@payloadcms/plugin-sentry 4.0.0-internal.011fd46 → 4.0.0-internal.0731f09
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 +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/providers/AdminErrorBoundary.d.ts.map +1 -1
- package/package.json +21 -24
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2018-
|
|
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
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Config } from 'payload';
|
|
2
1
|
import type { PluginOptions } from './types.js';
|
|
3
2
|
export { PluginOptions };
|
|
4
3
|
/**
|
|
@@ -23,5 +22,5 @@ export { PluginOptions };
|
|
|
23
22
|
* })
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
export declare const sentryPlugin: (
|
|
25
|
+
export declare const sentryPlugin: (options: PluginOptions) => import("payload").Plugin;
|
|
27
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,OAAO,EAAE,aAAa,EAAE,CAAA;AACxB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,YAAY,sDAiEvB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { definePlugin } from 'payload';
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* ```ts
|
|
@@ -19,7 +20,9 @@
|
|
|
19
20
|
* Sentry,
|
|
20
21
|
* })
|
|
21
22
|
* ```
|
|
22
|
-
*/ export const sentryPlugin = (
|
|
23
|
+
*/ export const sentryPlugin = definePlugin({
|
|
24
|
+
slug: '@payloadcms/plugin-sentry',
|
|
25
|
+
plugin: ({ config, options: pluginOptions })=>{
|
|
23
26
|
const { enabled = true, options = {}, Sentry } = pluginOptions;
|
|
24
27
|
if (!enabled || !Sentry) {
|
|
25
28
|
return config;
|
|
@@ -51,9 +54,10 @@
|
|
|
51
54
|
user: {
|
|
52
55
|
id: args.req.user.id,
|
|
53
56
|
collection: args.req.user.collection,
|
|
54
|
-
email
|
|
57
|
+
// Payload types email/username as nullable; Sentry's user expects string | undefined
|
|
58
|
+
email: args.req.user.email ?? undefined,
|
|
55
59
|
ip_address: args.req.headers?.get('X-Forwarded-For') ?? undefined,
|
|
56
|
-
username: args.req.user.username
|
|
60
|
+
username: args.req.user.username ?? undefined
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
63
|
};
|
|
@@ -72,6 +76,7 @@
|
|
|
72
76
|
]
|
|
73
77
|
}
|
|
74
78
|
};
|
|
75
|
-
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
76
81
|
|
|
77
82
|
//# sourceMappingURL=index.js.map
|
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
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { ScopeContext } from '@sentry/types'\nimport type { APIError } from 'payload'\n\nimport { definePlugin } 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 = definePlugin<PluginOptions>({\n slug: '@payloadcms/plugin-sentry',\n plugin: ({ config, options: pluginOptions }) => {\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})\n"],"names":["definePlugin","sentryPlugin","slug","plugin","config","options","pluginOptions","enabled","Sentry","captureErrors","debug","admin","components","providers","hooks","afterError","args","status","error","includes","context","extra","errorCollectionSlug","collection","req","user","id","email","undefined","ip_address","headers","get","username","defaultContext","captureException","payload","logger","info","message"],"mappings":"AAGA,SAASA,YAAY,QAA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AAC;4BACH;4BAEA,IAAIvB,SAASe,SAAS;gCACpBA,UAAU,MAAMf,QAAQe,OAAO,CAAC;oCAC9B,GAAGJ,IAAI;oCACPiB,gBAAgBb;gCAClB;4BACF;4BAEA,MAAMM,KAAKlB,OAAO0B,gBAAgB,CAAClB,KAAKE,KAAK,EAAEE;4BAE/C,IAAIV,OAAO;gCACTM,KAAKQ,GAAG,CAACW,OAAO,CAACC,MAAM,CAACC,IAAI,CAC1B,CAAC,mBAAmB,EAAEX,GAAG,uBAAuB,EAAEV,KAAKE,KAAK,CAACoB,OAAO,EAAE;4BAE1E;wBACF;oBACF;iBACD;YACH;QACF;IACF;AACF,GAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/providers/AdminErrorBoundary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC;;GAEG;AACH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"AdminErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/providers/AdminErrorBoundary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC;;GAEG;AACH,eAAO,MAAM,kBAAkB,iBAAkB;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,gCAEvE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-sentry",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.0731f09",
|
|
4
4
|
"description": "Sentry plugin for Payload",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"payload",
|
|
7
6
|
"cms",
|
|
7
|
+
"error handling",
|
|
8
|
+
"payload",
|
|
8
9
|
"plugin",
|
|
9
|
-
"typescript",
|
|
10
10
|
"sentry",
|
|
11
|
-
"
|
|
11
|
+
"typescript"
|
|
12
12
|
],
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "https://github.com/payloadcms/payload.git",
|
|
16
|
-
"directory": "packages/plugin-sentry"
|
|
17
|
-
},
|
|
18
13
|
"license": "MIT",
|
|
19
14
|
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
|
|
20
15
|
"maintainers": [
|
|
@@ -24,8 +19,18 @@
|
|
|
24
19
|
"url": "https://payloadcms.com"
|
|
25
20
|
}
|
|
26
21
|
],
|
|
27
|
-
"
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/payloadcms/payload.git",
|
|
25
|
+
"directory": "packages/plugin-sentry"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
28
30
|
"type": "module",
|
|
31
|
+
"sideEffects": false,
|
|
32
|
+
"main": "./dist/index.js",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
29
34
|
"exports": {
|
|
30
35
|
".": {
|
|
31
36
|
"import": "./dist/index.js",
|
|
@@ -38,25 +43,19 @@
|
|
|
38
43
|
"default": "./dist/exports/client.js"
|
|
39
44
|
}
|
|
40
45
|
},
|
|
41
|
-
"main": "./dist/index.js",
|
|
42
|
-
"types": "./dist/index.d.ts",
|
|
43
|
-
"files": [
|
|
44
|
-
"dist"
|
|
45
|
-
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@sentry/nextjs": "^9.5.0",
|
|
48
48
|
"@sentry/types": "^9.5.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@types/react": "19.
|
|
52
|
-
"@types/react-dom": "19.
|
|
53
|
-
"
|
|
54
|
-
"payload": "4.0.0-internal.011fd46"
|
|
51
|
+
"@types/react": "19.3.0",
|
|
52
|
+
"@types/react-dom": "19.3.0",
|
|
53
|
+
"payload": "4.0.0-internal.0731f09"
|
|
55
54
|
},
|
|
56
55
|
"peerDependencies": {
|
|
56
|
+
"payload": "4.0.0-internal.0731f09",
|
|
57
57
|
"react": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
58
|
-
"react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1"
|
|
59
|
-
"payload": "4.0.0-internal.011fd46"
|
|
58
|
+
"react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1"
|
|
60
59
|
},
|
|
61
60
|
"homepage:": "https://payloadcms.com",
|
|
62
61
|
"scripts": {
|
|
@@ -65,8 +64,6 @@
|
|
|
65
64
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc-build --strip-leading-paths",
|
|
66
65
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
67
66
|
"clean": "rimraf -g {dist,*.tsbuildinfo}",
|
|
68
|
-
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/"
|
|
69
|
-
"lint": "eslint .",
|
|
70
|
-
"lint:fix": "eslint . --fix"
|
|
67
|
+
"copyfiles": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/"
|
|
71
68
|
}
|
|
72
69
|
}
|