@getlimelight/sdk 0.5.1 → 0.5.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.d.mts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -7,7 +7,8 @@ declare enum NetworkPhase {
|
|
|
7
7
|
CONNECT = "CONNECT",
|
|
8
8
|
REQUEST = "REQUEST",
|
|
9
9
|
RESPONSE = "RESPONSE",
|
|
10
|
-
ERROR = "ERROR"
|
|
10
|
+
ERROR = "ERROR",
|
|
11
|
+
ABORT = "ABORT"
|
|
11
12
|
}
|
|
12
13
|
declare enum BodyFormat {
|
|
13
14
|
TEXT = "TEXT",
|
|
@@ -92,7 +93,7 @@ interface NetworkResponse extends BaseNetworkEvent {
|
|
|
92
93
|
* NETWORK ERROR (3rd possible outcome)
|
|
93
94
|
*/
|
|
94
95
|
interface NetworkErrorEvent extends BaseNetworkEvent {
|
|
95
|
-
phase: NetworkPhase.ERROR;
|
|
96
|
+
phase: NetworkPhase.ERROR | NetworkPhase.ABORT;
|
|
96
97
|
errorMessage: string;
|
|
97
98
|
stack?: string;
|
|
98
99
|
}
|
|
@@ -214,6 +215,14 @@ declare enum CommandType {
|
|
|
214
215
|
CLEAR_RENDERS = "CLEAR_RENDERS",
|
|
215
216
|
ACK = "ACK"
|
|
216
217
|
}
|
|
218
|
+
interface BaseCommand {
|
|
219
|
+
type: CommandType;
|
|
220
|
+
id?: string;
|
|
221
|
+
}
|
|
222
|
+
interface ClearRendersCommand extends BaseCommand {
|
|
223
|
+
type: CommandType.CLEAR_RENDERS;
|
|
224
|
+
}
|
|
225
|
+
type Command = ClearRendersCommand;
|
|
217
226
|
interface CommandAckEvent {
|
|
218
227
|
phase: CommandType.ACK;
|
|
219
228
|
commandId: string;
|
|
@@ -624,4 +633,4 @@ declare global {
|
|
|
624
633
|
}
|
|
625
634
|
}
|
|
626
635
|
|
|
627
|
-
export { type BaseNetworkEvent, BodyFormat, type ConnectEvent, type ConnectionEvent, type ConsoleEvent, ConsoleLevel, ConsoleSource, ConsoleType, EventType, type GraphQLRequest, type GraphQLResponse, GraphqlOprtation, HttpMethod, HttpStatusClass, Limelight, type LimelightConfig, type LimelightEvent, type LimelightMessage, type NetworkErrorEvent, type NetworkEvent, NetworkPhase, type NetworkRequest, type NetworkRequestWithResponse, type NetworkResponse, NetworkType, type ParsedStackTrace, type RequestBridgeConfig, type ResponseBridgeConfig, type SerializedBody, type Session, type StackFrame };
|
|
636
|
+
export { type BaseCommand, type BaseNetworkEvent, BodyFormat, type ClearRendersCommand, type Command, type CommandAckEvent, CommandType, type ConnectEvent, type ConnectionEvent, type ConsoleEvent, ConsoleLevel, ConsoleSource, ConsoleType, EventType, type GraphQLRequest, type GraphQLResponse, GraphqlOprtation, HttpMethod, HttpStatusClass, Limelight, type LimelightConfig, type LimelightEvent, type LimelightMessage, type NetworkErrorEvent, type NetworkEvent, NetworkPhase, type NetworkRequest, type NetworkRequestWithResponse, type NetworkResponse, NetworkType, type ParsedStackTrace, type RequestBridgeConfig, type ResponseBridgeConfig, type SerializedBody, type Session, type StackFrame };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ declare enum NetworkPhase {
|
|
|
7
7
|
CONNECT = "CONNECT",
|
|
8
8
|
REQUEST = "REQUEST",
|
|
9
9
|
RESPONSE = "RESPONSE",
|
|
10
|
-
ERROR = "ERROR"
|
|
10
|
+
ERROR = "ERROR",
|
|
11
|
+
ABORT = "ABORT"
|
|
11
12
|
}
|
|
12
13
|
declare enum BodyFormat {
|
|
13
14
|
TEXT = "TEXT",
|
|
@@ -92,7 +93,7 @@ interface NetworkResponse extends BaseNetworkEvent {
|
|
|
92
93
|
* NETWORK ERROR (3rd possible outcome)
|
|
93
94
|
*/
|
|
94
95
|
interface NetworkErrorEvent extends BaseNetworkEvent {
|
|
95
|
-
phase: NetworkPhase.ERROR;
|
|
96
|
+
phase: NetworkPhase.ERROR | NetworkPhase.ABORT;
|
|
96
97
|
errorMessage: string;
|
|
97
98
|
stack?: string;
|
|
98
99
|
}
|
|
@@ -214,6 +215,14 @@ declare enum CommandType {
|
|
|
214
215
|
CLEAR_RENDERS = "CLEAR_RENDERS",
|
|
215
216
|
ACK = "ACK"
|
|
216
217
|
}
|
|
218
|
+
interface BaseCommand {
|
|
219
|
+
type: CommandType;
|
|
220
|
+
id?: string;
|
|
221
|
+
}
|
|
222
|
+
interface ClearRendersCommand extends BaseCommand {
|
|
223
|
+
type: CommandType.CLEAR_RENDERS;
|
|
224
|
+
}
|
|
225
|
+
type Command = ClearRendersCommand;
|
|
217
226
|
interface CommandAckEvent {
|
|
218
227
|
phase: CommandType.ACK;
|
|
219
228
|
commandId: string;
|
|
@@ -624,4 +633,4 @@ declare global {
|
|
|
624
633
|
}
|
|
625
634
|
}
|
|
626
635
|
|
|
627
|
-
export { type BaseNetworkEvent, BodyFormat, type ConnectEvent, type ConnectionEvent, type ConsoleEvent, ConsoleLevel, ConsoleSource, ConsoleType, EventType, type GraphQLRequest, type GraphQLResponse, GraphqlOprtation, HttpMethod, HttpStatusClass, Limelight, type LimelightConfig, type LimelightEvent, type LimelightMessage, type NetworkErrorEvent, type NetworkEvent, NetworkPhase, type NetworkRequest, type NetworkRequestWithResponse, type NetworkResponse, NetworkType, type ParsedStackTrace, type RequestBridgeConfig, type ResponseBridgeConfig, type SerializedBody, type Session, type StackFrame };
|
|
636
|
+
export { type BaseCommand, type BaseNetworkEvent, BodyFormat, type ClearRendersCommand, type Command, type CommandAckEvent, CommandType, type ConnectEvent, type ConnectionEvent, type ConsoleEvent, ConsoleLevel, ConsoleSource, ConsoleType, EventType, type GraphQLRequest, type GraphQLResponse, GraphqlOprtation, HttpMethod, HttpStatusClass, Limelight, type LimelightConfig, type LimelightEvent, type LimelightMessage, type NetworkErrorEvent, type NetworkEvent, NetworkPhase, type NetworkRequest, type NetworkRequestWithResponse, type NetworkResponse, NetworkType, type ParsedStackTrace, type RequestBridgeConfig, type ResponseBridgeConfig, type SerializedBody, type Session, type StackFrame };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
BodyFormat: () => BodyFormat,
|
|
24
|
+
CommandType: () => CommandType,
|
|
24
25
|
ConsoleLevel: () => ConsoleLevel,
|
|
25
26
|
ConsoleSource: () => ConsoleSource,
|
|
26
27
|
ConsoleType: () => ConsoleType,
|
|
@@ -72,6 +73,7 @@ var NetworkPhase = /* @__PURE__ */ ((NetworkPhase2) => {
|
|
|
72
73
|
NetworkPhase2["REQUEST"] = "REQUEST";
|
|
73
74
|
NetworkPhase2["RESPONSE"] = "RESPONSE";
|
|
74
75
|
NetworkPhase2["ERROR"] = "ERROR";
|
|
76
|
+
NetworkPhase2["ABORT"] = "ABORT";
|
|
75
77
|
return NetworkPhase2;
|
|
76
78
|
})(NetworkPhase || {});
|
|
77
79
|
var BodyFormat = /* @__PURE__ */ ((BodyFormat2) => {
|
|
@@ -118,6 +120,13 @@ var GraphqlOprtation = /* @__PURE__ */ ((GraphqlOprtation2) => {
|
|
|
118
120
|
return GraphqlOprtation2;
|
|
119
121
|
})(GraphqlOprtation || {});
|
|
120
122
|
|
|
123
|
+
// src/types/commands.ts
|
|
124
|
+
var CommandType = /* @__PURE__ */ ((CommandType2) => {
|
|
125
|
+
CommandType2["CLEAR_RENDERS"] = "CLEAR_RENDERS";
|
|
126
|
+
CommandType2["ACK"] = "ACK";
|
|
127
|
+
return CommandType2;
|
|
128
|
+
})(CommandType || {});
|
|
129
|
+
|
|
121
130
|
// src/helpers/detection/detectConsoleType.ts
|
|
122
131
|
var detectConsoleType = (level, args) => {
|
|
123
132
|
const messageStr = args.map((arg) => {
|
|
@@ -267,7 +276,7 @@ var SENSITIVE_HEADERS = [
|
|
|
267
276
|
var LIMELIGHT_WEB_WSS_URL = "wss://api.getlimelight.io";
|
|
268
277
|
var LIMELIGHT_DESKTOP_WSS_URL = "ws://localhost:8484";
|
|
269
278
|
var WS_PATH = "/limelight";
|
|
270
|
-
var SDK_VERSION = true ? "0.5.
|
|
279
|
+
var SDK_VERSION = true ? "0.5.2" : "test-version";
|
|
271
280
|
var RENDER_THRESHOLDS = {
|
|
272
281
|
HOT_VELOCITY: 5,
|
|
273
282
|
HIGH_RENDER_COUNT: 50,
|
|
@@ -838,13 +847,14 @@ var NetworkInterceptor = class {
|
|
|
838
847
|
} catch (err) {
|
|
839
848
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
840
849
|
const errorStack = err instanceof Error ? err.stack : void 0;
|
|
850
|
+
const isAbort = err instanceof DOMException && err.name === "AbortError";
|
|
841
851
|
let errorEvent = {
|
|
842
852
|
id: requestId,
|
|
843
853
|
sessionId: self.getSessionId(),
|
|
844
854
|
timestamp: Date.now(),
|
|
845
|
-
phase: "ERROR" /* ERROR */,
|
|
855
|
+
phase: isAbort ? "ABORT" /* ABORT */ : "ERROR" /* ERROR */,
|
|
846
856
|
networkType: "fetch" /* FETCH */,
|
|
847
|
-
errorMessage,
|
|
857
|
+
errorMessage: isAbort ? "Request aborted" : errorMessage,
|
|
848
858
|
stack: errorStack
|
|
849
859
|
};
|
|
850
860
|
if (self.config?.beforeSend) {
|
|
@@ -1028,14 +1038,14 @@ var XHRInterceptor = class {
|
|
|
1028
1038
|
self.sendMessage(responseEvent);
|
|
1029
1039
|
cleanup.call(this);
|
|
1030
1040
|
};
|
|
1031
|
-
const sendError = (errorMessage) => {
|
|
1041
|
+
const sendError = (errorMessage, phase = "ERROR" /* ERROR */) => {
|
|
1032
1042
|
if (responseSent) return;
|
|
1033
1043
|
responseSent = true;
|
|
1034
1044
|
let errorEvent = {
|
|
1035
1045
|
id: data.id,
|
|
1036
1046
|
sessionId: self.getSessionId(),
|
|
1037
1047
|
timestamp: Date.now(),
|
|
1038
|
-
phase
|
|
1048
|
+
phase,
|
|
1039
1049
|
networkType: "xhr" /* XHR */,
|
|
1040
1050
|
errorMessage
|
|
1041
1051
|
};
|
|
@@ -1061,7 +1071,7 @@ var XHRInterceptor = class {
|
|
|
1061
1071
|
cleanup.call(this);
|
|
1062
1072
|
};
|
|
1063
1073
|
const abortHandler = function() {
|
|
1064
|
-
sendError("Request aborted");
|
|
1074
|
+
sendError("Request aborted", "ABORT" /* ABORT */);
|
|
1065
1075
|
cleanup.call(this);
|
|
1066
1076
|
};
|
|
1067
1077
|
const timeoutHandler = function() {
|
|
@@ -1274,13 +1284,14 @@ var RenderInterceptor = class {
|
|
|
1274
1284
|
*/
|
|
1275
1285
|
walkFiberTree(fiber, parentComponentId, depth) {
|
|
1276
1286
|
if (!fiber) return;
|
|
1287
|
+
let currentParentId = parentComponentId;
|
|
1277
1288
|
if (this.isUserComponent(fiber) && this.didFiberRender(fiber)) {
|
|
1278
1289
|
const componentId = this.getOrCreateComponentId(fiber);
|
|
1279
1290
|
this.accumulateRender(fiber, componentId, parentComponentId, depth);
|
|
1280
1291
|
this.currentCommitComponents.add(componentId);
|
|
1281
|
-
|
|
1292
|
+
currentParentId = componentId;
|
|
1282
1293
|
}
|
|
1283
|
-
this.walkFiberTree(fiber.child,
|
|
1294
|
+
this.walkFiberTree(fiber.child, currentParentId, depth + 1);
|
|
1284
1295
|
this.walkFiberTree(fiber.sibling, parentComponentId, depth);
|
|
1285
1296
|
}
|
|
1286
1297
|
/**
|
|
@@ -2597,6 +2608,7 @@ var Limelight = new LimelightClient();
|
|
|
2597
2608
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2598
2609
|
0 && (module.exports = {
|
|
2599
2610
|
BodyFormat,
|
|
2611
|
+
CommandType,
|
|
2600
2612
|
ConsoleLevel,
|
|
2601
2613
|
ConsoleSource,
|
|
2602
2614
|
ConsoleType,
|