@strapi/plugin-sentry 5.51.1 → 5.52.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.
@@ -1 +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,MAAAA,CAC3DE,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,MAAAA,EAAQ;;AAEX,QAAA;AACF,IAAA;AAEAL,IAAAA,MAAAA,CAAOO,MAAM,CAACC,GAAG,CAAC,OAAOC,GAAAA,EAAKC,IAAAA,GAAAA;QAC5B,IAAI;YACF,MAAMA,IAAAA,EAAAA;AACR,QAAA,CAAA,CAAE,OAAOC,KAAAA,EAAO;AACd,YAAA,IAAIA,iBAAiBC,KAAAA,EAAO;gBAC1BX,aAAAA,CAAcY,SAAS,CAACF,KAAAA,EAAO,CAACG,KAAAA,GAAAA;oBAC9BA,KAAAA,CAAMC,iBAAiB,CAAC,CAACC,KAAAA,GAAAA;;wBAEvB,OAAOX,MAAAA,CAAOY,QAAQ,CAACC,YAAY,CAACF,KAAAA,EAAOP,GAAAA,CAAIU,OAAO,EAAoB;;4BAExEC,WAAAA,EAAa;AACf,yBAAA,CAAA;AACF,oBAAA,CAAA,CAAA;;oBAGAN,KAAAA,CAAMO,MAAM,CAAC,aAAA,EAAe,CAAA,EAAGZ,GAAAA,CAAIa,MAAM,CAAC,CAAC,EAAEb,GAAAA,CAAIc,aAAa,CAAA,CAAE,CAAA;;oBAEhET,KAAAA,CAAMO,MAAM,CAAC,gBAAA,EAAkBrB,MAAAA,CAAOwB,MAAM,CAACC,IAAI,CAACzB,MAAM,CAAA;AACxDc,oBAAAA,KAAAA,CAAMO,MAAM,CAAC,QAAA,EAAUZ,GAAAA,CAAIa,MAAM,CAAA;AACnC,gBAAA,CAAA,CAAA;AACF,YAAA;YAEA,MAAMX,KAAAA;AACR,QAAA;AACF,IAAA,CAAA,CAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"sentry.js","sources":["../../../server/src/middlewares/sentry.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\nimport type * as 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,MAAAA,CAC3DE,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,MAAAA,EAAQ;;AAEX,QAAA;AACF,IAAA;AAEAL,IAAAA,MAAAA,CAAOO,MAAM,CAACC,GAAG,CAAC,OAAOC,GAAAA,EAAKC,IAAAA,GAAAA;QAC5B,IAAI;YACF,MAAMA,IAAAA,EAAAA;AACR,QAAA,CAAA,CAAE,OAAOC,KAAAA,EAAO;AACd,YAAA,IAAIA,iBAAiBC,KAAAA,EAAO;gBAC1BX,aAAAA,CAAcY,SAAS,CAACF,KAAAA,EAAO,CAACG,KAAAA,GAAAA;oBAC9BA,KAAAA,CAAMC,iBAAiB,CAAC,CAACC,KAAAA,GAAAA;;wBAEvB,OAAOX,MAAAA,CAAOY,QAAQ,CAACC,YAAY,CAACF,KAAAA,EAAOP,GAAAA,CAAIU,OAAO,EAAoB;;4BAExEC,WAAAA,EAAa;AACf,yBAAA,CAAA;AACF,oBAAA,CAAA,CAAA;;oBAGAN,KAAAA,CAAMO,MAAM,CAAC,aAAA,EAAe,CAAA,EAAGZ,GAAAA,CAAIa,MAAM,CAAC,CAAC,EAAEb,GAAAA,CAAIc,aAAa,CAAA,CAAE,CAAA;;oBAEhET,KAAAA,CAAMO,MAAM,CAAC,gBAAA,EAAkBrB,MAAAA,CAAOwB,MAAM,CAACC,IAAI,CAACzB,MAAM,CAAA;AACxDc,oBAAAA,KAAAA,CAAMO,MAAM,CAAC,QAAA,EAAUZ,GAAAA,CAAIa,MAAM,CAAA;AACnC,gBAAA,CAAA,CAAA;AACF,YAAA;YAEA,MAAMX,KAAAA;AACR,QAAA;AACF,IAAA,CAAA,CAAA;AACF,CAAA;;;;"}
@@ -1 +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,MAAAA,CAC3DE,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,MAAAA,EAAQ;;AAEX,QAAA;AACF,IAAA;AAEAL,IAAAA,MAAAA,CAAOO,MAAM,CAACC,GAAG,CAAC,OAAOC,GAAAA,EAAKC,IAAAA,GAAAA;QAC5B,IAAI;YACF,MAAMA,IAAAA,EAAAA;AACR,QAAA,CAAA,CAAE,OAAOC,KAAAA,EAAO;AACd,YAAA,IAAIA,iBAAiBC,KAAAA,EAAO;gBAC1BX,aAAAA,CAAcY,SAAS,CAACF,KAAAA,EAAO,CAACG,KAAAA,GAAAA;oBAC9BA,KAAAA,CAAMC,iBAAiB,CAAC,CAACC,KAAAA,GAAAA;;wBAEvB,OAAOX,MAAAA,CAAOY,QAAQ,CAACC,YAAY,CAACF,KAAAA,EAAOP,GAAAA,CAAIU,OAAO,EAAoB;;4BAExEC,WAAAA,EAAa;AACf,yBAAA,CAAA;AACF,oBAAA,CAAA,CAAA;;oBAGAN,KAAAA,CAAMO,MAAM,CAAC,aAAA,EAAe,CAAA,EAAGZ,GAAAA,CAAIa,MAAM,CAAC,CAAC,EAAEb,GAAAA,CAAIc,aAAa,CAAA,CAAE,CAAA;;oBAEhET,KAAAA,CAAMO,MAAM,CAAC,gBAAA,EAAkBrB,MAAAA,CAAOwB,MAAM,CAACC,IAAI,CAACzB,MAAM,CAAA;AACxDc,oBAAAA,KAAAA,CAAMO,MAAM,CAAC,QAAA,EAAUZ,GAAAA,CAAIa,MAAM,CAAA;AACnC,gBAAA,CAAA,CAAA;AACF,YAAA;YAEA,MAAMX,KAAAA;AACR,QAAA;AACF,IAAA,CAAA,CAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"sentry.mjs","sources":["../../../server/src/middlewares/sentry.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\nimport type * as 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,MAAAA,CAC3DE,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,MAAAA,EAAQ;;AAEX,QAAA;AACF,IAAA;AAEAL,IAAAA,MAAAA,CAAOO,MAAM,CAACC,GAAG,CAAC,OAAOC,GAAAA,EAAKC,IAAAA,GAAAA;QAC5B,IAAI;YACF,MAAMA,IAAAA,EAAAA;AACR,QAAA,CAAA,CAAE,OAAOC,KAAAA,EAAO;AACd,YAAA,IAAIA,iBAAiBC,KAAAA,EAAO;gBAC1BX,aAAAA,CAAcY,SAAS,CAACF,KAAAA,EAAO,CAACG,KAAAA,GAAAA;oBAC9BA,KAAAA,CAAMC,iBAAiB,CAAC,CAACC,KAAAA,GAAAA;;wBAEvB,OAAOX,MAAAA,CAAOY,QAAQ,CAACC,YAAY,CAACF,KAAAA,EAAOP,GAAAA,CAAIU,OAAO,EAAoB;;4BAExEC,WAAAA,EAAa;AACf,yBAAA,CAAA;AACF,oBAAA,CAAA,CAAA;;oBAGAN,KAAAA,CAAMO,MAAM,CAAC,aAAA,EAAe,CAAA,EAAGZ,GAAAA,CAAIa,MAAM,CAAC,CAAC,EAAEb,GAAAA,CAAIc,aAAa,CAAA,CAAE,CAAA;;oBAEhET,KAAAA,CAAMO,MAAM,CAAC,gBAAA,EAAkBrB,MAAAA,CAAOwB,MAAM,CAACC,IAAI,CAACzB,MAAM,CAAA;AACxDc,oBAAAA,KAAAA,CAAMO,MAAM,CAAC,QAAA,EAAUZ,GAAAA,CAAIa,MAAM,CAAA;AACnC,gBAAA,CAAA,CAAA;AACF,YAAA;YAEA,MAAMX,KAAAA;AACR,QAAA;AACF,IAAA,CAAA,CAAA;AACF,CAAA;;;;"}
@@ -49,7 +49,7 @@ const createSentryService = (strapi)=>{
49
49
  // Store the successfully initialized Sentry instance
50
50
  instance = Sentry__namespace;
51
51
  isReady = true;
52
- } catch (error) {
52
+ } catch {
53
53
  strapi.log.warn('Could not set up Sentry, make sure you entered a valid DSN');
54
54
  }
