@slicemachine/manager 0.26.3-beta.1 → 0.26.3-beta.3

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 (116) hide show
  1. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.cjs +6 -6
  2. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.js +4 -4
  3. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.js.map +1 -1
  4. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.cjs +4 -4
  5. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.cjs.map +1 -1
  6. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js +4 -4
  7. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js.map +1 -1
  8. package/dist/errors.cjs +7 -0
  9. package/dist/errors.cjs.map +1 -1
  10. package/dist/errors.d.ts +5 -1
  11. package/dist/errors.js +7 -0
  12. package/dist/errors.js.map +1 -1
  13. package/dist/index.cjs +1 -0
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +2 -1
  17. package/dist/managers/customTypes/CustomTypesManager.cjs +17 -7
  18. package/dist/managers/customTypes/CustomTypesManager.cjs.map +1 -1
  19. package/dist/managers/customTypes/CustomTypesManager.js +19 -9
  20. package/dist/managers/customTypes/CustomTypesManager.js.map +1 -1
  21. package/package.json +2 -2
  22. package/src/errors.ts +12 -1
  23. package/src/index.ts +1 -0
  24. package/src/managers/customTypes/CustomTypesManager.ts +29 -18
  25. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.cjs +0 -5
  26. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.cjs.map +0 -1
  27. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.js +0 -5
  28. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.js.map +0 -1
  29. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.cjs +0 -5
  30. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.cjs.map +0 -1
  31. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.js +0 -5
  32. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.js.map +0 -1
  33. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.cjs +0 -29
  34. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.cjs.map +0 -1
  35. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.js +0 -29
  36. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.js.map +0 -1
  37. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.cjs +0 -17
  38. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.cjs.map +0 -1
  39. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.js +0 -17
  40. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.js.map +0 -1
  41. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.cjs +0 -535
  42. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.cjs.map +0 -1
  43. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.js +0 -535
  44. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.js.map +0 -1
  45. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.cjs +0 -545
  46. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.cjs.map +0 -1
  47. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.js +0 -545
  48. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.js.map +0 -1
  49. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.cjs +0 -109
  50. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.cjs.map +0 -1
  51. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.js +0 -109
  52. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.js.map +0 -1
  53. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.cjs +0 -50
  54. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.cjs.map +0 -1
  55. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.js +0 -50
  56. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.js.map +0 -1
  57. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.cjs +0 -85
  58. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.cjs.map +0 -1
  59. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.js +0 -85
  60. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.js.map +0 -1
  61. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.cjs +0 -7
  62. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.cjs.map +0 -1
  63. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.js +0 -7
  64. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.js.map +0 -1
  65. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.cjs +0 -35
  66. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.cjs.map +0 -1
  67. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.js +0 -35
  68. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.js.map +0 -1
  69. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.cjs +0 -39
  70. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.cjs.map +0 -1
  71. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.js +0 -39
  72. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.js.map +0 -1
  73. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.cjs +0 -5
  74. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.cjs.map +0 -1
  75. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.js +0 -5
  76. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.js.map +0 -1
  77. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.cjs +0 -5
  78. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.cjs.map +0 -1
  79. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.js +0 -5
  80. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.js.map +0 -1
  81. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.cjs +0 -15
  82. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.cjs.map +0 -1
  83. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.js +0 -15
  84. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.js.map +0 -1
  85. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.cjs +0 -69
  86. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.cjs.map +0 -1
  87. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.js +0 -69
  88. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.js.map +0 -1
  89. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.cjs +0 -34
  90. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.cjs.map +0 -1
  91. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.js +0 -34
  92. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.js.map +0 -1
  93. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.cjs +0 -49
  94. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.cjs.map +0 -1
  95. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.js +0 -49
  96. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.js.map +0 -1
  97. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.cjs +0 -142
  98. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.cjs.map +0 -1
  99. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.js +0 -142
  100. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.js.map +0 -1
  101. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.cjs +0 -45
  102. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.cjs.map +0 -1
  103. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.js +0 -45
  104. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.js.map +0 -1
  105. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.cjs +0 -18
  106. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.cjs.map +0 -1
  107. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.js +0 -18
  108. package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.js.map +0 -1
  109. package/dist/lib/checkIsSentryEnabled.d.ts +0 -9
  110. package/dist/lib/sentryErrorHandlers.cjs +0 -10
  111. package/dist/lib/sentryErrorHandlers.cjs.map +0 -1
  112. package/dist/lib/sentryErrorHandlers.d.ts +0 -1
  113. package/dist/lib/sentryErrorHandlers.js +0 -10
  114. package/dist/lib/sentryErrorHandlers.js.map +0 -1
  115. package/src/lib/checkIsSentryEnabled.ts +0 -12
  116. package/src/lib/sentryErrorHandlers.ts +0 -13
