@multiplayer-app/session-recorder-node 0.0.13 → 1.0.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/README.md CHANGED
@@ -15,9 +15,9 @@ The Multiplayer **Session Recorder** is a powerful tool that offers deep session
15
15
  You can install the Session Recorder using npm or yarn:
16
16
 
17
17
  ```bash
18
- npm install @multiplayer-app/session-recorder-node @multiplayer-app/session-recorder-opentelemetry
18
+ npm install @multiplayer-app/session-recorder-node
19
19
  # or
20
- yarn add @multiplayer-app/session-recorder-node @multiplayer-app/session-recorder-opentelemetry
20
+ yarn add @multiplayer-app/session-recorder-node
21
21
  ```
22
22
 
23
23
  ### Basic Setup
@@ -37,17 +37,15 @@ import { idGenerator } from './opentelemetry'
37
37
  Use the following code to initialize the session recorder with your application details:
38
38
 
39
39
  ```javascript
40
- SessionRecorder.init(
41
- '{YOUR_API_KEY}',
42
- idGenerator,
43
- {
44
- resourceAttributes: {
45
- serviceName: '{YOUR_APPLICATION_NAME}'
46
- version: '{YOUR_APPLICATION_VERSION}',
47
- environment: '{YOUR_APPLICATION_ENVIRONMENT}',
48
- }
40
+ SessionRecorder.init({
41
+ apiKey: '{YOUR_API_KEY}',
42
+ traceIdGenerator: idGenerator,
43
+ resourceAttributes: {
44
+ serviceName: '{YOUR_APPLICATION_NAME}'
45
+ version: '{YOUR_APPLICATION_VERSION}',
46
+ environment: '{YOUR_APPLICATION_ENVIRONMENT}',
49
47
  }
50
- )
48
+ })
51
49
  ```
52
50
 
53
51
  Replace the placeholders with your application’s version, name, environment, and API key.
@@ -61,26 +59,26 @@ This library relies on the following packages:
61
59
  ## Example Usage
62
60
 