55
55
  return this;
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.js","sources":["../../../server/src/services/sentry.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\nimport * as Sentry from '@sentry/node';\nimport type { Config } from '../config';\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,OAAAA,GAAU,KAAA;AACd,IAAA,IAAIC,QAAAA,GAAiC,IAAA;;AAGrC,IAAA,MAAMC,MAAAA,GAASH,MAAAA,CAAOG,MAAM,CAACC,GAAG,CAAC,gBAAA,CAAA;IAEjC,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;;AAEE,YAAA,IAAIH,YAAY,IAAA,EAAM;AACpB,gBAAA,OAAO,IAAI;AACb,YAAA;;YAGA,IAAI,CAACC,MAAAA,CAAOG,GAAG,EAAE;gBACfN,MAAAA,CAAOO,GAAG,CAACC,IAAI,CAAC,sEAAA,CAAA;AAChB,gBAAA,OAAO,IAAI;AACb,YAAA;YAEA,IAAI;AACFC,gBAAAA,iBAAAA,CAAOJ,IAAI,CAAC;AACVC,oBAAAA,GAAAA,EAAKH,OAAOG,GAAG;AACfI,oBAAAA,WAAAA,EAAaV,MAAAA,CAAOG,MAAM,CAACC,GAAG,CAAC,aAAA,CAAA;AAC/B,oBAAA,GAAGD,OAAOE;AACZ,iBAAA,CAAA;;gBAGAH,QAAAA,GAAWO,iBAAAA;gBACXR,OAAAA,GAAU,IAAA;AACZ,YAAA,CAAA,CAAE,OAAOU,KAAAA,EAAO;gBACdX,MAAAA,CAAOO,GAAG,CAACK,IAAI,CAAC,4DAAA,CAAA;AAClB,YAAA;AAEA,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEA;;QAGAC,WAAAA,CAAAA,GAAAA;YACE,OAAOX,QAAAA;AACT,QAAA,CAAA;AAEA;;QAGAY,SAAAA,CAAAA,CAAUH,KAAY,EAAEI,cAA8C,EAAA;;YAEpE,IAAI,CAACd,OAAAA,IAAW,CAACC,QAAAA,EAAU;gBACzBF,MAAAA,CAAOO,GAAG,CAACK,IAAI,CAAC,uDAAA,CAAA;AAChB,gBAAA;AACF,YAAA;YAEAV,QAAAA,CAASc,SAAS,CAAC,CAACC,KAAAA,GAAAA;;gBAElB,IAAIF,cAAAA,IAAkBZ,MAAAA,CAAOe,YAAY,EAAE;oBACzCH,cAAAA,CAAeE,KAAAA,CAAAA;AACjB,gBAAA;;AAGAf,gBAAAA,QAAAA,EAAUiB,gBAAAA,CAAiBR,KAAAA,CAAAA;AAC7B,YAAA,CAAA,CAAA;AACF,QAAA;AACF,KAAA;AACF,CAAA;AAEA,aAAe,CAAA,CAAC,EAAEX,MAAM,EAA2B,GAAKD,mBAAAA,CAAoBC,OAAM;;;;"}
1
+ {"version":3,"file":"sentry.js","sources":["../../../server/src/services/sentry.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\nimport * as Sentry from '@sentry/node';\nimport type { Config } from '../config';\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 {\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","warn","getInstance","sendError","error","configureScope","withScope","scope","sendMetadata","captureException"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAMA,sBAAsB,CAACC,MAAAA,GAAAA;AAC3B,IAAA,IAAIC,OAAAA,GAAU,KAAA;AACd,IAAA,IAAIC,QAAAA,GAAiC,IAAA;;AAGrC,IAAA,MAAMC,MAAAA,GAASH,MAAAA,CAAOG,MAAM,CAACC,GAAG,CAAC,gBAAA,CAAA;IAEjC,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;;AAEE,YAAA,IAAIH,YAAY,IAAA,EAAM;AACpB,gBAAA,OAAO,IAAI;AACb,YAAA;;YAGA,IAAI,CAACC,MAAAA,CAAOG,GAAG,EAAE;gBACfN,MAAAA,CAAOO,GAAG,CAACC,IAAI,CAAC,sEAAA,CAAA;AAChB,gBAAA,OAAO,IAAI;AACb,YAAA;YAEA,IAAI;AACFC,gBAAAA,iBAAAA,CAAOJ,IAAI,CAAC;AACVC,oBAAAA,GAAAA,EAAKH,OAAOG,GAAG;AACfI,oBAAAA,WAAAA,EAAaV,MAAAA,CAAOG,MAAM,CAACC,GAAG,CAAC,aAAA,CAAA;AAC/B,oBAAA,GAAGD,OAAOE;AACZ,iBAAA,CAAA;;gBAGAH,QAAAA,GAAWO,iBAAAA;gBACXR,OAAAA,GAAU,IAAA;AACZ,YAAA,CAAA,CAAE,OAAM;gBACND,MAAAA,CAAOO,GAAG,CAACI,IAAI,CAAC,4DAAA,CAAA;AAClB,YAAA;AAEA,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEA;;QAGAC,WAAAA,CAAAA,GAAAA;YACE,OAAOV,QAAAA;AACT,QAAA,CAAA;AAEA;;QAGAW,SAAAA,CAAAA,CAAUC,KAAY,EAAEC,cAA8C,EAAA;;YAEpE,IAAI,CAACd,OAAAA,IAAW,CAACC,QAAAA,EAAU;gBACzBF,MAAAA,CAAOO,GAAG,CAACI,IAAI,CAAC,uDAAA,CAAA;AAChB,gBAAA;AACF,YAAA;YAEAT,QAAAA,CAASc,SAAS,CAAC,CAACC,KAAAA,GAAAA;;gBAElB,IAAIF,cAAAA,IAAkBZ,MAAAA,CAAOe,YAAY,EAAE;oBACzCH,cAAAA,CAAeE,KAAAA,CAAAA;AACjB,gBAAA;;AAGAf,gBAAAA,QAAAA,EAAUiB,gBAAAA,CAAiBL,KAAAA,CAAAA;AAC7B,YAAA,CAAA,CAAA;AACF,QAAA;AACF,KAAA;AACF,CAAA;AAEA,aAAe,CAAA,CAAC,EAAEd,MAAM,EAA2B,GAAKD,mBAAAA,CAAoBC,OAAM;;;;"}
@@ -27,7 +27,7 @@ const createSentryService = (strapi)=>{
27
27
  // Store the successfully initialized Sentry instance
28
28
  instance = Sentry;
29
29
  isReady = true;
30
- } catch (error) {
30
+ } catch {
31
31
  strapi.log.warn('Could not set up Sentry, make sure you entered a valid DSN');
32
32
  }
33
33
  return this;
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.mjs","sources":["../../../server/src/services/sentry.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\nimport * as Sentry from '@sentry/node';\nimport type { Config } from '../config';\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,OAAAA,GAAU,KAAA;AACd,IAAA,IAAIC,QAAAA,GAAiC,IAAA;;AAGrC,IAAA,MAAMC,MAAAA,GAASH,MAAAA,CAAOG,MAAM,CAACC,GAAG,CAAC,gBAAA,CAAA;IAEjC,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;;AAEE,YAAA,IAAIH,YAAY,IAAA,EAAM;AACpB,gBAAA,OAAO,IAAI;AACb,YAAA;;YAGA,IAAI,CAACC,MAAAA,CAAOG,GAAG,EAAE;gBACfN,MAAAA,CAAOO,GAAG,CAACC,IAAI,CAAC,sEAAA,CAAA;AAChB,gBAAA,OAAO,IAAI;AACb,YAAA;YAEA,IAAI;AACFC,gBAAAA,MAAAA,CAAOJ,IAAI,CAAC;AACVC,oBAAAA,GAAAA,EAAKH,OAAOG,GAAG;AACfI,oBAAAA,WAAAA,EAAaV,MAAAA,CAAOG,MAAM,CAACC,GAAG,CAAC,aAAA,CAAA;AAC/B,oBAAA,GAAGD,OAAOE;AACZ,iBAAA,CAAA;;gBAGAH,QAAAA,GAAWO,MAAAA;gBACXR,OAAAA,GAAU,IAAA;AACZ,YAAA,CAAA,CAAE,OAAOU,KAAAA,EAAO;gBACdX,MAAAA,CAAOO,GAAG,CAACK,IAAI,CAAC,4DAAA,CAAA;AAClB,YAAA;AAEA,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEA;;QAGAC,WAAAA,CAAAA,GAAAA;YACE,OAAOX,QAAAA;AACT,QAAA,CAAA;AAEA;;QAGAY,SAAAA,CAAAA,CAAUH,KAAY,EAAEI,cAA8C,EAAA;;YAEpE,IAAI,CAACd,OAAAA,IAAW,CAACC,QAAAA,EAAU;gBACzBF,MAAAA,CAAOO,GAAG,CAACK,IAAI,CAAC,uDAAA,CAAA;AAChB,gBAAA;AACF,YAAA;YAEAV,QAAAA,CAASc,SAAS,CAAC,CAACC,KAAAA,GAAAA;;gBAElB,IAAIF,cAAAA,IAAkBZ,MAAAA,CAAOe,YAAY,EAAE;oBACzCH,cAAAA,CAAeE,KAAAA,CAAAA;AACjB,gBAAA;;AAGAf,gBAAAA,QAAAA,EAAUiB,gBAAAA,CAAiBR,KAAAA,CAAAA;AAC7B,YAAA,CAAA,CAAA;AACF,QAAA;AACF,KAAA;AACF,CAAA;AAEA,aAAe,CAAA,CAAC,EAAEX,MAAM,EAA2B,GAAKD,mBAAAA,CAAoBC,OAAM;;;;"}
1
+ {"version":3,"file":"sentry.mjs","sources":["../../../server/src/services/sentry.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\nimport * as Sentry from '@sentry/node';\nimport type { Config } from '../config';\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 {\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","warn","getInstance","sendError","error","configureScope","withScope","scope","sendMetadata","captureException"],"mappings":";;AAIA,MAAMA,sBAAsB,CAACC,MAAAA,GAAAA;AAC3B,IAAA,IAAIC,OAAAA,GAAU,KAAA;AACd,IAAA,IAAIC,QAAAA,GAAiC,IAAA;;AAGrC,IAAA,MAAMC,MAAAA,GAASH,MAAAA,CAAOG,MAAM,CAACC,GAAG,CAAC,gBAAA,CAAA;IAEjC,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;;AAEE,YAAA,IAAIH,YAAY,IAAA,EAAM;AACpB,gBAAA,OAAO,IAAI;AACb,YAAA;;YAGA,IAAI,CAACC,MAAAA,CAAOG,GAAG,EAAE;gBACfN,MAAAA,CAAOO,GAAG,CAACC,IAAI,CAAC,sEAAA,CAAA;AAChB,gBAAA,OAAO,IAAI;AACb,YAAA;YAEA,IAAI;AACFC,gBAAAA,MAAAA,CAAOJ,IAAI,CAAC;AACVC,oBAAAA,GAAAA,EAAKH,OAAOG,GAAG;AACfI,oBAAAA,WAAAA,EAAaV,MAAAA,CAAOG,MAAM,CAACC,GAAG,CAAC,aAAA,CAAA;AAC/B,oBAAA,GAAGD,OAAOE;AACZ,iBAAA,CAAA;;gBAGAH,QAAAA,GAAWO,MAAAA;gBACXR,OAAAA,GAAU,IAAA;AACZ,YAAA,CAAA,CAAE,OAAM;gBACND,MAAAA,CAAOO,GAAG,CAACI,IAAI,CAAC,4DAAA,CAAA;AAClB,YAAA;AAEA,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEA;;QAGAC,WAAAA,CAAAA,GAAAA;YACE,OAAOV,QAAAA;AACT,QAAA,CAAA;AAEA;;QAGAW,SAAAA,CAAAA,CAAUC,KAAY,EAAEC,cAA8C,EAAA;;YAEpE,IAAI,CAACd,OAAAA,IAAW,CAACC,QAAAA,EAAU;gBACzBF,MAAAA,CAAOO,GAAG,CAACI,IAAI,CAAC,uDAAA,CAAA;AAChB,gBAAA;AACF,YAAA;YAEAT,QAAAA,CAASc,SAAS,CAAC,CAACC,KAAAA,GAAAA;;gBAElB,IAAIF,cAAAA,IAAkBZ,MAAAA,CAAOe,YAAY,EAAE;oBACzCH,cAAAA,CAAeE,KAAAA,CAAAA;AACjB,gBAAA;;AAGAf,gBAAAA,QAAAA,EAAUiB,gBAAAA,CAAiBL,KAAAA,CAAAA;AAC7B,YAAA,CAAA,CAAA;AACF,QAAA;AACF,KAAA;AACF,CAAA;AAEA,aAAe,CAAA,CAAC,EAAEd,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.51.1",
3
+ "version": "5.52.0",
4
4
  "description": "Send Strapi error events to Sentry",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -54,24 +54,24 @@
54
54
  "lint": "run -T eslint . --max-warnings=0",
55
55
  "test:ts:back": "run -T tsc -p server/tsconfig.json",
56
56
  "test:ts:front": "run -T tsc -p admin/tsconfig.json",
57
- "test:unit": "run -T jest",
58
- "test:unit:watch": "run -T jest --watch",
59
- "watch": "run -T rollup -c -w"
57
+ "watch": "run -T rollup -c -w",
58
+ "test:unit:vitest": "vitest run",
59
+ "test:unit:vitest:watch": "vitest --watch"
60
60
  },
61
61
  "dependencies": {
62
62
  "@sentry/node": "7.112.2",
63
- "@strapi/design-system": "2.2.3",
64
- "@strapi/icons": "2.2.3"
63
+ "@strapi/design-system": "2.2.4",
64
+ "@strapi/icons": "2.2.4"
65
65
  },
66
66
  "devDependencies": {
67
- "@strapi/strapi": "5.51.1",
68
- "@types/jest": "29.5.2",
67
+ "@strapi/strapi": "5.52.0",
69
68
  "@types/node": "20.19.41",
70
- "jest": "29.6.0",
71
69
  "react": "18.3.1",
72
70
  "react-dom": "18.3.1",
73
- "react-router-dom": "6.30.3",
74
- "styled-components": "6.4.1"
71
+ "react-router-dom": "6.30.4",
72
+ "styled-components": "6.4.1",
73
+ "vitest": "catalog:",
74
+ "vitest-config": "5.52.0"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@strapi/strapi": "^5.0.0",