@multiplayer-app/session-recorder-common 1.3.36 → 1.3.37

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.
@@ -18,7 +18,7 @@ const captureException = (error, errorInfo) => {
18
18
  let isNewSpan = false;
19
19
  if (!span || !span.isRecording()) {
20
20
  span = api_1.trace.getTracer('exception').startSpan(error.name || 'Error', {
21
- attributes: Object.assign({ [semantic_conventions_1.ATTR_EXCEPTION_MESSAGE]: error.message, [semantic_conventions_1.ATTR_EXCEPTION_STACKTRACE]: error.stack, [semantic_conventions_1.ATTR_EXCEPTION_TYPE]: error.name }, (0, set_resource_attributes_1.getResourceAttributes)())
21
+ attributes: Object.assign({ [semantic_conventions_1.ATTR_EXCEPTION_MESSAGE]: error.message, [semantic_conventions_1.ATTR_EXCEPTION_STACKTRACE]: error.stack, [semantic_conventions_1.ATTR_EXCEPTION_TYPE]: error.name }, (0, set_resource_attributes_1.getResourceAttributes)()),
22
22
  });
23
23
  api_1.trace.setSpan(activeContext, span);
24
24
  isNewSpan = true;
@@ -27,7 +27,7 @@ const captureException = (error, errorInfo) => {
27
27
  span.setAttributes({
28
28
  [semantic_conventions_1.ATTR_EXCEPTION_MESSAGE]: error.message,
29
29
  [semantic_conventions_1.ATTR_EXCEPTION_STACKTRACE]: error.stack,
30
- [semantic_conventions_1.ATTR_EXCEPTION_TYPE]: error.name
30
+ [semantic_conventions_1.ATTR_EXCEPTION_TYPE]: error.name,
31
31
  });
32
32
  }
33
33
  if (errorInfo) {
@@ -38,7 +38,7 @@ const captureException = (error, errorInfo) => {
38
38
  span.recordException(error);
39
39
  span.setStatus({
40
40
  code: api_1.SpanStatusCode.ERROR,
41
- message: error.message
41
+ message: error.message,
42
42
  });
43
43
  if (isNewSpan) {
44
44
  span.end();
@@ -1 +1 @@
1
- {"version":3,"file":"capture-exception.js","sourceRoot":"","sources":["../../../src/sdk/capture-exception.ts"],"names":[],"mappings":";;;AAAA,4CAAmE;AACnE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E,GAAG,CAAC,CAAA;IAEpD,MAAM,QAAQ,GAAG,2BAA2B,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;IAC7D,IAAI,QAAQ,IAAI,GAAG,GAAG,QAAQ,GAAG,uBAAuB,EAAE,CAAC;QACzD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,2BAA2B,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAA;IAEjD,0DAA0D;IAC1D,KAAK,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,2BAA2B,EAAE,CAAC;QACpD,IAAI,GAAG,GAAG,EAAE,GAAG,uBAAuB,GAAG,CAAC,EAAE,CAAC;YAC3C,2BAA2B,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAlCY,QAAA,sBAAsB,0BAkClC","sourcesContent":["import { context, trace, SpanStatusCode } from '@opentelemetry/api'\nimport {\n ATTR_EXCEPTION_MESSAGE,\n ATTR_EXCEPTION_STACKTRACE,\n ATTR_EXCEPTION_TYPE\n} from '@opentelemetry/semantic-conventions'\nimport { getResourceAttributes } from './set-resource-attributes'\n\n/**\n * @description Add error to current span\n * @param {Error} error\n * @returns {void}\n */\nexport const captureException = (error: Error, errorInfo?: Record<string, any>) => {\n if (!error || !shouldCaptureException(error)) {\n return\n }\n\n const activeContext = context.active()\n\n let span = trace.getSpan(activeContext)\n let isNewSpan = false\n\n if (!span || !span.isRecording()) {\n span = trace.getTracer('exception').startSpan(error.name || 'Error', {\n attributes: {\n [ATTR_EXCEPTION_MESSAGE]: error.message,\n [ATTR_EXCEPTION_STACKTRACE]: error.stack,\n [ATTR_EXCEPTION_TYPE]: error.name,\n ...getResourceAttributes()\n }\n })\n trace.setSpan(activeContext, span)\n isNewSpan = true\n } else {\n span.setAttributes({\n [ATTR_EXCEPTION_MESSAGE]: error.message,\n [ATTR_EXCEPTION_STACKTRACE]: error.stack,\n [ATTR_EXCEPTION_TYPE]: error.name\n })\n }\n\n if (errorInfo) {\n Object.entries(errorInfo).forEach(([key, value]) => {\n span.setAttribute(`error_info.${key}`, value)\n })\n }\n\n span.recordException(error)\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message\n })\n\n if (isNewSpan) {\n span.end()\n }\n}\n\n/**\n * Best-effort deduplication of exceptions that fire multiple times\n * (e.g. framework handler + global handlers) within a short time window.\n */\n\nconst exceptionDedupeWindowMs = 2000\nconst recentExceptionFingerprints = new Map<string, number>()\n\nexport const shouldCaptureException = (error: Error, _errorInfo?: Record<string, any>): boolean => {\n if (!error) return false\n\n const now = Date.now()\n\n // Build a fingerprint that is stable enough across repeated emissions\n // but not so broad that different errors collapse into one.\n const keyParts: string[] = []\n keyParts.push(error.name || 'Error')\n keyParts.push(error.message || '')\n\n // First stack line tends to include file/line where it originated.\n if (typeof error.stack === 'string') {\n const firstFrame = error.stack.split('\\n')[1] || ''\n keyParts.push(firstFrame.trim())\n }\n\n const fingerprint = keyParts.join('|').slice(0, 500)\n\n const lastSeen = recentExceptionFingerprints.get(fingerprint)\n if (lastSeen && now - lastSeen < exceptionDedupeWindowMs) {\n return false\n }\n\n recentExceptionFingerprints.set(fingerprint, now)\n\n // Cheap cleanup of old entries to avoid unbounded growth.\n for (const [key, ts] of recentExceptionFingerprints) {\n if (now - ts > exceptionDedupeWindowMs * 5) {\n recentExceptionFingerprints.delete(key)\n }\n }\n\n return true\n}\n"]}
1
+ {"version":3,"file":"capture-exception.js","sourceRoot":"","sources":["../../../src/sdk/capture-exception.ts"],"names":[],"mappings":";;;AAAA,4CAAmE;AACnE,8EAI4C;AAC5C,uEAAiE;AAEjE;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,KAAY,EAAE,SAA+B,EAAE,EAAE;IAChF,IAAI,CAAC,KAAK,IAAI,CAAC,IAAA,8BAAsB,EAAC,KAAK,CAAC,EAAE,CAAC;QAC7C,OAAM;IACR,CAAC;IAED,MAA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GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAA;IAEjD,0DAA0D;IAC1D,KAAK,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,2BAA2B,EAAE,CAAC;QACpD,IAAI,GAAG,GAAG,EAAE,GAAG,uBAAuB,GAAG,CAAC,EAAE,CAAC;YAC3C,2BAA2B,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAlCY,QAAA,sBAAsB,0BAkClC","sourcesContent":["import { context, trace, SpanStatusCode } from '@opentelemetry/api'\nimport {\n ATTR_EXCEPTION_MESSAGE,\n ATTR_EXCEPTION_STACKTRACE,\n ATTR_EXCEPTION_TYPE,\n} from '@opentelemetry/semantic-conventions'\nimport { getResourceAttributes } from './set-resource-attributes'\n\n/**\n * @description Add error to current span\n * @param {Error} error\n * @returns {void}\n */\nexport const captureException = (error: Error, errorInfo?: Record<string, any>) => {\n if (!error || !shouldCaptureException(error)) {\n return\n }\n\n const activeContext = context.active()\n\n let span = trace.getSpan(activeContext)\n let isNewSpan = false\n\n if (!span || !span.isRecording()) {\n span = trace.getTracer('exception').startSpan(error.name || 'Error', {\n attributes: {\n [ATTR_EXCEPTION_MESSAGE]: error.message,\n [ATTR_EXCEPTION_STACKTRACE]: error.stack,\n [ATTR_EXCEPTION_TYPE]: error.name,\n ...getResourceAttributes(),\n },\n })\n trace.setSpan(activeContext, span)\n isNewSpan = true\n } else {\n span.setAttributes({\n [ATTR_EXCEPTION_MESSAGE]: error.message,\n [ATTR_EXCEPTION_STACKTRACE]: error.stack,\n [ATTR_EXCEPTION_TYPE]: error.name,\n })\n }\n\n if (errorInfo) {\n Object.entries(errorInfo).forEach(([key, value]) => {\n span.setAttribute(`error_info.${key}`, value)\n })\n }\n\n span.recordException(error)\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message,\n })\n\n if (isNewSpan) {\n span.end()\n }\n}\n\n/**\n * Best-effort deduplication of exceptions that fire multiple times\n * (e.g. framework handler + global handlers) within a short time window.\n */\n\nconst exceptionDedupeWindowMs = 2000\nconst recentExceptionFingerprints = new Map<string, number>()\n\nexport const shouldCaptureException = (error: Error, _errorInfo?: Record<string, any>): boolean => {\n if (!error) return false\n\n const now = Date.now()\n\n // Build a fingerprint that is stable enough across repeated emissions\n // but not so broad that different errors collapse into one.\n const keyParts: string[] = []\n keyParts.push(error.name || 'Error')\n keyParts.push(error.message || '')\n\n // First stack line tends to include file/line where it originated.\n if (typeof error.stack === 'string') {\n const firstFrame = error.stack.split('\\n')[1] || ''\n keyParts.push(firstFrame.trim())\n }\n\n const fingerprint = keyParts.join('|').slice(0, 500)\n\n const lastSeen = recentExceptionFingerprints.get(fingerprint)\n if (lastSeen && now - lastSeen < exceptionDedupeWindowMs) {\n return false\n }\n\n recentExceptionFingerprints.set(fingerprint, now)\n\n // Cheap cleanup of old entries to avoid unbounded growth.\n for (const [key, ts] of recentExceptionFingerprints) {\n if (now - ts > exceptionDedupeWindowMs * 5) {\n recentExceptionFingerprints.delete(key)\n }\n }\n\n return true\n}\n"]}
@@ -0,0 +1,226 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import tseslint from '@typescript-eslint/eslint-plugin'
4
+ import tsparser from '@typescript-eslint/parser'
5
+
6
+ export default [
7
+ js.configs.recommended,
8
+ {
9
+ ignores: [
10
+ 'node_modules/**',
11
+ 'dist/**',
12
+ 'build/**',
13
+ 'coverage/**',
14
+ '*.min.js',
15
+ '*.bundle.js',
16
+ ],
17
+ },
18
+ {
19
+ files: ['**/*.ts', '**/*.tsx'],
20
+ languageOptions: {
21
+ parser: tsparser,
22
+ parserOptions: {
23
+ ecmaVersion: 'latest',
24
+ sourceType: 'module',
25
+ },
26
+ globals: {
27
+ ...globals.browser,
28
+ // Browser globals
29
+ window: 'readonly',
30
+ document: 'readonly',
31
+ navigator: 'readonly',
32
+ localStorage: 'readonly',
33
+ sessionStorage: 'readonly',
34
+ console: 'readonly',
35
+ setTimeout: 'readonly',
36
+ clearTimeout: 'readonly',
37
+ setInterval: 'readonly',
38
+ clearInterval: 'readonly',
39
+ requestAnimationFrame: 'readonly',
40
+ cancelAnimationFrame: 'readonly',
41
+ fetch: 'readonly',
42
+ Headers: 'readonly',
43
+ HeadersInit: 'readonly',
44
+ Request: 'readonly',
45
+ RequestInfo: 'readonly',
46
+ Response: 'readonly',
47
+ FormData: 'readonly',
48
+ File: 'readonly',
49
+ Blob: 'readonly',
50
+ URL: 'readonly',
51
+ URLSearchParams: 'readonly',
52
+ AbortController: 'readonly',
53
+ AbortSignal: 'readonly',
54
+ ReadableStream: 'readonly',
55
+ WritableStream: 'readonly',
56
+ TransformStream: 'readonly',
57
+ TextEncoder: 'readonly',
58
+ TextDecoder: 'readonly',
59
+ HTMLElement: 'readonly',
60
+ HTMLButtonElement: 'readonly',
61
+ HTMLInputElement: 'readonly',
62
+ HTMLTextAreaElement: 'readonly',
63
+ HTMLAnchorElement: 'readonly',
64
+ XMLHttpRequest: 'readonly',
65
+ XMLHttpRequestBodyInit: 'readonly',
66
+ MouseEvent: 'readonly',
67
+ InputEvent: 'readonly',
68
+ MessageEvent: 'readonly',
69
+ EventListener: 'readonly',
70
+ MutationObserver: 'readonly',
71
+ NodeJS: 'readonly',
72
+ Window: 'readonly',
73
+ Document: 'readonly',
74
+ IDBDatabase: 'readonly',
75
+ indexedDB: 'readonly',
76
+ // Node.js globals
77
+ process: 'readonly',
78
+ Buffer: 'readonly',
79
+ __dirname: 'readonly',
80
+ __filename: 'readonly',
81
+ global: 'readonly',
82
+ module: 'readonly',
83
+ require: 'readonly',
84
+ exports: 'readonly',
85
+ },
86
+ },
87
+ plugins: {
88
+ '@typescript-eslint': tseslint,
89
+ },
90
+ rules: {
91
+ // TypeScript specific rules
92
+ 'no-namespace': 'off',
93
+ 'no-useless-escape': 'off',
94
+ 'no-self-assign': 'off',
95
+ 'no-useless-catch': 'off',
96
+ 'prefer-namespace-keyword': 'off',
97
+ 'no-empty-function': 'off',
98
+ 'no-unused-vars': 'off',
99
+ 'no-explicit-any': 'off',
100
+ 'ban-types': 'off',
101
+ 'object-curly-spacing': ['error', 'always'],
102
+ 'space-before-blocks': 'error',
103
+ 'keyword-spacing': 'error',
104
+
105
+ // General rules
106
+ 'prefer-const': 'error',
107
+ 'block-spacing': ['error', 'always'],
108
+ 'keyword-spacing': [
109
+ 'error',
110
+ {
111
+ before: true,
112
+ after: true,
113
+ },
114
+ ],
115
+ 'indent': ['error', 2, { SwitchCase: 1 }],
116
+ 'linebreak-style': ['error', 'unix'],
117
+ 'quotes': ['error', 'single'],
118
+ 'semi': ['error', 'never'],
119
+ 'comma-dangle': ['error', 'always-multiline'],
120
+ 'no-console': 'warn',
121
+ 'object-curly-spacing': ['error', 'always'],
122
+ 'space-in-parens': ['error', 'never'],
123
+ 'array-bracket-spacing': ['error', 'never'],
124
+ 'no-trailing-spaces': 'error',
125
+ 'no-multi-spaces': 'error',
126
+ 'no-lonely-if': 'error',
127
+ 'key-spacing': 'error',
128
+ 'no-useless-escape': 'error',
129
+ 'no-self-assign': 'error',
130
+ },
131
+ },
132
+ {
133
+ files: ['**/*.js', '**/*.mjs'],
134
+ languageOptions: {
135
+ ecmaVersion: 'latest',
136
+ sourceType: 'module',
137
+ globals: {
138
+ // Browser globals
139
+ window: 'readonly',
140
+ document: 'readonly',
141
+ navigator: 'readonly',
142
+ localStorage: 'readonly',
143
+ sessionStorage: 'readonly',
144
+ console: 'readonly',
145
+ setTimeout: 'readonly',
146
+ clearTimeout: 'readonly',
147
+ setInterval: 'readonly',
148
+ clearInterval: 'readonly',
149
+ requestAnimationFrame: 'readonly',
150
+ cancelAnimationFrame: 'readonly',
151
+ fetch: 'readonly',
152
+ Headers: 'readonly',
153
+ HeadersInit: 'readonly',
154
+ Request: 'readonly',
155
+ RequestInfo: 'readonly',
156
+ Response: 'readonly',
157
+ FormData: 'readonly',
158
+ File: 'readonly',
159
+ Blob: 'readonly',
160
+ URL: 'readonly',
161
+ URLSearchParams: 'readonly',
162
+ AbortController: 'readonly',
163
+ AbortSignal: 'readonly',
164
+ ReadableStream: 'readonly',
165
+ WritableStream: 'readonly',
166
+ TransformStream: 'readonly',
167
+ TextEncoder: 'readonly',
168
+ TextDecoder: 'readonly',
169
+ HTMLElement: 'readonly',
170
+ HTMLButtonElement: 'readonly',
171
+ HTMLInputElement: 'readonly',
172
+ HTMLTextAreaElement: 'readonly',
173
+ HTMLAnchorElement: 'readonly',
174
+ XMLHttpRequest: 'readonly',
175
+ XMLHttpRequestBodyInit: 'readonly',
176
+ MouseEvent: 'readonly',
177
+ InputEvent: 'readonly',
178
+ MessageEvent: 'readonly',
179
+ EventListener: 'readonly',
180
+ MutationObserver: 'readonly',
181
+ NodeJS: 'readonly',
182
+ Window: 'readonly',
183
+ Document: 'readonly',
184
+ IDBDatabase: 'readonly',
185
+ indexedDB: 'readonly',
186
+ // Node.js globals
187
+ process: 'readonly',
188
+ Buffer: 'readonly',
189
+ __dirname: 'readonly',
190
+ __filename: 'readonly',
191
+ global: 'readonly',
192
+ module: 'readonly',
193
+ require: 'readonly',
194
+ exports: 'readonly',
195
+ },
196
+ },
197
+ rules: {
198
+ 'no-useless-escape': 'off',
199
+ 'no-self-assign': 'off',
200
+ 'prefer-const': 'error',
201
+ 'block-spacing': ['error', 'always'],
202
+ 'keyword-spacing': [
203
+ 'error',
204
+ {
205
+ before: true,
206
+ after: true,
207
+ },
208
+ ],
209
+ 'indent': ['error', 2, { SwitchCase: 1 }],
210
+ 'linebreak-style': ['error', 'unix'],
211
+ 'quotes': ['error', 'single'],
212
+ 'semi': ['error', 'never'],
213
+ 'comma-dangle': ['error', 'always-multiline'],
214
+ 'no-console': 'warn',
215
+ 'object-curly-spacing': ['error', 'always'],
216
+ 'space-in-parens': ['error', 'never'],
217
+ 'array-bracket-spacing': ['error', 'never'],
218
+ 'no-trailing-spaces': 'error',
219
+ 'no-multi-spaces': 'error',
220
+ 'no-lonely-if': 'error',
221
+ 'key-spacing': 'error',
222
+ 'no-useless-escape': 'error',
223
+ 'no-self-assign': 'error',
224
+ },
225
+ },
226
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplayer-app/session-recorder-common",
3
- "version": "1.3.36",
3
+ "version": "1.3.37",
4
4
  "description": "Multiplayer Fullstack Session Recorder - opentelemetry",
5
5
  "author": {
6
6
  "name": "Multiplayer Software, Inc.",
@@ -34,7 +34,7 @@
34
34
  "otlp"
35
35
  ],
36
36
  "scripts": {
37
- "lint": "eslint src/**/*.ts",
37
+ "lint": "eslint src/**/*.ts --config eslint.config.js",
38
38
  "preversion": "npm run lint",
39
39
  "postversion:skip": "git push && git push --tags",
40
40
  "build": "rm -rf dist tsconfig.tsbuildinfo && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
@@ -57,6 +57,7 @@
57
57
  "to-json-schema": "^0.2.5"
58
58
  },
59
59
  "devDependencies": {
60
+ "@types/node": "^22.0.0",
60
61
  "@types/to-json-schema": "0.2.4",
61
62
  "typescript": "5.8.3"
62
63
  }
@@ -2,7 +2,7 @@ import { context, trace, SpanStatusCode } from '@opentelemetry/api'
2
2
  import {
3
3
  ATTR_EXCEPTION_MESSAGE,
4
4
  ATTR_EXCEPTION_STACKTRACE,
5
- ATTR_EXCEPTION_TYPE
5
+ ATTR_EXCEPTION_TYPE,
6
6
  } from '@opentelemetry/semantic-conventions'
7
7
  import { getResourceAttributes } from './set-resource-attributes'
8
8
 
@@ -27,8 +27,8 @@ export const captureException = (error: Error, errorInfo?: Record<string, any>)
27
27
  [ATTR_EXCEPTION_MESSAGE]: error.message,
28
28
  [ATTR_EXCEPTION_STACKTRACE]: error.stack,
29
29
  [ATTR_EXCEPTION_TYPE]: error.name,
30
- ...getResourceAttributes()
31
- }
30
+ ...getResourceAttributes(),
31
+ },
32
32
  })
33
33
  trace.setSpan(activeContext, span)
34
34
  isNewSpan = true
@@ -36,7 +36,7 @@ export const captureException = (error: Error, errorInfo?: Record<string, any>)
36
36
  span.setAttributes({
37
37
  [ATTR_EXCEPTION_MESSAGE]: error.message,
38
38
  [ATTR_EXCEPTION_STACKTRACE]: error.stack,
39
- [ATTR_EXCEPTION_TYPE]: error.name
39
+ [ATTR_EXCEPTION_TYPE]: error.name,
40
40
  })
41
41
  }
42
42
 
@@ -49,7 +49,7 @@ export const captureException = (error: Error, errorInfo?: Record<string, any>)
49
49
  span.recordException(error)
50
50
  span.setStatus({
51
51
  code: SpanStatusCode.ERROR,
52
- message: error.message
52
+ message: error.message,
53
53
  })
54
54
 
55
55
  if (isNewSpan) {
@@ -23,6 +23,9 @@
23
23
  "strictNullChecks": true,
24
24
  "target": "es2017",
25
25
  "useUnknownInCatchVariables": false,
26
+ "types": [
27
+ "node"
28
+ ],
26
29
  "lib": [
27
30
  "es2017",
28
31
  "dom",