sentry-sails 0.0.1

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.
@@ -0,0 +1 @@
1
+ module.exports = { extends: ['@commitlint/config-conventional'] }
@@ -0,0 +1 @@
1
+ github: DominusKelvin
@@ -0,0 +1,22 @@
1
+ name: Prettier
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ prettier:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - name: Checkout code
11
+ uses: actions/checkout@v3
12
+
13
+ - name: Setup Node.js
14
+ uses: actions/setup-node@v3
15
+ with:
16
+ node-version: 18
17
+
18
+ - name: Run npm ci
19
+ run: npm ci
20
+
21
+ - name: Run Prettier
22
+ run: npx prettier --config ./.prettierrc.js --write .
@@ -0,0 +1 @@
1
+ npx --no -- commitlint --edit ${1}
@@ -0,0 +1 @@
1
+ npx lint-staged
package/.prettierrc.js ADDED
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ semi: false,
3
+ singleQuote: true,
4
+ trailingComma: 'none'
5
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 The Sailscasts Company
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Sails Sentry
2
+
3
+ A Sails hook for to easily setup up Application Monitoring and Error Tracking with Sentry in Sails applications
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install sails-sentry
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ To use the Sentry hook in your Sails.js application, add the following configuration to your `config/sentry.js` file:
14
+
15
+ ```javascript
16
+ module.exports.sentry = {
17
+ dsn: 'your-sentry-dsn',
18
+ environment: process.env.NODE_ENV || 'development',
19
+ };
20
+ ```
21
+
22
+ ## Configuration
23
+
24
+ - `dsn`: Your Sentry Data Source Name (DSN).
25
+ - `environment`: The environment in which your application is running (e.g., development, production).
26
+
27
+ ## License
28
+
29
+ This project is licensed under the MIT License.
package/index.js ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * sentry hook
3
+ *
4
+ * @description :: A hook definition. Extends Sails by adding shadow routes, implicit actions, and/or initialization logic.
5
+ * @docs :: https://sailsjs.com/docs/concepts/extending-sails/hooks
6
+ */
7
+ const Sentry = require('@sentry/node')
8
+ module.exports = function defineSentryHook(sails) {
9
+ return {
10
+ /**
11
+ * Runs when this Sails app loads/lifts.
12
+ */
13
+ defaults: {
14
+ tracesSampleRate: 1.0,
15
+ // Set sampling rate for profiling - this is relative to tracesSampleRate
16
+ profilesSampleRate: 1.0,
17
+ tracing: true,
18
+ spotlight: true
19
+ },
20
+ initialize: async function () {
21
+ sails.after('hook:http:loaded', () => {
22
+ const sentryInitOptions = {
23
+ ...sails.config.sentry,
24
+ integrations: [
25
+ // enable HTTP calls tracing
26
+ new Sentry.Integrations.Http({
27
+ tracing: sails.config.sentry.tracing
28
+ }),
29
+ // enable Express.js middleware tracing
30
+ new Sentry.Integrations.Express({ app: sails.hooks.http.app })
31
+ ]
32
+ }
33
+ Sentry.init(sentryInitOptions)
34
+ // The request handler must be the first middleware on the app
35
+ sails.hooks.http.app.use(Sentry.Handlers.requestHandler())
36
+
37
+ // TracingHandler creates a trace for every incoming request
38
+ sails.hooks.http.app.use(Sentry.Handlers.tracingHandler())
39
+
40
+ // The error handler must be registered before any other error middleware and after all controllers
41
+ sails.hooks.http.app.use(Sentry.Handlers.errorHandler())
42
+
43
+ sails.log.info('Initializing custom hook (`sentry`)')
44
+ })
45
+ }
46
+ }
47
+ }
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "sentry-sails",
3
+ "version": "0.0.1",
4
+ "description": "Sails SDK/hook for Sentry (https://sentry.io)",
5
+ "main": "index.js",
6
+ "scripts": {},
7
+ "keywords": [
8
+ "sails",
9
+ "sentry",
10
+ "error",
11
+ "monitoring"
12
+ ],
13
+ "author": "Kelvin Omereshone<kelvin@sailscasts.com>",
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/sailscastshq/sails-hook-sentry.git"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/sailscastshq/sails-hook-sentry/issues"
21
+ },
22
+ "homepage": "https://github.com/sailscastshq/sails-hook-sentry#readme",
23
+ "sails": {
24
+ "isHook": true,
25
+ "hookName": "sentry"
26
+ },
27
+ "devDependencies": {
28
+ "@commitlint/cli": "^19.6.1",
29
+ "@commitlint/config-conventional": "^19.6.0",
30
+ "husky": "^9.1.7",
31
+ "lint-staged": "^15.4.3",
32
+ "prettier": "^3.4.2"
33
+ },
34
+ "lint-staged": {
35
+ "**/*": "prettier --write --ignore-unknown"
36
+ },
37
+ "dependencies": {
38
+ "@sentry/node": "^8.52.1"
39
+ }
40
+ }