@webority/mobile-core 0.0.25 → 0.0.27

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.
Files changed (58) hide show
  1. package/LICENSE.txt +9 -0
  2. package/README.md +13 -0
  3. package/lib/commonjs/api/publicClient.js +4 -0
  4. package/lib/commonjs/api/retry.js +17 -1
  5. package/lib/commonjs/api/userClient.js +11 -3
  6. package/lib/commonjs/auth/authStore.js +49 -16
  7. package/lib/commonjs/config/index.js +8 -2
  8. package/lib/commonjs/formatters/currency.js +2 -1
  9. package/lib/commonjs/formatters/date.js +5 -6
  10. package/lib/commonjs/formatters/dateMath.js +2 -1
  11. package/lib/commonjs/formatters/intlCache.js +37 -0
  12. package/lib/commonjs/formatters/number.js +4 -3
  13. package/lib/commonjs/index.js +14 -0
  14. package/lib/commonjs/initSDK.js +1 -1
  15. package/lib/commonjs/logger/index.js +16 -6
  16. package/lib/commonjs/logger/redact.js +50 -0
  17. package/lib/commonjs/network/networkStatus.js +40 -2
  18. package/lib/commonjs/types/axios.js +4 -0
  19. package/lib/commonjs/utils/base64.js +24 -0
  20. package/lib/module/api/publicClient.js +4 -0
  21. package/lib/module/api/retry.js +17 -1
  22. package/lib/module/api/userClient.js +12 -4
  23. package/lib/module/auth/authStore.js +49 -16
  24. package/lib/module/config/index.js +7 -1
  25. package/lib/module/formatters/currency.js +2 -1
  26. package/lib/module/formatters/date.js +5 -6
  27. package/lib/module/formatters/dateMath.js +2 -1
  28. package/lib/module/formatters/intlCache.js +30 -0
  29. package/lib/module/formatters/number.js +4 -3
  30. package/lib/module/index.js +3 -0
  31. package/lib/module/initSDK.js +2 -2
  32. package/lib/module/logger/index.js +16 -6
  33. package/lib/module/logger/redact.js +44 -0
  34. package/lib/module/network/networkStatus.js +37 -0
  35. package/lib/module/types/axios.js +4 -0
  36. package/lib/module/utils/base64.js +19 -0
  37. package/lib/typescript/commonjs/api/publicClient.d.ts +1 -0
  38. package/lib/typescript/commonjs/api/userClient.d.ts +1 -0
  39. package/lib/typescript/commonjs/config/index.d.ts +6 -0
  40. package/lib/typescript/commonjs/formatters/intlCache.d.ts +6 -0
  41. package/lib/typescript/commonjs/index.d.ts +2 -0
  42. package/lib/typescript/commonjs/initSDK.d.ts +1 -1
  43. package/lib/typescript/commonjs/logger/redact.d.ts +4 -0
  44. package/lib/typescript/commonjs/network/networkStatus.d.ts +6 -0
  45. package/lib/typescript/commonjs/types/axios.d.ts +8 -0
  46. package/lib/typescript/commonjs/utils/base64.d.ts +7 -0
  47. package/lib/typescript/module/api/publicClient.d.ts +1 -0
  48. package/lib/typescript/module/api/userClient.d.ts +1 -0
  49. package/lib/typescript/module/config/index.d.ts +6 -0
  50. package/lib/typescript/module/formatters/intlCache.d.ts +6 -0
  51. package/lib/typescript/module/index.d.ts +2 -0
  52. package/lib/typescript/module/initSDK.d.ts +1 -1
  53. package/lib/typescript/module/logger/redact.d.ts +4 -0
  54. package/lib/typescript/module/network/networkStatus.d.ts +6 -0
  55. package/lib/typescript/module/types/axios.d.ts +8 -0
  56. package/lib/typescript/module/utils/base64.d.ts +7 -0
  57. package/package.json +2 -2
  58. package/LICENSE +0 -21
@@ -25,6 +25,7 @@ export { buildCurl, logCurl } from './api/curl';
25
25
  export { default as publicClient } from './api/publicClient';
26
26
  export type { RetryPolicy } from './api/retry';
27
27
  export { attachRetry, isRetryableStatus } from './api/retry';
28
+ export { refreshAccessToken } from './api/tokenRefresh';
28
29
  export type { RefreshableStore, SessionTerminationCode } from './api/userClient';
29
30
  export { default as userClient, injectStore, injectUserAuth, RequestOfflineError, resetRefreshState, SESSION_TERMINATION_CODES } from './api/userClient';
30
31
  export type { KeychainLike, SecureCredentials, StoredToken } from './auth/authStore';