@@ -1,109 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const time = require("../../utils/esm/time.cjs");
4
- const misc = require("../../utils/esm/misc.cjs");
5
- const object = require("../../utils/esm/object.cjs");
6
- function makeSession(context) {
7
- const startingTime = time.timestampInSeconds();
8
- const session = {
9
- sid: misc.uuid4(),
10
- init: true,
11
- timestamp: startingTime,
12
- started: startingTime,
13
- duration: 0,
14
- status: "ok",
15
- errors: 0,
16
- ignoreDuration: false,
17
- toJSON: () => sessionToJSON(session)
18
- };
19
- if (context) {
20
- updateSession(session, context);
21
- }
22
- return session;
23
- }
24
- function updateSession(session, context = {}) {
25
- if (context.user) {
26
- if (!session.ipAddress && context.user.ip_address) {
27
- session.ipAddress = context.user.ip_address;
28
- }
29
- if (!session.did && !context.did) {
30
- session.did = context.user.id || context.user.email || context.user.username;
31
- }
32
- }
33
- session.timestamp = context.timestamp || time.timestampInSeconds();
34
- if (context.abnormal_mechanism) {
35
- session.abnormal_mechanism = context.abnormal_mechanism;
36
- }
37
- if (context.ignoreDuration) {
38
- session.ignoreDuration = context.ignoreDuration;
39
- }
40
- if (context.sid) {
41
- session.sid = context.sid.length === 32 ? context.sid : misc.uuid4();
42
- }
43
- if (context.init !== void 0) {
44
- session.init = context.init;
45
- }
46
- if (!session.did && context.did) {
47
- session.did = `${context.did}`;
48
- }
49
- if (typeof context.started === "number") {
50
- session.started = context.started;
51
- }
52
- if (session.ignoreDuration) {
53
- session.duration = void 0;
54
- } else if (typeof context.duration === "number") {
55
- session.duration = context.duration;
56
- } else {
57
- const duration = session.timestamp - session.started;
58
- session.duration = duration >= 0 ? duration : 0;
59
- }
60
- if (context.release) {
61
- session.release = context.release;
62
- }
63
- if (context.environment) {
64
- session.environment = context.environment;
65
- }
66
- if (!session.ipAddress && context.ipAddress) {
67
- session.ipAddress = context.ipAddress;
68
- }
69
- if (!session.userAgent && context.userAgent) {
70
- session.userAgent = context.userAgent;
71
- }
72
- if (typeof context.errors === "number") {
73
- session.errors = context.errors;
74
- }
75
- if (context.status) {
76
- session.status = context.status;
77
- }
78
- }
79
- function closeSession(session, status) {
80
- let context = {};
81
- if (session.status === "ok") {
82
- context = { status: "exited" };
83
- }
84
- updateSession(session, context);
85
- }
86
- function sessionToJSON(session) {
87
- return object.dropUndefinedKeys({
88
- sid: `${session.sid}`,
89
- init: session.init,
90
- // Make sure that sec is converted to ms for date constructor
91
- started: new Date(session.started * 1e3).toISOString(),
92
- timestamp: new Date(session.timestamp * 1e3).toISOString(),
93
- status: session.status,
94
- errors: session.errors,
95
- did: typeof session.did === "number" || typeof session.did === "string" ? `${session.did}` : void 0,
96
- duration: session.duration,
97
- abnormal_mechanism: session.abnormal_mechanism,
98
- attrs: {
99
- release: session.release,
100
- environment: session.environment,
101
- ip_address: session.ipAddress,
102
- user_agent: session.userAgent
103
- }
104
- });
105
- }
106
- exports.closeSession = closeSession;
107
- exports.makeSession = makeSession;
108
- exports.updateSession = updateSession;
109
- //# sourceMappingURL=session.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.cjs","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/session.js"],"sourcesContent":["import { timestampInSeconds, uuid4, dropUndefinedKeys } from '@sentry/utils';\n\n/**\n * Creates a new `Session` object by setting certain default parameters. If optional @param context\n * is passed, the passed properties are applied to the session object.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns a new `Session` object\n */\nfunction makeSession(context) {\n // Both timestamp and started are in seconds since the UNIX epoch.\n const startingTime = timestampInSeconds();\n\n const session = {\n sid: uuid4(),\n init: true,\n timestamp: startingTime,\n started: startingTime,\n duration: 0,\n status: 'ok',\n errors: 0,\n ignoreDuration: false,\n toJSON: () => sessionToJSON(session),\n };\n\n if (context) {\n updateSession(session, context);\n }\n\n return session;\n}\n\n/**\n * Updates a session object with the properties passed in the context.\n *\n * Note that this function mutates the passed object and returns void.\n * (Had to do this instead of returning a new and updated session because closing and sending a session\n * makes an update to the session after it was passed to the sending logic.\n * @see BaseClient.captureSession )\n *\n * @param session the `Session` to update\n * @param context the `SessionContext` holding the properties that should be updated in @param session\n */\n// eslint-disable-next-line complexity\nfunction updateSession(session, context = {}) {\n if (context.user) {\n if (!session.ipAddress && context.user.ip_address) {\n session.ipAddress = context.user.ip_address;\n }\n\n if (!session.did && !context.did) {\n session.did = context.user.id || context.user.email || context.user.username;\n }\n }\n\n session.timestamp = context.timestamp || timestampInSeconds();\n\n if (context.abnormal_mechanism) {\n session.abnormal_mechanism = context.abnormal_mechanism;\n }\n\n if (context.ignoreDuration) {\n session.ignoreDuration = context.ignoreDuration;\n }\n if (context.sid) {\n // Good enough uuid validation. — Kamil\n session.sid = context.sid.length === 32 ? context.sid : uuid4();\n }\n if (context.init !== undefined) {\n session.init = context.init;\n }\n if (!session.did && context.did) {\n session.did = `${context.did}`;\n }\n if (typeof context.started === 'number') {\n session.started = context.started;\n }\n if (session.ignoreDuration) {\n session.duration = undefined;\n } else if (typeof context.duration === 'number') {\n session.duration = context.duration;\n } else {\n const duration = session.timestamp - session.started;\n session.duration = duration >= 0 ? duration : 0;\n }\n if (context.release) {\n session.release = context.release;\n }\n if (context.environment) {\n session.environment = context.environment;\n }\n if (!session.ipAddress && context.ipAddress) {\n session.ipAddress = context.ipAddress;\n }\n if (!session.userAgent && context.userAgent) {\n session.userAgent = context.userAgent;\n }\n if (typeof context.errors === 'number') {\n session.errors = context.errors;\n }\n if (context.status) {\n session.status = context.status;\n }\n}\n\n/**\n * Closes a session by setting its status and updating the session object with it.\n * Internally calls `updateSession` to update the passed session object.\n *\n * Note that this function mutates the passed session (@see updateSession for explanation).\n *\n * @param session the `Session` object to be closed\n * @param status the `SessionStatus` with which the session was closed. If you don't pass a status,\n * this function will keep the previously set status, unless it was `'ok'` in which case\n * it is changed to `'exited'`.\n */\nfunction closeSession(session, status) {\n let context = {};\n if (status) {\n context = { status };\n } else if (session.status === 'ok') {\n context = { status: 'exited' };\n }\n\n updateSession(session, context);\n}\n\n/**\n * Serializes a passed session object to a JSON object with a slightly different structure.\n * This is necessary because the Sentry backend requires a slightly different schema of a session\n * than the one the JS SDKs use internally.\n *\n * @param session the session to be converted\n *\n * @returns a JSON object of the passed session\n */\nfunction sessionToJSON(session) {\n return dropUndefinedKeys({\n sid: `${session.sid}`,\n init: session.init,\n // Make sure that sec is converted to ms for date constructor\n started: new Date(session.started * 1000).toISOString(),\n timestamp: new Date(session.timestamp * 1000).toISOString(),\n status: session.status,\n errors: session.errors,\n did: typeof session.did === 'number' || typeof session.did === 'string' ? `${session.did}` : undefined,\n duration: session.duration,\n abnormal_mechanism: session.abnormal_mechanism,\n attrs: {\n release: session.release,\n environment: session.environment,\n ip_address: session.ipAddress,\n user_agent: session.userAgent,\n },\n });\n}\n\nexport { closeSession, makeSession, updateSession };\n//# sourceMappingURL=session.js.map\n"],"names":["timestampInSeconds","uuid4","dropUndefinedKeys"],"mappings":";;;;;AAUA,SAAS,YAAY,SAAS;AAE5B,QAAM,eAAeA,KAAAA,mBAAkB;AAEvC,QAAM,UAAU;AAAA,IACd,KAAKC,KAAAA,MAAK;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,IACX,SAAS;AAAA,IACT,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,QAAQ,MAAM,c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3
- import { dropUndefinedKeys } from "../../utils/esm/object.js";
4
- function makeSession(context) {
5
- const startingTime = timestampInSeconds();
6
- const session = {
7
- sid: uuid4(),
8
- init: true,
9
- timestamp: startingTime,
10
- started: startingTime,
11
- duration: 0,
12
- status: "ok",
13
- errors: 0,
14
- ignoreDuration: false,
15
- toJSON: () => sessionToJSON(session)
16
- };
17
- if (context) {
18
- updateSession(session, context);
19
- }
20
- return session;
21
- }
22
- function updateSession(session, context = {}) {
23
- if (context.user) {
24
- if (!session.ipAddress && context.user.ip_address) {
25
- session.ipAddress = context.user.ip_address;
26
- }
27
- if (!session.did && !context.did) {
28
- session.did = context.user.id || context.user.email || context.user.username;
29
- }
30
- }
31
- session.timestamp = context.timestamp || timestampInSeconds();
32
- if (context.abnormal_mechanism) {
33
- session.abnormal_mechanism = context.abnormal_mechanism;
34
- }
35
- if (context.ignoreDuration) {
36
- session.ignoreDuration = context.ignoreDuration;
37
- }
38
- if (context.sid) {
39
- session.sid = context.sid.length === 32 ? context.sid : uuid4();
40
- }
41
- if (context.init !== void 0) {
42
- session.init = context.init;
43
- }
44
- if (!session.did && context.did) {
45
- session.did = `${context.did}`;
46
- }
47
- if (typeof context.started === "number") {
48
- session.started = context.started;
49
- }
50
- if (session.ignoreDuration) {
51
- session.duration = void 0;
52
- } else if (typeof context.duration === "number") {
53
- session.duration = context.duration;
54
- } else {
55
- const duration = session.timestamp - session.started;
56
- session.duration = duration >= 0 ? duration : 0;
57
- }
58
- if (context.release) {
59
- session.release = context.release;
60
- }
61
- if (context.environment) {
62
- session.environment = context.environment;
63
- }
64
- if (!session.ipAddress && context.ipAddress) {
65
- session.ipAddress = context.ipAddress;
66
- }
67
- if (!session.userAgent && context.userAgent) {
68
- session.userAgent = context.userAgent;
69
- }
70
- if (typeof context.errors === "number") {
71
- session.errors = context.errors;
72
- }
73
- if (context.status) {
74
- session.status = context.status;
75
- }
76
- }
77
- function closeSession(session, status) {
78
- let context = {};
79
- if (session.status === "ok") {
80
- context = { status: "exited" };
81
- }
82
- updateSession(session, context);
83
- }
84
- function sessionToJSON(session) {
85
- return dropUndefinedKeys({
86
- sid: `${session.sid}`,
87
- init: session.init,
88
- // Make sure that sec is converted to ms for date constructor
89
- started: new Date(session.started * 1e3).toISOString(),
90
- timestamp: new Date(session.timestamp * 1e3).toISOString(),
91
- status: session.status,
92
- errors: session.errors,
93
- did: typeof session.did === "number" || typeof session.did === "string" ? `${session.did}` : void 0,
94
- duration: session.duration,
95
- abnormal_mechanism: session.abnormal_mechanism,
96
- attrs: {
97
- release: session.release,
98
- environment: session.environment,
99
- ip_address: session.ipAddress,
100
- user_agent: session.userAgent
101
- }
102
- });
103
- }
104
- export {
105
- closeSession,
106
- makeSession,
107
- updateSession
108
- };
109
- //# sourceMappingURL=session.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.js","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/session.js"],"sourcesContent":["import { timestampInSeconds, uuid4, dropUndefinedKeys } from '@sentry/utils';\n\n/**\n * Creates a new `Session` object by setting certain default parameters. If optional @param context\n * is passed, the passed properties are applied to the session object.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns a new `Session` object\n */\nfunction makeSession(context) {\n // Both timestamp and started are in seconds since the UNIX epoch.\n const startingTime = timestampInSeconds();\n\n const session = {\n sid: uuid4(),\n init: true,\n timestamp: startingTime,\n started: startingTime,\n duration: 0,\n status: 'ok',\n errors: 0,\n ignoreDuration: false,\n toJSON: () => sessionToJSON(session),\n };\n\n if (context) {\n updateSession(session, context);\n }\n\n return session;\n}\n\n/**\n * Updates a session object with the properties passed in the context.\n *\n * Note that this function mutates the passed object and returns void.\n * (Had to do this instead of returning a new and updated session because closing and sending a session\n * makes an update to the session after it was passed to the sending logic.\n * @see BaseClient.captureSession )\n *\n * @param session the `Session` to update\n * @param context the `SessionContext` holding the properties that should be updated in @param session\n */\n// eslint-disable-next-line complexity\nfunction updateSession(session, context = {}) {\n if (context.user) {\n if (!session.ipAddress && context.user.ip_address) {\n session.ipAddress = context.user.ip_address;\n }\n\n if (!session.did && !context.did) {\n session.did = context.user.id || context.user.email || context.user.username;\n }\n }\n\n session.timestamp = context.timestamp || timestampInSeconds();\n\n if (context.abnormal_mechanism) {\n session.abnormal_mechanism = context.abnormal_mechanism;\n }\n\n if (context.ignoreDuration) {\n session.ignoreDuration = context.ignoreDuration;\n }\n if (context.sid) {\n // Good enough uuid validation. — Kamil\n session.sid = context.sid.length === 32 ? context.sid : uuid4();\n }\n if (context.init !== undefined) {\n session.init = context.init;\n }\n if (!session.did && context.did) {\n session.did = `${context.did}`;\n }\n if (typeof context.started === 'number') {\n session.started = context.started;\n }\n if (session.ignoreDuration) {\n session.duration = undefined;\n } else if (typeof context.duration === 'number') {\n session.duration = context.duration;\n } else {\n const duration = session.timestamp - session.started;\n session.duration = duration >= 0 ? duration : 0;\n }\n if (context.release) {\n session.release = context.release;\n }\n if (context.environment) {\n session.environment = context.environment;\n }\n if (!session.ipAddress && context.ipAddress) {\n session.ipAddress = context.ipAddress;\n }\n if (!session.userAgent && context.userAgent) {\n session.userAgent = context.userAgent;\n }\n if (typeof context.errors === 'number') {\n session.errors = context.errors;\n }\n if (context.status) {\n session.status = context.status;\n }\n}\n\n/**\n * Closes a session by setting its status and updating the session object with it.\n * Internally calls `updateSession` to update the passed session object.\n *\n * Note that this function mutates the passed session (@see updateSession for explanation).\n *\n * @param session the `Session` object to be closed\n * @param status the `SessionStatus` with which the session was closed. If you don't pass a status,\n * this function will keep the previously set status, unless it was `'ok'` in which case\n * it is changed to `'exited'`.\n */\nfunction closeSession(session, status) {\n let context = {};\n if (status) {\n context = { status };\n } else if (session.status === 'ok') {\n context = { status: 'exited' };\n }\n\n updateSession(session, context);\n}\n\n/**\n * Serializes a passed session object to a JSON object with a slightly different structure.\n * This is necessary because the Sentry backend requires a slightly different schema of a session\n * than the one the JS SDKs use internally.\n *\n * @param session the session to be converted\n *\n * @returns a JSON object of the passed session\n */\nfunction sessionToJSON(session) {\n return dropUndefinedKeys({\n sid: `${session.sid}`,\n init: session.init,\n // Make sure that sec is converted to ms for date constructor\n started: new Date(session.started * 1000).toISOString(),\n timestamp: new Date(session.timestamp * 1000).toISOString(),\n status: session.status,\n errors: session.errors,\n did: typeof session.did === 'number' || typeof session.did === 'string' ? `${session.did}` : undefined,\n duration: session.duration,\n abnormal_mechanism: session.abnormal_mechanism,\n attrs: {\n release: session.release,\n environment: session.environment,\n ip_address: session.ipAddress,\n user_agent: session.userAgent,\n },\n });\n}\n\nexport { closeSession, makeSession, updateSession };\n//# sourceMappingURL=session.js.map\n"],"names":[],"mappings":";;;AAUA,SAAS,YAAY,SAAS;AAE5B,QAAM,eAAe,mBAAkB;AAEvC,QAAM,UAAU;AAAA,IACd,KAAK,MAAK;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,IACX,SAAS;AAAA,IACT,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,QAAQ,MAAM,cAAc,OAAO;AAAA,EACvC;AAEE,MAAI,SAAS;AACX,kBAAc,SAAS,OAAO;AAAA,EAChC;AAEA,SAAO;AACT;AAcA,SAAS,cAAc,SAAS,UAAU,IAAI;AAC5C,MAAI,QAAQ,MAAM;AAChB,QAAI,CAAC,QAAQ,aAAa,QAAQ,KAAK,YAAY;AACjD,cAAQ,YAAY,QAAQ,KAAK;AAAA,IACnC;AAEA,QAAI,CAAC,QAAQ,OAAO,CAAC,QAAQ,KAAK;AAChC,cAAQ,MAAM,QAAQ,KAAK,MAAM,QAAQ,KAAK,SAAS,QAAQ,KAAK;AAAA,IACtE;AAAA,EACF;AAEA,UAAQ,YAAY,QAAQ,aAAa,mBAAkB;AAE3D,MAAI,QAAQ,oBAAoB;AAC9B,YAAQ,qBAAqB,QAAQ;AAAA,EACvC;AAEA,MAAI,QAAQ,gBAAgB;AAC1B,YAAQ,iBAAiB,QAAQ;AAAA,EACnC;AACA,MAAI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QAAQ,GAAG;AAAA,IACnB,MAAM,QAAQ;AAAA;AAAA,IAEd,SAAS,IAAI,KAAK,QAAQ,UAAU,GAAI,EAAE,YAAW;AAAA,IACrD,WAAW,IAAI,KAAK,QAAQ,YAAY,GAAI,EAAE,YAAW;AAAA,IACzD,QAAQ,QAAQ;AAAA,IAChB,QAAQ,QAAQ;AAAA,IAChB,KAAK,OAAO,QAAQ,QAAQ,YAAY,OAAO,QAAQ,QAAQ,WAAW,GAAG,QAAQ,GAAG,KAAK;AAAA,IAC7F,UAAU,QAAQ;AAAA,IAClB,oBAAoB,QAAQ;AAAA,IAC5B,OAAO;AAAA,MACL,SAAS,QAAQ;AAAA,MACjB,aAAa,QAAQ;AAAA,MACrB,YAAY,QAAQ;AAAA,MACpB,YAAY,QAAQ;AAAA,IAC1B;AAAA,EACA,CAAG;AACH;","x_google_ignoreList":[0]}
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const constants = require("../constants.cjs");
4
- const exports$1 = require("../exports.cjs");
5
- const getRootSpan = require("../utils/getRootSpan.cjs");
6
- const spanUtils = require("../utils/spanUtils.cjs");
7
- const object = require("../../../utils/esm/object.cjs");
8
- function getDynamicSamplingContextFromClient(trace_id, client, scope) {
9
- const options = client.getOptions();
10
- const { publicKey: public_key } = client.getDsn() || {};
11
- const { segment: user_segment } = scope && scope.getUser() || {};
12
- const dsc = object.dropUndefinedKeys({
13
- environment: options.environment || constants.DEFAULT_ENVIRONMENT,
14
- release: options.release,
15
- user_segment,
16
- public_key,
17
- trace_id
18
- });
19
- client.emit && client.emit("createDsc", dsc);
20
- return dsc;
21
- }
22
- function getDynamicSamplingContextFromSpan(span) {
23
- const client = exports$1.getClient();
24
- if (!client) {
25
- return {};
26
- }
27
- const dsc = getDynamicSamplingContextFromClient(spanUtils.spanToJSON(span).trace_id || "", client, exports$1.getCurrentScope());
28
- const txn = getRootSpan.getRootSpan(span);
29
- if (!txn) {
30
- return dsc;
31
- }
32
- const v7FrozenDsc = txn && txn._frozenDynamicSamplingContext;
33
- if (v7FrozenDsc) {
34
- return v7FrozenDsc;
35
- }
36
- const { sampleRate: maybeSampleRate, source } = txn.metadata;
37
- if (maybeSampleRate != null) {
38
- dsc.sample_rate = `${maybeSampleRate}`;
39
- }
40
- const jsonSpan = spanUtils.spanToJSON(txn);
41
- if (source && source !== "url") {
42
- dsc.transaction = jsonSpan.description;
43
- }
44
- dsc.sampled = String(spanUtils.spanIsSampled(txn));
45
- client.emit && client.emit("createDsc", dsc);
46
- return dsc;
47
- }
48
- exports.getDynamicSamplingContextFromClient = getDynamicSamplingContextFromClient;
49
- exports.getDynamicSamplingContextFromSpan = getDynamicSamplingContextFromSpan;
50
- //# sourceMappingURL=dynamicSamplingContext.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dynamicSamplingContext.cjs","sources":["../../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.js"],"sourcesContent":["import { dropUndefinedKeys } from '@sentry/utils';\nimport { DEFAULT_ENVIRONMENT } from '../constants.js';\nimport { getClient, getCurrentScope } from '../exports.js';\nimport { getRootSpan } from '../utils/getRootSpan.js';\nimport { spanToJSON, spanIsSampled } from '../utils/spanUtils.js';\n\n/**\n * Creates a dynamic sampling context from a client.\n *\n * Dispatches the `createDsc` lifecycle hook as a side effect.\n */\nfunction getDynamicSamplingContextFromClient(\n trace_id,\n client,\n scope,\n) {\n const options = client.getOptions();\n\n const { publicKey: public_key } = client.getDsn() || {};\n // TODO(v8): Remove segment from User\n // eslint-disable-next-line deprecation/deprecation\n const { segment: user_segment } = (scope && scope.getUser()) || {};\n\n const dsc = dropUndefinedKeys({\n environment: options.environment || DEFAULT_ENVIRONMENT,\n release: options.release,\n user_segment,\n public_key,\n trace_id,\n }) ;\n\n client.emit && client.emit('createDsc', dsc);\n\n return dsc;\n}\n\n/**\n * A Span with a frozen dynamic sampling context.\n */\n\n/**\n * Creates a dynamic sampling context from a span (and client and scope)\n *\n * @param span the span from which a few values like the root span name and sample rate are extracted.\n *\n * @returns a dynamic sampling context\n */\nfunction getDynamicSamplingContextFromSpan(span) {\n const client = getClient();\n if (!client) {\n return {};\n }\n\n // passing emit=false here to only emit later once the DSC is actually populated\n const dsc = getDynamicSamplingContextFromClient(spanToJSON(span).trace_id || '', client, getCurrentScope());\n\n // TODO (v8): Remove v7FrozenDsc as a Transaction will no longer have _frozenDynamicSamplingContext\n const txn = getRootSpan(span) ;\n if (!txn) {\n return dsc;\n }\n\n // TODO (v8): Remove v7FrozenDsc as a Transaction will no longer have _frozenDynamicSamplingContext\n // For now we need to avoid breaking users who directly created a txn with a DSC, where this field is still set.\n // @see Transaction class constructor\n const v7FrozenDsc = txn && txn._frozenDynamicSamplingContext;\n if (v7FrozenDsc) {\n return v7FrozenDsc;\n }\n\n // TODO (v8): Replace txn.metadata with txn.attributes[]\n // We can't do this yet because attributes aren't always set yet.\n // eslint-disable-next-line deprecation/deprecation\n const { sampleRate: maybeSampleRate, source } = txn.metadata;\n if (maybeSampleRate != null) {\n dsc.sample_rate = `${maybeSampleRate}`;\n }\n\n // We don't want to have a transaction name in the DSC if the source is \"url\" because URLs might contain PII\n const jsonSpan = spanToJSON(txn);\n\n // after JSON conversion, txn.name becomes jsonSpan.description\n if (source && source !== 'url') {\n dsc.transaction = jsonSpan.description;\n }\n\n dsc.sampled = String(spanIsSampled(txn));\n\n client.emit && client.emit('createDsc', dsc);\n\n return dsc;\n}\n\nexport { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan };\n//# sourceMappingURL=dynamicSamplingContext.js.map\n"],"names":["dropUndefinedKeys","DEFAULT_ENVIRONMENT","getClient","spanToJSON","getCurrentScope","getRootSpan","spanIsSampled"],"mappings":";;;;;;;AAWA,SAAS,oCACP,UACA,QACA,OACA;AACA,QAAM,UAAU,OAAO,WAAU;AAEjC,QAAM,EAAE,WAAW,WAAU,IAAK,OAAO,OAAM,KAAM,CAAA;AAGrD,QAAM,EAAE,SAAS,aAAY,IAAM,SAAS,MAAM,QAAO,KAAO,CAAA;AAEhE,QAAM,MAAMA,OAAAA,kBAAkB;AAAA,IAC5B,aAAa,QAAQ,eAAeC,UAAAA;AAAAA,IACpC,SAAS,QAAQ;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAG;AAED,SAAO,QAAQ,OAAO,KAAK,aAAa,GAAG;AAE3C,SAAO;AACT;AAaA,SAAS,kCAAkC,MAAM;AAC/C,QAAM,SAASC,UAAAA,UAAS;AACxB,MAAI,CAAC,QAAQ;AACX,WAAO,CAAA;AAAA,EACT;AAGA,QAAM,MAAM,oCAAoCC,UAAAA,WAAW,IAAI,EAAE,YAAY,IAAI,QAAQC,UAAAA,iBAAiB;AAG1G,QAAM,MAAMC,YAAAA,YAAY,IAAI;AAC5B,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AAKA,QAAM,cAAc,OAAO,IAAI;AAC/B,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAKA,QAAM,EAAE,YAAY,iBAAiB,OAAM,IAAK,IAAI;AACpD,MAAI,mBAAmB,MAAM;AAC3B,QAAI,cAAc,GAAG,eAAe;AAAA,EACtC;AAGA,QAAM,WAAWF,UAAAA,WAAW,GAAG;AAG/B,MAAI,UAAU,WAAW,OAAO;AAC9B,QAAI,cAAc,SAAS;AAAA,EAC7B;AAEA,MAAI,UAAU,OAAOG,UAAAA,cAAc,GAAG,CAAC;AAEvC,SAAO,QAAQ,OAAO,KAAK,aAAa,GAAG;AAE3C,SAAO;AACT;;;","x_google_ignoreList":[0]}
@@ -1,50 +0,0 @@
1
- import { DEFAULT_ENVIRONMENT } from "../constants.js";
2
- import { getClient, getCurrentScope } from "../exports.js";
3
- import { getRootSpan } from "../utils/getRootSpan.js";
4
- import { spanToJSON, spanIsSampled } from "../utils/spanUtils.js";
5
- import { dropUndefinedKeys } from "../../../utils/esm/object.js";
6
- function getDynamicSamplingContextFromClient(trace_id, client, scope) {
7
- const options = client.getOptions();
8
- const { publicKey: public_key } = client.getDsn() || {};
9
- const { segment: user_segment } = scope && scope.getUser() || {};
10
- const dsc = dropUndefinedKeys({
11
- environment: options.environment || DEFAULT_ENVIRONMENT,
12
- release: options.release,
13
- user_segment,
14
- public_key,
15
- trace_id
16
- });
17
- client.emit && client.emit("createDsc", dsc);
18
- return dsc;
19
- }
20
- function getDynamicSamplingContextFromSpan(span) {
21
- const client = getClient();
22
- if (!client) {
23
- return {};
24
- }
25
- const dsc = getDynamicSamplingContextFromClient(spanToJSON(span).trace_id || "", client, getCurrentScope());
26
- const txn = getRootSpan(span);
27
- if (!txn) {
28
- return dsc;
29
- }
30
- const v7FrozenDsc = txn && txn._frozenDynamicSamplingContext;
31
- if (v7FrozenDsc) {
32
- return v7FrozenDsc;
33
- }
34
- const { sampleRate: maybeSampleRate, source } = txn.metadata;
35
- if (maybeSampleRate != null) {
36
- dsc.sample_rate = `${maybeSampleRate}`;
37
- }
38
- const jsonSpan = spanToJSON(txn);
39
- if (source && source !== "url") {
40
- dsc.transaction = jsonSpan.description;
41
- }
42
- dsc.sampled = String(spanIsSampled(txn));
43
- client.emit && client.emit("createDsc", dsc);
44
- return dsc;
45
- }
46
- export {
47
- getDynamicSamplingContextFromClient,
48
- getDynamicSamplingContextFromSpan
49
- };
50
- //# sourceMappingURL=dynamicSamplingContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dynamicSamplingContext.js","sources":["../../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.js"],"sourcesContent":["import { dropUndefinedKeys } from '@sentry/utils';\nimport { DEFAULT_ENVIRONMENT } from '../constants.js';\nimport { getClient, getCurrentScope } from '../exports.js';\nimport { getRootSpan } from '../utils/getRootSpan.js';\nimport { spanToJSON, spanIsSampled } from '../utils/spanUtils.js';\n\n/**\n * Creates a dynamic sampling context from a client.\n *\n * Dispatches the `createDsc` lifecycle hook as a side effect.\n */\nfunction getDynamicSamplingContextFromClient(\n trace_id,\n client,\n scope,\n) {\n const options = client.getOptions();\n\n const { publicKey: public_key } = client.getDsn() || {};\n // TODO(v8): Remove segment from User\n // eslint-disable-next-line deprecation/deprecation\n const { segment: user_segment } = (scope && scope.getUser()) || {};\n\n const dsc = dropUndefinedKeys({\n environment: options.environment || DEFAULT_ENVIRONMENT,\n release: options.release,\n user_segment,\n public_key,\n trace_id,\n }) ;\n\n client.emit && client.emit('createDsc', dsc);\n\n return dsc;\n}\n\n/**\n * A Span with a frozen dynamic sampling context.\n */\n\n/**\n * Creates a dynamic sampling context from a span (and client and scope)\n *\n * @param span the span from which a few values like the root span name and sample rate are extracted.\n *\n * @returns a dynamic sampling context\n */\nfunction getDynamicSamplingContextFromSpan(span) {\n const client = getClient();\n if (!client) {\n return {};\n }\n\n // passing emit=false here to only emit later once the DSC is actually populated\n const dsc = getDynamicSamplingContextFromClient(spanToJSON(span).trace_id || '', client, getCurrentScope());\n\n // TODO (v8): Remove v7FrozenDsc as a Transaction will no longer have _frozenDynamicSamplingContext\n const txn = getRootSpan(span) ;\n if (!txn) {\n return dsc;\n }\n\n // TODO (v8): Remove v7FrozenDsc as a Transaction will no longer have _frozenDynamicSamplingContext\n // For now we need to avoid breaking users who directly created a txn with a DSC, where this field is still set.\n // @see Transaction class constructor\n const v7FrozenDsc = txn && txn._frozenDynamicSamplingContext;\n if (v7FrozenDsc) {\n return v7FrozenDsc;\n }\n\n // TODO (v8): Replace txn.metadata with txn.attributes[]\n // We can't do this yet because attributes aren't always set yet.\n // eslint-disable-next-line deprecation/deprecation\n const { sampleRate: maybeSampleRate, source } = txn.metadata;\n if (maybeSampleRate != null) {\n dsc.sample_rate = `${maybeSampleRate}`;\n }\n\n // We don't want to have a transaction name in the DSC if the source is \"url\" because URLs might contain PII\n const jsonSpan = spanToJSON(txn);\n\n // after JSON conversion, txn.name becomes jsonSpan.description\n if (source && source !== 'url') {\n dsc.transaction = jsonSpan.description;\n }\n\n dsc.sampled = String(spanIsSampled(txn));\n\n client.emit && client.emit('createDsc', dsc);\n\n return dsc;\n}\n\nexport { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan };\n//# sourceMappingURL=dynamicSamplingContext.js.map\n"],"names":[],"mappings":";;;;;AAWA,SAAS,oCACP,UACA,QACA,OACA;AACA,QAAM,UAAU,OAAO,WAAU;AAEjC,QAAM,EAAE,WAAW,WAAU,IAAK,OAAO,OAAM,KAAM,CAAA;AAGrD,QAAM,EAAE,SAAS,aAAY,IAAM,SAAS,MAAM,QAAO,KAAO,CAAA;AAEhE,QAAM,MAAM,kBAAkB;AAAA,IAC5B,aAAa,QAAQ,eAAe;AAAA,IACpC,SAAS,QAAQ;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAG;AAED,SAAO,QAAQ,OAAO,KAAK,aAAa,GAAG;AAE3C,SAAO;AACT;AAaA,SAAS,kCAAkC,MAAM;AAC/C,QAAM,SAAS,UAAS;AACxB,MAAI,CAAC,QAAQ;AACX,WAAO,CAAA;AAAA,EACT;AAGA,QAAM,MAAM,oCAAoC,WAAW,IAAI,EAAE,YAAY,IAAI,QAAQ,iBAAiB;AAG1G,QAAM,MAAM,YAAY,IAAI;AAC5B,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AAKA,QAAM,cAAc,OAAO,IAAI;AAC/B,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAKA,QAAM,EAAE,YAAY,iBAAiB,OAAM,IAAK,IAAI;AACpD,MAAI,mBAAmB,MAAM;AAC3B,QAAI,cAAc,GAAG,eAAe;AAAA,EACtC;AAGA,QAAM,WAAW,WAAW,GAAG;AAG/B,MAAI,UAAU,WAAW,OAAO;AAC9B,QAAI,cAAc,SAAS;AAAA,EAC7B;AAEA,MAAI,UAAU,OAAO,cAAc,GAAG,CAAC;AAEvC,SAAO,QAAQ,OAAO,KAAK,aAAa,GAAG;AAE3C,SAAO;AACT;","x_google_ignoreList":[0]}
@@ -1,85 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const dynamicSamplingContext = require("../tracing/dynamicSamplingContext.cjs");
4
- const getRootSpan = require("./getRootSpan.cjs");
5
- const spanUtils = require("./spanUtils.cjs");
6
- const object = require("../../../utils/esm/object.cjs");
7
- const misc = require("../../../utils/esm/misc.cjs");
8
- function applyScopeDataToEvent(event, data) {
9
- const { fingerprint, span, breadcrumbs, sdkProcessingMetadata } = data;
10
- applyDataToEvent(event, data);
11
- if (span) {
12
- applySpanToEvent(event, span);
13
- }
14
- applyFingerprintToEvent(event, fingerprint);
15
- applyBreadcrumbsToEvent(event, breadcrumbs);
16
- applySdkMetadataToEvent(event, sdkProcessingMetadata);
17
- }
18
- function applyDataToEvent(event, data) {
19
- const {
20
- extra,
21
- tags,
22
- user,
23
- contexts,
24
- level,
25
- // eslint-disable-next-line deprecation/deprecation
26
- transactionName
27
- } = data;
28
- const cleanedExtra = object.dropUndefinedKeys(extra);
29
- if (cleanedExtra && Object.keys(cleanedExtra).length) {
30
- event.extra = { ...cleanedExtra, ...event.extra };
31
- }
32
- const cleanedTags = object.dropUndefinedKeys(tags);
33
- if (cleanedTags && Object.keys(cleanedTags).length) {
34
- event.tags = { ...cleanedTags, ...event.tags };
35
- }
36
- const cleanedUser = object.dropUndefinedKeys(user);
37
- if (cleanedUser && Object.keys(cleanedUser).length) {
38
- event.user = { ...cleanedUser, ...event.user };
39
- }
40
- const cleanedContexts = object.dropUndefinedKeys(contexts);
41
- if (cleanedContexts && Object.keys(cleanedContexts).length) {
42
- event.contexts = { ...cleanedContexts, ...event.contexts };
43
- }
44
- if (level) {
45
- event.level = level;
46
- }
47
- if (transactionName) {
48
- event.transaction = transactionName;
49
- }
50
- }
51
- function applyBreadcrumbsToEvent(event, breadcrumbs) {
52
- const mergedBreadcrumbs = [...event.breadcrumbs || [], ...breadcrumbs];
53
- event.breadcrumbs = mergedBreadcrumbs.length ? mergedBreadcrumbs : void 0;
54
- }
55
- function applySdkMetadataToEvent(event, sdkProcessingMetadata) {
56
- event.sdkProcessingMetadata = {
57
- ...event.sdkProcessingMetadata,
58
- ...sdkProcessingMetadata
59
- };
60
- }
61
- function applySpanToEvent(event, span) {
62
- event.contexts = { trace: spanUtils.spanToTraceContext(span), ...event.contexts };
63
- const rootSpan = getRootSpan.getRootSpan(span);
64
- if (rootSpan) {
65
- event.sdkProcessingMetadata = {
66
- dynamicSamplingContext: dynamicSamplingContext.getDynamicSamplingContextFromSpan(span),
67
- ...event.sdkProcessingMetadata
68
- };
69
- const transactionName = spanUtils.spanToJSON(rootSpan).description;
70
- if (transactionName) {
71
- event.tags = { transaction: transactionName, ...event.tags };
72
- }
73
- }
74
- }
75
- function applyFingerprintToEvent(event, fingerprint) {
76
- event.fingerprint = event.fingerprint ? misc.arrayify(event.fingerprint) : [];
77
- if (fingerprint) {
78
- event.fingerprint = event.fingerprint.concat(fingerprint);
79
- }
80
- if (event.fingerprint && !event.fingerprint.length) {
81
- delete event.fingerprint;
82
- }
83
- }
84
- exports.applyScopeDataToEvent = applyScopeDataToEvent;
85
- //# sourceMappingURL=applyScopeDataToEvent.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"applyScopeDataToEvent.cjs","sources":["../../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.js"],"sourcesContent":["import { dropUndefinedKeys, arrayify } from '@sentry/utils';\nimport { getDynamicSamplingContextFromSpan } from '../tracing/dynamicSamplingContext.js';\nimport { getRootSpan } from './getRootSpan.js';\nimport { spanToTraceContext, spanToJSON } from './spanUtils.js';\n\n/**\n * Applies data from the scope to the event and runs all event processors on it.\n */\nfunction applyScopeDataToEvent(event, data) {\n const { fingerprint, span, breadcrumbs, sdkProcessingMetadata } = data;\n\n // Apply general data\n applyDataToEvent(event, data);\n\n // We want to set the trace context for normal events only if there isn't already\n // a trace context on the event. There is a product feature in place where we link\n // errors with transaction and it relies on that.\n if (span) {\n applySpanToEvent(event, span);\n }\n\n applyFingerprintToEvent(event, fingerprint);\n applyBreadcrumbsToEvent(event, breadcrumbs);\n applySdkMetadataToEvent(event, sdkProcessingMetadata);\n}\n\n/** Merge data of two scopes together. */\nfunction mergeScopeData(data, mergeData) {\n const {\n extra,\n tags,\n user,\n contexts,\n level,\n sdkProcessingMetadata,\n breadcrumbs,\n fingerprint,\n eventProcessors,\n attachments,\n propagationContext,\n // eslint-disable-next-line deprecation/deprecation\n transactionName,\n span,\n } = mergeData;\n\n mergeAndOverwriteScopeData(data, 'extra', extra);\n mergeAndOverwriteScopeData(data, 'tags', tags);\n mergeAndOverwriteScopeData(data, 'user', user);\n mergeAndOverwriteScopeData(data, 'contexts', contexts);\n mergeAndOverwriteScopeData(data, 'sdkProcessingMetadata', sdkProcessingMetadata);\n\n if (level) {\n data.level = level;\n }\n\n if (transactionName) {\n // eslint-disable-next-line deprecation/deprecation\n data.transactionName = transactionName;\n }\n\n if (span) {\n data.span = span;\n }\n\n if (breadcrumbs.length) {\n data.breadcrumbs = [...data.breadcrumbs, ...breadcrumbs];\n }\n\n if (fingerprint.length) {\n data.fingerprint = [...data.fingerprint, ...fingerprint];\n }\n\n if (eventProcessors.length) {\n data.eventProcessors = [...data.eventProcessors, ...eventProcessors];\n }\n\n if (attachments.length) {\n data.attachments = [...data.attachments, ...attachments];\n }\n\n data.propagationContext = { ...data.propagationContext, ...propagationContext };\n}\n\n/**\n * Merges certain scope data. Undefined values will overwrite any existing values.\n * Exported only for tests.\n */\nfunction mergeAndOverwriteScopeData\n\n(data, prop, mergeVal) {\n if (mergeVal && Object.keys(mergeVal).length) {\n // Clone object\n data[prop] = { ...data[prop] };\n for (const key in mergeVal) {\n if (Object.prototype.hasOwnProperty.call(mergeVal, key)) {\n data[prop][key] = mergeVal[key];\n }\n }\n }\n}\n\nfunction applyDataToEvent(event, data) {\n const {\n extra,\n tags,\n user,\n contexts,\n level,\n // eslint-disable-next-line deprecation/deprecation\n transactionName,\n } = data;\n\n const cleanedExtra = dropUndefinedKeys(extra);\n if (cleanedExtra && Object.keys(cleanedExtra).length) {\n event.extra = { ...cleanedExtra, ...event.extra };\n }\n\n const cleanedTags = dropUndefinedKeys(tags);\n if (cleanedTags && Object.keys(cleanedTags).length) {\n event.tags = { ...cleanedTags, ...event.tags };\n }\n\n const cleanedUser = dropUndefinedKeys(user);\n if (cleanedUser && Object.keys(cleanedUser).length) {\n event.user = { ...cleanedUser, ...event.user };\n }\n\n const cleanedContexts = dropUndefinedKeys(contexts);\n if (cleanedContexts && Object.keys(cleanedContexts).length) {\n event.contexts = { ...cleanedContexts, ...event.contexts };\n }\n\n if (level) {\n event.level = level;\n }\n\n if (transactionName) {\n event.transaction = transactionName;\n }\n}\n\nfunction applyBreadcrumbsToEvent(event, breadcrumbs) {\n const mergedBreadcrumbs = [...(event.breadcrumbs || []), ...breadcrumbs];\n event.breadcrumbs = mergedBreadcrumbs.length ? mergedBreadcrumbs : undefined;\n}\n\nfunction applySdkMetadataToEvent(event, sdkProcessingMetadata) {\n event.sdkProcessingMetadata = {\n ...event.sdkProcessingMetadata,\n ...sdkProcessingMetadata,\n };\n}\n\nfunction applySpanToEvent(event, span) {\n event.contexts = { trace: spanToTraceContext(span), ...event.contexts };\n const rootSpan = getRootSpan(span);\n if (rootSpan) {\n event.sdkProcessingMetadata = {\n dynamicSamplingContext: getDynamicSamplingContextFromSpan(span),\n ...event.sdkProcessingMetadata,\n };\n const transactionName = spanToJSON(rootSpan).description;\n if (transactionName) {\n event.tags = { transaction: transactionName, ...event.tags };\n }\n }\n}\n\n/**\n * Applies fingerprint from the scope to the event if there's one,\n * uses message if there's one instead or get rid of empty fingerprint\n */\nfunction applyFingerprintToEvent(event, fingerprint) {\n // Make sure it's an array first and we actually have something in place\n event.fingerprint = event.fingerprint ? arrayify(event.fingerprint) : [];\n\n // If we have something on the scope, then merge it with event\n if (fingerprint) {\n event.fingerprint = event.fingerprint.concat(fingerprint);\n }\n\n // If we have no data at all, remove empty array default\n if (event.fingerprint && !event.fingerprint.length) {\n delete event.fingerprint;\n }\n}\n\nexport { applyScopeDataToEvent, mergeAndOverwriteScopeData, mergeScopeData };\n//# sourceMappingURL=applyScopeDataToEvent.js.map\n"],"names":["dropUndefinedKeys","spanToTraceContext","getRootSpan","getDynamicSamplingContextFromSpan","spanToJSON","arrayify"],"mappings":";;;;;;;AAQA,SAAS,sBAAsB,OAAO,MAAM;AAC1C,QAAM,EAAE,aAAa,MAAM,aAAa,sBAAqB,IAAK;AAGlE,mBAAiB,OAAO,IAAI;AAK5B,MAAI,MAAM;AACR,qBAAiB,OAAO,IAAI;AAAA,EAC9B;AAEA,0BAAwB,OAAO,WAAW;AAC1C,0BAAwB,OAAO,WAAW;AAC1C,0BAAwB,OAAO,qBAAqB;AACtD;AA6EA,SAAS,iBAAiB,OAAO,MAAM;AACrC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,EACJ,IAAM;AAEJ,QAAM,eAAeA,OAAAA,kBAAkB,KAAK;AAC5C,MAAI,gBAAgB,OAAO,KAAK,YAAY,EAAE,QAAQ;AACpD,UAAM,QAAQ,EAAE,GAAG,cAAc,GAAG,MAAM,MAAK;AAAA,EACjD;AAEA,QAAM,cAAcA,OAAAA,kBAAkB,IAAI;AAC1C,MAAI,eAAe,OAAO,KAAK,WAAW,EAAE,QAAQ;AAClD,UAAM,OAAO,EAAE,GAAG,aAAa,GAAG,MAAM,KAAI;AAAA,EAC9C;AAEA,QAAM,cAAcA,OAAAA,kBAAkB,IAAI;AAC1C,MAAI,eAAe,OAAO,KAAK,WAAW,EAAE,QAAQ;AAClD,UAAM,OAAO,EAAE,GAAG,aAAa,GAAG,MAAM,KAAI;AAAA,EAC9C;AAEA,QAAM,kBAAkBA,OAAAA,kBAAkB,QAAQ;AAClD,MAAI,mBAAmB,OAAO,KAAK,eAAe,EAAE,QAAQ;AAC1D,UAAM,WAAW,EAAE,GAAG,iBAAiB,GAAG,MAAM,SAAQ;AAAA,EAC1D;AAEA,MAAI,OAAO;AACT,UAAM,QAAQ;AAAA,EAChB;AAEA,MAAI,iBAAiB;AACnB,UAAM,cAAc;AAAA,EACtB;AACF;AAEA,SAAS,wBAAwB,OAAO,aAAa;AACnD,QAAM,oBAAoB,CAAC,GAAI,MAAM,eAAe,CAAA,GAAK,GAAG,WAAW;AACvE,QAAM,cAAc,kBAAkB,SAAS,oBAAoB;AACrE;AAEA,SAAS,wBAAwB,OAAO,uBAAuB;AAC7D,QAAM,wBAAwB;AAAA,IAC5B,GAAG,MAAM;AAAA,IACT,GAAG;AAAA,EACP;AACA;AAEA,SAAS,iBAAiB,OAAO,MAAM;AACrC,QAAM,WAAW,EAAE,OAAOC,UAAAA,mBAAmB,IAAI,GAAG,GAAG,MAAM,SAAQ;AACrE,QAAM,WAAWC,YAAAA,YAAY,IAAI;AACjC,MAAI,UAAU;AACZ,UAAM,wBAAwB;AAAA,MAC5B,wBAAwBC,uBAAAA,kCAAkC,IAAI;AAAA,MAC9D,GAAG,MAAM;AAAA,IACf;AACI,UAAM,kBAAkBC,UAAAA,WAAW,QAAQ,EAAE;AAC7C,QAAI,iBAAiB;AACnB,YAAM,OAAO,EAAE,aAAa,iBAAiB,GAAG,MAAM,KAAI;AAAA,IAC5D;AAAA,EACF;AACF;AAMA,SAAS,wBAAwB,OAAO,aAAa;AAEnD,QAAM,cAAc,MAAM,cAAcC,KAAAA,SAAS,MAAM,WAAW,IAAI,CAAA;AAGtE,MAAI,aAAa;AACf,UAAM,cAAc,MAAM,YAAY,OAAO,WAAW;AAAA,EAC1D;AAGA,MAAI,MAAM,eAAe,CAAC,MAAM,YAAY,QAAQ;AAClD,WAAO,MAAM;AAAA,EACf;AACF;;","x_google_ignoreList":[0]}
@@ -1,85 +0,0 @@
1
- import { getDynamicSamplingContextFromSpan } from "../tracing/dynamicSamplingContext.js";
2
- import { getRootSpan } from "./getRootSpan.js";
3
- import { spanToTraceContext, spanToJSON } from "./spanUtils.js";
4
- import { dropUndefinedKeys } from "../../../utils/esm/object.js";
5
- import { arrayify } from "../../../utils/esm/misc.js";
6
- function applyScopeDataToEvent(event, data) {
7
- const { fingerprint, span, breadcrumbs, sdkProcessingMetadata } = data;
8
- applyDataToEvent(event, data);
9
- if (span) {
10
- applySpanToEvent(event, span);
11
- }
12
- applyFingerprintToEvent(event, fingerprint);
13
- applyBreadcrumbsToEvent(event, breadcrumbs);
14
- applySdkMetadataToEvent(event, sdkProcessingMetadata);
15
- }
16
- function applyDataToEvent(event, data) {
17
- const {
18
- extra,
19
- tags,
20
- user,
21
- contexts,
22
- level,
23
- // eslint-disable-next-line deprecation/deprecation
24
- transactionName
25
- } = data;
26
- const cleanedExtra = dropUndefinedKeys(extra);
27
- if (cleanedExtra && Object.keys(cleanedExtra).length) {
28
- event.extra = { ...cleanedExtra, ...event.extra };
29
- }
30
- const cleanedTags = dropUndefinedKeys(tags);
31
- if (cleanedTags && Object.keys(cleanedTags).length) {
32
- event.tags = { ...cleanedTags, ...event.tags };
33
- }
34
- const cleanedUser = dropUndefinedKeys(user);
35
- if (cleanedUser && Object.keys(cleanedUser).length) {
36
- event.user = { ...cleanedUser, ...event.user };
37
- }
38
- const cleanedContexts = dropUndefinedKeys(contexts);
39
- if (cleanedContexts && Object.keys(cleanedContexts).length) {
40
- event.contexts = { ...cleanedContexts, ...event.contexts };
41
- }
42
- if (level) {
43
- event.level = level;
44
- }
45
- if (transactionName) {
46
- event.transaction = transactionName;
47
- }
48
- }
49
- function applyBreadcrumbsToEvent(event, breadcrumbs) {
50
- const mergedBreadcrumbs = [...event.breadcrumbs || [], ...breadcrumbs];
51
- event.breadcrumbs = mergedBreadcrumbs.length ? mergedBreadcrumbs : void 0;
52
- }
53
- function applySdkMetadataToEvent(event, sdkProcessingMetadata) {
54
- event.sdkProcessingMetadata = {
55
- ...event.sdkProcessingMetadata,
56
- ...sdkProcessingMetadata
57
- };
58
- }
59
- function applySpanToEvent(event, span) {
60
- event.contexts = { trace: spanToTraceContext(span), ...event.contexts };
61
- const rootSpan = getRootSpan(span);
62
- if (rootSpan) {
63
- event.sdkProcessingMetadata = {
64
- dynamicSamplingContext: getDynamicSamplingContextFromSpan(span),
65
- ...event.sdkProcessingMetadata
66
- };
67
- const transactionName = spanToJSON(rootSpan).description;
68
- if (transactionName) {
69
- event.tags = { transaction: transactionName, ...event.tags };
70
- }
71
- }
72
- }
73
- function applyFingerprintToEvent(event, fingerprint) {
74
- event.fingerprint = event.fingerprint ? arrayify(event.fingerprint) : [];
75
- if (fingerprint) {
76
- event.fingerprint = event.fingerprint.concat(fingerprint);
77
- }
78
- if (event.fingerprint && !event.fingerprint.length) {
79
- delete event.fingerprint;
80
- }
81
- }
82
- export {
83
- applyScopeDataToEvent
84
- };
85
- //# sourceMappingURL=applyScopeDataToEvent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"applyScopeDataToEvent.js","sources":["../../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.js"],"sourcesContent":["import { dropUndefinedKeys, arrayify } from '@sentry/utils';\nimport { getDynamicSamplingContextFromSpan } from '../tracing/dynamicSamplingContext.js';\nimport { getRootSpan } from './getRootSpan.js';\nimport { spanToTraceContext, spanToJSON } from './spanUtils.js';\n\n/**\n * Applies data from the scope to the event and runs all event processors on it.\n */\nfunction applyScopeDataToEvent(event, data) {\n const { fingerprint, span, breadcrumbs, sdkProcessingMetadata } = data;\n\n // Apply general data\n applyDataToEvent(event, data);\n\n // We want to set the trace context for normal events only if there isn't already\n // a trace context on the event. There is a product feature in place where we link\n // errors with transaction and it relies on that.\n if (span) {\n applySpanToEvent(event, span);\n }\n\n applyFingerprintToEvent(event, fingerprint);\n applyBreadcrumbsToEvent(event, breadcrumbs);\n applySdkMetadataToEvent(event, sdkProcessingMetadata);\n}\n\n/** Merge data of two scopes together. */\nfunction mergeScopeData(data, mergeData) {\n const {\n extra,\n tags,\n user,\n contexts,\n level,\n sdkProcessingMetadata,\n breadcrumbs,\n fingerprint,\n eventProcessors,\n attachments,\n propagationContext,\n // eslint-disable-next-line deprecation/deprecation\n transactionName,\n span,\n } = mergeData;\n\n mergeAndOverwriteScopeData(data, 'extra', extra);\n mergeAndOverwriteScopeData(data, 'tags', tags);\n mergeAndOverwriteScopeData(data, 'user', user);\n mergeAndOverwriteScopeData(data, 'contexts', contexts);\n mergeAndOverwriteScopeData(data, 'sdkProcessingMetadata', sdkProcessingMetadata);\n\n if (level) {\n data.level = level;\n }\n\n if (transactionName) {\n // eslint-disable-next-line deprecation/deprecation\n data.transactionName = transactionName;\n }\n\n if (span) {\n data.span = span;\n }\n\n if (breadcrumbs.length) {\n data.breadcrumbs = [...data.breadcrumbs, ...breadcrumbs];\n }\n\n if (fingerprint.length) {\n data.fingerprint = [...data.fingerprint, ...fingerprint];\n }\n\n if (eventProcessors.length) {\n data.eventProcessors = [...data.eventProcessors, ...eventProcessors];\n }\n\n if (attachments.length) {\n data.attachments = [...data.attachments, ...attachments];\n }\n\n data.propagationContext = { ...data.propagationContext, ...propagationContext };\n}\n\n/**\n * Merges certain scope data. Undefined values will overwrite any existing values.\n * Exported only for tests.\n */\nfunction mergeAndOverwriteScopeData\n\n(data, prop, mergeVal) {\n if (mergeVal && Object.keys(mergeVal).length) {\n // Clone object\n data[prop] = { ...data[prop] };\n for (const key in mergeVal) {\n if (Object.prototype.hasOwnProperty.call(mergeVal, key)) {\n data[prop][key] = mergeVal[key];\n }\n }\n }\n}\n\nfunction applyDataToEvent(event, data) {\n const {\n extra,\n tags,\n user,\n contexts,\n level,\n // eslint-disable-next-line deprecation/deprecation\n transactionName,\n } = data;\n\n const cleanedExtra = dropUndefinedKeys(extra);\n if (cleanedExtra && Object.keys(cleanedExtra).length) {\n event.extra = { ...cleanedExtra, ...event.extra };\n }\n\n const cleanedTags = dropUndefinedKeys(tags);\n if (cleanedTags && Object.keys(cleanedTags).length) {\n event.tags = { ...cleanedTags, ...event.tags };\n }\n\n const cleanedUser = dropUndefinedKeys(user);\n if (cleanedUser && Object.keys(cleanedUser).length) {\n event.user = { ...cleanedUser, ...event.user };\n }\n\n const cleanedContexts = dropUndefinedKeys(contexts);\n if (cleanedContexts && Object.keys(cleanedContexts).length) {\n event.contexts = { ...cleanedContexts, ...event.contexts };\n }\n\n if (level) {\n event.level = level;\n }\n\n if (transactionName) {\n event.transaction = transactionName;\n }\n}\n\nfunction applyBreadcrumbsToEvent(event, breadcrumbs) {\n const mergedBreadcrumbs = [...(event.breadcrumbs || []), ...breadcrumbs];\n event.breadcrumbs = mergedBreadcrumbs.length ? mergedBreadcrumbs : undefined;\n}\n\nfunction applySdkMetadataToEvent(event, sdkProcessingMetadata) {\n event.sdkProcessingMetadata = {\n ...event.sdkProcessingMetadata,\n ...sdkProcessingMetadata,\n };\n}\n\nfunction applySpanToEvent(event, span) {\n event.contexts = { trace: spanToTraceContext(span), ...event.contexts };\n const rootSpan = getRootSpan(span);\n if (rootSpan) {\n event.sdkProcessingMetadata = {\n dynamicSamplingContext: getDynamicSamplingContextFromSpan(span),\n ...event.sdkProcessingMetadata,\n };\n const transactionName = spanToJSON(rootSpan).description;\n if (transactionName) {\n event.tags = { transaction: transactionName, ...event.tags };\n }\n }\n}\n\n/**\n * Applies fingerprint from the scope to the event if there's one,\n * uses message if there's one instead or get rid of empty fingerprint\n */\nfunction applyFingerprintToEvent(event, fingerprint) {\n // Make sure it's an array first and we actually have something in place\n event.fingerprint = event.fingerprint ? arrayify(event.fingerprint) : [];\n\n // If we have something on the scope, then merge it with event\n if (fingerprint) {\n event.fingerprint = event.fingerprint.concat(fingerprint);\n }\n\n // If we have no data at all, remove empty array default\n if (event.fingerprint && !event.fingerprint.length) {\n delete event.fingerprint;\n }\n}\n\nexport { applyScopeDataToEvent, mergeAndOverwriteScopeData, mergeScopeData };\n//# sourceMappingURL=applyScopeDataToEvent.js.map\n"],"names":[],"mappings":";;;;;AAQA,SAAS,sBAAsB,OAAO,MAAM;AAC1C,QAAM,EAAE,a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AAO,uBAAuB;AAC7D,QAAM,wBAAwB;AAAA,IAC5B,GAAG,MAAM;AAAA,IACT,GAAG;AAAA,EACP;AACA;AAEA,SAAS,iBAAiB,OAAO,MAAM;AACrC,QAAM,WAAW,EAAE,OAAO,mBAAmB,IAAI,GAAG,GAAG,MAAM,SAAQ;AACrE,QAAM,WAAW,YAAY,IAAI;AACjC,MAAI,UAAU;AACZ,UAAM,wBAAwB;AAAA,MAC5B,wBAAwB,kCAAkC,IAAI;AAAA,MAC9D,GAAG,MAAM;AAAA,IACf;AACI,UAAM,kBAAkB,WAAW,QAAQ,EAAE;AAC7C,QAAI,iBAAiB;AACnB,YAAM,OAAO,EAAE,aAAa,iBAAiB,GAAG,MAAM,KAAI;AAAA,IAC5D;AAAA,EACF;AACF;AAMA,SAAS,wBAAwB,OAAO,aAAa;AAEnD,QAAM,cAAc,MAAM,cAAc,SAAS,MAAM,WAAW,IAAI,CAAA;AAGtE,MAAI,aAAa;AACf,UAAM,cAAc,MAAM,YAAY,OAAO,WAAW;AAAA,EAC1D;AAGA,MAAI,MAAM,eAAe,CAAC,MAAM,YAAY,QAAQ;AAClD,WAAO,MAAM;AAAA,EACf;AACF;","x_google_ignoreList":[0]}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function getRootSpan(span) {
4
- return span.transaction;
5
- }
6
- exports.getRootSpan = getRootSpan;
7
- //# sourceMappingURL=getRootSpan.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRootSpan.cjs","sources":["../../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/utils/getRootSpan.js"],"sourcesContent":["/**\n * Returns the root span of a given span.\n *\n * As long as we use `Transaction`s internally, the returned root span\n * will be a `Transaction` but be aware that this might change in the future.\n *\n * If the given span has no root span or transaction, `undefined` is returned.\n */\nfunction getRootSpan(span) {\n // TODO (v8): Remove this check and just return span\n // eslint-disable-next-line deprecation/deprecation\n return span.transaction;\n}\n\nexport { getRootSpan };\n//# sourceMappingURL=getRootSpan.js.map\n"],"names":[],"mappings":";;AAQA,SAAS,YAAY,MAAM;AAGzB,SAAO,KAAK;AACd;;","x_google_ignoreList":[0]}
@@ -1,7 +0,0 @@
1
- function getRootSpan(span) {
2
- return span.transaction;
3
- }
4
- export {
5
- getRootSpan
6
- };
7
- //# sourceMappingURL=getRootSpan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRootSpan.js","sources":["../../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/utils/getRootSpan.js"],"sourcesContent":["/**\n * Returns the root span of a given span.\n *\n * As long as we use `Transaction`s internally, the returned root span\n * will be a `Transaction` but be aware that this might change in the future.\n *\n * If the given span has no root span or transaction, `undefined` is returned.\n */\nfunction getRootSpan(span) {\n // TODO (v8): Remove this check and just return span\n // eslint-disable-next-line deprecation/deprecation\n return span.transaction;\n}\n\nexport { getRootSpan };\n//# sourceMappingURL=getRootSpan.js.map\n"],"names":[],"mappings":"AAQA,SAAS,YAAY,MAAM;AAGzB,SAAO,KAAK;AACd;","x_google_ignoreList":[0]}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const scope = require("../scope.cjs");
4
- function parseEventHintOrCaptureContext(hint) {
5
- if (!hint) {
6
- return void 0;
7
- }
8
- if (hintIsScopeOrFunction(hint)) {
9
- return { captureContext: hint };
10
- }
11
- if (hintIsScopeContext(hint)) {
12
- return {
13
- captureContext: hint
14
- };
15
- }
16
- return hint;
17
- }
18
- function hintIsScopeOrFunction(hint) {
19
- return hint instanceof scope.Scope || typeof hint === "function";
20
- }
21
- const captureContextKeys = [
22
- "user",
23
- "level",
24
- "extra",
25
- "contexts",
26
- "tags",
27
- "fingerprint",
28
- "requestSession",
29
- "propagationContext"
30
- ];
31
- function hintIsScopeContext(hint) {
32
- return Object.keys(hint).some((key) => captureContextKeys.includes(key));
33
- }
34
- exports.parseEventHintOrCaptureContext = parseEventHintOrCaptureContext;
35
- //# sourceMappingURL=prepareEvent.cjs.map