@granular-software/sdk 0.4.42 → 0.4.44
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/agent-evals.js +280 -207
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +280 -207
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/cli/index.js +158 -154
- package/dist/index.js +280 -207
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +280 -207
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/agent-evals.mjs
CHANGED
|
@@ -162,9 +162,9 @@ var require_node_gyp_build = __commonJS({
|
|
|
162
162
|
}
|
|
163
163
|
function parseTags(file) {
|
|
164
164
|
var arr = file.split(".");
|
|
165
|
-
var
|
|
165
|
+
var extension2 = arr.pop();
|
|
166
166
|
var tags = { file, specificity: 0 };
|
|
167
|
-
if (
|
|
167
|
+
if (extension2 !== "node") return;
|
|
168
168
|
for (var i = 0; i < arr.length; i++) {
|
|
169
169
|
var tag = arr[i];
|
|
170
170
|
if (tag === "node" || tag === "electron" || tag === "node-webkit") {
|
|
@@ -412,7 +412,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
412
412
|
var kBuffers = Symbol("buffers");
|
|
413
413
|
var kError = Symbol("error");
|
|
414
414
|
var zlibLimiter;
|
|
415
|
-
var
|
|
415
|
+
var PerMessageDeflate2 = class {
|
|
416
416
|
/**
|
|
417
417
|
* Creates a PerMessageDeflate instance.
|
|
418
418
|
*
|
|
@@ -423,6 +423,9 @@ var require_permessage_deflate = __commonJS({
|
|
|
423
423
|
* acknowledge disabling of client context takeover
|
|
424
424
|
* @param {Number} [options.concurrencyLimit=10] The number of concurrent
|
|
425
425
|
* calls to zlib
|
|
426
|
+
* @param {Boolean} [options.isServer=false] Create the instance in either
|
|
427
|
+
* server or client mode
|
|
428
|
+
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
426
429
|
* @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
|
|
427
430
|
* use of a custom server window size
|
|
428
431
|
* @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
|
|
@@ -433,15 +436,12 @@ var require_permessage_deflate = __commonJS({
|
|
|
433
436
|
* deflate
|
|
434
437
|
* @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
|
|
435
438
|
* inflate
|
|
436
|
-
* @param {Boolean} [isServer=false] Create the instance in either server or
|
|
437
|
-
* client mode
|
|
438
|
-
* @param {Number} [maxPayload=0] The maximum allowed message length
|
|
439
439
|
*/
|
|
440
|
-
constructor(options
|
|
441
|
-
this._maxPayload = maxPayload | 0;
|
|
440
|
+
constructor(options) {
|
|
442
441
|
this._options = options || {};
|
|
443
442
|
this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024;
|
|
444
|
-
this.
|
|
443
|
+
this._maxPayload = this._options.maxPayload | 0;
|
|
444
|
+
this._isServer = !!this._options.isServer;
|
|
445
445
|
this._deflate = null;
|
|
446
446
|
this._inflate = null;
|
|
447
447
|
this.params = null;
|
|
@@ -750,7 +750,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
750
750
|
});
|
|
751
751
|
}
|
|
752
752
|
};
|
|
753
|
-
module.exports =
|
|
753
|
+
module.exports = PerMessageDeflate2;
|
|
754
754
|
function deflateOnData(chunk) {
|
|
755
755
|
this[kBuffers].push(chunk);
|
|
756
756
|
this[kTotalLength] += chunk.length;
|
|
@@ -1030,7 +1030,7 @@ var require_validation = __commonJS({
|
|
|
1030
1030
|
var require_receiver = __commonJS({
|
|
1031
1031
|
"../../node_modules/ws/lib/receiver.js"(exports, module) {
|
|
1032
1032
|
var { Writable } = __require("stream");
|
|
1033
|
-
var
|
|
1033
|
+
var PerMessageDeflate2 = require_permessage_deflate();
|
|
1034
1034
|
var {
|
|
1035
1035
|
BINARY_TYPES,
|
|
1036
1036
|
EMPTY_BUFFER,
|
|
@@ -1060,6 +1060,10 @@ var require_receiver = __commonJS({
|
|
|
1060
1060
|
* extensions
|
|
1061
1061
|
* @param {Boolean} [options.isServer=false] Specifies whether to operate in
|
|
1062
1062
|
* client or server mode
|
|
1063
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
1064
|
+
* buffered data chunks
|
|
1065
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
1066
|
+
* fragments
|
|
1063
1067
|
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
1064
1068
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
1065
1069
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -1070,6 +1074,8 @@ var require_receiver = __commonJS({
|
|
|
1070
1074
|
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
1071
1075
|
this._extensions = options.extensions || {};
|
|
1072
1076
|
this._isServer = !!options.isServer;
|
|
1077
|
+
this._maxBufferedChunks = options.maxBufferedChunks | 0;
|
|
1078
|
+
this._maxFragments = options.maxFragments | 0;
|
|
1073
1079
|
this._maxPayload = options.maxPayload | 0;
|
|
1074
1080
|
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
1075
1081
|
this[kWebSocket] = void 0;
|
|
@@ -1099,6 +1105,18 @@ var require_receiver = __commonJS({
|
|
|
1099
1105
|
*/
|
|
1100
1106
|
_write(chunk, encoding, cb) {
|
|
1101
1107
|
if (this._opcode === 8 && this._state == GET_INFO) return cb();
|
|
1108
|
+
if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
|
|
1109
|
+
cb(
|
|
1110
|
+
this.createError(
|
|
1111
|
+
RangeError,
|
|
1112
|
+
"Too many buffered chunks",
|
|
1113
|
+
false,
|
|
1114
|
+
1008,
|
|
1115
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
1116
|
+
)
|
|
1117
|
+
);
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1102
1120
|
this._bufferedBytes += chunk.length;
|
|
1103
1121
|
this._buffers.push(chunk);
|
|
1104
1122
|
this.startLoop(cb);
|
|
@@ -1197,7 +1215,7 @@ var require_receiver = __commonJS({
|
|
|
1197
1215
|
return;
|
|
1198
1216
|
}
|
|
1199
1217
|
const compressed = (buf[0] & 64) === 64;
|
|
1200
|
-
if (compressed && !this._extensions[
|
|
1218
|
+
if (compressed && !this._extensions[PerMessageDeflate2.extensionName]) {
|
|
1201
1219
|
const error = this.createError(
|
|
1202
1220
|
RangeError,
|
|
1203
1221
|
"RSV1 must be clear",
|
|
@@ -1428,6 +1446,17 @@ var require_receiver = __commonJS({
|
|
|
1428
1446
|
return;
|
|
1429
1447
|
}
|
|
1430
1448
|
if (data.length) {
|
|
1449
|
+
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
1450
|
+
const error = this.createError(
|
|
1451
|
+
RangeError,
|
|
1452
|
+
"Too many message fragments",
|
|
1453
|
+
false,
|
|
1454
|
+
1008,
|
|
1455
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
1456
|
+
);
|
|
1457
|
+
cb(error);
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1431
1460
|
this._messageLength = this._totalPayloadLength;
|
|
1432
1461
|
this._fragments.push(data);
|
|
1433
1462
|
}
|
|
@@ -1441,7 +1470,7 @@ var require_receiver = __commonJS({
|
|
|
1441
1470
|
* @private
|
|
1442
1471
|
*/
|
|
1443
1472
|
decompress(data, cb) {
|
|
1444
|
-
const perMessageDeflate = this._extensions[
|
|
1473
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
1445
1474
|
perMessageDeflate.decompress(data, this._fin, (err, buf) => {
|
|
1446
1475
|
if (err) return cb(err);
|
|
1447
1476
|
if (buf.length) {
|
|
@@ -1457,6 +1486,17 @@ var require_receiver = __commonJS({
|
|
|
1457
1486
|
cb(error);
|
|
1458
1487
|
return;
|
|
1459
1488
|
}
|
|
1489
|
+
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
1490
|
+
const error = this.createError(
|
|
1491
|
+
RangeError,
|
|
1492
|
+
"Too many message fragments",
|
|
1493
|
+
false,
|
|
1494
|
+
1008,
|
|
1495
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
1496
|
+
);
|
|
1497
|
+
cb(error);
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1460
1500
|
this._fragments.push(buf);
|
|
1461
1501
|
}
|
|
1462
1502
|
this.dataMessage(cb);
|
|
@@ -1622,7 +1662,10 @@ var require_sender = __commonJS({
|
|
|
1622
1662
|
"../../node_modules/ws/lib/sender.js"(exports, module) {
|
|
1623
1663
|
var { Duplex } = __require("stream");
|
|
1624
1664
|
var { randomFillSync } = __require("crypto");
|
|
1625
|
-
var
|
|
1665
|
+
var {
|
|
1666
|
+
types: { isUint8Array }
|
|
1667
|
+
} = __require("util");
|
|
1668
|
+
var PerMessageDeflate2 = require_permessage_deflate();
|
|
1626
1669
|
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
|
|
1627
1670
|
var { isBlob, isValidStatusCode } = require_validation();
|
|
1628
1671
|
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
@@ -1775,8 +1818,10 @@ var require_sender = __commonJS({
|
|
|
1775
1818
|
buf.writeUInt16BE(code, 0);
|
|
1776
1819
|
if (typeof data === "string") {
|
|
1777
1820
|
buf.write(data, 2);
|
|
1778
|
-
} else {
|
|
1821
|
+
} else if (isUint8Array(data)) {
|
|
1779
1822
|
buf.set(data, 2);
|
|
1823
|
+
} else {
|
|
1824
|
+
throw new TypeError("Second argument must be a string or a Uint8Array");
|
|
1780
1825
|
}
|
|
1781
1826
|
}
|
|
1782
1827
|
const options = {
|
|
@@ -1906,7 +1951,7 @@ var require_sender = __commonJS({
|
|
|
1906
1951
|
* @public
|
|
1907
1952
|
*/
|
|
1908
1953
|
send(data, options, cb) {
|
|
1909
|
-
const perMessageDeflate = this._extensions[
|
|
1954
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
1910
1955
|
let opcode = options.binary ? 2 : 1;
|
|
1911
1956
|
let rsv1 = options.compress;
|
|
1912
1957
|
let byteLength;
|
|
@@ -2030,7 +2075,7 @@ var require_sender = __commonJS({
|
|
|
2030
2075
|
this.sendFrame(_Sender.frame(data, options), cb);
|
|
2031
2076
|
return;
|
|
2032
2077
|
}
|
|
2033
|
-
const perMessageDeflate = this._extensions[
|
|
2078
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
2034
2079
|
this._bufferedBytes += options[kByteLength];
|
|
2035
2080
|
this._state = DEFLATING;
|
|
2036
2081
|
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
@@ -2466,11 +2511,11 @@ var require_extension = __commonJS({
|
|
|
2466
2511
|
return offers;
|
|
2467
2512
|
}
|
|
2468
2513
|
function format(extensions) {
|
|
2469
|
-
return Object.keys(extensions).map((
|
|
2470
|
-
let configurations = extensions[
|
|
2514
|
+
return Object.keys(extensions).map((extension2) => {
|
|
2515
|
+
let configurations = extensions[extension2];
|
|
2471
2516
|
if (!Array.isArray(configurations)) configurations = [configurations];
|
|
2472
2517
|
return configurations.map((params) => {
|
|
2473
|
-
return [
|
|
2518
|
+
return [extension2].concat(
|
|
2474
2519
|
Object.keys(params).map((k) => {
|
|
2475
2520
|
let values = params[k];
|
|
2476
2521
|
if (!Array.isArray(values)) values = [values];
|
|
@@ -2495,7 +2540,7 @@ var require_websocket = __commonJS({
|
|
|
2495
2540
|
var { randomBytes, createHash } = __require("crypto");
|
|
2496
2541
|
var { Duplex, Readable } = __require("stream");
|
|
2497
2542
|
var { URL: URL2 } = __require("url");
|
|
2498
|
-
var
|
|
2543
|
+
var PerMessageDeflate2 = require_permessage_deflate();
|
|
2499
2544
|
var Receiver2 = require_receiver();
|
|
2500
2545
|
var Sender2 = require_sender();
|
|
2501
2546
|
var { isBlob } = require_validation();
|
|
@@ -2654,6 +2699,10 @@ var require_websocket = __commonJS({
|
|
|
2654
2699
|
* multiple times in the same tick
|
|
2655
2700
|
* @param {Function} [options.generateMask] The function used to generate the
|
|
2656
2701
|
* masking key
|
|
2702
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
2703
|
+
* buffered data chunks
|
|
2704
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
2705
|
+
* fragments
|
|
2657
2706
|
* @param {Number} [options.maxPayload=0] The maximum allowed message size
|
|
2658
2707
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
2659
2708
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -2665,6 +2714,8 @@ var require_websocket = __commonJS({
|
|
|
2665
2714
|
binaryType: this.binaryType,
|
|
2666
2715
|
extensions: this._extensions,
|
|
2667
2716
|
isServer: this._isServer,
|
|
2717
|
+
maxBufferedChunks: options.maxBufferedChunks,
|
|
2718
|
+
maxFragments: options.maxFragments,
|
|
2668
2719
|
maxPayload: options.maxPayload,
|
|
2669
2720
|
skipUTF8Validation: options.skipUTF8Validation
|
|
2670
2721
|
});
|
|
@@ -2703,8 +2754,8 @@ var require_websocket = __commonJS({
|
|
|
2703
2754
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
2704
2755
|
return;
|
|
2705
2756
|
}
|
|
2706
|
-
if (this._extensions[
|
|
2707
|
-
this._extensions[
|
|
2757
|
+
if (this._extensions[PerMessageDeflate2.extensionName]) {
|
|
2758
|
+
this._extensions[PerMessageDeflate2.extensionName].cleanup();
|
|
2708
2759
|
}
|
|
2709
2760
|
this._receiver.removeAllListeners();
|
|
2710
2761
|
this._readyState = _WebSocket.CLOSED;
|
|
@@ -2866,7 +2917,7 @@ var require_websocket = __commonJS({
|
|
|
2866
2917
|
fin: true,
|
|
2867
2918
|
...options
|
|
2868
2919
|
};
|
|
2869
|
-
if (!this._extensions[
|
|
2920
|
+
if (!this._extensions[PerMessageDeflate2.extensionName]) {
|
|
2870
2921
|
opts.compress = false;
|
|
2871
2922
|
}
|
|
2872
2923
|
this._sender.send(data || EMPTY_BUFFER, opts, cb);
|
|
@@ -2964,6 +3015,8 @@ var require_websocket = __commonJS({
|
|
|
2964
3015
|
autoPong: true,
|
|
2965
3016
|
closeTimeout: CLOSE_TIMEOUT,
|
|
2966
3017
|
protocolVersion: protocolVersions[1],
|
|
3018
|
+
maxBufferedChunks: 1024 * 1024,
|
|
3019
|
+
maxFragments: 128 * 1024,
|
|
2967
3020
|
maxPayload: 100 * 1024 * 1024,
|
|
2968
3021
|
skipUTF8Validation: false,
|
|
2969
3022
|
perMessageDeflate: true,
|
|
@@ -2992,7 +3045,7 @@ var require_websocket = __commonJS({
|
|
|
2992
3045
|
} else {
|
|
2993
3046
|
try {
|
|
2994
3047
|
parsedUrl = new URL2(address);
|
|
2995
|
-
} catch
|
|
3048
|
+
} catch {
|
|
2996
3049
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
2997
3050
|
}
|
|
2998
3051
|
}
|
|
@@ -3040,13 +3093,13 @@ var require_websocket = __commonJS({
|
|
|
3040
3093
|
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
3041
3094
|
opts.timeout = opts.handshakeTimeout;
|
|
3042
3095
|
if (opts.perMessageDeflate) {
|
|
3043
|
-
perMessageDeflate = new
|
|
3044
|
-
opts.perMessageDeflate
|
|
3045
|
-
false,
|
|
3046
|
-
opts.maxPayload
|
|
3047
|
-
);
|
|
3096
|
+
perMessageDeflate = new PerMessageDeflate2({
|
|
3097
|
+
...opts.perMessageDeflate,
|
|
3098
|
+
isServer: false,
|
|
3099
|
+
maxPayload: opts.maxPayload
|
|
3100
|
+
});
|
|
3048
3101
|
opts.headers["Sec-WebSocket-Extensions"] = format({
|
|
3049
|
-
[
|
|
3102
|
+
[PerMessageDeflate2.extensionName]: perMessageDeflate.offer()
|
|
3050
3103
|
});
|
|
3051
3104
|
}
|
|
3052
3105
|
if (protocols.length) {
|
|
@@ -3189,23 +3242,25 @@ var require_websocket = __commonJS({
|
|
|
3189
3242
|
return;
|
|
3190
3243
|
}
|
|
3191
3244
|
const extensionNames = Object.keys(extensions);
|
|
3192
|
-
if (extensionNames.length !== 1 || extensionNames[0] !==
|
|
3245
|
+
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate2.extensionName) {
|
|
3193
3246
|
const message = "Server indicated an extension that was not requested";
|
|
3194
3247
|
abortHandshake(websocket, socket, message);
|
|
3195
3248
|
return;
|
|
3196
3249
|
}
|
|
3197
3250
|
try {
|
|
3198
|
-
perMessageDeflate.accept(extensions[
|
|
3251
|
+
perMessageDeflate.accept(extensions[PerMessageDeflate2.extensionName]);
|
|
3199
3252
|
} catch (err) {
|
|
3200
3253
|
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
3201
3254
|
abortHandshake(websocket, socket, message);
|
|
3202
3255
|
return;
|
|
3203
3256
|
}
|
|
3204
|
-
websocket._extensions[
|
|
3257
|
+
websocket._extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
3205
3258
|
}
|
|
3206
3259
|
websocket.setSocket(socket, head, {
|
|
3207
3260
|
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
3208
3261
|
generateMask: opts.generateMask,
|
|
3262
|
+
maxBufferedChunks: opts.maxBufferedChunks,
|
|
3263
|
+
maxFragments: opts.maxFragments,
|
|
3209
3264
|
maxPayload: opts.maxPayload,
|
|
3210
3265
|
skipUTF8Validation: opts.skipUTF8Validation
|
|
3211
3266
|
});
|
|
@@ -3517,9 +3572,9 @@ var require_websocket_server = __commonJS({
|
|
|
3517
3572
|
var http = __require("http");
|
|
3518
3573
|
var { Duplex } = __require("stream");
|
|
3519
3574
|
var { createHash } = __require("crypto");
|
|
3520
|
-
var
|
|
3521
|
-
var
|
|
3522
|
-
var
|
|
3575
|
+
var extension2 = require_extension();
|
|
3576
|
+
var PerMessageDeflate2 = require_permessage_deflate();
|
|
3577
|
+
var subprotocol2 = require_subprotocol();
|
|
3523
3578
|
var WebSocket2 = require_websocket();
|
|
3524
3579
|
var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants();
|
|
3525
3580
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
@@ -3545,6 +3600,10 @@ var require_websocket_server = __commonJS({
|
|
|
3545
3600
|
* called
|
|
3546
3601
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
3547
3602
|
* @param {String} [options.host] The hostname where to bind the server
|
|
3603
|
+
* @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
|
|
3604
|
+
* buffered data chunks
|
|
3605
|
+
* @param {Number} [options.maxFragments=131072] The maximum number of message
|
|
3606
|
+
* fragments
|
|
3548
3607
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
3549
3608
|
* size
|
|
3550
3609
|
* @param {Boolean} [options.noServer=false] Enable no server mode
|
|
@@ -3566,6 +3625,8 @@ var require_websocket_server = __commonJS({
|
|
|
3566
3625
|
options = {
|
|
3567
3626
|
allowSynchronousEvents: true,
|
|
3568
3627
|
autoPong: true,
|
|
3628
|
+
maxBufferedChunks: 1024 * 1024,
|
|
3629
|
+
maxFragments: 128 * 1024,
|
|
3569
3630
|
maxPayload: 100 * 1024 * 1024,
|
|
3570
3631
|
skipUTF8Validation: false,
|
|
3571
3632
|
perMessageDeflate: false,
|
|
@@ -3742,7 +3803,7 @@ var require_websocket_server = __commonJS({
|
|
|
3742
3803
|
let protocols = /* @__PURE__ */ new Set();
|
|
3743
3804
|
if (secWebSocketProtocol !== void 0) {
|
|
3744
3805
|
try {
|
|
3745
|
-
protocols =
|
|
3806
|
+
protocols = subprotocol2.parse(secWebSocketProtocol);
|
|
3746
3807
|
} catch (err) {
|
|
3747
3808
|
const message = "Invalid Sec-WebSocket-Protocol header";
|
|
3748
3809
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
@@ -3752,16 +3813,16 @@ var require_websocket_server = __commonJS({
|
|
|
3752
3813
|
const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
|
|
3753
3814
|
const extensions = {};
|
|
3754
3815
|
if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
|
|
3755
|
-
const perMessageDeflate = new
|
|
3756
|
-
this.options.perMessageDeflate,
|
|
3757
|
-
true,
|
|
3758
|
-
this.options.maxPayload
|
|
3759
|
-
);
|
|
3816
|
+
const perMessageDeflate = new PerMessageDeflate2({
|
|
3817
|
+
...this.options.perMessageDeflate,
|
|
3818
|
+
isServer: true,
|
|
3819
|
+
maxPayload: this.options.maxPayload
|
|
3820
|
+
});
|
|
3760
3821
|
try {
|
|
3761
|
-
const offers =
|
|
3762
|
-
if (offers[
|
|
3763
|
-
perMessageDeflate.accept(offers[
|
|
3764
|
-
extensions[
|
|
3822
|
+
const offers = extension2.parse(secWebSocketExtensions);
|
|
3823
|
+
if (offers[PerMessageDeflate2.extensionName]) {
|
|
3824
|
+
perMessageDeflate.accept(offers[PerMessageDeflate2.extensionName]);
|
|
3825
|
+
extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
3765
3826
|
}
|
|
3766
3827
|
} catch (err) {
|
|
3767
3828
|
const message = "Invalid or unacceptable Sec-WebSocket-Extensions header";
|
|
@@ -3832,10 +3893,10 @@ var require_websocket_server = __commonJS({
|
|
|
3832
3893
|
ws._protocol = protocol;
|
|
3833
3894
|
}
|
|
3834
3895
|
}
|
|
3835
|
-
if (extensions[
|
|
3836
|
-
const params = extensions[
|
|
3837
|
-
const value =
|
|
3838
|
-
[
|
|
3896
|
+
if (extensions[PerMessageDeflate2.extensionName]) {
|
|
3897
|
+
const params = extensions[PerMessageDeflate2.extensionName].params;
|
|
3898
|
+
const value = extension2.format({
|
|
3899
|
+
[PerMessageDeflate2.extensionName]: [params]
|
|
3839
3900
|
});
|
|
3840
3901
|
headers.push(`Sec-WebSocket-Extensions: ${value}`);
|
|
3841
3902
|
ws._extensions = extensions;
|
|
@@ -3845,6 +3906,8 @@ var require_websocket_server = __commonJS({
|
|
|
3845
3906
|
socket.removeListener("error", socketOnError);
|
|
3846
3907
|
ws.setSocket(socket, head, {
|
|
3847
3908
|
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
3909
|
+
maxBufferedChunks: this.options.maxBufferedChunks,
|
|
3910
|
+
maxFragments: this.options.maxFragments,
|
|
3848
3911
|
maxPayload: this.options.maxPayload,
|
|
3849
3912
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
3850
3913
|
});
|
|
@@ -3905,19 +3968,25 @@ var require_websocket_server = __commonJS({
|
|
|
3905
3968
|
// ../../node_modules/ws/wrapper.mjs
|
|
3906
3969
|
var wrapper_exports = {};
|
|
3907
3970
|
__export(wrapper_exports, {
|
|
3971
|
+
PerMessageDeflate: () => import_permessage_deflate.default,
|
|
3908
3972
|
Receiver: () => import_receiver.default,
|
|
3909
3973
|
Sender: () => import_sender.default,
|
|
3910
3974
|
WebSocket: () => import_websocket.default,
|
|
3911
3975
|
WebSocketServer: () => import_websocket_server.default,
|
|
3912
3976
|
createWebSocketStream: () => import_stream.default,
|
|
3913
|
-
default: () => wrapper_default
|
|
3977
|
+
default: () => wrapper_default,
|
|
3978
|
+
extension: () => import_extension.default,
|
|
3979
|
+
subprotocol: () => import_subprotocol.default
|
|
3914
3980
|
});
|
|
3915
|
-
var import_stream, import_receiver, import_sender, import_websocket, import_websocket_server, wrapper_default;
|
|
3981
|
+
var import_stream, import_extension, import_permessage_deflate, import_receiver, import_sender, import_subprotocol, import_websocket, import_websocket_server, wrapper_default;
|
|
3916
3982
|
var init_wrapper = __esm({
|
|
3917
3983
|
"../../node_modules/ws/wrapper.mjs"() {
|
|
3918
3984
|
import_stream = __toESM(require_stream());
|
|
3985
|
+
import_extension = __toESM(require_extension());
|
|
3986
|
+
import_permessage_deflate = __toESM(require_permessage_deflate());
|
|
3919
3987
|
import_receiver = __toESM(require_receiver());
|
|
3920
3988
|
import_sender = __toESM(require_sender());
|
|
3989
|
+
import_subprotocol = __toESM(require_subprotocol());
|
|
3921
3990
|
import_websocket = __toESM(require_websocket());
|
|
3922
3991
|
import_websocket_server = __toESM(require_websocket_server());
|
|
3923
3992
|
wrapper_default = import_websocket.default;
|
|
@@ -11376,6 +11445,164 @@ async function invokeRegisteredEffect(effectMap, request) {
|
|
|
11376
11445
|
return resolved.handler(request.input, context);
|
|
11377
11446
|
}
|
|
11378
11447
|
|
|
11448
|
+
// src/client-normalizers.ts
|
|
11449
|
+
function createEmptyHeapSnapshot(now = Date.now()) {
|
|
11450
|
+
return {
|
|
11451
|
+
entriesByPath: {},
|
|
11452
|
+
listsByName: {},
|
|
11453
|
+
variablesByName: {},
|
|
11454
|
+
updatedAt: now
|
|
11455
|
+
};
|
|
11456
|
+
}
|
|
11457
|
+
function normalizeHeapSnapshot(raw) {
|
|
11458
|
+
if (!raw || typeof raw !== "object") {
|
|
11459
|
+
return createEmptyHeapSnapshot();
|
|
11460
|
+
}
|
|
11461
|
+
const heap = raw;
|
|
11462
|
+
return {
|
|
11463
|
+
entriesByPath: heap.entriesByPath && typeof heap.entriesByPath === "object" ? JSON.parse(JSON.stringify(heap.entriesByPath)) : {},
|
|
11464
|
+
listsByName: heap.listsByName && typeof heap.listsByName === "object" ? JSON.parse(JSON.stringify(heap.listsByName)) : {},
|
|
11465
|
+
variablesByName: heap.variablesByName && typeof heap.variablesByName === "object" ? JSON.parse(JSON.stringify(heap.variablesByName)) : {},
|
|
11466
|
+
updatedAt: typeof heap.updatedAt === "number" ? heap.updatedAt : Date.now()
|
|
11467
|
+
};
|
|
11468
|
+
}
|
|
11469
|
+
function normalizeGraphPathSegment(value) {
|
|
11470
|
+
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
11471
|
+
}
|
|
11472
|
+
function extractRecordIdFromGraphPath(path2, className) {
|
|
11473
|
+
const normalizedPrefix = `${normalizeGraphPathSegment(className)}_`;
|
|
11474
|
+
if (path2.startsWith(normalizedPrefix)) {
|
|
11475
|
+
return path2.slice(normalizedPrefix.length);
|
|
11476
|
+
}
|
|
11477
|
+
const legacyPrefix = `${className}_`;
|
|
11478
|
+
if (path2.startsWith(legacyPrefix)) {
|
|
11479
|
+
return path2.slice(legacyPrefix.length);
|
|
11480
|
+
}
|
|
11481
|
+
return path2;
|
|
11482
|
+
}
|
|
11483
|
+
function toRecordSearchResult(className, node) {
|
|
11484
|
+
const path2 = typeof node.path === "string" ? node.path : "";
|
|
11485
|
+
if (!path2) return null;
|
|
11486
|
+
const fields = Array.isArray(node.submodels) ? node.submodels.flatMap(
|
|
11487
|
+
(submodel) => {
|
|
11488
|
+
const name = typeof submodel?.label === "string" && submodel.label.trim() ? submodel.label : typeof submodel?.path === "string" ? submodel.path.split(":").pop() || submodel.path : "";
|
|
11489
|
+
if (!name) return [];
|
|
11490
|
+
if (typeof submodel.string_value === "string") {
|
|
11491
|
+
return [{ name, type: "string", value: submodel.string_value }];
|
|
11492
|
+
}
|
|
11493
|
+
if (typeof submodel.number_value === "number") {
|
|
11494
|
+
return [{ name, type: "number", value: submodel.number_value }];
|
|
11495
|
+
}
|
|
11496
|
+
if (typeof submodel.boolean_value === "boolean") {
|
|
11497
|
+
return [
|
|
11498
|
+
{
|
|
11499
|
+
name,
|
|
11500
|
+
type: "boolean",
|
|
11501
|
+
value: submodel.boolean_value
|
|
11502
|
+
}
|
|
11503
|
+
];
|
|
11504
|
+
}
|
|
11505
|
+
return [];
|
|
11506
|
+
}
|
|
11507
|
+
) : [];
|
|
11508
|
+
return {
|
|
11509
|
+
path: path2,
|
|
11510
|
+
className,
|
|
11511
|
+
id: extractRecordIdFromGraphPath(path2, className),
|
|
11512
|
+
label: typeof node.label === "string" && node.label.trim() ? node.label : extractRecordIdFromGraphPath(path2, className),
|
|
11513
|
+
description: typeof node.description === "string" && node.description.trim() ? node.description : null,
|
|
11514
|
+
fields
|
|
11515
|
+
};
|
|
11516
|
+
}
|
|
11517
|
+
function normalizeRecordSearchText(value) {
|
|
11518
|
+
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, " ").replace(/\s+/g, " ").trim();
|
|
11519
|
+
}
|
|
11520
|
+
function rankRecordSearchResult(result, query, index) {
|
|
11521
|
+
const normalizedQuery = normalizeRecordSearchText(query);
|
|
11522
|
+
if (!normalizedQuery) {
|
|
11523
|
+
return index;
|
|
11524
|
+
}
|
|
11525
|
+
const label = normalizeRecordSearchText(result.label || "");
|
|
11526
|
+
const id = normalizeRecordSearchText(result.id || "");
|
|
11527
|
+
const path2 = normalizeRecordSearchText(result.path || "");
|
|
11528
|
+
const className = normalizeRecordSearchText(result.className || "");
|
|
11529
|
+
const searchable = [label, id, path2, className].filter(Boolean);
|
|
11530
|
+
if (label === normalizedQuery) return index;
|
|
11531
|
+
if (id === normalizedQuery || path2 === normalizedQuery) return 100 + index;
|
|
11532
|
+
if (label.startsWith(normalizedQuery)) return 200 + index;
|
|
11533
|
+
if (searchable.some((value) => value.startsWith(normalizedQuery))) {
|
|
11534
|
+
return 300 + index;
|
|
11535
|
+
}
|
|
11536
|
+
if (label.includes(normalizedQuery)) return 400 + index;
|
|
11537
|
+
if (searchable.some((value) => value.includes(normalizedQuery))) {
|
|
11538
|
+
return 500 + index;
|
|
11539
|
+
}
|
|
11540
|
+
return 900 + index;
|
|
11541
|
+
}
|
|
11542
|
+
function deriveRuntimeBaseUrl(apiEndpoint) {
|
|
11543
|
+
try {
|
|
11544
|
+
const endpoint = new URL(apiEndpoint);
|
|
11545
|
+
const graphqlSuffix = "/orchestrator/graphql";
|
|
11546
|
+
if (endpoint.pathname.endsWith(graphqlSuffix)) {
|
|
11547
|
+
endpoint.pathname = endpoint.pathname.slice(0, -graphqlSuffix.length);
|
|
11548
|
+
} else if (endpoint.pathname.endsWith("/graphql")) {
|
|
11549
|
+
endpoint.pathname = endpoint.pathname.slice(0, -"/graphql".length);
|
|
11550
|
+
}
|
|
11551
|
+
endpoint.search = "";
|
|
11552
|
+
endpoint.hash = "";
|
|
11553
|
+
return endpoint.toString().replace(/\/$/, "");
|
|
11554
|
+
} catch {
|
|
11555
|
+
return apiEndpoint.replace(/\/orchestrator\/graphql$/, "").replace(/\/$/, "");
|
|
11556
|
+
}
|
|
11557
|
+
}
|
|
11558
|
+
|
|
11559
|
+
// src/client-transport.ts
|
|
11560
|
+
function sleep(ms) {
|
|
11561
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11562
|
+
}
|
|
11563
|
+
function withTimeout(promise, timeoutMs, label) {
|
|
11564
|
+
let timer = null;
|
|
11565
|
+
const timeout = new Promise((_, reject) => {
|
|
11566
|
+
timer = setTimeout(() => {
|
|
11567
|
+
reject(new Error(`${label} timed out after ${timeoutMs}ms`));
|
|
11568
|
+
}, timeoutMs);
|
|
11569
|
+
});
|
|
11570
|
+
return Promise.race([promise, timeout]).finally(() => {
|
|
11571
|
+
if (timer) {
|
|
11572
|
+
clearTimeout(timer);
|
|
11573
|
+
}
|
|
11574
|
+
});
|
|
11575
|
+
}
|
|
11576
|
+
function isLocalControlUrl(url) {
|
|
11577
|
+
try {
|
|
11578
|
+
const parsed = new URL(url);
|
|
11579
|
+
return parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost" || parsed.hostname === "::1";
|
|
11580
|
+
} catch {
|
|
11581
|
+
return false;
|
|
11582
|
+
}
|
|
11583
|
+
}
|
|
11584
|
+
function isRetryableLocalWorkerRestart(status, body, url) {
|
|
11585
|
+
return isLocalControlUrl(url) && (status === 503 && body.includes("Your worker restarted mid-request") || status === 500 && body.includes("Network connection lost"));
|
|
11586
|
+
}
|
|
11587
|
+
function isRetryableRecordObjectsError(error) {
|
|
11588
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
11589
|
+
return /worker restarted mid-request|econnreset|network|socket connection was closed unexpectedly|timed out|bad gateway|too many requests|gateway timeout|control plane api error \((?:429|500|502|503|504)\)|graphql api error \((?:429|500|502|503|504)\)|failed to record batch/i.test(
|
|
11590
|
+
message
|
|
11591
|
+
);
|
|
11592
|
+
}
|
|
11593
|
+
function isRetryableEffectRegistrationError(error) {
|
|
11594
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
11595
|
+
return /timed out|websocket disconnected|websocket not connected|rpc timeout|worker restarted mid-request|network connection lost|bad gateway|gateway timeout|too many requests|(?:control plane|granular|graphql) api error \((?:429|500|502|503|504)\)/i.test(
|
|
11596
|
+
message
|
|
11597
|
+
);
|
|
11598
|
+
}
|
|
11599
|
+
function isRetryableSessionDataError(error) {
|
|
11600
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
11601
|
+
return /network connection lost|worker restarted mid-request|econnreset|socket connection was closed unexpectedly|bad gateway|gateway timeout|service unavailable|session data api error \((?:429|500|502|503|504)\)/i.test(
|
|
11602
|
+
message
|
|
11603
|
+
);
|
|
11604
|
+
}
|
|
11605
|
+
|
|
11379
11606
|
// src/spend.ts
|
|
11380
11607
|
function toGranularHttpBase(apiUrl) {
|
|
11381
11608
|
const url = new URL(apiUrl);
|
|
@@ -12861,51 +13088,6 @@ function planRecordObjectsChunks(records, batchSize) {
|
|
|
12861
13088
|
}
|
|
12862
13089
|
return plans;
|
|
12863
13090
|
}
|
|
12864
|
-
function sleep(ms) {
|
|
12865
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
12866
|
-
}
|
|
12867
|
-
function withTimeout(promise, timeoutMs, label) {
|
|
12868
|
-
let timer = null;
|
|
12869
|
-
const timeout = new Promise((_, reject) => {
|
|
12870
|
-
timer = setTimeout(() => {
|
|
12871
|
-
reject(new Error(`${label} timed out after ${timeoutMs}ms`));
|
|
12872
|
-
}, timeoutMs);
|
|
12873
|
-
});
|
|
12874
|
-
return Promise.race([promise, timeout]).finally(() => {
|
|
12875
|
-
if (timer) {
|
|
12876
|
-
clearTimeout(timer);
|
|
12877
|
-
}
|
|
12878
|
-
});
|
|
12879
|
-
}
|
|
12880
|
-
function isLocalControlUrl(url) {
|
|
12881
|
-
try {
|
|
12882
|
-
const parsed = new URL(url);
|
|
12883
|
-
return parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost" || parsed.hostname === "::1";
|
|
12884
|
-
} catch {
|
|
12885
|
-
return false;
|
|
12886
|
-
}
|
|
12887
|
-
}
|
|
12888
|
-
function isRetryableLocalWorkerRestart(status, body, url) {
|
|
12889
|
-
return isLocalControlUrl(url) && (status === 503 && body.includes("Your worker restarted mid-request") || status === 500 && body.includes("Network connection lost"));
|
|
12890
|
-
}
|
|
12891
|
-
function isRetryableRecordObjectsError(error) {
|
|
12892
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
12893
|
-
return /worker restarted mid-request|econnreset|network|socket connection was closed unexpectedly|timed out|bad gateway|too many requests|gateway timeout|control plane api error \((?:429|500|502|503|504)\)|graphql api error \((?:429|500|502|503|504)\)|failed to record batch/i.test(
|
|
12894
|
-
message
|
|
12895
|
-
);
|
|
12896
|
-
}
|
|
12897
|
-
function isRetryableEffectRegistrationError(error) {
|
|
12898
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
12899
|
-
return /timed out|websocket disconnected|websocket not connected|rpc timeout|worker restarted mid-request|network connection lost|bad gateway|gateway timeout|too many requests|(?:control plane|granular|graphql) api error \((?:429|500|502|503|504)\)/i.test(
|
|
12900
|
-
message
|
|
12901
|
-
);
|
|
12902
|
-
}
|
|
12903
|
-
function isRetryableSessionDataError(error) {
|
|
12904
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
12905
|
-
return /network connection lost|worker restarted mid-request|econnreset|socket connection was closed unexpectedly|bad gateway|gateway timeout|service unavailable|session data api error \((?:429|500|502|503|504)\)/i.test(
|
|
12906
|
-
message
|
|
12907
|
-
);
|
|
12908
|
-
}
|
|
12909
13091
|
function computeEffectKey2(effect) {
|
|
12910
13092
|
const attachedClass = effect.className?.trim();
|
|
12911
13093
|
if (!attachedClass) {
|
|
@@ -12960,115 +13142,6 @@ function buildEffectHostUrl(apiUrl, sandboxId, effectClientId, clientId, effectH
|
|
|
12960
13142
|
url.searchParams.set("clientId", clientId);
|
|
12961
13143
|
return url.toString();
|
|
12962
13144
|
}
|
|
12963
|
-
function createEmptyHeapSnapshot(now = Date.now()) {
|
|
12964
|
-
return {
|
|
12965
|
-
entriesByPath: {},
|
|
12966
|
-
listsByName: {},
|
|
12967
|
-
variablesByName: {},
|
|
12968
|
-
updatedAt: now
|
|
12969
|
-
};
|
|
12970
|
-
}
|
|
12971
|
-
function normalizeHeapSnapshot(raw) {
|
|
12972
|
-
if (!raw || typeof raw !== "object") {
|
|
12973
|
-
return createEmptyHeapSnapshot();
|
|
12974
|
-
}
|
|
12975
|
-
const heap = raw;
|
|
12976
|
-
return {
|
|
12977
|
-
entriesByPath: heap.entriesByPath && typeof heap.entriesByPath === "object" ? JSON.parse(JSON.stringify(heap.entriesByPath)) : {},
|
|
12978
|
-
listsByName: heap.listsByName && typeof heap.listsByName === "object" ? JSON.parse(JSON.stringify(heap.listsByName)) : {},
|
|
12979
|
-
variablesByName: heap.variablesByName && typeof heap.variablesByName === "object" ? JSON.parse(JSON.stringify(heap.variablesByName)) : {},
|
|
12980
|
-
updatedAt: typeof heap.updatedAt === "number" ? heap.updatedAt : Date.now()
|
|
12981
|
-
};
|
|
12982
|
-
}
|
|
12983
|
-
function normalizeGraphPathSegment(value) {
|
|
12984
|
-
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
12985
|
-
}
|
|
12986
|
-
function extractRecordIdFromGraphPath(path2, className) {
|
|
12987
|
-
const normalizedPrefix = `${normalizeGraphPathSegment(className)}_`;
|
|
12988
|
-
if (path2.startsWith(normalizedPrefix)) {
|
|
12989
|
-
return path2.slice(normalizedPrefix.length);
|
|
12990
|
-
}
|
|
12991
|
-
const legacyPrefix = `${className}_`;
|
|
12992
|
-
if (path2.startsWith(legacyPrefix)) {
|
|
12993
|
-
return path2.slice(legacyPrefix.length);
|
|
12994
|
-
}
|
|
12995
|
-
return path2;
|
|
12996
|
-
}
|
|
12997
|
-
function toRecordSearchResult(className, node) {
|
|
12998
|
-
const path2 = typeof node.path === "string" ? node.path : "";
|
|
12999
|
-
if (!path2) return null;
|
|
13000
|
-
const fields = Array.isArray(node.submodels) ? node.submodels.flatMap(
|
|
13001
|
-
(submodel) => {
|
|
13002
|
-
const name = typeof submodel?.label === "string" && submodel.label.trim() ? submodel.label : typeof submodel?.path === "string" ? submodel.path.split(":").pop() || submodel.path : "";
|
|
13003
|
-
if (!name) return [];
|
|
13004
|
-
if (typeof submodel.string_value === "string") {
|
|
13005
|
-
return [{ name, type: "string", value: submodel.string_value }];
|
|
13006
|
-
}
|
|
13007
|
-
if (typeof submodel.number_value === "number") {
|
|
13008
|
-
return [{ name, type: "number", value: submodel.number_value }];
|
|
13009
|
-
}
|
|
13010
|
-
if (typeof submodel.boolean_value === "boolean") {
|
|
13011
|
-
return [
|
|
13012
|
-
{
|
|
13013
|
-
name,
|
|
13014
|
-
type: "boolean",
|
|
13015
|
-
value: submodel.boolean_value
|
|
13016
|
-
}
|
|
13017
|
-
];
|
|
13018
|
-
}
|
|
13019
|
-
return [];
|
|
13020
|
-
}
|
|
13021
|
-
) : [];
|
|
13022
|
-
return {
|
|
13023
|
-
path: path2,
|
|
13024
|
-
className,
|
|
13025
|
-
id: extractRecordIdFromGraphPath(path2, className),
|
|
13026
|
-
label: typeof node.label === "string" && node.label.trim() ? node.label : extractRecordIdFromGraphPath(path2, className),
|
|
13027
|
-
description: typeof node.description === "string" && node.description.trim() ? node.description : null,
|
|
13028
|
-
fields
|
|
13029
|
-
};
|
|
13030
|
-
}
|
|
13031
|
-
function normalizeRecordSearchText(value) {
|
|
13032
|
-
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, " ").replace(/\s+/g, " ").trim();
|
|
13033
|
-
}
|
|
13034
|
-
function rankRecordSearchResult(result, query, index) {
|
|
13035
|
-
const normalizedQuery = normalizeRecordSearchText(query);
|
|
13036
|
-
if (!normalizedQuery) {
|
|
13037
|
-
return index;
|
|
13038
|
-
}
|
|
13039
|
-
const label = normalizeRecordSearchText(result.label || "");
|
|
13040
|
-
const id = normalizeRecordSearchText(result.id || "");
|
|
13041
|
-
const path2 = normalizeRecordSearchText(result.path || "");
|
|
13042
|
-
const className = normalizeRecordSearchText(result.className || "");
|
|
13043
|
-
const searchable = [label, id, path2, className].filter(Boolean);
|
|
13044
|
-
if (label === normalizedQuery) return index;
|
|
13045
|
-
if (id === normalizedQuery || path2 === normalizedQuery) return 100 + index;
|
|
13046
|
-
if (label.startsWith(normalizedQuery)) return 200 + index;
|
|
13047
|
-
if (searchable.some((value) => value.startsWith(normalizedQuery))) {
|
|
13048
|
-
return 300 + index;
|
|
13049
|
-
}
|
|
13050
|
-
if (label.includes(normalizedQuery)) return 400 + index;
|
|
13051
|
-
if (searchable.some((value) => value.includes(normalizedQuery))) {
|
|
13052
|
-
return 500 + index;
|
|
13053
|
-
}
|
|
13054
|
-
return 900 + index;
|
|
13055
|
-
}
|
|
13056
|
-
function deriveRuntimeBaseUrl(apiEndpoint) {
|
|
13057
|
-
try {
|
|
13058
|
-
const endpoint = new URL(apiEndpoint);
|
|
13059
|
-
const graphqlSuffix = "/orchestrator/graphql";
|
|
13060
|
-
if (endpoint.pathname.endsWith(graphqlSuffix)) {
|
|
13061
|
-
endpoint.pathname = endpoint.pathname.slice(0, -graphqlSuffix.length);
|
|
13062
|
-
} else if (endpoint.pathname.endsWith("/graphql")) {
|
|
13063
|
-
endpoint.pathname = endpoint.pathname.slice(0, -"/graphql".length);
|
|
13064
|
-
}
|
|
13065
|
-
endpoint.search = "";
|
|
13066
|
-
endpoint.hash = "";
|
|
13067
|
-
return endpoint.toString().replace(/\/$/, "");
|
|
13068
|
-
} catch {
|
|
13069
|
-
return apiEndpoint.replace(/\/orchestrator\/graphql$/, "").replace(/\/$/, "");
|
|
13070
|
-
}
|
|
13071
|
-
}
|
|
13072
13145
|
function normalizeSubject(subject) {
|
|
13073
13146
|
const granularId = subject.granularId || subject.subjectId;
|
|
13074
13147
|
const userId = subject.userId || subject.identityId || granularId;
|