@nativescript-community/sentry 4.6.17 → 4.6.19
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/backend.d.ts +105 -0
- package/backend.js +78 -0
- package/backend.js.map +1 -0
- package/measurement.d.ts +4 -0
- package/measurement.js +50 -0
- package/measurement.js.map +1 -0
- package/nssentry.android.d.ts +30 -0
- package/nssentry.android.js +645 -0
- package/nssentry.android.js.map +1 -0
- package/nssentry.d.ts +38 -0
- package/nssentry.ios.d.ts +34 -0
- package/nssentry.ios.js +286 -0
- package/nssentry.ios.js.map +1 -0
- package/package.json +3 -2
- package/sdk.js +1 -1
- package/sdk.js.map +1 -1
- package/wrapper.android.js +2 -2
- package/wrapper.android.js.map +1 -1
- package/integrations/rewriteframe.d.ts +0 -0
- package/integrations/rewriteframe.js +0 -1
- package/integrations/rewriteframe.js.map +0 -1
package/backend.d.ts
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
import { BrowserOptions } from '@sentry/browser';
|
2
|
+
import { BaseBackend } from '@sentry/core';
|
3
|
+
import { CaptureContext, Event, EventHint, Severity, Transport } from '@sentry/types';
|
4
|
+
import { SyncPromise } from '@sentry/utils';
|
5
|
+
/**
|
6
|
+
* Configuration options for the Sentry Nativescript SDK.
|
7
|
+
* @see NativescriptFrontend for more information.
|
8
|
+
*/
|
9
|
+
export interface NativescriptOptions extends BrowserOptions {
|
10
|
+
/**
|
11
|
+
* Enables native transport + device info + offline caching.
|
12
|
+
* Be careful, disabling this also breaks automatic release setting.
|
13
|
+
* This means you have to manage setting the release yourself.
|
14
|
+
* Defaults to `true`.
|
15
|
+
*/
|
16
|
+
enableNative?: boolean;
|
17
|
+
enableAutoSessionTracking?: boolean;
|
18
|
+
/**
|
19
|
+
* Enables native crashHandling. This only works if `enableNative` is `true`.
|
20
|
+
* Defaults to `true`.
|
21
|
+
*/
|
22
|
+
enableNativeCrashHandling?: boolean;
|
23
|
+
/** Maximum time to wait to drain the request queue, before the process is allowed to exit. */
|
24
|
+
shutdownTimeout?: number;
|
25
|
+
sessionTrackingIntervalMillis?: number;
|
26
|
+
/** Enable scope sync from Java to NDK on Android */
|
27
|
+
enableNdkScopeSync?: boolean;
|
28
|
+
/** When enabled, all the threads are automatically attached to all logged events on Android */
|
29
|
+
attachThreads?: boolean;
|
30
|
+
/**
|
31
|
+
* When enabled, certain personally identifiable information (PII) is added by active integrations.
|
32
|
+
*
|
33
|
+
* @default false
|
34
|
+
* */
|
35
|
+
sendDefaultPii?: boolean;
|
36
|
+
/** Should the native nagger alert be shown or not. */
|
37
|
+
/**
|
38
|
+
* Optional prefix to add while rewriting frames
|
39
|
+
*/
|
40
|
+
appPrefix?: string;
|
41
|
+
traceErrorHandler?: boolean;
|
42
|
+
uncaughtErrors?: boolean;
|
43
|
+
breadcrumbs?: {
|
44
|
+
console?: boolean;
|
45
|
+
dom?: boolean;
|
46
|
+
fetch?: boolean;
|
47
|
+
history?: boolean;
|
48
|
+
sentry?: boolean;
|
49
|
+
xhr?: boolean;
|
50
|
+
};
|
51
|
+
/** Enable auto performance tracking by default. */
|
52
|
+
enableAutoPerformanceTracking?: boolean;
|
53
|
+
flushSendEvent?: boolean;
|
54
|
+
/**
|
55
|
+
* Enables Out of Memory Tracking for iOS and macCatalyst.
|
56
|
+
* See the following link for more information and possible restrictions:
|
57
|
+
* https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/
|
58
|
+
*
|
59
|
+
* @default true
|
60
|
+
* */
|
61
|
+
enableOutOfMemoryTracking?: boolean;
|
62
|
+
/**
|
63
|
+
* Set data to the inital scope
|
64
|
+
* @deprecated Use `Sentry.configureScope(...)`
|
65
|
+
*/
|
66
|
+
initialScope?: CaptureContext;
|
67
|
+
headers?: {
|
68
|
+
[k: string]: string;
|
69
|
+
};
|
70
|
+
beforeSend?(event: any, hint?: any): any;
|
71
|
+
}
|
72
|
+
/** The Sentry Nativescript SDK Backend. */
|
73
|
+
export declare class NativescriptBackend extends BaseBackend<BrowserOptions> {
|
74
|
+
protected readonly _options: NativescriptOptions;
|
75
|
+
private readonly _browserBackend;
|
76
|
+
/** Creates a new Nativescript backend instance. */
|
77
|
+
constructor(_options: NativescriptOptions);
|
78
|
+
/**
|
79
|
+
* @inheritDoc
|
80
|
+
*/
|
81
|
+
protected _setupTransport(): Transport;
|
82
|
+
/**
|
83
|
+
* If true, native client is availabe and active
|
84
|
+
*/
|
85
|
+
private _isNativeTransportAvailable;
|
86
|
+
/**
|
87
|
+
* If native client is available it will trigger a native crash.
|
88
|
+
* Use this only for testing purposes.
|
89
|
+
*/
|
90
|
+
nativeCrash(): void;
|
91
|
+
/**
|
92
|
+
* @inheritDoc
|
93
|
+
*/
|
94
|
+
eventFromException(exception: any, hint?: EventHint): SyncPromise<Event>;
|
95
|
+
/**
|
96
|
+
* @inheritDoc
|
97
|
+
*/
|
98
|
+
eventFromMessage(message: string, level?: Severity, hint?: EventHint): SyncPromise<Event>;
|
99
|
+
}
|
100
|
+
/**
|
101
|
+
* Convert js severity level which has critical and log to more widely supported levels.
|
102
|
+
* @param level
|
103
|
+
* @returns More widely supported Severity level strings
|
104
|
+
*/
|
105
|
+
export declare function _processLevel(level: Severity): Severity;
|
package/backend.js
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
import { Transports } from '@sentry/browser';
|
2
|
+
import { BrowserBackend } from '@sentry/browser/dist/backend';
|
3
|
+
import { BaseBackend, NoopTransport } from '@sentry/core';
|
4
|
+
import { Severity } from '@sentry/types';
|
5
|
+
import { NativeTransport } from './transports/native';
|
6
|
+
import { NSSentry } from './nssentry';
|
7
|
+
/** The Sentry Nativescript SDK Backend. */
|
8
|
+
export class NativescriptBackend extends BaseBackend {
|
9
|
+
/** Creates a new Nativescript backend instance. */
|
10
|
+
constructor(_options) {
|
11
|
+
super(_options);
|
12
|
+
this._options = _options;
|
13
|
+
this._browserBackend = new BrowserBackend(_options);
|
14
|
+
if (_options.enableNative !== false) {
|
15
|
+
NSSentry.startWithDsnString(_options.dsn, _options);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* @inheritDoc
|
20
|
+
*/
|
21
|
+
_setupTransport() {
|
22
|
+
if (!this._options.dsn) {
|
23
|
+
// We return the noop transport here in case there is no Dsn.
|
24
|
+
return new NoopTransport();
|
25
|
+
}
|
26
|
+
const transportOptions = Object.assign(Object.assign({}, this._options.transportOptions), { dsn: this._options.dsn });
|
27
|
+
if (this._options.transport) {
|
28
|
+
return new this._options.transport(transportOptions);
|
29
|
+
}
|
30
|
+
if (this._isNativeTransportAvailable()) {
|
31
|
+
return new NativeTransport();
|
32
|
+
}
|
33
|
+
return new Transports.FetchTransport(transportOptions);
|
34
|
+
}
|
35
|
+
/**
|
36
|
+
* If true, native client is availabe and active
|
37
|
+
*/
|
38
|
+
_isNativeTransportAvailable() {
|
39
|
+
return NSSentry.nativeClientAvailable && NSSentry.nativeTransport;
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* If native client is available it will trigger a native crash.
|
43
|
+
* Use this only for testing purposes.
|
44
|
+
*/
|
45
|
+
nativeCrash() {
|
46
|
+
if (this._options.enableNative) {
|
47
|
+
// tslint:disable-next-line: no-unsafe-any
|
48
|
+
NSSentry.crash();
|
49
|
+
}
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* @inheritDoc
|
53
|
+
*/
|
54
|
+
eventFromException(exception, hint) {
|
55
|
+
return this._browserBackend.eventFromException(exception, hint);
|
56
|
+
}
|
57
|
+
/**
|
58
|
+
* @inheritDoc
|
59
|
+
*/
|
60
|
+
eventFromMessage(message, level = Severity.Info, hint) {
|
61
|
+
return this._browserBackend.eventFromMessage(message, level, hint);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
/**
|
65
|
+
* Convert js severity level which has critical and log to more widely supported levels.
|
66
|
+
* @param level
|
67
|
+
* @returns More widely supported Severity level strings
|
68
|
+
*/
|
69
|
+
export function _processLevel(level) {
|
70
|
+
if (level === Severity.Critical) {
|
71
|
+
return Severity.Fatal;
|
72
|
+
}
|
73
|
+
if (level === Severity.Log) {
|
74
|
+
return Severity.Debug;
|
75
|
+
}
|
76
|
+
return level;
|
77
|
+
}
|
78
|
+
//# sourceMappingURL=backend.js.map
|
package/backend.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAoC,QAAQ,EAAa,MAAM,eAAe,CAAC;AAGtF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAwFtC,2CAA2C;AAC3C,MAAM,OAAO,mBAAoB,SAAQ,WAA2B;IAGhE,mDAAmD;IACnD,YAAsC,QAA6B;QAC/D,KAAK,CAAC,QAAQ,CAAC,CAAC;QADkB,aAAQ,GAAR,QAAQ,CAAqB;QAE/D,IAAI,CAAC,eAAe,GAAG,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC;QAEpD,IAAI,QAAQ,CAAC,YAAY,KAAK,KAAK,EAAE;YACjC,QAAQ,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;SACvD;IACL,CAAC;IAED;;OAEG;IACO,eAAe;QACrB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YACpB,6DAA6D;YAC7D,OAAO,IAAI,aAAa,EAAE,CAAC;SAC9B;QAED,MAAM,gBAAgB,mCACf,IAAI,CAAC,QAAQ,CAAC,gBAAgB,KACjC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,GACzB,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ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|
+
import { NativescriptTracing } from './tracing';
|
3
|
+
/**
|
4
|
+
* Adds React Native's extensions. Needs to be called after @sentry/tracing's extension methods are added
|
5
|
+
*/
|
6
|
+
export function _addTracingExtensions() {
|
7
|
+
const carrier = getMainCarrier();
|
8
|
+
if (carrier.__SENTRY__) {
|
9
|
+
carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};
|
10
|
+
if (carrier.__SENTRY__.extensions.startTransaction) {
|
11
|
+
const originalStartTransaction = carrier.__SENTRY__.extensions
|
12
|
+
.startTransaction;
|
13
|
+
/*
|
14
|
+
Overwrites the transaction start and finish to start and finish stall tracking.
|
15
|
+
Preferably instead of overwriting add a callback method for this in the Transaction itself.
|
16
|
+
*/
|
17
|
+
const _startTransaction = _patchStartTransaction(originalStartTransaction);
|
18
|
+
carrier.__SENTRY__.extensions.startTransaction = _startTransaction;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Overwrite the startTransaction extension method to start and end stall tracking.
|
24
|
+
*/
|
25
|
+
const _patchStartTransaction = (originalStartTransaction) => {
|
26
|
+
/**
|
27
|
+
* Method to overwrite with
|
28
|
+
*/
|
29
|
+
function _startTransaction(transactionContext, customSamplingContext) {
|
30
|
+
const transaction = originalStartTransaction.apply(this, [
|
31
|
+
transactionContext,
|
32
|
+
customSamplingContext,
|
33
|
+
]);
|
34
|
+
const reactNativeTracing = getCurrentHub().getIntegration(NativescriptTracing);
|
35
|
+
if (reactNativeTracing) {
|
36
|
+
reactNativeTracing.onTransactionStart(transaction);
|
37
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
38
|
+
const originalFinish = transaction.finish;
|
39
|
+
transaction.finish = (endTimestamp) => {
|
40
|
+
if (reactNativeTracing) {
|
41
|
+
reactNativeTracing.onTransactionFinish(transaction);
|
42
|
+
}
|
43
|
+
return originalFinish.apply(transaction, [endTimestamp]);
|
44
|
+
};
|
45
|
+
}
|
46
|
+
return transaction;
|
47
|
+
}
|
48
|
+
return _startTransaction;
|
49
|
+
};
|
50
|
+
//# sourceMappingURL=measurement.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"measurement.js","sourceRoot":"","sources":["../src/measurement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACjC,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,IAAI,OAAO,CAAC,UAAU,EAAE;QACpB,OAAO,CAAC,UAAU,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;QACpE,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,gBAAgB,EAAE;YAChD,MAAM,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU;iBACzD,gBAA4C,CAAC;YAElD;;;QAGJ;YACI,MAAM,iBAAiB,GAAG,sBAAsB,CAC5C,wBAAwB,CAC3B,CAAC;YAEF,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,gBAAgB,GAAG,iBAAiB,CAAC;SACtE;KACJ;AACL,CAAC;AAQD;;GAEG;AACH,MAAM,sBAAsB,GAAG,CAC3B,wBAAkD,EAC1B,EAAE;IAC1B;;KAEC;IACD,SAAS,iBAAiB,CAEtB,kBAAsC,EACtC,qBAA6C;QAE7C,MAAM,WAAW,GAAgB,wBAAwB,CAAC,KAAK,CAAC,IAAI,EAAE;YAClE,kBAAkB;YAClB,qBAAqB;SACxB,CAAC,CAAC;QAEH,MAAM,kBAAkB,GAAG,aAAa,EAAE,CAAC,cAAc,CACrD,mBAAmB,CACtB,CAAC;QAEF,IAAI,kBAAkB,EAAE;YACpB,kBAAkB,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAEnD,6DAA6D;YAC7D,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC;YAE1C,WAAW,CAAC,MAAM,GAAG,CAAC,YAAgC,EAAE,EAAE;gBACtD,IAAI,kBAAkB,EAAE;oBACpB,kBAAkB,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;iBACvD;gBAED,OAAO,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;YAC7D,CAAC,CAAC;SACL;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC7B,CAAC,CAAC"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { Breadcrumb, Event, Response, User } from '@sentry/types';
|
2
|
+
import { NativescriptOptions } from './backend';
|
3
|
+
import { UserFeedback } from './nssentry';
|
4
|
+
export declare namespace NSSentry {
|
5
|
+
const nativeClientAvailable = true;
|
6
|
+
const nativeTransport = true;
|
7
|
+
function sendEvent(event: Event): Promise<Response>;
|
8
|
+
function captureEnvelope(envelope: string): Promise<void>;
|
9
|
+
function flush(timeout: number): void;
|
10
|
+
function startWithDsnString(dsnString: string, options?: NativescriptOptions): Promise<Response>;
|
11
|
+
function disableNativeFramesTracking(): void;
|
12
|
+
function fetchNativeSdkInfo(): {};
|
13
|
+
function fetchNativeRelease(): {
|
14
|
+
id: any;
|
15
|
+
version: any;
|
16
|
+
build: string;
|
17
|
+
};
|
18
|
+
function closeNativeSdk(): void;
|
19
|
+
function crash(): void;
|
20
|
+
function deviceContexts(): Promise<any>;
|
21
|
+
function captureUserFeedback(feedback: UserFeedback): void;
|
22
|
+
function setUser(user: User | null, otherUserKeys: any): void;
|
23
|
+
function setTag(key: string, value: string): void;
|
24
|
+
function setExtra(key: string, extra: string): void;
|
25
|
+
function addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): void;
|
26
|
+
function clearBreadcrumbs(): void;
|
27
|
+
function setContext(key: string, context: {
|
28
|
+
[key: string]: any;
|
29
|
+
} | null): void;
|
30
|
+
}
|