@webority/mobile-core 0.149.0 → 0.152.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/README.md +47 -0
- 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/jest/setup.js +1 -0
- 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/outbox/types.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/entityVersion.js +1 -0
- package/lib/commonjs/query/index.js +1 -1
- package/lib/commonjs/query/paging.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/jest/setup.js +1 -0
- 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/outbox/types.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/entityVersion.js +1 -0
- package/lib/module/query/index.js +1 -1
- package/lib/module/query/paging.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 +9 -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/jest/setup.d.ts +9 -0
- 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 -17
- 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 +23 -14
- package/lib/typescript/commonjs/query/dataState.d.ts +76 -0
- package/lib/typescript/commonjs/query/entityVersion.d.ts +47 -0
- package/lib/typescript/commonjs/query/index.d.ts +5 -1
- package/lib/typescript/commonjs/query/paging.d.ts +6 -5
- package/lib/typescript/commonjs/query/persistedQueries.d.ts +12 -7
- package/lib/typescript/commonjs/query/usePagedList.d.ts +11 -18
- 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 +10 -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 +9 -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/jest/setup.d.ts +9 -0
- 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 -17
- 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 +23 -14
- package/lib/typescript/module/query/dataState.d.ts +76 -0
- package/lib/typescript/module/query/entityVersion.d.ts +47 -0
- package/lib/typescript/module/query/index.d.ts +5 -1
- package/lib/typescript/module/query/paging.d.ts +6 -5
- package/lib/typescript/module/query/persistedQueries.d.ts +12 -7
- package/lib/typescript/module/query/usePagedList.d.ts +11 -18
- 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 +10 -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 +14 -2
- package/src/specs/NativeSmsRetriever.ts +1 -1
|
@@ -10,15 +10,15 @@ type LogFn = (message: string, ...optionalParams: unknown[]) => void;
|
|
|
10
10
|
*/
|
|
11
11
|
export interface RemoteLogger {
|
|
12
12
|
/** Append a breadcrumb (small, non-error event) for crash context. */
|
|
13
|
-
breadcrumb?: (message: string, data?: Record<string, unknown>) => void;
|
|
13
|
+
breadcrumb?: ((message: string, data?: Record<string, unknown>) => void) | undefined;
|
|
14
14
|
/** Record a non-fatal error with optional context. */
|
|
15
|
-
recordError?: (error: unknown, context?: Record<string, unknown>) => void;
|
|
15
|
+
recordError?: ((error: unknown, context?: Record<string, unknown>) => void) | undefined;
|
|
16
16
|
/** Bind a logical user to subsequent events. */
|
|
17
|
-
setUser?: (id: string | null, attrs?: Record<string, unknown>) => void;
|
|
17
|
+
setUser?: ((id: string | null, attrs?: Record<string, unknown>) => void) | undefined;
|
|
18
18
|
/** Attach a custom attribute / tag (e.g. `release`, `env`). */
|
|
19
|
-
setAttribute?: (key: string, value: string | number | boolean | null) => void;
|
|
19
|
+
setAttribute?: ((key: string, value: string | number | boolean | null) => void) | undefined;
|
|
20
20
|
/** Forward a leveled console message. */
|
|
21
|
-
log?: (level: LogLevel, message: string, optionalParams: unknown[]) => void;
|
|
21
|
+
log?: ((level: LogLevel, message: string, optionalParams: unknown[]) => void) | undefined;
|
|
22
22
|
}
|
|
23
23
|
/** Set by `initWebority`; `null` detaches. Not part of the package's public API. */
|
|
24
24
|
export declare const setRemoteLogger: (impl: RemoteLogger | null) => void;
|
|
@@ -29,12 +29,12 @@ export declare const setRemoteLogger: (impl: RemoteLogger | null) => void;
|
|
|
29
29
|
*/
|
|
30
30
|
export interface DeviceContext {
|
|
31
31
|
platform: string;
|
|
32
|
-
osVersion?: string;
|
|
33
|
-
appVersion?: string;
|
|
34
|
-
buildNumber?: string;
|
|
35
|
-
deviceModel?: string;
|
|
36
|
-
isEmulator?: boolean;
|
|
37
|
-
locale?: string;
|
|
32
|
+
osVersion?: string | undefined;
|
|
33
|
+
appVersion?: string | null | undefined;
|
|
34
|
+
buildNumber?: string | null | undefined;
|
|
35
|
+
deviceModel?: string | null | undefined;
|
|
36
|
+
isEmulator?: boolean | undefined;
|
|
37
|
+
locale?: string | undefined;
|
|
38
38
|
[key: string]: unknown;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -46,22 +46,22 @@ export declare const setDeviceContext: (context: DeviceContext | null) => void;
|
|
|
46
46
|
export declare const getDeviceContext: () => DeviceContext | null;
|
|
47
47
|
export interface LoggerBreadcrumb {
|
|
48
48
|
message: string;
|
|
49
|
-
data?: Record<string, unknown
|
|
49
|
+
data?: Record<string, unknown> | undefined;
|
|
50
50
|
/** When it was recorded, ISO 8601 in UTC. */
|
|
51
51
|
timestampUtc: string;
|
|
52
52
|
}
|
|
53
53
|
/** Tuning knobs for screen history and duplicate-error suppression. */
|
|
54
54
|
export interface LoggerOptions {
|
|
55
55
|
/** Identical errors within this window are collapsed. Default 5000ms. 0 disables dedupe. */
|
|
56
|
-
dedupeWindowMs?: number;
|
|
56
|
+
dedupeWindowMs?: number | undefined;
|
|
57
57
|
/** Max identical errors forwarded per window before suppression. Default 1. */
|
|
58
|
-
dedupeMaxPerWindow?: number;
|
|
58
|
+
dedupeMaxPerWindow?: number | undefined;
|
|
59
59
|
/** Cap on tracked screen history. Default 20. */
|
|
60
|
-
screenHistoryLimit?: number;
|
|
60
|
+
screenHistoryLimit?: number | undefined;
|
|
61
61
|
/** Extra keys masked in logs, added to the built-in list. */
|
|
62
|
-
redactKeys?: string[];
|
|
62
|
+
redactKeys?: string[] | undefined;
|
|
63
63
|
/** Breadcrumbs kept for Logger.getBreadcrumbs(). Default 50. */
|
|
64
|
-
breadcrumbLimit?: number;
|
|
64
|
+
breadcrumbLimit?: number | undefined;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Configure dedupe, screen history, breadcrumbs and redaction. Merges with current options;
|
|
@@ -71,12 +71,12 @@ export declare const configureLogger: (options: LoggerOptions) => void;
|
|
|
71
71
|
/** What `Logger.requestFailed` is told about the call beside the error itself. */
|
|
72
72
|
export interface RequestFailedContext {
|
|
73
73
|
/** What the call was, in words: `'Load projects'`. Names the log line; defaults to the method and path. */
|
|
74
|
-
label?: string;
|
|
74
|
+
label?: string | undefined;
|
|
75
75
|
/**
|
|
76
76
|
* Statuses this call answers as part of its work (a 409 the screen explains, a 404 that
|
|
77
77
|
* means "none yet"): logged as info, never recorded as an error.
|
|
78
78
|
*/
|
|
79
|
-
expectedStatuses?: readonly number[];
|
|
79
|
+
expectedStatuses?: readonly number[] | undefined;
|
|
80
80
|
/** Anything else worth carrying to the remote sink. Never a token or a request body. */
|
|
81
81
|
[key: string]: unknown;
|
|
82
82
|
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
export declare const configureRedaction: (extraKeys: readonly string[]) => void;
|
|
3
3
|
export declare const redactString: (input: string) => string;
|
|
4
4
|
/** Returns a copy with secrets masked. An Error comes back as its summary, never as the Error itself. */
|
|
5
|
-
export declare const redact:
|
|
5
|
+
export declare const redact: (value: unknown) => unknown;
|
|
6
|
+
/** `redact` for a plain object: a record always comes back as one, so anything else is a defect and throws. */
|
|
7
|
+
export declare const redactRecord: (value: Readonly<Record<string, unknown>>) => Record<string, unknown>;
|
|
6
8
|
/** An Error safe to hand to a sink: the original name and stack, a redacted message, and no request data. */
|
|
7
9
|
export declare const redactError: (input: unknown) => Error;
|
|
8
10
|
//# sourceMappingURL=redact.d.ts.map
|
|
@@ -13,8 +13,8 @@ export interface MetroStore {
|
|
|
13
13
|
export interface MetroSignInRequest {
|
|
14
14
|
email: string;
|
|
15
15
|
/** Absent for an account that signs in with an emailed code only. */
|
|
16
|
-
password?: string;
|
|
17
|
-
code?: string;
|
|
16
|
+
password?: string | undefined;
|
|
17
|
+
code?: string | undefined;
|
|
18
18
|
}
|
|
19
19
|
export interface MetroSignInResult {
|
|
20
20
|
/** True when the app now waits for the emailed or authenticator code. */
|
|
@@ -27,7 +27,7 @@ export interface MetroBridgeOptions {
|
|
|
27
27
|
signOut: () => Promise<void>;
|
|
28
28
|
isSignedIn: () => boolean;
|
|
29
29
|
/** App commands beyond signIn, signOut and navigate; a name already taken throws. */
|
|
30
|
-
commands?: Record<string, (args?: unknown) => unknown
|
|
30
|
+
commands?: Record<string, (args?: unknown) => unknown> | undefined;
|
|
31
31
|
}
|
|
32
32
|
export interface MetroBridge {
|
|
33
33
|
commands: {
|
|
@@ -37,7 +37,7 @@ export interface MetroBridge {
|
|
|
37
37
|
}>;
|
|
38
38
|
navigate: (args: {
|
|
39
39
|
name: string;
|
|
40
|
-
params?: object;
|
|
40
|
+
params?: object | undefined;
|
|
41
41
|
}) => {
|
|
42
42
|
route: string;
|
|
43
43
|
};
|
|
@@ -13,7 +13,7 @@ export type NetworkStatusListener = (status: NetworkStatus) => void;
|
|
|
13
13
|
interface NetInfoStateLike {
|
|
14
14
|
isConnected: boolean | null;
|
|
15
15
|
isInternetReachable: boolean | null;
|
|
16
|
-
type?: string;
|
|
16
|
+
type?: string | undefined;
|
|
17
17
|
}
|
|
18
18
|
export interface NetInfoLike {
|
|
19
19
|
fetch: () => Promise<NetInfoStateLike>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AxiosInstance } from "axios";
|
|
1
2
|
export type OutboxMethod = "POST" | "PUT" | "PATCH";
|
|
2
3
|
export interface OutboxFilePart {
|
|
3
4
|
uri: string;
|
|
@@ -25,7 +26,7 @@ export interface OutboxRequest {
|
|
|
25
26
|
/** Must carry Idempotency-Key (a uuid); Authorization and Account-Id are refused, the outbox sets the workspace itself. */
|
|
26
27
|
headers: Record<string, string>;
|
|
27
28
|
body: OutboxBody;
|
|
28
|
-
timeoutMs?: number;
|
|
29
|
+
timeoutMs?: number | undefined;
|
|
29
30
|
}
|
|
30
31
|
export type OutboxEntryState = "Pending" | "Sending" | "Failed";
|
|
31
32
|
export interface OutboxFailure {
|
|
@@ -73,27 +74,15 @@ export type OutboxEvent = {
|
|
|
73
74
|
};
|
|
74
75
|
export type OutboxListener = (event: OutboxEvent) => void;
|
|
75
76
|
/** The slice of the app's signed-in axios instance (mobile-core's userClient) the outbox sends through. */
|
|
76
|
-
export
|
|
77
|
-
request(config: {
|
|
78
|
-
method: string;
|
|
79
|
-
url: string;
|
|
80
|
-
headers: Record<string, string>;
|
|
81
|
-
data?: unknown;
|
|
82
|
-
timeout?: number;
|
|
83
|
-
retry?: false;
|
|
84
|
-
}): Promise<{
|
|
85
|
-
status: number;
|
|
86
|
-
data: unknown;
|
|
87
|
-
}>;
|
|
88
|
-
}
|
|
77
|
+
export type OutboxHttpClient = Pick<AxiosInstance, "request">;
|
|
89
78
|
export interface OutboxOptions {
|
|
90
79
|
http: OutboxHttpClient;
|
|
91
80
|
/** Default "webority-outbox". */
|
|
92
|
-
databaseName?: string;
|
|
81
|
+
databaseName?: string | undefined;
|
|
93
82
|
/** Default 50; enqueue beyond it throws OutboxFullError. */
|
|
94
|
-
maxEntriesPerOwner?: number;
|
|
83
|
+
maxEntriesPerOwner?: number | undefined;
|
|
95
84
|
/** Default 14; older entries are deleted with their files. */
|
|
96
|
-
keepDays?: number;
|
|
85
|
+
keepDays?: number | undefined;
|
|
97
86
|
}
|
|
98
87
|
export interface Outbox {
|
|
99
88
|
/** Stores the entry (files copied first), then tries it once. Definitive refusal on this first try deletes the entry and returns Failed. */
|
|
@@ -11,7 +11,7 @@ interface ExpoPermissionResponse {
|
|
|
11
11
|
granted: boolean;
|
|
12
12
|
canAskAgain: boolean;
|
|
13
13
|
/** iOS partial photo access, from expo-image-picker's MediaLibraryPermissionResponse. */
|
|
14
|
-
accessPrivileges?: "all" | "limited" | "none";
|
|
14
|
+
accessPrivileges?: "all" | "limited" | "none" | undefined;
|
|
15
15
|
}
|
|
16
16
|
interface ExpoPermissionFns {
|
|
17
17
|
check: () => Promise<ExpoPermissionResponse>;
|
|
@@ -32,6 +32,9 @@ export interface PermissionsBackend {
|
|
|
32
32
|
export declare const setPermissionsImplementation: (impl: PermissionsBackend | null) => void;
|
|
33
33
|
/** Called by the per-package entry points to register their kind(s). Not for app code. */
|
|
34
34
|
export declare const registerPermissionAdapter: (kind: PermissionKind, fns: ExpoPermissionFns) => void;
|
|
35
|
+
declare const checkPermission: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
36
|
+
declare const requestPermission: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
37
|
+
declare const openAppSettings: () => Promise<boolean>;
|
|
35
38
|
/**
|
|
36
39
|
* Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
|
|
37
40
|
* (camera, photos, location, notifications, …) to whichever Expo adapter an
|
|
@@ -41,13 +44,13 @@ export declare const registerPermissionAdapter: (kind: PermissionKind, fns: Expo
|
|
|
41
44
|
* points for the kinds it actually asks for.
|
|
42
45
|
*/
|
|
43
46
|
export declare const Permissions: {
|
|
44
|
-
check:
|
|
45
|
-
request:
|
|
47
|
+
check: typeof checkPermission;
|
|
48
|
+
request: typeof requestPermission;
|
|
46
49
|
/** Convenience: returns true when the permission is `granted` or `limited`. */
|
|
47
50
|
isAuthorized: (kind: PermissionKind) => Promise<boolean>;
|
|
48
51
|
/** Convenience: check, and request only when the status is `undetermined` or `denied`. */
|
|
49
52
|
ensure: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
50
|
-
openSettings:
|
|
53
|
+
openSettings: typeof openAppSettings;
|
|
51
54
|
};
|
|
52
55
|
export {};
|
|
53
56
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
export interface PickedFile {
|
|
2
2
|
uri: string;
|
|
3
|
-
name?: string;
|
|
4
|
-
type?: string;
|
|
5
|
-
size?: number;
|
|
6
|
-
meta?: Record<string, unknown
|
|
3
|
+
name?: string | undefined;
|
|
4
|
+
type?: string | undefined;
|
|
5
|
+
size?: number | undefined;
|
|
6
|
+
meta?: Record<string, unknown> | undefined;
|
|
7
7
|
}
|
|
8
8
|
export interface PickerSource {
|
|
9
9
|
key: string;
|
|
10
10
|
label: string;
|
|
11
|
-
description?: string;
|
|
11
|
+
description?: string | undefined;
|
|
12
12
|
pick: () => Promise<PickedFile[]>;
|
|
13
13
|
}
|
|
14
14
|
export interface PhotoOptions {
|
|
15
|
-
maxEdgePx?: number;
|
|
16
|
-
quality?: number;
|
|
17
|
-
multiple?: boolean;
|
|
18
|
-
limit?: number;
|
|
15
|
+
maxEdgePx?: number | undefined;
|
|
16
|
+
quality?: number | undefined;
|
|
17
|
+
multiple?: boolean | undefined;
|
|
18
|
+
limit?: number | undefined;
|
|
19
19
|
/** What the library offers; photos only by default. */
|
|
20
|
-
mediaTypes?: ReadonlyArray<"images" | "videos"
|
|
20
|
+
mediaTypes?: ReadonlyArray<"images" | "videos"> | undefined;
|
|
21
21
|
}
|
|
22
22
|
export declare function whenSheetHasClosed(): Promise<void>;
|
|
23
23
|
/** Bounds the longer side to `maxEdgePx`, re-encodes as JPEG at `quality` and returns the file named `photo-<time>.jpg`. */
|
|
24
24
|
export declare function boundPhoto(asset: {
|
|
25
25
|
uri: string;
|
|
26
|
-
width?: number;
|
|
27
|
-
height?: number;
|
|
28
|
-
type?: "image" | "video" | "livePhoto" | "pairedVideo" | null;
|
|
29
|
-
fileName?: string | null;
|
|
30
|
-
mimeType?: string;
|
|
31
|
-
fileSize?: number;
|
|
26
|
+
width?: number | undefined;
|
|
27
|
+
height?: number | undefined;
|
|
28
|
+
type?: "image" | "video" | "livePhoto" | "pairedVideo" | null | undefined;
|
|
29
|
+
fileName?: string | null | undefined;
|
|
30
|
+
mimeType?: string | undefined;
|
|
31
|
+
fileSize?: number | undefined;
|
|
32
32
|
}, options?: PhotoOptions): Promise<PickedFile>;
|
|
33
33
|
export declare function cameraSource(options: PhotoOptions & {
|
|
34
34
|
label: string;
|
|
@@ -38,7 +38,7 @@ export declare function photoLibrarySource(options: PhotoOptions & {
|
|
|
38
38
|
}): PickerSource;
|
|
39
39
|
export declare function documentSource(options: {
|
|
40
40
|
label: string;
|
|
41
|
-
types?: string[];
|
|
42
|
-
multiple?: boolean;
|
|
41
|
+
types?: string[] | undefined;
|
|
42
|
+
multiple?: boolean | undefined;
|
|
43
43
|
}): PickerSource;
|
|
44
44
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -33,12 +33,12 @@ export interface EnablePushOptions {
|
|
|
33
33
|
* registered silently and any other phone is left alone, so the app can ask
|
|
34
34
|
* later at a moment it chooses.
|
|
35
35
|
*/
|
|
36
|
-
prompt?: boolean;
|
|
36
|
+
prompt?: boolean | undefined;
|
|
37
37
|
}
|
|
38
38
|
export interface PushAndroidChannel {
|
|
39
39
|
id: string;
|
|
40
40
|
name: string;
|
|
41
|
-
importance?: "default" | "high";
|
|
41
|
+
importance?: "default" | "high" | undefined;
|
|
42
42
|
}
|
|
43
43
|
export interface PushConfig {
|
|
44
44
|
getInstallationId: () => Promise<string> | string;
|
|
@@ -49,27 +49,27 @@ export interface PushConfig {
|
|
|
49
49
|
/** A notification was tapped, including the tap that launched the app. */
|
|
50
50
|
onOpen: (data: Record<string, string>) => void;
|
|
51
51
|
/** Only for channels the app does not create natively. */
|
|
52
|
-
androidChannels?: PushAndroidChannel[];
|
|
52
|
+
androidChannels?: PushAndroidChannel[] | undefined;
|
|
53
53
|
/** Whether a notification arriving while the app is open is shown. Defaults to true. */
|
|
54
|
-
showInForeground?: () => boolean;
|
|
54
|
+
showInForeground?: (() => boolean) | undefined;
|
|
55
55
|
/** Whether a notification shown while the app is open plays its sound. Defaults to true. */
|
|
56
|
-
playSoundInForeground?: () => boolean;
|
|
56
|
+
playSoundInForeground?: (() => boolean) | undefined;
|
|
57
57
|
}
|
|
58
58
|
/** A button on a notification category. */
|
|
59
59
|
export interface PushCategoryAction {
|
|
60
60
|
id: string;
|
|
61
61
|
title: string;
|
|
62
62
|
/** Whether the tap brings the app to the foreground. Defaults to true. */
|
|
63
|
-
opensApp?: boolean;
|
|
63
|
+
opensApp?: boolean | undefined;
|
|
64
64
|
/** iOS only: the title shows in red. */
|
|
65
|
-
destructive?: boolean;
|
|
65
|
+
destructive?: boolean | undefined;
|
|
66
66
|
/** Turns the button into a reply box; the text arrives as `userText`. */
|
|
67
67
|
textInput?: {
|
|
68
68
|
submitTitle: string;
|
|
69
69
|
placeholder: string;
|
|
70
|
-
};
|
|
70
|
+
} | undefined;
|
|
71
71
|
/** iOS only: the phone must be unlocked before the action runs. */
|
|
72
|
-
authenticationRequired?: boolean;
|
|
72
|
+
authenticationRequired?: boolean | undefined;
|
|
73
73
|
}
|
|
74
74
|
/** A set of buttons a push names through its category id. */
|
|
75
75
|
export interface PushCategory {
|
|
@@ -80,7 +80,7 @@ export interface PushCategory {
|
|
|
80
80
|
export interface PushAction {
|
|
81
81
|
actionId: string;
|
|
82
82
|
/** What the person typed, for a `textInput` action. */
|
|
83
|
-
userText?: string;
|
|
83
|
+
userText?: string | undefined;
|
|
84
84
|
data: Record<string, string>;
|
|
85
85
|
/** The notification's identifier on the phone, not a server id in `data`. */
|
|
86
86
|
notificationId: string;
|
|
@@ -89,7 +89,7 @@ export type PushActionHandler = (action: PushAction) => Promise<void> | void;
|
|
|
89
89
|
export interface PushLocalNotification {
|
|
90
90
|
title: string;
|
|
91
91
|
body: string;
|
|
92
|
-
data?: Record<string, string
|
|
92
|
+
data?: Record<string, string> | undefined;
|
|
93
93
|
}
|
|
94
94
|
export interface PushState {
|
|
95
95
|
status: PushStatus;
|
|
@@ -111,24 +111,24 @@ interface NotificationLike {
|
|
|
111
111
|
identifier: string;
|
|
112
112
|
/** A background task receives the raw content, where data may still be a JSON `dataString`. */
|
|
113
113
|
content: {
|
|
114
|
-
title?: string | null;
|
|
115
|
-
body?: string | null;
|
|
116
|
-
data?: Record<string, unknown> | null;
|
|
117
|
-
dataString?: string;
|
|
114
|
+
title?: string | null | undefined;
|
|
115
|
+
body?: string | null | undefined;
|
|
116
|
+
data?: Record<string, unknown> | null | undefined;
|
|
117
|
+
dataString?: string | undefined;
|
|
118
118
|
};
|
|
119
119
|
/** A remote push carries its raw payload: APNs `userInfo` on iOS, the FCM message on Android. */
|
|
120
120
|
trigger?: {
|
|
121
|
-
type?: string;
|
|
122
|
-
payload?: Record<string, unknown> | null;
|
|
121
|
+
type?: string | undefined;
|
|
122
|
+
payload?: Record<string, unknown> | null | undefined;
|
|
123
123
|
remoteMessage?: {
|
|
124
|
-
data?: Record<string, unknown> | null;
|
|
125
|
-
} | null;
|
|
126
|
-
} | null;
|
|
124
|
+
data?: Record<string, unknown> | null | undefined;
|
|
125
|
+
} | null | undefined;
|
|
126
|
+
} | null | undefined;
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
interface NotificationResponseLike {
|
|
130
130
|
actionIdentifier: string;
|
|
131
|
-
userText?: string;
|
|
131
|
+
userText?: string | undefined;
|
|
132
132
|
notification: NotificationLike;
|
|
133
133
|
}
|
|
134
134
|
interface NotificationActionLike {
|
|
@@ -137,7 +137,7 @@ interface NotificationActionLike {
|
|
|
137
137
|
textInput?: {
|
|
138
138
|
submitButtonTitle: string;
|
|
139
139
|
placeholder: string;
|
|
140
|
-
};
|
|
140
|
+
} | undefined;
|
|
141
141
|
options: {
|
|
142
142
|
opensAppToForeground: boolean;
|
|
143
143
|
isDestructive: boolean;
|
|
@@ -158,7 +158,7 @@ export interface PushNotificationsLike {
|
|
|
158
158
|
addNotificationResponseReceivedListener: (listener: (response: NotificationResponseLike) => void) => SubscriptionLike;
|
|
159
159
|
addNotificationReceivedListener: (listener: (notification: NotificationLike) => void) => SubscriptionLike;
|
|
160
160
|
getLastNotificationResponseAsync: () => Promise<NotificationResponseLike | null>;
|
|
161
|
-
clearLastNotificationResponseAsync?: () => Promise<void
|
|
161
|
+
clearLastNotificationResponseAsync?: (() => Promise<void>) | undefined;
|
|
162
162
|
setNotificationHandler: (handler: {
|
|
163
163
|
handleNotification: () => Promise<{
|
|
164
164
|
shouldShowBanner: boolean;
|
|
@@ -16,27 +16,34 @@ import { type ApiError } from "../errors";
|
|
|
16
16
|
export type ParamsFormat = "repeat" | "brackets" | "comma";
|
|
17
17
|
export interface ApiRequest {
|
|
18
18
|
url: string;
|
|
19
|
-
method?: Method;
|
|
19
|
+
method?: Method | undefined;
|
|
20
20
|
/** The request body. FormData is sent as multipart by the client. */
|
|
21
21
|
data?: unknown;
|
|
22
22
|
/** Query string values; build list queries with `buildListQuery`. */
|
|
23
|
-
params?: Record<string, unknown
|
|
24
|
-
headers?: Record<string, string
|
|
23
|
+
params?: Record<string, unknown> | undefined;
|
|
24
|
+
headers?: Record<string, string> | undefined;
|
|
25
25
|
/** Only JSON-safe types belong in the store; a blob download stays a service call. */
|
|
26
|
-
responseType?: Extract<ResponseType, "json" | "text"
|
|
27
|
-
timeout?: number;
|
|
28
|
-
silent?: boolean;
|
|
29
|
-
expectedStatuses?: number[];
|
|
30
|
-
paramsFormat?: ParamsFormat;
|
|
31
|
-
public?: boolean;
|
|
26
|
+
responseType?: Extract<ResponseType, "json" | "text"> | undefined;
|
|
27
|
+
timeout?: number | undefined;
|
|
28
|
+
silent?: boolean | undefined;
|
|
29
|
+
expectedStatuses?: number[] | undefined;
|
|
30
|
+
paramsFormat?: ParamsFormat | undefined;
|
|
31
|
+
public?: boolean | undefined;
|
|
32
|
+
/** Sent as `If-Match: "<value>"`; the version read from `meta.entityTag`. */
|
|
33
|
+
ifMatch?: string | undefined;
|
|
34
|
+
/** Sent as `Idempotency-Key`; one key per submit, kept across its retries. */
|
|
35
|
+
idempotencyKey?: string | undefined;
|
|
32
36
|
}
|
|
33
37
|
export type ApiQueryArgs = string | ApiRequest;
|
|
34
38
|
/** Per-endpoint options, set as the endpoint's `extraOptions`. */
|
|
35
39
|
export interface ApiExtraOptions {
|
|
36
|
-
silent?: boolean;
|
|
37
|
-
expectedStatuses?: number[];
|
|
38
|
-
paramsFormat?: ParamsFormat;
|
|
40
|
+
silent?: boolean | undefined;
|
|
41
|
+
expectedStatuses?: number[] | undefined;
|
|
42
|
+
paramsFormat?: ParamsFormat | undefined;
|
|
39
43
|
}
|
|
44
|
+
export declare const strongEntityTag: (value: unknown) => string | undefined;
|
|
45
|
+
/** The `If-Match` header value for a version: the version in quotes, as an ETag is sent. */
|
|
46
|
+
export declare const ifMatchValue: (version: string) => string;
|
|
40
47
|
/**
|
|
41
48
|
* Returned as the base query's `meta`, which RTK Query copies onto the
|
|
42
49
|
* fulfilled and rejected actions as `action.meta.baseQueryMeta`. The toast
|
|
@@ -46,15 +53,17 @@ export interface ApiExtraOptions {
|
|
|
46
53
|
export interface ApiBaseQueryMeta {
|
|
47
54
|
silent: boolean;
|
|
48
55
|
/** The statuses the call's screen handles itself; the toast middleware skips a failure with one. */
|
|
49
|
-
expectedStatuses?: number[];
|
|
56
|
+
expectedStatuses?: number[] | undefined;
|
|
50
57
|
/** The HTTP status, or 0 when no response arrived. */
|
|
51
58
|
status: number;
|
|
59
|
+
/** The strong ETag of the response, without quotes; undefined when none was sent. */
|
|
60
|
+
entityTag?: string | undefined;
|
|
52
61
|
}
|
|
53
62
|
export interface ApiBaseQueryOptions {
|
|
54
63
|
/** The signed-in client every call uses by default (`userClient`). */
|
|
55
64
|
client: AxiosInstance;
|
|
56
65
|
/** The anonymous client for calls marked `public: true` (`publicClient`). */
|
|
57
|
-
publicClient?: AxiosInstance;
|
|
66
|
+
publicClient?: AxiosInstance | undefined;
|
|
58
67
|
}
|
|
59
68
|
export type ApiBaseQuery = BaseQueryFn<ApiQueryArgs, unknown, ApiError, ApiExtraOptions, ApiBaseQueryMeta>;
|
|
60
69
|
/**
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ApiError } from "../errors/extractApiError";
|
|
2
|
+
import type { PagedDataObject } from "./paging";
|
|
3
|
+
import type { PagedListPaging } from "./usePagedList";
|
|
4
|
+
/** What a screen can be showing for one request. A closed set: the block draws every member. */
|
|
5
|
+
export type DataState<T> = {
|
|
6
|
+
readonly status: "idle";
|
|
7
|
+
} | {
|
|
8
|
+
readonly status: "loading";
|
|
9
|
+
} | {
|
|
10
|
+
readonly status: "error";
|
|
11
|
+
readonly error: ApiError;
|
|
12
|
+
readonly retry: () => void;
|
|
13
|
+
} | {
|
|
14
|
+
readonly status: "empty";
|
|
15
|
+
readonly refreshing: boolean;
|
|
16
|
+
readonly refresh: () => void;
|
|
17
|
+
readonly fulfilledTimeStamp?: number | undefined;
|
|
18
|
+
} | {
|
|
19
|
+
readonly status: "data";
|
|
20
|
+
readonly data: T;
|
|
21
|
+
readonly refreshing: boolean;
|
|
22
|
+
readonly refresh: () => void;
|
|
23
|
+
readonly fulfilledTimeStamp?: number | undefined;
|
|
24
|
+
};
|
|
25
|
+
/** The members of an RTK Query hook result that useDataState reads. */
|
|
26
|
+
export interface QueryResultLike<T> {
|
|
27
|
+
readonly currentData?: T | undefined;
|
|
28
|
+
/** The last result for any arguments; read only with keepPreviousData. */
|
|
29
|
+
readonly data?: T | undefined;
|
|
30
|
+
readonly error?: unknown;
|
|
31
|
+
readonly isFetching: boolean;
|
|
32
|
+
/** True while the query has never started, which for an RTK Query hook means it is skipped. */
|
|
33
|
+
readonly isUninitialized?: boolean | undefined;
|
|
34
|
+
readonly fulfilledTimeStamp?: number | undefined;
|
|
35
|
+
readonly refetch: () => unknown;
|
|
36
|
+
}
|
|
37
|
+
export interface DataStateOptions<T> {
|
|
38
|
+
/** Default: an array of length 0, or a PagedDataObject whose items has length 0. Anything else is never empty. */
|
|
39
|
+
readonly isEmpty?: (data: T) => boolean;
|
|
40
|
+
/** Default false. True keeps the last result on screen, refreshing, while a query with new arguments loads. */
|
|
41
|
+
readonly keepPreviousData?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface InfiniteQueryResultLike<T> {
|
|
44
|
+
readonly currentData?: {
|
|
45
|
+
readonly pages: readonly PagedDataObject<T>[];
|
|
46
|
+
} | undefined;
|
|
47
|
+
readonly error?: unknown;
|
|
48
|
+
readonly isFetching: boolean;
|
|
49
|
+
readonly isFetchingNextPage: boolean;
|
|
50
|
+
readonly hasNextPage: boolean;
|
|
51
|
+
readonly isError: boolean;
|
|
52
|
+
/** True while the query has never started, which for an RTK Query hook means it is skipped. */
|
|
53
|
+
readonly isUninitialized?: boolean | undefined;
|
|
54
|
+
readonly fulfilledTimeStamp?: number | undefined;
|
|
55
|
+
readonly refetch: () => unknown;
|
|
56
|
+
readonly fetchNextPage: () => unknown;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Rules, in order:
|
|
60
|
+
* 1. currentData is not undefined: "empty" when isEmpty says so, else "data"; refreshing is isFetching; refresh is refetch;
|
|
61
|
+
* fulfilledTimeStamp is passed through.
|
|
62
|
+
* A failed refetch that still holds currentData stays here (the toast middleware reports it).
|
|
63
|
+
* 2. error is set: "error", with error passed through extractApiError and retry calling refetch.
|
|
64
|
+
* It wins over a kept previous result, so a failed new query never shows the old arguments' rows as its answer.
|
|
65
|
+
* 3. isUninitialized is true: "idle", the query is skipped and the block draws nothing.
|
|
66
|
+
* 4. keepPreviousData is on and data is not undefined: rule 1 applied to data, with refreshing true while isFetching.
|
|
67
|
+
* 5. otherwise "loading" (first load, an argument that changed).
|
|
68
|
+
* The returned object is memoised on its inputs.
|
|
69
|
+
*/
|
|
70
|
+
export declare function useDataState<T>(result: QueryResultLike<T>, options?: DataStateOptions<T>): DataState<T>;
|
|
71
|
+
/** state: every loaded page's items in order, "empty" when there are none. paging: what the paged list footer reads. */
|
|
72
|
+
export declare function useInfiniteDataState<T>(result: InfiniteQueryResultLike<T>): {
|
|
73
|
+
readonly state: DataState<readonly T[]>;
|
|
74
|
+
readonly paging: PagedListPaging;
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=dataState.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AxiosRequestConfig } from "axios";
|
|
2
|
+
import { type ApiError } from "../errors";
|
|
3
|
+
/**
|
|
4
|
+
* The version a write sends back as `If-Match`: the record's own `version` string (a list item, or the
|
|
5
|
+
* body of a single record), else the strong ETag of the read that loaded it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const versionOf: (record: unknown, entityTag?: string | undefined) => string | undefined;
|
|
8
|
+
/** A copy of `cfg` that sends `version` as `If-Match`, replacing an `If-Match` under any casing; `cfg` itself is not changed. */
|
|
9
|
+
export declare const withIfMatch: (version: string, cfg?: AxiosRequestConfig) => AxiosRequestConfig;
|
|
10
|
+
/** The strong ETag of a response's `etag` header, without quotes; undefined when there is none or it is weak. */
|
|
11
|
+
export declare const entityTagOf: (response: {
|
|
12
|
+
headers: unknown;
|
|
13
|
+
}) => string | undefined;
|
|
14
|
+
/** A record as the server holds it now, with the ETag of the read that returned it when the caller has one. */
|
|
15
|
+
export interface VersionedRead<R> {
|
|
16
|
+
record: R;
|
|
17
|
+
entityTag?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface SaveWithVersionOptions<R, F> {
|
|
20
|
+
/** The record the form opened with. */
|
|
21
|
+
record: R;
|
|
22
|
+
/** Its ETag, when the screen read it from the response meta. */
|
|
23
|
+
entityTag?: string | undefined;
|
|
24
|
+
/** The values the form holds now. */
|
|
25
|
+
form: F;
|
|
26
|
+
/** The fields the form shows and sends, read from a record. */
|
|
27
|
+
toForm: (record: R) => F;
|
|
28
|
+
/** Reads the record as the server holds it now. */
|
|
29
|
+
read: () => Promise<VersionedRead<R>>;
|
|
30
|
+
/** Sends `form` with `version` as If-Match. Rejects with the ApiError of a failed reply. */
|
|
31
|
+
save: (form: F, version: string) => Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export type SaveWithVersionResult<R> = {
|
|
34
|
+
saved: true;
|
|
35
|
+
} | {
|
|
36
|
+
saved: false;
|
|
37
|
+
error: ApiError;
|
|
38
|
+
fresh: R;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Saves a record guarded by its version. A 412 re-reads the record once. When the fields the form covers
|
|
42
|
+
* are unchanged on the server, it saves the form again with the fresh version and reports success. Otherwise
|
|
43
|
+
* it returns the stale error and the fresh record: the caller shows the message and resets the form to
|
|
44
|
+
* `toForm(fresh)`. A second 412 is returned, never retried. Any other failure is rethrown.
|
|
45
|
+
*/
|
|
46
|
+
export declare const saveWithVersion: <R, F>({ record, entityTag, form, toForm, read, save, }: SaveWithVersionOptions<R, F>) => Promise<SaveWithVersionResult<R>>;
|
|
47
|
+
//# sourceMappingURL=entityVersion.d.ts.map
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export type { ApiBaseQuery, ApiBaseQueryMeta, ApiBaseQueryOptions, ApiExtraOptions, ApiQueryArgs, ApiRequest, } from "./apiBaseQuery";
|
|
2
2
|
export { createApiBaseQuery } from "./apiBaseQuery";
|
|
3
3
|
export { APP_API_DEFAULTS, createAppApi } from "./createAppApi";
|
|
4
|
+
export type { DataState, DataStateOptions, InfiniteQueryResultLike, QueryResultLike } from "./dataState";
|
|
5
|
+
export { useDataState, useInfiniteDataState } from "./dataState";
|
|
6
|
+
export type { SaveWithVersionOptions, SaveWithVersionResult, VersionedRead } from "./entityVersion";
|
|
7
|
+
export { entityTagOf, saveWithVersion, versionOf, withIfMatch } from "./entityVersion";
|
|
4
8
|
export { setupApiListeners } from "./listeners";
|
|
5
9
|
export type { ListFilterValue, ListQuery, PagedDataObject, PagedListRequest, SortOrder, } from "./paging";
|
|
6
10
|
export { buildListQuery, getNextPageParam, getPreviousPageParam, hasNextPage, hasPreviousPage, } from "./paging";
|
|
@@ -9,5 +13,5 @@ export { createPersistedQueries, PERSISTED_QUERIES_RESTORED } from "./persistedQ
|
|
|
9
13
|
export type { ApiTag, TagId } from "./tags";
|
|
10
14
|
export { itemTag, LIST_TAG_ID, listTag, providesList, providesPagedList } from "./tags";
|
|
11
15
|
export type { PagedListPaging, PagedListResult, UsePagedListOptions, } from "./usePagedList";
|
|
12
|
-
export {
|
|
16
|
+
export { usePagedList } from "./usePagedList";
|
|
13
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -10,18 +10,19 @@ export interface PagedDataObject<T> {
|
|
|
10
10
|
page: number;
|
|
11
11
|
pageSize: number;
|
|
12
12
|
totalCount: number;
|
|
13
|
+
totalCountCapped: boolean;
|
|
13
14
|
totalPages: number;
|
|
14
15
|
}
|
|
15
16
|
export type SortOrder = "asc" | "desc";
|
|
16
17
|
export interface PagedListRequest {
|
|
17
|
-
page?: number;
|
|
18
|
-
pageSize?: number;
|
|
19
|
-
sortBy?: string;
|
|
20
|
-
sortOrder?: SortOrder;
|
|
18
|
+
page?: number | undefined;
|
|
19
|
+
pageSize?: number | undefined;
|
|
20
|
+
sortBy?: string | undefined;
|
|
21
|
+
sortOrder?: SortOrder | undefined;
|
|
21
22
|
}
|
|
22
23
|
export type ListFilterValue = string | number | boolean | null | undefined;
|
|
23
24
|
export interface ListQuery extends PagedListRequest {
|
|
24
|
-
filters?: Record<string, ListFilterValue
|
|
25
|
+
filters?: Record<string, ListFilterValue> | undefined;
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* The `params` for a list endpoint. Filters sit beside the paging keys, as the
|