@superblocksteam/library 2.0.0-next.38 → 2.0.0-next.39
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/{allPaths-BPEggTbd.js → allPaths-C47LrTbh.js} +2 -2
- package/dist/{allPaths-BPEggTbd.js.map → allPaths-C47LrTbh.js.map} +1 -1
- package/dist/{allPaths-PR2rTiD5.js → allPaths-DYy0fkDX.js} +2 -2
- package/dist/{allPaths-PR2rTiD5.js.map → allPaths-DYy0fkDX.js.map} +1 -1
- package/dist/{allPathsLoader-BWLDGMsQ.js → allPathsLoader-BTLo3hEI.js} +3 -3
- package/dist/{allPathsLoader-C82irE62.js.map → allPathsLoader-BTLo3hEI.js.map} +1 -1
- package/dist/{allPathsLoader-C82irE62.js → allPathsLoader-ECeH1kwp.js} +3 -3
- package/dist/{allPathsLoader-BWLDGMsQ.js.map → allPathsLoader-ECeH1kwp.js.map} +1 -1
- package/dist/{index--MyJLg0V.js → index-DAxw-Mz5.js} +613 -214
- package/dist/{index--MyJLg0V.js.map → index-DAxw-Mz5.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/{splitPathsBySizeLoader-aKrjndrG.js → splitPathsBySizeLoader-BaVxbR-T.js} +2 -2
- package/dist/{splitPathsBySizeLoader-aKrjndrG.js.map → splitPathsBySizeLoader-BaVxbR-T.js.map} +1 -1
- package/dist/{splitPathsBySizeLoader-2qHY2dmp.js → splitPathsBySizeLoader-ClT0eYSZ.js} +2 -2
- package/dist/{splitPathsBySizeLoader-2qHY2dmp.js.map → splitPathsBySizeLoader-ClT0eYSZ.js.map} +1 -1
- package/package.json +4 -3
|
@@ -2690,14 +2690,14 @@ function getLoaderFn$1(options) {
|
|
|
2690
2690
|
if (!(loader === "all")) return [3, 3];
|
|
2691
2691
|
return [4, import(
|
|
2692
2692
|
/* webpackChunkName: "blueprint-icons-all-paths-loader" */
|
|
2693
|
-
"./allPathsLoader-
|
|
2693
|
+
"./allPathsLoader-ECeH1kwp.js"
|
|
2694
2694
|
)];
|
|
2695
2695
|
case 2:
|
|
2696
2696
|
return [2, _b2.sent().allPathsLoader];
|
|
2697
2697
|
case 3:
|
|
2698
2698
|
return [4, import(
|
|
2699
2699
|
/* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
|
|
2700
|
-
"./splitPathsBySizeLoader-
|
|
2700
|
+
"./splitPathsBySizeLoader-ClT0eYSZ.js"
|
|
2701
2701
|
)];
|
|
2702
2702
|
case 4:
|
|
2703
2703
|
return [2, _b2.sent().splitPathsBySizeLoader];
|
|
@@ -45785,6 +45785,240 @@ const SUPERBLOCKS_AUTHORIZATION_HEADER = "x-superblocks-authorization";
|
|
|
45785
45785
|
akeylesssecretsmanager: srcExports.SecretsV1.Store,
|
|
45786
45786
|
couchbase: srcExports.CouchbasePluginV1.Plugin
|
|
45787
45787
|
});
|
|
45788
|
+
var TMP_HTTP_STATUS_CODE = "http.status_code";
|
|
45789
|
+
var TMP_HTTP_ROUTE = "http.route";
|
|
45790
|
+
var TMP_MESSAGING_SYSTEM = "messaging.system";
|
|
45791
|
+
var TMP_MESSAGING_DESTINATION_KIND = "messaging.destination_kind";
|
|
45792
|
+
var SEMATTRS_HTTP_STATUS_CODE = TMP_HTTP_STATUS_CODE;
|
|
45793
|
+
var SEMATTRS_HTTP_ROUTE = TMP_HTTP_ROUTE;
|
|
45794
|
+
var SEMATTRS_MESSAGING_SYSTEM = TMP_MESSAGING_SYSTEM;
|
|
45795
|
+
var SEMATTRS_MESSAGING_DESTINATION_KIND = TMP_MESSAGING_DESTINATION_KIND;
|
|
45796
|
+
const OBS_TAG_API_ID = "api-id";
|
|
45797
|
+
const OBS_TAG_HTTP_ROUTE = SEMATTRS_HTTP_ROUTE;
|
|
45798
|
+
const OBS_TAG_HTTP_STATUS_CODE = SEMATTRS_HTTP_STATUS_CODE;
|
|
45799
|
+
const OBS_TAG_APPLICATION_ID = "application-id";
|
|
45800
|
+
const OBS_TAG_BRANCH = "branch";
|
|
45801
|
+
const OBS_TAG_COMMIT_ID = "commit-id";
|
|
45802
|
+
const OBS_SOCKET_STATUS_CODE = "socket.status-code";
|
|
45803
|
+
class SocketErrorException extends Error {
|
|
45804
|
+
constructor(code3, message2) {
|
|
45805
|
+
super(message2);
|
|
45806
|
+
this.code = code3;
|
|
45807
|
+
this.message = message2;
|
|
45808
|
+
}
|
|
45809
|
+
}
|
|
45810
|
+
class ISocket {
|
|
45811
|
+
constructor(ws2, requestHandlers, globalMiddlewares, timeouts, logger) {
|
|
45812
|
+
this.responseHandler = /* @__PURE__ */ new Map();
|
|
45813
|
+
this.ws = ws2;
|
|
45814
|
+
this.requestHandlers = requestHandlers;
|
|
45815
|
+
this.globalMiddlewares = globalMiddlewares;
|
|
45816
|
+
this.nxtRequestId = 0;
|
|
45817
|
+
this.logger = logger ?? { error: console.error };
|
|
45818
|
+
this.timeouts = timeouts;
|
|
45819
|
+
this.resetConnectionTimeout();
|
|
45820
|
+
this.ws.addEventListener("message", async (event) => {
|
|
45821
|
+
const eventData = JSON.parse(event.data.toString());
|
|
45822
|
+
return this.handleMessage(eventData);
|
|
45823
|
+
});
|
|
45824
|
+
}
|
|
45825
|
+
async handleMessage(message2) {
|
|
45826
|
+
this.resetConnectionTimeout();
|
|
45827
|
+
if (message2.request) {
|
|
45828
|
+
const parts = message2.request.method.split(".");
|
|
45829
|
+
let handlers = this.requestHandlers;
|
|
45830
|
+
for (const part of parts) {
|
|
45831
|
+
handlers = handlers[part];
|
|
45832
|
+
if (!handlers) {
|
|
45833
|
+
return this.respondError(message2.request.id, {
|
|
45834
|
+
code: 2,
|
|
45835
|
+
message: `unknown method ${message2.request.method}`
|
|
45836
|
+
});
|
|
45837
|
+
}
|
|
45838
|
+
}
|
|
45839
|
+
if (!Array.isArray(handlers)) {
|
|
45840
|
+
return this.respondError(message2.request.id, {
|
|
45841
|
+
code: 2,
|
|
45842
|
+
message: "unknown method"
|
|
45843
|
+
});
|
|
45844
|
+
}
|
|
45845
|
+
handlers = [...this.globalMiddlewares, ...handlers];
|
|
45846
|
+
if (message2.request.setAuthorization) {
|
|
45847
|
+
this.peerAuthorization = message2.request.setAuthorization;
|
|
45848
|
+
}
|
|
45849
|
+
const reqCtx = {
|
|
45850
|
+
peerAuthorization: this.peerAuthorization,
|
|
45851
|
+
method: message2.request.method,
|
|
45852
|
+
requestId: message2.request.id
|
|
45853
|
+
};
|
|
45854
|
+
const client2 = createISocketClient(this);
|
|
45855
|
+
const payload = message2.request.payload;
|
|
45856
|
+
let alreadyResponded = false;
|
|
45857
|
+
const generateNextFn = (idx) => {
|
|
45858
|
+
let wasCalled = false;
|
|
45859
|
+
return async () => {
|
|
45860
|
+
if (alreadyResponded) {
|
|
45861
|
+
throw new SocketErrorException(4, "next() was called after the response was sent");
|
|
45862
|
+
}
|
|
45863
|
+
const handler = handlers[idx];
|
|
45864
|
+
if (!handler) {
|
|
45865
|
+
throw new SocketErrorException(5, "cannot call past the last handler in the chain");
|
|
45866
|
+
}
|
|
45867
|
+
if (wasCalled) {
|
|
45868
|
+
throw new SocketErrorException(6, "next() was called multiple times");
|
|
45869
|
+
}
|
|
45870
|
+
wasCalled = true;
|
|
45871
|
+
return this.callHandler(handler, payload, reqCtx, client2, generateNextFn(idx + 1));
|
|
45872
|
+
};
|
|
45873
|
+
};
|
|
45874
|
+
let response;
|
|
45875
|
+
try {
|
|
45876
|
+
response = await generateNextFn(0)();
|
|
45877
|
+
} catch (error) {
|
|
45878
|
+
const socketError = error instanceof SocketErrorException ? { code: error.code, message: error.message } : { code: 3, message: error.toString() };
|
|
45879
|
+
return this.respondError(message2.request.id, socketError, error);
|
|
45880
|
+
}
|
|
45881
|
+
this.respond(message2.request.id, response);
|
|
45882
|
+
alreadyResponded = true;
|
|
45883
|
+
} else if (message2.response && message2.response.id) {
|
|
45884
|
+
const responseHandler = this.responseHandler.get(message2.response.id);
|
|
45885
|
+
if (!responseHandler) {
|
|
45886
|
+
return;
|
|
45887
|
+
}
|
|
45888
|
+
if (message2.response.error) {
|
|
45889
|
+
responseHandler.reject(message2.response.error);
|
|
45890
|
+
}
|
|
45891
|
+
responseHandler.resolve(message2.response.payload);
|
|
45892
|
+
clearTimeout(responseHandler.timeout);
|
|
45893
|
+
this.responseHandler.delete(message2.response.id);
|
|
45894
|
+
} else {
|
|
45895
|
+
return this.respondError(-1, {
|
|
45896
|
+
code: 3,
|
|
45897
|
+
message: "unknown request id"
|
|
45898
|
+
});
|
|
45899
|
+
}
|
|
45900
|
+
}
|
|
45901
|
+
async callHandler(handler, params, ctx, client2, next2) {
|
|
45902
|
+
return handler(params, ctx, client2, next2);
|
|
45903
|
+
}
|
|
45904
|
+
request(method4, params, authorization) {
|
|
45905
|
+
return new Promise((resolve, reject) => {
|
|
45906
|
+
const requestId = ++this.nxtRequestId;
|
|
45907
|
+
this.responseHandler.set(requestId, {
|
|
45908
|
+
resolve: (result) => resolve(result),
|
|
45909
|
+
reject: (error) => reject(error)
|
|
45910
|
+
});
|
|
45911
|
+
let toSend = { request: { method: method4, payload: params, id: requestId, setAuthorization: authorization } };
|
|
45912
|
+
toSend = this.decorateToSend(toSend);
|
|
45913
|
+
this.ws.send(JSON.stringify(toSend));
|
|
45914
|
+
this.resetConnectionTimeout();
|
|
45915
|
+
this.resetNoResponseTimeout(requestId);
|
|
45916
|
+
});
|
|
45917
|
+
}
|
|
45918
|
+
decorateToSend(message2) {
|
|
45919
|
+
return message2;
|
|
45920
|
+
}
|
|
45921
|
+
respond(requestId, result) {
|
|
45922
|
+
const toSend = {
|
|
45923
|
+
response: {
|
|
45924
|
+
payload: result,
|
|
45925
|
+
id: requestId,
|
|
45926
|
+
error: null
|
|
45927
|
+
}
|
|
45928
|
+
};
|
|
45929
|
+
return this.ws.send(JSON.stringify(toSend));
|
|
45930
|
+
}
|
|
45931
|
+
respondError(requestId, error, exception) {
|
|
45932
|
+
const toSend = {
|
|
45933
|
+
response: {
|
|
45934
|
+
payload: null,
|
|
45935
|
+
id: requestId,
|
|
45936
|
+
error
|
|
45937
|
+
}
|
|
45938
|
+
};
|
|
45939
|
+
return this.ws.send(JSON.stringify(toSend));
|
|
45940
|
+
}
|
|
45941
|
+
resetConnectionTimeout() {
|
|
45942
|
+
var _a2, _b2;
|
|
45943
|
+
if (!((_a2 = this.timeouts) == null ? void 0 : _a2.connectionTimeoutInSeconds)) {
|
|
45944
|
+
return;
|
|
45945
|
+
}
|
|
45946
|
+
if (this.connectionTimeout) {
|
|
45947
|
+
clearTimeout(this.connectionTimeout);
|
|
45948
|
+
}
|
|
45949
|
+
this.connectionTimeout = setTimeout(this.handleConnectionTimeout(), ((_b2 = this.timeouts) == null ? void 0 : _b2.connectionTimeoutInSeconds) * 1e3);
|
|
45950
|
+
}
|
|
45951
|
+
handleConnectionTimeout() {
|
|
45952
|
+
return () => {
|
|
45953
|
+
var _a2;
|
|
45954
|
+
this.logger.error(`Connection timed out after ${(_a2 = this.timeouts) == null ? void 0 : _a2.connectionTimeoutInSeconds} seconds`);
|
|
45955
|
+
this.close();
|
|
45956
|
+
};
|
|
45957
|
+
}
|
|
45958
|
+
resetNoResponseTimeout(requestId) {
|
|
45959
|
+
var _a2, _b2;
|
|
45960
|
+
if (!((_a2 = this.timeouts) == null ? void 0 : _a2.noResponseTimeoutInSeconds)) {
|
|
45961
|
+
return;
|
|
45962
|
+
}
|
|
45963
|
+
const responseHandler = this.responseHandler.get(requestId);
|
|
45964
|
+
if (!responseHandler) {
|
|
45965
|
+
return;
|
|
45966
|
+
}
|
|
45967
|
+
const noResponseTimeout = responseHandler.timeout;
|
|
45968
|
+
const reject = responseHandler.reject;
|
|
45969
|
+
if (responseHandler.timeout) {
|
|
45970
|
+
clearTimeout(noResponseTimeout);
|
|
45971
|
+
}
|
|
45972
|
+
responseHandler.timeout = setTimeout(this.handleNoResponseTimeout(reject), ((_b2 = this.timeouts) == null ? void 0 : _b2.noResponseTimeoutInSeconds) * 1e3);
|
|
45973
|
+
}
|
|
45974
|
+
handleNoResponseTimeout(reject) {
|
|
45975
|
+
return () => {
|
|
45976
|
+
var _a2;
|
|
45977
|
+
const message2 = `Request timed out after ${(_a2 = this.timeouts) == null ? void 0 : _a2.noResponseTimeoutInSeconds} seconds`;
|
|
45978
|
+
this.logger.error(message2);
|
|
45979
|
+
reject({ code: 7, message: message2 });
|
|
45980
|
+
};
|
|
45981
|
+
}
|
|
45982
|
+
close() {
|
|
45983
|
+
clearTimeout(this.connectionTimeout);
|
|
45984
|
+
this.responseHandler.forEach((handler, key2) => {
|
|
45985
|
+
clearTimeout(handler.timeout);
|
|
45986
|
+
this.logger.error(`Rejecting pending requestId ${key2} due to connection close`);
|
|
45987
|
+
handler.reject({ code: 8, message: "Connection closed" });
|
|
45988
|
+
});
|
|
45989
|
+
this.ws.close();
|
|
45990
|
+
}
|
|
45991
|
+
}
|
|
45992
|
+
const proxyTarget = Object.freeze(() => {
|
|
45993
|
+
});
|
|
45994
|
+
function createIsocketProxy(socket, path2) {
|
|
45995
|
+
return new Proxy(proxyTarget, {
|
|
45996
|
+
get(_target, prop) {
|
|
45997
|
+
const childPath = path2 ? `${path2}.${prop}` : prop;
|
|
45998
|
+
if (childPath === "then") {
|
|
45999
|
+
return void 0;
|
|
46000
|
+
}
|
|
46001
|
+
return createIsocketProxy(socket, childPath);
|
|
46002
|
+
},
|
|
46003
|
+
apply(_target, _thisArg, args) {
|
|
46004
|
+
if (path2 === void 0) {
|
|
46005
|
+
throw new Error("The root object is not callable");
|
|
46006
|
+
}
|
|
46007
|
+
if (path2.endsWith(".apply") && args.length === 2 && Array.isArray(args[1])) {
|
|
46008
|
+
path2 = path2.slice(0, -".apply".length);
|
|
46009
|
+
args = args[1];
|
|
46010
|
+
}
|
|
46011
|
+
return socket.request(path2, args[0]);
|
|
46012
|
+
}
|
|
46013
|
+
});
|
|
46014
|
+
}
|
|
46015
|
+
function createISocketClient(socket) {
|
|
46016
|
+
return {
|
|
46017
|
+
close: () => socket.close(),
|
|
46018
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46019
|
+
call: createIsocketProxy(socket, void 0)
|
|
46020
|
+
};
|
|
46021
|
+
}
|
|
45788
46022
|
var _globalThis = typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : typeof window === "object" ? window : typeof global === "object" ? global : {};
|
|
45789
46023
|
var VERSION = "1.9.0";
|
|
45790
46024
|
var re$2 = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
@@ -46029,7 +46263,7 @@ var __spreadArray$3 = function(to2, from2, pack) {
|
|
|
46029
46263
|
}
|
|
46030
46264
|
return to2.concat(ar2 || Array.prototype.slice.call(from2));
|
|
46031
46265
|
};
|
|
46032
|
-
var API_NAME$
|
|
46266
|
+
var API_NAME$3 = "diag";
|
|
46033
46267
|
var DiagAPI = (
|
|
46034
46268
|
/** @class */
|
|
46035
46269
|
function() {
|
|
@@ -46073,7 +46307,7 @@ var DiagAPI = (
|
|
|
46073
46307
|
};
|
|
46074
46308
|
self2.setLogger = setLogger;
|
|
46075
46309
|
self2.disable = function() {
|
|
46076
|
-
unregisterGlobal(API_NAME$
|
|
46310
|
+
unregisterGlobal(API_NAME$3, self2);
|
|
46077
46311
|
};
|
|
46078
46312
|
self2.createComponentLogger = function(options) {
|
|
46079
46313
|
return new DiagComponentLogger(options);
|
|
@@ -46314,7 +46548,7 @@ var __spreadArray$1 = function(to2, from2, pack) {
|
|
|
46314
46548
|
}
|
|
46315
46549
|
return to2.concat(ar2 || Array.prototype.slice.call(from2));
|
|
46316
46550
|
};
|
|
46317
|
-
var API_NAME$
|
|
46551
|
+
var API_NAME$2 = "context";
|
|
46318
46552
|
var NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
46319
46553
|
var ContextAPI = (
|
|
46320
46554
|
/** @class */
|
|
@@ -46328,7 +46562,7 @@ var ContextAPI = (
|
|
|
46328
46562
|
return this._instance;
|
|
46329
46563
|
};
|
|
46330
46564
|
ContextAPI2.prototype.setGlobalContextManager = function(contextManager) {
|
|
46331
|
-
return registerGlobal(API_NAME$
|
|
46565
|
+
return registerGlobal(API_NAME$2, contextManager, DiagAPI.instance());
|
|
46332
46566
|
};
|
|
46333
46567
|
ContextAPI2.prototype.active = function() {
|
|
46334
46568
|
return this._getContextManager().active();
|
|
@@ -46345,15 +46579,232 @@ var ContextAPI = (
|
|
|
46345
46579
|
return this._getContextManager().bind(context2, target);
|
|
46346
46580
|
};
|
|
46347
46581
|
ContextAPI2.prototype._getContextManager = function() {
|
|
46348
|
-
return getGlobal$1(API_NAME$
|
|
46582
|
+
return getGlobal$1(API_NAME$2) || NOOP_CONTEXT_MANAGER;
|
|
46349
46583
|
};
|
|
46350
46584
|
ContextAPI2.prototype.disable = function() {
|
|
46351
46585
|
this._getContextManager().disable();
|
|
46352
|
-
unregisterGlobal(API_NAME$
|
|
46586
|
+
unregisterGlobal(API_NAME$2, DiagAPI.instance());
|
|
46353
46587
|
};
|
|
46354
46588
|
return ContextAPI2;
|
|
46355
46589
|
}()
|
|
46356
46590
|
);
|
|
46591
|
+
var TraceFlags;
|
|
46592
|
+
(function(TraceFlags2) {
|
|
46593
|
+
TraceFlags2[TraceFlags2["NONE"] = 0] = "NONE";
|
|
46594
|
+
TraceFlags2[TraceFlags2["SAMPLED"] = 1] = "SAMPLED";
|
|
46595
|
+
})(TraceFlags || (TraceFlags = {}));
|
|
46596
|
+
var INVALID_SPANID = "0000000000000000";
|
|
46597
|
+
var INVALID_TRACEID = "00000000000000000000000000000000";
|
|
46598
|
+
var INVALID_SPAN_CONTEXT = {
|
|
46599
|
+
traceId: INVALID_TRACEID,
|
|
46600
|
+
spanId: INVALID_SPANID,
|
|
46601
|
+
traceFlags: TraceFlags.NONE
|
|
46602
|
+
};
|
|
46603
|
+
var NonRecordingSpan = (
|
|
46604
|
+
/** @class */
|
|
46605
|
+
function() {
|
|
46606
|
+
function NonRecordingSpan2(_spanContext) {
|
|
46607
|
+
if (_spanContext === void 0) {
|
|
46608
|
+
_spanContext = INVALID_SPAN_CONTEXT;
|
|
46609
|
+
}
|
|
46610
|
+
this._spanContext = _spanContext;
|
|
46611
|
+
}
|
|
46612
|
+
NonRecordingSpan2.prototype.spanContext = function() {
|
|
46613
|
+
return this._spanContext;
|
|
46614
|
+
};
|
|
46615
|
+
NonRecordingSpan2.prototype.setAttribute = function(_key, _value) {
|
|
46616
|
+
return this;
|
|
46617
|
+
};
|
|
46618
|
+
NonRecordingSpan2.prototype.setAttributes = function(_attributes) {
|
|
46619
|
+
return this;
|
|
46620
|
+
};
|
|
46621
|
+
NonRecordingSpan2.prototype.addEvent = function(_name, _attributes) {
|
|
46622
|
+
return this;
|
|
46623
|
+
};
|
|
46624
|
+
NonRecordingSpan2.prototype.addLink = function(_link) {
|
|
46625
|
+
return this;
|
|
46626
|
+
};
|
|
46627
|
+
NonRecordingSpan2.prototype.addLinks = function(_links) {
|
|
46628
|
+
return this;
|
|
46629
|
+
};
|
|
46630
|
+
NonRecordingSpan2.prototype.setStatus = function(_status) {
|
|
46631
|
+
return this;
|
|
46632
|
+
};
|
|
46633
|
+
NonRecordingSpan2.prototype.updateName = function(_name) {
|
|
46634
|
+
return this;
|
|
46635
|
+
};
|
|
46636
|
+
NonRecordingSpan2.prototype.end = function(_endTime) {
|
|
46637
|
+
};
|
|
46638
|
+
NonRecordingSpan2.prototype.isRecording = function() {
|
|
46639
|
+
return false;
|
|
46640
|
+
};
|
|
46641
|
+
NonRecordingSpan2.prototype.recordException = function(_exception, _time) {
|
|
46642
|
+
};
|
|
46643
|
+
return NonRecordingSpan2;
|
|
46644
|
+
}()
|
|
46645
|
+
);
|
|
46646
|
+
var SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
|
|
46647
|
+
function getSpan(context2) {
|
|
46648
|
+
return context2.getValue(SPAN_KEY) || void 0;
|
|
46649
|
+
}
|
|
46650
|
+
function getActiveSpan() {
|
|
46651
|
+
return getSpan(ContextAPI.getInstance().active());
|
|
46652
|
+
}
|
|
46653
|
+
function setSpan(context2, span) {
|
|
46654
|
+
return context2.setValue(SPAN_KEY, span);
|
|
46655
|
+
}
|
|
46656
|
+
function deleteSpan(context2) {
|
|
46657
|
+
return context2.deleteValue(SPAN_KEY);
|
|
46658
|
+
}
|
|
46659
|
+
function setSpanContext(context2, spanContext) {
|
|
46660
|
+
return setSpan(context2, new NonRecordingSpan(spanContext));
|
|
46661
|
+
}
|
|
46662
|
+
function getSpanContext(context2) {
|
|
46663
|
+
var _a2;
|
|
46664
|
+
return (_a2 = getSpan(context2)) === null || _a2 === void 0 ? void 0 : _a2.spanContext();
|
|
46665
|
+
}
|
|
46666
|
+
var VALID_TRACEID_REGEX = /^([0-9a-f]{32})$/i;
|
|
46667
|
+
var VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;
|
|
46668
|
+
function isValidTraceId(traceId) {
|
|
46669
|
+
return VALID_TRACEID_REGEX.test(traceId) && traceId !== INVALID_TRACEID;
|
|
46670
|
+
}
|
|
46671
|
+
function isValidSpanId(spanId) {
|
|
46672
|
+
return VALID_SPANID_REGEX.test(spanId) && spanId !== INVALID_SPANID;
|
|
46673
|
+
}
|
|
46674
|
+
function isSpanContextValid(spanContext) {
|
|
46675
|
+
return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
|
|
46676
|
+
}
|
|
46677
|
+
function wrapSpanContext(spanContext) {
|
|
46678
|
+
return new NonRecordingSpan(spanContext);
|
|
46679
|
+
}
|
|
46680
|
+
var contextApi = ContextAPI.getInstance();
|
|
46681
|
+
var NoopTracer = (
|
|
46682
|
+
/** @class */
|
|
46683
|
+
function() {
|
|
46684
|
+
function NoopTracer2() {
|
|
46685
|
+
}
|
|
46686
|
+
NoopTracer2.prototype.startSpan = function(name, options, context2) {
|
|
46687
|
+
if (context2 === void 0) {
|
|
46688
|
+
context2 = contextApi.active();
|
|
46689
|
+
}
|
|
46690
|
+
var root2 = Boolean(options === null || options === void 0 ? void 0 : options.root);
|
|
46691
|
+
if (root2) {
|
|
46692
|
+
return new NonRecordingSpan();
|
|
46693
|
+
}
|
|
46694
|
+
var parentFromContext = context2 && getSpanContext(context2);
|
|
46695
|
+
if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) {
|
|
46696
|
+
return new NonRecordingSpan(parentFromContext);
|
|
46697
|
+
} else {
|
|
46698
|
+
return new NonRecordingSpan();
|
|
46699
|
+
}
|
|
46700
|
+
};
|
|
46701
|
+
NoopTracer2.prototype.startActiveSpan = function(name, arg2, arg3, arg4) {
|
|
46702
|
+
var opts;
|
|
46703
|
+
var ctx;
|
|
46704
|
+
var fn3;
|
|
46705
|
+
if (arguments.length < 2) {
|
|
46706
|
+
return;
|
|
46707
|
+
} else if (arguments.length === 2) {
|
|
46708
|
+
fn3 = arg2;
|
|
46709
|
+
} else if (arguments.length === 3) {
|
|
46710
|
+
opts = arg2;
|
|
46711
|
+
fn3 = arg3;
|
|
46712
|
+
} else {
|
|
46713
|
+
opts = arg2;
|
|
46714
|
+
ctx = arg3;
|
|
46715
|
+
fn3 = arg4;
|
|
46716
|
+
}
|
|
46717
|
+
var parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
46718
|
+
var span = this.startSpan(name, opts, parentContext);
|
|
46719
|
+
var contextWithSpanSet = setSpan(parentContext, span);
|
|
46720
|
+
return contextApi.with(contextWithSpanSet, fn3, void 0, span);
|
|
46721
|
+
};
|
|
46722
|
+
return NoopTracer2;
|
|
46723
|
+
}()
|
|
46724
|
+
);
|
|
46725
|
+
function isSpanContext(spanContext) {
|
|
46726
|
+
return typeof spanContext === "object" && typeof spanContext["spanId"] === "string" && typeof spanContext["traceId"] === "string" && typeof spanContext["traceFlags"] === "number";
|
|
46727
|
+
}
|
|
46728
|
+
var NOOP_TRACER = new NoopTracer();
|
|
46729
|
+
var ProxyTracer = (
|
|
46730
|
+
/** @class */
|
|
46731
|
+
function() {
|
|
46732
|
+
function ProxyTracer2(_provider, name, version2, options) {
|
|
46733
|
+
this._provider = _provider;
|
|
46734
|
+
this.name = name;
|
|
46735
|
+
this.version = version2;
|
|
46736
|
+
this.options = options;
|
|
46737
|
+
}
|
|
46738
|
+
ProxyTracer2.prototype.startSpan = function(name, options, context2) {
|
|
46739
|
+
return this._getTracer().startSpan(name, options, context2);
|
|
46740
|
+
};
|
|
46741
|
+
ProxyTracer2.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
|
|
46742
|
+
var tracer = this._getTracer();
|
|
46743
|
+
return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
|
|
46744
|
+
};
|
|
46745
|
+
ProxyTracer2.prototype._getTracer = function() {
|
|
46746
|
+
if (this._delegate) {
|
|
46747
|
+
return this._delegate;
|
|
46748
|
+
}
|
|
46749
|
+
var tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
|
|
46750
|
+
if (!tracer) {
|
|
46751
|
+
return NOOP_TRACER;
|
|
46752
|
+
}
|
|
46753
|
+
this._delegate = tracer;
|
|
46754
|
+
return this._delegate;
|
|
46755
|
+
};
|
|
46756
|
+
return ProxyTracer2;
|
|
46757
|
+
}()
|
|
46758
|
+
);
|
|
46759
|
+
var NoopTracerProvider = (
|
|
46760
|
+
/** @class */
|
|
46761
|
+
function() {
|
|
46762
|
+
function NoopTracerProvider2() {
|
|
46763
|
+
}
|
|
46764
|
+
NoopTracerProvider2.prototype.getTracer = function(_name, _version, _options) {
|
|
46765
|
+
return new NoopTracer();
|
|
46766
|
+
};
|
|
46767
|
+
return NoopTracerProvider2;
|
|
46768
|
+
}()
|
|
46769
|
+
);
|
|
46770
|
+
var NOOP_TRACER_PROVIDER = new NoopTracerProvider();
|
|
46771
|
+
var ProxyTracerProvider = (
|
|
46772
|
+
/** @class */
|
|
46773
|
+
function() {
|
|
46774
|
+
function ProxyTracerProvider2() {
|
|
46775
|
+
}
|
|
46776
|
+
ProxyTracerProvider2.prototype.getTracer = function(name, version2, options) {
|
|
46777
|
+
var _a2;
|
|
46778
|
+
return (_a2 = this.getDelegateTracer(name, version2, options)) !== null && _a2 !== void 0 ? _a2 : new ProxyTracer(this, name, version2, options);
|
|
46779
|
+
};
|
|
46780
|
+
ProxyTracerProvider2.prototype.getDelegate = function() {
|
|
46781
|
+
var _a2;
|
|
46782
|
+
return (_a2 = this._delegate) !== null && _a2 !== void 0 ? _a2 : NOOP_TRACER_PROVIDER;
|
|
46783
|
+
};
|
|
46784
|
+
ProxyTracerProvider2.prototype.setDelegate = function(delegate) {
|
|
46785
|
+
this._delegate = delegate;
|
|
46786
|
+
};
|
|
46787
|
+
ProxyTracerProvider2.prototype.getDelegateTracer = function(name, version2, options) {
|
|
46788
|
+
var _a2;
|
|
46789
|
+
return (_a2 = this._delegate) === null || _a2 === void 0 ? void 0 : _a2.getTracer(name, version2, options);
|
|
46790
|
+
};
|
|
46791
|
+
return ProxyTracerProvider2;
|
|
46792
|
+
}()
|
|
46793
|
+
);
|
|
46794
|
+
var SpanKind;
|
|
46795
|
+
(function(SpanKind2) {
|
|
46796
|
+
SpanKind2[SpanKind2["INTERNAL"] = 0] = "INTERNAL";
|
|
46797
|
+
SpanKind2[SpanKind2["SERVER"] = 1] = "SERVER";
|
|
46798
|
+
SpanKind2[SpanKind2["CLIENT"] = 2] = "CLIENT";
|
|
46799
|
+
SpanKind2[SpanKind2["PRODUCER"] = 3] = "PRODUCER";
|
|
46800
|
+
SpanKind2[SpanKind2["CONSUMER"] = 4] = "CONSUMER";
|
|
46801
|
+
})(SpanKind || (SpanKind = {}));
|
|
46802
|
+
var SpanStatusCode;
|
|
46803
|
+
(function(SpanStatusCode2) {
|
|
46804
|
+
SpanStatusCode2[SpanStatusCode2["UNSET"] = 0] = "UNSET";
|
|
46805
|
+
SpanStatusCode2[SpanStatusCode2["OK"] = 1] = "OK";
|
|
46806
|
+
SpanStatusCode2[SpanStatusCode2["ERROR"] = 2] = "ERROR";
|
|
46807
|
+
})(SpanStatusCode || (SpanStatusCode = {}));
|
|
46357
46808
|
var context$2 = ContextAPI.getInstance();
|
|
46358
46809
|
var NoopTextMapPropagator = (
|
|
46359
46810
|
/** @class */
|
|
@@ -46384,7 +46835,7 @@ function setBaggage(context2, baggage) {
|
|
|
46384
46835
|
function deleteBaggage(context2) {
|
|
46385
46836
|
return context2.deleteValue(BAGGAGE_KEY);
|
|
46386
46837
|
}
|
|
46387
|
-
var API_NAME = "propagation";
|
|
46838
|
+
var API_NAME$1 = "propagation";
|
|
46388
46839
|
var NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();
|
|
46389
46840
|
var PropagationAPI = (
|
|
46390
46841
|
/** @class */
|
|
@@ -46403,7 +46854,7 @@ var PropagationAPI = (
|
|
|
46403
46854
|
return this._instance;
|
|
46404
46855
|
};
|
|
46405
46856
|
PropagationAPI2.prototype.setGlobalPropagator = function(propagator) {
|
|
46406
|
-
return registerGlobal(API_NAME, propagator, DiagAPI.instance());
|
|
46857
|
+
return registerGlobal(API_NAME$1, propagator, DiagAPI.instance());
|
|
46407
46858
|
};
|
|
46408
46859
|
PropagationAPI2.prototype.inject = function(context2, carrier, setter) {
|
|
46409
46860
|
if (setter === void 0) {
|
|
@@ -46421,230 +46872,177 @@ var PropagationAPI = (
|
|
|
46421
46872
|
return this._getGlobalPropagator().fields();
|
|
46422
46873
|
};
|
|
46423
46874
|
PropagationAPI2.prototype.disable = function() {
|
|
46424
|
-
unregisterGlobal(API_NAME, DiagAPI.instance());
|
|
46875
|
+
unregisterGlobal(API_NAME$1, DiagAPI.instance());
|
|
46425
46876
|
};
|
|
46426
46877
|
PropagationAPI2.prototype._getGlobalPropagator = function() {
|
|
46427
|
-
return getGlobal$1(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;
|
|
46878
|
+
return getGlobal$1(API_NAME$1) || NOOP_TEXT_MAP_PROPAGATOR;
|
|
46428
46879
|
};
|
|
46429
46880
|
return PropagationAPI2;
|
|
46430
46881
|
}()
|
|
46431
46882
|
);
|
|
46432
46883
|
var propagation = PropagationAPI.getInstance();
|
|
46433
|
-
|
|
46434
|
-
|
|
46435
|
-
|
|
46436
|
-
|
|
46437
|
-
|
|
46884
|
+
var API_NAME = "trace";
|
|
46885
|
+
var TraceAPI = (
|
|
46886
|
+
/** @class */
|
|
46887
|
+
function() {
|
|
46888
|
+
function TraceAPI2() {
|
|
46889
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
46890
|
+
this.wrapSpanContext = wrapSpanContext;
|
|
46891
|
+
this.isSpanContextValid = isSpanContextValid;
|
|
46892
|
+
this.deleteSpan = deleteSpan;
|
|
46893
|
+
this.getSpan = getSpan;
|
|
46894
|
+
this.getActiveSpan = getActiveSpan;
|
|
46895
|
+
this.getSpanContext = getSpanContext;
|
|
46896
|
+
this.setSpan = setSpan;
|
|
46897
|
+
this.setSpanContext = setSpanContext;
|
|
46898
|
+
}
|
|
46899
|
+
TraceAPI2.getInstance = function() {
|
|
46900
|
+
if (!this._instance) {
|
|
46901
|
+
this._instance = new TraceAPI2();
|
|
46902
|
+
}
|
|
46903
|
+
return this._instance;
|
|
46904
|
+
};
|
|
46905
|
+
TraceAPI2.prototype.setGlobalTracerProvider = function(provider) {
|
|
46906
|
+
var success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance());
|
|
46907
|
+
if (success) {
|
|
46908
|
+
this._proxyTracerProvider.setDelegate(provider);
|
|
46909
|
+
}
|
|
46910
|
+
return success;
|
|
46911
|
+
};
|
|
46912
|
+
TraceAPI2.prototype.getTracerProvider = function() {
|
|
46913
|
+
return getGlobal$1(API_NAME) || this._proxyTracerProvider;
|
|
46914
|
+
};
|
|
46915
|
+
TraceAPI2.prototype.getTracer = function(name, version2) {
|
|
46916
|
+
return this.getTracerProvider().getTracer(name, version2);
|
|
46917
|
+
};
|
|
46918
|
+
TraceAPI2.prototype.disable = function() {
|
|
46919
|
+
unregisterGlobal(API_NAME, DiagAPI.instance());
|
|
46920
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
46921
|
+
};
|
|
46922
|
+
return TraceAPI2;
|
|
46923
|
+
}()
|
|
46924
|
+
);
|
|
46925
|
+
var trace$1 = TraceAPI.getInstance();
|
|
46926
|
+
function isPromise(obj) {
|
|
46927
|
+
return obj !== null && typeof obj === "object" && typeof obj.then === "function";
|
|
46928
|
+
}
|
|
46929
|
+
const endSpan = (traced, span) => {
|
|
46930
|
+
try {
|
|
46931
|
+
const result = traced();
|
|
46932
|
+
if (isPromise(result)) {
|
|
46933
|
+
return Promise.resolve(result).catch((err) => {
|
|
46934
|
+
setHttpStatusFromError(span, typeof err === "string" ? new Error(err) : err);
|
|
46935
|
+
throw err;
|
|
46936
|
+
}).finally(() => span.end());
|
|
46937
|
+
} else {
|
|
46938
|
+
span.end();
|
|
46939
|
+
return result;
|
|
46940
|
+
}
|
|
46941
|
+
} catch (error) {
|
|
46942
|
+
setHttpStatusFromError(span, error);
|
|
46943
|
+
span.end();
|
|
46944
|
+
throw error;
|
|
46438
46945
|
}
|
|
46946
|
+
};
|
|
46947
|
+
function setHttpStatusFromError(span, error) {
|
|
46948
|
+
span.setAttribute(OBS_TAG_HTTP_STATUS_CODE, 500);
|
|
46949
|
+
span.recordException(error);
|
|
46950
|
+
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
46439
46951
|
}
|
|
46440
|
-
class ISocket {
|
|
46441
|
-
constructor(ws2, requestHandlers, globalMiddlewares, timeouts, logger) {
|
|
46442
|
-
|
|
46443
|
-
this.
|
|
46444
|
-
this.
|
|
46445
|
-
this.
|
|
46446
|
-
|
|
46447
|
-
|
|
46448
|
-
|
|
46449
|
-
this.
|
|
46450
|
-
this.
|
|
46451
|
-
|
|
46452
|
-
|
|
46952
|
+
class TracedSocket extends ISocket {
|
|
46953
|
+
constructor(ws2, requestHandlers, globalMiddlewares, tracer, timeouts, logger) {
|
|
46954
|
+
super(ws2, requestHandlers, globalMiddlewares, timeouts, logger);
|
|
46955
|
+
this.activeSpanByRequestId = /* @__PURE__ */ new Map();
|
|
46956
|
+
this.middlewareSpanByReqId = /* @__PURE__ */ new Map();
|
|
46957
|
+
this.tracer = tracer;
|
|
46958
|
+
}
|
|
46959
|
+
async callHandler(handler, params, ctx, client2, next2) {
|
|
46960
|
+
let currentContext = context$2.active();
|
|
46961
|
+
const middleWareSpan = this.middlewareSpanByReqId.get(ctx.requestId);
|
|
46962
|
+
const activeSpan = this.activeSpanByRequestId.get(ctx.requestId);
|
|
46963
|
+
if (middleWareSpan) {
|
|
46964
|
+
middleWareSpan.end();
|
|
46965
|
+
if (activeSpan) {
|
|
46966
|
+
currentContext = trace$1.setSpan(context$2.active(), activeSpan);
|
|
46967
|
+
}
|
|
46968
|
+
}
|
|
46969
|
+
let result;
|
|
46970
|
+
await context$2.with(currentContext, async () => {
|
|
46971
|
+
await this.tracer.startActiveSpan(`WS HANDLER ${handler.name === "" ? ctx.method : handler.name}`, {
|
|
46972
|
+
attributes: {
|
|
46973
|
+
[SEMATTRS_MESSAGING_SYSTEM]: "ws",
|
|
46974
|
+
[SEMATTRS_MESSAGING_DESTINATION_KIND]: "websocket"
|
|
46975
|
+
},
|
|
46976
|
+
kind: SpanKind.SERVER
|
|
46977
|
+
}, async (span) => {
|
|
46978
|
+
this.middlewareSpanByReqId.set(ctx.requestId, span);
|
|
46979
|
+
result = await endSpan(() => super.callHandler(handler, params, ctx, client2, next2), span);
|
|
46980
|
+
this.middlewareSpanByReqId.delete(ctx.requestId);
|
|
46981
|
+
});
|
|
46453
46982
|
});
|
|
46983
|
+
return result;
|
|
46454
46984
|
}
|
|
46455
46985
|
async handleMessage(message2) {
|
|
46456
|
-
this.resetConnectionTimeout();
|
|
46457
46986
|
if (message2.request) {
|
|
46458
|
-
const
|
|
46459
|
-
|
|
46460
|
-
for (const part of parts) {
|
|
46461
|
-
handlers = handlers[part];
|
|
46462
|
-
if (!handlers) {
|
|
46463
|
-
return this.respondError(message2.request.id, {
|
|
46464
|
-
code: 2,
|
|
46465
|
-
message: `unknown method ${message2.request.method}`
|
|
46466
|
-
});
|
|
46467
|
-
}
|
|
46468
|
-
}
|
|
46469
|
-
if (!Array.isArray(handlers)) {
|
|
46470
|
-
return this.respondError(message2.request.id, {
|
|
46471
|
-
code: 2,
|
|
46472
|
-
message: "unknown method"
|
|
46473
|
-
});
|
|
46474
|
-
}
|
|
46475
|
-
handlers = [...this.globalMiddlewares, ...handlers];
|
|
46476
|
-
if (message2.request.setAuthorization) {
|
|
46477
|
-
this.peerAuthorization = message2.request.setAuthorization;
|
|
46478
|
-
}
|
|
46479
|
-
const reqCtx = {
|
|
46480
|
-
peerAuthorization: this.peerAuthorization,
|
|
46481
|
-
method: message2.request.method,
|
|
46482
|
-
requestId: message2.request.id
|
|
46483
|
-
};
|
|
46484
|
-
const client2 = createISocketClient(this);
|
|
46987
|
+
const spanName = message2.request.method;
|
|
46988
|
+
const requestId = message2.request.id;
|
|
46485
46989
|
const payload = message2.request.payload;
|
|
46486
|
-
|
|
46487
|
-
|
|
46488
|
-
|
|
46489
|
-
|
|
46490
|
-
|
|
46491
|
-
|
|
46492
|
-
|
|
46493
|
-
|
|
46494
|
-
|
|
46495
|
-
|
|
46496
|
-
|
|
46497
|
-
|
|
46498
|
-
|
|
46499
|
-
|
|
46500
|
-
|
|
46501
|
-
|
|
46502
|
-
|
|
46503
|
-
};
|
|
46504
|
-
|
|
46505
|
-
|
|
46506
|
-
|
|
46507
|
-
} catch (error) {
|
|
46508
|
-
const socketError = error instanceof SocketErrorException ? { code: error.code, message: error.message } : { code: 3, message: error.toString() };
|
|
46509
|
-
return this.respondError(message2.request.id, socketError, error);
|
|
46510
|
-
}
|
|
46511
|
-
this.respond(message2.request.id, response);
|
|
46512
|
-
alreadyResponded = true;
|
|
46513
|
-
} else if (message2.response && message2.response.id) {
|
|
46514
|
-
const responseHandler = this.responseHandler.get(message2.response.id);
|
|
46515
|
-
if (!responseHandler) {
|
|
46516
|
-
return;
|
|
46517
|
-
}
|
|
46518
|
-
if (message2.response.error) {
|
|
46519
|
-
responseHandler.reject(message2.response.error);
|
|
46520
|
-
}
|
|
46521
|
-
responseHandler.resolve(message2.response.payload);
|
|
46522
|
-
clearTimeout(responseHandler.timeout);
|
|
46523
|
-
this.responseHandler.delete(message2.response.id);
|
|
46524
|
-
} else {
|
|
46525
|
-
return this.respondError(-1, {
|
|
46526
|
-
code: 3,
|
|
46527
|
-
message: "unknown request id"
|
|
46528
|
-
});
|
|
46990
|
+
await context$2.with(propagation.extract(ROOT_CONTEXT, message2.request), async () => await this.tracer.startActiveSpan(`WS SERVER ${spanName}`, {
|
|
46991
|
+
attributes: {
|
|
46992
|
+
[SEMATTRS_MESSAGING_SYSTEM]: "ws",
|
|
46993
|
+
[SEMATTRS_MESSAGING_DESTINATION_KIND]: "websocket",
|
|
46994
|
+
[OBS_TAG_HTTP_ROUTE]: spanName,
|
|
46995
|
+
[OBS_TAG_APPLICATION_ID]: payload == null ? void 0 : payload["applicationId"],
|
|
46996
|
+
[OBS_TAG_API_ID]: payload == null ? void 0 : payload["apiId"],
|
|
46997
|
+
[OBS_TAG_BRANCH]: (payload == null ? void 0 : payload["branch"]) ?? (payload == null ? void 0 : payload["branchName"]),
|
|
46998
|
+
[OBS_TAG_COMMIT_ID]: payload == null ? void 0 : payload["commitId"]
|
|
46999
|
+
},
|
|
47000
|
+
kind: SpanKind.SERVER
|
|
47001
|
+
}, async (span) => {
|
|
47002
|
+
this.lastActiveSpan = span;
|
|
47003
|
+
this.activeSpanByRequestId.set(requestId, span);
|
|
47004
|
+
const result = await endSpan(() => super.handleMessage(message2), span);
|
|
47005
|
+
this.activeSpanByRequestId.delete(requestId);
|
|
47006
|
+
return result;
|
|
47007
|
+
}));
|
|
47008
|
+
} else if (message2.response) {
|
|
47009
|
+
this.addEvent("ws.received-response", { ["ws.response.id"]: message2.response.id });
|
|
47010
|
+
return await super.handleMessage(message2);
|
|
46529
47011
|
}
|
|
46530
47012
|
}
|
|
46531
|
-
async callHandler(handler, params, ctx, client2, next2) {
|
|
46532
|
-
return handler(params, ctx, client2, next2);
|
|
46533
|
-
}
|
|
46534
47013
|
request(method4, params, authorization) {
|
|
46535
|
-
|
|
46536
|
-
|
|
46537
|
-
|
|
46538
|
-
|
|
46539
|
-
|
|
46540
|
-
|
|
46541
|
-
const toSend = { request: { method: method4, payload: params, id: requestId, setAuthorization: authorization } };
|
|
46542
|
-
propagation.inject(context$2.active(), toSend.request);
|
|
46543
|
-
this.ws.send(JSON.stringify(toSend));
|
|
46544
|
-
this.resetConnectionTimeout();
|
|
46545
|
-
this.resetNoResponseTimeout(requestId);
|
|
46546
|
-
});
|
|
47014
|
+
this.addEvent("ws.send-request", { ["ws.request.method"]: method4, ["ws.request.id"]: this.nxtRequestId });
|
|
47015
|
+
return super.request(method4, params, authorization);
|
|
47016
|
+
}
|
|
47017
|
+
decorateToSend(message2) {
|
|
47018
|
+
propagation.inject(context$2.active(), message2.request);
|
|
47019
|
+
return message2;
|
|
46547
47020
|
}
|
|
46548
47021
|
respond(requestId, result) {
|
|
46549
|
-
|
|
46550
|
-
|
|
46551
|
-
payload: result,
|
|
46552
|
-
id: requestId,
|
|
46553
|
-
error: null
|
|
46554
|
-
}
|
|
46555
|
-
};
|
|
46556
|
-
return this.ws.send(JSON.stringify(toSend));
|
|
47022
|
+
this.addEvent("ws.send-response", { ["ws.response.id"]: requestId });
|
|
47023
|
+
return super.respond(requestId, result);
|
|
46557
47024
|
}
|
|
46558
47025
|
respondError(requestId, error, exception) {
|
|
46559
|
-
|
|
46560
|
-
|
|
46561
|
-
|
|
46562
|
-
|
|
46563
|
-
error
|
|
46564
|
-
}
|
|
46565
|
-
};
|
|
46566
|
-
return this.ws.send(JSON.stringify(toSend));
|
|
46567
|
-
}
|
|
46568
|
-
resetConnectionTimeout() {
|
|
46569
|
-
var _a2, _b2;
|
|
46570
|
-
if (!((_a2 = this.timeouts) == null ? void 0 : _a2.connectionTimeoutInSeconds)) {
|
|
46571
|
-
return;
|
|
46572
|
-
}
|
|
46573
|
-
if (this.connectionTimeout) {
|
|
46574
|
-
clearTimeout(this.connectionTimeout);
|
|
47026
|
+
this.addEvent("ws.send-error", { ["ws.response.id"]: requestId });
|
|
47027
|
+
if (this.lastActiveSpan) {
|
|
47028
|
+
setHttpStatusFromError(this.lastActiveSpan, exception ?? new Error(error.message));
|
|
47029
|
+
this.lastActiveSpan.setAttribute(OBS_SOCKET_STATUS_CODE, error.code);
|
|
46575
47030
|
}
|
|
46576
|
-
|
|
46577
|
-
}
|
|
46578
|
-
handleConnectionTimeout() {
|
|
46579
|
-
return () => {
|
|
46580
|
-
var _a2;
|
|
46581
|
-
this.logger.error(`Connection timed out after ${(_a2 = this.timeouts) == null ? void 0 : _a2.connectionTimeoutInSeconds} seconds`);
|
|
46582
|
-
this.close();
|
|
46583
|
-
};
|
|
47031
|
+
return super.respondError(requestId, error, exception);
|
|
46584
47032
|
}
|
|
46585
|
-
|
|
46586
|
-
|
|
46587
|
-
|
|
46588
|
-
return;
|
|
46589
|
-
}
|
|
46590
|
-
const responseHandler = this.responseHandler.get(requestId);
|
|
46591
|
-
if (!responseHandler) {
|
|
46592
|
-
return;
|
|
47033
|
+
addEvent(eventName, attributes2) {
|
|
47034
|
+
if (this.lastActiveSpan) {
|
|
47035
|
+
this.lastActiveSpan.addEvent(eventName, attributes2, /* @__PURE__ */ new Date());
|
|
46593
47036
|
}
|
|
46594
|
-
const noResponseTimeout = responseHandler.timeout;
|
|
46595
|
-
const reject = responseHandler.reject;
|
|
46596
|
-
if (responseHandler.timeout) {
|
|
46597
|
-
clearTimeout(noResponseTimeout);
|
|
46598
|
-
}
|
|
46599
|
-
responseHandler.timeout = setTimeout(this.handleNoResponseTimeout(reject), ((_b2 = this.timeouts) == null ? void 0 : _b2.noResponseTimeoutInSeconds) * 1e3);
|
|
46600
|
-
}
|
|
46601
|
-
handleNoResponseTimeout(reject) {
|
|
46602
|
-
return () => {
|
|
46603
|
-
var _a2;
|
|
46604
|
-
const message2 = `Request timed out after ${(_a2 = this.timeouts) == null ? void 0 : _a2.noResponseTimeoutInSeconds} seconds`;
|
|
46605
|
-
this.logger.error(message2);
|
|
46606
|
-
reject({ code: 7, message: message2 });
|
|
46607
|
-
};
|
|
46608
47037
|
}
|
|
46609
47038
|
close() {
|
|
46610
|
-
|
|
46611
|
-
|
|
46612
|
-
clearTimeout(handler.timeout);
|
|
46613
|
-
this.logger.error(`Rejecting pending requestId ${key2} due to connection close`);
|
|
46614
|
-
handler.reject({ code: 8, message: "Connection closed" });
|
|
46615
|
-
});
|
|
46616
|
-
this.ws.close();
|
|
46617
|
-
}
|
|
46618
|
-
}
|
|
46619
|
-
const proxyTarget = Object.freeze(() => {
|
|
46620
|
-
});
|
|
46621
|
-
function createIsocketProxy(socket, path2) {
|
|
46622
|
-
return new Proxy(proxyTarget, {
|
|
46623
|
-
get(_target, prop) {
|
|
46624
|
-
const childPath = path2 ? `${path2}.${prop}` : prop;
|
|
46625
|
-
if (childPath === "then") {
|
|
46626
|
-
return void 0;
|
|
46627
|
-
}
|
|
46628
|
-
return createIsocketProxy(socket, childPath);
|
|
46629
|
-
},
|
|
46630
|
-
apply(_target, _thisArg, args) {
|
|
46631
|
-
if (path2 === void 0) {
|
|
46632
|
-
throw new Error("The root object is not callable");
|
|
46633
|
-
}
|
|
46634
|
-
if (path2.endsWith(".apply") && args.length === 2 && Array.isArray(args[1])) {
|
|
46635
|
-
path2 = path2.slice(0, -".apply".length);
|
|
46636
|
-
args = args[1];
|
|
46637
|
-
}
|
|
46638
|
-
return socket.request(path2, args[0]);
|
|
47039
|
+
for (const span of this.activeSpanByRequestId.values()) {
|
|
47040
|
+
span.end();
|
|
46639
47041
|
}
|
|
46640
|
-
|
|
46641
|
-
|
|
46642
|
-
|
|
46643
|
-
|
|
46644
|
-
close: () => socket.close(),
|
|
46645
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46646
|
-
call: createIsocketProxy(socket, void 0)
|
|
46647
|
-
};
|
|
47042
|
+
this.activeSpanByRequestId = /* @__PURE__ */ new Map();
|
|
47043
|
+
this.lastActiveSpan = void 0;
|
|
47044
|
+
super.close();
|
|
47045
|
+
}
|
|
46648
47046
|
}
|
|
46649
47047
|
var ws$1 = null;
|
|
46650
47048
|
if (typeof WebSocket !== "undefined") {
|
|
@@ -46669,9 +47067,9 @@ function connectWebSocket(wsUrl, protocol) {
|
|
|
46669
47067
|
});
|
|
46670
47068
|
});
|
|
46671
47069
|
}
|
|
46672
|
-
class ISocketWithClientAuth extends
|
|
46673
|
-
constructor(ws2, authorization, requestHandlers, globalMiddlewares, timeouts) {
|
|
46674
|
-
super(ws2, requestHandlers, globalMiddlewares, timeouts);
|
|
47070
|
+
class ISocketWithClientAuth extends TracedSocket {
|
|
47071
|
+
constructor(ws2, authorization, requestHandlers, globalMiddlewares, tracer, timeouts) {
|
|
47072
|
+
super(ws2, requestHandlers, globalMiddlewares, tracer, timeouts);
|
|
46675
47073
|
this.hasSentAuth = false;
|
|
46676
47074
|
this.authorization = authorization;
|
|
46677
47075
|
}
|
|
@@ -53585,7 +53983,7 @@ var Reaction = /* @__PURE__ */ function() {
|
|
|
53585
53983
|
_proto.toString = function toString22() {
|
|
53586
53984
|
return "Reaction[" + this.name_ + "]";
|
|
53587
53985
|
};
|
|
53588
|
-
_proto.trace = function trace$
|
|
53986
|
+
_proto.trace = function trace$12(enterBreakPoint) {
|
|
53589
53987
|
if (enterBreakPoint === void 0) {
|
|
53590
53988
|
enterBreakPoint = false;
|
|
53591
53989
|
}
|
|
@@ -97693,6 +98091,7 @@ async function connectSocket(serverUrl, peerId, userId) {
|
|
|
97693
98091
|
]
|
|
97694
98092
|
},
|
|
97695
98093
|
[],
|
|
98094
|
+
trace$1.getTracer("superblocks-ui-framework"),
|
|
97696
98095
|
{
|
|
97697
98096
|
connectionTimeoutInSeconds: 6 * 60,
|
|
97698
98097
|
noResponseTimeoutInSeconds: 5 * 60
|
|
@@ -144032,14 +144431,14 @@ function getLoaderFn(options) {
|
|
|
144032
144431
|
if (!(loader === "all")) return [3, 3];
|
|
144033
144432
|
return [4, import(
|
|
144034
144433
|
/* webpackChunkName: "blueprint-icons-all-paths-loader" */
|
|
144035
|
-
"./allPathsLoader-
|
|
144434
|
+
"./allPathsLoader-BTLo3hEI.js"
|
|
144036
144435
|
)];
|
|
144037
144436
|
case 2:
|
|
144038
144437
|
return [2, _b2.sent().allPathsLoader];
|
|
144039
144438
|
case 3:
|
|
144040
144439
|
return [4, import(
|
|
144041
144440
|
/* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
|
|
144042
|
-
"./splitPathsBySizeLoader-
|
|
144441
|
+
"./splitPathsBySizeLoader-BaVxbR-T.js"
|
|
144043
144442
|
)];
|
|
144044
144443
|
case 4:
|
|
144045
144444
|
return [2, _b2.sent().splitPathsBySizeLoader];
|
|
@@ -190561,4 +190960,4 @@ export {
|
|
|
190561
190960
|
copyToClipboard as y,
|
|
190562
190961
|
navigateTo as z
|
|
190563
190962
|
};
|
|
190564
|
-
//# sourceMappingURL=index
|
|
190963
|
+
//# sourceMappingURL=index-DAxw-Mz5.js.map
|