@codmir/sdk 0.1.1 → 0.1.2

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.cjs CHANGED
@@ -324,7 +324,11 @@ __export(overseer_exports, {
324
324
  close: () => close,
325
325
  flush: () => flush,
326
326
  getClient: () => getClient,
327
+ getConversationId: () => getConversationId,
328
+ getSessionId: () => getSessionId,
327
329
  init: () => init,
330
+ setConversationId: () => setConversationId,
331
+ setSessionId: () => setSessionId,
328
332
  setTag: () => setTag,
329
333
  setTags: () => setTags,
330
334
  setUser: () => setUser
@@ -338,6 +342,8 @@ var OverseerClient = class {
338
342
  eventQueue = [];
339
343
  flushTimer = null;
340
344
  isInitialized = false;
345
+ conversationId = null;
346
+ sessionId = null;
341
347
  constructor(config = {}) {
342
348
  this.config = {
343
349
  dsn: config.dsn || "",
@@ -389,11 +395,19 @@ var OverseerClient = class {
389
395
  },
390
396
  user: this.user || void 0,
391
397
  tags: { ...this.tags },
392
- extra: context,
398
+ extra: {
399
+ ...context,
400
+ conversationId: this.conversationId,
401
+ sessionId: this.sessionId
402
+ },
393
403
  breadcrumbs: [...this.breadcrumbs],
394
404
  environment: this.config.environment,
395
405
  release: this.config.release,
396
- sdk: { name: "@codmir/sdk", version: "1.0.0" }
406
+ sdk: { name: "@codmir/sdk", version: "1.0.0" },
407
+ contexts: {
408
+ conversation: this.conversationId ? { id: this.conversationId } : void 0,
409
+ session: this.sessionId ? { id: this.sessionId } : void 0
410
+ }
397
411
  };
398
412
  this.sendEvent(event);
399
413
  return eventId;
@@ -429,6 +443,18 @@ var OverseerClient = class {
429
443
  }
430
444
  setExtra(key, value) {
431
445
  }
446
+ setConversationId(conversationId) {
447
+ this.conversationId = conversationId;
448
+ }
449
+ getConversationId() {
450
+ return this.conversationId;
451
+ }
452
+ setSessionId(sessionId) {
453
+ this.sessionId = sessionId;
454
+ }
455
+ getSessionId() {
456
+ return this.sessionId;
457
+ }
432
458
  addBreadcrumb(breadcrumb) {
433
459
  this.breadcrumbs.push({
434
460
  ...breadcrumb,
@@ -530,6 +556,18 @@ function flush(timeout) {
530
556
  function close() {
531
557
  client?.close();
532
558
  }
559
+ function setConversationId(conversationId) {
560
+ client?.setConversationId(conversationId);
561
+ }
562
+ function getConversationId() {
563
+ return client?.getConversationId() || null;
564
+ }
565
+ function setSessionId(sessionId) {
566
+ client?.setSessionId(sessionId);
567
+ }
568
+ function getSessionId() {
569
+ return client?.getSessionId() || null;
570
+ }
533
571
  // Annotate the CommonJS export names for ESM import in node:
534
572
  0 && (module.exports = {
535
573
  CodmirApiError,
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-233XBWQD.js";
10
10
  import {
11
11
  overseer_exports
12
- } from "./chunk-T7OAAOG2.js";
12
+ } from "./chunk-4W5YK72Y.js";
13
13
  import "./chunk-MLKGABMK.js";
14
14
  export {
15
15
  CodmirApiError,
@@ -47,6 +47,8 @@ var OverseerClient = class {
47
47
  eventQueue = [];
48
48
  flushTimer = null;
49
49
  isInitialized = false;
50
+ conversationId = null;
51
+ sessionId = null;
50
52
  constructor(config = {}) {
51
53
  this.config = {
52
54
  dsn: config.dsn || "",
@@ -98,11 +100,19 @@ var OverseerClient = class {
98
100
  },
99
101
  user: this.user || void 0,
100
102
  tags: { ...this.tags },
101
- extra: context,
103
+ extra: {
104
+ ...context,
105
+ conversationId: this.conversationId,
106
+ sessionId: this.sessionId
107
+ },
102
108
  breadcrumbs: [...this.breadcrumbs],
103
109
  environment: this.config.environment,
104
110
  release: this.config.release,
105
- sdk: { name: "@codmir/sdk", version: "1.0.0" }
111
+ sdk: { name: "@codmir/sdk", version: "1.0.0" },
112
+ contexts: {
113
+ conversation: this.conversationId ? { id: this.conversationId } : void 0,
114
+ session: this.sessionId ? { id: this.sessionId } : void 0
115
+ }
106
116
  };
107
117
  this.sendEvent(event);
108
118
  return eventId;
@@ -138,6 +148,18 @@ var OverseerClient = class {
138
148
  }
139
149
  setExtra(key, value) {
140
150
  }
151
+ setConversationId(conversationId) {
152
+ this.conversationId = conversationId;
153
+ }
154
+ getConversationId() {
155
+ return this.conversationId;
156
+ }
157
+ setSessionId(sessionId) {
158
+ this.sessionId = sessionId;
159
+ }
160
+ getSessionId() {
161
+ return this.sessionId;
162
+ }
141
163
  addBreadcrumb(breadcrumb) {
142
164
  this.breadcrumbs.push({
143
165
  ...breadcrumb,
@@ -9,7 +9,7 @@ import {
9
9
  setTag,
10
10
  setTags,
11
11
  setUser
12
- } from "../chunk-T7OAAOG2.js";
12
+ } from "../chunk-4W5YK72Y.js";
13
13
  import "../chunk-MLKGABMK.js";
14
14
 
15
15
  // src/nextjs/index.ts
@@ -27,7 +27,11 @@ __export(overseer_exports, {
27
27
  close: () => close,
28
28
  flush: () => flush,
29
29
  getClient: () => getClient,
30
+ getConversationId: () => getConversationId,
31
+ getSessionId: () => getSessionId,
30
32
  init: () => init,
33
+ setConversationId: () => setConversationId,
34
+ setSessionId: () => setSessionId,
31
35
  setTag: () => setTag,
32
36
  setTags: () => setTags,
33
37
  setUser: () => setUser
@@ -42,6 +46,8 @@ var OverseerClient = class {
42
46
  eventQueue = [];
43
47
  flushTimer = null;
44
48
  isInitialized = false;
49
+ conversationId = null;
50
+ sessionId = null;
45
51
  constructor(config = {}) {
46
52
  this.config = {
47
53
  dsn: config.dsn || "",
@@ -93,11 +99,19 @@ var OverseerClient = class {
93
99
  },
94
100
  user: this.user || void 0,
95
101
  tags: { ...this.tags },
96
- extra: context,
102
+ extra: {
103
+ ...context,
104
+ conversationId: this.conversationId,
105
+ sessionId: this.sessionId
106
+ },
97
107
  breadcrumbs: [...this.breadcrumbs],
98
108
  environment: this.config.environment,
99
109
  release: this.config.release,
100
- sdk: { name: "@codmir/sdk", version: "1.0.0" }
110
+ sdk: { name: "@codmir/sdk", version: "1.0.0" },
111
+ contexts: {
112
+ conversation: this.conversationId ? { id: this.conversationId } : void 0,
113
+ session: this.sessionId ? { id: this.sessionId } : void 0
114
+ }
101
115
  };
102
116
  this.sendEvent(event);
103
117
  return eventId;
@@ -133,6 +147,18 @@ var OverseerClient = class {
133
147
  }
134
148
  setExtra(key, value) {
135
149
  }
150
+ setConversationId(conversationId) {
151
+ this.conversationId = conversationId;
152
+ }
153
+ getConversationId() {
154
+ return this.conversationId;
155
+ }
156
+ setSessionId(sessionId) {
157
+ this.sessionId = sessionId;
158
+ }
159
+ getSessionId() {
160
+ return this.sessionId;
161
+ }
136
162
  addBreadcrumb(breadcrumb) {
137
163
  this.breadcrumbs.push({
138
164
  ...breadcrumb,
@@ -234,6 +260,18 @@ function flush(timeout) {
234
260
  function close() {
235
261
  client?.close();
236
262
  }
263
+ function setConversationId(conversationId) {
264
+ client?.setConversationId(conversationId);
265
+ }
266
+ function getConversationId() {
267
+ return client?.getConversationId() || null;
268
+ }
269
+ function setSessionId(sessionId) {
270
+ client?.setSessionId(sessionId);
271
+ }
272
+ function getSessionId() {
273
+ return client?.getSessionId() || null;
274
+ }
237
275
  // Annotate the CommonJS export names for ESM import in node:
238
276
  0 && (module.exports = {
239
277
  OverseerClient,
@@ -243,7 +281,11 @@ function close() {
243
281
  close,
244
282
  flush,
245
283
  getClient,
284
+ getConversationId,
285
+ getSessionId,
246
286
  init,
287
+ setConversationId,
288
+ setSessionId,
247
289
  setTag,
248
290
  setTags,
249
291
  setUser
@@ -6,11 +6,15 @@ import {
6
6
  close,
7
7
  flush,
8
8
  getClient,
9
+ getConversationId,
10
+ getSessionId,
9
11
  init,
12
+ setConversationId,
13
+ setSessionId,
10
14
  setTag,
11
15
  setTags,
12
16
  setUser
13
- } from "../chunk-T7OAAOG2.js";
17
+ } from "../chunk-4W5YK72Y.js";
14
18
  import "../chunk-MLKGABMK.js";
15
19
  export {
16
20
  OverseerClient,
@@ -20,7 +24,11 @@ export {
20
24
  close,
21
25
  flush,
22
26
  getClient,
27
+ getConversationId,
28
+ getSessionId,
23
29
  init,
30
+ setConversationId,
31
+ setSessionId,
24
32
  setTag,
25
33
  setTags,
26
34
  setUser
@@ -48,6 +48,8 @@ var OverseerClient = class {
48
48
  eventQueue = [];
49
49
  flushTimer = null;
50
50
  isInitialized = false;
51
+ conversationId = null;
52
+ sessionId = null;
51
53
  constructor(config = {}) {
52
54
  this.config = {
53
55
  dsn: config.dsn || "",
@@ -99,11 +101,19 @@ var OverseerClient = class {
99
101
  },
100
102
  user: this.user || void 0,
101
103
  tags: { ...this.tags },
102
- extra: context,
104
+ extra: {
105
+ ...context,
106
+ conversationId: this.conversationId,
107
+ sessionId: this.sessionId
108
+ },
103
109
  breadcrumbs: [...this.breadcrumbs],
104
110
  environment: this.config.environment,
105
111
  release: this.config.release,
106
- sdk: { name: "@codmir/sdk", version: "1.0.0" }
112
+ sdk: { name: "@codmir/sdk", version: "1.0.0" },
113
+ contexts: {
114
+ conversation: this.conversationId ? { id: this.conversationId } : void 0,
115
+ session: this.sessionId ? { id: this.sessionId } : void 0
116
+ }
107
117
  };
108
118
  this.sendEvent(event);
109
119
  return eventId;
@@ -139,6 +149,18 @@ var OverseerClient = class {
139
149
  }
140
150
  setExtra(key, value) {
141
151
  }
152
+ setConversationId(conversationId) {
153
+ this.conversationId = conversationId;
154
+ }
155
+ getConversationId() {
156
+ return this.conversationId;
157
+ }
158
+ setSessionId(sessionId) {
159
+ this.sessionId = sessionId;
160
+ }
161
+ getSessionId() {
162
+ return this.sessionId;
163
+ }
142
164
  addBreadcrumb(breadcrumb) {
143
165
  this.breadcrumbs.push({
144
166
  ...breadcrumb,
@@ -8,7 +8,7 @@ import {
8
8
  init,
9
9
  setTags,
10
10
  setUser
11
- } from "../chunk-T7OAAOG2.js";
11
+ } from "../chunk-4W5YK72Y.js";
12
12
  import "../chunk-MLKGABMK.js";
13
13
 
14
14
  // src/react-native/index.ts