63
61
  ```javascript
64
- import SessionRecorder from '@multiplayer-app/session-recorder-node'
65
- import { SessionType } from '@multiplayer-app/session-recorder-opentelemetry'
62
+ import {
63
+ sessionRecorder,
64
+ SessionType
65
+ } from '@multiplayer-app/session-recorder-node'
66
66
  // Session recorder trace id generator which is used during opentelemetry initialization
67
67
  import { idGenerator } from './opentelemetry'
68
68
 
69
- SessionRecorder.init(
70
- '{YOUR_API_KEY}',
71
- idGenerator,
72
- {
73
- resourceAttributes: {
74
- serviceName: '{YOUR_APPLICATION_NAME}'
75
- version: '{YOUR_APPLICATION_VERSION}',
76
- environment: '{YOUR_APPLICATION_ENVIRONMENT}',
77
- }
69
+ sessionRecorder.init({
70
+ apiKey: '{YOUR_API_KEY}',
71
+ traceIdGenerator: idGenerator,
72
+ resourceAttributes: {
73
+ serviceName: '{YOUR_APPLICATION_NAME}',
74
+ version: '{YOUR_APPLICATION_VERSION}',
75
+ environment: '{YOUR_APPLICATION_ENVIRONMENT}',
78
76
  }
79
- )
77
+ })
80
78
 
81
79
  // ...
82
80
 
83
- await SessionRecorder.start(
81
+ await sessionRecorder.start(
84
82
  SessionType.PLAIN,
85
83
  {
86
84
  name: 'This is test session',
@@ -93,6 +91,6 @@ SessionRecorder.init(
93
91
 
94
92
  // do something here
95
93
 
96
- await SessionRecorder.stop()
94
+ await sessionRecorder.stop()
97
95
 
98
96
  ```
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAkC;AAErB,QAAA,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,6BAA6B,CAAA;AAEhG,QAAA,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,sBAAG,CAAC,OAAO,CAAA"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAiC;AAEpB,QAAA,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,6BAA6B,CAAA;AAEhG,QAAA,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,sBAAG,CAAC,OAAO,CAAA"}
@@ -73,7 +73,7 @@ class ApiService {
73
73
  * Check debug session should be started remotely
74
74
  */
75
75
  async checkRemoteSession(requestBody, signal) {
76
- return this.makeRequest(`/remote-debug-session/check`, 'POST', requestBody, signal);
76
+ return this.makeRequest('/remote-debug-session/check', 'POST', requestBody, signal);
77
77
  }
78
78
  /**
79
79
  * Make a request to the session API
@@ -26,7 +26,7 @@ class SessionRecorder {
26
26
  init(config) {
27
27
  var _a, _b;
28
28
  this._resourceAttributes = config.resourceAttributes || {
29
- [session_recorder_common_1.ATTR_MULTIPLAYER_SESSION_RECORDER_VERSION]: config_1.SESSION_RECORDER_VERSION
29
+ [session_recorder_common_1.ATTR_MULTIPLAYER_SESSION_RECORDER_VERSION]: config_1.SESSION_RECORDER_VERSION,
30
30
  };
31
31
  this._isInitialized = true;
32
32
  if (typeof config.generateSessionShortIdLocally === 'function') {
@@ -67,7 +67,7 @@ class SessionRecorder {
67
67
  : `Session on ${(0, helper_1.getFormattedDate)(Date.now())}`;
68
68
  sessionPayload.resourceAttributes = {
69
69
  ...this._resourceAttributes,
70
- ...sessionPayload.resourceAttributes
70
+ ...sessionPayload.resourceAttributes,
71
71
  };
72
72
  if (this._sessionType === session_recorder_common_1.SessionType.CONTINUOUS) {
73
73
  session = await this._apiService.startContinuousSession(sessionPayload);
@@ -108,7 +108,7 @@ class SessionRecorder {
108
108
  ...(sessionData || {}),
109
109
  name: (sessionData === null || sessionData === void 0 ? void 0 : sessionData.name)
110
110
  ? sessionData.name
111
- : `Session on ${(0, helper_1.getFormattedDate)(Date.now())}`
111
+ : `Session on ${(0, helper_1.getFormattedDate)(Date.now())}`,
112
112
  });
113
113
  }
114
114
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplayer-app/session-recorder-node",
3
- "version": "0.0.13",
3
+ "version": "1.0.0",
4
4
  "description": "Multiplayer Fullstack Session Recorder for Node.js",
5
5
  "author": {
6
6
  "name": "Multiplayer Software, Inc.",
@@ -22,14 +22,14 @@
22
22
  "fullstack session recorder"
23
23
  ],
24
24
  "scripts": {
25
- "lint": "eslint src/**/*.ts --config ../../.eslintrc",
25
+ "lint": "eslint src/**/*.ts",
26
26
  "preversion": "npm run lint",
27
27
  "postversion:skip": "git push && git push --tags",
28
28
  "build": "rm -rf dist tsconfig.tsbuildinfo && tsc --build tsconfig.json",
29
29
  "prepublishOnly": "npm run build"
30
30
  },
31
31
  "dependencies": {
32
- "@multiplayer-app/session-recorder-common": "0.0.12",
32
+ "@multiplayer-app/session-recorder-common": "1.0.0",
33
33
  "@opentelemetry/api": "^1.9.0",
34
34
  "@opentelemetry/core": "^1.29.0",
35
35
  "@opentelemetry/otlp-exporter-base": "^0.56.0",
@@ -42,4 +42,4 @@
42
42
  "@types/node": "24.0.12",
43
43
  "typescript": "5.8.3"
44
44
  }
45
- }
45
+ }
package/src/config.ts CHANGED
@@ -1,4 +1,4 @@
1
- import pkg from '../package.json';
1
+ import pkg from '../package.json'
2
2
 
