ghost 4.22.2 → 4.24.0

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.
Files changed (118) hide show
  1. package/.c8rc.json +24 -0
  2. package/Gruntfile.js +0 -1
  3. package/content/public/README.md +3 -0
  4. package/core/app.js +12 -1
  5. package/core/boot.js +45 -26
  6. package/core/bridge.js +10 -10
  7. package/core/built/assets/{chunk.3.324fd0cc598c73650219.js → chunk.3.8f95b516d88ff4eec64c.js} +18 -18
  8. package/core/built/assets/{ghost-dark-39fb496d051565531062d7e047d1c0b1.css → ghost-dark-e7b57ab951512c5719aee89b16b9a448.css} +1 -1
  9. package/core/built/assets/{ghost.min-4207edfc1ae0a3f9f6505ca00d20b0c0.css → ghost.min-7f3603dbeb5ebf0ec09e207ae82fb4e3.css} +1 -1
  10. package/core/built/assets/{ghost.min-7da921f6c6cac3fe10da1ba104575440.js → ghost.min-d5595f9c71ebc534ccf9ac78483d357c.js} +138 -105
  11. package/core/built/assets/icons/powered-by-tenor.svg +35 -0
  12. package/core/built/assets/icons/tenor.svg +7 -0
  13. package/core/built/assets/{vendor.min-413f887176a041e6dbf88214ca9a7481.js → vendor.min-1a84ac3ef74edf31c6e86810b45221cc.js} +2964 -2434
  14. package/core/frontend/apps/amp/lib/views/amp.hbs +104 -0
  15. package/core/frontend/apps/private-blogging/lib/router.js +1 -1
  16. package/core/frontend/services/card-assets/index.js +0 -12
  17. package/core/frontend/services/card-assets/service.js +35 -26
  18. package/core/frontend/services/routing/CollectionRouter.js +4 -5
  19. package/core/frontend/services/routing/EmailRouter.js +1 -1
  20. package/core/frontend/services/routing/ParentRouter.js +0 -8
  21. package/core/frontend/services/routing/PreviewRouter.js +1 -1
  22. package/core/frontend/services/routing/StaticPagesRouter.js +1 -1
  23. package/core/frontend/services/routing/StaticRoutesRouter.js +4 -4
  24. package/core/frontend/services/routing/TaxonomyRouter.js +3 -3
  25. package/core/frontend/services/routing/{middlewares → middleware}/index.js +0 -0
  26. package/core/frontend/services/routing/{middlewares → middleware}/page-param.js +0 -0
  27. package/core/frontend/services/routing/router-manager.js +7 -2
  28. package/core/frontend/services/rss/generate-feed.js +2 -1
  29. package/core/frontend/src/cards/css/bookmark.css +72 -47
  30. package/core/frontend/src/cards/css/callout.css +41 -4
  31. package/core/frontend/src/cards/css/gallery.css +15 -10
  32. package/core/frontend/src/cards/css/nft.css +20 -11
  33. package/core/frontend/src/cards/css/toggle.css +58 -0
  34. package/core/frontend/src/cards/js/toggle.js +16 -0
  35. package/core/frontend/web/middleware/serve-public-file.js +39 -16
  36. package/core/frontend/web/site.js +11 -14
  37. package/core/server/api/canary/authentication.js +1 -1
  38. package/core/server/api/canary/utils/serializers/output/config.js +1 -1
  39. package/core/server/api/v2/authentication.js +1 -1
  40. package/core/server/api/v3/authentication.js +1 -1
  41. package/core/server/data/db/connection.js +7 -0
  42. package/core/server/data/importer/importers/data/data-importer.js +3 -3
  43. package/core/server/data/migrations/init/2-create-fixtures.js +3 -20
  44. package/core/server/data/migrations/versions/1.21/1-add-contributor-role.js +5 -5
  45. package/core/server/data/migrations/versions/2.15/2-insert-zapier-integration.js +3 -3
  46. package/core/server/data/migrations/versions/2.2/3-insert-admin-integration-role.js +5 -5
  47. package/core/server/data/migrations/versions/2.27/1-insert-ghost-db-backup-role.js +5 -6
  48. package/core/server/data/migrations/versions/2.27/2-insert-db-backup-integration.js +3 -4
  49. package/core/server/data/migrations/versions/2.28/3-insert-ghost-scheduler-role.js +7 -7
  50. package/core/server/data/migrations/versions/2.28/4-insert-scheduler-integration.js +3 -3
  51. package/core/server/data/migrations/versions/4.23/01-truncate-offer-names.js +58 -0
  52. package/core/server/data/schema/fixtures/fixture-manager.js +340 -0
  53. package/core/server/data/schema/fixtures/index.js +8 -2
  54. package/core/server/services/email-analytics/jobs/index.js +1 -1
  55. package/core/server/services/mega/post-email-serializer.js +5 -1
  56. package/core/server/services/mega/segment-parser.js +1 -2
  57. package/core/server/services/mega/template.js +52 -37
  58. package/core/server/services/nft-oembed.js +7 -21
  59. package/core/server/services/oembed.js +24 -24
  60. package/core/server/services/public-config/config.js +1 -1
  61. package/core/server/services/redirects/api.js +18 -23
  62. package/core/server/services/redirects/index.js +18 -10
  63. package/core/server/services/redirects/utils.js +14 -0
  64. package/core/server/services/redirects/validation.js +10 -0
  65. package/core/server/services/route-settings/index.js +40 -17
  66. package/core/server/services/route-settings/route-settings.js +127 -114
  67. package/core/server/services/route-settings/settings-loader.js +14 -32
  68. package/core/server/services/themes/activation-bridge.js +3 -3
  69. package/core/server/services/url/LocalFileCache.js +75 -0
  70. package/core/server/services/url/Resources.js +8 -2
  71. package/core/server/services/url/UrlGenerator.js +23 -20
  72. package/core/server/services/url/UrlService.js +75 -63
  73. package/core/server/services/url/index.js +17 -3
  74. package/core/server/web/admin/app.js +7 -10
  75. package/core/server/web/admin/controller.js +35 -12
  76. package/core/server/web/admin/middleware/redirect-admin-urls.js +15 -0
  77. package/core/server/web/admin/views/default-prod.html +4 -4
  78. package/core/server/web/admin/views/default.html +4 -4
  79. package/core/server/web/api/app.js +1 -1
  80. package/core/server/web/api/canary/admin/app.js +3 -6
  81. package/core/server/web/api/canary/admin/middleware.js +6 -6
  82. package/core/server/web/api/canary/admin/routes.js +5 -5
  83. package/core/server/web/api/canary/content/app.js +3 -6
  84. package/core/server/web/api/canary/content/middleware.js +3 -3
  85. package/core/server/web/api/v2/admin/app.js +3 -6
  86. package/core/server/web/api/v2/admin/middleware.js +6 -6
  87. package/core/server/web/api/v2/admin/routes.js +5 -5
  88. package/core/server/web/api/v2/content/app.js +3 -6
  89. package/core/server/web/api/v2/content/middleware.js +3 -3
  90. package/core/server/web/api/v3/admin/app.js +3 -6
  91. package/core/server/web/api/v3/admin/middleware.js +6 -6
  92. package/core/server/web/api/v3/admin/routes.js +5 -5
  93. package/core/server/web/api/v3/content/app.js +3 -6
  94. package/core/server/web/api/v3/content/middleware.js +3 -3
  95. package/core/server/web/members/app.js +6 -9
  96. package/core/server/web/oauth/app.js +0 -4
  97. package/core/server/web/parent/app.js +17 -9
  98. package/core/server/web/parent/frontend.js +1 -1
  99. package/core/server/web/shared/index.js +2 -2
  100. package/core/server/web/shared/{middlewares → middleware}/api/index.js +0 -0
  101. package/core/server/web/shared/{middlewares → middleware}/api/spam-prevention.js +0 -0
  102. package/core/server/web/shared/{middlewares → middleware}/brute.js +0 -0
  103. package/core/server/web/shared/{middlewares → middleware}/cache-control.js +0 -0
  104. package/core/server/web/shared/{middlewares → middleware}/error-handler.js +70 -53
  105. package/core/server/web/shared/{middlewares → middleware}/index.js +0 -4
  106. package/core/server/web/shared/{middlewares → middleware}/pretty-urls.js +0 -0
  107. package/core/server/web/shared/{middlewares → middleware}/uncapitalise.js +0 -0
  108. package/core/server/web/shared/{middlewares → middleware}/url-redirects.js +0 -0
  109. package/core/shared/config/defaults.json +7 -1
  110. package/core/shared/config/helpers.js +42 -0
  111. package/core/shared/config/loader.js +1 -1
  112. package/core/shared/labs.js +7 -2
  113. package/loggingrc.js +19 -20
  114. package/package.json +35 -34
  115. package/yarn.lock +822 -345
  116. package/core/server/data/schema/fixtures/utils.js +0 -321
  117. package/core/server/web/parent/vhost-utils.js +0 -39
  118. package/core/server/web/shared/middlewares/maintenance.js +0 -25
