@payloadcms/plugin-sentry 4.0.0-canary.6 → 4.0.0-canary.8

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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018-2025 Payload CMS, Inc. <info@payloadcms.com>
3
+ Copyright (c) 2018-2026 Payload CMS, LLC <info@payloadcms.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,MAAM,EAAE,MAAM,SAAS,CAAA;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,OAAO,EAAE,aAAa,EAAE,CAAA;AACxB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,YAAY,GACtB,eAAe,aAAa,MAC5B,QAAQ,MAAM,KAAG,MA6DjB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,MAAM,EAAE,MAAM,SAAS,CAAA;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,OAAO,EAAE,aAAa,EAAE,CAAA;AACxB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,YAAY,GACtB,eAAe,aAAa,MAC5B,QAAQ,MAAM,KAAG,MA8DjB,CAAA"}
package/dist/index.js CHANGED
@@ -51,9 +51,10 @@
51
51
  user: {
52
52
  id: args.req.user.id,
53
53
  collection: args.req.user.collection,
54
- email: args.req.user.email,
54
+ // Payload types email/username as nullable; Sentry's user expects string | undefined
55
+ email: args.req.user.email ?? undefined,
55
56
  ip_address: args.req.headers?.get('X-Forwarded-For') ?? undefined,
56
- username: args.req.user.username
57
+ username: args.req.user.username ?? undefined
57
58
  }
58
59
  }
59
60
  };
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,EAAE;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 // Payload types email/username as nullable; Sentry's user expects string | undefined\n email: args.req.user.email ?? undefined,\n ip_address: args.req.headers?.get('X-Forwarded-For') ?? undefined,\n username: args.req.user.username ?? undefined,\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","undefined","ip_address","headers","get","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;wCACpC,qFAAqF;wCACrFK,OAAOZ,KAAKS,GAAG,CAACC,IAAI,CAACE,KAAK,IAAIC;wCAC9BC,YAAYd,KAAKS,GAAG,CAACM,OAAO,EAAEC,IAAI,sBAAsBH;wCACxDI,UAAUjB,KAAKS,GAAG,CAACC,IAAI,CAACO,QAAQ,IAAIJ;oCACtC;gCACF,CAAC;4BACH;4BAEA,IAAItB,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": "4.0.0-canary.6",
3
+ "version": "4.0.0-canary.8",
4
4
  "description": "Sentry plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -51,12 +51,12 @@
51
51
  "@types/react": "19.2.14",
52
52
  "@types/react-dom": "19.2.3",
53
53
  "@payloadcms/eslint-config": "3.28.0",
54
- "payload": "4.0.0-canary.6"
54
+ "payload": "4.0.0-canary.8"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
58
58
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
59
- "payload": "4.0.0-canary.6"
59
+ "payload": "4.0.0-canary.8"
60
60
  },
61
61
  "homepage:": "https://payloadcms.com",
62
62
  "scripts": {