noibu-react-native 0.2.7 → 0.2.8
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/android/build.gradle +1 -1
- package/dist/api/ClientConfig.d.ts +99 -0
- package/dist/api/ClientConfig.js +25 -23
- package/dist/api/ClientConfig.test.d.ts +1 -0
- package/dist/api/HelpCode.d.ts +16 -0
- package/dist/api/HelpCode.js +3 -2
- package/dist/api/InputManager.d.ts +39 -0
- package/dist/api/MetroplexSocket.d.ts +132 -0
- package/dist/api/MetroplexSocket.js +4 -3
- package/dist/api/MetroplexSocket.test.d.ts +1 -0
- package/dist/api/StoredMetrics.d.ts +63 -0
- package/dist/api/StoredPageVisit.d.ts +43 -0
- package/dist/api/StoredPageVisit.js +4 -3
- package/dist/const_matchers.d.ts +1 -0
- package/dist/constants.d.ts +48 -0
- package/dist/constants.js +2 -9
- package/dist/entry/index.d.ts +13 -0
- package/dist/entry/init.d.ts +8 -0
- package/dist/entry/init.js +4 -3
- package/dist/monitors/AppNavigationMonitor.d.ts +10 -0
- package/dist/monitors/AppNavigationMonitor.js +2 -2
- package/dist/monitors/AppNavigationMonitor.test.d.ts +1 -0
- package/dist/monitors/BaseMonitor.d.ts +13 -0
- package/dist/monitors/BaseMonitor.test.d.ts +1 -0
- package/dist/monitors/ClickMonitor.d.ts +28 -0
- package/dist/monitors/ClickMonitor.test.d.ts +1 -0
- package/dist/monitors/ErrorMonitor.d.ts +39 -0
- package/dist/monitors/KeyboardInputMonitor.d.ts +18 -0
- package/dist/monitors/PageMonitor.d.ts +20 -0
- package/dist/monitors/RequestMonitor.d.ts +74 -0
- package/dist/monitors/RequestMonitor.js +8 -8
- package/dist/monitors/http-tools/GqlErrorValidator.d.ts +35 -0
- package/dist/monitors/http-tools/GqlErrorValidator.js +5 -3
- package/dist/monitors/http-tools/HTTPDataBundler.d.ts +106 -0
- package/dist/monitors/http-tools/HTTPDataBundler.js +7 -5
- package/dist/monitors/integrations/ReactNativeNavigationIntegration.d.ts +17 -0
- package/dist/pageVisit/EventDebouncer.d.ts +23 -0
- package/dist/pageVisit/HttpEventManager.d.ts +14 -0
- package/dist/pageVisit/PageVisitManager.d.ts +31 -0
- package/dist/pageVisit/pageVisitEventError.d.ts +12 -0
- package/dist/pageVisit/pageVisitEventError.js +2 -2
- package/dist/react/ErrorBoundary.d.ts +67 -0
- package/dist/sessionRecorder/SessionRecorder.d.ts +50 -0
- package/dist/sessionRecorder/SessionRecorder.js +7 -6
- package/dist/sessionRecorder/nativeSessionRecorderSubscription.d.ts +77 -0
- package/dist/sessionRecorder/types.d.ts +91 -0
- package/dist/storage/RNStorageProvider.d.ts +19 -0
- package/dist/storage/Storage.d.ts +29 -0
- package/dist/storage/StorageProvider.d.ts +23 -0
- package/dist/types/NavigationIntegration.d.ts +6 -0
- package/dist/utils/date.d.ts +7 -0
- package/dist/utils/date.js +3 -2
- package/dist/utils/eventlistener.d.ts +8 -0
- package/dist/utils/eventlistener.js +2 -3
- package/dist/utils/function.d.ts +72 -0
- package/dist/utils/log.d.ts +4 -0
- package/dist/utils/log.js +1 -3
- package/dist/utils/object.d.ts +46 -0
- package/dist/utils/performance.d.ts +6 -0
- package/dist/utils/piiRedactor.d.ts +11 -0
- package/dist/utils/polyfills.d.ts +4 -0
- package/dist/utils/stacktrace-parser.d.ts +8 -0
- package/dist/utils/stacktrace-parser.test.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SEVERITY } from '../constants.js';
|
|
2
1
|
import ClientConfig from '../api/ClientConfig.js';
|
|
3
2
|
|
|
4
3
|
/** addSafeEventListener will add an event listener for the specified event
|
|
@@ -24,7 +23,7 @@ function addSafeEventListener(object, event, callback, capture = false) {
|
|
|
24
23
|
ClientConfig.getInstance().postInternalError(
|
|
25
24
|
`addEventListener callback error: ${e.message}`,
|
|
26
25
|
false,
|
|
27
|
-
|
|
26
|
+
Severity.ERROR,
|
|
28
27
|
);
|
|
29
28
|
}
|
|
30
29
|
};
|
|
@@ -53,7 +52,7 @@ function addSafeEventListener(object, event, callback, capture = false) {
|
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
|
-
ClientConfig.getInstance().postInternalError(`addEventListener error: ${e.message}`, false,
|
|
55
|
+
ClientConfig.getInstance().postInternalError(`addEventListener error: ${e.message}`, false, Severity.ERROR);
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { JSError } from '@noibu/metroplex-ts-bindings';
|
|
2
|
+
import { RawStackFrame } from './stacktrace-parser';
|
|
3
|
+
/**
|
|
4
|
+
* returns a string that satisfies a max length
|
|
5
|
+
* stringToVerify: string that needs to be verified
|
|
6
|
+
* length :optional, max length that stringToVerify can be
|
|
7
|
+
*/
|
|
8
|
+
export declare function getMaxSubstringAllowed(stringToVerify: string, length?: number): string;
|
|
9
|
+
/**
|
|
10
|
+
* Processes the raw stack frames and creates a readable stack in a safe manner
|
|
11
|
+
*/
|
|
12
|
+
export declare function processFrames(rawFrames: RawStackFrame[]): import("@noibu/metroplex-ts-bindings").JSStackFrame[];
|
|
13
|
+
/** Retrieves the javascript stack and message from an error event object */
|
|
14
|
+
export declare function getJSStack(errObj?: {
|
|
15
|
+
stack?: string | NativeStackAndroid;
|
|
16
|
+
message?: string;
|
|
17
|
+
}): JSError;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if possiblyStacktrace has any stack frames present
|
|
20
|
+
*/
|
|
21
|
+
export declare function isStackTrace(_possiblyStacktrace: unknown): _possiblyStacktrace is string;
|
|
22
|
+
/**
|
|
23
|
+
* counts the number of bytes
|
|
24
|
+
*/
|
|
25
|
+
export declare function byteCount(s: string): number;
|
|
26
|
+
/**
|
|
27
|
+
* Stringify function that is aware of inner circular references and handles them by replacing with {} (empty object)
|
|
28
|
+
* taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value
|
|
29
|
+
*/
|
|
30
|
+
export declare function stringifyJSON(jsonObject: unknown): string;
|
|
31
|
+
/**
|
|
32
|
+
* Wrapper for a request with an ability to send-and-forget
|
|
33
|
+
* a send-and-forget request can outlive the page
|
|
34
|
+
*/
|
|
35
|
+
export declare function postRequest(url: string | URL, data: unknown, headers: Record<string, string>, sendAndForget?: boolean, timeout?: number): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* makes sure the url sent is a valid URL
|
|
38
|
+
*/
|
|
39
|
+
export declare function isValidURL(str: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Fakes the user agent retrieval, since there are no good libraries that support both expo and plain RN
|
|
42
|
+
* caches the result for the session
|
|
43
|
+
*/
|
|
44
|
+
export declare function getUserAgent(): Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* isNoibuJSAlreadyLoaded will verify if there are already other
|
|
47
|
+
* copies of NoibuJS runnung
|
|
48
|
+
*/
|
|
49
|
+
export declare function isNoibuJSAlreadyLoaded(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* asString will create a string out of anything passed to it.
|
|
52
|
+
*/
|
|
53
|
+
export declare function asString(obj: unknown): string;
|
|
54
|
+
/**
|
|
55
|
+
* masks textual content if it ressembles something sensitive
|
|
56
|
+
*/
|
|
57
|
+
export declare function maskTextInput(text: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Checks if the provided object is an instance of the specified type.
|
|
60
|
+
* It's safer than `instanceof` operator as it handles cases
|
|
61
|
+
* where type is not actually a type but an object.
|
|
62
|
+
*/
|
|
63
|
+
export declare function isInstanceOf<T>(instance: unknown, type: T): instance is T;
|
|
64
|
+
/** String.trim, but safe */
|
|
65
|
+
export declare function safeTrim(text: unknown): string;
|
|
66
|
+
/**
|
|
67
|
+
* Tries to get the stack trace from the given error object and returns it.
|
|
68
|
+
* If the error object does not have a stack trace, an empty string is returned.
|
|
69
|
+
*/
|
|
70
|
+
export declare function tryGetStackTrace(error: {
|
|
71
|
+
stack?: string;
|
|
72
|
+
}): string;
|
package/dist/utils/log.js
CHANGED
|
@@ -9,7 +9,5 @@ const getConsoleMethod = (ogProp) => {
|
|
|
9
9
|
};
|
|
10
10
|
/**log with level = info */
|
|
11
11
|
const noibuLog = (...msgs) => getConsoleMethod('log')('Noibu', ...msgs);
|
|
12
|
-
/**log with level = error */
|
|
13
|
-
const noibuErr = (...msgs) => getConsoleMethod('error')('Noibu', ...msgs);
|
|
14
12
|
|
|
15
|
-
export {
|
|
13
|
+
export { noibuLog };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** @module Object */
|
|
2
|
+
/**
|
|
3
|
+
* Replaces an attribute value found in an object with another value
|
|
4
|
+
* sourceObject: source object whose attribute will get replaced
|
|
5
|
+
* attributeName: the attribute key whose value will be replace
|
|
6
|
+
* processingFunction: function that accepts the original value
|
|
7
|
+
* and returns the newValue
|
|
8
|
+
*/
|
|
9
|
+
export declare function replace<Target extends object, Prop extends keyof Target>(sourceObject: Target, attributeName: Prop, processingFunction: (arg: Target[Prop]) => Target[Prop]): void;
|
|
10
|
+
/**
|
|
11
|
+
* unwraps wrapped property, so we can use it without side effects
|
|
12
|
+
*/
|
|
13
|
+
export declare function unwrapNoibuWrapped<T>(anything: {
|
|
14
|
+
__noibu_original__?: T;
|
|
15
|
+
} & T): NonNullable<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Checks if the given object is wrapped
|
|
18
|
+
*/
|
|
19
|
+
export declare function isNoibuWrapped<T extends object>(anything: T): anything is {
|
|
20
|
+
__noibu_original__?: T;
|
|
21
|
+
} & T;
|
|
22
|
+
/**
|
|
23
|
+
* Checks whether the prototype's property is writeable. If it is not,
|
|
24
|
+
* checks whether the property can be made writeable. If it can, it is
|
|
25
|
+
* set to writeable.
|
|
26
|
+
* returns Whether the property on the prototype is (or is now) writeable
|
|
27
|
+
*/
|
|
28
|
+
export declare const propWriteableOrMadeWriteable: <T>(proto: T, property: keyof T) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Iterates object recursively and calls visit function
|
|
31
|
+
* for each property allowing to override its value
|
|
32
|
+
* @param {Object} instance An object to iterate through
|
|
33
|
+
* @param {Function} visit Target callback function that is called for each property
|
|
34
|
+
* There are 3 arguments: current object, current property and its value
|
|
35
|
+
* @param {{depth: number}} limit Use limit config object to set depth of the recursion
|
|
36
|
+
*/
|
|
37
|
+
export declare const iterateObjectRecursively: (instance: Record<any, any>, visit: (i: typeof instance, p: keyof typeof i, v: (typeof i)[typeof p]) => typeof v, limit?: {
|
|
38
|
+
depth: number;
|
|
39
|
+
}) => void;
|
|
40
|
+
export declare const safeEntries: (obj: unknown | Record<string, string | null> | Headers) => [string, string | null][];
|
|
41
|
+
/**
|
|
42
|
+
* Replaces the behaviour of Object.fromEntries() as it is not supported on all browsers
|
|
43
|
+
* @param {Iterable} entries The iterable to parse into an object
|
|
44
|
+
* @returns An object containing the same key/values as the iterable passed
|
|
45
|
+
*/
|
|
46
|
+
export declare const safeFromEntries: <T>(entries: unknown) => Record<string, T>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redacts one string, returns redacted value or false if nothing to redact
|
|
3
|
+
*/
|
|
4
|
+
export declare function shouldRedact(field: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Takes a string and redacts any PII we're able to detect
|
|
7
|
+
*
|
|
8
|
+
* content - the string from which we want to redact PII
|
|
9
|
+
* returns the string with any PII we're able to detect redacted.
|
|
10
|
+
*/
|
|
11
|
+
export declare function removePII(content: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "noibu-react-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"targetNjsVersion": "1.0.104",
|
|
5
5
|
"description": "React-Native SDK for NoibuJS to collect errors in React-Native applications",
|
|
6
6
|
"main": "dist/entry/index.js",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@babel/preset-typescript": "^7.26.0",
|
|
50
50
|
"@eslint/eslintrc": "^3.2.0",
|
|
51
51
|
"@jest/globals": "^29.7.0",
|
|
52
|
-
"@noibu/metroplex-ts-bindings": "1.0.
|
|
52
|
+
"@noibu/metroplex-ts-bindings": "1.0.25",
|
|
53
53
|
"@react-native-async-storage/async-storage": "^1.19.0",
|
|
54
54
|
"@rollup/plugin-commonjs": "^25.0.0",
|
|
55
55
|
"@rollup/plugin-json": "^6.0.0",
|