@webority/mobile-core 0.161.0 → 0.164.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 +7 -3
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/AppSignatureHelper.kt +2 -2
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverModuleImpl.kt +2 -2
- package/lib/commonjs/api/contractCaller.js +1 -1
- package/lib/commonjs/api/tokenRefresh.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/query/index.js +1 -1
- package/lib/commonjs/query/paging.js +1 -1
- package/lib/commonjs/query/usePagedList.js +1 -1
- package/lib/commonjs/versionCheck/index.js +1 -1
- package/lib/module/api/contractCaller.js +1 -1
- package/lib/module/api/tokenRefresh.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/query/index.js +1 -1
- package/lib/module/query/paging.js +1 -1
- package/lib/module/query/usePagedList.js +1 -1
- package/lib/module/versionCheck/index.js +1 -1
- package/lib/typescript/commonjs/api/baseUrl.d.ts +1 -1
- package/lib/typescript/commonjs/api/contractCaller.d.ts +21 -7
- package/lib/typescript/commonjs/config/index.d.ts +1 -1
- package/lib/typescript/commonjs/formatters/currency.d.ts +1 -1
- package/lib/typescript/commonjs/formatters/dateMath.d.ts +9 -9
- package/lib/typescript/commonjs/formatters/number.d.ts +1 -1
- package/lib/typescript/commonjs/formatters/windowsToIanaTable.d.ts +3 -3
- package/lib/typescript/commonjs/geolocation/adapters/expoLocation.d.ts +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -0
- package/lib/typescript/commonjs/initUserAuth.d.ts +1 -1
- package/lib/typescript/commonjs/permissions/index.d.ts +1 -1
- package/lib/typescript/commonjs/query/apiBaseQuery.d.ts +1 -1
- package/lib/typescript/commonjs/query/index.d.ts +4 -2
- package/lib/typescript/commonjs/query/paging.d.ts +0 -11
- package/lib/typescript/commonjs/query/usePagedList.d.ts +8 -7
- package/lib/typescript/commonjs/smsRetriever/index.d.ts +2 -2
- package/lib/typescript/commonjs/specs/NativeSmsRetriever.d.ts +1 -1
- package/lib/typescript/commonjs/sqlite/index.d.ts +1 -1
- package/lib/typescript/commonjs/storage/index.d.ts +1 -1
- package/lib/typescript/commonjs/validators/index.d.ts +1 -1
- package/lib/typescript/commonjs/versionCheck/index.d.ts +1 -1
- package/lib/typescript/module/api/baseUrl.d.ts +1 -1
- package/lib/typescript/module/api/contractCaller.d.ts +21 -7
- package/lib/typescript/module/config/index.d.ts +1 -1
- package/lib/typescript/module/formatters/currency.d.ts +1 -1
- package/lib/typescript/module/formatters/dateMath.d.ts +9 -9
- package/lib/typescript/module/formatters/number.d.ts +1 -1
- package/lib/typescript/module/formatters/windowsToIanaTable.d.ts +3 -3
- package/lib/typescript/module/geolocation/adapters/expoLocation.d.ts +1 -1
- package/lib/typescript/module/index.d.ts +2 -0
- package/lib/typescript/module/initUserAuth.d.ts +1 -1
- package/lib/typescript/module/permissions/index.d.ts +1 -1
- package/lib/typescript/module/query/apiBaseQuery.d.ts +1 -1
- package/lib/typescript/module/query/index.d.ts +4 -2
- package/lib/typescript/module/query/paging.d.ts +0 -11
- package/lib/typescript/module/query/usePagedList.d.ts +8 -7
- package/lib/typescript/module/smsRetriever/index.d.ts +2 -2
- package/lib/typescript/module/specs/NativeSmsRetriever.d.ts +1 -1
- package/lib/typescript/module/sqlite/index.d.ts +1 -1
- package/lib/typescript/module/storage/index.d.ts +1 -1
- package/lib/typescript/module/validators/index.d.ts +1 -1
- package/lib/typescript/module/versionCheck/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/specs/NativeSmsRetriever.ts +1 -1
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
* client reads the bearer token. It needs no optional peer: the backend is
|
|
37
37
|
* expo-secure-store, and `expo` is required anyway.
|
|
38
38
|
*/
|
|
39
|
+
export type { ContractFullReply, ContractListQueryInput } from "@webority/api-contract/call";
|
|
40
|
+
export { listQuery } from "@webority/api-contract/call";
|
|
39
41
|
export type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
|
|
40
42
|
export type { AccountIdProvider, ClientKind } from "./api/clientHeaders";
|
|
41
43
|
export { ACCOUNT_ID_HEADER, CLIENT_BUILD_HEADER, CLIENT_KIND, CLIENT_KIND_HEADER, getClientBuild, } from "./api/clientHeaders";
|
|
@@ -28,7 +28,7 @@ export interface TokenRefreshConfig {
|
|
|
28
28
|
headers?: (() => Record<string, string> | Promise<Record<string, string>>) | undefined;
|
|
29
29
|
/**
|
|
30
30
|
* Reads the new tokens from the response body. Defaults to the Webority API's
|
|
31
|
-
* `{ accessToken,
|
|
31
|
+
* `{ accessToken, accessTokenExpiresDateTimeUtc, refreshToken, refreshTokenExpiresDateTimeUtc }`.
|
|
32
32
|
*/
|
|
33
33
|
readTokens?: ((data: unknown) => TokenRefreshResult) | undefined;
|
|
34
34
|
}
|
|
@@ -38,7 +38,7 @@ declare const openAppSettings: () => Promise<boolean>;
|
|
|
38
38
|
/**
|
|
39
39
|
* Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
|
|
40
40
|
* (camera, photos, location, notifications, …) to whichever Expo adapter an
|
|
41
|
-
* app has registered by importing that kind's entry point
|
|
41
|
+
* app has registered by importing that kind's entry point: expo-camera,
|
|
42
42
|
* expo-image-picker, expo-location, expo-contacts, expo-calendar,
|
|
43
43
|
* expo-notifications, expo-media-library. An app imports only the entry
|
|
44
44
|
* points for the kinds it actually asks for.
|
|
@@ -19,7 +19,7 @@ export interface ApiRequest {
|
|
|
19
19
|
method?: Method | undefined;
|
|
20
20
|
/** The request body. FormData is sent as multipart by the client. */
|
|
21
21
|
data?: unknown;
|
|
22
|
-
/** Query string values; build list queries with `
|
|
22
|
+
/** Query string values; build list queries with `listQuery`. */
|
|
23
23
|
params?: Record<string, unknown> | undefined;
|
|
24
24
|
headers?: Record<string, string> | undefined;
|
|
25
25
|
/** Only JSON-safe types belong in the store; a blob download stays a service call. */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type { ContractListQueryInput } from "@webority/api-contract/call";
|
|
2
|
+
export { listQuery } from "@webority/api-contract/call";
|
|
1
3
|
export type { ApiBaseQuery, ApiBaseQueryMeta, ApiBaseQueryOptions, ApiExtraOptions, ApiQueryArgs, ApiRequest, } from "./apiBaseQuery";
|
|
2
4
|
export { createApiBaseQuery } from "./apiBaseQuery";
|
|
3
5
|
export type { ContractQuery, ContractQueryOptions, ContractResponse } from "./contractQuery";
|
|
@@ -8,8 +10,8 @@ export { useDataState, useInfiniteDataState } from "./dataState";
|
|
|
8
10
|
export type { SaveWithVersionOptions, SaveWithVersionResult, VersionedRead } from "./entityVersion";
|
|
9
11
|
export { entityTagOf, saveWithVersion, versionOf, withIfMatch } from "./entityVersion";
|
|
10
12
|
export { setupApiListeners } from "./listeners";
|
|
11
|
-
export type {
|
|
12
|
-
export {
|
|
13
|
+
export type { PagedDataObject, PagedListRequest, SortOrder } from "./paging";
|
|
14
|
+
export { getNextPageParam, getPreviousPageParam, hasNextPage, hasPreviousPage } from "./paging";
|
|
13
15
|
export type { PersistedQueries, PersistedQueriesOptions } from "./persistedQueries";
|
|
14
16
|
export { createPersistedQueries, PERSISTED_QUERIES_RESTORED } from "./persistedQueries";
|
|
15
17
|
export type { ApiTag, TagId } from "./tags";
|
|
@@ -20,17 +20,6 @@ export interface PagedListRequest {
|
|
|
20
20
|
sortBy?: string | undefined;
|
|
21
21
|
sortOrder?: SortOrder | undefined;
|
|
22
22
|
}
|
|
23
|
-
export type ListFilterValue = string | number | boolean | null | undefined;
|
|
24
|
-
export interface ListQuery extends PagedListRequest {
|
|
25
|
-
filters?: Record<string, ListFilterValue> | undefined;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* The `params` for a list endpoint. Filters sit beside the paging keys, as the
|
|
29
|
-
* API's request type derives from `PagedListRequest`. Unset values and empty
|
|
30
|
-
* strings are dropped, so a cleared filter never sends `?status=`. A filter
|
|
31
|
-
* named like a paging key is refused rather than silently overriding it.
|
|
32
|
-
*/
|
|
33
|
-
export declare const buildListQuery: ({ page, pageSize, sortBy, sortOrder, filters }: ListQuery) => Record<string, string | number | boolean>;
|
|
34
23
|
export declare const hasNextPage: (page: PagedDataObject<unknown>) => boolean;
|
|
35
24
|
export declare const hasPreviousPage: (page: PagedDataObject<unknown>) => boolean;
|
|
36
25
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ContractListQueryInput } from "@webority/api-contract/call";
|
|
1
2
|
import { type ApiError } from "../errors";
|
|
2
3
|
import type { DataState } from "./dataState";
|
|
3
|
-
import { type
|
|
4
|
+
import { type PagedDataObject } from "./paging";
|
|
4
5
|
export interface PagedListPaging {
|
|
5
6
|
hasMore: boolean;
|
|
6
7
|
loadingMore: boolean;
|
|
@@ -8,12 +9,12 @@ export interface PagedListPaging {
|
|
|
8
9
|
loadMore: () => void;
|
|
9
10
|
retryMore: () => void;
|
|
10
11
|
}
|
|
11
|
-
export interface UsePagedListOptions<T
|
|
12
|
-
fetchPage: (query:
|
|
12
|
+
export interface UsePagedListOptions<T, TQuery = Record<string, unknown>> {
|
|
13
|
+
fetchPage: (query: ContractListQueryInput<TQuery>, signal: AbortSignal) => Promise<PagedDataObject<T>>;
|
|
13
14
|
pageSize?: number | undefined;
|
|
14
|
-
filters?:
|
|
15
|
-
sortBy?:
|
|
16
|
-
sortOrder?:
|
|
15
|
+
filters?: ContractListQueryInput<TQuery>["filters"];
|
|
16
|
+
sortBy?: ContractListQueryInput<TQuery>["sortBy"];
|
|
17
|
+
sortOrder?: ContractListQueryInput<TQuery>["sortOrder"];
|
|
17
18
|
enabled?: boolean | undefined;
|
|
18
19
|
/** Called when a refresh or next-page load fails while items are shown; the items stay. */
|
|
19
20
|
onRefreshError?: ((error: ApiError) => void) | undefined;
|
|
@@ -24,5 +25,5 @@ export interface PagedListResult<T> {
|
|
|
24
25
|
totalCountCapped: boolean;
|
|
25
26
|
paging: PagedListPaging;
|
|
26
27
|
}
|
|
27
|
-
export declare function usePagedList<T
|
|
28
|
+
export declare function usePagedList<T, TQuery = Record<string, unknown>>(options: UsePagedListOptions<T, TQuery>): PagedListResult<T>;
|
|
28
29
|
//# sourceMappingURL=usePagedList.d.ts.map
|
|
@@ -12,14 +12,14 @@ export interface SmsRetrieverBackend {
|
|
|
12
12
|
/** Test-only injection point. Pass `null` to reset to the native module. */
|
|
13
13
|
export declare const setSmsRetrieverImplementation: (impl: SmsRetrieverBackend | null) => void;
|
|
14
14
|
/**
|
|
15
|
-
* The Play Services SMS Retriever API
|
|
15
|
+
* The Play Services SMS Retriever API, which auto-reads an incoming OTP SMS with
|
|
16
16
|
* no SMS permission, matched by an 11-character app-signature hash
|
|
17
17
|
* (`getAppHash`) the backend appends to the message. Android only; every
|
|
18
18
|
* method is safe to call on iOS and resolves/reports unavailable rather than
|
|
19
19
|
* throwing, so a caller doesn't need a platform check at every call site.
|
|
20
20
|
* A native listener that fails to start is reported through `onError` as `UNKNOWN_ERROR`; without an `onError` it throws.
|
|
21
21
|
*
|
|
22
|
-
* OTP extraction is left to the caller
|
|
22
|
+
* OTP extraction is left to the caller: `onMessage` receives the raw SMS
|
|
23
23
|
* text, since the expected OTP format (digit count, prefix) is a backend
|
|
24
24
|
* concern, not this module's.
|
|
25
25
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TurboModule } from "react-native";
|
|
2
2
|
/**
|
|
3
|
-
* Android-only
|
|
3
|
+
* Android-only. The Play Services SMS Retriever API has no iOS equivalent.
|
|
4
4
|
* The JS wrapper in `smsRetriever/index.ts` never touches this module on
|
|
5
5
|
* iOS, so `getEnforcing` only ever runs on Android, where autolinking has
|
|
6
6
|
* registered `SmsRetrieverPackage`.
|
|
@@ -21,7 +21,7 @@ export interface SqliteDriver {
|
|
|
21
21
|
}) => Promise<SqliteDatabase>;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Test/showcase-only injection point
|
|
24
|
+
* Test/showcase-only injection point; see the module header. Not a way to
|
|
25
25
|
* pick an alternate real driver; `@webority/mobile-core` always
|
|
26
26
|
* resolves expo-sqlite when nothing is injected. Pass `null` to clear it.
|
|
27
27
|
*/
|
|
@@ -14,7 +14,7 @@ interface AsyncStorageLike {
|
|
|
14
14
|
* pairs, and `setMany` takes a Record where `multiSet` took pairs. The v1
|
|
15
15
|
* names are still what `expo-sqlite/kv-store` and AsyncStorage 2 expose.
|
|
16
16
|
*
|
|
17
|
-
* Declaring only one set is not a compile error and not a runtime error
|
|
17
|
+
* Declaring only one set is not a compile error and not a runtime error; it
|
|
18
18
|
* silently falls through to the per-key loop below. Apps pin
|
|
19
19
|
* AsyncStorage 3, so recognising only the v1 names put every consumer on N
|
|
20
20
|
* round-trips per batch with nothing to notice.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
export declare const isNonEmpty: (value: unknown) => boolean;
|
|
9
9
|
export declare const isEmail: (value: unknown) => boolean;
|
|
10
10
|
/**
|
|
11
|
-
* Generic phone validator: 7
|
|
11
|
+
* Generic phone validator: 7 to 15 digits, optional `+` prefix.
|
|
12
12
|
* Use `isIndianMobile` from `@webority/mobile-core/india` when you specifically need an Indian mobile number.
|
|
13
13
|
*/
|
|
14
14
|
export declare const isPhone: (value: unknown) => boolean;
|
|
@@ -2,7 +2,7 @@ import { type Environment } from "../config";
|
|
|
2
2
|
import { type DeviceInfoLike } from "./appBuild";
|
|
3
3
|
/**
|
|
4
4
|
* Supply the app identity from a native module instead of config.
|
|
5
|
-
* Prefer `setConfig({ appId, appBuild })
|
|
5
|
+
* Prefer `setConfig({ appId, appBuild })`. It needs no native dependency.
|
|
6
6
|
* Pass `null` to clear.
|
|
7
7
|
*/
|
|
8
8
|
export declare const setDeviceInfoImplementation: (impl: DeviceInfoLike | null) => void;
|
|
@@ -3,7 +3,7 @@ import type { AxiosInstance } from "axios";
|
|
|
3
3
|
* Resolves `baseURL` PER REQUEST rather than at module evaluation.
|
|
4
4
|
*
|
|
5
5
|
* `axios.create({ baseURL: getConfigValue('baseUrl') })` reads the value once,
|
|
6
|
-
* when the module is first imported
|
|
6
|
+
* when the module is first imported, which happens the moment anything touches
|
|
7
7
|
* the package barrel, long before an app's startup code can call `setConfig`.
|
|
8
8
|
* The result was a client permanently pinned to `undefined` and a `setConfig`
|
|
9
9
|
* that appeared to do nothing, with no error anywhere: requests just went to a
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
import { type ContractCallOptions, type OperationEntry, type OperationShape } from "@webority/api-contract/call";
|
|
1
|
+
import { type ContractCallOptions, type ContractFullReply, type OperationEntry, type OperationShape } from "@webority/api-contract/call";
|
|
2
2
|
import type { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
3
3
|
/**
|
|
4
4
|
* Per-call options: an abort signal, a timeout, the client's retry override (`false`, or a policy such as `{ retries: 1 }`),
|
|
5
|
-
* call headers the contract does not declare, `skipErrorLog`
|
|
6
|
-
* headers and
|
|
5
|
+
* call headers the contract does not declare, `skipErrorLog`, `expectedStatuses`, `reply` (`"full"` resolves to the status,
|
|
6
|
+
* headers and body, and a 304 resolves as `notModified`), `replacesSession` (the reply carries a new session, which the
|
|
7
|
+
* client stores before the call resolves) and `onSessionReplaced` (runs after those tokens are stored and receives the
|
|
8
|
+
* reply body). buildContractRequest validates the headers and the error and reply options, and throws ContractCallError
|
|
9
|
+
* on an invalid value before anything is sent.
|
|
7
10
|
*/
|
|
8
|
-
export type ContractCallConfig = Pick<AxiosRequestConfig, "signal" | "timeout" | "retry"> & ContractCallOptions;
|
|
9
|
-
export
|
|
11
|
+
export type ContractCallConfig = Pick<AxiosRequestConfig, "signal" | "timeout" | "retry" | "onSessionReplaced"> & ContractCallOptions;
|
|
12
|
+
export interface ContractCaller<TOperations extends {
|
|
10
13
|
readonly [K in keyof TOperations]: OperationShape;
|
|
11
|
-
}>
|
|
12
|
-
|
|
14
|
+
}> {
|
|
15
|
+
<TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config: ContractCallConfig & {
|
|
16
|
+
readonly reply: "full";
|
|
17
|
+
}): Promise<ContractFullReply<TOperations[TId]["response"]>>;
|
|
18
|
+
<TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?: ContractCallConfig & {
|
|
19
|
+
readonly reply?: "body" | undefined;
|
|
20
|
+
}): Promise<TOperations[TId]["response"]>;
|
|
21
|
+
}
|
|
22
|
+
export declare function createContractCaller<TOperations extends {
|
|
23
|
+
readonly [K in keyof TOperations]: OperationShape;
|
|
24
|
+
}>(client: Pick<AxiosInstance, "request">, operations: {
|
|
25
|
+
readonly [K in keyof TOperations & string]: OperationEntry;
|
|
26
|
+
}): ContractCaller<TOperations>;
|
|
13
27
|
//# sourceMappingURL=contractCaller.d.ts.map
|
|
@@ -19,7 +19,7 @@ export interface Config {
|
|
|
19
19
|
*/
|
|
20
20
|
country: string;
|
|
21
21
|
/**
|
|
22
|
-
* The app's store identifier
|
|
22
|
+
* The app's store identifier (Android package name / iOS bundle id). Every
|
|
23
23
|
* Webority app already has this in its `appsettings.Compiled.json`, so the
|
|
24
24
|
* version-check module reads it from here rather than crossing the native
|
|
25
25
|
* bridge for a value the app already knows.
|
|
@@ -11,7 +11,7 @@ export interface FormatCurrencyOptions extends Omit<Intl.NumberFormatOptions, "s
|
|
|
11
11
|
minimumFractionDigits?: number | undefined;
|
|
12
12
|
/** Maximum fraction digits. Defaults to the currency's own. */
|
|
13
13
|
maximumFractionDigits?: number | undefined;
|
|
14
|
-
/** Strip the currency symbol
|
|
14
|
+
/** Strip the currency symbol. Useful when the symbol is rendered separately. */
|
|
15
15
|
stripSymbol?: boolean | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* What a missing amount prints. Defaults to the configured placeholder once the app has
|
|
@@ -27,24 +27,24 @@ export declare const startOfDay: (value: DateInput) => Date | null;
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const addDays: (value: DateInput | null | undefined, count: number) => Date | null;
|
|
29
29
|
/**
|
|
30
|
-
* Small dayjs/moment-style token formatter
|
|
30
|
+
* Small dayjs/moment-style token formatter: YYYY/YY, MMMM/MMM/MM/M,
|
|
31
31
|
* DD/D, dddd/ddd, HH/H (24h), hh/h (12h), mm/m, ss/s, A/a (upper/lower AM/PM).
|
|
32
32
|
* Everything else in the pattern (spaces, commas, colons) passes through
|
|
33
33
|
* literally. Hand-rolled rather than a dependency because the date
|
|
34
|
-
* formatting needs are a small, closed token set, not general i18n
|
|
34
|
+
* formatting needs are a small, closed token set, not general i18n; for
|
|
35
35
|
* genuinely locale-aware output, `formatDate`/`formatTime` (Intl-backed, in
|
|
36
36
|
* `./date`) are the ones to reach for; this is for matching an exact
|
|
37
37
|
* existing pattern (a legacy display string, an API's expected shape).
|
|
38
38
|
*
|
|
39
39
|
* `utc: true` reads every field from the UTC calendar/clock instead of the
|
|
40
|
-
* device's local one
|
|
40
|
+
* device's local one. See `formatDateDDMMMYYYY`'s note on why this isn't
|
|
41
41
|
* cosmetic.
|
|
42
42
|
*/
|
|
43
43
|
export declare const formatDatePattern: (value: DateInput, pattern: string, options?: {
|
|
44
44
|
utc?: boolean | undefined;
|
|
45
45
|
}) => string;
|
|
46
46
|
/**
|
|
47
|
-
* `DD MMM, YYYY
|
|
47
|
+
* `DD MMM, YYYY`: zero-padded day, short month, comma, year (e.g.
|
|
48
48
|
* `05 Sep, 2025`). A specific legacy pattern some apps already display,
|
|
49
49
|
* not the recommended convention: `formatDate` (the Intl `style`-based
|
|
50
50
|
* formatter in `./date`) is the one to reach for in new code. This exists so
|
|
@@ -52,7 +52,7 @@ export declare const formatDatePattern: (value: DateInput, pattern: string, opti
|
|
|
52
52
|
* without a visible change.
|
|
53
53
|
*
|
|
54
54
|
* `utc: true` reads the calendar day from the UTC fields instead of the
|
|
55
|
-
* device's local ones
|
|
55
|
+
* device's local ones, matching `dayjs.utc(x).format(...)`, not
|
|
56
56
|
* `dayjs(x).format(...)`. The two disagree whenever local time has crossed a
|
|
57
57
|
* day boundary UTC hasn't yet (or vice versa), so this is not a cosmetic
|
|
58
58
|
* option; pass it only to match a call site that was genuinely UTC-explicit.
|
|
@@ -63,26 +63,26 @@ export declare const formatDateDDMMMYYYY: (value: DateInput, options?: {
|
|
|
63
63
|
/** `YYYY-MM-DD`, in the device's local timezone. */
|
|
64
64
|
export declare const formatDateISO: (value: DateInput) => string;
|
|
65
65
|
/**
|
|
66
|
-
* `hh:mm A` in the device's local timezone
|
|
66
|
+
* `hh:mm A` in the device's local timezone: zero-padded 12-hour clock,
|
|
67
67
|
* uppercase AM/PM (e.g. `09:30 PM`).
|
|
68
68
|
*/
|
|
69
69
|
export declare const formatTime12h: (value: DateInput) => string;
|
|
70
70
|
/**
|
|
71
71
|
* `hh:mm a` (zero-padded 12-hour, lowercase am/pm) of the given instant as
|
|
72
|
-
* seen in `ianaTimeZone` (e.g. `Asia/Kolkata`)
|
|
72
|
+
* seen in `ianaTimeZone` (e.g. `Asia/Kolkata`), not the device's own
|
|
73
73
|
* timezone. Reads the hour/minute/period through `Intl.DateTimeFormat`'s
|
|
74
74
|
* `formatToParts` rather than its assembled string, because the assembled
|
|
75
75
|
* string's spacing before AM/PM varies by JS engine (some insert a narrow
|
|
76
76
|
* no-break space, U+202F, instead of a plain space) and isn't reliably
|
|
77
77
|
* zero-padded either. Throws if `ianaTimeZone` isn't a timezone Intl
|
|
78
|
-
* recognises
|
|
78
|
+
* recognises: the same failure mode as handing dayjs.tz() a bad zone name.
|
|
79
79
|
*/
|
|
80
80
|
export declare const formatTimeInZone: (value: DateInput, ianaTimeZone: string) => string;
|
|
81
81
|
/**
|
|
82
82
|
* Same as {@link formatTimeInZone}, but for a .NET-style Windows timezone ID
|
|
83
83
|
* (e.g. `"India Standard Time"`) rather than an IANA one. .NET's own
|
|
84
84
|
* `TimeZoneInfo` API only knows Windows IDs, so a backend built on it hands
|
|
85
|
-
* these to clients directly
|
|
85
|
+
* these to clients directly. `Intl`, by contrast, only recognises IANA
|
|
86
86
|
* names, so the ID has to be translated before it can be used here. Throws
|
|
87
87
|
* if `windowsTimeZoneId` has no known IANA mapping.
|
|
88
88
|
*/
|
|
@@ -15,7 +15,7 @@ export declare function formatNumber(value: number | null | undefined, fractionD
|
|
|
15
15
|
export declare function formatPercent(value: number | string | null | undefined, options?: FormatPercentOptions): string;
|
|
16
16
|
/**
|
|
17
17
|
* Intl percent output. Pass `asRatio: false` if the input is already on the
|
|
18
|
-
* 0
|
|
18
|
+
* 0 to 100 scale.
|
|
19
19
|
*/
|
|
20
20
|
export declare function formatPercent(value: number | null | undefined, fractionDigits: number | undefined, asRatio?: boolean, locale?: string): string;
|
|
21
21
|
/**
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* Windows zone, generated from CLDR's `windowsZones.xml` (the same
|
|
4
4
|
* upstream source the retired `windows-iana` npm package derived its own
|
|
5
5
|
* table from). Only the `territory="001"` (world-default) row is kept per
|
|
6
|
-
* Windows zone
|
|
6
|
+
* Windows zone. `formatTimeInWindowsZone` only ever reads the first IANA
|
|
7
7
|
* candidate, and CLDR's `001` row is exactly that default candidate, so
|
|
8
8
|
* per-country territory variants (`US`, `CA`, `ZZ`, …) carry no information
|
|
9
9
|
* this table's one caller uses.
|
|
10
10
|
*
|
|
11
11
|
* Regenerate with `node packages/core/scripts/generate-windows-to-iana-table.mjs
|
|
12
12
|
* <path-to-windowsZones.xml>` (CLDR: `common/supplemental/windowsZones.xml` in
|
|
13
|
-
* https://github.com/unicode-org/cldr) whenever CLDR adds/renames a zone
|
|
14
|
-
*
|
|
13
|
+
* https://github.com/unicode-org/cldr) whenever CLDR adds/renames a zone.
|
|
14
|
+
* This is a committed, static table; nothing fetches CLDR at build or test
|
|
15
15
|
* time.
|
|
16
16
|
*/
|
|
17
17
|
export declare const WINDOWS_TO_IANA: Readonly<Record<string, string>>;
|
|
@@ -34,7 +34,7 @@ export interface ExpoLocationLike {
|
|
|
34
34
|
* subscription later. So the adapter mints its own id immediately and stores
|
|
35
35
|
* the subscription against it on arrival. `clearWatch` called during that
|
|
36
36
|
* window records the id as cancelled, and the subscription is removed the
|
|
37
|
-
* moment it lands
|
|
37
|
+
* moment it lands. Without that, a screen that unmounts before the watch
|
|
38
38
|
* starts leaks a live GPS listener for the rest of the session, which is a
|
|
39
39
|
* battery drain nobody would attribute to this code.
|
|
40
40
|
*/
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
* client reads the bearer token. It needs no optional peer: the backend is
|
|
37
37
|
* expo-secure-store, and `expo` is required anyway.
|
|
38
38
|
*/
|
|
39
|
+
export type { ContractFullReply, ContractListQueryInput } from "@webority/api-contract/call";
|
|
40
|
+
export { listQuery } from "@webority/api-contract/call";
|
|
39
41
|
export type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
|
|
40
42
|
export type { AccountIdProvider, ClientKind } from "./api/clientHeaders.js";
|
|
41
43
|
export { ACCOUNT_ID_HEADER, CLIENT_BUILD_HEADER, CLIENT_KIND, CLIENT_KIND_HEADER, getClientBuild, } from "./api/clientHeaders.js";
|
|
@@ -28,7 +28,7 @@ export interface TokenRefreshConfig {
|
|
|
28
28
|
headers?: (() => Record<string, string> | Promise<Record<string, string>>) | undefined;
|
|
29
29
|
/**
|
|
30
30
|
* Reads the new tokens from the response body. Defaults to the Webority API's
|
|
31
|
-
* `{ accessToken,
|
|
31
|
+
* `{ accessToken, accessTokenExpiresDateTimeUtc, refreshToken, refreshTokenExpiresDateTimeUtc }`.
|
|
32
32
|
*/
|
|
33
33
|
readTokens?: ((data: unknown) => TokenRefreshResult) | undefined;
|
|
34
34
|
}
|
|
@@ -38,7 +38,7 @@ declare const openAppSettings: () => Promise<boolean>;
|
|
|
38
38
|
/**
|
|
39
39
|
* Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
|
|
40
40
|
* (camera, photos, location, notifications, …) to whichever Expo adapter an
|
|
41
|
-
* app has registered by importing that kind's entry point
|
|
41
|
+
* app has registered by importing that kind's entry point: expo-camera,
|
|
42
42
|
* expo-image-picker, expo-location, expo-contacts, expo-calendar,
|
|
43
43
|
* expo-notifications, expo-media-library. An app imports only the entry
|
|
44
44
|
* points for the kinds it actually asks for.
|
|
@@ -19,7 +19,7 @@ export interface ApiRequest {
|
|
|
19
19
|
method?: Method | undefined;
|
|
20
20
|
/** The request body. FormData is sent as multipart by the client. */
|
|
21
21
|
data?: unknown;
|
|
22
|
-
/** Query string values; build list queries with `
|
|
22
|
+
/** Query string values; build list queries with `listQuery`. */
|
|
23
23
|
params?: Record<string, unknown> | undefined;
|
|
24
24
|
headers?: Record<string, string> | undefined;
|
|
25
25
|
/** Only JSON-safe types belong in the store; a blob download stays a service call. */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type { ContractListQueryInput } from "@webority/api-contract/call";
|
|
2
|
+
export { listQuery } from "@webority/api-contract/call";
|
|
1
3
|
export type { ApiBaseQuery, ApiBaseQueryMeta, ApiBaseQueryOptions, ApiExtraOptions, ApiQueryArgs, ApiRequest, } from "./apiBaseQuery.js";
|
|
2
4
|
export { createApiBaseQuery } from "./apiBaseQuery.js";
|
|
3
5
|
export type { ContractQuery, ContractQueryOptions, ContractResponse } from "./contractQuery.js";
|
|
@@ -8,8 +10,8 @@ export { useDataState, useInfiniteDataState } from "./dataState.js";
|
|
|
8
10
|
export type { SaveWithVersionOptions, SaveWithVersionResult, VersionedRead } from "./entityVersion.js";
|
|
9
11
|
export { entityTagOf, saveWithVersion, versionOf, withIfMatch } from "./entityVersion.js";
|
|
10
12
|
export { setupApiListeners } from "./listeners.js";
|
|
11
|
-
export type {
|
|
12
|
-
export {
|
|
13
|
+
export type { PagedDataObject, PagedListRequest, SortOrder } from "./paging.js";
|
|
14
|
+
export { getNextPageParam, getPreviousPageParam, hasNextPage, hasPreviousPage } from "./paging.js";
|
|
13
15
|
export type { PersistedQueries, PersistedQueriesOptions } from "./persistedQueries.js";
|
|
14
16
|
export { createPersistedQueries, PERSISTED_QUERIES_RESTORED } from "./persistedQueries.js";
|
|
15
17
|
export type { ApiTag, TagId } from "./tags.js";
|
|
@@ -20,17 +20,6 @@ export interface PagedListRequest {
|
|
|
20
20
|
sortBy?: string | undefined;
|
|
21
21
|
sortOrder?: SortOrder | undefined;
|
|
22
22
|
}
|
|
23
|
-
export type ListFilterValue = string | number | boolean | null | undefined;
|
|
24
|
-
export interface ListQuery extends PagedListRequest {
|
|
25
|
-
filters?: Record<string, ListFilterValue> | undefined;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* The `params` for a list endpoint. Filters sit beside the paging keys, as the
|
|
29
|
-
* API's request type derives from `PagedListRequest`. Unset values and empty
|
|
30
|
-
* strings are dropped, so a cleared filter never sends `?status=`. A filter
|
|
31
|
-
* named like a paging key is refused rather than silently overriding it.
|
|
32
|
-
*/
|
|
33
|
-
export declare const buildListQuery: ({ page, pageSize, sortBy, sortOrder, filters }: ListQuery) => Record<string, string | number | boolean>;
|
|
34
23
|
export declare const hasNextPage: (page: PagedDataObject<unknown>) => boolean;
|
|
35
24
|
export declare const hasPreviousPage: (page: PagedDataObject<unknown>) => boolean;
|
|
36
25
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ContractListQueryInput } from "@webority/api-contract/call";
|
|
1
2
|
import { type ApiError } from "../errors/index.js";
|
|
2
3
|
import type { DataState } from "./dataState.js";
|
|
3
|
-
import { type
|
|
4
|
+
import { type PagedDataObject } from "./paging.js";
|
|
4
5
|
export interface PagedListPaging {
|
|
5
6
|
hasMore: boolean;
|
|
6
7
|
loadingMore: boolean;
|
|
@@ -8,12 +9,12 @@ export interface PagedListPaging {
|
|
|
8
9
|
loadMore: () => void;
|
|
9
10
|
retryMore: () => void;
|
|
10
11
|
}
|
|
11
|
-
export interface UsePagedListOptions<T
|
|
12
|
-
fetchPage: (query:
|
|
12
|
+
export interface UsePagedListOptions<T, TQuery = Record<string, unknown>> {
|
|
13
|
+
fetchPage: (query: ContractListQueryInput<TQuery>, signal: AbortSignal) => Promise<PagedDataObject<T>>;
|
|
13
14
|
pageSize?: number | undefined;
|
|
14
|
-
filters?:
|
|
15
|
-
sortBy?:
|
|
16
|
-
sortOrder?:
|
|
15
|
+
filters?: ContractListQueryInput<TQuery>["filters"];
|
|
16
|
+
sortBy?: ContractListQueryInput<TQuery>["sortBy"];
|
|
17
|
+
sortOrder?: ContractListQueryInput<TQuery>["sortOrder"];
|
|
17
18
|
enabled?: boolean | undefined;
|
|
18
19
|
/** Called when a refresh or next-page load fails while items are shown; the items stay. */
|
|
19
20
|
onRefreshError?: ((error: ApiError) => void) | undefined;
|
|
@@ -24,5 +25,5 @@ export interface PagedListResult<T> {
|
|
|
24
25
|
totalCountCapped: boolean;
|
|
25
26
|
paging: PagedListPaging;
|
|
26
27
|
}
|
|
27
|
-
export declare function usePagedList<T
|
|
28
|
+
export declare function usePagedList<T, TQuery = Record<string, unknown>>(options: UsePagedListOptions<T, TQuery>): PagedListResult<T>;
|
|
28
29
|
//# sourceMappingURL=usePagedList.d.ts.map
|
|
@@ -12,14 +12,14 @@ export interface SmsRetrieverBackend {
|
|
|
12
12
|
/** Test-only injection point. Pass `null` to reset to the native module. */
|
|
13
13
|
export declare const setSmsRetrieverImplementation: (impl: SmsRetrieverBackend | null) => void;
|
|
14
14
|
/**
|
|
15
|
-
* The Play Services SMS Retriever API
|
|
15
|
+
* The Play Services SMS Retriever API, which auto-reads an incoming OTP SMS with
|
|
16
16
|
* no SMS permission, matched by an 11-character app-signature hash
|
|
17
17
|
* (`getAppHash`) the backend appends to the message. Android only; every
|
|
18
18
|
* method is safe to call on iOS and resolves/reports unavailable rather than
|
|
19
19
|
* throwing, so a caller doesn't need a platform check at every call site.
|
|
20
20
|
* A native listener that fails to start is reported through `onError` as `UNKNOWN_ERROR`; without an `onError` it throws.
|
|
21
21
|
*
|
|
22
|
-
* OTP extraction is left to the caller
|
|
22
|
+
* OTP extraction is left to the caller: `onMessage` receives the raw SMS
|
|
23
23
|
* text, since the expected OTP format (digit count, prefix) is a backend
|
|
24
24
|
* concern, not this module's.
|
|
25
25
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TurboModule } from "react-native";
|
|
2
2
|
/**
|
|
3
|
-
* Android-only
|
|
3
|
+
* Android-only. The Play Services SMS Retriever API has no iOS equivalent.
|
|
4
4
|
* The JS wrapper in `smsRetriever/index.ts` never touches this module on
|
|
5
5
|
* iOS, so `getEnforcing` only ever runs on Android, where autolinking has
|
|
6
6
|
* registered `SmsRetrieverPackage`.
|
|
@@ -21,7 +21,7 @@ export interface SqliteDriver {
|
|
|
21
21
|
}) => Promise<SqliteDatabase>;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Test/showcase-only injection point
|
|
24
|
+
* Test/showcase-only injection point; see the module header. Not a way to
|
|
25
25
|
* pick an alternate real driver; `@webority/mobile-core` always
|
|
26
26
|
* resolves expo-sqlite when nothing is injected. Pass `null` to clear it.
|
|
27
27
|
*/
|
|
@@ -14,7 +14,7 @@ interface AsyncStorageLike {
|
|
|
14
14
|
* pairs, and `setMany` takes a Record where `multiSet` took pairs. The v1
|
|
15
15
|
* names are still what `expo-sqlite/kv-store` and AsyncStorage 2 expose.
|
|
16
16
|
*
|
|
17
|
-
* Declaring only one set is not a compile error and not a runtime error
|
|
17
|
+
* Declaring only one set is not a compile error and not a runtime error; it
|
|
18
18
|
* silently falls through to the per-key loop below. Apps pin
|
|
19
19
|
* AsyncStorage 3, so recognising only the v1 names put every consumer on N
|
|
20
20
|
* round-trips per batch with nothing to notice.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
export declare const isNonEmpty: (value: unknown) => boolean;
|
|
9
9
|
export declare const isEmail: (value: unknown) => boolean;
|
|
10
10
|
/**
|
|
11
|
-
* Generic phone validator: 7
|
|
11
|
+
* Generic phone validator: 7 to 15 digits, optional `+` prefix.
|
|
12
12
|
* Use `isIndianMobile` from `@webority/mobile-core/india` when you specifically need an Indian mobile number.
|
|
13
13
|
*/
|
|
14
14
|
export declare const isPhone: (value: unknown) => boolean;
|
|
@@ -2,7 +2,7 @@ import { type Environment } from "../config/index.js";
|
|
|
2
2
|
import { type DeviceInfoLike } from "./appBuild.js";
|
|
3
3
|
/**
|
|
4
4
|
* Supply the app identity from a native module instead of config.
|
|
5
|
-
* Prefer `setConfig({ appId, appBuild })
|
|
5
|
+
* Prefer `setConfig({ appId, appBuild })`. It needs no native dependency.
|
|
6
6
|
* Pass `null` to clear.
|
|
7
7
|
*/
|
|
8
8
|
export declare const setDeviceInfoImplementation: (impl: DeviceInfoLike | null) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.164.0",
|
|
4
4
|
"description": "Platform layer for Webority React Native apps: HTTP clients, auth/token storage, config, logging, formatters, validators, network status, permissions, storage, version checks and over-the-air updates. No UI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -399,7 +399,7 @@
|
|
|
399
399
|
}
|
|
400
400
|
},
|
|
401
401
|
"dependencies": {
|
|
402
|
-
"@webority/api-contract": "0.
|
|
402
|
+
"@webority/api-contract": "0.164.0",
|
|
403
403
|
"axios": "^1.19.0",
|
|
404
404
|
"libphonenumber-js": "^1.12.41"
|
|
405
405
|
},
|
|
@@ -2,7 +2,7 @@ import type { TurboModule } from "react-native";
|
|
|
2
2
|
import { TurboModuleRegistry } from "react-native";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Android-only
|
|
5
|
+
* Android-only. The Play Services SMS Retriever API has no iOS equivalent.
|
|
6
6
|
* The JS wrapper in `smsRetriever/index.ts` never touches this module on
|
|
7
7
|
* iOS, so `getEnforcing` only ever runs on Android, where autolinking has
|
|
8
8
|
* registered `SmsRetrieverPackage`.
|