@miradorlabs/parallax-web 1.0.2 → 1.0.4

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 CHANGED
@@ -7,32 +7,124 @@ declare class ParallaxClient {
7
7
  apiUrl: string;
8
8
  private client;
9
9
  constructor(apiKey?: string | undefined, apiUrl?: string);
10
+ /**
11
+ * Gather client metadata for traces/spans
12
+ * Returns a metadata object with client environment details
13
+ * This includes browser, OS, screen size, IP address, and more
14
+ * @returns metadata
15
+ */
16
+ getClientMetadata(): Promise<{
17
+ [key: string]: string;
18
+ }>;
19
+ /**
20
+ * Creates a CreateTraceRequest with optional attributes and client metadata
21
+ * @param name name of the trace
22
+ * @param tags optional tags for trace
23
+ * @param attr optional attributes for trace
24
+ * @param includeClientMeta optional flag to include client metadata (ip, browser, os, etc)
25
+ * @returns a CreateTraceRequest object to be used for the createTrace request
26
+ */
27
+ createTraceRequest({ name, tags, attr, includeClientMeta }: {
28
+ name: string;
29
+ tags?: string[];
30
+ attr?: {
31
+ [key: string]: string;
32
+ };
33
+ includeClientMeta?: boolean;
34
+ }): Promise<CreateTraceRequest>;
10
35
  /**
11
36
  * Create a new trace
12
37
  * @param params Parameters to create a new trace
13
38
  * @returns Response from the create trace operation
14
39
  */
15
40
  createTrace(params: CreateTraceRequest): Promise<CreateTraceResponse>;
41
+ /**
42
+ * Create a StartSpanRequest with optional attributes and client metadata
43
+ * @param traceId trace id to associate the span with
44
+ * @param name name of the span
45
+ * @param parentSpanId (optional) create a span off a parent span id
46
+ * @param attr (optional) attributes to add to the span
47
+ * @param includeClientMeta (optional) flag to include client metadata (ip, browser, os, etc)
48
+ * @returns
49
+ */
50
+ createStartSpanRequest({ traceId, name, parentSpanId, attr, includeClientMeta }: {
51
+ traceId: string;
52
+ name: string;
53
+ parentSpanId?: string;
54
+ attr?: {
55
+ [key: string]: string;
56
+ };
57
+ includeClientMeta?: boolean;
58
+ }): Promise<StartSpanRequest>;
16
59
  /**
17
60
  * Start a new span within a trace
18
61
  * @param params Parameters to start a new span
19
62
  */
20
63
  startSpan(params: StartSpanRequest): Promise<StartSpanResponse>;
64
+ /**
65
+ * Create a FinishSpanRequest
66
+ * @param params Parameters to finish a span - traceId, spanId, status (optional) (success, errorMessage)
67
+ * @returns FinishSpanRequest
68
+ */
69
+ createFinishSpanRequest({ traceId, spanId, status }: {
70
+ traceId: string;
71
+ spanId: string;
72
+ status?: {
73
+ success: boolean;
74
+ errorMessage: string;
75
+ };
76
+ }): FinishSpanRequest;
21
77
  /**
22
78
  * Finish a span within a trace
23
79
  * @param params Parameters to finish a span
24
80
  */
25
81
  finishSpan(params: FinishSpanRequest): Promise<FinishSpanResponse>;
82
+ /**
83
+ * Creates the add span event request
84
+ * @param params - Parameters to create an AddSpanEventRequest - traceId, spanId, eventName, attr (optional)
85
+ * @returns AddSpanEventRequest
86
+ */
87
+ createAddSpanEventRequest({ traceId, spanId, eventName, attr }: {
88
+ traceId: string;
89
+ spanId: string;
90
+ eventName: string;
91
+ attr?: {
92
+ [key: string]: string;
93
+ };
94
+ }): AddSpanEventRequest;
26
95
  /**
27
96
  * Add an event to a span
28
97
  * @param params Parameters to add an event to a span
29
98
  */
30
99
  addSpanEvent(params: AddSpanEventRequest): Promise<AddSpanEventResponse>;
100
+ /**
101
+ * Creates the add span error request
102
+ * @param params - params used to generate the error request ( traceid, span id, error message, error type, stack trace)
103
+ * @returns AddSpanErrorRequest
104
+ */
105
+ createAddSpanErrorRequest({ traceId, spanId, errorMessage, errorType, stackTrace }: {
106
+ traceId: string;
107
+ spanId: string;
108
+ errorMessage: string;
109
+ errorType?: string;
110
+ stackTrace?: string;
111
+ }): AddSpanErrorRequest;
31
112
  /**
32
113
  * Add an error to a span
33
114
  * @param params Parameters to add an error to a span
34
115
  */
35
116
  addSpanError(params: AddSpanErrorRequest): Promise<AddSpanErrorResponse>;
117
+ /**
118
+ * Creates the add span hint request
119
+ * @param params - params used to generate the span hint (trace id, parentSpanId, txHash and chainId)
120
+ * @returns AddSpanHintRequest
121
+ */
122
+ createAddSpanHintRequest({ traceId, parentSpanId, txHash, chainId }: {
123
+ traceId: string;
124
+ parentSpanId: string;
125
+ txHash?: string;
126
+ chainId?: number;
127
+ }): AddSpanHintRequest;
36
128
  /**
37
129
  * Add a hint to a span
38
130
  * @param params Parameters to add a hint to a span