package.build.cjs.breadcrumbs.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Base implementation for all Sentry JavaScript SDKs
{"version":3,"file":"breadcrumbs.js","sources":["../../src/breadcrumbs.ts"],"sourcesContent":["import type { Breadcrumb, BreadcrumbHint } from '@sentry/types';\nimport { consoleSandbox, dateTimestampInSeconds } from '@sentry/utils';\nimport { getClient, getIsolationScope } from './currentScopes';\n\n/**\n * Default maximum number of breadcrumbs added to an event. Can be overwritten\n * with {@link Options.maxBreadcrumbs}.\n */\nconst DEFAULT_BREADCRUMBS = 100;\n\n/**\n * Records a new breadcrumb which will be attached to future events.\n *\n * Breadcrumbs will be added to subsequent events to provide more context on\n * user's actions prior to an error or crash.\n */\nexport function addBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void {\n const client = getClient();\n const isolationScope = getIsolationScope();\n\n if (!client) return;\n\n const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions();\n\n if (maxBreadcrumbs <= 0) return;\n\n const timestamp = dateTimestampInSeconds();\n const mergedBreadcrumb = { timestamp, ...breadcrumb };\n const finalBreadcrumb = beforeBreadcrumb\n ? (consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) as Breadcrumb | null)\n : mergedBreadcrumb;\n\n if (finalBreadcrumb === null) return;\n\n if (client.emit) {\n client.emit('beforeAddBreadcrumb', finalBreadcrumb, hint);\n }\n\n isolationScope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);\n}\n"],"names":["getClient","getIsolationScope","dateTimestampInSeconds","consoleSandbox"],"mappings":";;;;;AAIA;AACA;AACA;AACA;AACA,MAAM,mBAAA,GAAsB,GAAG,CAAA;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa,CAAC,UAAU,EAAc,IAAI,EAAyB;AACnF,EAAE,MAAM,MAAA,GAASA,uBAAS,EAAE,CAAA;AAC5B,EAAE,MAAM,cAAA,GAAiBC,+BAAiB,EAAE,CAAA;AAC5C;AACA,EAAE,IAAI,CAAC,MAAM,EAAE,OAAM;AACrB;AACA,EAAE,MAAM,EAAE,gBAAiB,GAAE,IAAI,EAAE,cAAA,GAAiB,mBAAA,KAAwB,MAAM,CAAC,UAAU,EAAE,CAAA;AAC/F;AACA,EAAE,IAAI,cAAA,IAAkB,CAAC,EAAE,OAAM;AACjC;AACA,EAAE,MAAM,SAAA,GAAYC,4BAAsB,EAAE,CAAA;AAC5C,EAAE,MAAM,mBAAmB,EAAE,SAAS,EAAE,GAAG,YAAY,CAAA;AACvD,EAAE,MAAM,kBAAkB,gBAAA;AAC1B,OAAOC,oBAAc,CAAC,MAAM,gBAAgB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAE;AACtE,MAAM,gBAAgB,CAAA;AACtB;AACA,EAAE,IAAI,eAAA,KAAoB,IAAI,EAAE,OAAM;AACtC;AACA,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE;AACnB,IAAI,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,eAAe,EAAE,IAAI,CAAC,CAAA;AAC7D,GAAE;AACF;AACA,EAAE,cAAc,CAAC,aAAa,CAAC,eAAe,EAAE,cAAc,CAAC,CAAA;AAC/D;;;;"}