@inventreedb/ui 0.10.1 → 0.11.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.
- package/CHANGELOG.md +4 -0
- package/dist/.vite/manifest.json +444 -1
- package/dist/components/Boundary.d.ts +10 -0
- package/dist/components/Boundary.js +37 -0
- package/dist/components/Boundary.js.map +1 -0
- package/dist/components/CopyButton.d.ts +13 -0
- package/dist/components/CopyButton.js +51 -0
- package/dist/components/CopyButton.js.map +1 -0
- package/dist/components/CopyableCell.d.ts +11 -0
- package/dist/components/CopyableCell.js +24 -0
- package/dist/components/CopyableCell.js.map +1 -0
- package/dist/components/InvenTreeTable.d.ts +17 -0
- package/dist/components/InvenTreeTable.js +41 -0
- package/dist/components/InvenTreeTable.js.map +1 -0
- package/dist/components/TableColumnSelect.d.ts +4 -0
- package/dist/components/TableColumnSelect.js +38 -0
- package/dist/components/TableColumnSelect.js.map +1 -0
- package/dist/enums/ApiEndpoints.d.ts +1 -1
- package/dist/enums/ApiEndpoints.js +1 -1
- package/dist/enums/ApiEndpoints.js.map +1 -1
- package/dist/enums/ModelInformation.js +17 -0
- package/dist/enums/ModelInformation.js.map +1 -1
- package/dist/enums/ModelType.d.ts +1 -0
- package/dist/enums/ModelType.js +1 -0
- package/dist/enums/ModelType.js.map +1 -1
- package/dist/functions/Forms.d.ts +11 -0
- package/dist/functions/Forms.js +27 -0
- package/dist/functions/Forms.js.map +1 -0
- package/dist/functions/Notification.d.ts +16 -0
- package/dist/functions/Notification.js +82 -0
- package/dist/functions/Notification.js.map +1 -0
- package/dist/functions/String.d.ts +13 -0
- package/dist/functions/String.js +25 -0
- package/dist/functions/String.js.map +1 -0
- package/dist/hooks/UseFilterSet.d.ts +2 -0
- package/dist/hooks/UseFilterSet.js +35 -0
- package/dist/hooks/UseFilterSet.js.map +1 -0
- package/dist/hooks/UseTable.d.ts +12 -0
- package/dist/hooks/UseTable.js +92 -0
- package/dist/hooks/UseTable.js.map +1 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.js +32 -4
- package/dist/index.js.map +1 -1
- package/dist/node_modules/@mantine/hooks/esm/use-local-storage/create-storage.js +129 -0
- package/dist/node_modules/@mantine/hooks/esm/use-local-storage/create-storage.js.map +1 -0
- package/dist/node_modules/@mantine/hooks/esm/use-local-storage/use-local-storage.js +8 -0
- package/dist/node_modules/@mantine/hooks/esm/use-local-storage/use-local-storage.js.map +1 -0
- package/dist/node_modules/@mantine/hooks/esm/use-window-event/use-window-event.js +11 -0
- package/dist/node_modules/@mantine/hooks/esm/use-window-event/use-window-event.js.map +1 -0
- package/dist/node_modules/@mantine/hooks/esm/utils/random-id/random-id.js +7 -0
- package/dist/node_modules/@mantine/hooks/esm/utils/random-id/random-id.js.map +1 -0
- package/dist/node_modules/@remix-run/router/dist/router.js +272 -0
- package/dist/node_modules/@remix-run/router/dist/router.js.map +1 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/debug-build.js +5 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/debug-build.js.map +1 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/helpers.js +6 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/helpers.js.map +1 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/report-dialog.js +54 -0
- package/dist/node_modules/@sentry/browser/build/npm/esm/prod/report-dialog.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/api.js +41 -0
- package/dist/node_modules/@sentry/core/build/esm/api.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/asyncContext/index.js +13 -0
- package/dist/node_modules/@sentry/core/build/esm/asyncContext/index.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js +124 -0
- package/dist/node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/carrier.js +22 -0
- package/dist/node_modules/@sentry/core/build/esm/carrier.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/currentScopes.js +34 -0
- package/dist/node_modules/@sentry/core/build/esm/currentScopes.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/debug-build.js +5 -0
- package/dist/node_modules/@sentry/core/build/esm/debug-build.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/defaultScopes.js +13 -0
- package/dist/node_modules/@sentry/core/build/esm/defaultScopes.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/exports.js +13 -0
- package/dist/node_modules/@sentry/core/build/esm/exports.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/scope.js +577 -0
- package/dist/node_modules/@sentry/core/build/esm/scope.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/session.js +61 -0
- package/dist/node_modules/@sentry/core/build/esm/session.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/chain-and-copy-promiselike.js +39 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/chain-and-copy-promiselike.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/debug-logger.js +79 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/debug-logger.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/dsn.js +88 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/dsn.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/is.js +35 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/is.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/merge.js +19 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/merge.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/misc.js +32 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/misc.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/object.js +18 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/object.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/prepareEvent.js +34 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/prepareEvent.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/propagationContext.js +8 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/propagationContext.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/randomSafeContext.js +27 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/randomSafeContext.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/spanOnScope.js +17 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/spanOnScope.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/string.js +10 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/string.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/time.js +26 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/time.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/version.js +5 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/version.js.map +1 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/worldwide.js +5 -0
- package/dist/node_modules/@sentry/core/build/esm/utils/worldwide.js.map +1 -0
- package/dist/node_modules/@sentry/react/build/esm/debug-build.js +5 -0
- package/dist/node_modules/@sentry/react/build/esm/debug-build.js.map +1 -0
- package/dist/node_modules/@sentry/react/build/esm/error.js +40 -0
- package/dist/node_modules/@sentry/react/build/esm/error.js.map +1 -0
- package/dist/node_modules/@sentry/react/build/esm/errorboundary.js +103 -0
- package/dist/node_modules/@sentry/react/build/esm/errorboundary.js.map +1 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustments.js +8 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustments.js.map +1 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +8 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js.map +1 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleX.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleX.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js.map +1 -1
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +0 -6
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js.map +1 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +1 -10
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js.map +1 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +1 -10
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.js.map +1 -1
- package/dist/node_modules/react-router/dist/index.js +377 -0
- package/dist/node_modules/react-router/dist/index.js.map +1 -0
- package/dist/node_modules/react-router-dom/dist/index.js +560 -0
- package/dist/node_modules/react-router-dom/dist/index.js.map +1 -0
- package/dist/node_modules/zustand/esm/middleware.js +202 -0
- package/dist/node_modules/zustand/esm/middleware.js.map +1 -0
- package/dist/node_modules/zustand/esm/react.js +24 -0
- package/dist/node_modules/zustand/esm/react.js.map +1 -0
- package/dist/node_modules/zustand/esm/vanilla.js +26 -0
- package/dist/node_modules/zustand/esm/vanilla.js.map +1 -0
- package/dist/states/StoredTableState.d.ts +37 -0
- package/dist/states/StoredTableState.js +58 -0
- package/dist/states/StoredTableState.js.map +1 -0
- package/dist/types/Forms.d.ts +2 -0
- package/dist/types/Plugins.d.ts +14 -7
- package/dist/types/Plugins.js +1 -1
- package/dist/types/Plugins.js.map +1 -1
- package/dist/types/Tables.d.ts +10 -0
- package/lib/components/Boundary.tsx +46 -0
- package/lib/components/CopyButton.tsx +76 -0
- package/lib/components/CopyableCell.tsx +51 -0
- package/lib/components/InvenTreeTable.tsx +63 -0
- package/lib/components/TableColumnSelect.tsx +40 -0
- package/lib/enums/ApiEndpoints.tsx +1 -1
- package/lib/enums/ModelInformation.tsx +7 -0
- package/lib/enums/ModelType.tsx +1 -0
- package/lib/functions/Forms.tsx +47 -0
- package/lib/functions/Notification.tsx +50 -0
- package/lib/functions/String.tsx +38 -0
- package/lib/hooks/UseFilterSet.tsx +47 -0
- package/lib/hooks/UseTable.tsx +160 -0
- package/lib/index.ts +49 -1
- package/lib/states/StoredTableState.tsx +91 -0
- package/lib/types/Forms.tsx +2 -0
- package/lib/types/Plugins.tsx +15 -7
- package/lib/types/Tables.tsx +11 -0
- package/package.json +2 -2
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { DEBUG_BUILD } from "./debug-build.js";
|
|
2
|
+
import { WINDOW } from "./helpers.js";
|
|
3
|
+
import { debug } from "../../../../../core/build/esm/utils/debug-logger.js";
|
|
4
|
+
import { getCurrentScope, getClient } from "../../../../../core/build/esm/currentScopes.js";
|
|
5
|
+
import { lastEventId } from "../../../../../core/build/esm/exports.js";
|
|
6
|
+
import { getReportDialogEndpoint } from "../../../../../core/build/esm/api.js";
|
|
7
|
+
function showReportDialog(options = {}) {
|
|
8
|
+
const optionalDocument = WINDOW.document;
|
|
9
|
+
const injectionPoint = optionalDocument?.head || optionalDocument?.body;
|
|
10
|
+
if (!injectionPoint) {
|
|
11
|
+
DEBUG_BUILD && debug.error("[showReportDialog] Global document not defined");
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const scope = getCurrentScope();
|
|
15
|
+
const client = getClient();
|
|
16
|
+
const dsn = client?.getDsn();
|
|
17
|
+
if (!dsn) {
|
|
18
|
+
DEBUG_BUILD && debug.error("[showReportDialog] DSN not configured");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const mergedOptions = {
|
|
22
|
+
...options,
|
|
23
|
+
user: {
|
|
24
|
+
...scope.getUser(),
|
|
25
|
+
...options.user
|
|
26
|
+
},
|
|
27
|
+
eventId: options.eventId || lastEventId()
|
|
28
|
+
};
|
|
29
|
+
const script = WINDOW.document.createElement("script");
|
|
30
|
+
script.async = true;
|
|
31
|
+
script.crossOrigin = "anonymous";
|
|
32
|
+
script.src = getReportDialogEndpoint(dsn, mergedOptions);
|
|
33
|
+
const { onLoad, onClose } = mergedOptions;
|
|
34
|
+
if (onLoad) {
|
|
35
|
+
script.onload = onLoad;
|
|
36
|
+
}
|
|
37
|
+
if (onClose) {
|
|
38
|
+
const reportDialogClosedMessageHandler = (event) => {
|
|
39
|
+
if (event.data === "__sentry_reportdialog_closed__") {
|
|
40
|
+
try {
|
|
41
|
+
onClose();
|
|
42
|
+
} finally {
|
|
43
|
+
WINDOW.removeEventListener("message", reportDialogClosedMessageHandler);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
WINDOW.addEventListener("message", reportDialogClosedMessageHandler);
|
|
48
|
+
}
|
|
49
|
+
injectionPoint.appendChild(script);
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
showReportDialog
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=report-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-dialog.js","sources":["../../../../../../../../node_modules/@sentry/browser/build/npm/esm/prod/report-dialog.js"],"sourcesContent":["import { debug, getCurrentScope, getClient, lastEventId, getReportDialogEndpoint } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { WINDOW } from './helpers.js';\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the current scope.\n */\nfunction showReportDialog(options = {}) {\n const optionalDocument = WINDOW.document ;\n const injectionPoint = optionalDocument?.head || optionalDocument?.body;\n\n // doesn't work without a document (React Native)\n if (!injectionPoint) {\n DEBUG_BUILD && debug.error('[showReportDialog] Global document not defined');\n return;\n }\n\n const scope = getCurrentScope();\n const client = getClient();\n const dsn = client?.getDsn();\n\n if (!dsn) {\n DEBUG_BUILD && debug.error('[showReportDialog] DSN not configured');\n return;\n }\n\n const mergedOptions = {\n ...options,\n user: {\n ...scope.getUser(),\n ...options.user,\n },\n eventId: options.eventId || lastEventId(),\n };\n\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, mergedOptions);\n\n const { onLoad, onClose } = mergedOptions;\n\n if (onLoad) {\n script.onload = onLoad;\n }\n\n if (onClose) {\n const reportDialogClosedMessageHandler = (event) => {\n if (event.data === '__sentry_reportdialog_closed__') {\n try {\n onClose();\n } finally {\n WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);\n }\n }\n };\n WINDOW.addEventListener('message', reportDialogClosedMessageHandler);\n }\n\n injectionPoint.appendChild(script);\n}\n\nexport { showReportDialog };\n//# sourceMappingURL=report-dialog.js.map\n"],"names":[],"mappings":";;;;;;AASA,SAAS,iBAAiB,UAAU,IAAI;AACtC,QAAM,mBAAmB,OAAO;AAChC,QAAM,iBAAiB,kBAAkB,QAAQ,kBAAkB;AAGnE,MAAI,CAAC,gBAAgB;AACnB,mBAAe,MAAM,MAAM,gDAAgD;AAC3E;AAAA,EACF;AAEA,QAAM,QAAQ,gBAAe;AAC7B,QAAM,SAAS,UAAS;AACxB,QAAM,MAAM,QAAQ,OAAM;AAE1B,MAAI,CAAC,KAAK;AACR,mBAAe,MAAM,MAAM,uCAAuC;AAClE;AAAA,EACF;AAEA,QAAM,gBAAgB;AAAA,IACpB,GAAG;AAAA,IACH,MAAM;AAAA,MACJ,GAAG,MAAM,QAAO;AAAA,MAChB,GAAG,QAAQ;AAAA,IACjB;AAAA,IACI,SAAS,QAAQ,WAAW,YAAW;AAAA,EAC3C;AAEE,QAAM,SAAS,OAAO,SAAS,cAAc,QAAQ;AACrD,SAAO,QAAQ;AACf,SAAO,cAAc;AACrB,SAAO,MAAM,wBAAwB,KAAK,aAAa;AAEvD,QAAM,EAAE,QAAQ,QAAO,IAAK;AAE5B,MAAI,QAAQ;AACV,WAAO,SAAS;AAAA,EAClB;AAEA,MAAI,SAAS;AACX,UAAM,mCAAmC,CAAC,UAAU;AAClD,UAAI,MAAM,SAAS,kCAAkC;AACnD,YAAI;AACF,kBAAO;AAAA,QACT,UAAC;AACC,iBAAO,oBAAoB,WAAW,gCAAgC;AAAA,QACxE;AAAA,MACF;AAAA,IACF;AACA,WAAO,iBAAiB,WAAW,gCAAgC;AAAA,EACrE;AAEA,iBAAe,YAAY,MAAM;AACnC;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { makeDsn, dsnToString } from "./utils/dsn.js";
|
|
2
|
+
function getBaseApiEndpoint(dsn) {
|
|
3
|
+
const protocol = dsn.protocol ? `${dsn.protocol}:` : "";
|
|
4
|
+
const port = dsn.port ? `:${dsn.port}` : "";
|
|
5
|
+
return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ""}/api/`;
|
|
6
|
+
}
|
|
7
|
+
function getReportDialogEndpoint(dsnLike, dialogOptions) {
|
|
8
|
+
const dsn = makeDsn(dsnLike);
|
|
9
|
+
if (!dsn) {
|
|
10
|
+
return "";
|
|
11
|
+
}
|
|
12
|
+
const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`;
|
|
13
|
+
let encodedOptions = `dsn=${dsnToString(dsn)}`;
|
|
14
|
+
for (const key in dialogOptions) {
|
|
15
|
+
if (key === "dsn") {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (key === "onClose") {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (key === "user") {
|
|
22
|
+
const user = dialogOptions.user;
|
|
23
|
+
if (!user) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (user.name) {
|
|
27
|
+
encodedOptions += `&name=${encodeURIComponent(user.name)}`;
|
|
28
|
+
}
|
|
29
|
+
if (user.email) {
|
|
30
|
+
encodedOptions += `&email=${encodeURIComponent(user.email)}`;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key])}`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return `${endpoint}?${encodedOptions}`;
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
getReportDialogEndpoint
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sources":["../../../../../../node_modules/@sentry/core/build/esm/api.js"],"sourcesContent":["import { makeDsn, dsnToString } from './utils/dsn.js';\n\nconst SENTRY_API_VERSION = '7';\n\n/** Returns the prefix to construct Sentry ingestion API endpoints. */\nfunction getBaseApiEndpoint(dsn) {\n const protocol = dsn.protocol ? `${dsn.protocol}:` : '';\n const port = dsn.port ? `:${dsn.port}` : '';\n return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;\n}\n\n/** Returns the ingest API endpoint for target. */\nfunction _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n}\n\n/** Returns a URL-encoded string with auth config suitable for a query string. */\nfunction _encodedAuth(dsn, sdkInfo) {\n const params = {\n sentry_version: SENTRY_API_VERSION,\n };\n\n if (dsn.publicKey) {\n // We send only the minimum set of required information. See\n // https://github.com/getsentry/sentry-javascript/issues/2572.\n params.sentry_key = dsn.publicKey;\n }\n\n if (sdkInfo) {\n params.sentry_client = `${sdkInfo.name}/${sdkInfo.version}`;\n }\n\n return new URLSearchParams(params).toString();\n}\n\n/**\n * Returns the envelope endpoint URL with auth in the query string.\n *\n * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.\n */\nfunction getEnvelopeEndpointWithUrlEncodedAuth(dsn, tunnel, sdkInfo) {\n return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`;\n}\n\n/** Returns the url to the report dialog endpoint. */\nfunction getReportDialogEndpoint(dsnLike, dialogOptions) {\n const dsn = makeDsn(dsnLike);\n if (!dsn) {\n return '';\n }\n\n const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`;\n\n let encodedOptions = `dsn=${dsnToString(dsn)}`;\n for (const key in dialogOptions) {\n if (key === 'dsn') {\n continue;\n }\n\n if (key === 'onClose') {\n continue;\n }\n\n if (key === 'user') {\n const user = dialogOptions.user;\n if (!user) {\n continue;\n }\n if (user.name) {\n encodedOptions += `&name=${encodeURIComponent(user.name)}`;\n }\n if (user.email) {\n encodedOptions += `&email=${encodeURIComponent(user.email)}`;\n }\n } else {\n encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] )}`;\n }\n }\n\n return `${endpoint}?${encodedOptions}`;\n}\n\nexport { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint };\n//# sourceMappingURL=api.js.map\n"],"names":[],"mappings":";AAKA,SAAS,mBAAmB,KAAK;AAC/B,QAAM,WAAW,IAAI,WAAW,GAAG,IAAI,QAAQ,MAAM;AACrD,QAAM,OAAO,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK;AACzC,SAAO,GAAG,QAAQ,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,EAAE;AACzE;AAoCA,SAAS,wBAAwB,SAAS,eAAe;AACvD,QAAM,MAAM,QAAQ,OAAO;AAC3B,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AAEA,QAAM,WAAW,GAAG,mBAAmB,GAAG,CAAC;AAE3C,MAAI,iBAAiB,OAAO,YAAY,GAAG,CAAC;AAC5C,aAAW,OAAO,eAAe;AAC/B,QAAI,QAAQ,OAAO;AACjB;AAAA,IACF;AAEA,QAAI,QAAQ,WAAW;AACrB;AAAA,IACF;AAEA,QAAI,QAAQ,QAAQ;AAClB,YAAM,OAAO,cAAc;AAC3B,UAAI,CAAC,MAAM;AACT;AAAA,MACF;AACA,UAAI,KAAK,MAAM;AACb,0BAAkB,SAAS,mBAAmB,KAAK,IAAI,CAAC;AAAA,MAC1D;AACA,UAAI,KAAK,OAAO;AACd,0BAAkB,UAAU,mBAAmB,KAAK,KAAK,CAAC;AAAA,MAC5D;AAAA,IACF,OAAO;AACL,wBAAkB,IAAI,mBAAmB,GAAG,CAAC,IAAI,mBAAmB,cAAc,GAAG,CAAC,CAAE;AAAA,IAC1F;AAAA,EACF;AAEA,SAAO,GAAG,QAAQ,IAAI,cAAc;AACtC;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getSentryCarrier } from "../carrier.js";
|
|
2
|
+
import { getStackAsyncContextStrategy } from "./stackStrategy.js";
|
|
3
|
+
function getAsyncContextStrategy(carrier) {
|
|
4
|
+
const sentry = getSentryCarrier(carrier);
|
|
5
|
+
if (sentry.acs) {
|
|
6
|
+
return sentry.acs;
|
|
7
|
+
}
|
|
8
|
+
return getStackAsyncContextStrategy();
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
getAsyncContextStrategy
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../node_modules/@sentry/core/build/esm/asyncContext/index.js"],"sourcesContent":["import { getMainCarrier, getSentryCarrier } from '../carrier.js';\nimport { getStackAsyncContextStrategy } from './stackStrategy.js';\n\n/**\n * @private Private API with no semver guarantees!\n *\n * Sets the global async context strategy\n */\nfunction setAsyncContextStrategy(strategy) {\n // Get main carrier (global for every environment)\n const registry = getMainCarrier();\n const sentry = getSentryCarrier(registry);\n sentry.acs = strategy;\n}\n\n/**\n * Get the current async context strategy.\n * If none has been setup, the default will be used.\n */\nfunction getAsyncContextStrategy(carrier) {\n const sentry = getSentryCarrier(carrier);\n\n if (sentry.acs) {\n return sentry.acs;\n }\n\n // Otherwise, use the default one (stack)\n return getStackAsyncContextStrategy();\n}\n\nexport { getAsyncContextStrategy, setAsyncContextStrategy };\n//# sourceMappingURL=index.js.map\n"],"names":[],"mappings":";;AAmBA,SAAS,wBAAwB,SAAS;AACxC,QAAM,SAAS,iBAAiB,OAAO;AAEvC,MAAI,OAAO,KAAK;AACd,WAAO,OAAO;AAAA,EAChB;AAGA,SAAO,6BAA4B;AACrC;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { getDefaultCurrentScope, getDefaultIsolationScope } from "../defaultScopes.js";
|
|
2
|
+
import { Scope } from "../scope.js";
|
|
3
|
+
import { chainAndCopyPromiseLike } from "../utils/chain-and-copy-promiselike.js";
|
|
4
|
+
import { isThenable } from "../utils/is.js";
|
|
5
|
+
import { getMainCarrier, getSentryCarrier } from "../carrier.js";
|
|
6
|
+
class AsyncContextStack {
|
|
7
|
+
constructor(scope, isolationScope) {
|
|
8
|
+
let assignedScope;
|
|
9
|
+
if (!scope) {
|
|
10
|
+
assignedScope = new Scope();
|
|
11
|
+
} else {
|
|
12
|
+
assignedScope = scope;
|
|
13
|
+
}
|
|
14
|
+
let assignedIsolationScope;
|
|
15
|
+
if (!isolationScope) {
|
|
16
|
+
assignedIsolationScope = new Scope();
|
|
17
|
+
} else {
|
|
18
|
+
assignedIsolationScope = isolationScope;
|
|
19
|
+
}
|
|
20
|
+
this._stack = [{ scope: assignedScope }];
|
|
21
|
+
this._isolationScope = assignedIsolationScope;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Fork a scope for the stack.
|
|
25
|
+
*/
|
|
26
|
+
withScope(callback) {
|
|
27
|
+
const scope = this._pushScope();
|
|
28
|
+
let maybePromiseResult;
|
|
29
|
+
try {
|
|
30
|
+
maybePromiseResult = callback(scope);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
this._popScope();
|
|
33
|
+
throw e;
|
|
34
|
+
}
|
|
35
|
+
if (isThenable(maybePromiseResult)) {
|
|
36
|
+
return chainAndCopyPromiseLike(
|
|
37
|
+
maybePromiseResult,
|
|
38
|
+
() => this._popScope(),
|
|
39
|
+
() => this._popScope()
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
this._popScope();
|
|
43
|
+
return maybePromiseResult;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get the client of the stack.
|
|
47
|
+
*/
|
|
48
|
+
getClient() {
|
|
49
|
+
return this.getStackTop().client;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns the scope of the top stack.
|
|
53
|
+
*/
|
|
54
|
+
getScope() {
|
|
55
|
+
return this.getStackTop().scope;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get the isolation scope for the stack.
|
|
59
|
+
*/
|
|
60
|
+
getIsolationScope() {
|
|
61
|
+
return this._isolationScope;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns the topmost scope layer in the order domain > local > process.
|
|
65
|
+
*/
|
|
66
|
+
getStackTop() {
|
|
67
|
+
return this._stack[this._stack.length - 1];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Push a scope to the stack.
|
|
71
|
+
*/
|
|
72
|
+
_pushScope() {
|
|
73
|
+
const scope = this.getScope().clone();
|
|
74
|
+
this._stack.push({
|
|
75
|
+
client: this.getClient(),
|
|
76
|
+
scope
|
|
77
|
+
});
|
|
78
|
+
return scope;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Pop a scope from the stack.
|
|
82
|
+
*/
|
|
83
|
+
_popScope() {
|
|
84
|
+
if (this._stack.length <= 1) return false;
|
|
85
|
+
return !!this._stack.pop();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function getAsyncContextStack() {
|
|
89
|
+
const registry = getMainCarrier();
|
|
90
|
+
const sentry = getSentryCarrier(registry);
|
|
91
|
+
return sentry.stack = sentry.stack || new AsyncContextStack(getDefaultCurrentScope(), getDefaultIsolationScope());
|
|
92
|
+
}
|
|
93
|
+
function withScope(callback) {
|
|
94
|
+
return getAsyncContextStack().withScope(callback);
|
|
95
|
+
}
|
|
96
|
+
function withSetScope(scope, callback) {
|
|
97
|
+
const stack = getAsyncContextStack();
|
|
98
|
+
return stack.withScope(() => {
|
|
99
|
+
stack.getStackTop().scope = scope;
|
|
100
|
+
return callback(scope);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function withIsolationScope(callback) {
|
|
104
|
+
return getAsyncContextStack().withScope(() => {
|
|
105
|
+
return callback(getAsyncContextStack().getIsolationScope());
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function getStackAsyncContextStrategy() {
|
|
109
|
+
return {
|
|
110
|
+
withIsolationScope,
|
|
111
|
+
withScope,
|
|
112
|
+
withSetScope,
|
|
113
|
+
withSetIsolationScope: (_isolationScope, callback) => {
|
|
114
|
+
return withIsolationScope(callback);
|
|
115
|
+
},
|
|
116
|
+
getCurrentScope: () => getAsyncContextStack().getScope(),
|
|
117
|
+
getIsolationScope: () => getAsyncContextStack().getIsolationScope()
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
AsyncContextStack,
|
|
122
|
+
getStackAsyncContextStrategy
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=stackStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stackStrategy.js","sources":["../../../../../../../node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js"],"sourcesContent":["import { getDefaultCurrentScope, getDefaultIsolationScope } from '../defaultScopes.js';\nimport { Scope } from '../scope.js';\nimport { chainAndCopyPromiseLike } from '../utils/chain-and-copy-promiselike.js';\nimport { isThenable } from '../utils/is.js';\nimport { getMainCarrier, getSentryCarrier } from '../carrier.js';\n\n/**\n * This is an object that holds a stack of scopes.\n */\nclass AsyncContextStack {\n\n constructor(scope, isolationScope) {\n let assignedScope;\n if (!scope) {\n assignedScope = new Scope();\n } else {\n assignedScope = scope;\n }\n\n let assignedIsolationScope;\n if (!isolationScope) {\n assignedIsolationScope = new Scope();\n } else {\n assignedIsolationScope = isolationScope;\n }\n\n // scope stack for domains or the process\n this._stack = [{ scope: assignedScope }];\n this._isolationScope = assignedIsolationScope;\n }\n\n /**\n * Fork a scope for the stack.\n */\n withScope(callback) {\n const scope = this._pushScope();\n\n let maybePromiseResult;\n try {\n maybePromiseResult = callback(scope);\n } catch (e) {\n this._popScope();\n throw e;\n }\n\n if (isThenable(maybePromiseResult)) {\n return chainAndCopyPromiseLike(\n maybePromiseResult ,\n () => this._popScope(),\n () => this._popScope(),\n ) ;\n }\n\n this._popScope();\n return maybePromiseResult;\n }\n\n /**\n * Get the client of the stack.\n */\n getClient() {\n return this.getStackTop().client ;\n }\n\n /**\n * Returns the scope of the top stack.\n */\n getScope() {\n return this.getStackTop().scope;\n }\n\n /**\n * Get the isolation scope for the stack.\n */\n getIsolationScope() {\n return this._isolationScope;\n }\n\n /**\n * Returns the topmost scope layer in the order domain > local > process.\n */\n getStackTop() {\n return this._stack[this._stack.length - 1] ;\n }\n\n /**\n * Push a scope to the stack.\n */\n _pushScope() {\n // We want to clone the content of prev scope\n const scope = this.getScope().clone();\n this._stack.push({\n client: this.getClient(),\n scope,\n });\n return scope;\n }\n\n /**\n * Pop a scope from the stack.\n */\n _popScope() {\n if (this._stack.length <= 1) return false;\n return !!this._stack.pop();\n }\n}\n\n/**\n * Get the global async context stack.\n * This will be removed during the v8 cycle and is only here to make migration easier.\n */\nfunction getAsyncContextStack() {\n const registry = getMainCarrier();\n const sentry = getSentryCarrier(registry);\n\n return (sentry.stack = sentry.stack || new AsyncContextStack(getDefaultCurrentScope(), getDefaultIsolationScope()));\n}\n\nfunction withScope(callback) {\n return getAsyncContextStack().withScope(callback);\n}\n\nfunction withSetScope(scope, callback) {\n const stack = getAsyncContextStack();\n return stack.withScope(() => {\n stack.getStackTop().scope = scope;\n return callback(scope);\n });\n}\n\nfunction withIsolationScope(callback) {\n return getAsyncContextStack().withScope(() => {\n return callback(getAsyncContextStack().getIsolationScope());\n });\n}\n\n/**\n * Get the stack-based async context strategy.\n */\nfunction getStackAsyncContextStrategy() {\n return {\n withIsolationScope,\n withScope,\n withSetScope,\n withSetIsolationScope: (_isolationScope, callback) => {\n return withIsolationScope(callback);\n },\n getCurrentScope: () => getAsyncContextStack().getScope(),\n getIsolationScope: () => getAsyncContextStack().getIsolationScope(),\n };\n}\n\nexport { AsyncContextStack, getStackAsyncContextStrategy };\n//# sourceMappingURL=stackStrategy.js.map\n"],"names":[],"mappings":";;;;;AASA,MAAM,kBAAkB;AAAA,EAErB,YAAY,OAAO,gBAAgB;AAClC,QAAI;AACJ,QAAI,CAAC,OAAO;AACV,sBAAgB,IAAI,MAAK;AAAA,IAC3B,OAAO;AACL,sBAAgB;AAAA,IAClB;AAEA,QAAI;AACJ,QAAI,CAAC,gBAAgB;AACnB,+BAAyB,IAAI,MAAK;AAAA,IACpC,OAAO;AACL,+BAAyB;AAAA,IAC3B;AAGA,SAAK,SAAS,CAAC,EAAE,OAAO,cAAa,CAAE;AACvC,SAAK,kBAAkB;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKC,UAAU,UAAU;AACnB,UAAM,QAAQ,KAAK,WAAU;AAE7B,QAAI;AACJ,QAAI;AACF,2BAAqB,SAAS,KAAK;AAAA,IACrC,SAAS,GAAG;AACV,WAAK,UAAS;AACd,YAAM;AAAA,IACR;AAEA,QAAI,WAAW,kBAAkB,GAAG;AAClC,aAAO;AAAA,QACL;AAAA,QACA,MAAM,KAAK,UAAS;AAAA,QACpB,MAAM,KAAK,UAAS;AAAA,MAC5B;AAAA,IACI;AAEA,SAAK,UAAS;AACd,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKC,YAAY;AACX,WAAO,KAAK,YAAW,EAAG;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA,EAKC,WAAW;AACV,WAAO,KAAK,YAAW,EAAG;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA,EAKC,oBAAoB;AACnB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKC,cAAc;AACb,WAAO,KAAK,OAAO,KAAK,OAAO,SAAS,CAAC;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA,EAKC,aAAa;AAEZ,UAAM,QAAQ,KAAK,SAAQ,EAAG,MAAK;AACnC,SAAK,OAAO,KAAK;AAAA,MACf,QAAQ,KAAK,UAAS;AAAA,MACtB;AAAA,IACN,CAAK;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKC,YAAY;AACX,QAAI,KAAK,OAAO,UAAU,EAAG,QAAO;AACpC,WAAO,CAAC,CAAC,KAAK,OAAO,IAAG;AAAA,EAC1B;AACF;AAMA,SAAS,uBAAuB;AAC9B,QAAM,WAAW,eAAc;AAC/B,QAAM,SAAS,iBAAiB,QAAQ;AAExC,SAAQ,OAAO,QAAQ,OAAO,SAAS,IAAI,kBAAkB,0BAA0B,0BAA0B;AACnH;AAEA,SAAS,UAAU,UAAU;AAC3B,SAAO,qBAAoB,EAAG,UAAU,QAAQ;AAClD;AAEA,SAAS,aAAa,OAAO,UAAU;AACrC,QAAM,QAAQ,qBAAoB;AAClC,SAAO,MAAM,UAAU,MAAM;AAC3B,UAAM,cAAc,QAAQ;AAC5B,WAAO,SAAS,KAAK;AAAA,EACvB,CAAC;AACH;AAEA,SAAS,mBAAmB,UAAU;AACpC,SAAO,qBAAoB,EAAG,UAAU,MAAM;AAC5C,WAAO,SAAS,uBAAuB,mBAAmB;AAAA,EAC5D,CAAC;AACH;AAKA,SAAS,+BAA+B;AACtC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,uBAAuB,CAAC,iBAAiB,aAAa;AACpD,aAAO,mBAAmB,QAAQ;AAAA,IACpC;AAAA,IACA,iBAAiB,MAAM,qBAAoB,EAAG,SAAQ;AAAA,IACtD,mBAAmB,MAAM,qBAAoB,EAAG,kBAAiB;AAAA,EACrE;AACA;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SDK_VERSION } from "./utils/version.js";
|
|
2
|
+
import { GLOBAL_OBJ } from "./utils/worldwide.js";
|
|
3
|
+
function getMainCarrier() {
|
|
4
|
+
getSentryCarrier(GLOBAL_OBJ);
|
|
5
|
+
return GLOBAL_OBJ;
|
|
6
|
+
}
|
|
7
|
+
function getSentryCarrier(carrier) {
|
|
8
|
+
const __SENTRY__ = carrier.__SENTRY__ = carrier.__SENTRY__ || {};
|
|
9
|
+
__SENTRY__.version = __SENTRY__.version || SDK_VERSION;
|
|
10
|
+
return __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {};
|
|
11
|
+
}
|
|
12
|
+
function getGlobalSingleton(name, creator, obj = GLOBAL_OBJ) {
|
|
13
|
+
const __SENTRY__ = obj.__SENTRY__ = obj.__SENTRY__ || {};
|
|
14
|
+
const carrier = __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {};
|
|
15
|
+
return carrier[name] || (carrier[name] = creator());
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
getGlobalSingleton,
|
|
19
|
+
getMainCarrier,
|
|
20
|
+
getSentryCarrier
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=carrier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carrier.js","sources":["../../../../../../node_modules/@sentry/core/build/esm/carrier.js"],"sourcesContent":["import { SDK_VERSION } from './utils/version.js';\nimport { GLOBAL_OBJ } from './utils/worldwide.js';\n\n/**\n * An object that contains globally accessible properties and maintains a scope stack.\n * @hidden\n */\n\n/**\n * Returns the global shim registry.\n *\n * FIXME: This function is problematic, because despite always returning a valid Carrier,\n * it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check\n * at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there.\n **/\nfunction getMainCarrier() {\n // This ensures a Sentry carrier exists\n getSentryCarrier(GLOBAL_OBJ);\n return GLOBAL_OBJ;\n}\n\n/** Will either get the existing sentry carrier, or create a new one. */\nfunction getSentryCarrier(carrier) {\n const __SENTRY__ = (carrier.__SENTRY__ = carrier.__SENTRY__ || {});\n\n // For now: First SDK that sets the .version property wins\n __SENTRY__.version = __SENTRY__.version || SDK_VERSION;\n\n // Intentionally populating and returning the version of \"this\" SDK instance\n // rather than what's set in .version so that \"this\" SDK always gets its carrier\n return (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});\n}\n\n/**\n * Returns a global singleton contained in the global `__SENTRY__[]` object.\n *\n * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory\n * function and added to the `__SENTRY__` object.\n *\n * @param name name of the global singleton on __SENTRY__\n * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`\n * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value\n * @returns the singleton\n */\nfunction getGlobalSingleton(\n name,\n creator,\n obj = GLOBAL_OBJ,\n) {\n const __SENTRY__ = (obj.__SENTRY__ = obj.__SENTRY__ || {});\n const carrier = (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});\n // Note: We do not want to set `carrier.version` here, as this may be called before any `init` is called, e.g. for the default scopes\n return carrier[name] || (carrier[name] = creator());\n}\n\nexport { getGlobalSingleton, getMainCarrier, getSentryCarrier };\n//# sourceMappingURL=carrier.js.map\n"],"names":[],"mappings":";;AAeA,SAAS,iBAAiB;AAExB,mBAAiB,UAAU;AAC3B,SAAO;AACT;AAGA,SAAS,iBAAiB,SAAS;AACjC,QAAM,aAAc,QAAQ,aAAa,QAAQ,cAAc,CAAA;AAG/D,aAAW,UAAU,WAAW,WAAW;AAI3C,SAAQ,WAAW,WAAW,IAAI,WAAW,WAAW,KAAK,CAAA;AAC/D;AAaA,SAAS,mBACP,MACA,SACA,MAAM,YACN;AACA,QAAM,aAAc,IAAI,aAAa,IAAI,cAAc,CAAA;AACvD,QAAM,UAAW,WAAW,WAAW,IAAI,WAAW,WAAW,KAAK;AAEtE,SAAO,QAAQ,IAAI,MAAM,QAAQ,IAAI,IAAI;AAC3C;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getAsyncContextStrategy } from "./asyncContext/index.js";
|
|
2
|
+
import { getMainCarrier } from "./carrier.js";
|
|
3
|
+
function getCurrentScope() {
|
|
4
|
+
const carrier = getMainCarrier();
|
|
5
|
+
const acs = getAsyncContextStrategy(carrier);
|
|
6
|
+
return acs.getCurrentScope();
|
|
7
|
+
}
|
|
8
|
+
function getIsolationScope() {
|
|
9
|
+
const carrier = getMainCarrier();
|
|
10
|
+
const acs = getAsyncContextStrategy(carrier);
|
|
11
|
+
return acs.getIsolationScope();
|
|
12
|
+
}
|
|
13
|
+
function withScope(...rest) {
|
|
14
|
+
const carrier = getMainCarrier();
|
|
15
|
+
const acs = getAsyncContextStrategy(carrier);
|
|
16
|
+
if (rest.length === 2) {
|
|
17
|
+
const [scope, callback] = rest;
|
|
18
|
+
if (!scope) {
|
|
19
|
+
return acs.withScope(callback);
|
|
20
|
+
}
|
|
21
|
+
return acs.withSetScope(scope, callback);
|
|
22
|
+
}
|
|
23
|
+
return acs.withScope(rest[0]);
|
|
24
|
+
}
|
|
25
|
+
function getClient() {
|
|
26
|
+
return getCurrentScope().getClient();
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
getClient,
|
|
30
|
+
getCurrentScope,
|
|
31
|
+
getIsolationScope,
|
|
32
|
+
withScope
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=currentScopes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currentScopes.js","sources":["../../../../../../node_modules/@sentry/core/build/esm/currentScopes.js"],"sourcesContent":["import { getAsyncContextStrategy } from './asyncContext/index.js';\nimport { getMainCarrier, getGlobalSingleton } from './carrier.js';\nimport { Scope } from './scope.js';\nimport { generateSpanId } from './utils/propagationContext.js';\n\n/**\n * Get the currently active scope.\n */\nfunction getCurrentScope() {\n const carrier = getMainCarrier();\n const acs = getAsyncContextStrategy(carrier);\n return acs.getCurrentScope();\n}\n\n/**\n * Get the currently active isolation scope.\n * The isolation scope is active for the current execution context.\n */\nfunction getIsolationScope() {\n const carrier = getMainCarrier();\n const acs = getAsyncContextStrategy(carrier);\n return acs.getIsolationScope();\n}\n\n/**\n * Get the global scope.\n * This scope is applied to _all_ events.\n */\nfunction getGlobalScope() {\n return getGlobalSingleton('globalScope', () => new Scope());\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n */\n\n/**\n * Either creates a new active scope, or sets the given scope as active scope in the given callback.\n */\nfunction withScope(\n ...rest\n) {\n const carrier = getMainCarrier();\n const acs = getAsyncContextStrategy(carrier);\n\n // If a scope is defined, we want to make this the active scope instead of the default one\n if (rest.length === 2) {\n const [scope, callback] = rest;\n\n if (!scope) {\n return acs.withScope(callback);\n }\n\n return acs.withSetScope(scope, callback);\n }\n\n return acs.withScope(rest[0]);\n}\n\n/**\n * Attempts to fork the current isolation scope and the current scope based on the current async context strategy. If no\n * async context strategy is set, the isolation scope and the current scope will not be forked (this is currently the\n * case, for example, in the browser).\n *\n * Usage of this function in environments without async context strategy is discouraged and may lead to unexpected behaviour.\n *\n * This function is intended for Sentry SDK and SDK integration development. It is not recommended to be used in \"normal\"\n * applications directly because it comes with pitfalls. Use at your own risk!\n */\n\n/**\n * Either creates a new active isolation scope, or sets the given isolation scope as active scope in the given callback.\n */\nfunction withIsolationScope(\n ...rest\n\n) {\n const carrier = getMainCarrier();\n const acs = getAsyncContextStrategy(carrier);\n\n // If a scope is defined, we want to make this the active scope instead of the default one\n if (rest.length === 2) {\n const [isolationScope, callback] = rest;\n\n if (!isolationScope) {\n return acs.withIsolationScope(callback);\n }\n\n return acs.withSetIsolationScope(isolationScope, callback);\n }\n\n return acs.withIsolationScope(rest[0]);\n}\n\n/**\n * Get the currently active client.\n */\nfunction getClient() {\n return getCurrentScope().getClient();\n}\n\n/**\n * Get a trace context for the given scope.\n */\nfunction getTraceContextFromScope(scope) {\n const propagationContext = scope.getPropagationContext();\n\n const { traceId, parentSpanId, propagationSpanId } = propagationContext;\n\n const traceContext = {\n trace_id: traceId,\n span_id: propagationSpanId || generateSpanId(),\n };\n\n if (parentSpanId) {\n traceContext.parent_span_id = parentSpanId;\n }\n\n return traceContext;\n}\n\nexport { getClient, getCurrentScope, getGlobalScope, getIsolationScope, getTraceContextFromScope, withIsolationScope, withScope };\n//# sourceMappingURL=currentScopes.js.map\n"],"names":[],"mappings":";;AAQA,SAAS,kBAAkB;AACzB,QAAM,UAAU,eAAc;AAC9B,QAAM,MAAM,wBAAwB,OAAO;AAC3C,SAAO,IAAI,gBAAe;AAC5B;AAMA,SAAS,oBAAoB;AAC3B,QAAM,UAAU,eAAc;AAC9B,QAAM,MAAM,wBAAwB,OAAO;AAC3C,SAAO,IAAI,kBAAiB;AAC9B;AAmBA,SAAS,aACJ,MACH;AACA,QAAM,UAAU,eAAc;AAC9B,QAAM,MAAM,wBAAwB,OAAO;AAG3C,MAAI,KAAK,WAAW,GAAG;AACrB,UAAM,CAAC,OAAO,QAAQ,IAAI;AAE1B,QAAI,CAAC,OAAO;AACV,aAAO,IAAI,UAAU,QAAQ;AAAA,IAC/B;AAEA,WAAO,IAAI,aAAa,OAAO,QAAQ;AAAA,EACzC;AAEA,SAAO,IAAI,UAAU,KAAK,CAAC,CAAC;AAC9B;AAwCA,SAAS,YAAY;AACnB,SAAO,gBAAe,EAAG,UAAS;AACpC;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-build.js","sources":["../../../../../../node_modules/@sentry/core/build/esm/debug-build.js"],"sourcesContent":["/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nconst DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);\n\nexport { DEBUG_BUILD };\n//# sourceMappingURL=debug-build.js.map\n"],"names":[],"mappings":"AAKK,MAAC,cAAe,OAAO,qBAAqB,eAAe;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getGlobalSingleton } from "./carrier.js";
|
|
2
|
+
import { Scope } from "./scope.js";
|
|
3
|
+
function getDefaultCurrentScope() {
|
|
4
|
+
return getGlobalSingleton("defaultCurrentScope", () => new Scope());
|
|
5
|
+
}
|
|
6
|
+
function getDefaultIsolationScope() {
|
|
7
|
+
return getGlobalSingleton("defaultIsolationScope", () => new Scope());
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
getDefaultCurrentScope,
|
|
11
|
+
getDefaultIsolationScope
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=defaultScopes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultScopes.js","sources":["../../../../../../node_modules/@sentry/core/build/esm/defaultScopes.js"],"sourcesContent":["import { getGlobalSingleton } from './carrier.js';\nimport { Scope } from './scope.js';\n\n/** Get the default current scope. */\nfunction getDefaultCurrentScope() {\n return getGlobalSingleton('defaultCurrentScope', () => new Scope());\n}\n\n/** Get the default isolation scope. */\nfunction getDefaultIsolationScope() {\n return getGlobalSingleton('defaultIsolationScope', () => new Scope());\n}\n\nexport { getDefaultCurrentScope, getDefaultIsolationScope };\n//# sourceMappingURL=defaultScopes.js.map\n"],"names":[],"mappings":";;AAIA,SAAS,yBAAyB;AAChC,SAAO,mBAAmB,uBAAuB,MAAM,IAAI,MAAK,CAAE;AACpE;AAGA,SAAS,2BAA2B;AAClC,SAAO,mBAAmB,yBAAyB,MAAM,IAAI,MAAK,CAAE;AACtE;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getIsolationScope, getCurrentScope } from "./currentScopes.js";
|
|
2
|
+
import { parseEventHintOrCaptureContext } from "./utils/prepareEvent.js";
|
|
3
|
+
function captureException(exception, hint) {
|
|
4
|
+
return getCurrentScope().captureException(exception, parseEventHintOrCaptureContext(hint));
|
|
5
|
+
}
|
|
6
|
+
function lastEventId() {
|
|
7
|
+
return getIsolationScope().lastEventId();
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
captureException,
|
|
11
|
+
lastEventId
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=exports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.js","sources":["../../../../../../node_modules/@sentry/core/build/esm/exports.js"],"sourcesContent":["import { getIsolationScope, getCurrentScope, getClient, withIsolationScope } from './currentScopes.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { closeSession, makeSession, updateSession } from './session.js';\nimport { startNewTrace } from './tracing/trace.js';\nimport { debug } from './utils/debug-logger.js';\nimport { isThenable } from './utils/is.js';\nimport { uuid4 } from './utils/misc.js';\nimport { parseEventHintOrCaptureContext } from './utils/prepareEvent.js';\nimport { getCombinedScopeData } from './utils/scopeData.js';\nimport { timestampInSeconds } from './utils/time.js';\nimport { GLOBAL_OBJ } from './utils/worldwide.js';\n\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nfunction captureException(exception, hint) {\n return getCurrentScope().captureException(exception, parseEventHintOrCaptureContext(hint));\n}\n\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param message The message to send to Sentry.\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n * @returns the id of the captured message.\n */\nfunction captureMessage(message, captureContext) {\n // This is necessary to provide explicit scopes upgrade, without changing the original\n // arity of the `captureMessage(message, level)` method.\n const level = typeof captureContext === 'string' ? captureContext : undefined;\n const hint = typeof captureContext !== 'string' ? { captureContext } : undefined;\n return getCurrentScope().captureMessage(message, level, hint);\n}\n\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param event The event to send to Sentry.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured event.\n */\nfunction captureEvent(event, hint) {\n return getCurrentScope().captureEvent(event, hint);\n}\n\n/**\n * Sets context data with the given name.\n * @param name of the context\n * @param context Any kind of data. This data will be normalized.\n */\nfunction setContext(name, context) {\n getIsolationScope().setContext(name, context);\n}\n\n/**\n * Set an object that will be merged sent as extra data with the event.\n * @param extras Extras object to merge into current context.\n */\nfunction setExtras(extras) {\n getIsolationScope().setExtras(extras);\n}\n\n/**\n * Set key:value that will be sent as extra data with the event.\n * @param key String of extra\n * @param extra Any kind of data. This data will be normalized.\n */\nfunction setExtra(key, extra) {\n getIsolationScope().setExtra(key, extra);\n}\n\n/**\n * Set an object that will be merged sent as tags data with the event.\n * @param tags Tags context object to merge into current context.\n */\nfunction setTags(tags) {\n getIsolationScope().setTags(tags);\n}\n\n/**\n * Set key:value that will be sent as tags data with the event.\n *\n * Can also be used to unset a tag, by passing `undefined`.\n *\n * @param key String key of tag\n * @param value Value of tag\n */\nfunction setTag(key, value) {\n getIsolationScope().setTag(key, value);\n}\n\n/**\n * Updates user context information for future events.\n *\n * @param user User context object to be set in the current context. Pass `null` to unset the user.\n */\nfunction setUser(user) {\n getIsolationScope().setUser(user);\n}\n\n/**\n * Sets the conversation ID for the current isolation scope.\n *\n * @param conversationId The conversation ID to set. Pass `null` or `undefined` to unset the conversation ID.\n */\nfunction setConversationId(conversationId) {\n getIsolationScope().setConversationId(conversationId);\n}\n\n/**\n * The last error event id of the isolation scope.\n *\n * Warning: This function really returns the last recorded error event id on the current\n * isolation scope. If you call this function after handling a certain error and another error\n * is captured in between, the last one is returned instead of the one you might expect.\n * Also, ids of events that were never sent to Sentry (for example because\n * they were dropped in `beforeSend`) could be returned.\n *\n * @returns The last event id of the isolation scope.\n */\nfunction lastEventId() {\n return getIsolationScope().lastEventId();\n}\n\n/**\n * Create a cron monitor check in and send it to Sentry.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nfunction captureCheckIn(checkIn, upsertMonitorConfig) {\n const scope = getCurrentScope();\n const client = getClient();\n if (!client) {\n DEBUG_BUILD && debug.warn('Cannot capture check-in. No client defined.');\n } else if (!client.captureCheckIn) {\n DEBUG_BUILD && debug.warn('Cannot capture check-in. Client does not support sending check-ins.');\n } else {\n return client.captureCheckIn(checkIn, upsertMonitorConfig, scope);\n }\n\n return uuid4();\n}\n\n/**\n * Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.\n *\n * @param monitorSlug The distinct slug of the monitor.\n * @param callback Callback to be monitored\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nfunction withMonitor(\n monitorSlug,\n callback,\n upsertMonitorConfig,\n) {\n function runCallback() {\n const checkInId = captureCheckIn({ monitorSlug, status: 'in_progress' }, upsertMonitorConfig);\n const now = timestampInSeconds();\n\n function finishCheckIn(status) {\n captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now });\n }\n // Default behavior without isolateTrace\n let maybePromiseResult;\n try {\n maybePromiseResult = callback();\n } catch (e) {\n finishCheckIn('error');\n throw e;\n }\n\n if (isThenable(maybePromiseResult)) {\n return maybePromiseResult.then(\n r => {\n finishCheckIn('ok');\n return r;\n },\n e => {\n finishCheckIn('error');\n throw e;\n },\n ) ;\n }\n finishCheckIn('ok');\n\n return maybePromiseResult;\n }\n\n return withIsolationScope(() => (upsertMonitorConfig?.isolateTrace ? startNewTrace(runCallback) : runCallback()));\n}\n\n/**\n * Call `flush()` on the current client, if there is one. See {@link Client.flush}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause\n * the client to wait until all events are sent before resolving the promise.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nasync function flush(timeout) {\n const client = getClient();\n if (client) {\n return client.flush(timeout);\n }\n DEBUG_BUILD && debug.warn('Cannot flush events. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Call `close()` on the current client, if there is one. See {@link Client.close}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this\n * parameter will cause the client to wait until all events are sent before disabling itself.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nasync function close(timeout) {\n const client = getClient();\n if (client) {\n return client.close(timeout);\n }\n DEBUG_BUILD && debug.warn('Cannot flush events and disable SDK. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Returns true if Sentry has been properly initialized.\n */\nfunction isInitialized() {\n return !!getClient();\n}\n\n/** If the SDK is initialized & enabled. */\nfunction isEnabled() {\n const client = getClient();\n return client?.getOptions().enabled !== false && !!client?.getTransport();\n}\n\n/**\n * Add an event processor.\n * This will be added to the current isolation scope, ensuring any event that is processed in the current execution\n * context will have the processor applied.\n */\nfunction addEventProcessor(callback) {\n getIsolationScope().addEventProcessor(callback);\n}\n\n/**\n * Start a session on the current isolation scope.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns the new active session\n */\nfunction startSession(context) {\n const isolationScope = getIsolationScope();\n\n const { user } = getCombinedScopeData(isolationScope, getCurrentScope());\n\n // Will fetch userAgent if called from browser sdk\n const { userAgent } = GLOBAL_OBJ.navigator || {};\n\n const session = makeSession({\n user,\n ...(userAgent && { userAgent }),\n ...context,\n });\n\n // End existing session if there's one\n const currentSession = isolationScope.getSession();\n if (currentSession?.status === 'ok') {\n updateSession(currentSession, { status: 'exited' });\n }\n\n endSession();\n\n // Afterwards we set the new session on the scope\n isolationScope.setSession(session);\n\n return session;\n}\n\n/**\n * End the session on the current isolation scope.\n */\nfunction endSession() {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session) {\n closeSession(session);\n }\n _sendSessionUpdate();\n\n // the session is over; take it off of the scope\n isolationScope.setSession();\n}\n\n/**\n * Sends the current Session on the scope\n */\nfunction _sendSessionUpdate() {\n const isolationScope = getIsolationScope();\n const client = getClient();\n const session = isolationScope.getSession();\n if (session && client) {\n client.captureSession(session);\n }\n}\n\n/**\n * Sends the current session on the scope to Sentry\n *\n * @param end If set the session will be marked as exited and removed from the scope.\n * Defaults to `false`.\n */\nfunction captureSession(end = false) {\n // both send the update and pull the session from the scope\n if (end) {\n endSession();\n return;\n }\n\n // only send the update\n _sendSessionUpdate();\n}\n\nexport { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor };\n//# sourceMappingURL=exports.js.map\n"],"names":[],"mappings":";;AAmBA,SAAS,iBAAiB,WAAW,MAAM;AACzC,SAAO,gBAAe,EAAG,iBAAiB,WAAW,+BAA+B,IAAI,CAAC;AAC3F;AAuGA,SAAS,cAAc;AACrB,SAAO,kBAAiB,EAAG,YAAW;AACxC;","x_google_ignoreList":[0]}
|