package/.c8rc.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "all": true,
3
+ "include": [
4
+ "core/{*.js,frontend,server,shared}"
5
+ ],
6
+ "exclude": [
7
+ "core/frontend/src/**",
8
+ "core/frontend/public/**",
9
+ "core/server/data/migrations/**",
10
+ "!core/server/data/migrations/utils.js",
11
+ "core/frontend/web/**",
12
+ "!core/frontend/web/middleware/**",
13
+ "core/server/web/api/**",
14
+ "!core/server/web/api/middleware/**",
15
+ "core/server/web/parent/**",
16
+ "!core/server/web/parent/middleware/**",
17
+ "core/server/web/shared/**",
18
+ "!core/server/web/shared/middleware/**",
19
+ "core/server/api/v2/**",
20
+ "core/server/api/v3/**",
21
+ "core/server/api/canary/**",
22
+ "!core/server/api/canary/utils"
23
+ ]
24
+ }
package/Gruntfile.js CHANGED
@@ -75,7 +75,6 @@ module.exports = function (grunt) {
75
75
  'core/shared/**/*.js',
76
76
  'core/frontend/**/*.js',
77
77
  'core/frontend/src/**/*.css',
78
- '!core/frontend/public/**',
79
78
  'core/*.js',
80
79
  'index.js',
81
80
  'config.*.json',
@@ -0,0 +1,3 @@
1
+ # Content / Public
2
+
3
+ Ghost will store any built assets here. This goes hand in hand with core/frontend/public where static assets are stored.
package/core/app.js CHANGED
@@ -1,14 +1,25 @@
1
1
  const sentry = require('./shared/sentry');
2
2
  const express = require('./shared/express');
3
+ const config = require('./shared/config');
4
+ const urlService = require('./server/services/url');
3
5
 
4
6
  const fs = require('fs');
5
7
  const path = require('path');
6
8
 
9
+ const isMaintenanceModeEnabled = (req) => {
10
+ if (req.app.get('maintenance') || config.get('maintenance').enabled || !urlService.hasFinished()) {
11
+ return true;
12
+ }
13
+
14
+ return false;
15
+ };
16
+
7
17
  // We never want middleware functions to be anonymous
8
18
  const maintenanceMiddleware = (req, res, next) => {
9
- if (!req.app.get('maintenance')) {
19
+ if (!isMaintenanceModeEnabled(req)) {
10
20
  return next();
11
21
  }
22
+
12
23
  res.set({
13
24
  'Cache-Control': 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0'
14
25
  });
package/core/boot.js CHANGED
@@ -68,8 +68,10 @@ async function initDatabase({config, logging}) {
68
68
  * @param {object} options
69
69
  * @param {object} options.ghostServer
70
70
  * @param {object} options.config
71
+ * @param {object} options.bootLogger
72
+ * @param {boolean} options.frontend
71
73
  */
72
- async function initCore({ghostServer, config}) {
74
+ async function initCore({ghostServer, config, bootLogger, frontend}) {
73
75
  debug('Begin: initCore');
74
76
 
75
77
  // URL Utils is a bit slow, put it here so the timing is visible separate from models
@@ -94,9 +96,14 @@ async function initCore({ghostServer, config}) {
94
96
  debug('Begin: Url Service');
95
97
  const urlService = require('./server/services/url');
96
98
  // Note: there is no await here, we do not wait for the url service to finish
97
- // We can return, but the site will remain in (the shared, not global) maintenance mode until this finishes
98
- // This is managed on request: https://github.com/TryGhost/Ghost/blob/main/core/server/web/shared/middlewares/maintenance.js#L13
99
- urlService.init();
99
+ // We can return, but the site will remain in maintenance mode until this finishes
100
+ // This is managed on request: https://github.com/TryGhost/Ghost/blob/main/core/app.js#L10
101
+ urlService.init({
102
+ onFinished: () => {
103
+ bootLogger.log('URL Service Ready');
104
+ },
105
+ urlCache: !frontend // hacky parameter to make the cache initialization kick in as we can't initialize labs before the boot
106
+ });
100
107
  debug('End: Url Service');
101
108
 
102
109
  // Job Service allows parts of Ghost to run in the background
@@ -106,7 +113,7 @@ async function initCore({ghostServer, config}) {
106
113
  await jobService.shutdown();
107
114
  });
108
115
  ghostServer.registerCleanupTask(async () => {
109
- await urlService.persistUrls();
116
+ await urlService.shutdown();
110
117
  });
111
118
  debug('End: Job Service');
112
119
 
@@ -124,6 +131,11 @@ async function initServicesForFrontend() {
124
131
  await routeSettings.init();
125
132
  debug('End: Routing Settings');
126
133
 
134
+ debug('Begin: Redirects');
135
+ const customRedirects = require('./server/services/redirects');
136
+ await customRedirects.init(),
137
+ debug('End: Redirects');
138
+
127
139
  debug('Begin: Themes');
128
140
  // customThemSettingsService.api must be initialized before any theme activation occurs
129
141
  const customThemeSettingsService = require('./server/services/custom-theme-settings');
@@ -144,9 +156,6 @@ async function initFrontend() {
144
156
  const helperService = require('./frontend/services/helpers');
145
157
  await helperService.init();
146
158
 
147
- const cardAssetService = require('./frontend/services/card-assets');
148
- await cardAssetService.init();
149
-
150
159
  debug('End: initFrontend');
151
160
  }
152
161
 
@@ -154,10 +163,13 @@ async function initFrontend() {
154
163
  * At the moment we load our express apps all in one go, they require themselves and are co-located
155
164
  * What we want is to be able to optionally load various components and mount them
156
165
  * So eventually this function should go away
166
+ * @param {Object} options
167
+ * @param {Boolean} options.backend
168
+ * @param {Boolean} options.frontend
157
169
  */
158
- async function initExpressApps() {
170
+ async function initExpressApps(options) {
159
171
  debug('Begin: initExpressApps');
160
- const parentApp = require('./server/web/parent/app')();
172
+ const parentApp = require('./server/web/parent/app')(options);
161
173
  debug('End: initExpressApps');
162
174
  return parentApp;
163
175
  }
@@ -173,6 +185,7 @@ async function initDynamicRouting() {
173
185
  const routing = require('./frontend/services/routing');
174
186
  const routeSettingsService = require('./server/services/route-settings');
175
187
  const bridge = require('./bridge');
188
+ bridge.init();
176
189
 
177
190
  // We pass the frontend API version + the dynamic routes here, so that the frontend services are slightly less tightly-coupled
178
191
  const apiVersion = bridge.getFrontendApiVersion();
@@ -214,7 +227,6 @@ async function initServices({config}) {
214
227
  const appService = require('./frontend/services/apps');
215
228
  const limits = require('./server/services/limits');
216
229
  const scheduling = require('./server/adapters/scheduling');
217
- const customRedirects = require('./server/services/redirects');
218
230
 
219
231
  const urlUtils = require('./shared/url-utils');
220
232
 
@@ -228,7 +240,6 @@ async function initServices({config}) {
228
240
  await offers.init();
229
241
 
230
242
  await Promise.all([
231
- customRedirects.init(),
232
243
  members.init(),
233
244
  permissions.init(),
234
245
  xmlrpc.listen(),
@@ -266,7 +277,7 @@ async function initBackgroundServices({config}) {
266
277
  themeService.loadInactiveThemes();
267
278
 
268
279
  // we don't want to kick off background services that will interfere with tests
269
- if (process.env.NODE_ENV.match(/^testing/)) {
280
+ if (process.env.NODE_ENV.startsWith('test')) {
270
281
  return;
271
282
  }
272
283
 
@@ -292,7 +303,7 @@ async function initBackgroundServices({config}) {
292
303
 
293
304
  * @returns {Promise<object>} ghostServer
294
305
  */
295
- async function bootGhost() {
306
+ async function bootGhost({backend = true, frontend = true} = {}) {
296
307
  // Metrics
297
308
  const startTime = Date.now();
298
309
  debug('Begin Boot');
@@ -307,12 +318,18 @@ async function bootGhost() {
307
318
  // These require their own try-catch block and error format, because we can't log an error if logging isn't working
308
319
  try {
309
320
  // Step 0 - Load config and logging - fundamental required components
310
- // Config must be the first thing we do, because it is required for absolutely everything
321
+ // Version is required by logging, sentry & Migration config & so is fundamental to booting
322
+ // However, it involves reading package.json so its slow & it's here for visibility on that slowness
323
+ debug('Begin: Load version info');
324
+ require('@tryghost/version');
325
+ debug('End: Load version info');
326
+
327
+ // Loading config must be the first thing we do, because it is required for absolutely everything
311
328
  debug('Begin: Load config');
312
329
  config = require('./shared/config');
313
330
  debug('End: Load config');
314
331
 
315
- // Logging is used absolutely everywhere
332
+ // Logging is also used absolutely everywhere
316
333
  debug('Begin: Load logging');
317
334
  logging = require('@tryghost/logging');
318
335
  metrics = require('@tryghost/metrics');
@@ -327,12 +344,6 @@ async function bootGhost() {
327
344
 
328
345
  try {
329
346
  // Step 1 - require more fundamental components
330
- // Version is required by sentry & Migration config & so is fundamental to booting
331
- // However, it involves reading package.json so its slow & it's here for visibility on that slowness
332
- debug('Begin: Load version info');
333
- require('@tryghost/version');
334
- debug('End: Load version info');
335
-
336
347
  // Sentry must be initialized early, but requires config
337
348
  debug('Begin: Load sentry');
338
349
  require('./shared/sentry');
@@ -341,6 +352,7 @@ async function bootGhost() {
341
352
  // Step 2 - Start server with minimal app in global maintenance mode
342
353
  debug('Begin: load server + minimal app');
343
354
  const rootApp = require('./app');
355
+
344
356
  const GhostServer = require('./server/ghost-server');
345
357
  ghostServer = new GhostServer({url: config.getSiteUrl()});
346
358
  await ghostServer.start(rootApp);
@@ -355,11 +367,18 @@ async function bootGhost() {
355
367
 
356
368
  // Step 4 - Load Ghost with all its services
357
369
  debug('Begin: Load Ghost Services & Apps');
358
- await initCore({ghostServer, config});
370
+ await initCore({ghostServer, config, bootLogger, frontend});
359
371
  await initServicesForFrontend();
360
- await initFrontend();
361
- const ghostApp = await initExpressApps();
362
- await initDynamicRouting();
372
+
373
+ if (frontend) {
374
+ await initFrontend();
375
+ }
376
+ const ghostApp = await initExpressApps({frontend, backend});
377
+
378
+ if (frontend) {
379
+ await initDynamicRouting();
380
+ }
381
+
363
382
  await initServices({config});
364
383
  debug('End: Load Ghost Services & Apps');
365
384
 
package/core/bridge.js CHANGED
@@ -16,6 +16,7 @@ const config = require('./shared/config');
16
16
  const logging = require('@tryghost/logging');
17
17
  const tpl = require('@tryghost/tpl');
18
18
  const themeEngine = require('./frontend/services/theme-engine');
19
+ const cardAssetService = require('./frontend/services/card-assets');
19
20
  const routerManager = require('./frontend/services/routing').routerManager;
20
21
  const settingsCache = require('./shared/settings-cache');
21
22
 
@@ -27,7 +28,7 @@ const messages = {
27
28
  };
28
29
 
29
30
  class Bridge {
30
- constructor() {
31
+ init() {
31
32
  /**
32
33
  * When locale changes, we reload theme translations
33
34
  * @deprecated: the term "lang" was deprecated in favor of "locale" publicly in 4.0
@@ -49,7 +50,7 @@ class Bridge {
49
50
  return themeEngine.getActive();
50
51
  }
51
52
 
52
- activateTheme(loadedTheme, checkedTheme) {
53
+ async activateTheme(loadedTheme, checkedTheme) {
53
54
  let settings = {
54
55
  locale: settingsCache.get('lang')
55
56
  };
@@ -67,8 +68,12 @@ class Bridge {
67
68
 
68
69
  if (previousGhostAPI !== undefined && (previousGhostAPI !== currentGhostAPI)) {
69
70
  events.emit('services.themes.api.changed');
70
- this.reloadFrontend();
71
+ await this.reloadFrontend();
71
72
  }
73
+
74
+ const cardAssetConfig = this.getCardAssetConfig();
75
+ debug('reload card assets config', cardAssetConfig);
76
+ await cardAssetService.load(cardAssetConfig);
72
77
  } catch (err) {
73
78
  logging.error(new errors.InternalServerError({
74
79
  message: tpl(messages.activateFailed, {theme: loadedTheme.name}),
@@ -93,17 +98,12 @@ class Bridge {
93
98
  }
94
99
  }
95
100
 
96
- reloadFrontend() {
101
+ async reloadFrontend() {
97
102
  const apiVersion = this.getFrontendApiVersion();
98
- const cardAssetConfig = this.getCardAssetConfig();
99
-
100
- debug('reload card assets config', cardAssetConfig);
101
- const cardAssetService = require('./frontend/services/card-assets');
102
- cardAssetService.load(cardAssetConfig);
103
103
 
104
104
  debug('reload frontend', apiVersion);
105
105
  const siteApp = require('./frontend/web/site');
106
- siteApp.reload({apiVersion});
106
+ await siteApp.reload({apiVersion});
107
107
  }
108
108
  }
109
109
 
@@ -1,8 +1,8 @@
1
- (window.webpackJsonp_ember_auto_import_=window.webpackJsonp_ember_auto_import_||[]).push([[3],{606:function(t,e,n){"use strict"
1
+ (window.webpackJsonp_ember_auto_import_=window.webpackJsonp_ember_auto_import_||[]).push([[3],{610:function(t,e,n){"use strict"
2
2
  n.r(e),n.d(e,"Integrations",(function(){return X})),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 G.i})),n.d(e,"TRACEPARENT_REGEXP",(function(){return d.a}))
3
3
  var i={}
4
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(18),s=n(5),o=n(610),c=n(611),u=n(609),d=n(608),p=Object(s.a)(),l=n(17),m=n(82),h=n(32),f=function(t,e,n){var i
5
+ var a=n(0),r=n(19),s=n(5),o=n(614),c=n(615),u=n(613),d=n(612),p=Object(s.a)(),l=n(18),m=n(82),h=n(32),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
8
  return n.observe({type:t,buffered:!0}),n}}catch(t){}},b=function(t,e){var n=function(i){"pagehide"!==i.type&&"hidden"!==Object(s.a)().document.visibilityState||(t(i),e&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))}
@@ -46,7 +46,7 @@ if(n){var i=Object(d.e)(m.b),a=Object(d.e)(n.startTime)
46
46
  r.b.log("[Measurements] Adding FID"),t._measurements.fid={value:e.value},t._measurements["mark.fid"]={value:i+a}}}))},t}()
47
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
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(12),k=n(91),w=n(4),R={traceFetch:!0,traceXHR:!0,tracingOrigins:["localhost",/^\//]}
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(13),k=n(92),w=n(4),R={traceFetch:!0,traceXHR:!0,tracingOrigins:["localhost",/^\//]}
50
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
52
  return o[t]=e.some((function(e){return Object(C.b)(t,e)}))&&!Object(C.b)(t,"sentry_key"),o[t]},p=c
@@ -115,15 +115,15 @@ return t.call.apply(t,Object(a.e)([this],u.slice(0,-1),[function(t,e){var n
115
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}(),W=n(612),J=n(613),G=n(83),X=Object(a.a)(Object(a.a)({},i),{BrowserTracing:D})
119
- Object(o.a)()},608:function(t,e,n){"use strict"
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(616),J=n(617),G=n(84),X=Object(a.a)(Object(a.a)({},i),{BrowserTracing:D})
119
+ Object(o.a)()},612: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(607),a=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$")
121
+ var i=n(611),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}},609:function(t,e,n){"use strict"
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}},613: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={}))},610: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(607),r=n(92),s=n(18),o=n(17),c=n(615),u=n(611),d=n(613),p=n(608)
138
+ default:return t.InternalError}return t.UnknownError}}(i||(i={}))},614: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(611),r=n(93),s=n(19),o=n(18),c=n(619),u=n(615),d=n(617),p=n(612)
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)(e)?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.b.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.b.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.b.log("[Tracing] starting "+t.op+" transaction - "+t.name),t):(s.b.log("[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = "+Number(i)+")"),t)):(s.b.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.b.warn("[Tracing] Discarding transaction because of invalid sample rate."),t.sampled=!1,t)):(t.sampled=!1,t)
@@ -144,9 +144,9 @@ 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/node/mongo").Mongo)},mongoose:function(){return new(Object(o.a)(t,"./integrations/node/mongo").Mongo)({mongoose:!0})},mysql:function(){return new(Object(o.a)(t,"./integrations/node/mysql").Mysql)},pg:function(){return new(Object(o.a)(t,"./integrations/node/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(47)(t))},611:function(t,e,n){"use strict"
147
+ r.length>0&&(e.__SENTRY__.integrations=Object(i.e)(e.__SENTRY__.integrations||[],r))}}(),Object(c.a)()}}).call(this,n(47)(t))},615: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(82),r=n(18),s=n(612),o=n(609),c=n(613),u=1e3,d=function(t){function e(e,n,i,a){void 0===i&&(i="")
149
+ var i=n(0),a=n(82),r=n(19),s=n(616),o=n(613),c=n(617),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)
@@ -164,9 +164,9 @@ setTimeout((function(){e._finished||e.finish(i)}),n)}},e.prototype._beat=functio
164
164
  t===this._prevHeartbeatString?this._heartbeatCounter+=1:this._heartbeatCounter=1,this._prevHeartbeatString=t,this._heartbeatCounter>=3?(r.b.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
165
  r.b.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)}}},612:function(t,e,n){"use strict"
167
+ e&&e.getTransaction()&&e.setSpan(void 0)}}},616: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(83),r=n(82),s=n(7),o=n(609),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.j)(),this.spanId=Object(a.j)().substring(16),this.startTimestamp=Object(r.e)(),this.tags={},this.data={},!t)return this
169
+ var i=n(0),a=n(84),r=n(82),s=n(7),o=n(613),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.j)(),this.spanId=Object(a.j)().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,9 +174,9 @@ 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}()},613:function(t,e,n){"use strict"
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}()},617:function(t,e,n){"use strict"
178
178
  n.d(e,"a",(function(){return d}))
179
- var i=n(0),a=n(607),r=n(88),s=n(4),o=n(18),c=n(7),u=n(612),d=function(t){function e(e,n){var i=t.call(this,e)||this
179
+ var i=n(0),a=n(611),r=n(89),s=n(4),o=n(19),c=n(7),u=n(616),d=function(t){function e(e,n){var i=t.call(this,e)||this
180
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,c,u=this
181
181
  if(void 0===this.endTimestamp){if(this.name||(o.b.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.b.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."),void(null===(c=null===(a=null===(n=this._hub.getClient())||void 0===n?void 0:(i=n).getTransport)||void 0===a?void 0:(s=a.call(i)).recordLostEvent)||void 0===c||c.call(s,r.a.SampleRate,"transaction"))
182
182
  var d=this.spanRecorder?this.spanRecorder.spans.filter((function(t){return t!==u&&t.endTimestamp})):[]
@@ -184,10 +184,10 @@ this._trimEnd&&d.length>0&&(this.endTimestamp=d.reduce((function(t,e){return t.e
184
184
  var p={contexts:{trace:this.getTraceContext()},spans:d,start_timestamp:this.startTimestamp,tags:this.tags,timestamp:this.endTimestamp,transaction:this.name,type:"transaction",debug_meta:this.metadata}
185
185
  return Object.keys(this._measurements).length>0&&(o.b.log("[Measurements] Adding measurements to transaction",JSON.stringify(this._measurements,void 0,2)),p.measurements=this._measurements),o.b.log("[Tracing] Finishing "+this.op+" transaction: "+this.name+"."),this._hub.captureEvent(p)}},e.prototype.toContext=function(){var e=t.prototype.toContext.call(this)
186
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)},615:function(t,e,n){"use strict"
187
+ return t.prototype.updateWithContext.call(this,e),this.name=null!=(n=e.name)?n:"",this._trimEnd=e.trimEnd,this},e}(u.a)},619:function(t,e,n){"use strict"
188
188
  n.d(e,"a",(function(){return o}))
189
- var i=n(91),a=n(18),r=n(609),s=n(608)
189
+ var i=n(92),a=n(19),r=n(613),s=n(612)
190
190
  function o(){Object(i.a)({callback:c,type:"error"}),Object(i.a)({callback:c,type:"unhandledrejection"})}function c(){var t=Object(s.c)()
191
191
  t&&(a.b.log("[Tracing] Transaction: "+r.a.InternalError+" -> Global error occured"),t.setStatus(r.a.InternalError))}}}])
192
192
 
193
- //# sourceMappingURL=chunk.3.324fd0cc598c73650219.map
193
+ //# sourceMappingURL=chunk.3.8f95b516d88ff4eec64c.map