@myxtra/microservice 1.23.0 → 1.25.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.d.mts CHANGED
@@ -83,4 +83,13 @@ declare const getTechnicalContext: (request: FastifyRequest) => {
83
83
  };
84
84
  };
85
85
 
86
- export { DEFAULT_SPEC_FILE_URL, MOCKED_BEARER_TOKEN, MOCKED_JWT_HEADER, MOCKED_JWT_NAME, MOCKED_JWT_PAYLOAD, MOCKED_JWT_SIGNATURE, createApi, generateSwagger, getTechnicalContext, _default$1 as swagger, validationError, _default as zod };
86
+ /**
87
+ * Capture an exception with minimal request context.
88
+ */
89
+ declare function captureSentryError(error: unknown, request?: FastifyRequest, context?: Record<string, unknown>): void;
90
+ /**
91
+ * Capture an info event for successful API calls.
92
+ */
93
+ declare function captureSentryInfo(message: string, request?: FastifyRequest, context?: Record<string, unknown>): void;
94
+
95
+ export { DEFAULT_SPEC_FILE_URL, MOCKED_BEARER_TOKEN, MOCKED_JWT_HEADER, MOCKED_JWT_NAME, MOCKED_JWT_PAYLOAD, MOCKED_JWT_SIGNATURE, captureSentryError, captureSentryInfo, createApi, generateSwagger, getTechnicalContext, _default$1 as swagger, validationError, _default as zod };
package/dist/index.mjs CHANGED
@@ -9995,6 +9995,30 @@ var getTechnicalContext = (request) => {
9995
9995
  webSignature: { userAgent, originUrl, remoteIPAddress, signatureDate }
9996
9996
  };
9997
9997
  };
9998
+
9999
+ // src/utils/sentryTrace.ts
10000
+ import * as Sentry from "@sentry/node";
10001
+ import "fastify";
10002
+ function captureSentryError(error, request, context) {
10003
+ Sentry.withScope((scope) => {
10004
+ scope.setTag("method", request?.method);
10005
+ scope.setTag("url", request?.url);
10006
+ if (context) {
10007
+ scope.setContext("context", context);
10008
+ }
10009
+ Sentry.captureException(error);
10010
+ });
10011
+ }
10012
+ function captureSentryInfo(message, request, context) {
10013
+ Sentry.withScope((scope) => {
10014
+ scope.setTag("method", request?.method);
10015
+ scope.setTag("url", request?.url);
10016
+ if (context) {
10017
+ scope.setContext("context", context);
10018
+ }
10019
+ Sentry.captureMessage(message, "info");
10020
+ });
10021
+ }
9998
10022
  export {
9999
10023
  DEFAULT_SPEC_FILE_URL,
10000
10024
  MOCKED_BEARER_TOKEN,
@@ -10002,6 +10026,8 @@ export {
10002
10026
  MOCKED_JWT_NAME,
10003
10027
  MOCKED_JWT_PAYLOAD,
10004
10028
  MOCKED_JWT_SIGNATURE,
10029
+ captureSentryError,
10030
+ captureSentryInfo,
10005
10031
  createApi,
10006
10032
  generateSwagger,
10007
10033
  getTechnicalContext,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myxtra/microservice",
3
- "version": "1.23.0",
3
+ "version": "1.25.0",
4
4
  "main": "./dist/index.mjs",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -20,7 +20,8 @@
20
20
  "typecheck": "tsc --noEmit"
21
21
  },
22
22
  "dependencies": {
23
- "@myxtra/api": "1.22.0"
23
+ "@myxtra/api": "1.24.0",
24
+ "@sentry/node": "^9.17.0"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@myxtra/eslint-config": "1.20.0",