@webority/mobile-core 0.148.0 → 0.150.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.
- package/lib/commonjs/api/baseUrl.js +1 -1
- package/lib/commonjs/api/contractCaller.js +1 -0
- package/lib/commonjs/api/curl.js +1 -1
- package/lib/commonjs/api/minAppVersion.js +1 -1
- package/lib/commonjs/api/requestDefaults.js +1 -1
- package/lib/commonjs/api/retry.js +1 -1
- package/lib/commonjs/api/tokenRefresh.js +1 -1
- package/lib/commonjs/api/userClient.js +1 -1
- package/lib/commonjs/api/workspace.js +1 -1
- package/lib/commonjs/auth/authStore.js +1 -1
- package/lib/commonjs/auth/jwt.js +1 -1
- package/lib/commonjs/deepLink/index.js +1 -1
- package/lib/commonjs/download/adapters/expoFs.js +1 -1
- package/lib/commonjs/download/index.js +1 -1
- package/lib/commonjs/errors/extractApiError.js +1 -1
- package/lib/commonjs/errors/index.js +1 -1
- package/lib/commonjs/errors/parseResponse.js +1 -0
- package/lib/commonjs/errors/requestPlatform.js +1 -0
- package/lib/commonjs/formatters/currency.js +1 -1
- package/lib/commonjs/formatters/date.js +1 -1
- package/lib/commonjs/formatters/dateMath.js +1 -1
- package/lib/commonjs/formatters/formatConfig.js +1 -1
- package/lib/commonjs/formatters/house.js +1 -1
- package/lib/commonjs/formatters/number.js +1 -1
- package/lib/commonjs/formatters/phone.js +1 -1
- package/lib/commonjs/geolocation/index.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/india/gstStates.js +1 -0
- package/lib/commonjs/india/index.js +1 -1
- package/lib/commonjs/logger/crashlytics.js +1 -1
- package/lib/commonjs/logger/index.js +1 -1
- package/lib/commonjs/logger/redact.js +1 -1
- package/lib/commonjs/network/networkStatus.js +1 -1
- package/lib/commonjs/outbox/outbox.js +1 -1
- package/lib/commonjs/push/broadcasts.js +1 -1
- package/lib/commonjs/push/push.js +1 -1
- package/lib/commonjs/query/apiBaseQuery.js +1 -1
- package/lib/commonjs/query/dataState.js +1 -0
- package/lib/commonjs/query/index.js +1 -1
- package/lib/commonjs/query/persistedQueries.js +1 -1
- package/lib/commonjs/query/tags.js +1 -1
- package/lib/commonjs/query/usePagedList.js +1 -1
- package/lib/commonjs/redux/errorToastMiddleware.js +1 -1
- package/lib/commonjs/redux/rootReducer.js +1 -1
- package/lib/commonjs/redux/sessionMiddleware.js +1 -1
- package/lib/commonjs/review/index.js +1 -1
- package/lib/commonjs/secureScreen/index.js +1 -1
- package/lib/commonjs/sqlite/index.js +1 -1
- package/lib/commonjs/storage/index.js +1 -1
- package/lib/commonjs/types/complete.js +1 -0
- package/lib/commonjs/types/formData.d.js +1 -0
- package/lib/commonjs/updates/updates.js +1 -1
- package/lib/commonjs/utils/base64.js +1 -1
- package/lib/commonjs/utils/guards.js +1 -0
- package/lib/commonjs/utils/imageCompression.js +1 -1
- package/lib/module/api/baseUrl.js +1 -1
- package/lib/module/api/contractCaller.js +1 -0
- package/lib/module/api/curl.js +1 -1
- package/lib/module/api/minAppVersion.js +1 -1
- package/lib/module/api/requestDefaults.js +1 -1
- package/lib/module/api/retry.js +1 -1
- package/lib/module/api/tokenRefresh.js +1 -1
- package/lib/module/api/userClient.js +1 -1
- package/lib/module/api/workspace.js +1 -1
- package/lib/module/auth/authStore.js +1 -1
- package/lib/module/auth/jwt.js +1 -1
- package/lib/module/deepLink/index.js +1 -1
- package/lib/module/download/adapters/expoFs.js +1 -1
- package/lib/module/download/index.js +1 -1
- package/lib/module/errors/extractApiError.js +1 -1
- package/lib/module/errors/index.js +1 -1
- package/lib/module/errors/parseResponse.js +1 -0
- package/lib/module/errors/requestPlatform.js +1 -0
- package/lib/module/formatters/currency.js +1 -1
- package/lib/module/formatters/date.js +1 -1
- package/lib/module/formatters/dateMath.js +1 -1
- package/lib/module/formatters/formatConfig.js +1 -1
- package/lib/module/formatters/house.js +1 -1
- package/lib/module/formatters/number.js +1 -1
- package/lib/module/formatters/phone.js +1 -1
- package/lib/module/geolocation/index.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/india/gstStates.js +1 -0
- package/lib/module/india/index.js +1 -1
- package/lib/module/logger/crashlytics.js +1 -1
- package/lib/module/logger/index.js +1 -1
- package/lib/module/logger/redact.js +1 -1
- package/lib/module/network/networkStatus.js +1 -1
- package/lib/module/outbox/outbox.js +1 -1
- package/lib/module/push/broadcasts.js +1 -1
- package/lib/module/push/push.js +1 -1
- package/lib/module/query/apiBaseQuery.js +1 -1
- package/lib/module/query/dataState.js +1 -0
- package/lib/module/query/index.js +1 -1
- package/lib/module/query/persistedQueries.js +1 -1
- package/lib/module/query/tags.js +1 -1
- package/lib/module/query/usePagedList.js +1 -1
- package/lib/module/redux/errorToastMiddleware.js +1 -1
- package/lib/module/redux/rootReducer.js +1 -1
- package/lib/module/redux/sessionMiddleware.js +1 -1
- package/lib/module/review/index.js +1 -1
- package/lib/module/secureScreen/index.js +1 -1
- package/lib/module/sqlite/index.js +1 -1
- package/lib/module/storage/index.js +1 -1
- package/lib/module/types/complete.js +1 -0
- package/lib/module/types/formData.d.js +1 -0
- package/lib/module/updates/updates.js +1 -1
- package/lib/module/utils/base64.js +1 -1
- package/lib/module/utils/guards.js +1 -0
- package/lib/module/utils/imageCompression.js +1 -1
- package/lib/typescript/commonjs/api/clientHeaders.d.ts +1 -1
- package/lib/typescript/commonjs/api/contractCaller.d.ts +7 -0
- package/lib/typescript/commonjs/api/fetchRetry.d.ts +3 -3
- package/lib/typescript/commonjs/api/minAppVersion.d.ts +1 -1
- package/lib/typescript/commonjs/api/retry.d.ts +11 -5
- package/lib/typescript/commonjs/api/tokenRefresh.d.ts +2 -1
- package/lib/typescript/commonjs/api/userClient.d.ts +11 -0
- package/lib/typescript/commonjs/api/workspace.d.ts +3 -3
- package/lib/typescript/commonjs/appLock/index.d.ts +1 -1
- package/lib/typescript/commonjs/attachments/index.d.ts +5 -5
- package/lib/typescript/commonjs/auth/authStore.d.ts +8 -6
- package/lib/typescript/commonjs/auth/jwt.d.ts +11 -8
- package/lib/typescript/commonjs/deepLink/index.d.ts +18 -11
- package/lib/typescript/commonjs/download/adapters/expoFs.d.ts +4 -4
- package/lib/typescript/commonjs/download/index.d.ts +16 -12
- package/lib/typescript/commonjs/errors/extractApiError.d.ts +5 -17
- package/lib/typescript/commonjs/errors/index.d.ts +2 -0
- package/lib/typescript/commonjs/errors/parseResponse.d.ts +20 -0
- package/lib/typescript/commonjs/errors/requestPlatform.d.ts +8 -0
- package/lib/typescript/commonjs/formatters/currency.d.ts +5 -5
- package/lib/typescript/commonjs/formatters/dateMath.d.ts +2 -2
- package/lib/typescript/commonjs/formatters/formatConfig.d.ts +8 -6
- package/lib/typescript/commonjs/formatters/house.d.ts +19 -20
- package/lib/typescript/commonjs/formatters/intlCache.d.ts +1 -3
- package/lib/typescript/commonjs/formatters/phone.d.ts +3 -3
- package/lib/typescript/commonjs/geolocation/adapters/expoLocation.d.ts +11 -11
- package/lib/typescript/commonjs/geolocation/index.d.ts +29 -26
- package/lib/typescript/commonjs/index.d.ts +5 -2
- package/lib/typescript/commonjs/india/gstStates.d.ts +8 -0
- package/lib/typescript/commonjs/india/gstStates.g.d.ts +1 -1
- package/lib/typescript/commonjs/india/index.d.ts +1 -0
- package/lib/typescript/commonjs/initSDK.d.ts +14 -14
- package/lib/typescript/commonjs/initUserAuth.d.ts +9 -8
- package/lib/typescript/commonjs/logger/crashlytics.d.ts +5 -4
- package/lib/typescript/commonjs/logger/index.d.ts +19 -19
- package/lib/typescript/commonjs/logger/redact.d.ts +3 -1
- package/lib/typescript/commonjs/metro/types.d.ts +4 -4
- package/lib/typescript/commonjs/network/networkStatus.d.ts +1 -1
- package/lib/typescript/commonjs/outbox/types.d.ts +6 -6
- package/lib/typescript/commonjs/permissions/index.d.ts +7 -4
- package/lib/typescript/commonjs/pickers/index.d.ts +18 -18
- package/lib/typescript/commonjs/push/push.d.ts +23 -23
- package/lib/typescript/commonjs/query/apiBaseQuery.d.ts +14 -14
- package/lib/typescript/commonjs/query/dataState.d.ts +58 -0
- package/lib/typescript/commonjs/query/index.d.ts +3 -1
- package/lib/typescript/commonjs/query/paging.d.ts +5 -5
- package/lib/typescript/commonjs/query/persistedQueries.d.ts +12 -7
- package/lib/typescript/commonjs/query/usePagedList.d.ts +9 -17
- package/lib/typescript/commonjs/redux/errorToastMiddleware.d.ts +4 -4
- package/lib/typescript/commonjs/redux/rootReducer.d.ts +1 -1
- package/lib/typescript/commonjs/review/index.d.ts +1 -1
- package/lib/typescript/commonjs/secureScreen/index.d.ts +1 -1
- package/lib/typescript/commonjs/share/index.d.ts +2 -2
- package/lib/typescript/commonjs/sqlite/index.d.ts +21 -16
- package/lib/typescript/commonjs/storage/index.d.ts +9 -9
- package/lib/typescript/commonjs/types/axios.d.ts +2 -2
- package/lib/typescript/commonjs/types/complete.d.ts +5 -0
- package/lib/typescript/commonjs/updates/updates.d.ts +20 -20
- package/lib/typescript/commonjs/utils/guards.d.ts +9 -0
- package/lib/typescript/commonjs/utils/imageCompression.d.ts +9 -9
- package/lib/typescript/commonjs/validators/index.d.ts +5 -5
- package/lib/typescript/commonjs/versionCheck/appBuild.d.ts +3 -2
- package/lib/typescript/commonjs/versionCheck/index.d.ts +4 -4
- package/lib/typescript/module/api/clientHeaders.d.ts +1 -1
- package/lib/typescript/module/api/contractCaller.d.ts +7 -0
- package/lib/typescript/module/api/fetchRetry.d.ts +3 -3
- package/lib/typescript/module/api/minAppVersion.d.ts +1 -1
- package/lib/typescript/module/api/retry.d.ts +11 -5
- package/lib/typescript/module/api/tokenRefresh.d.ts +2 -1
- package/lib/typescript/module/api/userClient.d.ts +11 -0
- package/lib/typescript/module/api/workspace.d.ts +3 -3
- package/lib/typescript/module/appLock/index.d.ts +1 -1
- package/lib/typescript/module/attachments/index.d.ts +5 -5
- package/lib/typescript/module/auth/authStore.d.ts +8 -6
- package/lib/typescript/module/auth/jwt.d.ts +11 -8
- package/lib/typescript/module/deepLink/index.d.ts +18 -11
- package/lib/typescript/module/download/adapters/expoFs.d.ts +4 -4
- package/lib/typescript/module/download/index.d.ts +16 -12
- package/lib/typescript/module/errors/extractApiError.d.ts +5 -17
- package/lib/typescript/module/errors/index.d.ts +2 -0
- package/lib/typescript/module/errors/parseResponse.d.ts +20 -0
- package/lib/typescript/module/errors/requestPlatform.d.ts +8 -0
- package/lib/typescript/module/formatters/currency.d.ts +5 -5
- package/lib/typescript/module/formatters/dateMath.d.ts +2 -2
- package/lib/typescript/module/formatters/formatConfig.d.ts +8 -6
- package/lib/typescript/module/formatters/house.d.ts +19 -20
- package/lib/typescript/module/formatters/intlCache.d.ts +1 -3
- package/lib/typescript/module/formatters/phone.d.ts +3 -3
- package/lib/typescript/module/geolocation/adapters/expoLocation.d.ts +11 -11
- package/lib/typescript/module/geolocation/index.d.ts +29 -26
- package/lib/typescript/module/index.d.ts +5 -2
- package/lib/typescript/module/india/gstStates.d.ts +8 -0
- package/lib/typescript/module/india/gstStates.g.d.ts +1 -1
- package/lib/typescript/module/india/index.d.ts +1 -0
- package/lib/typescript/module/initSDK.d.ts +14 -14
- package/lib/typescript/module/initUserAuth.d.ts +9 -8
- package/lib/typescript/module/logger/crashlytics.d.ts +5 -4
- package/lib/typescript/module/logger/index.d.ts +19 -19
- package/lib/typescript/module/logger/redact.d.ts +3 -1
- package/lib/typescript/module/metro/types.d.ts +4 -4
- package/lib/typescript/module/network/networkStatus.d.ts +1 -1
- package/lib/typescript/module/outbox/types.d.ts +6 -6
- package/lib/typescript/module/permissions/index.d.ts +7 -4
- package/lib/typescript/module/pickers/index.d.ts +18 -18
- package/lib/typescript/module/push/push.d.ts +23 -23
- package/lib/typescript/module/query/apiBaseQuery.d.ts +14 -14
- package/lib/typescript/module/query/dataState.d.ts +58 -0
- package/lib/typescript/module/query/index.d.ts +3 -1
- package/lib/typescript/module/query/paging.d.ts +5 -5
- package/lib/typescript/module/query/persistedQueries.d.ts +12 -7
- package/lib/typescript/module/query/usePagedList.d.ts +9 -17
- package/lib/typescript/module/redux/errorToastMiddleware.d.ts +4 -4
- package/lib/typescript/module/redux/rootReducer.d.ts +1 -1
- package/lib/typescript/module/review/index.d.ts +1 -1
- package/lib/typescript/module/secureScreen/index.d.ts +1 -1
- package/lib/typescript/module/share/index.d.ts +2 -2
- package/lib/typescript/module/sqlite/index.d.ts +21 -16
- package/lib/typescript/module/storage/index.d.ts +9 -9
- package/lib/typescript/module/types/axios.d.ts +2 -2
- package/lib/typescript/module/types/complete.d.ts +5 -0
- package/lib/typescript/module/updates/updates.d.ts +20 -20
- package/lib/typescript/module/utils/guards.d.ts +9 -0
- package/lib/typescript/module/utils/imageCompression.d.ts +9 -9
- package/lib/typescript/module/validators/index.d.ts +5 -5
- package/lib/typescript/module/versionCheck/appBuild.d.ts +3 -2
- package/lib/typescript/module/versionCheck/index.d.ts +4 -4
- package/package.json +3 -2
- package/src/specs/NativeSmsRetriever.ts +1 -1
|
@@ -2,14 +2,14 @@ import "axios";
|
|
|
2
2
|
declare module "axios" {
|
|
3
3
|
interface AxiosRequestConfig {
|
|
4
4
|
/** When true, the library's response-error interceptors do not log this request's failure. */
|
|
5
|
-
skipErrorLog?: boolean;
|
|
5
|
+
skipErrorLog?: boolean | undefined;
|
|
6
6
|
/**
|
|
7
7
|
* The request ends the current session and answers with a new one in the refresh
|
|
8
8
|
* response's shape (a workspace switch, a reissue after a security change). userClient
|
|
9
9
|
* stores those tokens before the response resolves, and a request refused meanwhile for
|
|
10
10
|
* the old session waits for them and is sent again instead of ending the session.
|
|
11
11
|
*/
|
|
12
|
-
replacesSession?: boolean;
|
|
12
|
+
replacesSession?: boolean | undefined;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=axios.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** T with every key present and no value undefined: the shape of a defaults object. `Required<T>` keeps `| undefined` on a `key?: V | undefined` property, so it cannot say this. */
|
|
2
|
+
export type Complete<T> = {
|
|
3
|
+
[K in keyof T]-?: Exclude<T[K], undefined>;
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=complete.d.ts.map
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
export declare const OTA_LAST_LAUNCH_KEY = "@webority/ota/last-launch";
|
|
3
3
|
export declare const DEFAULT_MIN_CHECK_INTERVAL_MS: number;
|
|
4
4
|
interface ManifestLike {
|
|
5
|
-
id?: string;
|
|
5
|
+
id?: string | undefined;
|
|
6
6
|
extra?: {
|
|
7
7
|
webority?: {
|
|
8
|
-
appIdentifier?: string | null;
|
|
9
|
-
} | null;
|
|
10
|
-
} | null;
|
|
8
|
+
appIdentifier?: string | null | undefined;
|
|
9
|
+
} | null | undefined;
|
|
10
|
+
} | null | undefined;
|
|
11
11
|
}
|
|
12
12
|
interface StateContextLike {
|
|
13
|
-
isChecking?: boolean;
|
|
14
|
-
isDownloading?: boolean;
|
|
15
|
-
isUpdatePending?: boolean;
|
|
16
|
-
latestManifest?: ManifestLike;
|
|
17
|
-
downloadedManifest?: ManifestLike;
|
|
18
|
-
checkError?: Error;
|
|
19
|
-
downloadError?: Error;
|
|
13
|
+
isChecking?: boolean | undefined;
|
|
14
|
+
isDownloading?: boolean | undefined;
|
|
15
|
+
isUpdatePending?: boolean | undefined;
|
|
16
|
+
latestManifest?: ManifestLike | undefined;
|
|
17
|
+
downloadedManifest?: ManifestLike | undefined;
|
|
18
|
+
checkError?: Error | undefined;
|
|
19
|
+
downloadError?: Error | undefined;
|
|
20
20
|
}
|
|
21
21
|
/** The slice of expo-updates this module calls, so the optional peer stays untyped at build. */
|
|
22
22
|
export interface UpdatesModuleLike {
|
|
@@ -24,26 +24,26 @@ export interface UpdatesModuleLike {
|
|
|
24
24
|
isEmbeddedLaunch: boolean;
|
|
25
25
|
updateId: string | null;
|
|
26
26
|
runtimeVersion: string | null;
|
|
27
|
-
channel?: string | null;
|
|
28
|
-
isEmergencyLaunch?: boolean;
|
|
29
|
-
emergencyLaunchReason?: string | null;
|
|
27
|
+
channel?: string | null | undefined;
|
|
28
|
+
isEmergencyLaunch?: boolean | undefined;
|
|
29
|
+
emergencyLaunchReason?: string | null | undefined;
|
|
30
30
|
checkAutomatically: string | null;
|
|
31
31
|
manifest: ManifestLike | null | undefined;
|
|
32
32
|
checkForUpdateAsync: () => Promise<{
|
|
33
33
|
isAvailable: boolean;
|
|
34
34
|
isRollBackToEmbedded: boolean;
|
|
35
|
-
manifest?: ManifestLike;
|
|
35
|
+
manifest?: ManifestLike | undefined;
|
|
36
36
|
}>;
|
|
37
37
|
fetchUpdateAsync: () => Promise<{
|
|
38
38
|
isNew: boolean;
|
|
39
39
|
isRollBackToEmbedded: boolean;
|
|
40
40
|
}>;
|
|
41
41
|
reloadAsync: () => Promise<void>;
|
|
42
|
-
addUpdatesStateChangeListener?: (listener: (event: {
|
|
42
|
+
addUpdatesStateChangeListener?: ((listener: (event: {
|
|
43
43
|
context: StateContextLike;
|
|
44
44
|
}) => void) => {
|
|
45
45
|
remove: () => void;
|
|
46
|
-
};
|
|
46
|
+
}) | undefined;
|
|
47
47
|
}
|
|
48
48
|
export interface OtaUpdatesConfig {
|
|
49
49
|
/**
|
|
@@ -55,11 +55,11 @@ export interface OtaUpdatesConfig {
|
|
|
55
55
|
* The app's own identity, compared with the identity stamped into every served update. Defaults
|
|
56
56
|
* to `appId` from `setConfig`, the base package name / bundle id from the compiled settings.
|
|
57
57
|
*/
|
|
58
|
-
appIdentifier?: string;
|
|
58
|
+
appIdentifier?: string | undefined;
|
|
59
59
|
/** Check again each time the app returns to the foreground. Default true. */
|
|
60
|
-
checkOnForeground?: boolean;
|
|
60
|
+
checkOnForeground?: boolean | undefined;
|
|
61
61
|
/** The shortest gap between two checks this module starts, in milliseconds. Default 15 minutes. */
|
|
62
|
-
minCheckIntervalMs?: number;
|
|
62
|
+
minCheckIntervalMs?: number | undefined;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* `unavailable`: OTA is off in this build (a debug build, or expo-updates not installed).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** True when value is one of the listed values; narrows value to the list's member type. */
|
|
2
|
+
export declare function isOneOf<const T>(list: readonly T[], value: unknown): value is T;
|
|
3
|
+
/** True when key is an own key of the object; narrows key to the object's key type. */
|
|
4
|
+
export declare function hasKey<O extends object>(object: O, key: PropertyKey): key is keyof O;
|
|
5
|
+
/** True for a plain object value (not null, not an array). */
|
|
6
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
7
|
+
/** The object's own keys, each checked by hasKey, typed as the object's keys. */
|
|
8
|
+
export declare function keysOf<O extends object>(object: O): (keyof O)[];
|
|
9
|
+
//# sourceMappingURL=guards.d.ts.map
|
|
@@ -34,36 +34,36 @@
|
|
|
34
34
|
export type ImageOutputFormat = "jpg" | "png" | "webp";
|
|
35
35
|
export interface CompressImageOptions {
|
|
36
36
|
/** Bound on the LONGER side in pixels; never enlarges. Defaults to 1500. */
|
|
37
|
-
maxSize?: number;
|
|
37
|
+
maxSize?: number | undefined;
|
|
38
38
|
/**
|
|
39
39
|
* JPEG/WebP quality, 0 to 1. Overrides the size-based quality ladder. PNG
|
|
40
40
|
* is lossless and ignores it.
|
|
41
41
|
*/
|
|
42
|
-
quality?: number;
|
|
42
|
+
quality?: number | undefined;
|
|
43
43
|
/** Output format. Defaults to `'jpg'`. */
|
|
44
|
-
output?: ImageOutputFormat;
|
|
44
|
+
output?: ImageOutputFormat | undefined;
|
|
45
45
|
/**
|
|
46
46
|
* Byte size of the source as the picker reported it. Only a HINT for the
|
|
47
47
|
* quality ladder when the file cannot be measured (an Android `content://`
|
|
48
48
|
* URI); a measurable file is measured, because the picker's number can be
|
|
49
49
|
* stale by the time this runs.
|
|
50
50
|
*/
|
|
51
|
-
fileSize?: number;
|
|
51
|
+
fileSize?: number | undefined;
|
|
52
52
|
/**
|
|
53
53
|
* Byte ceiling for the output (an API's upload limit). Quality is stepped
|
|
54
54
|
* down to `minQuality`, then the size is stepped down, until the output
|
|
55
55
|
* fits. Best effort: the result's `size` says whether it did.
|
|
56
56
|
*/
|
|
57
|
-
maxBytes?: number;
|
|
57
|
+
maxBytes?: number | undefined;
|
|
58
58
|
/** Lowest quality the `maxBytes` ladder may reach. Defaults to 0.4. */
|
|
59
|
-
minQuality?: number;
|
|
59
|
+
minQuality?: number | undefined;
|
|
60
60
|
/**
|
|
61
61
|
* Base name for the output file (any extension is replaced by the output
|
|
62
62
|
* format's). Defaults to the source's own name, or `image`. A picked photo
|
|
63
63
|
* has no useful name of its own; a list of twelve documents all called
|
|
64
64
|
* `image.jpg` is unreadable.
|
|
65
65
|
*/
|
|
66
|
-
name?: string;
|
|
66
|
+
name?: string | undefined;
|
|
67
67
|
}
|
|
68
68
|
export interface CompressedImage {
|
|
69
69
|
/** Local URI of the file to upload. */
|
|
@@ -104,8 +104,8 @@ export interface ImageFileStat {
|
|
|
104
104
|
}
|
|
105
105
|
export interface EncodeOptions {
|
|
106
106
|
/** Target size; one side only, the other follows the aspect ratio. Omit both to keep the size. */
|
|
107
|
-
width?: number;
|
|
108
|
-
height?: number;
|
|
107
|
+
width?: number | undefined;
|
|
108
|
+
height?: number | undefined;
|
|
109
109
|
quality: number;
|
|
110
110
|
format: "jpeg" | "png" | "webp";
|
|
111
111
|
}
|
|
@@ -17,11 +17,11 @@ export declare const isNumeric: (value: unknown) => boolean;
|
|
|
17
17
|
export declare const isInteger: (value: unknown) => boolean;
|
|
18
18
|
export declare const isAlphanumeric: (value: unknown) => boolean;
|
|
19
19
|
export interface PasswordRules {
|
|
20
|
-
minLength?: number;
|
|
21
|
-
requireUppercase?: boolean;
|
|
22
|
-
requireLowercase?: boolean;
|
|
23
|
-
requireNumber?: boolean;
|
|
24
|
-
requireSymbol?: boolean;
|
|
20
|
+
minLength?: number | undefined;
|
|
21
|
+
requireUppercase?: boolean | undefined;
|
|
22
|
+
requireLowercase?: boolean | undefined;
|
|
23
|
+
requireNumber?: boolean | undefined;
|
|
24
|
+
requireSymbol?: boolean | undefined;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Common password complexity check. Defaults to 8+ chars,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Complete } from "../types/complete";
|
|
1
2
|
/**
|
|
2
3
|
* Minimal device-info shape we depend on.
|
|
3
4
|
*
|
|
@@ -11,14 +12,14 @@
|
|
|
11
12
|
export interface DeviceInfoLike {
|
|
12
13
|
getBundleId: () => string;
|
|
13
14
|
getVersion: () => string;
|
|
14
|
-
getBuildNumber?: () => string;
|
|
15
|
+
getBuildNumber?: (() => string) | undefined;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* expo-application, read at call time: its values are module CONSTANTS, and
|
|
18
19
|
* capturing them here would snapshot them before the native module has
|
|
19
20
|
* initialised. Config still wins over this.
|
|
20
21
|
*/
|
|
21
|
-
export declare const expoApplicationBackend:
|
|
22
|
+
export declare const expoApplicationBackend: Complete<DeviceInfoLike>;
|
|
22
23
|
export declare const setDeviceInfo: (impl: DeviceInfoLike | null) => void;
|
|
23
24
|
export declare const getDeviceInfo: () => DeviceInfoLike | null;
|
|
24
25
|
/**
|
|
@@ -23,18 +23,18 @@ export interface ParsedVersion {
|
|
|
23
23
|
/** @deprecated The store is no longer read; the minimum comes from `Min-App-Version`. */
|
|
24
24
|
export interface VersionData {
|
|
25
25
|
version: string | null;
|
|
26
|
-
released?: string | null;
|
|
27
|
-
releasedAt?: string;
|
|
26
|
+
released?: string | null | undefined;
|
|
27
|
+
releasedAt?: string | undefined;
|
|
28
28
|
notes: string;
|
|
29
29
|
url: string | null;
|
|
30
|
-
country?: string;
|
|
30
|
+
country?: string | undefined;
|
|
31
31
|
lastChecked: string;
|
|
32
32
|
}
|
|
33
33
|
/** @deprecated The store is no longer read; the minimum comes from `Min-App-Version`. */
|
|
34
34
|
export interface VersionComparison {
|
|
35
35
|
needsUpdate: boolean;
|
|
36
36
|
updateType: UpdateType;
|
|
37
|
-
notice?: string;
|
|
37
|
+
notice?: string | undefined;
|
|
38
38
|
}
|
|
39
39
|
export interface VersionCheckResult {
|
|
40
40
|
isNewVersionAvailable: boolean;
|
|
@@ -33,7 +33,7 @@ export interface AccountStampedConfig {
|
|
|
33
33
|
set: (name: string, value: string) => unknown;
|
|
34
34
|
};
|
|
35
35
|
/** The workspace the request was made in; `null` when it named none, unset until first sent. */
|
|
36
|
-
_accountId?: string | null;
|
|
36
|
+
_accountId?: string | null | undefined;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Stamps Account-Id once, on the first send, and records it on the config. A request must
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type OperationEntry, type OperationShape } from "@webority/api-contract/call";
|
|
2
|
+
import type { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
3
|
+
export type ContractCaller<TOperations extends {
|
|
4
|
+
readonly [K in keyof TOperations]: OperationShape;
|
|
5
|
+
}> = <TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?: Pick<AxiosRequestConfig, "signal" | "timeout">) => Promise<TOperations[TId]["response"]>;
|
|
6
|
+
export declare const createContractCaller: <TOperations extends { readonly [K in keyof TOperations]: OperationShape; }>(client: AxiosInstance, operations: { readonly [K in keyof TOperations & string]: OperationEntry; }) => ContractCaller<TOperations>;
|
|
7
|
+
//# sourceMappingURL=contractCaller.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export interface FetchRetryPolicy {
|
|
2
2
|
/** Resends after the first attempt; 0 turns retrying off. */
|
|
3
|
-
retries?: number;
|
|
3
|
+
retries?: number | undefined;
|
|
4
4
|
/** `attempt` is 1-based: 1 is the first resend. */
|
|
5
|
-
retryDelayMs?: (attempt: number) => number;
|
|
5
|
+
retryDelayMs?: ((attempt: number) => number) | undefined;
|
|
6
6
|
/** Treat this request as a read: it changes nothing on the server, so it is resent like a GET. */
|
|
7
|
-
sideEffectFree?: boolean;
|
|
7
|
+
sideEffectFree?: boolean | undefined;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* A write is resent only under the shared rule in retry.ts. A rejection that is not a TypeError is thrown at once, not retried.
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { type AxiosError, type AxiosInstance, type GenericAbortSignal } from "axios";
|
|
2
2
|
export interface RetryPolicy {
|
|
3
|
-
retries?: number;
|
|
3
|
+
retries?: number | undefined;
|
|
4
4
|
/** `attempt` is 1-based: 1 is the first retry, not the original request. */
|
|
5
|
-
retryDelayMs?: (attempt: number) => number;
|
|
6
|
-
shouldRetry?: (error: AxiosError) => boolean;
|
|
7
|
-
onRetry?: (attempt: number, error: AxiosError) => void;
|
|
5
|
+
retryDelayMs?: ((attempt: number) => number) | undefined;
|
|
6
|
+
shouldRetry?: ((error: AxiosError) => boolean) | undefined;
|
|
7
|
+
onRetry?: ((attempt: number, error: AxiosError) => void) | undefined;
|
|
8
8
|
}
|
|
9
9
|
declare module "axios" {
|
|
10
10
|
interface AxiosRequestConfig {
|
|
11
11
|
/** `false` opts a single request out of retrying; an object overrides the client policy. */
|
|
12
|
-
retry?: boolean | RetryPolicy;
|
|
12
|
+
retry?: boolean | RetryPolicy | undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
declare module "axios" {
|
|
16
|
+
interface InternalAxiosRequestConfig {
|
|
17
|
+
__retryAttempt?: number | undefined;
|
|
18
|
+
__retryStartedAt?: number | undefined;
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
@@ -22,7 +22,8 @@ export interface RefreshableStore {
|
|
|
22
22
|
export declare class SessionEndedError extends Error {
|
|
23
23
|
constructor(message: string);
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
/** Pass `null` to detach the store, as a test's teardown does. */
|
|
26
|
+
export declare const injectStore: (nextStore: RefreshableStore | null) => void;
|
|
26
27
|
export declare const injectUserAuth: (options: UserAuthOptions) => void;
|
|
27
28
|
/**
|
|
28
29
|
* Clear any in-flight token refresh and reject everything queued behind it.
|
|
@@ -11,6 +11,17 @@ export { injectStore, injectUserAuth, resetRefreshState, SESSION_EXPIRED_CODE, S
|
|
|
11
11
|
export declare class RequestOfflineError extends Error {
|
|
12
12
|
constructor(message?: string);
|
|
13
13
|
}
|
|
14
|
+
declare module "axios" {
|
|
15
|
+
interface InternalAxiosRequestConfig {
|
|
16
|
+
_retry?: boolean | undefined;
|
|
17
|
+
/** Replayed once because the session changed while it was in flight; never replayed for that again. */
|
|
18
|
+
_replayedWithCurrentToken?: boolean | undefined;
|
|
19
|
+
/** Closes the session-replacement window a `replacesSession` request opened. */
|
|
20
|
+
_endReplacement?: (() => void) | undefined;
|
|
21
|
+
_accountId?: string | null | undefined;
|
|
22
|
+
_transformGuarded?: boolean | undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
14
25
|
declare const userClient: AxiosInstance;
|
|
15
26
|
export default userClient;
|
|
16
27
|
//# sourceMappingURL=userClient.d.ts.map
|
|
@@ -18,11 +18,11 @@ interface WorkspaceChangedResponse {
|
|
|
18
18
|
export declare class WorkspaceChangedError extends Error {
|
|
19
19
|
readonly code = "workspace_changed";
|
|
20
20
|
readonly response: WorkspaceChangedResponse;
|
|
21
|
-
readonly config?: InternalAxiosRequestConfig;
|
|
21
|
+
readonly config?: InternalAxiosRequestConfig | undefined;
|
|
22
22
|
readonly cause?: unknown;
|
|
23
23
|
constructor(message?: string, options?: {
|
|
24
|
-
response?: WorkspaceChangedResponse;
|
|
25
|
-
config?: InternalAxiosRequestConfig;
|
|
24
|
+
response?: WorkspaceChangedResponse | undefined;
|
|
25
|
+
config?: InternalAxiosRequestConfig | undefined;
|
|
26
26
|
cause?: unknown;
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -32,6 +32,6 @@ export declare function authenticateBiometric(reason: string): Promise<AppLockRe
|
|
|
32
32
|
*/
|
|
33
33
|
export declare function useAppLock({ active, policy }: {
|
|
34
34
|
active: boolean;
|
|
35
|
-
policy?: Partial<AppLockPolicy
|
|
35
|
+
policy?: Partial<AppLockPolicy> | undefined;
|
|
36
36
|
}): AppLockState;
|
|
37
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -7,7 +7,7 @@ export declare const mimeTypeFromFileName: (fileName: string | null | undefined)
|
|
|
7
7
|
export interface AttachmentRequest {
|
|
8
8
|
url: string;
|
|
9
9
|
fileName: string;
|
|
10
|
-
mimeType?: string | null;
|
|
10
|
+
mimeType?: string | null | undefined;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Fetches a file through the signed-in client into the app's cache, where a viewer or a save reads it. Answers with
|
|
@@ -16,7 +16,7 @@ export interface AttachmentRequest {
|
|
|
16
16
|
export declare const fetchAttachment: ({ url, fileName, mimeType }: AttachmentRequest) => Promise<DownloadResult>;
|
|
17
17
|
export interface PreviewAttachment {
|
|
18
18
|
path: string;
|
|
19
|
-
mimeType?: string;
|
|
19
|
+
mimeType?: string | undefined;
|
|
20
20
|
folder: string;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -26,12 +26,12 @@ export interface PreviewAttachment {
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const fetchPreviewAttachment: ({ cacheId, version, url, fileName, mimeType, }: AttachmentRequest & {
|
|
28
28
|
cacheId: string;
|
|
29
|
-
version?: string | null;
|
|
29
|
+
version?: string | null | undefined;
|
|
30
30
|
}) => Promise<PreviewAttachment | DownloadResult>;
|
|
31
31
|
export type PreviewKind = "image" | "pdf";
|
|
32
32
|
/** What the app can show itself, from a content type or a file name: "image", "pdf", or null for anything else. */
|
|
33
33
|
export declare const previewKind: (file: {
|
|
34
|
-
contentType?: string | null;
|
|
35
|
-
name?: string | null;
|
|
34
|
+
contentType?: string | null | undefined;
|
|
35
|
+
name?: string | null | undefined;
|
|
36
36
|
}) => PreviewKind | null;
|
|
37
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -51,7 +51,7 @@ export interface LegacyTokenKeys {
|
|
|
51
51
|
accessToken: string;
|
|
52
52
|
refreshToken: string;
|
|
53
53
|
/** The old key of the signed-in user's profile snapshot, if the app kept one. */
|
|
54
|
-
sessionUser?: string;
|
|
54
|
+
sessionUser?: string | undefined;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* The expiry given to a migrated refresh token whose expiry the old store never kept and which
|
|
@@ -93,13 +93,13 @@ interface SecureCredentials {
|
|
|
93
93
|
}
|
|
94
94
|
interface KeychainLike {
|
|
95
95
|
setGenericPassword: (username: string, password: string, options?: {
|
|
96
|
-
service?: string;
|
|
96
|
+
service?: string | undefined;
|
|
97
97
|
}) => Promise<unknown>;
|
|
98
98
|
getGenericPassword: (options?: {
|
|
99
|
-
service?: string;
|
|
99
|
+
service?: string | undefined;
|
|
100
100
|
}) => Promise<SecureCredentials | false>;
|
|
101
101
|
resetGenericPassword: (options?: {
|
|
102
|
-
service?: string;
|
|
102
|
+
service?: string | undefined;
|
|
103
103
|
}) => Promise<unknown>;
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
@@ -113,7 +113,9 @@ export declare const setKeychainImplementation: (impl: KeychainLike | null) => v
|
|
|
113
113
|
*/
|
|
114
114
|
export declare const storeToken: (key: string, token: string, expiry: string) => Promise<void>;
|
|
115
115
|
/**
|
|
116
|
-
* Retrieve token and check if expired.
|
|
116
|
+
* Retrieve token and check if expired. Rejects when the store cannot be read
|
|
117
|
+
* (other than an invalidated key, which is cleared and read as no token), and
|
|
118
|
+
* when a legacy session move fails.
|
|
117
119
|
*/
|
|
118
120
|
export declare const getToken: (key: string) => Promise<StoredToken | null>;
|
|
119
121
|
/**
|
|
@@ -130,7 +132,7 @@ export declare const storeSessionUser: <T>(user: T) => Promise<void>;
|
|
|
130
132
|
* The stored user, or null. An unreadable snapshot is removed and reported,
|
|
131
133
|
* but does not end the session: it is a cache the next profile fetch refills.
|
|
132
134
|
*/
|
|
133
|
-
export declare const getSessionUser: <T>() => Promise<T | null>;
|
|
135
|
+
export declare const getSessionUser: <T>(parse: (value: unknown) => T) => Promise<T | null>;
|
|
134
136
|
export declare const removeSessionUser: () => Promise<void>;
|
|
135
137
|
/** Set by `initUserAuth({ legacyKeys })`; `null` turns the migration off. */
|
|
136
138
|
export declare const setLegacyTokenKeys: (keys: LegacyTokenKeys | null) => void;
|
|
@@ -3,20 +3,23 @@
|
|
|
3
3
|
* `sub`, `exp`, `iat`, `nbf` follow RFC 7519 conventions.
|
|
4
4
|
*/
|
|
5
5
|
export interface JwtClaims {
|
|
6
|
-
sub?: string;
|
|
7
|
-
exp?: number;
|
|
8
|
-
iat?: number;
|
|
9
|
-
nbf?: number;
|
|
10
|
-
iss?: string;
|
|
11
|
-
aud?: string | string[];
|
|
6
|
+
sub?: string | undefined;
|
|
7
|
+
exp?: number | undefined;
|
|
8
|
+
iat?: number | undefined;
|
|
9
|
+
nbf?: number | undefined;
|
|
10
|
+
iss?: string | undefined;
|
|
11
|
+
aud?: string | string[] | undefined;
|
|
12
12
|
[key: string]: unknown;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Decode a JWT's payload claims. Does **not** verify the signature.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* Without `parse`, returns the claims. With `parse`, returns what `parse` builds from them; a throw from `parse` propagates.
|
|
18
|
+
*
|
|
19
|
+
* @returns claims (or the value `parse` returns) on success, `null` if the token is malformed or a standard claim has the wrong type.
|
|
18
20
|
*/
|
|
19
|
-
export declare
|
|
21
|
+
export declare function decodeJWT(token: string): JwtClaims | null;
|
|
22
|
+
export declare function decodeJWT<T>(token: string, parse: (claims: JwtClaims) => T): T | null;
|
|
20
23
|
/**
|
|
21
24
|
* Returns true when the token is expired (or unparseable / missing `exp`).
|
|
22
25
|
*
|
|
@@ -18,31 +18,37 @@ export interface ParsedLink {
|
|
|
18
18
|
export interface DeepLinkRoute {
|
|
19
19
|
/** A path pattern with `:param` segments (`order/:id`), or a RegExp on `path`. */
|
|
20
20
|
match: string | RegExp;
|
|
21
|
-
requiresAuth?: boolean;
|
|
21
|
+
requiresAuth?: boolean | undefined;
|
|
22
22
|
handler: (link: ParsedLink, params: Record<string, string>) => void;
|
|
23
23
|
}
|
|
24
24
|
export interface DeepLinkConfig {
|
|
25
25
|
routes: DeepLinkRoute[];
|
|
26
26
|
/** Navigator readiness. Links arriving before this is true are queued. */
|
|
27
|
-
isReady?: () => boolean;
|
|
28
|
-
isAuthenticated?: () => boolean;
|
|
27
|
+
isReady?: (() => boolean) | undefined;
|
|
28
|
+
isAuthenticated?: (() => boolean) | undefined;
|
|
29
29
|
/** Called when an auth-gated link is stashed; the app sends the user to login. */
|
|
30
|
-
onUnauthenticated?: (link: ParsedLink) => void;
|
|
31
|
-
onUnmatched?: (link: ParsedLink) => void;
|
|
30
|
+
onUnauthenticated?: ((link: ParsedLink) => void) | undefined;
|
|
31
|
+
onUnmatched?: ((link: ParsedLink) => void) | undefined;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Parse a deep-link URL. Returns null for anything that is not a usable URL so
|
|
35
35
|
* a hostile or truncated link can never throw on the native event path.
|
|
36
36
|
*/
|
|
37
37
|
export declare const parseDeepLink: (url: string) => ParsedLink | null;
|
|
38
|
+
declare const flushPending: () => void;
|
|
39
|
+
declare const configure: (next: DeepLinkConfig) => void;
|
|
40
|
+
declare const handleUrl: (url: string) => void;
|
|
41
|
+
declare const start: () => Promise<void>;
|
|
42
|
+
declare const stop: () => void;
|
|
43
|
+
declare const setReady: (ready: boolean) => void;
|
|
38
44
|
export declare const DeepLink: {
|
|
39
|
-
configure:
|
|
40
|
-
start:
|
|
41
|
-
stop:
|
|
42
|
-
handleUrl:
|
|
43
|
-
setReady:
|
|
45
|
+
configure: typeof configure;
|
|
46
|
+
start: typeof start;
|
|
47
|
+
stop: typeof stop;
|
|
48
|
+
handleUrl: typeof handleUrl;
|
|
49
|
+
setReady: typeof setReady;
|
|
44
50
|
/** Replay the stashed link, once. Call after a successful login. */
|
|
45
|
-
replayPending:
|
|
51
|
+
replayPending: typeof flushPending;
|
|
46
52
|
getPending: () => ParsedLink | null;
|
|
47
53
|
};
|
|
48
54
|
/**
|
|
@@ -51,4 +57,5 @@ export declare const DeepLink: {
|
|
|
51
57
|
* not tear down and re-subscribe the native listener.
|
|
52
58
|
*/
|
|
53
59
|
export declare const useDeepLink: (deepLinkConfig: DeepLinkConfig) => void;
|
|
60
|
+
export {};
|
|
54
61
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -12,8 +12,8 @@ interface ExpoFileLike {
|
|
|
12
12
|
readonly exists: boolean;
|
|
13
13
|
readonly size: number;
|
|
14
14
|
create: (options?: {
|
|
15
|
-
intermediates?: boolean;
|
|
16
|
-
overwrite?: boolean;
|
|
15
|
+
intermediates?: boolean | undefined;
|
|
16
|
+
overwrite?: boolean | undefined;
|
|
17
17
|
}) => void;
|
|
18
18
|
write: (content: Uint8Array) => Promise<void>;
|
|
19
19
|
delete: () => void;
|
|
@@ -21,8 +21,8 @@ interface ExpoFileLike {
|
|
|
21
21
|
interface ExpoDirectoryLike {
|
|
22
22
|
readonly uri: string;
|
|
23
23
|
create: (options?: {
|
|
24
|
-
intermediates?: boolean;
|
|
25
|
-
idempotent?: boolean;
|
|
24
|
+
intermediates?: boolean | undefined;
|
|
25
|
+
idempotent?: boolean | undefined;
|
|
26
26
|
}) => void;
|
|
27
27
|
}
|
|
28
28
|
export interface ExpoFileSystemModuleLike {
|
|
@@ -18,6 +18,10 @@ export interface FileSystemLike {
|
|
|
18
18
|
unlink: (path: string) => Promise<void>;
|
|
19
19
|
mkdir: (path: string) => Promise<void>;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Built by downloadFile and handed to the client, never written by an app: its optional keys are absent rather
|
|
23
|
+
* than undefined, so an axios instance (whose config refuses an explicit undefined) satisfies DownloadHttpClient.
|
|
24
|
+
*/
|
|
21
25
|
export interface DownloadHttpRequestConfig {
|
|
22
26
|
headers?: Record<string, string>;
|
|
23
27
|
responseType: "arraybuffer";
|
|
@@ -25,7 +29,7 @@ export interface DownloadHttpRequestConfig {
|
|
|
25
29
|
signal?: AbortSignal;
|
|
26
30
|
onDownloadProgress?: (event: {
|
|
27
31
|
loaded: number;
|
|
28
|
-
total?: number;
|
|
32
|
+
total?: number | undefined;
|
|
29
33
|
}) => void;
|
|
30
34
|
}
|
|
31
35
|
/**
|
|
@@ -36,8 +40,8 @@ export interface DownloadHttpRequestConfig {
|
|
|
36
40
|
* mobile-support's client is, so no axios type leaks into the declarations.
|
|
37
41
|
*/
|
|
38
42
|
export interface DownloadHttpClient {
|
|
39
|
-
get
|
|
40
|
-
data:
|
|
43
|
+
get(url: string, config?: DownloadHttpRequestConfig): Promise<{
|
|
44
|
+
data: unknown;
|
|
41
45
|
}>;
|
|
42
46
|
}
|
|
43
47
|
export type DownloadDestination = "documents" | "cache" | "downloads";
|
|
@@ -45,25 +49,25 @@ export interface DownloadOptions {
|
|
|
45
49
|
/** Sends the request: `userClient` for a signed-in download, `publicClient` for an open one. */
|
|
46
50
|
client: DownloadHttpClient;
|
|
47
51
|
url: string;
|
|
48
|
-
fileName?: string;
|
|
49
|
-
destination?: DownloadDestination;
|
|
52
|
+
fileName?: string | undefined;
|
|
53
|
+
destination?: DownloadDestination | undefined;
|
|
50
54
|
/** Sent with the request, beside whatever the client adds itself. */
|
|
51
|
-
headers?: Record<string, string
|
|
52
|
-
mimeType?: string;
|
|
53
|
-
onProgress?: (received: number, total: number, fraction: number) => void;
|
|
54
|
-
overwrite?: boolean;
|
|
55
|
-
signal?: AbortSignal;
|
|
55
|
+
headers?: Record<string, string> | undefined;
|
|
56
|
+
mimeType?: string | undefined;
|
|
57
|
+
onProgress?: ((received: number, total: number, fraction: number) => void) | undefined;
|
|
58
|
+
overwrite?: boolean | undefined;
|
|
59
|
+
signal?: AbortSignal | undefined;
|
|
56
60
|
}
|
|
57
61
|
export interface DownloadResult {
|
|
58
62
|
path: string;
|
|
59
63
|
bytes: number;
|
|
60
|
-
mimeType?: string;
|
|
64
|
+
mimeType?: string | undefined;
|
|
61
65
|
fromCache: boolean;
|
|
62
66
|
}
|
|
63
67
|
export type DownloadErrorCode = "unsupported" | "permission-denied" | "network" | "http-error" | "write-failed" | "aborted" | "empty-file";
|
|
64
68
|
export declare class DownloadError extends Error {
|
|
65
69
|
readonly code: DownloadErrorCode;
|
|
66
|
-
readonly status?: number;
|
|
70
|
+
readonly status?: number | undefined;
|
|
67
71
|
constructor(code: DownloadErrorCode, message: string, status?: number);
|
|
68
72
|
}
|
|
69
73
|
/**
|