mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
1 line
34 KiB
JSON
1 line
34 KiB
JSON
|
|
{"ast":null,"code":"import { __awaiter, __rest } from \"tslib\";\n/* eslint-disable max-lines */\nimport { Capacitor } from '@capacitor/core';\nimport { dropUndefinedKeys, logger, SentryError } from '@sentry/utils';\nimport { SentryCapacitor } from './plugin';\n/**\n * Internal interface for calling native functions\n */\nexport const NATIVE = {\n /**\n * Sending the event over the bridge to native\n * @param event Event\n */\n sendEnvelope(envelope) {\n var _a, _b, _c, _d;\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this.isNativeClientAvailable()) {\n throw this._NativeClientError;\n }\n const header = envelope[0];\n const headerString = JSON.stringify(header);\n let envelopeItemsBuilder = `${headerString}`;\n for (const envelopeItems of envelope[1]) {\n const event = this._getEvent(envelopeItems);\n if (event != undefined) {\n if (NATIVE.platform === 'android') {\n // @ts-ignore Android still uses the old message object, without this the serialization of events will break.\n event.message = {\n message: event.message\n };\n /*\n We do this to avoid duplicate breadcrumbs on Android as sentry-android applies the breadcrumbs\n from the native scope onto every envelope sent through it. This scope will contain the breadcrumbs\n sent through the scope sync feature. This causes duplicate breadcrumbs.\n We then remove the breadcrumbs in all cases but if it is handled == false,\n this is a signal that the app would crash and android would lose the breadcrumbs by the time the app is restarted to read\n the envelope.\n */\n if (((_d = (_c = (_b = (_a = event.exception) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.mechanism) === null || _d === void 0 ? void 0 : _d.handled) != false && event.breadcrumbs) {\n event.breadcrumbs = [];\n }\n }\n envelopeItems[1] = event;\n }\n // Content type is not inside BaseEnvelopeItemHeaders.\n envelopeItems[0].content_type = 'application/json';\n const itemPayload = JSON.stringify(envelopeItems[1]);\n let length = itemPayload.length;\n try {\n yield SentryCapacitor.getStringBytesLength({\n string: itemPayload\n }).then(resp => {\n length = resp.value;\n });\n } catch (_e) {\n // The native call failed, we do nothing, we have payload.length as a fallback\n }\n envelopeItems[0].length = length;\n const itemHeader = JSON.stringify(envelopeItems[0]);\n envelopeItemsBuilder += `\\n${itemHeader}\\n${itemPayload}`;\n }\n yield SentryCapacitor.captureEnvelope({\n envelope: envelopeItemsBuilder\n });\n });\n },\n /**\n * Starts native with the provided options\n * @param options CapacitorOptions\n */\n initNativeSdk(options) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!options.dsn) {\n logger.warn('Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.');\n return false;\n }\n if (!options.enableNative) {\n if (options.enableNativeNagger) {\n logger.warn('Note: Native Sentry SDK is disabled.');\n }\n this.enableNative = false;\n return false;\n }\n if (!this.isNativeClientAvailable()) {\n throw this._NativeClientError;\n }\n // filter out all options that would crash native\n /* eslint-disable @typescript-eslint/unbound-method, @typescript-eslint/no-unused-vars */\n const {\n // @ts-ignore Vue specific option.\n app,\n // @ts-ignore Vue specific option.\n vue,\n beforeSend,\n
|