@@ -47,6 +48,7 @@ export type { NetworkConnectionType, NetworkStatus, NetworkStatusLike, NetworkSt
47
48
  export { addNetworkStatusListener, getNetworkStatus, setNetworkStatusImplementation, useNetworkStatus } from './network';
48
49
  export type { AsyncStorageLike, StorageApi } from './storage';
49
50
  export { isStorageAvailable, Storage, setStorageImplementation } from './storage';
51
+ export { encodeBase64 } from './utils/base64';
50
52
  export type { PasswordRules } from './validators';
51
53
  export { isAadhaar, isAlphanumeric, isBetween, isEmail, isGstin, isHexColor, isIfsc, isIndianMobile, isIndianPincode, isInteger, isNonEmpty, isNumeric, isPan, isPhone, isStrongPassword, isUrl, maxLength, minLength } from './validators';
52
54
  export type { DeviceInfoLike, ParsedVersion, Platform, UpdateInfo, UpdateType, VersionCheckResult, VersionCheckType, VersionComparison, VersionData } from './versionCheck';
@@ -11,7 +11,7 @@ export interface InitConfig {
11
11
  baseUrl: string;
12
12
  /** Enable/disable logging. Defaults to `true`. */
13
13
  loggingEnabled?: boolean;
14
- /** Log level. Defaults to `'info'`. */
14
+ /** Log level. Defaults to `'info'` in development and `'warn'` in a release build. */
15
15
  logLevel?: LogLevel;
16
16
  /** Environment. Defaults to `'Development'`. */
17
17
  environment?: Environment;
@@ -0,0 +1,4 @@
1
+ export declare const redactString: (input: string) => string;
2
+ /** Returns a copy with secrets masked; Errors are masked in place so identity and stack survive. */
3
+ export declare const redact: <T>(value: T) => T;
4
+ //# sourceMappingURL=redact.d.ts.map
@@ -34,6 +34,12 @@ export declare const getNetworkStatus: () => Promise<NetworkStatus>;
34
34
  * Subscribe to network status changes. Returns an unsubscribe function.
35
35
  */
36
36
  export declare const addNetworkStatusListener: (listener: NetworkStatusListener) => (() => void);
37
+ /**
38
+ * The connectivity the HTTP client checks before every request. One listener,
39
+ * attached on first use, keeps it current, so a request costs no native probe:
40
+ * one probe seeds the value and the listener's events replace it.
41
+ */
42
+ export declare const getLastKnownNetworkStatus: () => Promise<NetworkStatus>;
37
43
  /**
38
44
  * React hook that returns the current network status and re-renders on change.
39
45
  * Reports an optimistic online default when NetInfo is not installed.
@@ -0,0 +1,8 @@
1
+ import 'axios';
2
+ declare module 'axios' {
3
+ interface AxiosRequestConfig {
4
+ /** When true, the library's response-error interceptors do not log this request's failure. */
5
+ skipErrorLog?: boolean;
6
+ }
7
+ }
8
+ //# sourceMappingURL=axios.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Base64 of raw bytes, for a `data:` URI. Builds a Latin-1 string a chunk at a
3
+ * time and hands it to the engine's native `btoa` (Hermes ships it), which is
4
+ * many times faster on the JS thread than encoding byte by byte in JS.
5
+ */
6
+ export declare const encodeBase64: (buffer: ArrayBuffer) => string;
7
+ //# sourceMappingURL=base64.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import { type AxiosInstance } from 'axios';
2
+ import '../types/axios.js';
2
3
  /**
3
4
  * Public Axios Client
4
5
  * - Base URL: Set your public API base URL.
@@ -1,4 +1,5 @@
1
1
  import { type AxiosInstance } from 'axios';
2
+ import '../types/axios.js';
2
3
  export type { RefreshableStore } from './tokenRefresh.js';
3
4
  export { injectStore, injectUserAuth, resetRefreshState } from './tokenRefresh.js';
4
5
  /**
@@ -34,6 +34,12 @@ export interface Config {
34
34
  */
35
35
  logCurl: boolean;
36
36
  }
37
+ /**
38
+ * Info lines (each token refresh, each unauthorised URL) reach the device log
39
+ * and any remote sink, so a release build that sets nothing logs warnings and
40
+ * errors only.
41
+ */
42
+ export declare const DEFAULT_LOG_LEVEL: LogLevel;
37
43
  /**
38
44
  * Set global configuration for all Webority packages
39
45
  */
@@ -0,0 +1,6 @@
1
+ export declare const numberFormat: (locale: string, options?: Intl.NumberFormatOptions) => Intl.NumberFormat;
2
+ export declare const dateTimeFormat: (locale: string, options: Intl.DateTimeFormatOptions) => Intl.DateTimeFormat;
3
+ export declare const relativeTimeFormat: (RelativeTimeFormat: new (locale: string, options?: {
4
+ numeric?: "always" | "auto";
5
+ }) => Intl.RelativeTimeFormat, locale: string) => Intl.RelativeTimeFormat;
6
+ //# sourceMappingURL=intlCache.d.ts.map
@@ -25,6 +25,7 @@ export { buildCurl, logCurl } from './api/curl.js';
25
25
  export { default as publicClient } from './api/publicClient.js';
