@payloadcms/plugin-sentry 3.2.3-canary.673b4b5 → 3.3.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/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { ScopeContext } from '@sentry/types'\nimport type { APIError, Config } from 'payload'\n\nimport type { PluginOptions } from './types.js'\n\nexport { PluginOptions }\n/**\n * @example\n * ```ts\n * import * as Sentry from '@sentry/nextjs'\n *\n * sentryPlugin({\n * options: {\n * captureErrors: [400, 403],\n * context: ({ defaultContext, req }) => {\n * return {\n * ...defaultContext,\n * tags: {\n * locale: req.locale,\n * },\n * }\n * },\n * debug: true,\n * },\n * Sentry,\n * })\n * ```\n */\nexport const sentryPlugin =\n (pluginOptions: PluginOptions) =>\n (config: Config): Config => {\n const { enabled = true, options = {}, Sentry } = pluginOptions\n\n if (!enabled || !Sentry) {\n return config\n }\n\n const { captureErrors = [], debug = false } = options\n\n return {\n ...config,\n admin: {\n ...config.admin,\n components: {\n ...config.admin?.components,\n providers: [\n ...(config.admin?.components?.providers ?? []),\n '@payloadcms/plugin-sentry/client#AdminErrorBoundary',\n ],\n },\n },\n hooks: {\n afterError: [\n ...(config.hooks?.afterError ?? []),\n async (args) => {\n const status = (args.error as APIError).status ?? 500\n if (status >= 500 || captureErrors.includes(status)) {\n let context: Partial<ScopeContext> = {\n extra: {\n errorCollectionSlug: args.collection?.slug,\n },\n ...(args.req.user && {\n user: {\n id: args.req.user.id,\n collection: args.req.user.collection,\n email: args.req.user.email,\n ip_address: args.req.headers?.get('X-Forwarded-For') ?? undefined,\n username: args.req.user.username,\n },\n }),\n }\n\n if (options?.context) {\n context = await options.context({\n ...args,\n defaultContext: context,\n })\n }\n\n const id = Sentry.captureException(args.error, context)\n\n if (debug) {\n args.req.payload.logger.info(\n `Captured exception ${id} to Sentry, error msg: ${args.error.message}`,\n )\n }\n }\n },\n ],\n },\n }\n }\n"],"names":["sentryPlugin","pluginOptions","config","enabled","options","Sentry","captureErrors","debug","admin","components","providers","hooks","afterError","args","status","error","includes","context","extra","errorCollectionSlug","collection","slug","req","user","id","email","ip_address","headers","get","undefined","username","defaultContext","captureException","payload","logger","info","message"],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,MAAMA,eACX,CAACC,gBACD,CAACC;QACC,MAAM,EAAEC,UAAU,IAAI,EAAEC,UAAU,CAAC,CAAC,EAAEC,MAAM,EAAE,GAAGJ;QAEjD,IAAI,CAACE,WAAW,CAACE,QAAQ;YACvB,OAAOH;QACT;QAEA,MAAM,EAAEI,gBAAgB,EAAE,EAAEC,QAAQ,KAAK,EAAE,GAAGH;QAE9C,OAAO;YACL,GAAGF,MAAM;YACTM,OAAO;gBACL,GAAGN,OAAOM,KAAK;gBACfC,YAAY;oBACV,GAAGP,OAAOM,KAAK,EAAEC,UAAU;oBAC3BC,WAAW;2BACLR,OAAOM,KAAK,EAAEC,YAAYC,aAAa,EAAE;wBAC7C;qBACD;gBACH;YACF;YACAC,OAAO;gBACLC,YAAY;uBACNV,OAAOS,KAAK,EAAEC,cAAc,EAAE;oBAClC,OAAOC;wBACL,MAAMC,SAAS,AAACD,KAAKE,KAAK,CAAcD,MAAM,IAAI;wBAClD,IAAIA,UAAU,OAAOR,cAAcU,QAAQ,CAACF,SAAS;4BACnD,IAAIG,UAAiC;gCACnCC,OAAO;oCACLC,qBAAqBN,KAAKO,UAAU,EAAEC;gCACxC;gCACA,GAAIR,KAAKS,GAAG,CAACC,IAAI,IAAI;oCACnBA,MAAM;wCACJC,IAAIX,KAAKS,GAAG,CAACC,IAAI,CAACC,EAAE;wCACpBJ,YAAYP,KAAKS,GAAG,CAACC,IAAI,CAACH,UAAU;wCACpCK,OAAOZ,KAAKS,GAAG,CAACC,IAAI,CAACE,KAAK;wCAC1BC,YAAYb,KAAKS,GAAG,CAACK,OAAO,EAAEC,IAAI,sBAAsBC;wCACxDC,UAAUjB,KAAKS,GAAG,CAACC,IAAI,CAACO,QAAQ;oCAClC;gCACF,CAAC;4BACH;4BAEA,IAAI1B,SAASa,SAAS;gCACpBA,UAAU,MAAMb,QAAQa,OAAO,CAAC;oCAC9B,GAAGJ,IAAI;oCACPkB,gBAAgBd;gCAClB;4BACF;4BAEA,MAAMO,KAAKnB,OAAO2B,gBAAgB,CAACnB,KAAKE,KAAK,EAAEE;4BAE/C,IAAIV,OAAO;gCACTM,KAAKS,GAAG,CAACW,OAAO,CAACC,MAAM,CAACC,IAAI,CAC1B,CAAC,mBAAmB,EAAEX,GAAG,uBAAuB,EAAEX,KAAKE,KAAK,CAACqB,OAAO,CAAC,CAAC;4BAE1E;wBACF;oBACF;iBACD;YACH;QACF;IACF,EAAC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { ScopeContext } from '@sentry/types'\nimport type { APIError, Config } from 'payload'\n\nimport type { PluginOptions } from './types.js'\n\nexport { PluginOptions }\n/**\n * @example\n * ```ts\n * import * as Sentry from '@sentry/nextjs'\n *\n * sentryPlugin({\n * options: {\n * captureErrors: [400, 403],\n * context: ({ defaultContext, req }) => {\n * return {\n * ...defaultContext,\n * tags: {\n * locale: req.locale,\n * },\n * }\n * },\n * debug: true,\n * },\n * Sentry,\n * })\n * ```\n */\nexport const sentryPlugin =\n (pluginOptions: PluginOptions) =>\n (config: Config): Config => {\n const { enabled = true, options = {}, Sentry } = pluginOptions\n\n if (!enabled || !Sentry) {\n return config\n }\n\n const { captureErrors = [], debug = false } = options\n\n return {\n ...config,\n admin: {\n ...config.admin,\n components: {\n ...config.admin?.components,\n providers: [\n ...(config.admin?.components?.providers ?? []),\n '@payloadcms/plugin-sentry/client#AdminErrorBoundary',\n ],\n },\n },\n hooks: {\n afterError: [\n ...(config.hooks?.afterError ?? []),\n async (args) => {\n const status = (args.error as APIError).status ?? 500\n if (status >= 500 || captureErrors.includes(status)) {\n let context: Partial<ScopeContext> = {\n extra: {\n errorCollectionSlug: args.collection?.slug,\n },\n ...(args.req.user && {\n user: {\n id: args.req.user.id,\n collection: args.req.user.collection,\n email: args.req.user.email,\n ip_address: args.req.headers?.get('X-Forwarded-For') ?? undefined,\n username: args.req.user.username,\n },\n }),\n }\n\n if (options?.context) {\n context = await options.context({\n ...args,\n defaultContext: context,\n })\n }\n\n const id = Sentry.captureException(args.error, context)\n\n if (debug) {\n args.req.payload.logger.info(\n `Captured exception ${id} to Sentry, error msg: ${args.error.message}`,\n )\n }\n }\n },\n ],\n },\n }\n }\n"],"names":["sentryPlugin","pluginOptions","config","enabled","options","Sentry","captureErrors","debug","admin","components","providers","hooks","afterError","args","status","error","includes","context","extra","errorCollectionSlug","collection","slug","req","user","id","email","ip_address","headers","get","undefined","username","defaultContext","captureException","payload","logger","info","message"],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,MAAMA,eACX,CAACC,gBACD,CAACC;QACC,MAAM,EAAEC,UAAU,IAAI,EAAEC,UAAU,CAAC,CAAC,EAAEC,MAAM,EAAE,GAAGJ;QAEjD,IAAI,CAACE,WAAW,CAACE,QAAQ;YACvB,OAAOH;QACT;QAEA,MAAM,EAAEI,gBAAgB,EAAE,EAAEC,QAAQ,KAAK,EAAE,GAAGH;QAE9C,OAAO;YACL,GAAGF,MAAM;YACTM,OAAO;gBACL,GAAGN,OAAOM,KAAK;gBACfC,YAAY;oBACV,GAAGP,OAAOM,KAAK,EAAEC,UAAU;oBAC3BC,WAAW;2BACLR,OAAOM,KAAK,EAAEC,YAAYC,aAAa,EAAE;wBAC7C;qBACD;gBACH;YACF;YACAC,OAAO;gBACLC,YAAY;uBACNV,OAAOS,KAAK,EAAEC,cAAc,EAAE;oBAClC,OAAOC;wBACL,MAAMC,SAAS,AAACD,KAAKE,KAAK,CAAcD,MAAM,IAAI;wBAClD,IAAIA,UAAU,OAAOR,cAAcU,QAAQ,CAACF,SAAS;4BACnD,IAAIG,UAAiC;gCACnCC,OAAO;oCACLC,qBAAqBN,KAAKO,UAAU,EAAEC;gCACxC;gCACA,GAAIR,KAAKS,GAAG,CAACC,IAAI,IAAI;oCACnBA,MAAM;wCACJC,IAAIX,KAAKS,GAAG,CAACC,IAAI,CAACC,EAAE;wCACpBJ,YAAYP,KAAKS,GAAG,CAACC,IAAI,CAACH,UAAU;wCACpCK,OAAOZ,KAAKS,GAAG,CAACC,IAAI,CAACE,KAAK;wCAC1BC,YAAYb,KAAKS,GAAG,CAACK,OAAO,EAAEC,IAAI,sBAAsBC;wCACxDC,UAAUjB,KAAKS,GAAG,CAACC,IAAI,CAACO,QAAQ;oCAClC;gCACF,CAAC;4BACH;4BAEA,IAAI1B,SAASa,SAAS;gCACpBA,UAAU,MAAMb,QAAQa,OAAO,CAAC;oCAC9B,GAAGJ,IAAI;oCACPkB,gBAAgBd;gCAClB;4BACF;4BAEA,MAAMO,KAAKnB,OAAO2B,gBAAgB,CAACnB,KAAKE,KAAK,EAAEE;4BAE/C,IAAIV,OAAO;gCACTM,KAAKS,GAAG,CAACW,OAAO,CAACC,MAAM,CAACC,IAAI,CAC1B,CAAC,mBAAmB,EAAEX,GAAG,uBAAuB,EAAEX,KAAKE,KAAK,CAACqB,OAAO,EAAE;4BAE1E;wBACF;oBACF;iBACD;YACH;QACF;IACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-sentry",
3
- "version": "3.2.3-canary.673b4b5",
3
+ "version": "3.3.0",
4
4
  "description": "Sentry plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -50,12 +50,12 @@
50
50
  "@types/react": "npm:types-react@19.0.0-rc.1",
51
51
  "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
52
52
  "@payloadcms/eslint-config": "3.0.0",
53
- "payload": "3.2.3-canary.673b4b5"
53
+ "payload": "3.3.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
57
57
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
58
- "payload": "3.2.3-canary.673b4b5"
58
+ "payload": "3.3.0"
59
59
  },
60
60
  "homepage:": "https://payloadcms.com",
61
61
  "overrides": {