@webority/mobile-core 0.14.2 → 0.16.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 +4 -0
- package/lib/commonjs/errors/extractApiError.js +1 -1
- package/lib/commonjs/errors/index.js +1 -1
- package/lib/commonjs/formatters/currency.js +1 -1
- package/lib/commonjs/formatters/house.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/initSDK.js +1 -1
- package/lib/commonjs/logger/index.js +1 -1
- package/lib/commonjs/logger/redact.js +1 -1
- package/lib/commonjs/push/push.js +1 -1
- package/lib/commonjs/utils/imageCompression.js +1 -1
- package/lib/module/errors/extractApiError.js +1 -1
- package/lib/module/errors/index.js +1 -1
- package/lib/module/formatters/currency.js +1 -1
- package/lib/module/formatters/house.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/initSDK.js +1 -1
- package/lib/module/logger/index.js +1 -1
- package/lib/module/logger/redact.js +1 -1
- package/lib/module/push/push.js +1 -1
- package/lib/module/utils/imageCompression.js +1 -1
- package/lib/typescript/commonjs/errors/extractApiError.d.ts +9 -6
- package/lib/typescript/commonjs/errors/index.d.ts +1 -1
- package/lib/typescript/commonjs/formatters/currency.d.ts +10 -9
- package/lib/typescript/commonjs/formatters/house.d.ts +2 -36
- package/lib/typescript/commonjs/index.d.ts +3 -3
- package/lib/typescript/commonjs/initSDK.d.ts +9 -1
- package/lib/typescript/commonjs/logger/crashlytics.d.ts +3 -3
- package/lib/typescript/commonjs/logger/index.d.ts +20 -8
- package/lib/typescript/commonjs/logger/redact.d.ts +2 -0
- package/lib/typescript/commonjs/push/push.d.ts +2 -0
- package/lib/typescript/module/errors/extractApiError.d.ts +9 -6
- package/lib/typescript/module/errors/index.d.ts +1 -1
- package/lib/typescript/module/formatters/currency.d.ts +10 -9
- package/lib/typescript/module/formatters/house.d.ts +2 -36
- package/lib/typescript/module/index.d.ts +3 -3
- package/lib/typescript/module/initSDK.d.ts +9 -1
- package/lib/typescript/module/logger/crashlytics.d.ts +3 -3
- package/lib/typescript/module/logger/index.d.ts +20 -8
- package/lib/typescript/module/logger/redact.d.ts +2 -0
- package/lib/typescript/module/push/push.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type LogLevel } from '../config/index.js';
|
|
2
2
|
type LogFn = (message: string, ...optionalParams: unknown[]) => void;
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* and breadcrumbs to Crashlytics, Sentry, Bugsnag, etc
|
|
4
|
+
* Remote sink. Apps pass one to `initWebority({ remoteLogger })` to forward errors
|
|
5
|
+
* and breadcrumbs to Crashlytics, Sentry, Bugsnag, etc., without making the
|
|
6
6
|
* library depend on any of them.
|
|
7
7
|
*
|
|
8
8
|
* Every method is optional; the library calls only what the adapter implements.
|
|
@@ -20,10 +20,7 @@ export interface RemoteLogger {
|
|
|
20
20
|
/** Forward a leveled console message. */
|
|
21
21
|
log?: (level: LogLevel, message: string, optionalParams: unknown[]) => void;
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Inject a remote logger adapter (e.g. Firebase Crashlytics, Sentry).
|
|
25
|
-
* Pass `null` to detach. Safe to call before or after `initWebority`.
|
|
26
|
-
*/
|
|
23
|
+
/** Set by `initWebority`; `null` detaches. Not part of the package's public API. */
|
|
27
24
|
export declare const setRemoteLogger: (impl: RemoteLogger | null) => void;
|
|
28
25
|
/**
|
|
29
26
|
* Device / app context attached once at boot (platform, OS version, app version,
|
|
@@ -47,6 +44,12 @@ export interface DeviceContext {
|
|
|
47
44
|
*/
|
|
48
45
|
export declare const setDeviceContext: (context: DeviceContext | null) => void;
|
|
49
46
|
export declare const getDeviceContext: () => DeviceContext | null;
|
|
47
|
+
export interface LoggerBreadcrumb {
|
|
48
|
+
message: string;
|
|
49
|
+
data?: Record<string, unknown>;
|
|
50
|
+
/** When it was recorded, ISO 8601 in UTC. */
|
|
51
|
+
timestampUtc: string;
|
|
52
|
+
}
|
|
50
53
|
/** Tuning knobs for screen history and duplicate-error suppression. */
|
|
51
54
|
export interface LoggerOptions {
|
|
52
55
|
/** Identical errors within this window are collapsed. Default 5000ms. 0 disables dedupe. */
|
|
@@ -55,8 +58,15 @@ export interface LoggerOptions {
|
|
|
55
58
|
dedupeMaxPerWindow?: number;
|
|
56
59
|
/** Cap on tracked screen history. Default 20. */
|
|
57
60
|
screenHistoryLimit?: number;
|
|
61
|
+
/** Extra keys masked in logs, added to the built-in list. */
|
|
62
|
+
redactKeys?: string[];
|
|
63
|
+
/** Breadcrumbs kept for Logger.getBreadcrumbs(). Default 50. */
|
|
64
|
+
breadcrumbLimit?: number;
|
|
58
65
|
}
|
|
59
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Configure dedupe, screen history, breadcrumbs and redaction. Merges with current options;
|
|
68
|
+
* a `redactKeys` list replaces the app keys given before, and omitting it keeps them.
|
|
69
|
+
*/
|
|
60
70
|
export declare const configureLogger: (options: LoggerOptions) => void;
|
|
61
71
|
/** What `Logger.requestFailed` is told about the call beside the error itself. */
|
|
62
72
|
export interface RequestFailedContext {
|
|
@@ -76,7 +86,7 @@ export interface LoggerType {
|
|
|
76
86
|
info: LogFn;
|
|
77
87
|
warn: LogFn;
|
|
78
88
|
error: LogFn;
|
|
79
|
-
/** Append a breadcrumb to the remote sink (and log at info level). */
|
|
89
|
+
/** Append a breadcrumb to the ring and the remote sink (and log at info level). Data is redacted before it is kept. */
|
|
80
90
|
breadcrumb: (message: string, data?: Record<string, unknown>) => void;
|
|
81
91
|
/** Record a non-fatal error with optional context. */
|
|
82
92
|
recordError: (error: unknown, context?: Record<string, unknown>) => void;
|
|
@@ -92,6 +102,8 @@ export interface LoggerType {
|
|
|
92
102
|
getCurrentScreen: () => string | null;
|
|
93
103
|
/** Bounded history of tracked screen names, oldest first. */
|
|
94
104
|
getScreenHistory: () => string[];
|
|
105
|
+
/** Copy of the breadcrumb ring, oldest first, capped at configureLogger({ breadcrumbLimit }). */
|
|
106
|
+
getBreadcrumbs: () => LoggerBreadcrumb[];
|
|
95
107
|
}
|
|
96
108
|
export declare const Logger: LoggerType;
|
|
97
109
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Rebuilds the masking rules from the built-in list plus `extraKeys`. Replaces any earlier extras. */
|
|
2
|
+
export declare const configureRedaction: (extraKeys: readonly string[]) => void;
|
|
1
3
|
export declare const redactString: (input: string) => string;
|
|
2
4
|
/** Returns a copy with secrets masked; Errors are masked in place so identity and stack survive. */
|
|
3
5
|
export declare const redact: <T>(value: T) => T;
|
|
@@ -14,6 +14,8 @@ export interface PushDevice {
|
|
|
14
14
|
* (the simulator), so the server falls back to its own setting.
|
|
15
15
|
*/
|
|
16
16
|
apnsEnvironment: PushApnsEnvironment | null;
|
|
17
|
+
/** The device's IANA time zone, such as `Europe/London`. Null when the platform cannot name it. */
|
|
18
|
+
timeZone: string | null;
|
|
17
19
|
}
|
|
18
20
|
/** A notification that arrived while the app was open. */
|
|
19
21
|
export interface PushReceived {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.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",
|