ghost 4.15.0 → 4.17.1
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/.eslintrc.js +7 -1
- package/content/themes/casper/assets/built/screen.css +1 -1
- package/content/themes/casper/assets/built/screen.css.map +1 -1
- package/content/themes/casper/assets/css/screen.css +1 -1
- package/content/themes/casper/default.hbs +2 -2
- package/content/themes/casper/package.json +1 -1
- package/content/themes/casper/page.hbs +28 -26
- package/content/themes/casper/partials/post-card.hbs +2 -2
- package/content/themes/casper/post.hbs +67 -65
- package/content/themes/casper/tag.hbs +2 -2
- package/core/boot.js +7 -7
- package/core/bridge.js +4 -3
- package/core/built/assets/{chunk.3.4b1d9e20e57164ac9c29.js → chunk.3.b80d3e1e6b8556aaff3c.js} +72 -71
- package/core/built/assets/ghost-dark-f7bf2dd8d8c702716f75bfa4ccd92df2.css +1 -0
- package/core/built/assets/{ghost.min-e35cfee26d942c364166f57f3dcc9e75.js → ghost.min-52a5420ffcea6bf17761b5c59cf020e2.js} +979 -908
- package/core/built/assets/ghost.min-741246f42f000c073999a5363434ea2c.css +1 -0
- package/core/built/assets/icons/discount-bubble.svg +1 -0
- package/core/built/assets/{vendor.min-ca33abc718f21a51327841d58f8875d0.js → vendor.min-1bfc9d56d27508db88ef417deb55f16f.js} +454 -434
- package/core/frontend/apps/amp/lib/helpers/amp_analytics.js +2 -2
- package/core/frontend/apps/amp/lib/helpers/amp_components.js +2 -1
- package/core/frontend/apps/amp/lib/helpers/amp_content.js +5 -1
- package/core/frontend/apps/amp/lib/helpers/amp_style.js +1 -1
- package/core/frontend/apps/amp/lib/router.js +8 -4
- package/core/frontend/apps/private-blogging/index.js +13 -5
- package/core/frontend/apps/private-blogging/lib/helpers/input_password.js +1 -1
- package/core/frontend/apps/private-blogging/lib/middleware.js +8 -3
- package/core/frontend/helpers/asset.js +10 -2
- package/core/frontend/helpers/author.js +5 -3
- package/core/frontend/helpers/authors.js +4 -3
- package/core/frontend/helpers/body_class.js +1 -1
- package/core/frontend/helpers/cancel_link.js +9 -2
- package/core/frontend/helpers/concat.js +1 -1
- package/core/frontend/helpers/content.js +1 -1
- package/core/frontend/helpers/date.js +1 -1
- package/core/frontend/helpers/encode.js +1 -1
- package/core/frontend/helpers/excerpt.js +2 -1
- package/core/frontend/helpers/facebook_url.js +2 -1
- package/core/frontend/helpers/foreach.js +11 -2
- package/core/frontend/helpers/get.js +14 -3
- package/core/frontend/helpers/ghost_foot.js +2 -1
- package/core/frontend/helpers/ghost_head.js +10 -1
- package/core/frontend/helpers/has.js +8 -3
- package/core/frontend/helpers/img_url.js +9 -3
- package/core/frontend/helpers/is.js +7 -2
- package/core/frontend/helpers/lang.js +1 -1
- package/core/frontend/helpers/link.js +11 -2
- package/core/frontend/helpers/link_class.js +11 -2
- package/core/frontend/helpers/match.js +12 -3
- package/core/frontend/helpers/navigation.js +13 -4
- package/core/frontend/helpers/pagination.js +15 -5
- package/core/frontend/helpers/plural.js +8 -2
- package/core/frontend/helpers/post_class.js +1 -1
- package/core/frontend/helpers/prev_post.js +9 -2
- package/core/frontend/helpers/price.js +11 -6
- package/core/frontend/helpers/products.js +2 -1
- package/core/frontend/helpers/reading_time.js +4 -2
- package/core/frontend/helpers/t.js +1 -1
- package/core/frontend/helpers/tags.js +3 -1
- package/core/frontend/helpers/title.js +1 -1
- package/core/frontend/helpers/twitter_url.js +2 -1
- package/core/frontend/helpers/url.js +3 -1
- package/core/frontend/services/proxy.js +34 -57
- package/core/frontend/services/rendering.js +24 -0
- package/core/frontend/services/routing/controllers/channel.js +6 -2
- package/core/frontend/services/routing/controllers/collection.js +6 -2
- package/core/frontend/services/routing/middlewares/page-param.js +6 -2
- package/core/frontend/services/theme-engine/middleware.js +23 -6
- package/core/frontend/services/theme-engine/preview.js +31 -8
- package/core/server/adapters/scheduling/post-scheduling/scheduler-intergation.js +6 -4
- package/core/server/adapters/storage/LocalFileStorage.js +10 -4
- package/core/server/api/canary/custom-theme-settings.js +22 -0
- package/core/server/api/canary/index.js +4 -0
- package/core/server/api/canary/members.js +1 -1
- package/core/server/api/canary/redirects.js +5 -5
- package/core/server/api/canary/settings.js +16 -148
- package/core/server/api/canary/utils/serializers/output/custom-theme-settings.js +13 -0
- package/core/server/api/canary/utils/serializers/output/index.js +4 -0
- package/core/server/api/canary/utils/validators/input/settings.js +23 -1
- package/core/server/api/v2/redirects.js +3 -3
- package/core/server/api/v2/settings.js +3 -4
- package/core/server/api/v3/redirects.js +5 -5
- package/core/server/api/v3/settings.js +16 -136
- package/core/server/api/v3/utils/validators/input/settings.js +23 -1
- package/core/server/data/db/state-manager.js +1 -1
- package/core/server/data/exporter/table-lists.js +3 -1
- package/core/server/data/importer/import-manager.js +398 -0
- package/core/server/data/importer/importers/data/data-importer.js +162 -0
- package/core/server/data/importer/importers/data/index.js +1 -162
- package/core/server/data/importer/index.js +1 -379
- package/core/server/data/migrations/versions/4.16/01-add-custom-theme-settings-table.js +9 -0
- package/core/server/data/migrations/versions/4.17/01-add-custom-theme-settings-permissions.js +21 -0
- package/core/server/data/migrations/versions/4.17/02-add-offers-table.js +19 -0
- package/core/server/data/migrations/versions/4.17/03-add-offers-permissions.js +35 -0
- package/core/server/data/schema/fixtures/fixtures.json +32 -0
- package/core/server/data/schema/schema.js +33 -0
- package/core/server/models/custom-theme-setting.js +9 -0
- package/core/server/models/index.js +2 -0
- package/core/server/services/custom-theme-settings.js +8 -0
- package/core/server/services/members/api.js +4 -1
- package/core/server/services/redirects/index.js +15 -0
- package/core/{frontend → server}/services/redirects/settings.js +13 -6
- package/core/server/services/redirects/validation.js +44 -0
- package/core/{frontend/services/settings → server/services/route-settings}/default-routes.yaml +0 -0
- package/core/server/services/route-settings/default-settings-manager.js +62 -0
- package/core/server/services/route-settings/index.js +32 -1
- package/core/server/services/route-settings/route-settings.js +38 -12
- package/core/server/services/route-settings/settings-loader.js +102 -0
- package/core/{frontend/services/settings → server/services/route-settings}/validate.js +38 -28
- package/core/server/services/route-settings/yaml-parser.js +53 -0
- package/core/server/services/settings/index.js +13 -16
- package/core/server/services/settings/settings-bread-service.js +188 -0
- package/core/server/services/settings/settings-utils.js +32 -0
- package/core/server/services/themes/ThemeStorage.js +5 -4
- package/core/server/services/themes/activation-bridge.js +14 -0
- package/core/server/services/themes/validate.js +5 -2
- package/core/server/web/admin/views/default-prod.html +4 -4
- package/core/server/web/admin/views/default.html +4 -4
- package/core/server/web/api/canary/admin/routes.js +5 -1
- package/core/server/web/members/app.js +3 -0
- package/core/server/web/oauth/app.js +7 -8
- package/core/server/web/shared/middlewares/custom-redirects.js +82 -59
- package/core/server/web/site/routes.js +2 -2
- package/core/shared/config/defaults.json +2 -2
- package/core/shared/config/overrides.json +1 -1
- package/core/shared/custom-theme-settings-cache.js +3 -0
- package/core/shared/i18n/translations/en.json +2 -13
- package/core/shared/labs.js +2 -2
- package/package.json +42 -41
- package/yarn.lock +916 -901
- package/core/built/assets/ghost-dark-faf931d90e92535e6c03ca16793cbe7b.css +0 -1
- package/core/built/assets/ghost.min-7aa074ad556a8455155ac88ceaca03ab.css +0 -1
- package/core/frontend/services/redirects/index.js +0 -9
- package/core/frontend/services/redirects/validation.js +0 -28
- package/core/frontend/services/settings/ensure-settings.js +0 -47
- package/core/frontend/services/settings/index.js +0 -104
- package/core/frontend/services/settings/loader.js +0 -89
- package/core/frontend/services/settings/yaml-parser.js +0 -31
|
@@ -7,78 +7,80 @@ into the {body} tag of the default.hbs template --}}
|
|
|
7
7
|
{{#post}}
|
|
8
8
|
{{!-- Everything inside the #post block pulls data from the post --}}
|
|
9
9
|
|
|
10
|
-
<
|
|
10
|
+
<main id="site-main" class="site-main">
|
|
11
|
+
<article class="article {{post_class}}">
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
<header class="article-header gh-canvas">
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</section>
|
|
18
|
-
{{/if}}
|
|
19
|
-
|
|
20
|
-
<h1 class="article-title">{{title}}</h1>
|
|
21
|
-
|
|
22
|
-
{{#if custom_excerpt}}
|
|
23
|
-
<p class="article-excerpt">{{custom_excerpt}}</p>
|
|
24
|
-
{{/if}}
|
|
25
|
-
|
|
26
|
-
<div class="article-byline">
|
|
27
|
-
<section class="article-byline-content">
|
|
28
|
-
<ul class="author-list">
|
|
29
|
-
{{#foreach authors}}
|
|
30
|
-
<li class="author-list-item">
|
|
31
|
-
{{#if profile_image}}
|
|
32
|
-
<a href="{{url}}" class="author-avatar">
|
|
33
|
-
<img class="author-profile-image" src="{{img_url profile_image size="xs"}}" alt="{{name}}" />
|
|
34
|
-
</a>
|
|
35
|
-
{{else}}
|
|
36
|
-
<a href="{{url}}" class="author-avatar author-profile-image">{{> "icons/avatar"}}</a>
|
|
37
|
-
{{/if}}
|
|
38
|
-
</li>
|
|
39
|
-
{{/foreach}}
|
|
40
|
-
</ul>
|
|
41
|
-
<div class="article-byline-meta">
|
|
42
|
-
<h4 class="author-name">{{authors}}</h4>
|
|
43
|
-
<div class="byline-meta-content">
|
|
44
|
-
<time class="byline-meta-date" datetime="{{date format="YYYY-MM-DD"}}">{{date}}</time>
|
|
45
|
-
<span class="byline-reading-time"><span class="bull">•</span> {{reading_time}}</span>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
15
|
+
{{#if primary_tag}}
|
|
16
|
+
<section class="article-tag">
|
|
17
|
+
<a href="{{primary_tag.url}}">{{primary_tag.name}}</a>
|
|
48
18
|
</section>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
{{#if feature_image}}
|
|
52
|
-
<figure class="article-image">
|
|
53
|
-
{{!-- This is a responsive image, it loads different sizes depending on device
|
|
54
|
-
https://medium.freecodecamp.org/a-guide-to-responsive-images-with-ready-to-use-templates-c400bd65c433 --}}
|
|
55
|
-
<img
|
|
56
|
-
srcset="{{img_url feature_image size="s"}} 300w,
|
|
57
|
-
{{img_url feature_image size="m"}} 600w,
|
|
58
|
-
{{img_url feature_image size="l"}} 1000w,
|
|
59
|
-
{{img_url feature_image size="xl"}} 2000w"
|
|
60
|
-
sizes="(min-width: 1400px) 1400px, 92vw"
|
|
61
|
-
src="{{img_url feature_image size="xl"}}"
|
|
62
|
-
alt="{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}"
|
|
63
|
-
/>
|
|
64
|
-
{{#if feature_image_caption}}
|
|
65
|
-
<figcaption>{{feature_image_caption}}</figcaption>
|
|
66
19
|
{{/if}}
|
|
67
|
-
</figure>
|
|
68
|
-
{{/if}}
|
|
69
|
-
</header>
|
|
70
20
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
21
|
+
<h1 class="article-title">{{title}}</h1>
|
|
22
|
+
|
|
23
|
+
{{#if custom_excerpt}}
|
|
24
|
+
<p class="article-excerpt">{{custom_excerpt}}</p>
|
|
25
|
+
{{/if}}
|
|
26
|
+
|
|
27
|
+
<div class="article-byline">
|
|
28
|
+
<section class="article-byline-content">
|
|
29
|
+
<ul class="author-list">
|
|
30
|
+
{{#foreach authors}}
|
|
31
|
+
<li class="author-list-item">
|
|
32
|
+
{{#if profile_image}}
|
|
33
|
+
<a href="{{url}}" class="author-avatar">
|
|
34
|
+
<img class="author-profile-image" src="{{img_url profile_image size="xs"}}" alt="{{name}}" />
|
|
35
|
+
</a>
|
|
36
|
+
{{else}}
|
|
37
|
+
<a href="{{url}}" class="author-avatar author-profile-image">{{> "icons/avatar"}}</a>
|
|
38
|
+
{{/if}}
|
|
39
|
+
</li>
|
|
40
|
+
{{/foreach}}
|
|
41
|
+
</ul>
|
|
42
|
+
<div class="article-byline-meta">
|
|
43
|
+
<h4 class="author-name">{{authors}}</h4>
|
|
44
|
+
<div class="byline-meta-content">
|
|
45
|
+
<time class="byline-meta-date" datetime="{{date format="YYYY-MM-DD"}}">{{date}}</time>
|
|
46
|
+
<span class="byline-reading-time"><span class="bull">•</span> {{reading_time}}</span>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</section>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
{{#if feature_image}}
|
|
53
|
+
<figure class="article-image">
|
|
54
|
+
{{!-- This is a responsive image, it loads different sizes depending on device
|
|
55
|
+
https://medium.freecodecamp.org/a-guide-to-responsive-images-with-ready-to-use-templates-c400bd65c433 --}}
|
|
56
|
+
<img
|
|
57
|
+
srcset="{{img_url feature_image size="s"}} 300w,
|
|
58
|
+
{{img_url feature_image size="m"}} 600w,
|
|
59
|
+
{{img_url feature_image size="l"}} 1000w,
|
|
60
|
+
{{img_url feature_image size="xl"}} 2000w"
|
|
61
|
+
sizes="(min-width: 1400px) 1400px, 92vw"
|
|
62
|
+
src="{{img_url feature_image size="xl"}}"
|
|
63
|
+
alt="{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}"
|
|
64
|
+
/>
|
|
65
|
+
{{#if feature_image_caption}}
|
|
66
|
+
<figcaption>{{feature_image_caption}}</figcaption>
|
|
67
|
+
{{/if}}
|
|
68
|
+
</figure>
|
|
69
|
+
{{/if}}
|
|
70
|
+
</header>
|
|
74
71
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
<section class="gh-content gh-canvas">
|
|
73
|
+
{{content}}
|
|
74
|
+
</section>
|
|
75
|
+
|
|
76
|
+
{{!--
|
|
77
|
+
<section class="article-comments gh-canvas">
|
|
78
|
+
If you want to embed comments, this is a good place to paste your code!
|
|
79
|
+
</section>
|
|
80
|
+
--}}
|
|
80
81
|
|
|
81
|
-
</article>
|
|
82
|
+
</article>
|
|
83
|
+
</main>
|
|
82
84
|
|
|
83
85
|
{{!-- A signup call to action is displayed here, unless viewed as a logged-in member --}}
|
|
84
86
|
{{#unless @member}}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
{{!-- The tag above means - insert everything in this file into the {body} of the default.hbs template --}}
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
<
|
|
5
|
+
<main id="site-main" class="site-main outer">
|
|
6
6
|
<div class="inner posts">
|
|
7
7
|
<div class="post-feed">
|
|
8
8
|
|
|
@@ -54,4 +54,4 @@
|
|
|
54
54
|
|
|
55
55
|
</div>
|
|
56
56
|
</div>
|
|
57
|
-
</
|
|
57
|
+
</main>
|
package/core/boot.js
CHANGED
|
@@ -112,10 +112,10 @@ async function initCore({ghostServer, config}) {
|
|
|
112
112
|
async function initFrontend() {
|
|
113
113
|
debug('Begin: initFrontend');
|
|
114
114
|
|
|
115
|
-
debug('Begin: Frontend Settings');
|
|
116
|
-
const
|
|
117
|
-
await
|
|
118
|
-
debug('End: Frontend Settings');
|
|
115
|
+
debug('Begin: Frontend Routing Settings');
|
|
116
|
+
const routeSettings = require('./server/services/route-settings');
|
|
117
|
+
await routeSettings.init();
|
|
118
|
+
debug('End: Frontend Routing Settings');
|
|
119
119
|
|
|
120
120
|
debug('Begin: Themes');
|
|
121
121
|
const themeService = require('./server/services/themes');
|
|
@@ -146,16 +146,16 @@ async function initExpressApps() {
|
|
|
146
146
|
async function initDynamicRouting() {
|
|
147
147
|
debug('Begin: Dynamic Routing');
|
|
148
148
|
const routing = require('./frontend/services/routing');
|
|
149
|
-
const
|
|
149
|
+
const routeSettingsService = require('./server/services/route-settings');
|
|
150
150
|
const bridge = require('./bridge');
|
|
151
151
|
|
|
152
152
|
// We pass the frontend API version + the dynamic routes here, so that the frontend services are slightly less tightly-coupled
|
|
153
153
|
const apiVersion = bridge.getFrontendApiVersion();
|
|
154
|
-
const routeSettings =
|
|
154
|
+
const routeSettings = await routeSettingsService.loadRouteSettings();
|
|
155
155
|
debug(`Frontend API Version: ${apiVersion}`);
|
|
156
156
|
|
|
157
157
|
routing.bootstrap.start(apiVersion, routeSettings);
|
|
158
|
-
const getRoutesHash = () =>
|
|
158
|
+
const getRoutesHash = () => routeSettingsService.api.getCurrentHash();
|
|
159
159
|
|
|
160
160
|
const settings = require('./server/services/settings');
|
|
161
161
|
await settings.syncRoutesHash(getRoutesHash);
|
package/core/bridge.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* The bridge is responsible for handing communication from the server to the frontend.
|
|
5
5
|
* Data should only be flowing server -> frontend.
|
|
6
6
|
* As the architecture improves, the number of cross requires here should go down
|
|
7
|
-
* Eventually, the aim is to make this a component that is
|
|
7
|
+
* Eventually, the aim is to make this a component that is initialized on boot and is either handed to or actively creates the frontend, if the frontend is desired.
|
|
8
8
|
*
|
|
9
9
|
* This file is a great place for all the cross-component event handling in lieu of refactoring
|
|
10
|
+
* NOTE: You may require anything from shared, the frontend or server here - it is the one place (other than boot) that is allowed :)
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
const debug = require('@tryghost/debug')('bridge');
|
|
@@ -40,7 +41,7 @@ class Bridge {
|
|
|
40
41
|
return themeEngine.getActive();
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
activateTheme(loadedTheme, checkedTheme
|
|
44
|
+
activateTheme(loadedTheme, checkedTheme) {
|
|
44
45
|
let settings = {
|
|
45
46
|
locale: settingsCache.get('lang')
|
|
46
47
|
};
|
|
@@ -53,7 +54,7 @@ class Bridge {
|
|
|
53
54
|
previousGhostAPI = this.getActiveTheme().engine('ghost-api');
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
themeEngine.setActive(settings, loadedTheme, checkedTheme
|
|
57
|
+
themeEngine.setActive(settings, loadedTheme, checkedTheme);
|
|
57
58
|
const currentGhostAPI = this.getActiveTheme().engine('ghost-api');
|
|
58
59
|
|
|
59
60
|
if (previousGhostAPI !== undefined && (previousGhostAPI !== currentGhostAPI)) {
|
package/core/built/assets/{chunk.3.4b1d9e20e57164ac9c29.js → chunk.3.b80d3e1e6b8556aaff3c.js}
RENAMED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
(window.webpackJsonp_ember_auto_import_=window.webpackJsonp_ember_auto_import_||[]).push([[3],{
|
|
2
|
-
n.r(e),n.d(e,"Integrations",(function(){return
|
|
1
|
+
(window.webpackJsonp_ember_auto_import_=window.webpackJsonp_ember_auto_import_||[]).push([[3],{440:function(t,e,n){"use strict"
|
|
2
|
+
n.r(e),n.d(e,"Integrations",(function(){return G})),n.d(e,"Span",(function(){return W.a})),n.d(e,"Transaction",(function(){return J.a})),n.d(e,"registerRequestInstrumentation",(function(){return A})),n.d(e,"defaultRequestInstrumentationOptions",(function(){return R})),n.d(e,"SpanStatus",(function(){return u.a})),n.d(e,"IdleTransaction",(function(){return c.b})),n.d(e,"startIdleTransaction",(function(){return o.b})),n.d(e,"addExtensionMethods",(function(){return o.a})),n.d(e,"extractTraceparentData",(function(){return d.b})),n.d(e,"getActiveTransaction",(function(){return d.c})),n.d(e,"hasTracingEnabled",(function(){return d.d})),n.d(e,"stripUrlQueryAndFragment",(function(){return s.k})),n.d(e,"TRACEPARENT_REGEXP",(function(){return d.a}))
|
|
3
3
|
var i={}
|
|
4
|
-
n.r(i),n.d(i,"Express",(function(){return
|
|
5
|
-
var a=n(0),r=n(11),s=n(5),o=n(
|
|
4
|
+
n.r(i),n.d(i,"Express",(function(){return q})),n.d(i,"Postgres",(function(){return L})),n.d(i,"Mysql",(function(){return z})),n.d(i,"Mongo",(function(){return Y}))
|
|
5
|
+
var a=n(0),r=n(11),s=n(5),o=n(444),c=n(445),u=n(443),d=n(442),p=Object(s.f)(),l=n(10),m=n(50),h=n(22),f=function(t,e,n){var i
|
|
6
6
|
return function(a){e.value>=0&&(a||n)&&(e.delta=e.value-(i||0),(e.delta||void 0===i)&&(i=e.value,t(e)))}},v=function(t,e){return{name:t,value:null!=e?e:-1,delta:0,entries:[],id:"v2-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12)}},g=function(t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){if("first-input"===t&&!("PerformanceEventTiming"in self))return
|
|
7
7
|
var n=new PerformanceObserver((function(t){return t.getEntries().map(e)}))
|
|
8
|
-
return n.observe({type:t,buffered:!0}),n}}catch(t){}},_=function(t,e){var n=function(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(t(i),e&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))}
|
|
9
|
-
addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},b=-1,y=function(){return b<0&&(b="hidden"===document.visibilityState?0:1/0,_((function(t){var e=t.timeStamp
|
|
10
|
-
b=e}),!0)),{get firstHiddenTime(){return b}}},O={},T=Object(s.f)(),S=function(){function t(){var
|
|
11
|
-
this._measurements={},this._performanceCursor=0,!Object(l.b)()&&(null===(
|
|
8
|
+
return n.observe({type:t,buffered:!0}),n}}catch(t){}},_=function(t,e){var n=function(i){"pagehide"!==i.type&&"hidden"!==Object(s.f)().document.visibilityState||(t(i),e&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))}
|
|
9
|
+
addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},b=-1,y=function(){return b<0&&(b="hidden"===Object(s.f)().document.visibilityState?0:1/0,_((function(t){var e=t.timeStamp
|
|
10
|
+
b=e}),!0)),{get firstHiddenTime(){return b}}},O={},T=Object(s.f)(),j={_reportAllChanges:!1},S=function(){function t(t){var e,n
|
|
11
|
+
this._measurements={},this._performanceCursor=0,!Object(l.b)()&&(null===(e=T)||void 0===e?void 0:e.performance)&&(null===(n=T)||void 0===n?void 0:n.document)&&(T.performance.mark&&T.performance.mark("sentry-tracing-init"),this._trackCLS(),this._trackLCP(t._reportAllChanges),this._trackFID())}return t.prototype.addPerformanceEntries=function(t){var e=this
|
|
12
12
|
if(T&&T.performance&&T.performance.getEntries&&m.b){r.a.log("[Tracing] Adding & adjusting spans using Performance API")
|
|
13
13
|
var n,i,a,s,o,c=Object(d.e)(m.b)
|
|
14
14
|
if(T.document&&T.document.scripts)for(var u=0;u<T.document.scripts.length;u++)if("true"===T.document.scripts[u].dataset.entry){n=T.document.scripts[u].src
|
|
15
15
|
break}if(T.performance.getEntries().slice(this._performanceCursor).forEach((function(u){var p=Object(d.e)(u.startTime),l=Object(d.e)(u.duration)
|
|
16
|
-
if(!("navigation"===t.op&&c+p<t.startTimestamp))switch(u.entryType){case"navigation":!function(t,e,n){
|
|
16
|
+
if(!("navigation"===t.op&&c+p<t.startTimestamp))switch(u.entryType){case"navigation":!function(t,e,n){E({transaction:t,entry:e,event:"unloadEvent",timeOrigin:n}),E({transaction:t,entry:e,event:"redirect",timeOrigin:n}),E({transaction:t,entry:e,event:"domContentLoadedEvent",timeOrigin:n}),E({transaction:t,entry:e,event:"loadEvent",timeOrigin:n}),E({transaction:t,entry:e,event:"connect",timeOrigin:n}),E({transaction:t,entry:e,event:"secureConnection",timeOrigin:n,eventEnd:"connectEnd",description:"TLS/SSL"}),E({transaction:t,entry:e,event:"fetch",timeOrigin:n,eventEnd:"domainLookupStart",description:"cache"}),E({transaction:t,entry:e,event:"domainLookup",timeOrigin:n,description:"DNS"}),function(t,e,n){x(t,{op:"browser",description:"request",startTimestamp:n+Object(d.e)(e.requestStart),endTimestamp:n+Object(d.e)(e.responseEnd)}),x(t,{op:"browser",description:"response",startTimestamp:n+Object(d.e)(e.responseStart),endTimestamp:n+Object(d.e)(e.responseEnd)})}(t,e,n)}(t,u,c),s=c+Object(d.e)(u.responseStart),o=c+Object(d.e)(u.requestStart)
|
|
17
17
|
break
|
|
18
18
|
case"mark":case"paint":case"measure":var m=function(t,e,n,i,a){var r=a+n,s=r+i
|
|
19
|
-
return
|
|
19
|
+
return x(t,{description:e.name,endTimestamp:s,op:e.entryType,startTimestamp:r}),r}(t,u,p,l,c)
|
|
20
20
|
void 0===a&&"sentry-tracing-init"===u.name&&(a=m)
|
|
21
21
|
var h=y(),f=u.startTime<h.firstHiddenTime
|
|
22
22
|
"first-paint"===u.name&&f&&(r.a.log("[Measurements] Adding FP"),e._measurements.fp={value:u.startTime},e._measurements["mark.fp"]={value:m}),"first-contentful-paint"===u.name&&f&&(r.a.log("[Measurements] Adding FCP"),e._measurements.fcp={value:u.startTime},e._measurements["mark.fcp"]={value:m})
|
|
23
23
|
break
|
|
24
|
-
case"resource":var v=u.name.replace(
|
|
24
|
+
case"resource":var v=u.name.replace(T.location.origin,""),g=function(t,e,n,i,a,r){if("xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType){var s={}
|
|
25
25
|
"transferSize"in e&&(s["Transfer Size"]=e.transferSize),"encodedBodySize"in e&&(s["Encoded Body Size"]=e.encodedBodySize),"decodedBodySize"in e&&(s["Decoded Body Size"]=e.decodedBodySize)
|
|
26
26
|
var o=r+i,c=o+a
|
|
27
|
-
return
|
|
28
|
-
void 0===i&&(n||"").indexOf(v)>-1&&(i=g)}})),void 0!==i&&void 0!==a&&
|
|
27
|
+
return x(t,{description:n,endTimestamp:c,op:e.initiatorType?"resource."+e.initiatorType:"resource",startTimestamp:o,data:s}),c}}(t,u,v,p,l,c)
|
|
28
|
+
void 0===i&&(n||"").indexOf(v)>-1&&(i=g)}})),void 0!==i&&void 0!==a&&x(t,{description:"evaluation",endTimestamp:a,op:"script",startTimestamp:i}),this._performanceCursor=Math.max(performance.getEntries().length-1,0),this._trackNavigator(t),"pageload"===t.op){var p=Object(d.e)(m.b)
|
|
29
29
|
"number"==typeof s&&(r.a.log("[Measurements] Adding TTFB"),this._measurements.ttfb={value:1e3*(s-t.startTimestamp)},"number"==typeof o&&o<=s&&(this._measurements["ttfb.requestTime"]={value:1e3*(s-o)})),["fcp","fp","lcp"].forEach((function(n){if(e._measurements[n]&&!(p>=t.startTimestamp)){var i=e._measurements[n].value,a=p+Object(d.e)(i),s=Math.abs(1e3*(a-t.startTimestamp)),o=s-i
|
|
30
|
-
r.a.log("[Measurements] Normalized "+n+" from "+i+" to "+s+" ("+o+")"),e._measurements[n].value=s}})),this._measurements["mark.fid"]&&this._measurements.fid&&
|
|
30
|
+
r.a.log("[Measurements] Normalized "+n+" from "+i+" to "+s+" ("+o+")"),e._measurements[n].value=s}})),this._measurements["mark.fid"]&&this._measurements.fid&&x(t,{description:"first input delay",endTimestamp:this._measurements["mark.fid"].value+Object(d.e)(this._measurements.fid.value),op:"web.vitals",startTimestamp:this._measurements["mark.fid"].value}),"fcp"in this._measurements||delete this._measurements.cls,t.setMeasurements(this._measurements),this._tagMetricInfo(t)}}},t.prototype._tagMetricInfo=function(t){this._lcpEntry&&(r.a.log("[Measurements] Adding LCP Data"),this._lcpEntry.element&&t.setTag("lcp.element",Object(h.a)(this._lcpEntry.element)),this._lcpEntry.id&&t.setTag("lcp.id",this._lcpEntry.id),this._lcpEntry.url&&t.setTag("lcp.url",this._lcpEntry.url.trim().slice(0,200)),t.setTag("lcp.size",this._lcpEntry.size)),this._clsEntry&&this._clsEntry.sources&&(r.a.log("[Measurements] Adding CLS Data"),this._clsEntry.sources.forEach((function(e,n){return t.setTag("cls.source."+(n+1),Object(h.a)(e.node))})))},t.prototype._trackCLS=function(){var t=this
|
|
31
31
|
!function(t,e){var n,i=v("CLS",0),a=0,r=[],s=function(t){if(t&&!t.hadRecentInput){var e=r[0],s=r[r.length-1]
|
|
32
32
|
a&&0!==r.length&&t.startTime-s.startTime<1e3&&t.startTime-e.startTime<5e3?(a+=t.value,r.push(t)):(a=t.value,r=[t]),a>i.value&&(i.value=a,i.entries=r,n&&n())}},o=g("layout-shift",s)
|
|
33
33
|
o&&(n=f(t,i,void 0),_((function(){o.takeRecords().map(s),n(!0)})))}((function(e){var n=e.entries.pop()
|
|
34
34
|
n&&(r.a.log("[Measurements] Adding CLS"),t._measurements.cls={value:e.value},t._clsEntry=n)}))},t.prototype._trackNavigator=function(t){var e=T.navigator
|
|
35
35
|
if(e){var n=e.connection
|
|
36
|
-
n&&(n.effectiveType&&t.setTag("effectiveConnectionType",n.effectiveType),n.type&&t.setTag("connectionType",n.type),
|
|
36
|
+
n&&(n.effectiveType&&t.setTag("effectiveConnectionType",n.effectiveType),n.type&&t.setTag("connectionType",n.type),I(n.rtt)&&(this._measurements["connection.rtt"]={value:n.rtt}),I(n.downlink)&&(this._measurements["connection.downlink"]={value:n.downlink})),I(e.deviceMemory)&&t.setTag("deviceMemory",String(e.deviceMemory)),I(e.hardwareConcurrency)&&t.setTag("hardwareConcurrency",String(e.hardwareConcurrency))}},t.prototype._trackLCP=function(t){var e=this
|
|
37
37
|
!function(t,e){var n,i=y(),a=v("LCP"),r=function(t){var e=t.startTime
|
|
38
38
|
e<i.firstHiddenTime&&(a.value=e,a.entries.push(t)),n&&n()},s=g("largest-contentful-paint",r)
|
|
39
|
-
if(s){n=f(t,a,
|
|
40
|
-
var o=function(){O[a.id]||(s.takeRecords().map(r),s.disconnect(),O[a.id]=!0,n(!0))};["keydown","click"].forEach((function(t){addEventListener(t,o,{once:!0,capture:!0})})),_(o,!0)}}((function(
|
|
39
|
+
if(s){n=f(t,a,e)
|
|
40
|
+
var o=function(){O[a.id]||(s.takeRecords().map(r),s.disconnect(),O[a.id]=!0,n(!0))};["keydown","click"].forEach((function(t){addEventListener(t,o,{once:!0,capture:!0})})),_(o,!0)}}((function(t){var n=t.entries.pop()
|
|
41
41
|
if(n){var i=Object(d.e)(m.b),a=Object(d.e)(n.startTime)
|
|
42
|
-
r.a.log("[Measurements] Adding LCP"),
|
|
42
|
+
r.a.log("[Measurements] Adding LCP"),e._measurements.lcp={value:t.value},e._measurements["mark.lcp"]={value:i+a},e._lcpEntry=n}}),t)},t.prototype._trackFID=function(){var t=this
|
|
43
43
|
!function(t,e){var n,i=y(),a=v("FID"),r=function(t){n&&t.startTime<i.firstHiddenTime&&(a.value=t.processingStart-t.startTime,a.entries.push(t),n(!0))},s=g("first-input",r)
|
|
44
44
|
s&&(n=f(t,a,void 0),_((function(){s.takeRecords().map(r),s.disconnect()}),!0))}((function(e){var n=e.entries.pop()
|
|
45
45
|
if(n){var i=Object(d.e)(m.b),a=Object(d.e)(n.startTime)
|
|
46
46
|
r.a.log("[Measurements] Adding FID"),t._measurements.fid={value:e.value},t._measurements["mark.fid"]={value:i+a}}}))},t}()
|
|
47
|
-
function
|
|
48
|
-
c&&o&&
|
|
49
|
-
return n&&t.startTimestamp>n&&(t.startTimestamp=n),t.startChild(Object(a.a)({startTimestamp:n},i))}function
|
|
50
|
-
function
|
|
47
|
+
function E(t){var e=t.transaction,n=t.entry,i=t.event,a=t.timeOrigin,r=t.eventEnd,s=t.description,o=r?n[r]:n[i+"End"],c=n[i+"Start"]
|
|
48
|
+
c&&o&&x(e,{op:"browser",description:null!=s?s:i,startTimestamp:a+Object(d.e)(c),endTimestamp:a+Object(d.e)(o)})}function x(t,e){var n=e.startTimestamp,i=Object(a.d)(e,["startTimestamp"])
|
|
49
|
+
return n&&t.startTimestamp>n&&(t.startTimestamp=n),t.startChild(Object(a.a)({startTimestamp:n},i))}function I(t){return"number"==typeof t&&isFinite(t)}var C=n(9),k=n(56),w=n(4),R={traceFetch:!0,traceXHR:!0,tracingOrigins:["localhost",/^\//]}
|
|
50
|
+
function A(t){var e=Object(a.a)(Object(a.a)({},R),t),n=e.traceFetch,i=e.traceXHR,r=e.tracingOrigins,s=e.shouldCreateSpanForRequest,o={},c=function(t){if(o[t])return o[t]
|
|
51
51
|
var e=r
|
|
52
|
-
return o[t]=e.some((function(e){return Object(
|
|
52
|
+
return o[t]=e.some((function(e){return Object(C.a)(t,e)}))&&!Object(C.a)(t,"sentry_key"),o[t]},p=c
|
|
53
53
|
"function"==typeof s&&(p=function(t){return c(t)&&s(t)})
|
|
54
54
|
var l={}
|
|
55
|
-
n&&Object(
|
|
55
|
+
n&&Object(k.a)({callback:function(t){!function(t,e,n){if(Object(d.d)()&&t.fetchData&&e(t.fetchData.url))if(t.endTimestamp&&t.fetchData.__span)(r=n[t.fetchData.__span])&&(t.response?r.setHttpStatus(t.response.status):t.error&&r.setStatus(u.a.InternalError),r.finish(),delete n[t.fetchData.__span])
|
|
56
56
|
else{var i=Object(d.c)()
|
|
57
57
|
if(i){var r=i.startChild({data:Object(a.a)(Object(a.a)({},t.fetchData),{type:"fetch"}),description:t.fetchData.method+" "+t.fetchData.url,op:"http.client"})
|
|
58
58
|
t.fetchData.__span=r.spanId,n[r.spanId]=r
|
|
59
59
|
var s=t.args[0]=t.args[0],o=t.args[1]=t.args[1]||{},c=o.headers
|
|
60
|
-
Object(
|
|
60
|
+
Object(w.g)(s,Request)&&(c=s.headers),c?"function"==typeof c.append?c.append("sentry-trace",r.toTraceparent()):c=Array.isArray(c)?Object(a.e)(c,[["sentry-trace",r.toTraceparent()]]):Object(a.a)(Object(a.a)({},c),{"sentry-trace":r.toTraceparent()}):c={"sentry-trace":r.toTraceparent()},o.headers=c}}}(t,p,l)},type:"fetch"}),i&&Object(k.a)({callback:function(t){!function(t,e,n){var i,r
|
|
61
61
|
if(Object(d.d)()&&!(null===(i=t.xhr)||void 0===i?void 0:i.__sentry_own_request__)&&(null===(r=t.xhr)||void 0===r?void 0:r.__sentry_xhr__)&&e(t.xhr.__sentry_xhr__.url)){var s=t.xhr.__sentry_xhr__
|
|
62
62
|
if(t.endTimestamp&&t.xhr.__sentry_xhr_span_id__)(c=n[t.xhr.__sentry_xhr_span_id__])&&(c.setHttpStatus(s.status_code),c.finish(),delete n[t.xhr.__sentry_xhr_span_id__])
|
|
63
63
|
else{var o=Object(d.c)()
|
|
64
64
|
if(o){var c=o.startChild({data:Object(a.a)(Object(a.a)({},s.data),{type:"xhr",method:s.method,url:s.url}),description:s.method+" "+s.url,op:"http.client"})
|
|
65
|
-
if(t.xhr.__sentry_xhr_span_id__=c.spanId,n[t.xhr.__sentry_xhr_span_id__]=c,t.xhr.setRequestHeader)try{t.xhr.setRequestHeader("sentry-trace",c.toTraceparent())}catch(t){}}}}}(t,p,l)},type:"xhr"})}var
|
|
66
|
-
e&&(i=t({name:
|
|
67
|
-
void 0===s&&a&&-1!==a.indexOf(n)?a=void 0:s!==n&&(a=void 0,i&&(r.a.log("[Tracing] Finishing current transaction with op: "+i.op),i.finish()),i=t({name:
|
|
68
|
-
var n=
|
|
69
|
-
e&&e.tracingOrigins&&Array.isArray(e.tracingOrigins)&&0!==e.tracingOrigins.length?n=e.tracingOrigins:this._emitOptionsWarning=!0,this.options=Object(a.a)(Object(a.a)(Object(a.a)({},
|
|
70
|
-
this._getCurrentHub=e,this._emitOptionsWarning&&(r.a.warn("[Tracing] You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace."),r.a.warn("[Tracing] We added a reasonable default for you: "+
|
|
65
|
+
if(t.xhr.__sentry_xhr_span_id__=c.spanId,n[t.xhr.__sentry_xhr_span_id__]=c,t.xhr.setRequestHeader)try{t.xhr.setRequestHeader("sentry-trace",c.toTraceparent())}catch(t){}}}}}(t,p,l)},type:"xhr"})}var M=Object(s.f)(),N=Object(a.a)({idleTimeout:c.a,markBackgroundTransactions:!0,maxTransactionDuration:600,routingInstrumentation:function(t,e,n){if(void 0===e&&(e=!0),void 0===n&&(n=!0),M&&M.location){var i,a=M.location.href
|
|
66
|
+
e&&(i=t({name:M.location.pathname,op:"pageload"})),n&&Object(k.a)({callback:function(e){var n=e.to,s=e.from
|
|
67
|
+
void 0===s&&a&&-1!==a.indexOf(n)?a=void 0:s!==n&&(a=void 0,i&&(r.a.log("[Tracing] Finishing current transaction with op: "+i.op),i.finish()),i=t({name:M.location.pathname,op:"navigation"}))},type:"history"})}else r.a.warn("Could not initialize routing instrumentation due to invalid location")},startTransactionOnLocationChange:!0,startTransactionOnPageLoad:!0},R),D=function(){function t(e){this.name=t.id,this._emitOptionsWarning=!1
|
|
68
|
+
var n=R.tracingOrigins
|
|
69
|
+
e&&e.tracingOrigins&&Array.isArray(e.tracingOrigins)&&0!==e.tracingOrigins.length?n=e.tracingOrigins:this._emitOptionsWarning=!0,this.options=Object(a.a)(Object(a.a)(Object(a.a)({},N),e),{tracingOrigins:n}),this._metrics=new S(Object(a.a)(Object(a.a)({},j),this.options._metricOptions))}return t.prototype.setupOnce=function(t,e){var n=this
|
|
70
|
+
this._getCurrentHub=e,this._emitOptionsWarning&&(r.a.warn("[Tracing] You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace."),r.a.warn("[Tracing] We added a reasonable default for you: "+R.tracingOrigins))
|
|
71
71
|
var i=this.options,a=i.routingInstrumentation,s=i.startTransactionOnLocationChange,o=i.startTransactionOnPageLoad,c=i.markBackgroundTransactions,l=i.traceFetch,m=i.traceXHR,h=i.tracingOrigins,f=i.shouldCreateSpanForRequest
|
|
72
72
|
a((function(t){return n._createRouteTransaction(t)}),o,s),c&&(p&&p.document?p.document.addEventListener("visibilitychange",(function(){var t=Object(d.c)()
|
|
73
|
-
p.document.hidden&&t&&(r.a.log("[Tracing] Transaction: "+u.a.Cancelled+" -> since tab moved to the background, op: "+t.op),t.status||t.setStatus(u.a.Cancelled),t.setTag("visibilitychange","document.hidden"),t.finish())})):r.a.warn("[Tracing] Could not set up background tab detection due to lack of global document")),
|
|
74
|
-
if(this._getCurrentHub){var n=this.options,i=n.beforeNavigate,c=n.idleTimeout,p=n.maxTransactionDuration,l="pageload"===t.op?function(){var t,e=("sentry-trace",(t=document.querySelector("meta[name=sentry-trace]"))?t.getAttribute("content"):null)
|
|
73
|
+
p.document.hidden&&t&&(r.a.log("[Tracing] Transaction: "+u.a.Cancelled+" -> since tab moved to the background, op: "+t.op),t.status||t.setStatus(u.a.Cancelled),t.setTag("visibilitychange","document.hidden"),t.finish())})):r.a.warn("[Tracing] Could not set up background tab detection due to lack of global document")),A({traceFetch:l,traceXHR:m,tracingOrigins:h,shouldCreateSpanForRequest:f})},t.prototype._createRouteTransaction=function(t){var e=this
|
|
74
|
+
if(this._getCurrentHub){var n=this.options,i=n.beforeNavigate,c=n.idleTimeout,p=n.maxTransactionDuration,l="pageload"===t.op?function(){var t,e=("sentry-trace",(t=Object(s.f)().document.querySelector("meta[name=sentry-trace]"))?t.getAttribute("content"):null)
|
|
75
75
|
if(e)return Object(d.b)(e)}():void 0,m=Object(a.a)(Object(a.a)(Object(a.a)({},t),l),{trimEnd:!0}),h="function"==typeof i?i(m):m,f=void 0===h?Object(a.a)(Object(a.a)({},m),{sampled:!1}):h
|
|
76
76
|
!1===f.sampled&&r.a.log("[Tracing] Will not send "+f.op+" transaction because of beforeNavigate."),r.a.log("[Tracing] Starting "+f.op+" transaction on scope")
|
|
77
77
|
var v=this._getCurrentHub(),g=Object(s.f)().location,_=Object(o.b)(v,f,c,!0,{location:g})
|
|
78
78
|
return _.registerBeforeFinishCallback((function(t,n){e._metrics.addPerformanceEntries(t),function(t,e,n){var i=n-e.startTimestamp
|
|
79
|
-
n&&(i>t||i<0)&&(e.setStatus(u.a.DeadlineExceeded),e.setTag("maxTransactionDurationExceeded","true"))}(Object(d.f)(p),t,n)})),_}r.a.warn("[Tracing] Did not create "+t.op+" transaction because _getCurrentHub is invalid.")},t.id="BrowserTracing",t}(),
|
|
79
|
+
n&&(i>t||i<0)&&(e.setStatus(u.a.DeadlineExceeded),e.setTag("maxTransactionDurationExceeded","true"))}(Object(d.f)(p),t,n)})),_}r.a.warn("[Tracing] Did not create "+t.op+" transaction because _getCurrentHub is invalid.")},t.id="BrowserTracing",t}(),q=function(){function t(e){void 0===e&&(e={}),this.name=t.id,this._router=e.router||e.app,this._methods=(Array.isArray(e.methods)?e.methods:[]).concat("use")}return t.prototype.setupOnce=function(){this._router?function(t,e){void 0===e&&(e=[]),e.forEach((function(e){return function(t,e){var n=t[e]
|
|
80
80
|
return t[e]=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i]
|
|
81
|
-
return n.call.apply(n,Object(a.e)([this],
|
|
82
|
-
function
|
|
81
|
+
return n.call.apply(n,Object(a.e)([this],F(t,e)))},t}(t,e)}))}(this._router,this._methods):r.a.error("ExpressIntegration is missing an Express instance")},t.id="Express",t}()
|
|
82
|
+
function P(t,e){var n=t.length
|
|
83
83
|
switch(n){case 2:return function(n,i){var a=i.__sentry_transaction
|
|
84
84
|
if(a){var r=a.startChild({description:t.name,op:"middleware."+e})
|
|
85
85
|
i.once("finish",(function(){r.finish()}))}return t.call(this,n,i)}
|
|
@@ -89,41 +89,41 @@ null===(t=o)||void 0===t||t.finish(),r.call.apply(r,Object(a.e)([this],e))}))}
|
|
|
89
89
|
case 4:return function(n,i,r,s){var o,c=null===(o=r.__sentry_transaction)||void 0===o?void 0:o.startChild({description:t.name,op:"middleware."+e})
|
|
90
90
|
t.call(this,n,i,r,(function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
|
|
91
91
|
null===(t=c)||void 0===t||t.finish(),s.call.apply(s,Object(a.e)([this],e))}))}
|
|
92
|
-
default:throw new Error("Express middleware takes 2-4 arguments. Got: "+n)}}function
|
|
92
|
+
default:throw new Error("Express middleware takes 2-4 arguments. Got: "+n)}}function F(t,e){return t.map((function(t){return"function"==typeof t?P(t,e):Array.isArray(t)?t.map((function(t){return"function"==typeof t?P(t,e):t})):t}))}var H=n(7),L=function(){function t(e){void 0===e&&(e={}),this.name=t.id,this._usePgNative=!!e.usePgNative}return t.prototype.setupOnce=function(t,e){var n,i=Object(l.c)("pg")
|
|
93
93
|
if(i)if(!this._usePgNative||(null===(n=i.native)||void 0===n?void 0:n.Client)){var a=(this._usePgNative?i.native:i).Client
|
|
94
|
-
Object(
|
|
94
|
+
Object(H.c)(a.prototype,"query",(function(t){return function(n,i,a){var r,s,o,c=null===(s=null===(r=e().getScope())||void 0===r?void 0:r.getSpan())||void 0===s?void 0:s.startChild({description:"string"==typeof n?n:n.text,op:"db"})
|
|
95
95
|
if("function"==typeof a)return t.call(this,n,i,(function(t,e){var n
|
|
96
96
|
null===(n=c)||void 0===n||n.finish(),a(t,e)}))
|
|
97
97
|
if("function"==typeof i)return t.call(this,n,(function(t,e){var n
|
|
98
98
|
null===(n=c)||void 0===n||n.finish(),i(t,e)}))
|
|
99
99
|
var u=void 0!==i?t.call(this,n,i):t.call(this,n)
|
|
100
|
-
return Object(
|
|
100
|
+
return Object(w.m)(u)?u.then((function(t){var e
|
|
101
101
|
return null===(e=c)||void 0===e||e.finish(),t})):(null===(o=c)||void 0===o||o.finish(),u)}}))}else r.a.error("Postgres Integration was unable to access 'pg-native' bindings.")
|
|
102
|
-
else r.a.error("Postgres Integration was unable to require `pg` package.")},t.id="Postgres",t}(),
|
|
103
|
-
n?Object(
|
|
102
|
+
else r.a.error("Postgres Integration was unable to require `pg` package.")},t.id="Postgres",t}(),z=function(){function t(){this.name=t.id}return t.prototype.setupOnce=function(t,e){var n=Object(l.c)("mysql/lib/Connection.js")
|
|
103
|
+
n?Object(H.c)(n,"createQuery",(function(t){return function(n,i,a){var r,s,o=null===(s=null===(r=e().getScope())||void 0===r?void 0:r.getSpan())||void 0===s?void 0:s.startChild({description:"string"==typeof n?n:n.sql,op:"db"})
|
|
104
104
|
return"function"==typeof a?t.call(this,n,i,(function(t,e,n){var i
|
|
105
105
|
null===(i=o)||void 0===i||i.finish(),a(t,e,n)})):"function"==typeof i?t.call(this,n,(function(t,e,n){var a
|
|
106
|
-
null===(a=o)||void 0===a||a.finish(),i(t,e,n)})):t.call(this,n,i,a)}})):r.a.error("Mysql Integration was unable to require `mysql` package.")},t.id="Mysql",t}(),
|
|
106
|
+
null===(a=o)||void 0===a||a.finish(),i(t,e,n)})):t.call(this,n,i,a)}})):r.a.error("Mysql Integration was unable to require `mysql` package.")},t.id="Mysql",t}(),B=["aggregate","bulkWrite","countDocuments","createIndex","createIndexes","deleteMany","deleteOne","distinct","drop","dropIndex","dropIndexes","estimatedDocumentCount","find","findOne","findOneAndDelete","findOneAndReplace","findOneAndUpdate","indexes","indexExists","indexInformation","initializeOrderedBulkOp","insertMany","insertOne","isCapped","mapReduce","options","parallelCollectionScan","rename","replaceOne","stats","updateMany","updateOne"],U={bulkWrite:["operations"],countDocuments:["query"],createIndex:["fieldOrSpec"],createIndexes:["indexSpecs"],deleteMany:["filter"],deleteOne:["filter"],distinct:["key","query"],dropIndex:["indexName"],find:["query"],findOne:["query"],findOneAndDelete:["filter"],findOneAndReplace:["filter","replacement"],findOneAndUpdate:["filter","update"],indexExists:["indexes"],insertMany:["docs"],insertOne:["doc"],mapReduce:["map","reduce"],rename:["newName"],replaceOne:["filter","doc"],updateMany:["filter","update"],updateOne:["filter","update"]},Y=function(){function t(e){void 0===e&&(e={}),this.name=t.id,this._operations=Array.isArray(e.operations)?e.operations:B,this._describeOperations=!("describeOperations"in e)||e.describeOperations,this._useMongoose=!!e.useMongoose}return t.prototype.setupOnce=function(t,e){var n=this._useMongoose?"mongoose":"mongodb",i=Object(l.c)(n)
|
|
107
107
|
i?this._instrumentOperations(i.Collection,this._operations,e):r.a.error("Mongo Integration was unable to require `"+n+"` package.")},t.prototype._instrumentOperations=function(t,e,n){var i=this
|
|
108
108
|
e.forEach((function(e){return i._patchOperation(t,e,n)}))},t.prototype._patchOperation=function(t,e,n){if(e in t.prototype){var i=this._getSpanContextFromOperationArguments.bind(this)
|
|
109
|
-
Object(
|
|
109
|
+
Object(H.c)(t.prototype,e,(function(t){return function(){for(var r,s,o,c,u=[],d=0;d<arguments.length;d++)u[d]=arguments[d]
|
|
110
110
|
var p=u[u.length-1],l=n().getScope(),m=null===(r=l)||void 0===r?void 0:r.getSpan()
|
|
111
111
|
if("function"!=typeof p||"mapReduce"===e&&2===u.length){var h=null===(s=m)||void 0===s?void 0:s.startChild(i(this,e,u)),f=t.call.apply(t,Object(a.e)([this],u))
|
|
112
|
-
return Object(
|
|
112
|
+
return Object(w.m)(f)?f.then((function(t){var e
|
|
113
113
|
return null===(e=h)||void 0===e||e.finish(),t})):(null===(o=h)||void 0===o||o.finish(),f)}var v=null===(c=m)||void 0===c?void 0:c.startChild(i(this,e,u.slice(0,-1)))
|
|
114
114
|
return t.call.apply(t,Object(a.e)([this],u.slice(0,-1),[function(t,e){var n
|
|
115
|
-
null===(n=v)||void 0===n||n.finish(),p(t,e)}]))}}))}},t.prototype._getSpanContextFromOperationArguments=function(t,e,n){var i={collectionName:t.collectionName,dbName:t.dbName,namespace:t.namespace},r={op:"db",description:e,data:i},s=
|
|
115
|
+
null===(n=v)||void 0===n||n.finish(),p(t,e)}]))}}))}},t.prototype._getSpanContextFromOperationArguments=function(t,e,n){var i={collectionName:t.collectionName,dbName:t.dbName,namespace:t.namespace},r={op:"db",description:e,data:i},s=U[e],o=Array.isArray(this._describeOperations)?this._describeOperations.includes(e):this._describeOperations
|
|
116
116
|
if(!s||!o)return r
|
|
117
117
|
try{if("mapReduce"===e){var c=Object(a.c)(n,2),u=c[0],d=c[1]
|
|
118
|
-
i[s[0]]="string"==typeof u?u:u.name||"<anonymous>",i[s[1]]="string"==typeof d?d:d.name||"<anonymous>"}else for(var p=0;p<s.length;p++)i[s[p]]=JSON.stringify(n[p])}catch(t){}return r},t.id="Mongo",t}(),
|
|
119
|
-
Object(o.a)()},
|
|
118
|
+
i[s[0]]="string"==typeof u?u:u.name||"<anonymous>",i[s[1]]="string"==typeof d?d:d.name||"<anonymous>"}else for(var p=0;p<s.length;p++)i[s[p]]=JSON.stringify(n[p])}catch(t){}return r},t.id="Mongo",t}(),W=n(446),J=n(447),G=Object(a.a)(Object(a.a)({},i),{BrowserTracing:D})
|
|
119
|
+
Object(o.a)()},442:function(t,e,n){"use strict"
|
|
120
120
|
n.d(e,"a",(function(){return a})),n.d(e,"d",(function(){return r})),n.d(e,"b",(function(){return s})),n.d(e,"c",(function(){return o})),n.d(e,"e",(function(){return c})),n.d(e,"f",(function(){return u}))
|
|
121
|
-
var i=n(
|
|
121
|
+
var i=n(441),a=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$")
|
|
122
122
|
function r(t){var e
|
|
123
123
|
return void 0===t&&(t=null===(e=Object(i.b)().getClient())||void 0===e?void 0:e.getOptions()),!!t&&("tracesSampleRate"in t||"tracesSampler"in t)}function s(t){var e=t.match(a)
|
|
124
124
|
if(e){var n=void 0
|
|
125
125
|
return"1"===e[3]?n=!0:"0"===e[3]&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}}function o(t){var e,n
|
|
126
|
-
return void 0===t&&(t=Object(i.b)()),null===(n=null===(e=t)||void 0===e?void 0:e.getScope())||void 0===n?void 0:n.getTransaction()}function c(t){return t/1e3}function u(t){return 1e3*t}},
|
|
126
|
+
return void 0===t&&(t=Object(i.b)()),null===(n=null===(e=t)||void 0===e?void 0:e.getScope())||void 0===n?void 0:n.getTransaction()}function c(t){return t/1e3}function u(t){return 1e3*t}},443:function(t,e,n){"use strict"
|
|
127
127
|
var i
|
|
128
128
|
n.d(e,"a",(function(){return i})),function(t){t.Ok="ok",t.DeadlineExceeded="deadline_exceeded",t.Unauthenticated="unauthenticated",t.PermissionDenied="permission_denied",t.NotFound="not_found",t.ResourceExhausted="resource_exhausted",t.InvalidArgument="invalid_argument",t.Unimplemented="unimplemented",t.Unavailable="unavailable",t.InternalError="internal_error",t.UnknownError="unknown_error",t.Cancelled="cancelled",t.AlreadyExists="already_exists",t.FailedPrecondition="failed_precondition",t.Aborted="aborted",t.OutOfRange="out_of_range",t.DataLoss="data_loss"}(i||(i={})),function(t){t.fromHttpCode=function(e){if(e<400)return t.Ok
|
|
129
129
|
if(e>=400&&e<500)switch(e){case 401:return t.Unauthenticated
|
|
@@ -135,8 +135,8 @@ case 429:return t.ResourceExhausted
|
|
|
135
135
|
default:return t.InvalidArgument}if(e>=500&&e<600)switch(e){case 501:return t.Unimplemented
|
|
136
136
|
case 503:return t.Unavailable
|
|
137
137
|
case 504:return t.DeadlineExceeded
|
|
138
|
-
default:return t.InternalError}return t.UnknownError}}(i||(i={}))},
|
|
139
|
-
var i=n(0),a=n(
|
|
138
|
+
default:return t.InternalError}return t.UnknownError}}(i||(i={}))},444:function(t,e,n){"use strict";(function(t){n.d(e,"b",(function(){return f})),n.d(e,"a",(function(){return v}))
|
|
139
|
+
var i=n(0),a=n(441),r=n(57),s=n(11),o=n(10),c=n(449),u=n(445),d=n(447),p=n(442)
|
|
140
140
|
function l(){var t=this.getScope()
|
|
141
141
|
if(t){var e=t.getSpan()
|
|
142
142
|
if(e)return{"sentry-trace":e.toTraceparent()}}return{}}function m(t,e,n){return Object(p.d)()?void 0!==t.sampled?(t.setMetadata({transactionSampling:{method:r.a.Explicit}}),t):("function"==typeof e.tracesSampler?(i=e.tracesSampler(n),t.setMetadata({transactionSampling:{method:r.a.Sampler,rate:Number(i)}})):void 0!==n.parentSampled?(i=n.parentSampled,t.setMetadata({transactionSampling:{method:r.a.Inheritance}})):(i=e.tracesSampleRate,t.setMetadata({transactionSampling:{method:r.a.Rate,rate:Number(i)}})),function(t){return isNaN(t)||"number"!=typeof t&&"boolean"!=typeof t?(s.a.warn("[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got "+JSON.stringify(t)+" of type "+JSON.stringify(typeof t)+"."),!1):!(t<0||t>1)||(s.a.warn("[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got "+t+"."),!1)}(i)?i?(t.sampled=Math.random()<i,t.sampled?(s.a.log("[Tracing] starting "+t.op+" transaction - "+t.name),t):(s.a.log("[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = "+Number(i)+")"),t)):(s.a.log("[Tracing] Discarding transaction because "+("function"==typeof e.tracesSampler?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0")),t.sampled=!1,t):(s.a.warn("[Tracing] Discarding transaction because of invalid sample rate."),t.sampled=!1,t)):(t.sampled=!1,t)
|
|
@@ -144,14 +144,14 @@ var i}function h(t,e){var n,a,r=(null===(n=this.getClient())||void 0===n?void 0:
|
|
|
144
144
|
return(s=m(s,r,Object(i.a)({parentSampled:t.parentSampled,transactionContext:t},e))).sampled&&s.initSpanRecorder(null===(a=r._experiments)||void 0===a?void 0:a.maxSpans),s}function f(t,e,n,a,r){var s,o,c=(null===(s=t.getClient())||void 0===s?void 0:s.getOptions())||{},d=new u.b(e,t,n,a)
|
|
145
145
|
return(d=m(d,c,Object(i.a)({parentSampled:e.parentSampled,transactionContext:e},r))).sampled&&d.initSpanRecorder(null===(o=c._experiments)||void 0===o?void 0:o.maxSpans),d}function v(){var e;(e=Object(a.d)()).__SENTRY__&&(e.__SENTRY__.extensions=e.__SENTRY__.extensions||{},e.__SENTRY__.extensions.startTransaction||(e.__SENTRY__.extensions.startTransaction=h),e.__SENTRY__.extensions.traceHeaders||(e.__SENTRY__.extensions.traceHeaders=l)),Object(o.b)()&&function(){var e=Object(a.d)()
|
|
146
146
|
if(e.__SENTRY__){var n={mongodb:function(){return new(Object(o.a)(t,"./integrations/mongo").Mongo)},mongoose:function(){return new(Object(o.a)(t,"./integrations/mongo").Mongo)({mongoose:!0})},mysql:function(){return new(Object(o.a)(t,"./integrations/mysql").Mysql)},pg:function(){return new(Object(o.a)(t,"./integrations/postgres").Postgres)}},r=Object.keys(n).filter((function(t){return!!Object(o.c)(t)})).map((function(t){try{return n[t]()}catch(t){return}})).filter((function(t){return t}))
|
|
147
|
-
r.length>0&&(e.__SENTRY__.integrations=Object(i.e)(e.__SENTRY__.integrations||[],r))}}(),Object(c.a)()}}).call(this,n(31)(t))},
|
|
147
|
+
r.length>0&&(e.__SENTRY__.integrations=Object(i.e)(e.__SENTRY__.integrations||[],r))}}(),Object(c.a)()}}).call(this,n(31)(t))},445:function(t,e,n){"use strict"
|
|
148
148
|
n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return p}))
|
|
149
|
-
var i=n(0),a=n(50),r=n(11),s=n(
|
|
149
|
+
var i=n(0),a=n(50),r=n(11),s=n(446),o=n(443),c=n(447),u=1e3,d=function(t){function e(e,n,i,a){void 0===i&&(i="")
|
|
150
150
|
var r=t.call(this,a)||this
|
|
151
151
|
return r._pushActivity=e,r._popActivity=n,r.transactionSpanId=i,r}return Object(i.b)(e,t),e.prototype.add=function(e){var n=this
|
|
152
152
|
e.spanId!==this.transactionSpanId&&(e.finish=function(t){e.endTimestamp="number"==typeof t?t:Object(a.e)(),n._popActivity(e.spanId)},void 0===e.endTimestamp&&this._pushActivity(e.spanId)),t.prototype.add.call(this,e)},e}(s.b),p=function(t){function e(e,n,i,a){void 0===i&&(i=u),void 0===a&&(a=!1)
|
|
153
153
|
var s=t.call(this,e,n)||this
|
|
154
|
-
return s._idleHub=n,s._idleTimeout=i,s._onScope=a,s.activities={},s.
|
|
154
|
+
return s._idleHub=n,s._idleTimeout=i,s._onScope=a,s.activities={},s._heartbeatCounter=0,s._finished=!1,s._beforeFinishCallbacks=[],n&&a&&(l(n),r.a.log("Setting idle transaction on scope. Span ID: "+s.spanId),n.configureScope((function(t){return t.setSpan(s)}))),s._initTimeout=setTimeout((function(){s._finished||s.finish()}),s._idleTimeout),s}return Object(i.b)(e,t),e.prototype.finish=function(e){var n,s,c=this
|
|
155
155
|
if(void 0===e&&(e=Object(a.e)()),this._finished=!0,this.activities={},this.spanRecorder){r.a.log("[Tracing] finishing IdleTransaction",new Date(1e3*e).toISOString(),this.op)
|
|
156
156
|
try{for(var u=Object(i.f)(this._beforeFinishCallbacks),d=u.next();!d.done;d=u.next())(0,d.value)(this,e)}catch(t){n={error:t}}finally{try{d&&!d.done&&(s=u.return)&&s.call(u)}finally{if(n)throw n.error}}this.spanRecorder.spans=this.spanRecorder.spans.filter((function(t){if(t.spanId===c.spanId)return!0
|
|
157
157
|
t.endTimestamp||(t.endTimestamp=e,t.setStatus(o.a.Cancelled),r.a.log("[Tracing] cancelling span since transaction ended early",JSON.stringify(t,void 0,2)))
|
|
@@ -160,13 +160,13 @@ return n||r.a.log("[Tracing] discarding Span since it happened after Transaction
|
|
|
160
160
|
return this._onScope&&l(this._idleHub),t.prototype.finish.call(this,e)},e.prototype.registerBeforeFinishCallback=function(t){this._beforeFinishCallbacks.push(t)},e.prototype.initSpanRecorder=function(t){var e=this
|
|
161
161
|
this.spanRecorder||(this.spanRecorder=new d((function(t){e._finished||e._pushActivity(t)}),(function(t){e._finished||e._popActivity(t)}),this.spanId,t),r.a.log("Starting heartbeat"),this._pingHeartbeat()),this.spanRecorder.add(this)},e.prototype._pushActivity=function(t){this._initTimeout&&(clearTimeout(this._initTimeout),this._initTimeout=void 0),r.a.log("[Tracing] pushActivity: "+t),this.activities[t]=!0,r.a.log("[Tracing] new activities count",Object.keys(this.activities).length)},e.prototype._popActivity=function(t){var e=this
|
|
162
162
|
if(this.activities[t]&&(r.a.log("[Tracing] popActivity "+t),delete this.activities[t],r.a.log("[Tracing] new activities count",Object.keys(this.activities).length)),0===Object.keys(this.activities).length){var n=this._idleTimeout,i=Object(a.e)()+n/1e3
|
|
163
|
-
setTimeout((function(){e._finished||e.finish(i)}),n)}},e.prototype._beat=function(){if(
|
|
164
|
-
|
|
165
|
-
r.a.log("pinging Heartbeat -> current counter: "+this._heartbeatCounter),
|
|
163
|
+
setTimeout((function(){e._finished||e.finish(i)}),n)}},e.prototype._beat=function(){if(!this._finished){var t=Object.keys(this.activities).join("")
|
|
164
|
+
t===this._prevHeartbeatString?this._heartbeatCounter+=1:this._heartbeatCounter=1,this._prevHeartbeatString=t,this._heartbeatCounter>=3?(r.a.log("[Tracing] Transaction finished because of no change for 3 heart beats"),this.setStatus(o.a.DeadlineExceeded),this.setTag("heartbeat","failed"),this.finish()):this._pingHeartbeat()}},e.prototype._pingHeartbeat=function(){var t=this
|
|
165
|
+
r.a.log("pinging Heartbeat -> current counter: "+this._heartbeatCounter),setTimeout((function(){t._beat()}),5e3)},e}(c.a)
|
|
166
166
|
function l(t){if(t){var e=t.getScope()
|
|
167
|
-
e&&e.getTransaction()&&e.setSpan(void 0)}}},
|
|
167
|
+
e&&e.getTransaction()&&e.setSpan(void 0)}}},446:function(t,e,n){"use strict"
|
|
168
168
|
n.d(e,"b",(function(){return c})),n.d(e,"a",(function(){return u}))
|
|
169
|
-
var i=n(0),a=n(5),r=n(50),s=n(
|
|
169
|
+
var i=n(0),a=n(5),r=n(50),s=n(7),o=n(443),c=function(){function t(t){void 0===t&&(t=1e3),this.spans=[],this._maxlen=t}return t.prototype.add=function(t){this.spans.length>this._maxlen?t.spanRecorder=void 0:this.spans.push(t)},t}(),u=function(){function t(t){if(this.traceId=Object(a.l)(),this.spanId=Object(a.l)().substring(16),this.startTimestamp=Object(r.e)(),this.tags={},this.data={},!t)return this
|
|
170
170
|
t.traceId&&(this.traceId=t.traceId),t.spanId&&(this.spanId=t.spanId),t.parentSpanId&&(this.parentSpanId=t.parentSpanId),"sampled"in t&&(this.sampled=t.sampled),t.op&&(this.op=t.op),t.description&&(this.description=t.description),t.data&&(this.data=t.data),t.tags&&(this.tags=t.tags),t.status&&(this.status=t.status),t.startTimestamp&&(this.startTimestamp=t.startTimestamp),t.endTimestamp&&(this.endTimestamp=t.endTimestamp)}return t.prototype.child=function(t){return this.startChild(t)},t.prototype.startChild=function(e){var n=new t(Object(i.a)(Object(i.a)({},e),{parentSpanId:this.spanId,sampled:this.sampled,traceId:this.traceId}))
|
|
171
171
|
return n.spanRecorder=this.spanRecorder,n.spanRecorder&&n.spanRecorder.add(n),n.transaction=this.transaction,n},t.prototype.setTag=function(t,e){var n
|
|
172
172
|
return this.tags=Object(i.a)(Object(i.a)({},this.tags),((n={})[t]=e,n)),this},t.prototype.setData=function(t,e){var n
|
|
@@ -174,19 +174,20 @@ return this.data=Object(i.a)(Object(i.a)({},this.data),((n={})[t]=e,n)),this},t.
|
|
|
174
174
|
var e=o.a.fromHttpCode(t)
|
|
175
175
|
return e!==o.a.UnknownError&&this.setStatus(e),this},t.prototype.isSuccess=function(){return this.status===o.a.Ok},t.prototype.finish=function(t){this.endTimestamp="number"==typeof t?t:Object(r.e)()},t.prototype.toTraceparent=function(){var t=""
|
|
176
176
|
return void 0!==this.sampled&&(t=this.sampled?"-1":"-0"),this.traceId+"-"+this.spanId+t},t.prototype.toContext=function(){return Object(s.a)({data:this.data,description:this.description,endTimestamp:this.endTimestamp,op:this.op,parentSpanId:this.parentSpanId,sampled:this.sampled,spanId:this.spanId,startTimestamp:this.startTimestamp,status:this.status,tags:this.tags,traceId:this.traceId})},t.prototype.updateWithContext=function(t){var e,n,i,a,r
|
|
177
|
-
return this.data=null!=(e=t.data)?e:{},this.description=t.description,this.endTimestamp=t.endTimestamp,this.op=t.op,this.parentSpanId=t.parentSpanId,this.sampled=t.sampled,this.spanId=null!=(n=t.spanId)?n:this.spanId,this.startTimestamp=null!=(i=t.startTimestamp)?i:this.startTimestamp,this.status=t.status,this.tags=null!=(a=t.tags)?a:{},this.traceId=null!=(r=t.traceId)?r:this.traceId,this},t.prototype.getTraceContext=function(){return Object(s.a)({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,trace_id:this.traceId})},t.prototype.toJSON=function(){return Object(s.a)({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,start_timestamp:this.startTimestamp,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,timestamp:this.endTimestamp,trace_id:this.traceId})},t}()},
|
|
178
|
-
n.d(e,"a",(function(){return
|
|
179
|
-
var i=n(0),a=n(
|
|
180
|
-
return i._measurements={},i._hub=Object(a.b)(),Object(
|
|
181
|
-
if(void 0===this.endTimestamp){if(this.name||(
|
|
182
|
-
this.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return Object(
|
|
186
|
-
return
|
|
177
|
+
return this.data=null!=(e=t.data)?e:{},this.description=t.description,this.endTimestamp=t.endTimestamp,this.op=t.op,this.parentSpanId=t.parentSpanId,this.sampled=t.sampled,this.spanId=null!=(n=t.spanId)?n:this.spanId,this.startTimestamp=null!=(i=t.startTimestamp)?i:this.startTimestamp,this.status=t.status,this.tags=null!=(a=t.tags)?a:{},this.traceId=null!=(r=t.traceId)?r:this.traceId,this},t.prototype.getTraceContext=function(){return Object(s.a)({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,trace_id:this.traceId})},t.prototype.toJSON=function(){return Object(s.a)({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,start_timestamp:this.startTimestamp,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,timestamp:this.endTimestamp,trace_id:this.traceId})},t}()},447:function(t,e,n){"use strict"
|
|
178
|
+
n.d(e,"a",(function(){return d}))
|
|
179
|
+
var i=n(0),a=n(441),r=n(53),s=n(4),o=n(11),c=n(7),u=n(446),d=function(t){function e(e,n){var i=t.call(this,e)||this
|
|
180
|
+
return i._measurements={},i._hub=Object(a.b)(),Object(s.g)(n,a.a)&&(i._hub=n),i.name=e.name||"",i.metadata=e.metadata||{},i._trimEnd=e.trimEnd,i.transaction=i,i}return Object(i.b)(e,t),e.prototype.setName=function(t){this.name=t},e.prototype.initSpanRecorder=function(t){void 0===t&&(t=1e3),this.spanRecorder||(this.spanRecorder=new u.b(t)),this.spanRecorder.add(this)},e.prototype.setMeasurements=function(t){this._measurements=Object(i.a)({},t)},e.prototype.setMetadata=function(t){this.metadata=Object(i.a)(Object(i.a)({},this.metadata),t)},e.prototype.finish=function(e){var n,i,a,s=this
|
|
181
|
+
if(void 0===this.endTimestamp){if(this.name||(o.a.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this.name="<unlabeled transaction>"),t.prototype.finish.call(this,e),!0!==this.sampled)return o.a.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."),void(null===(a=null===(n=this._hub.getClient())||void 0===n?void 0:(i=n.getTransport()).recordLostEvent)||void 0===a||a.call(i,r.a.SampleRate,"transaction"))
|
|
182
|
+
var c=this.spanRecorder?this.spanRecorder.spans.filter((function(t){return t!==s&&t.endTimestamp})):[]
|
|
183
|
+
this._trimEnd&&c.length>0&&(this.endTimestamp=c.reduce((function(t,e){return t.endTimestamp&&e.endTimestamp?t.endTimestamp>e.endTimestamp?t:e:t})).endTimestamp)
|
|
184
|
+
var u={contexts:{trace:this.getTraceContext()},spans:c,start_timestamp:this.startTimestamp,tags:this.tags,timestamp:this.endTimestamp,transaction:this.name,type:"transaction",debug_meta:this.metadata}
|
|
185
|
+
return Object.keys(this._measurements).length>0&&(o.a.log("[Measurements] Adding measurements to transaction",JSON.stringify(this._measurements,void 0,2)),u.measurements=this._measurements),o.a.log("[Tracing] Finishing "+this.op+" transaction: "+this.name+"."),this._hub.captureEvent(u)}},e.prototype.toContext=function(){var e=t.prototype.toContext.call(this)
|
|
186
|
+
return Object(c.a)(Object(i.a)(Object(i.a)({},e),{name:this.name,trimEnd:this._trimEnd}))},e.prototype.updateWithContext=function(e){var n
|
|
187
|
+
return t.prototype.updateWithContext.call(this,e),this.name=null!=(n=e.name)?n:"",this._trimEnd=e.trimEnd,this},e}(u.a)},449:function(t,e,n){"use strict"
|
|
187
188
|
n.d(e,"a",(function(){return o}))
|
|
188
|
-
var i=n(
|
|
189
|
+
var i=n(56),a=n(11),r=n(443),s=n(442)
|
|
189
190
|
function o(){Object(i.a)({callback:c,type:"error"}),Object(i.a)({callback:c,type:"unhandledrejection"})}function c(){var t=Object(s.c)()
|
|
190
191
|
t&&(a.a.log("[Tracing] Transaction: "+r.a.InternalError+" -> Global error occured"),t.setStatus(r.a.InternalError))}}}])
|
|
191
192
|
|
|
192
|
-
//# sourceMappingURL=chunk.3.
|
|
193
|
+
//# sourceMappingURL=chunk.3.b80d3e1e6b8556aaff3c.map
|