26
26
  export type { RetryPolicy } from './api/retry.js';
27
27
  export { attachRetry, isRetryableStatus } from './api/retry.js';
28
+ export { refreshAccessToken } from './api/tokenRefresh.js';
28
29
  export type { RefreshableStore, SessionTerminationCode } from './api/userClient.js';
29
30
  export { default as userClient, injectStore, injectUserAuth, RequestOfflineError, resetRefreshState, SESSION_TERMINATION_CODES } from './api/userClient.js';
30
31
  export type { KeychainLike, SecureCredentials, StoredToken } from './auth/authStore.js';
@@ -47,6 +48,7 @@ export type { NetworkConnectionType, NetworkStatus, NetworkStatusLike, NetworkSt
47
48
  export { addNetworkStatusListener, getNetworkStatus, setNetworkStatusImplementation, useNetworkStatus } from './network/index.js';
48
49
  export type { AsyncStorageLike, StorageApi } from './storage/index.js';
49
50
  export { isStorageAvailable, Storage, setStorageImplementation } from './storage/index.js';
51
+ export { encodeBase64 } from './utils/base64.js';
50
52
  export type { PasswordRules } from './validators/index.js';
51
53
  export { isAadhaar, isAlphanumeric, isBetween, isEmail, isGstin, isHexColor, isIfsc, isIndianMobile, isIndianPincode, isInteger, isNonEmpty, isNumeric, isPan, isPhone, isStrongPassword, isUrl, maxLength, minLength } from './validators/index.js';
52
54
  export type { DeviceInfoLike, ParsedVersion, Platform, UpdateInfo, UpdateType, VersionCheckResult, VersionCheckType, VersionComparison, VersionData } from './versionCheck/index.js';
@@ -11,7 +11,7 @@ export interface InitConfig {
11
11
  baseUrl: string;
12
12
  /** Enable/disable logging. Defaults to `true`. */
13
13
  loggingEnabled?: boolean;
14
- /** Log level. Defaults to `'info'`. */
14
+ /** Log level. Defaults to `'info'` in development and `'warn'` in a release build. */
15
15
  logLevel?: LogLevel;
16
16
  /** Environment. Defaults to `'Development'`. */
17
17
  environment?: Environment;
@@ -0,0 +1,4 @@
1
+ export declare const redactString: (input: string) => string;
2
+ /** Returns a copy with secrets masked; Errors are masked in place so identity and stack survive. */
3
+ export declare const redact: <T>(value: T) => T;
4
+ //# sourceMappingURL=redact.d.ts.map
@@ -34,6 +34,12 @@ export declare const getNetworkStatus: () => Promise<NetworkStatus>;
34
34
  * Subscribe to network status changes. Returns an unsubscribe function.
35
35
  */
36
36
  export declare const addNetworkStatusListener: (listener: NetworkStatusListener) => (() => void);
37
+ /**
38
+ * The connectivity the HTTP client checks before every request. One listener,
39
+ * attached on first use, keeps it current, so a request costs no native probe:
40
+ * one probe seeds the value and the listener's events replace it.
41
+ */
42
+ export declare const getLastKnownNetworkStatus: () => Promise<NetworkStatus>;
37
43
  /**
38
44
  * React hook that returns the current network status and re-renders on change.
39
45
  * Reports an optimistic online default when NetInfo is not installed.
@@ -0,0 +1,8 @@
1
+ import 'axios';
2
+ declare module 'axios' {
3
+ interface AxiosRequestConfig {
4
+ /** When true, the library's response-error interceptors do not log this request's failure. */
5
+ skipErrorLog?: boolean;
6
+ }
7
+ }
8
+ //# sourceMappingURL=axios.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Base64 of raw bytes, for a `data:` URI. Builds a Latin-1 string a chunk at a
3
+ * time and hands it to the engine's native `btoa` (Hermes ships it), which is
4
+ * many times faster on the JS thread than encoding byte by byte in JS.
5
+ */
6
+ export declare const encodeBase64: (buffer: ArrayBuffer) => string;
7
+ //# sourceMappingURL=base64.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/mobile-core",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "Platform layer for Webority React Native apps: HTTP clients, auth/token storage, config, logging, formatters, validators, network status, permissions, storage and version checks. No UI.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -14,7 +14,7 @@
14
14
  "webority"
15
15
  ],
16
16
  "homepage": "https://www.webority.com",
17
- "license": "MIT",
17
+ "license": "SEE LICENSE IN LICENSE.txt",
18
18
  "author": {
19
19
  "name": "Webority Technologies",
20
20
  "email": "contact@webority.com",
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Webority Technologies
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.