statelog-client 0.0.29 → 0.0.30
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.ts +3 -3
- package/dist/index.js +5 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,14 +8,14 @@ export type JSONEdge = {
|
|
|
8
8
|
export declare class StatelogClient {
|
|
9
9
|
private host;
|
|
10
10
|
private debugMode;
|
|
11
|
-
private
|
|
11
|
+
private trace_id;
|
|
12
12
|
private apiKey;
|
|
13
13
|
private projectId;
|
|
14
|
-
constructor(
|
|
14
|
+
constructor(config: {
|
|
15
15
|
host: string;
|
|
16
16
|
apiKey: string;
|
|
17
17
|
projectId: string;
|
|
18
|
-
|
|
18
|
+
trace_id?: string;
|
|
19
19
|
debugMode?: boolean;
|
|
20
20
|
});
|
|
21
21
|
debug(message: string, data: any): void;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { nanoid } from "nanoid";
|
|
2
2
|
export class StatelogClient {
|
|
3
|
-
constructor(
|
|
3
|
+
constructor(config) {
|
|
4
|
+
const { host, apiKey, projectId, trace_id, debugMode } = config;
|
|
4
5
|
this.host = host;
|
|
5
6
|
this.apiKey = apiKey;
|
|
6
7
|
this.projectId = projectId;
|
|
7
8
|
this.debugMode = debugMode || false;
|
|
8
|
-
this.
|
|
9
|
+
this.trace_id = trace_id || nanoid();
|
|
9
10
|
if (this.debugMode) {
|
|
10
|
-
console.log(`Statelog client initialized with host: ${host} and TID: ${this.
|
|
11
|
+
console.log(`Statelog client initialized with host: ${host} and TID: ${this.trace_id}`, { config });
|
|
11
12
|
}
|
|
12
13
|
if (!this.apiKey) {
|
|
13
14
|
throw new Error("API key is required for StatelogClient");
|
|
@@ -100,7 +101,7 @@ export class StatelogClient {
|
|
|
100
101
|
Authorization: `Bearer ${this.apiKey}`,
|
|
101
102
|
},
|
|
102
103
|
body: JSON.stringify({
|
|
103
|
-
|
|
104
|
+
trace_id: this.trace_id,
|
|
104
105
|
project_id: this.projectId,
|
|
105
106
|
data: Object.assign(Object.assign({}, body), { timeStamp: new Date().toISOString() }),
|
|
106
107
|
}),
|