3
3
  export const MULTIPLAYER_BASE_API_URL = process.env.MULTIPLAYER_BASE_API_URL || 'https://api.multiplayer.app'
4
4
 
@@ -148,7 +148,7 @@ export class ApiService {
148
148
  signal?: AbortSignal,
149
149
  ): Promise<{ state: 'START' | 'STOP' }> {
150
150
  return this.makeRequest(
151
- `/remote-debug-session/check`,
151
+ '/remote-debug-session/check',
152
152
  'POST',
153
153
  requestBody,
154
154
  signal,
@@ -40,7 +40,7 @@ export class SessionRecorder {
40
40
  generateSessionShortIdLocally?: boolean | (() => string)
41
41
  }): void {
42
42
  this._resourceAttributes = config.resourceAttributes || {
43
- [ATTR_MULTIPLAYER_SESSION_RECORDER_VERSION]: SESSION_RECORDER_VERSION
43
+ [ATTR_MULTIPLAYER_SESSION_RECORDER_VERSION]: SESSION_RECORDER_VERSION,
44
44
  }
45
45
  this._isInitialized = true
46
46
 
@@ -68,7 +68,7 @@ export class SessionRecorder {
68
68
  */
69
69
  public async start(
70
70
  sessionType: SessionType,
71
- sessionPayload?: Omit<ISession, '_id'>
71
+ sessionPayload?: Omit<ISession, '_id'>,
72
72
  ): Promise<void> {
73
73
  if (!this._isInitialized) {
74
74
  throw new Error(
@@ -99,7 +99,7 @@ export class SessionRecorder {
99
99
 
100
100
  sessionPayload.resourceAttributes = {
101
101
  ...this._resourceAttributes,
102
- ...sessionPayload.resourceAttributes
102
+ ...sessionPayload.resourceAttributes,
103
103
  }
104
104
 
105
105
  if (this._sessionType === SessionType.CONTINUOUS) {
@@ -112,7 +112,7 @@ export class SessionRecorder {
112
112
 
113
113
  (this._traceIdGenerator as SessionRecorderIdGenerator).setSessionId(
114
114
  this._shortSessionId,
115
- this._sessionType
115
+ this._sessionType,
116
116
  )
117
117
 
118
118
  this._sessionState = 'STARTED'
@@ -133,7 +133,7 @@ export class SessionRecorder {
133
133
  * @returns {Promise<void>}
134
134
  */
135
135
  public async save(
136
- sessionData?: ISession
136
+ sessionData?: ISession,
137
137
  ): Promise<void> {
138
138
  try {
139
139
  if (!this._isInitialized) {
@@ -159,7 +159,7 @@ export class SessionRecorder {
159
159
  ...(sessionData || {}),
160
160
  name: sessionData?.name
161
161
  ? sessionData.name
162
- : `Session on ${getFormattedDate(Date.now())}`
162
+ : `Session on ${getFormattedDate(Date.now())}`,
163
163
  },
164
164
  )
165
165
  } catch (e) {
@@ -173,7 +173,7 @@ export class SessionRecorder {
173
173
  * @returns {Promise<void>}
174
174
  */
175
175
  public async stop(
176
- sessionData?: ISession
176
+ sessionData?: ISession,
177
177
  ): Promise<void> {
178
178
  try {
179
179
  if (!this._isInitialized) {
@@ -247,7 +247,7 @@ export class SessionRecorder {
247
247
  * @returns {Promise<void>}
248
248
  */
249
249
  public async checkRemoteContinuousSession(
250
- sessionPayload?: Omit<ISession, '_id' | 'shortId'>
250
+ sessionPayload?: Omit<ISession, '_id' | 'shortId'>,
251
251
  ): Promise<void> {
252
252
  if (!this._isInitialized) {
253
253
  throw new Error(