@strapi/plugin-sentry 5.12.1 → 5.12.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.
- package/dist/admin/index.js +19 -122
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +15 -120
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/package.json.js +121 -0
- package/dist/admin/package.json.js.map +1 -0
- package/dist/admin/package.json.mjs +102 -0
- package/dist/admin/package.json.mjs.map +1 -0
- package/dist/admin/pluginId.js +6 -0
- package/dist/admin/pluginId.js.map +1 -0
- package/dist/admin/pluginId.mjs +4 -0
- package/dist/admin/pluginId.mjs.map +1 -0
- package/dist/admin/{chunks/dk-C64Vk1_X.js → translations/dk.json.js} +2 -2
- package/dist/admin/translations/dk.json.js.map +1 -0
- package/dist/admin/{chunks/dk-2c1X5YD1.mjs → translations/dk.json.mjs} +1 -1
- package/dist/admin/translations/dk.json.mjs.map +1 -0
- package/dist/admin/{chunks/en-CzMdlTs0.js → translations/en.json.js} +2 -2
- package/dist/admin/translations/en.json.js.map +1 -0
- package/dist/admin/{chunks/en-DDCHBy0-.mjs → translations/en.json.mjs} +1 -1
- package/dist/admin/translations/en.json.mjs.map +1 -0
- package/dist/admin/{chunks/es-l4HaM-C0.js → translations/es.json.js} +2 -2
- package/dist/admin/translations/es.json.js.map +1 -0
- package/dist/admin/{chunks/es-BnizV7-a.mjs → translations/es.json.mjs} +1 -1
- package/dist/admin/translations/es.json.mjs.map +1 -0
- package/dist/admin/{chunks/fr-rJIDC4Jx.js → translations/fr.json.js} +2 -2
- package/dist/admin/translations/fr.json.js.map +1 -0
- package/dist/admin/{chunks/fr-BsXNdB-N.mjs → translations/fr.json.mjs} +1 -1
- package/dist/admin/translations/fr.json.mjs.map +1 -0
- package/dist/admin/{chunks/ko-CoJrUsj1.js → translations/ko.json.js} +2 -2
- package/dist/admin/translations/ko.json.js.map +1 -0
- package/dist/admin/{chunks/ko-BrDfWiIr.mjs → translations/ko.json.mjs} +1 -1
- package/dist/admin/translations/ko.json.mjs.map +1 -0
- package/dist/admin/{chunks/pl-DbPKh3_6.js → translations/pl.json.js} +2 -2
- package/dist/admin/translations/pl.json.js.map +1 -0
- package/dist/admin/{chunks/pl-6JvJwTZm.mjs → translations/pl.json.mjs} +1 -1
- package/dist/admin/translations/pl.json.mjs.map +1 -0
- package/dist/admin/{chunks/ru-CgCHTIu5.js → translations/ru.json.js} +2 -2
- package/dist/admin/translations/ru.json.js.map +1 -0
- package/dist/admin/{chunks/ru-B4OA2fUb.mjs → translations/ru.json.mjs} +1 -1
- package/dist/admin/translations/ru.json.mjs.map +1 -0
- package/dist/admin/{chunks/sv-DrckibdJ.js → translations/sv.json.js} +2 -2
- package/dist/admin/translations/sv.json.js.map +1 -0
- package/dist/admin/{chunks/sv-OPAT8f7H.mjs → translations/sv.json.mjs} +1 -1
- package/dist/admin/translations/sv.json.mjs.map +1 -0
- package/dist/admin/{chunks/tr-DMgP5sU_.js → translations/tr.json.js} +2 -2
- package/dist/admin/translations/tr.json.js.map +1 -0
- package/dist/admin/{chunks/tr-C8CxtgGx.mjs → translations/tr.json.mjs} +1 -1
- package/dist/admin/translations/tr.json.mjs.map +1 -0
- package/dist/admin/{chunks/uk-B2xQjt3Y.js → translations/uk.json.js} +2 -2
- package/dist/admin/translations/uk.json.js.map +1 -0
- package/dist/admin/{chunks/uk-DTdvxZPe.mjs → translations/uk.json.mjs} +1 -1
- package/dist/admin/translations/uk.json.mjs.map +1 -0
- package/dist/admin/{chunks/vi-CpPssghl.js → translations/vi.json.js} +2 -2
- package/dist/admin/translations/vi.json.js.map +1 -0
- package/dist/admin/{chunks/vi-D0rPKKIu.mjs → translations/vi.json.mjs} +1 -1
- package/dist/admin/translations/vi.json.mjs.map +1 -0
- package/dist/admin/{chunks/zh-TX10GrSY.js → translations/zh.json.js} +2 -2
- package/dist/admin/translations/zh.json.js.map +1 -0
- package/dist/admin/{chunks/zh-MmnOh-xz.mjs → translations/zh.json.mjs} +1 -1
- package/dist/admin/translations/zh.json.mjs.map +1 -0
- package/dist/admin/utils/prefixPluginTranslations.js +11 -0
- package/dist/admin/utils/prefixPluginTranslations.js.map +1 -0
- package/dist/admin/utils/prefixPluginTranslations.mjs +9 -0
- package/dist/admin/utils/prefixPluginTranslations.mjs.map +1 -0
- package/dist/server/bootstrap.js +13 -0
- package/dist/server/bootstrap.js.map +1 -0
- package/dist/server/bootstrap.mjs +11 -0
- package/dist/server/bootstrap.mjs.map +1 -0
- package/dist/server/config.js +13 -0
- package/dist/server/config.js.map +1 -0
- package/dist/server/config.mjs +11 -0
- package/dist/server/config.mjs.map +1 -0
- package/dist/server/index.js +4 -134
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +3 -114
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/middlewares/sentry.js +39 -0
- package/dist/server/middlewares/sentry.js.map +1 -0
- package/dist/server/middlewares/sentry.mjs +37 -0
- package/dist/server/middlewares/sentry.mjs.map +1 -0
- package/dist/server/services/index.js +10 -0
- package/dist/server/services/index.js.map +1 -0
- package/dist/server/services/index.mjs +8 -0
- package/dist/server/services/index.mjs.map +1 -0
- package/dist/server/services/sentry.js +83 -0
- package/dist/server/services/sentry.js.map +1 -0
- package/dist/server/services/sentry.mjs +62 -0
- package/dist/server/services/sentry.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/admin/chunks/dk-2c1X5YD1.mjs.map +0 -1
- package/dist/admin/chunks/dk-C64Vk1_X.js.map +0 -1
- package/dist/admin/chunks/en-CzMdlTs0.js.map +0 -1
- package/dist/admin/chunks/en-DDCHBy0-.mjs.map +0 -1
- package/dist/admin/chunks/es-BnizV7-a.mjs.map +0 -1
- package/dist/admin/chunks/es-l4HaM-C0.js.map +0 -1
- package/dist/admin/chunks/fr-BsXNdB-N.mjs.map +0 -1
- package/dist/admin/chunks/fr-rJIDC4Jx.js.map +0 -1
- package/dist/admin/chunks/ko-BrDfWiIr.mjs.map +0 -1
- package/dist/admin/chunks/ko-CoJrUsj1.js.map +0 -1
- package/dist/admin/chunks/pl-6JvJwTZm.mjs.map +0 -1
- package/dist/admin/chunks/pl-DbPKh3_6.js.map +0 -1
- package/dist/admin/chunks/ru-B4OA2fUb.mjs.map +0 -1
- package/dist/admin/chunks/ru-CgCHTIu5.js.map +0 -1
- package/dist/admin/chunks/sv-DrckibdJ.js.map +0 -1
- package/dist/admin/chunks/sv-OPAT8f7H.mjs.map +0 -1
- package/dist/admin/chunks/tr-C8CxtgGx.mjs.map +0 -1
- package/dist/admin/chunks/tr-DMgP5sU_.js.map +0 -1
- package/dist/admin/chunks/uk-B2xQjt3Y.js.map +0 -1
- package/dist/admin/chunks/uk-DTdvxZPe.mjs.map +0 -1
- package/dist/admin/chunks/vi-CpPssghl.js.map +0 -1
- package/dist/admin/chunks/vi-D0rPKKIu.mjs.map +0 -1
- package/dist/admin/chunks/zh-MmnOh-xz.mjs.map +0 -1
- package/dist/admin/chunks/zh-TX10GrSY.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../server/src/
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../server/src/index.ts"],"sourcesContent":["import bootstrap from './bootstrap';\nimport services from './services';\nimport config from './config';\n\nexport default () => ({\n bootstrap,\n config,\n services,\n});\n"],"names":["bootstrap","config","services"],"mappings":";;;;AAIA,YAAe,CAAA,KAAO;AACpBA,QAAAA,SAAAA;AACAC,QAAAA,MAAAA;AACAC,QAAAA;AACF,KAAA,CAAC;;;;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Programmatic sentry middleware. We do not want to expose it in the plugin
|
|
5
|
+
*/ var initSentryMiddleware = (({ strapi })=>{
|
|
6
|
+
const sentryService = strapi.plugin('sentry').service('sentry');
|
|
7
|
+
sentryService.init();
|
|
8
|
+
const sentry = sentryService.getInstance();
|
|
9
|
+
if (!sentry) {
|
|
10
|
+
// initialization failed
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
strapi.server.use(async (ctx, next)=>{
|
|
14
|
+
try {
|
|
15
|
+
await next();
|
|
16
|
+
} catch (error) {
|
|
17
|
+
if (error instanceof Error) {
|
|
18
|
+
sentryService.sendError(error, (scope)=>{
|
|
19
|
+
scope.addEventProcessor((event)=>{
|
|
20
|
+
// Parse Koa context to add error metadata
|
|
21
|
+
return sentry.Handlers.parseRequest(event, ctx.request, {
|
|
22
|
+
// Don't parse the transaction name, we'll do it manually
|
|
23
|
+
transaction: false
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
// Manually add transaction name
|
|
27
|
+
scope.setTag('transaction', `${ctx.method} ${ctx._matchedRoute}`);
|
|
28
|
+
// Manually add Strapi version
|
|
29
|
+
scope.setTag('strapi_version', strapi.config.info.strapi);
|
|
30
|
+
scope.setTag('method', ctx.method);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
module.exports = initSentryMiddleware;
|
|
39
|
+
//# sourceMappingURL=sentry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.js","sources":["../../../server/src/middlewares/sentry.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\nimport type Sentry from '@sentry/node';\nimport type createSentryService from '../services/sentry';\n\n/**\n * Programmatic sentry middleware. We do not want to expose it in the plugin\n */\nexport default ({ strapi }: { strapi: Core.Strapi }) => {\n const sentryService: ReturnType<typeof createSentryService> = strapi\n .plugin('sentry')\n .service('sentry');\n sentryService.init();\n const sentry = sentryService.getInstance();\n\n if (!sentry) {\n // initialization failed\n return;\n }\n\n strapi.server.use(async (ctx, next) => {\n try {\n await next();\n } catch (error) {\n if (error instanceof Error) {\n sentryService.sendError(error, (scope: Sentry.Scope) => {\n scope.addEventProcessor((event) => {\n // Parse Koa context to add error metadata\n return sentry.Handlers.parseRequest(event, ctx.request as Sentry.Request, {\n // Don't parse the transaction name, we'll do it manually\n transaction: false,\n });\n });\n\n // Manually add transaction name\n scope.setTag('transaction', `${ctx.method} ${ctx._matchedRoute}`);\n // Manually add Strapi version\n scope.setTag('strapi_version', strapi.config.info.strapi);\n scope.setTag('method', ctx.method);\n });\n }\n\n throw error;\n }\n });\n};\n"],"names":["strapi","sentryService","plugin","service","init","sentry","getInstance","server","use","ctx","next","error","Error","sendError","scope","addEventProcessor","event","Handlers","parseRequest","request","transaction","setTag","method","_matchedRoute","config","info"],"mappings":";;AAIA;;AAEC,IACD,2BAAe,CAAA,CAAC,EAAEA,MAAM,EAA2B,GAAA;AACjD,IAAA,MAAMC,gBAAwDD,MAC3DE,CAAAA,MAAM,CAAC,QAAA,CAAA,CACPC,OAAO,CAAC,QAAA,CAAA;AACXF,IAAAA,aAAAA,CAAcG,IAAI,EAAA;IAClB,MAAMC,MAAAA,GAASJ,cAAcK,WAAW,EAAA;AAExC,IAAA,IAAI,CAACD,MAAQ,EAAA;;AAEX,QAAA;AACF;AAEAL,IAAAA,MAAAA,CAAOO,MAAM,CAACC,GAAG,CAAC,OAAOC,GAAKC,EAAAA,IAAAA,GAAAA;QAC5B,IAAI;YACF,MAAMA,IAAAA,EAAAA;AACR,SAAA,CAAE,OAAOC,KAAO,EAAA;AACd,YAAA,IAAIA,iBAAiBC,KAAO,EAAA;gBAC1BX,aAAcY,CAAAA,SAAS,CAACF,KAAAA,EAAO,CAACG,KAAAA,GAAAA;oBAC9BA,KAAMC,CAAAA,iBAAiB,CAAC,CAACC,KAAAA,GAAAA;;wBAEvB,OAAOX,MAAAA,CAAOY,QAAQ,CAACC,YAAY,CAACF,KAAOP,EAAAA,GAAAA,CAAIU,OAAO,EAAoB;;4BAExEC,WAAa,EAAA;AACf,yBAAA,CAAA;AACF,qBAAA,CAAA;;AAGAN,oBAAAA,KAAAA,CAAMO,MAAM,CAAC,aAAe,EAAA,CAAC,EAAEZ,GAAAA,CAAIa,MAAM,CAAC,CAAC,EAAEb,GAAIc,CAAAA,aAAa,CAAC,CAAC,CAAA;;oBAEhET,KAAMO,CAAAA,MAAM,CAAC,gBAAkBrB,EAAAA,MAAAA,CAAOwB,MAAM,CAACC,IAAI,CAACzB,MAAM,CAAA;AACxDc,oBAAAA,KAAAA,CAAMO,MAAM,CAAC,QAAUZ,EAAAA,GAAAA,CAAIa,MAAM,CAAA;AACnC,iBAAA,CAAA;AACF;YAEA,MAAMX,KAAAA;AACR;AACF,KAAA,CAAA;AACF,CAAA;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Programmatic sentry middleware. We do not want to expose it in the plugin
|
|
3
|
+
*/ var initSentryMiddleware = (({ strapi })=>{
|
|
4
|
+
const sentryService = strapi.plugin('sentry').service('sentry');
|
|
5
|
+
sentryService.init();
|
|
6
|
+
const sentry = sentryService.getInstance();
|
|
7
|
+
if (!sentry) {
|
|
8
|
+
// initialization failed
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
strapi.server.use(async (ctx, next)=>{
|
|
12
|
+
try {
|
|
13
|
+
await next();
|
|
14
|
+
} catch (error) {
|
|
15
|
+
if (error instanceof Error) {
|
|
16
|
+
sentryService.sendError(error, (scope)=>{
|
|
17
|
+
scope.addEventProcessor((event)=>{
|
|
18
|
+
// Parse Koa context to add error metadata
|
|
19
|
+
return sentry.Handlers.parseRequest(event, ctx.request, {
|
|
20
|
+
// Don't parse the transaction name, we'll do it manually
|
|
21
|
+
transaction: false
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
// Manually add transaction name
|
|
25
|
+
scope.setTag('transaction', `${ctx.method} ${ctx._matchedRoute}`);
|
|
26
|
+
// Manually add Strapi version
|
|
27
|
+
scope.setTag('strapi_version', strapi.config.info.strapi);
|
|
28
|
+
scope.setTag('method', ctx.method);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export { initSentryMiddleware as default };
|
|
37
|
+
//# sourceMappingURL=sentry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.mjs","sources":["../../../server/src/middlewares/sentry.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\nimport type Sentry from '@sentry/node';\nimport type createSentryService from '../services/sentry';\n\n/**\n * Programmatic sentry middleware. We do not want to expose it in the plugin\n */\nexport default ({ strapi }: { strapi: Core.Strapi }) => {\n const sentryService: ReturnType<typeof createSentryService> = strapi\n .plugin('sentry')\n .service('sentry');\n sentryService.init();\n const sentry = sentryService.getInstance();\n\n if (!sentry) {\n // initialization failed\n return;\n }\n\n strapi.server.use(async (ctx, next) => {\n try {\n await next();\n } catch (error) {\n if (error instanceof Error) {\n sentryService.sendError(error, (scope: Sentry.Scope) => {\n scope.addEventProcessor((event) => {\n // Parse Koa context to add error metadata\n return sentry.Handlers.parseRequest(event, ctx.request as Sentry.Request, {\n // Don't parse the transaction name, we'll do it manually\n transaction: false,\n });\n });\n\n // Manually add transaction name\n scope.setTag('transaction', `${ctx.method} ${ctx._matchedRoute}`);\n // Manually add Strapi version\n scope.setTag('strapi_version', strapi.config.info.strapi);\n scope.setTag('method', ctx.method);\n });\n }\n\n throw error;\n }\n });\n};\n"],"names":["strapi","sentryService","plugin","service","init","sentry","getInstance","server","use","ctx","next","error","Error","sendError","scope","addEventProcessor","event","Handlers","parseRequest","request","transaction","setTag","method","_matchedRoute","config","info"],"mappings":"AAIA;;AAEC,IACD,2BAAe,CAAA,CAAC,EAAEA,MAAM,EAA2B,GAAA;AACjD,IAAA,MAAMC,gBAAwDD,MAC3DE,CAAAA,MAAM,CAAC,QAAA,CAAA,CACPC,OAAO,CAAC,QAAA,CAAA;AACXF,IAAAA,aAAAA,CAAcG,IAAI,EAAA;IAClB,MAAMC,MAAAA,GAASJ,cAAcK,WAAW,EAAA;AAExC,IAAA,IAAI,CAACD,MAAQ,EAAA;;AAEX,QAAA;AACF;AAEAL,IAAAA,MAAAA,CAAOO,MAAM,CAACC,GAAG,CAAC,OAAOC,GAAKC,EAAAA,IAAAA,GAAAA;QAC5B,IAAI;YACF,MAAMA,IAAAA,EAAAA;AACR,SAAA,CAAE,OAAOC,KAAO,EAAA;AACd,YAAA,IAAIA,iBAAiBC,KAAO,EAAA;gBAC1BX,aAAcY,CAAAA,SAAS,CAACF,KAAAA,EAAO,CAACG,KAAAA,GAAAA;oBAC9BA,KAAMC,CAAAA,iBAAiB,CAAC,CAACC,KAAAA,GAAAA;;wBAEvB,OAAOX,MAAAA,CAAOY,QAAQ,CAACC,YAAY,CAACF,KAAOP,EAAAA,GAAAA,CAAIU,OAAO,EAAoB;;4BAExEC,WAAa,EAAA;AACf,yBAAA,CAAA;AACF,qBAAA,CAAA;;AAGAN,oBAAAA,KAAAA,CAAMO,MAAM,CAAC,aAAe,EAAA,CAAC,EAAEZ,GAAAA,CAAIa,MAAM,CAAC,CAAC,EAAEb,GAAIc,CAAAA,aAAa,CAAC,CAAC,CAAA;;oBAEhET,KAAMO,CAAAA,MAAM,CAAC,gBAAkBrB,EAAAA,MAAAA,CAAOwB,MAAM,CAACC,IAAI,CAACzB,MAAM,CAAA;AACxDc,oBAAAA,KAAAA,CAAMO,MAAM,CAAC,QAAUZ,EAAAA,GAAAA,CAAIa,MAAM,CAAA;AACnC,iBAAA,CAAA;AACF;YAEA,MAAMX,KAAAA;AACR;AACF,KAAA,CAAA;AACF,CAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../server/src/services/index.ts"],"sourcesContent":["import sentry from './sentry';\n\nexport default {\n sentry,\n};\n"],"names":["sentry"],"mappings":";;;;AAEA,eAAe;AACbA,IAAAA;AACF,CAAE;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../server/src/services/index.ts"],"sourcesContent":["import sentry from './sentry';\n\nexport default {\n sentry,\n};\n"],"names":["sentry"],"mappings":";;AAEA,eAAe;AACbA,IAAAA;AACF,CAAE;;;;"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Sentry = require('@sentry/node');
|
|
4
|
+
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
var n = Object.create(null);
|
|
7
|
+
if (e) {
|
|
8
|
+
Object.keys(e).forEach(function (k) {
|
|
9
|
+
if (k !== 'default') {
|
|
10
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return e[k]; }
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var Sentry__namespace = /*#__PURE__*/_interopNamespaceDefault(Sentry);
|
|
23
|
+
|
|
24
|
+
const createSentryService = (strapi)=>{
|
|
25
|
+
let isReady = false;
|
|
26
|
+
let instance = null;
|
|
27
|
+
// Retrieve user config and merge it with the default one
|
|
28
|
+
const config = strapi.config.get('plugin::sentry');
|
|
29
|
+
return {
|
|
30
|
+
/**
|
|
31
|
+
* Initialize Sentry service
|
|
32
|
+
*/ init () {
|
|
33
|
+
// Make sure there isn't a Sentry instance already running
|
|
34
|
+
if (instance != null) {
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
// Don't init Sentry if no DSN was provided
|
|
38
|
+
if (!config.dsn) {
|
|
39
|
+
strapi.log.info('@strapi/plugin-sentry is disabled because no Sentry DSN was provided');
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
Sentry__namespace.init({
|
|
44
|
+
dsn: config.dsn,
|
|
45
|
+
environment: strapi.config.get('environment'),
|
|
46
|
+
...config.init
|
|
47
|
+
});
|
|
48
|
+
// Store the successfully initialized Sentry instance
|
|
49
|
+
instance = Sentry__namespace;
|
|
50
|
+
isReady = true;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
strapi.log.warn('Could not set up Sentry, make sure you entered a valid DSN');
|
|
53
|
+
}
|
|
54
|
+
return this;
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Expose Sentry instance through a getter
|
|
58
|
+
*/ getInstance () {
|
|
59
|
+
return instance;
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Higher level method to send exception events to Sentry
|
|
63
|
+
*/ sendError (error, configureScope) {
|
|
64
|
+
// Make sure Sentry is ready
|
|
65
|
+
if (!isReady || !instance) {
|
|
66
|
+
strapi.log.warn("Sentry wasn't properly initialized, cannot send event");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
instance.withScope((scope)=>{
|
|
70
|
+
// Configure the Sentry scope using the provided callback
|
|
71
|
+
if (configureScope && config.sendMetadata) {
|
|
72
|
+
configureScope(scope);
|
|
73
|
+
}
|
|
74
|
+
// Actually send the Error to Sentry
|
|
75
|
+
instance?.captureException(error);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
var sentry = (({ strapi })=>createSentryService(strapi));
|
|
81
|
+
|
|
82
|
+
module.exports = sentry;
|
|
83
|
+
//# sourceMappingURL=sentry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.js","sources":["../../../server/src/services/sentry.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\nimport type { Config } from 'src/config';\nimport * as Sentry from '@sentry/node';\n\nconst createSentryService = (strapi: Core.Strapi) => {\n let isReady = false;\n let instance: typeof Sentry | null = null;\n\n // Retrieve user config and merge it with the default one\n const config = strapi.config.get('plugin::sentry') as Config;\n\n return {\n /**\n * Initialize Sentry service\n */\n init() {\n // Make sure there isn't a Sentry instance already running\n if (instance != null) {\n return this;\n }\n\n // Don't init Sentry if no DSN was provided\n if (!config.dsn) {\n strapi.log.info('@strapi/plugin-sentry is disabled because no Sentry DSN was provided');\n return this;\n }\n\n try {\n Sentry.init({\n dsn: config.dsn,\n environment: strapi.config.get('environment'),\n ...config.init,\n });\n\n // Store the successfully initialized Sentry instance\n instance = Sentry;\n isReady = true;\n } catch (error) {\n strapi.log.warn('Could not set up Sentry, make sure you entered a valid DSN');\n }\n\n return this;\n },\n\n /**\n * Expose Sentry instance through a getter\n */\n getInstance() {\n return instance;\n },\n\n /**\n * Higher level method to send exception events to Sentry\n */\n sendError(error: Error, configureScope?: (scope: Sentry.Scope) => void) {\n // Make sure Sentry is ready\n if (!isReady || !instance) {\n strapi.log.warn(\"Sentry wasn't properly initialized, cannot send event\");\n return;\n }\n\n instance.withScope((scope) => {\n // Configure the Sentry scope using the provided callback\n if (configureScope && config.sendMetadata) {\n configureScope(scope);\n }\n\n // Actually send the Error to Sentry\n instance?.captureException(error);\n });\n },\n };\n};\n\nexport default ({ strapi }: { strapi: Core.Strapi }) => createSentryService(strapi);\n"],"names":["createSentryService","strapi","isReady","instance","config","get","init","dsn","log","info","Sentry","environment","error","warn","getInstance","sendError","configureScope","withScope","scope","sendMetadata","captureException"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAMA,sBAAsB,CAACC,MAAAA,GAAAA;AAC3B,IAAA,IAAIC,OAAU,GAAA,KAAA;AACd,IAAA,IAAIC,QAAiC,GAAA,IAAA;;AAGrC,IAAA,MAAMC,MAASH,GAAAA,MAAAA,CAAOG,MAAM,CAACC,GAAG,CAAC,gBAAA,CAAA;IAEjC,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;;AAEE,YAAA,IAAIH,YAAY,IAAM,EAAA;AACpB,gBAAA,OAAO,IAAI;AACb;;YAGA,IAAI,CAACC,MAAOG,CAAAA,GAAG,EAAE;gBACfN,MAAOO,CAAAA,GAAG,CAACC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|
+
// Retrieve user config and merge it with the default one
|
|
7
|
+
const config = strapi.config.get('plugin::sentry');
|
|
8
|
+
return {
|
|
9
|
+
/**
|
|
10
|
+
* Initialize Sentry service
|
|
11
|
+
*/ init () {
|
|
12
|
+
// Make sure there isn't a Sentry instance already running
|
|
13
|
+
if (instance != null) {
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
// Don't init Sentry if no DSN was provided
|
|
17
|
+
if (!config.dsn) {
|
|
18
|
+
strapi.log.info('@strapi/plugin-sentry is disabled because no Sentry DSN was provided');
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
Sentry.init({
|
|
23
|
+
dsn: config.dsn,
|
|
24
|
+
environment: strapi.config.get('environment'),
|
|
25
|
+
...config.init
|
|
26
|
+
});
|
|
27
|
+
// Store the successfully initialized Sentry instance
|
|
28
|
+
instance = Sentry;
|
|
29
|
+
isReady = true;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
strapi.log.warn('Could not set up Sentry, make sure you entered a valid DSN');
|
|
32
|
+
}
|
|
33
|
+
return this;
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Expose Sentry instance through a getter
|
|
37
|
+
*/ getInstance () {
|
|
38
|
+
return instance;
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Higher level method to send exception events to Sentry
|
|
42
|
+
*/ sendError (error, configureScope) {
|
|
43
|
+
// Make sure Sentry is ready
|
|
44
|
+
if (!isReady || !instance) {
|
|
45
|
+
strapi.log.warn("Sentry wasn't properly initialized, cannot send event");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
instance.withScope((scope)=>{
|
|
49
|
+
// Configure the Sentry scope using the provided callback
|
|
50
|
+
if (configureScope && config.sendMetadata) {
|
|
51
|
+
configureScope(scope);
|
|
52
|
+
}
|
|
53
|
+
// Actually send the Error to Sentry
|
|
54
|
+
instance?.captureException(error);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
var sentry = (({ strapi })=>createSentryService(strapi));
|
|
60
|
+
|
|
61
|
+
export { sentry as default };
|
|
62
|
+
//# sourceMappingURL=sentry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.mjs","sources":["../../../server/src/services/sentry.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\nimport type { Config } from 'src/config';\nimport * as Sentry from '@sentry/node';\n\nconst createSentryService = (strapi: Core.Strapi) => {\n let isReady = false;\n let instance: typeof Sentry | null = null;\n\n // Retrieve user config and merge it with the default one\n const config = strapi.config.get('plugin::sentry') as Config;\n\n return {\n /**\n * Initialize Sentry service\n */\n init() {\n // Make sure there isn't a Sentry instance already running\n if (instance != null) {\n return this;\n }\n\n // Don't init Sentry if no DSN was provided\n if (!config.dsn) {\n strapi.log.info('@strapi/plugin-sentry is disabled because no Sentry DSN was provided');\n return this;\n }\n\n try {\n Sentry.init({\n dsn: config.dsn,\n environment: strapi.config.get('environment'),\n ...config.init,\n });\n\n // Store the successfully initialized Sentry instance\n instance = Sentry;\n isReady = true;\n } catch (error) {\n strapi.log.warn('Could not set up Sentry, make sure you entered a valid DSN');\n }\n\n return this;\n },\n\n /**\n * Expose Sentry instance through a getter\n */\n getInstance() {\n return instance;\n },\n\n /**\n * Higher level method to send exception events to Sentry\n */\n sendError(error: Error, configureScope?: (scope: Sentry.Scope) => void) {\n // Make sure Sentry is ready\n if (!isReady || !instance) {\n strapi.log.warn(\"Sentry wasn't properly initialized, cannot send event\");\n return;\n }\n\n instance.withScope((scope) => {\n // Configure the Sentry scope using the provided callback\n if (configureScope && config.sendMetadata) {\n configureScope(scope);\n }\n\n // Actually send the Error to Sentry\n instance?.captureException(error);\n });\n },\n };\n};\n\nexport default ({ strapi }: { strapi: Core.Strapi }) => createSentryService(strapi);\n"],"names":["createSentryService","strapi","isReady","instance","config","get","init","dsn","log","info","Sentry","environment","error","warn","getInstance","sendError","config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IF,cAAAA,IAAkBZ,MAAOe,CAAAA,YAAY,EAAE;oBACzCH,cAAeE,CAAAA,KAAAA,CAAAA;AACjB;;AAGAf,gBAAAA,QAAAA,EAAUiB,gBAAiBR,CAAAA,KAAAA,CAAAA;AAC7B,aAAA,CAAA;AACF;AACF,KAAA;AACF,CAAA;AAEA,aAAe,CAAA,CAAC,EAAEX,MAAM,EAA2B,GAAKD,mBAAAA,CAAoBC,OAAM;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/plugin-sentry",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.3",
|
|
4
4
|
"description": "Send Strapi error events to Sentry",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@strapi/icons": "2.0.0-rc.18"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@strapi/strapi": "5.12.
|
|
61
|
+
"@strapi/strapi": "5.12.3",
|
|
62
62
|
"react": "18.3.1",
|
|
63
63
|
"react-dom": "18.3.1",
|
|
64
64
|
"react-router-dom": "6.22.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dk-2c1X5YD1.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dk-C64Vk1_X.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"en-CzMdlTs0.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"en-DDCHBy0-.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"es-BnizV7-a.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"es-l4HaM-C0.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fr-BsXNdB-N.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fr-rJIDC4Jx.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ko-BrDfWiIr.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ko-CoJrUsj1.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pl-6JvJwTZm.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pl-DbPKh3_6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ru-B4OA2fUb.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ru-CgCHTIu5.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sv-DrckibdJ.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sv-OPAT8f7H.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tr-C8CxtgGx.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tr-DMgP5sU_.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uk-B2xQjt3Y.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uk-DTdvxZPe.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vi-CpPssghl.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vi-D0rPKKIu.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zh-MmnOh-xz.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zh-TX10GrSY.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|