@webority-technologies/mobile-core 0.0.1 → 0.0.2
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 +22 -1
- package/lib/commonjs/api/baseUrl.js +34 -0
- package/lib/commonjs/api/curl.js +109 -0
- package/lib/commonjs/api/publicClient.js +11 -20
- package/lib/commonjs/api/retry.js +75 -0
- package/lib/commonjs/api/userClient.js +46 -22
- package/lib/commonjs/auth/authStore.js +101 -33
- package/lib/commonjs/auth/jwt.js +32 -8
- package/lib/commonjs/config/index.js +2 -1
- package/lib/commonjs/deepLink/index.js +286 -0
- package/lib/commonjs/download/adapters/expoFs.js +100 -0
- package/lib/commonjs/download/adapters/shared.js +13 -0
- package/lib/commonjs/download/index.js +272 -0
- package/lib/commonjs/formatters/date.js +1 -1
- package/lib/commonjs/formatters/index.js +6 -0
- package/lib/commonjs/formatters/phone.js +103 -15
- package/lib/commonjs/geolocation/adapters/expoLocation.js +126 -0
- package/lib/commonjs/geolocation/index.js +339 -0
- package/lib/commonjs/index.js +133 -48
- package/lib/commonjs/initSDK.js +23 -2
- package/lib/commonjs/initUserAuth.js +2 -1
- package/lib/commonjs/logger/index.js +159 -5
- package/lib/commonjs/network/index.js +6 -0
- package/lib/commonjs/network/networkStatus.js +50 -15
- package/lib/commonjs/permissions/index.js +24 -1
- package/lib/commonjs/sqlite/adapters/expo.js +53 -0
- package/lib/commonjs/sqlite/adapters/op.js +43 -0
- package/lib/commonjs/sqlite/adapters/rows.js +33 -0
- package/lib/commonjs/sqlite/adapters/storage.js +50 -0
- package/lib/commonjs/sqlite/adapters/sync.js +45 -0
- package/lib/commonjs/sqlite/index.js +610 -0
- package/lib/commonjs/sqlite/nitro.js +17 -0
- package/lib/commonjs/sqlite/op.js +18 -0
- package/lib/commonjs/sqlite/quick.js +14 -0
- package/lib/commonjs/sqlite/storage.js +14 -0
- package/lib/commonjs/storage/index.js +40 -19
- package/lib/commonjs/types/globals.d.js +6 -0
- package/lib/commonjs/utils/imageCompression.js +51 -14
- package/lib/commonjs/utils/index.js +6 -0
- package/lib/commonjs/versionCheck/index.js +28 -4
- package/lib/module/api/baseUrl.js +30 -0
- package/lib/module/api/curl.js +104 -0
- package/lib/module/api/publicClient.js +11 -20
- package/lib/module/api/retry.js +69 -0
- package/lib/module/api/userClient.js +45 -21
- package/lib/module/auth/authStore.js +99 -32
- package/lib/module/auth/jwt.js +32 -8
- package/lib/module/config/index.js +2 -1
- package/lib/module/deepLink/index.js +280 -0
- package/lib/module/download/adapters/expoFs.js +95 -0
- package/lib/module/download/adapters/shared.js +8 -0
- package/lib/module/download/index.js +264 -0
- package/lib/module/formatters/date.js +1 -1
- package/lib/module/formatters/index.js +1 -1
- package/lib/module/formatters/phone.js +99 -13
- package/lib/module/geolocation/adapters/expoLocation.js +121 -0
- package/lib/module/geolocation/index.js +332 -0
- package/lib/module/index.js +28 -11
- package/lib/module/initSDK.js +23 -2
- package/lib/module/initUserAuth.js +2 -1
- package/lib/module/logger/index.js +156 -4
- package/lib/module/network/index.js +1 -1
- package/lib/module/network/networkStatus.js +47 -14
- package/lib/module/permissions/index.js +22 -0
- package/lib/module/sqlite/adapters/expo.js +48 -0
- package/lib/module/sqlite/adapters/op.js +38 -0
- package/lib/module/sqlite/adapters/rows.js +28 -0
- package/lib/module/sqlite/adapters/storage.js +46 -0
- package/lib/module/sqlite/adapters/sync.js +41 -0
- package/lib/module/sqlite/index.js +600 -0
- package/lib/module/sqlite/nitro.js +12 -0
- package/lib/module/sqlite/op.js +13 -0
- package/lib/module/sqlite/quick.js +9 -0
- package/lib/module/sqlite/storage.js +9 -0
- package/lib/module/storage/index.js +37 -18
- package/lib/module/types/globals.d.js +10 -0
- package/lib/module/utils/imageCompression.js +49 -13
- package/lib/module/utils/index.js +1 -1
- package/lib/module/versionCheck/index.js +27 -4
- package/lib/typescript/commonjs/api/baseUrl.d.ts +20 -0
- package/lib/typescript/commonjs/api/curl.d.ts +18 -0
- package/lib/typescript/commonjs/api/retry.d.ts +27 -0
- package/lib/typescript/commonjs/api/userClient.d.ts +11 -0
- package/lib/typescript/commonjs/auth/authStore.d.ts +29 -6
- package/lib/typescript/commonjs/config/index.d.ts +6 -0
- package/lib/typescript/commonjs/deepLink/index.d.ts +54 -0
- package/lib/typescript/commonjs/download/adapters/expoFs.d.ts +45 -0
- package/lib/typescript/commonjs/download/adapters/shared.d.ts +3 -0
- package/lib/typescript/commonjs/download/index.d.ts +76 -0
- package/lib/typescript/commonjs/formatters/index.d.ts +2 -1
- package/lib/typescript/commonjs/formatters/phone.d.ts +16 -1
- package/lib/typescript/commonjs/geolocation/adapters/expoLocation.d.ts +42 -0
- package/lib/typescript/commonjs/geolocation/index.d.ts +89 -0
- package/lib/typescript/commonjs/index.d.ts +30 -13
- package/lib/typescript/commonjs/initSDK.d.ts +32 -0
- package/lib/typescript/commonjs/logger/index.d.ts +39 -0
- package/lib/typescript/commonjs/network/index.d.ts +2 -2
- package/lib/typescript/commonjs/network/networkStatus.d.ts +16 -0
- package/lib/typescript/commonjs/permissions/index.d.ts +35 -0
- package/lib/typescript/commonjs/sqlite/adapters/expo.d.ts +30 -0
- package/lib/typescript/commonjs/sqlite/adapters/op.d.ts +27 -0
- package/lib/typescript/commonjs/sqlite/adapters/rows.d.ts +7 -0
- package/lib/typescript/commonjs/sqlite/adapters/storage.d.ts +30 -0
- package/lib/typescript/commonjs/sqlite/adapters/sync.d.ts +31 -0
- package/lib/typescript/commonjs/sqlite/index.d.ts +121 -0
- package/lib/typescript/commonjs/sqlite/nitro.d.ts +7 -0
- package/lib/typescript/commonjs/sqlite/op.d.ts +8 -0
- package/lib/typescript/commonjs/sqlite/quick.d.ts +4 -0
- package/lib/typescript/commonjs/sqlite/storage.d.ts +4 -0
- package/lib/typescript/commonjs/storage/index.d.ts +24 -2
- package/lib/typescript/commonjs/utils/imageCompression.d.ts +17 -0
- package/lib/typescript/commonjs/utils/index.d.ts +2 -2
- package/lib/typescript/module/api/baseUrl.d.ts +20 -0
- package/lib/typescript/module/api/curl.d.ts +18 -0
- package/lib/typescript/module/api/retry.d.ts +27 -0
- package/lib/typescript/module/api/userClient.d.ts +11 -0
- package/lib/typescript/module/auth/authStore.d.ts +29 -6
- package/lib/typescript/module/config/index.d.ts +6 -0
- package/lib/typescript/module/deepLink/index.d.ts +54 -0
- package/lib/typescript/module/download/adapters/expoFs.d.ts +45 -0
- package/lib/typescript/module/download/adapters/shared.d.ts +3 -0
- package/lib/typescript/module/download/index.d.ts +76 -0
- package/lib/typescript/module/formatters/index.d.ts +2 -1
- package/lib/typescript/module/formatters/phone.d.ts +16 -1
- package/lib/typescript/module/geolocation/adapters/expoLocation.d.ts +42 -0
- package/lib/typescript/module/geolocation/index.d.ts +89 -0
- package/lib/typescript/module/index.d.ts +30 -13
- package/lib/typescript/module/initSDK.d.ts +32 -0
- package/lib/typescript/module/logger/index.d.ts +39 -0
- package/lib/typescript/module/network/index.d.ts +2 -2
- package/lib/typescript/module/network/networkStatus.d.ts +16 -0
- package/lib/typescript/module/permissions/index.d.ts +35 -0
- package/lib/typescript/module/sqlite/adapters/expo.d.ts +30 -0
- package/lib/typescript/module/sqlite/adapters/op.d.ts +27 -0
- package/lib/typescript/module/sqlite/adapters/rows.d.ts +7 -0
- package/lib/typescript/module/sqlite/adapters/storage.d.ts +30 -0
- package/lib/typescript/module/sqlite/adapters/sync.d.ts +31 -0
- package/lib/typescript/module/sqlite/index.d.ts +121 -0
- package/lib/typescript/module/sqlite/nitro.d.ts +7 -0
- package/lib/typescript/module/sqlite/op.d.ts +8 -0
- package/lib/typescript/module/sqlite/quick.d.ts +4 -0
- package/lib/typescript/module/sqlite/storage.d.ts +4 -0
- package/lib/typescript/module/storage/index.d.ts +24 -2
- package/lib/typescript/module/utils/imageCompression.d.ts +17 -0
- package/lib/typescript/module/utils/index.d.ts +2 -2
- package/package.json +102 -14
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { GeolocationLike } from '../index';
|
|
2
|
+
/**
|
|
3
|
+
* The slice of expo-location this adapter uses. Verified against 57.0.14.
|
|
4
|
+
*
|
|
5
|
+
* The REQUIRE lives in the entry point beside this file, never here.
|
|
6
|
+
*/
|
|
7
|
+
export interface ExpoLocationObject {
|
|
8
|
+
coords?: {
|
|
9
|
+
latitude?: number;
|
|
10
|
+
longitude?: number;
|
|
11
|
+
altitude?: number | null;
|
|
12
|
+
accuracy?: number | null;
|
|
13
|
+
heading?: number | null;
|
|
14
|
+
speed?: number | null;
|
|
15
|
+
} | null;
|
|
16
|
+
timestamp?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ExpoLocationSubscription {
|
|
19
|
+
remove: () => void;
|
|
20
|
+
}
|
|
21
|
+
export interface ExpoLocationLike {
|
|
22
|
+
getCurrentPositionAsync: (options?: Record<string, unknown>) => Promise<ExpoLocationObject>;
|
|
23
|
+
watchPositionAsync: (options: Record<string, unknown>, callback: (location: ExpoLocationObject) => void) => Promise<ExpoLocationSubscription>;
|
|
24
|
+
getForegroundPermissionsAsync?: () => Promise<{
|
|
25
|
+
granted: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
hasServicesEnabledAsync?: () => Promise<boolean>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Adapts expo-location to the library's geolocation seam.
|
|
31
|
+
*
|
|
32
|
+
* The interesting half is `watchPosition`. The seam must hand back a numeric
|
|
33
|
+
* watch id SYNCHRONOUSLY, while `watchPositionAsync` only resolves its
|
|
34
|
+
* subscription later. So the adapter mints its own id immediately and stores
|
|
35
|
+
* the subscription against it on arrival. `clearWatch` called during that
|
|
36
|
+
* window records the id as cancelled, and the subscription is removed the
|
|
37
|
+
* moment it lands — without that, a screen that unmounts before the watch
|
|
38
|
+
* starts leaks a live GPS listener for the rest of the session, which is a
|
|
39
|
+
* battery drain nobody would attribute to this code.
|
|
40
|
+
*/
|
|
41
|
+
export declare const adaptExpoLocation: (mod: ExpoLocationLike) => GeolocationLike;
|
|
42
|
+
//# sourceMappingURL=expoLocation.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export interface GeoCoordinates {
|
|
2
|
+
latitude: number;
|
|
3
|
+
longitude: number;
|
|
4
|
+
accuracy: number;
|
|
5
|
+
altitude: number | null;
|
|
6
|
+
heading: number | null;
|
|
7
|
+
speed: number | null;
|
|
8
|
+
}
|
|
9
|
+
export interface GeoPosition {
|
|
10
|
+
coords: GeoCoordinates;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
}
|
|
13
|
+
export type GeoErrorCode = 'permission-denied' | 'position-unavailable' | 'timeout' | 'services-disabled' | 'unsupported';
|
|
14
|
+
export declare class GeolocationError extends Error {
|
|
15
|
+
readonly code: GeoErrorCode;
|
|
16
|
+
constructor(code: GeoErrorCode, message: string);
|
|
17
|
+
}
|
|
18
|
+
export interface GeoOptions {
|
|
19
|
+
/** `fine` maps to the platform's high-accuracy (GPS) provider. Default `fine`. */
|
|
20
|
+
accuracy?: 'fine' | 'coarse';
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
maximumAgeMs?: number;
|
|
23
|
+
/** Extra attempts after the first, used only for `timeout` / `position-unavailable`. */
|
|
24
|
+
retries?: number;
|
|
25
|
+
/** A fix with a worse (larger) accuracy radius counts as `position-unavailable`. */
|
|
26
|
+
minimumAccuracyM?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Pause between retries. Android's fused provider is frequently not ready on
|
|
29
|
+
* the first request after the permission grant or after location is switched
|
|
30
|
+
* on, and retrying immediately just re-collects the same failure.
|
|
31
|
+
*/
|
|
32
|
+
retryDelayMs?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface GeoWatchOptions extends GeoOptions {
|
|
35
|
+
/** Metres the device must move before the listener fires again. */
|
|
36
|
+
distanceFilterM?: number;
|
|
37
|
+
onError?: (error: GeolocationError) => void;
|
|
38
|
+
}
|
|
39
|
+
interface NativeGeoCoords {
|
|
40
|
+
latitude?: number | null;
|
|
41
|
+
longitude?: number | null;
|
|
42
|
+
accuracy?: number | null;
|
|
43
|
+
altitude?: number | null;
|
|
44
|
+
heading?: number | null;
|
|
45
|
+
speed?: number | null;
|
|
46
|
+
}
|
|
47
|
+
interface NativeGeoPosition {
|
|
48
|
+
coords?: NativeGeoCoords | null;
|
|
49
|
+
timestamp?: number | null;
|
|
50
|
+
}
|
|
51
|
+
interface NativeGeoError {
|
|
52
|
+
code?: number;
|
|
53
|
+
message?: string;
|
|
54
|
+
}
|
|
55
|
+
interface NativeGeoOptions {
|
|
56
|
+
enableHighAccuracy?: boolean;
|
|
57
|
+
timeout?: number;
|
|
58
|
+
maximumAge?: number;
|
|
59
|
+
distanceFilter?: number;
|
|
60
|
+
}
|
|
61
|
+
/** Minimal shape of the native geolocation module we depend on. */
|
|
62
|
+
export interface GeolocationLike {
|
|
63
|
+
getCurrentPosition: (onSuccess: (position: NativeGeoPosition) => void, onError?: (error: NativeGeoError) => void, options?: NativeGeoOptions) => void;
|
|
64
|
+
watchPosition: (onSuccess: (position: NativeGeoPosition) => void, onError?: (error: NativeGeoError) => void, options?: NativeGeoOptions) => number;
|
|
65
|
+
clearWatch: (watchId: number) => void;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Replace the geolocation provider. Intended for TESTS and for the showcase,
|
|
69
|
+
* which injects a denying provider to demo the permission and services-off
|
|
70
|
+
* errors; an app gets expo-location without wiring anything. Pass `null` to
|
|
71
|
+
* restore it.
|
|
72
|
+
*/
|
|
73
|
+
export declare const setGeolocationImplementation: (impl: GeolocationLike | null) => void;
|
|
74
|
+
export declare const Geolocation: {
|
|
75
|
+
getCurrentPosition: (options?: GeoOptions) => Promise<GeoPosition>;
|
|
76
|
+
watchPosition: (listener: (position: GeoPosition) => void, options?: GeoWatchOptions) => (() => void);
|
|
77
|
+
isAvailable: () => boolean;
|
|
78
|
+
};
|
|
79
|
+
export interface UseCurrentPositionResult {
|
|
80
|
+
position: GeoPosition | null;
|
|
81
|
+
error: GeolocationError | null;
|
|
82
|
+
loading: boolean;
|
|
83
|
+
refresh: () => void;
|
|
84
|
+
}
|
|
85
|
+
export declare const useCurrentPosition: (options?: GeoOptions & {
|
|
86
|
+
enabled?: boolean;
|
|
87
|
+
}) => UseCurrentPositionResult;
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,28 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The main barrel deliberately does NOT re-export the modules that need a native
|
|
3
|
+
* package. Metro resolves requires statically, so anything reachable from here
|
|
4
|
+
* is resolved for every consumer, which would make an optional peer mandatory
|
|
5
|
+
* for anyone importing anything at all. Those live behind their own import
|
|
6
|
+
* paths instead:
|
|
7
|
+
*
|
|
8
|
+
* @webority-technologies/mobile-core/permissions react-native-permissions
|
|
9
|
+
* @webority-technologies/mobile-core/compressor react-native-compressor
|
|
10
|
+
* @webority-technologies/mobile-core/geolocation a geolocation provider
|
|
11
|
+
* @webority-technologies/mobile-core/sqlite a SQLite driver
|
|
12
|
+
* @webority-technologies/mobile-core/download a filesystem module
|
|
13
|
+
*
|
|
14
|
+
* react-native-keychain is the exception and is a REQUIRED peer: the HTTP client
|
|
15
|
+
* reads the bearer token, so it is reachable from the main barrel by design.
|
|
16
|
+
*/
|
|
17
|
+
export { buildCurl, logCurl } from './api/curl';
|
|
1
18
|
export { default as publicClient } from './api/publicClient';
|
|
19
|
+
export type { RetryPolicy } from './api/retry';
|
|
20
|
+
export { attachRetry, isRetryableStatus } from './api/retry';
|
|
2
21
|
export type { RefreshableStore, SessionTerminationCode } from './api/userClient';
|
|
3
|
-
export { default as userClient, injectAuthActions, injectStore, RequestOfflineError, SESSION_TERMINATION_CODES } from './api/userClient';
|
|
22
|
+
export { default as userClient, injectAuthActions, injectStore, RequestOfflineError, resetRefreshState, SESSION_TERMINATION_CODES } from './api/userClient';
|
|
4
23
|
export type { KeychainLike, StoredToken } from './auth/authStore';
|
|
5
|
-
export { getToken, removeToken, setKeychainImplementation, storeToken } from './auth/authStore';
|
|
24
|
+
export { ACCESS_TOKEN_KEY, getToken, REFRESH_TOKEN_KEY, removeToken, setKeychainImplementation, storeToken } from './auth/authStore';
|
|
6
25
|
export type { JwtClaims } from './auth/jwt';
|
|
7
26
|
export { decodeJWT, getJWTExpiry, isJWTExpired } from './auth/jwt';
|
|
8
27
|
export type { Config, Environment, LogLevel } from './config';
|
|
9
28
|
export { getConfig, getConfigValue, resetConfig, setConfig } from './config';
|
|
10
|
-
export type {
|
|
11
|
-
export {
|
|
29
|
+
export type { DeepLinkConfig, DeepLinkRoute, ParsedLink } from './deepLink';
|
|
30
|
+
export { DeepLink, parseDeepLink, useDeepLink } from './deepLink';
|
|
31
|
+
export type { DateInput, DateStyle, FormatCurrencyOptions, FormatPhoneOptions, PhoneCountry, TimeStyle } from './formatters';
|
|
32
|
+
export { detectPhoneCountry, formatCompactNumber, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, getInitials, normalizePhone } from './formatters';
|
|
12
33
|
export type { InitConfig } from './initSDK';
|
|
13
34
|
export { initWebority } from './initSDK';
|
|
14
35
|
export type { AuthActions } from './initUserAuth';
|
|
15
36
|
export { initUserAuth } from './initUserAuth';
|
|
16
|
-
export type { LoggerType, RemoteLogger } from './logger';
|
|
17
|
-
export { Logger, setRemoteLogger } from './logger';
|
|
18
|
-
export type { NetworkConnectionType, NetworkStatus, NetworkStatusListener } from './network';
|
|
19
|
-
export { addNetworkStatusListener, getNetworkStatus, useNetworkStatus } from './network';
|
|
20
|
-
export type { PermissionKind, PermissionStatus } from './permissions';
|
|
21
|
-
export { Permissions } from './permissions';
|
|
37
|
+
export type { DeviceContext, LoggerOptions, LoggerType, RemoteLogger } from './logger';
|
|
38
|
+
export { configureLogger, getDeviceContext, Logger, setDeviceContext, setRemoteLogger } from './logger';
|
|
39
|
+
export type { NetworkConnectionType, NetworkStatus, NetworkStatusLike, NetworkStatusListener } from './network';
|
|
40
|
+
export { addNetworkStatusListener, getNetworkStatus, setNetworkStatusImplementation, useNetworkStatus } from './network';
|
|
22
41
|
export type { AsyncStorageLike, StorageApi } from './storage';
|
|
23
|
-
export { Storage, setStorageImplementation } from './storage';
|
|
24
|
-
export type { CompressImageOptions } from './utils';
|
|
25
|
-
export { compressImage } from './utils';
|
|
42
|
+
export { isStorageAvailable, Storage, setStorageImplementation } from './storage';
|
|
26
43
|
export type { PasswordRules } from './validators';
|
|
27
44
|
export { isAadhaar, isAlphanumeric, isBetween, isEmail, isGstin, isHexColor, isIfsc, isIndianMobile, isIndianPincode, isInteger, isNonEmpty, isNumeric, isPan, isPhone, isStrongPassword, isUrl, maxLength, minLength } from './validators';
|
|
28
45
|
export type { DeviceInfoLike, ParsedVersion, Platform, UpdateInfo, UpdateType, VersionCheckResult, VersionCheckType, VersionComparison, VersionData } from './versionCheck';
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Simple initialization API for Webority packages
|
|
3
3
|
* One function to configure everything needed
|
|
4
4
|
*/
|
|
5
|
+
import { type KeychainLike } from './auth/authStore';
|
|
5
6
|
import { type Environment, type LogLevel } from './config';
|
|
7
|
+
import { type NetInfoLike } from './network/networkStatus';
|
|
8
|
+
import { setStorageImplementation } from './storage';
|
|
6
9
|
export interface InitConfig {
|
|
7
10
|
/** Your API base URL (required) */
|
|
8
11
|
baseUrl: string;
|
|
@@ -17,6 +20,35 @@ export interface InitConfig {
|
|
|
17
20
|
* version checks. Defaults to `'in'`.
|
|
18
21
|
*/
|
|
19
22
|
country?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The app's store identifier (Android package name / iOS bundle id) and its
|
|
25
|
+
* user-visible version, both needed by the version-check module. Every
|
|
26
|
+
* Webority app already has them in `appsettings.Compiled.json`, which is why
|
|
27
|
+
* they come from config rather than across the native bridge.
|
|
28
|
+
*/
|
|
29
|
+
appId?: string;
|
|
30
|
+
appVersion?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Log a redacted curl line per request. Off by default; it is a debugging
|
|
33
|
+
* aid, not something to leave on.
|
|
34
|
+
*/
|
|
35
|
+
logCurl?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The native modules that fill the seams the library does not import.
|
|
38
|
+
*
|
|
39
|
+
* Passing them here is strongly preferred over calling each setter, because
|
|
40
|
+
* forgetting one is silent: storage returns falsy and network status reports
|
|
41
|
+
* optimistic online, so an app looks like it works and simply never persists
|
|
42
|
+
* anything. The pilot migration wired NONE of them and nothing said so.
|
|
43
|
+
*
|
|
44
|
+
* Every value is whatever that surface's package exports, or an Expo adapter
|
|
45
|
+
* from its own import path. See docs/expo.md.
|
|
46
|
+
*/
|
|
47
|
+
backends?: {
|
|
48
|
+
storage?: Parameters<typeof setStorageImplementation>[0];
|
|
49
|
+
keychain?: KeychainLike | null;
|
|
50
|
+
network?: NetInfoLike | null;
|
|
51
|
+
};
|
|
20
52
|
}
|
|
21
53
|
/**
|
|
22
54
|
* Initialize Webority packages with your project configuration.
|
|
@@ -24,6 +24,39 @@ export interface RemoteLogger {
|
|
|
24
24
|
* Pass `null` to detach. Safe to call before or after `initWebority`.
|
|
25
25
|
*/
|
|
26
26
|
export declare const setRemoteLogger: (impl: RemoteLogger | null) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Device / app context attached once at boot (platform, OS version, app version,
|
|
29
|
+
* build number, device model, etc). Merged into every `recordError` context so
|
|
30
|
+
* every crash carries it without every call site repeating it.
|
|
31
|
+
*/
|
|
32
|
+
export interface DeviceContext {
|
|
33
|
+
platform: string;
|
|
34
|
+
osVersion?: string;
|
|
35
|
+
appVersion?: string;
|
|
36
|
+
buildNumber?: string;
|
|
37
|
+
deviceModel?: string;
|
|
38
|
+
isEmulator?: boolean;
|
|
39
|
+
locale?: string;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Set (or clear, with `null`) the device/app context merged into every
|
|
44
|
+
* `recordError` call. Each key is also forwarded to `remote.setAttribute`
|
|
45
|
+
* once, at the moment it is set.
|
|
46
|
+
*/
|
|
47
|
+
export declare const setDeviceContext: (context: DeviceContext | null) => void;
|
|
48
|
+
export declare const getDeviceContext: () => DeviceContext | null;
|
|
49
|
+
/** Tuning knobs for screen history and duplicate-error suppression. */
|
|
50
|
+
export interface LoggerOptions {
|
|
51
|
+
/** Identical errors within this window are collapsed. Default 5000ms. 0 disables dedupe. */
|
|
52
|
+
dedupeWindowMs?: number;
|
|
53
|
+
/** Max identical errors forwarded per window before suppression. Default 1. */
|
|
54
|
+
dedupeMaxPerWindow?: number;
|
|
55
|
+
/** Cap on tracked screen history. Default 20. */
|
|
56
|
+
screenHistoryLimit?: number;
|
|
57
|
+
}
|
|
58
|
+
/** Configure dedupe window/threshold and screen history size. Merges with current options. */
|
|
59
|
+
export declare const configureLogger: (options: LoggerOptions) => void;
|
|
27
60
|
export interface LoggerType {
|
|
28
61
|
info: LogFn;
|
|
29
62
|
warn: LogFn;
|
|
@@ -36,6 +69,12 @@ export interface LoggerType {
|
|
|
36
69
|
setUser: (id: string | null, attrs?: Record<string, unknown>) => void;
|
|
37
70
|
/** Attach a custom attribute (release, build, env, role, etc.). */
|
|
38
71
|
setAttribute: (key: string, value: string | number | boolean | null) => void;
|
|
72
|
+
/** Record the active screen; attaches `screen` to subsequent `recordError` context. */
|
|
73
|
+
trackScreen: (name: string, params?: Record<string, unknown>) => void;
|
|
74
|
+
/** The most recently tracked screen name, or `null` if none was tracked yet. */
|
|
75
|
+
getCurrentScreen: () => string | null;
|
|
76
|
+
/** Bounded history of tracked screen names, oldest first. */
|
|
77
|
+
getScreenHistory: () => string[];
|
|
39
78
|
}
|
|
40
79
|
export declare const Logger: LoggerType;
|
|
41
80
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { NetworkConnectionType, NetworkStatus, NetworkStatusListener } from './networkStatus';
|
|
2
|
-
export { addNetworkStatusListener, getNetworkStatus, useNetworkStatus } from './networkStatus';
|
|
1
|
+
export type { NetworkConnectionType, NetworkStatus, NetworkStatusLike, NetworkStatusListener } from './networkStatus';
|
|
2
|
+
export { addNetworkStatusListener, getNetworkStatus, setNetworkStatusImplementation, useNetworkStatus } from './networkStatus';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -10,6 +10,21 @@ export interface NetworkStatus {
|
|
|
10
10
|
type: NetworkConnectionType;
|
|
11
11
|
}
|
|
12
12
|
export type NetworkStatusListener = (status: NetworkStatus) => void;
|
|
13
|
+
interface NetInfoStateLike {
|
|
14
|
+
isConnected: boolean | null;
|
|
15
|
+
isInternetReachable: boolean | null;
|
|
16
|
+
type?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface NetInfoLike {
|
|
19
|
+
fetch: () => Promise<NetInfoStateLike>;
|
|
20
|
+
addEventListener: (cb: (state: NetInfoStateLike) => void) => () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Replace the backend. Intended for TESTS and for the showcase, which uses it
|
|
24
|
+
* to reach error paths that a healthy device never takes; it is not the way an
|
|
25
|
+
* app is meant to configure the library. Pass `null` to restore expo-network.
|
|
26
|
+
*/
|
|
27
|
+
export declare const setNetworkStatusImplementation: (impl: NetInfoLike | null) => void;
|
|
13
28
|
/**
|
|
14
29
|
* Imperative one-shot fetch of current network status. Resolves to the default
|
|
15
30
|
* online status when NetInfo is unavailable so callers never crash.
|
|
@@ -24,4 +39,5 @@ export declare const addNetworkStatusListener: (listener: NetworkStatusListener)
|
|
|
24
39
|
* Reports an optimistic online default when NetInfo is not installed.
|
|
25
40
|
*/
|
|
26
41
|
export declare const useNetworkStatus: () => NetworkStatus;
|
|
42
|
+
export type { NetInfoLike as NetworkStatusLike };
|
|
27
43
|
//# sourceMappingURL=networkStatus.d.ts.map
|
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
export type PermissionKind = 'camera' | 'microphone' | 'photos' | 'photosAdd' | 'mediaLibrary' | 'location' | 'locationAlways' | 'contacts' | 'calendar' | 'reminders' | 'notifications' | 'bluetooth' | 'storage';
|
|
2
2
|
export type PermissionStatus = 'unavailable' | 'denied' | 'limited' | 'granted' | 'blocked';
|
|
3
|
+
export interface RNPermissionsModule {
|
|
4
|
+
PERMISSIONS: {
|
|
5
|
+
IOS: Record<string, string>;
|
|
6
|
+
ANDROID: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
RESULTS: {
|
|
9
|
+
UNAVAILABLE: string;
|
|
10
|
+
DENIED: string;
|
|
11
|
+
LIMITED: string;
|
|
12
|
+
GRANTED: string;
|
|
13
|
+
BLOCKED: string;
|
|
14
|
+
};
|
|
15
|
+
check: (permission: string) => Promise<string>;
|
|
16
|
+
request: (permission: string) => Promise<string>;
|
|
17
|
+
openSettings: () => Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Inject a custom permissions implementation at runtime.
|
|
21
|
+
* Pass `null` to reset to the default lazily-resolved native module.
|
|
22
|
+
*
|
|
23
|
+
* `resolved` goes FALSE on null, never true. Marking it resolved with a null
|
|
24
|
+
* backend would permanently disable permissions: the resolver short-circuits and the
|
|
25
|
+
* real module is never loaded again, which contradicts this function's own
|
|
26
|
+
* documented contract. That exact bug shipped once, in the storage seam.
|
|
27
|
+
*
|
|
28
|
+
* THIS MODULE IS THE EXPO-FIRST EXCEPTION, and deliberately keeps the old
|
|
29
|
+
* shape. Expo ships no permissions package: each module carries its own
|
|
30
|
+
* (expo-location's requestForegroundPermissionsAsync, expo-image-picker's, and
|
|
31
|
+
* so on), so there is no single object to adapt and the library must not guess
|
|
32
|
+
* which Expo modules an app installed. react-native-permissions stays, behind
|
|
33
|
+
* this module's own import path so an app that never asks for permissions
|
|
34
|
+
* never names the package to Metro.
|
|
35
|
+
*/
|
|
36
|
+
export declare const setPermissionsImplementation: (impl: RNPermissionsModule | null) => void;
|
|
3
37
|
/**
|
|
4
38
|
* Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
|
|
5
39
|
* (camera, photos, location, notifications, …) to the right
|
|
@@ -17,4 +51,5 @@ export declare const Permissions: {
|
|
|
17
51
|
ensure: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
18
52
|
openSettings: () => Promise<boolean>;
|
|
19
53
|
};
|
|
54
|
+
export type { RNPermissionsModule as PermissionsLike };
|
|
20
55
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SqliteDriver } from '../index';
|
|
2
|
+
/**
|
|
3
|
+
* expo-sqlite. Shape verified against 57.0.2 rather than assumed, and it is the
|
|
4
|
+
* one driver that cannot share an adapter with the others: expo splits reads
|
|
5
|
+
* from writes. `getAllAsync` yields rows but no change count, `runAsync` yields
|
|
6
|
+
* `{ changes, lastInsertRowId }` but no rows, and SqliteResultSet needs all
|
|
7
|
+
* three from one call. `prepareAsync` + `executeAsync` is the only call that
|
|
8
|
+
* returns both, so every statement goes through it rather than being routed by
|
|
9
|
+
* sniffing the SQL for a leading SELECT.
|
|
10
|
+
*
|
|
11
|
+
* The REQUIRE lives in the driver entry point beside this file, never here.
|
|
12
|
+
*/
|
|
13
|
+
export interface ExpoSqliteExecuteResult {
|
|
14
|
+
lastInsertRowId: number;
|
|
15
|
+
changes: number;
|
|
16
|
+
getAllAsync: () => Promise<Record<string, unknown>[]>;
|
|
17
|
+
}
|
|
18
|
+
export interface ExpoSqliteStatementLike {
|
|
19
|
+
executeAsync: (params: unknown[]) => Promise<ExpoSqliteExecuteResult>;
|
|
20
|
+
finalizeAsync: () => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export interface ExpoSqliteDatabaseLike {
|
|
23
|
+
prepareAsync: (source: string) => Promise<ExpoSqliteStatementLike>;
|
|
24
|
+
closeAsync: () => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export interface ExpoSqliteModuleLike {
|
|
27
|
+
openDatabaseAsync: (name: string, options?: Record<string, unknown>, directory?: string) => Promise<ExpoSqliteDatabaseLike>;
|
|
28
|
+
}
|
|
29
|
+
export declare const adaptExpoSqlite: (mod: ExpoSqliteModuleLike) => SqliteDriver;
|
|
30
|
+
//# sourceMappingURL=expo.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SqliteDriver } from '../index';
|
|
2
|
+
/**
|
|
3
|
+
* @op-engineering/op-sqlite. Shape verified against 18.1.4 rather than assumed:
|
|
4
|
+
* `open({ name, location })` is synchronous and returns a DB whose `execute` is
|
|
5
|
+
* ASYNC, and whose `rows` is already a plain array of objects rather than the
|
|
6
|
+
* `{ _array, item() }` shape the older drivers use. Both differences are why it
|
|
7
|
+
* cannot share the sync adapter.
|
|
8
|
+
*
|
|
9
|
+
* The REQUIRE lives in the driver entry point beside this file, never here.
|
|
10
|
+
*/
|
|
11
|
+
export interface OpSqliteQueryResult {
|
|
12
|
+
rows?: Record<string, unknown>[];
|
|
13
|
+
rowsAffected?: number;
|
|
14
|
+
insertId?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface OpSqliteModuleLike {
|
|
17
|
+
open: (options: {
|
|
18
|
+
name: string;
|
|
19
|
+
location?: string;
|
|
20
|
+
}) => {
|
|
21
|
+
execute: (sql: string, params?: unknown[]) => Promise<OpSqliteQueryResult>;
|
|
22
|
+
close: () => void;
|
|
23
|
+
closeAsync?: () => Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare const adaptOpSqlite: (mod: OpSqliteModuleLike) => SqliteDriver;
|
|
27
|
+
//# sourceMappingURL=op.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row shapes differ per driver: a plain array, `{ _array, length, item() }`, or
|
|
3
|
+
* `{ length, item() }` alone. Every adapter normalises to a plain array here so
|
|
4
|
+
* nothing driver-specific escapes into the Db layer.
|
|
5
|
+
*/
|
|
6
|
+
export declare const rowsToArray: (rows: unknown) => Record<string, unknown>[];
|
|
7
|
+
//# sourceMappingURL=rows.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SqliteDriver } from '../index';
|
|
2
|
+
interface SqliteStorageResultSet {
|
|
3
|
+
rows: {
|
|
4
|
+
length: number;
|
|
5
|
+
item: (i: number) => Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
rowsAffected: number;
|
|
8
|
+
insertId?: number;
|
|
9
|
+
}
|
|
10
|
+
/** react-native-sqlite-storage: callback-based by default, promise-based once
|
|
11
|
+
* `enablePromise(true)` is called; `executeSql` resolves an array whose first
|
|
12
|
+
* element is the result set. */
|
|
13
|
+
interface SqliteStorageModuleLike {
|
|
14
|
+
enablePromise: (enabled: boolean) => void;
|
|
15
|
+
openDatabase: (options: {
|
|
16
|
+
name: string;
|
|
17
|
+
location?: string;
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
executeSql: (sql: string, params?: unknown[]) => Promise<[SqliteStorageResultSet]>;
|
|
20
|
+
close: () => Promise<void>;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Adapt an already-required `react-native-sqlite-storage` module. Exported for
|
|
25
|
+
* the same reason as the filesystem adapters: the library cannot name a package
|
|
26
|
+
* the app did not install without breaking the app's bundle.
|
|
27
|
+
*/
|
|
28
|
+
export declare const adaptSqliteStorage: (mod: SqliteStorageModuleLike) => SqliteDriver;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SqliteDriver } from '../index';
|
|
2
|
+
/**
|
|
3
|
+
* nitro-sqlite and quick-sqlite share one synchronous shape, so one adapter
|
|
4
|
+
* serves both. The REQUIRE lives in the driver entry points beside this file,
|
|
5
|
+
* never here and never in the core: Metro resolves requires statically, so a
|
|
6
|
+
* package named anywhere reachable becomes mandatory for every consumer.
|
|
7
|
+
*/
|
|
8
|
+
interface SyncQueryResult {
|
|
9
|
+
rows?: unknown;
|
|
10
|
+
rowsAffected?: number;
|
|
11
|
+
insertId?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Shape shared by react-native-nitro-sqlite and react-native-quick-sqlite: a
|
|
14
|
+
* synchronous `open({ name, location })` whose `db.execute()` and `db.close()`
|
|
15
|
+
* are also synchronous. Both are wrapped in Promise.resolve to fit SqliteDriver. */
|
|
16
|
+
interface SyncSqliteModuleLike {
|
|
17
|
+
open: (options: {
|
|
18
|
+
name: string;
|
|
19
|
+
location?: string;
|
|
20
|
+
}) => {
|
|
21
|
+
execute: (sql: string, params?: unknown[]) => SyncQueryResult;
|
|
22
|
+
close: () => void;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Adapt an already-required nitro-sqlite or quick-sqlite module. Both expose the
|
|
27
|
+
* same synchronous shape. Exported so an app on quick-sqlite can inject it.
|
|
28
|
+
*/
|
|
29
|
+
export declare const adaptSyncSqlite: (mod: SyncSqliteModuleLike) => SqliteDriver;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module names NO native package. Metro resolves requires statically, so a
|
|
3
|
+
* driver named here would be bundled by every consumer and would have to be
|
|
4
|
+
* installed by every app, whichever driver it actually chose. Each driver lives
|
|
5
|
+
* behind its own import path, and the app wires one at startup:
|
|
6
|
+
*
|
|
7
|
+
* import { setSqliteImplementation } from '@webority-technologies/mobile-core/sqlite';
|
|
8
|
+
* import { opSqliteDriver } from '@webority-technologies/mobile-core/sqlite/op';
|
|
9
|
+
* setSqliteImplementation(opSqliteDriver());
|
|
10
|
+
*
|
|
11
|
+
* Supported entry points: /sqlite/op, /sqlite/nitro, /sqlite/quick,
|
|
12
|
+
* /sqlite/storage. Any object matching SqliteDriver also works.
|
|
13
|
+
*/
|
|
14
|
+
export interface SqliteResultSet {
|
|
15
|
+
rows: Record<string, unknown>[];
|
|
16
|
+
rowsAffected: number;
|
|
17
|
+
insertId?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface SqliteDatabase {
|
|
20
|
+
execute: (sql: string, params?: readonly unknown[]) => Promise<SqliteResultSet>;
|
|
21
|
+
close: () => Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export interface SqliteDriver {
|
|
24
|
+
open: (name: string, options?: {
|
|
25
|
+
location?: string;
|
|
26
|
+
}) => Promise<SqliteDatabase>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Inject the SQLite driver. Pass `null` to clear it.
|
|
30
|
+
*
|
|
31
|
+
* `@webority-technologies/mobile-core` ships no database: it is pure JavaScript
|
|
32
|
+
* and defines only this interface. Wire a driver once at startup:
|
|
33
|
+
*
|
|
34
|
+
* import { opSqliteDriver } from '@webority-technologies/mobile-core/sqlite/op';
|
|
35
|
+
* setSqliteImplementation(opSqliteDriver());
|
|
36
|
+
*/
|
|
37
|
+
export declare const setSqliteImplementation: (impl: SqliteDriver | null) => void;
|
|
38
|
+
export declare const isSqliteAvailable: () => boolean;
|
|
39
|
+
/** The ledger of applied migrations. Never emptied by `wipe`. */
|
|
40
|
+
export declare const MIGRATIONS_TABLE = "_webority_migrations";
|
|
41
|
+
/**
|
|
42
|
+
* SQLite cannot bind an identifier to `?`, so every table/column name reaching
|
|
43
|
+
* a statement is concatenated. This is the ONE place that is allowed to happen,
|
|
44
|
+
* and it throws rather than quoting a hostile name into something executable.
|
|
45
|
+
*/
|
|
46
|
+
export declare const assertSqlIdentifier: (value: unknown, kind?: string) => string;
|
|
47
|
+
/** Normalise a JS value into something every SQLite driver can bind. */
|
|
48
|
+
export declare const toSqliteValue: (value: unknown) => unknown;
|
|
49
|
+
/** SQLite has no boolean type, so a stored flag comes back as 0/1 or '0'/'1'. */
|
|
50
|
+
export declare const fromSqliteBoolean: (value: unknown) => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Build an `IN (...)` clause with one placeholder per value. An empty list
|
|
53
|
+
* yields a clause that matches nothing, because `IN ()` is a syntax error.
|
|
54
|
+
*/
|
|
55
|
+
export declare const whereIn: (column: string, values: readonly unknown[]) => {
|
|
56
|
+
sql: string;
|
|
57
|
+
params: unknown[];
|
|
58
|
+
};
|
|
59
|
+
export interface RawWhere {
|
|
60
|
+
sql: string;
|
|
61
|
+
params?: readonly unknown[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Either a map of column to value (ANDed, `null` meaning IS NULL) or a raw
|
|
65
|
+
* fragment for anything the object form cannot express.
|
|
66
|
+
*/
|
|
67
|
+
export type Where = Record<string, unknown> | RawWhere;
|
|
68
|
+
export interface FindOptions {
|
|
69
|
+
orderBy?: string;
|
|
70
|
+
limit?: number;
|
|
71
|
+
offset?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface Migration {
|
|
74
|
+
version: number;
|
|
75
|
+
name?: string;
|
|
76
|
+
up: string | string[] | ((tx: Pick<Db, 'execute'>) => Promise<void>);
|
|
77
|
+
}
|
|
78
|
+
export interface MigrateOptions {
|
|
79
|
+
/**
|
|
80
|
+
* Skip the downgrade guard. Only set this when the app knows the older code
|
|
81
|
+
* can read the newer schema.
|
|
82
|
+
*/
|
|
83
|
+
allowDowngrade?: boolean;
|
|
84
|
+
}
|
|
85
|
+
export declare const DEFAULT_PRAGMAS: Readonly<Record<string, string | number>>;
|
|
86
|
+
export interface OpenDatabaseOptions {
|
|
87
|
+
location?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Merged over DEFAULT_PRAGMAS and applied on open. Pass `false` to apply none.
|
|
90
|
+
*/
|
|
91
|
+
pragmas?: Record<string, string | number> | false;
|
|
92
|
+
}
|
|
93
|
+
export interface Db {
|
|
94
|
+
readonly name: string;
|
|
95
|
+
execute: (sql: string, params?: readonly unknown[]) => Promise<SqliteResultSet>;
|
|
96
|
+
select: <T = Record<string, unknown>>(sql: string, params?: readonly unknown[]) => Promise<T[]>;
|
|
97
|
+
selectOne: <T = Record<string, unknown>>(sql: string, params?: readonly unknown[]) => Promise<T | null>;
|
|
98
|
+
transaction: <T>(work: (tx: Pick<Db, 'execute' | 'select' | 'selectOne'>) => Promise<T>) => Promise<T>;
|
|
99
|
+
insert: (table: string, row: Record<string, unknown>) => Promise<number | undefined>;
|
|
100
|
+
insertMany: (table: string, rows: Record<string, unknown>[]) => Promise<number>;
|
|
101
|
+
update: (table: string, values: Record<string, unknown>, where: Where) => Promise<number>;
|
|
102
|
+
remove: (table: string, where: Where) => Promise<number>;
|
|
103
|
+
upsert: (table: string, row: Record<string, unknown>, conflictColumns: string[]) => Promise<void>;
|
|
104
|
+
findAll: <T = Record<string, unknown>>(table: string, where?: Where, options?: FindOptions) => Promise<T[]>;
|
|
105
|
+
findOne: <T = Record<string, unknown>>(table: string, where?: Where) => Promise<T | null>;
|
|
106
|
+
count: (table: string, where?: Where) => Promise<number>;
|
|
107
|
+
tableExists: (table: string) => Promise<boolean>;
|
|
108
|
+
createTable: (table: string, columns: Record<string, string>, options?: {
|
|
109
|
+
ifNotExists?: boolean;
|
|
110
|
+
}) => Promise<void>;
|
|
111
|
+
dropTable: (table: string, options?: {
|
|
112
|
+
ifExists?: boolean;
|
|
113
|
+
}) => Promise<void>;
|
|
114
|
+
wipe: () => Promise<void>;
|
|
115
|
+
reset: (migrations: Migration[]) => Promise<number>;
|
|
116
|
+
migrate: (migrations: Migration[], options?: MigrateOptions) => Promise<number>;
|
|
117
|
+
baseline: (version: number, migrations?: Migration[]) => Promise<void>;
|
|
118
|
+
close: () => Promise<void>;
|
|
119
|
+
}
|
|
120
|
+
export declare const openDatabase: (name: string, options?: OpenDatabaseOptions) => Promise<Db>;
|
|
121
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SqliteDriver } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* The one place `react-native-nitro-sqlite` is named. Import this module only if
|
|
4
|
+
* you installed it; nothing else in the library reaches it.
|
|
5
|
+
*/
|
|
6
|
+
export declare const nitroSqliteDriver: () => SqliteDriver;
|
|
7
|
+
//# sourceMappingURL=nitro.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SqliteDriver } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* The one place `@op-engineering/op-sqlite` is named. It is the driver we
|
|
4
|
+
* recommend: the most actively maintained of the four, and the only one already
|
|
5
|
+
* proven in one of our apps. Import this module only if you installed it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const opSqliteDriver: () => SqliteDriver;
|
|
8
|
+
//# sourceMappingURL=op.d.ts.map
|