@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/index.js
CHANGED
|
@@ -181,9 +181,9 @@ var require_node_gyp_build = __commonJS({
|
|
|
181
181
|
}
|
|
182
182
|
function parseTags(file) {
|
|
183
183
|
var arr = file.split(".");
|
|
184
|
-
var
|
|
184
|
+
var extension2 = arr.pop();
|
|
185
185
|
var tags = { file, specificity: 0 };
|
|
186
|
-
if (
|
|
186
|
+
if (extension2 !== "node") return;
|
|
187
187
|
for (var i = 0; i < arr.length; i++) {
|
|
188
188
|
var tag = arr[i];
|
|
189
189
|
if (tag === "node" || tag === "electron" || tag === "node-webkit") {
|
|
@@ -431,7 +431,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
431
431
|
var kBuffers = Symbol("buffers");
|
|
432
432
|
var kError = Symbol("error");
|
|
433
433
|
var zlibLimiter;
|
|
434
|
-
var
|
|
434
|
+
var PerMessageDeflate2 = class {
|
|
435
435
|
/**
|
|
436
436
|
* Creates a PerMessageDeflate instance.
|
|
437
437
|
*
|
|
@@ -442,6 +442,9 @@ var require_permessage_deflate = __commonJS({
|
|
|
442
442
|
* acknowledge disabling of client context takeover
|
|
443
443
|
* @param {Number} [options.concurrencyLimit=10] The number of concurrent
|
|
444
444
|
* calls to zlib
|
|
445
|
+
* @param {Boolean} [options.isServer=false] Create the instance in either
|
|
446
|
+
* server or client mode
|
|
447
|
+
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
445
448
|
* @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
|
|
446
449
|
* use of a custom server window size
|
|
447
450
|
* @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
|
|
@@ -452,15 +455,12 @@ var require_permessage_deflate = __commonJS({
|
|
|
452
455
|
* deflate
|
|
453
456
|
* @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
|
|
454
457
|
* inflate
|
|
455
|
-
* @param {Boolean} [isServer=false] Create the instance in either server or
|
|
456
|
-
* client mode
|
|
457
|
-
* @param {Number} [maxPayload=0] The maximum allowed message length
|
|
458
458
|
*/
|
|
459
|
-
constructor(options
|
|
460
|
-
this._maxPayload = maxPayload | 0;
|
|
459
|
+
constructor(options) {
|
|
461
460
|
this._options = options || {};
|
|
462
461
|
this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024;
|
|
463
|
-
this.
|
|
462
|
+
this._maxPayload = this._options.maxPayload | 0;
|
|
463
|
+
this._isServer = !!this._options.isServer;
|
|
464
464
|
this._deflate = null;
|
|
465
465
|
this._inflate = null;
|
|
466
466
|
this.params = null;
|
|
@@ -769,7 +769,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
};
|
|
772
|
-
module.exports =
|
|
772
|
+
module.exports = PerMessageDeflate2;
|
|
773
773
|
function deflateOnData(chunk) {
|
|
774
774
|
this[kBuffers].push(chunk);
|
|
775
775
|
this[kTotalLength] += chunk.length;
|
|
@@ -1049,7 +1049,7 @@ var require_validation = __commonJS({
|
|
|
1049
1049
|
var require_receiver = __commonJS({
|
|
1050
1050
|
"../../node_modules/ws/lib/receiver.js"(exports, module) {
|
|
1051
1051
|
var { Writable } = __require("stream");
|
|
1052
|
-
var
|
|
1052
|
+
var PerMessageDeflate2 = require_permessage_deflate();
|
|
1053
1053
|
var {
|
|
1054
1054
|
BINARY_TYPES,
|
|
1055
1055
|
EMPTY_BUFFER,
|
|
@@ -1079,6 +1079,10 @@ var require_receiver = __commonJS({
|
|
|
1079
1079
|
* extensions
|
|
1080
1080
|
* @param {Boolean} [options.isServer=false] Specifies whether to operate in
|
|
1081
1081
|
* client or server mode
|
|
1082
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
1083
|
+
* buffered data chunks
|
|
1084
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
1085
|
+
* fragments
|
|
1082
1086
|
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
1083
1087
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
1084
1088
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -1089,6 +1093,8 @@ var require_receiver = __commonJS({
|
|
|
1089
1093
|
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
1090
1094
|
this._extensions = options.extensions || {};
|
|
1091
1095
|
this._isServer = !!options.isServer;
|
|
1096
|
+
this._maxBufferedChunks = options.maxBufferedChunks | 0;
|
|
1097
|
+
this._maxFragments = options.maxFragments | 0;
|
|
1092
1098
|
this._maxPayload = options.maxPayload | 0;
|
|
1093
1099
|
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
1094
1100
|
this[kWebSocket] = void 0;
|
|
@@ -1118,6 +1124,18 @@ var require_receiver = __commonJS({
|
|
|
1118
1124
|
*/
|
|
1119
1125
|
_write(chunk, encoding, cb) {
|
|
1120
1126
|
if (this._opcode === 8 && this._state == GET_INFO) return cb();
|
|
1127
|
+
if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
|
|
1128
|
+
cb(
|
|
1129
|
+
this.createError(
|
|
1130
|
+
RangeError,
|
|
1131
|
+
"Too many buffered chunks",
|
|
1132
|
+
false,
|
|
1133
|
+
1008,
|
|
1134
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
1135
|
+
)
|
|
1136
|
+
);
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1121
1139
|
this._bufferedBytes += chunk.length;
|
|
1122
1140
|
this._buffers.push(chunk);
|
|
1123
1141
|
this.startLoop(cb);
|
|
@@ -1216,7 +1234,7 @@ var require_receiver = __commonJS({
|
|
|
1216
1234
|
return;
|
|
1217
1235
|
}
|
|
1218
1236
|
const compressed = (buf[0] & 64) === 64;
|
|
1219
|
-
if (compressed && !this._extensions[
|
|
1237
|
+
if (compressed && !this._extensions[PerMessageDeflate2.extensionName]) {
|
|
1220
1238
|
const error = this.createError(
|
|
1221
1239
|
RangeError,
|
|
1222
1240
|
"RSV1 must be clear",
|
|
@@ -1447,6 +1465,17 @@ var require_receiver = __commonJS({
|
|
|
1447
1465
|
return;
|
|
1448
1466
|
}
|
|
1449
1467
|
if (data.length) {
|
|
1468
|
+
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
1469
|
+
const error = this.createError(
|
|
1470
|
+
RangeError,
|
|
1471
|
+
"Too many message fragments",
|
|
1472
|
+
false,
|
|
1473
|
+
1008,
|
|
1474
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
1475
|
+
);
|
|
1476
|
+
cb(error);
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1450
1479
|
this._messageLength = this._totalPayloadLength;
|
|
1451
1480
|
this._fragments.push(data);
|
|
1452
1481
|
}
|
|
@@ -1460,7 +1489,7 @@ var require_receiver = __commonJS({
|
|
|
1460
1489
|
* @private
|
|
1461
1490
|
*/
|
|
1462
1491
|
decompress(data, cb) {
|
|
1463
|
-
const perMessageDeflate = this._extensions[
|
|
1492
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
1464
1493
|
perMessageDeflate.decompress(data, this._fin, (err, buf) => {
|
|
1465
1494
|
if (err) return cb(err);
|
|
1466
1495
|
if (buf.length) {
|
|
@@ -1476,6 +1505,17 @@ var require_receiver = __commonJS({
|
|
|
1476
1505
|
cb(error);
|
|
1477
1506
|
return;
|
|
1478
1507
|
}
|
|
1508
|
+
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
1509
|
+
const error = this.createError(
|
|
1510
|
+
RangeError,
|
|
1511
|
+
"Too many message fragments",
|
|
1512
|
+
false,
|
|
1513
|
+
1008,
|
|
1514
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
1515
|
+
);
|
|
1516
|
+
cb(error);
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1479
1519
|
this._fragments.push(buf);
|
|
1480
1520
|
}
|
|
1481
1521
|
this.dataMessage(cb);
|
|
@@ -1641,7 +1681,10 @@ var require_sender = __commonJS({
|
|
|
1641
1681
|
"../../node_modules/ws/lib/sender.js"(exports, module) {
|
|
1642
1682
|
var { Duplex } = __require("stream");
|
|
1643
1683
|
var { randomFillSync } = __require("crypto");
|
|
1644
|
-
var
|
|
1684
|
+
var {
|
|
1685
|
+
types: { isUint8Array }
|
|
1686
|
+
} = __require("util");
|
|
1687
|
+
var PerMessageDeflate2 = require_permessage_deflate();
|
|
1645
1688
|
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
|
|
1646
1689
|
var { isBlob, isValidStatusCode } = require_validation();
|
|
1647
1690
|
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
@@ -1794,8 +1837,10 @@ var require_sender = __commonJS({
|
|
|
1794
1837
|
buf.writeUInt16BE(code, 0);
|
|
1795
1838
|
if (typeof data === "string") {
|
|
1796
1839
|
buf.write(data, 2);
|
|
1797
|
-
} else {
|
|
1840
|
+
} else if (isUint8Array(data)) {
|
|
1798
1841
|
buf.set(data, 2);
|
|
1842
|
+
} else {
|
|
1843
|
+
throw new TypeError("Second argument must be a string or a Uint8Array");
|
|
1799
1844
|
}
|
|
1800
1845
|
}
|
|
1801
1846
|
const options = {
|
|
@@ -1925,7 +1970,7 @@ var require_sender = __commonJS({
|
|
|
1925
1970
|
* @public
|
|
1926
1971
|
*/
|
|
1927
1972
|
send(data, options, cb) {
|
|
1928
|
-
const perMessageDeflate = this._extensions[
|
|
1973
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
1929
1974
|
let opcode = options.binary ? 2 : 1;
|
|
1930
1975
|
let rsv1 = options.compress;
|
|
1931
1976
|
let byteLength;
|
|
@@ -2049,7 +2094,7 @@ var require_sender = __commonJS({
|
|
|
2049
2094
|
this.sendFrame(_Sender.frame(data, options), cb);
|
|
2050
2095
|
return;
|
|
2051
2096
|
}
|
|
2052
|
-
const perMessageDeflate = this._extensions[
|
|
2097
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
2053
2098
|
this._bufferedBytes += options[kByteLength];
|
|
2054
2099
|
this._state = DEFLATING;
|
|
2055
2100
|
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
@@ -2485,11 +2530,11 @@ var require_extension = __commonJS({
|
|
|
2485
2530
|
return offers;
|
|
2486
2531
|
}
|
|
2487
2532
|
function format(extensions) {
|
|
2488
|
-
return Object.keys(extensions).map((
|
|
2489
|
-
let configurations = extensions[
|
|
2533
|
+
return Object.keys(extensions).map((extension2) => {
|
|
2534
|
+
let configurations = extensions[extension2];
|
|
2490
2535
|
if (!Array.isArray(configurations)) configurations = [configurations];
|
|
2491
2536
|
return configurations.map((params) => {
|
|
2492
|
-
return [
|
|
2537
|
+
return [extension2].concat(
|
|
2493
2538
|
Object.keys(params).map((k) => {
|
|
2494
2539
|
let values = params[k];
|
|
2495
2540
|
if (!Array.isArray(values)) values = [values];
|
|
@@ -2514,7 +2559,7 @@ var require_websocket = __commonJS({
|
|
|
2514
2559
|
var { randomBytes, createHash } = __require("crypto");
|
|
2515
2560
|
var { Duplex, Readable } = __require("stream");
|
|
2516
2561
|
var { URL: URL2 } = __require("url");
|
|
2517
|
-
var
|
|
2562
|
+
var PerMessageDeflate2 = require_permessage_deflate();
|
|
2518
2563
|
var Receiver2 = require_receiver();
|
|
2519
2564
|
var Sender2 = require_sender();
|
|
2520
2565
|
var { isBlob } = require_validation();
|
|
@@ -2673,6 +2718,10 @@ var require_websocket = __commonJS({
|
|
|
2673
2718
|
* multiple times in the same tick
|
|
2674
2719
|
* @param {Function} [options.generateMask] The function used to generate the
|
|
2675
2720
|
* masking key
|
|
2721
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
2722
|
+
* buffered data chunks
|
|
2723
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
2724
|
+
* fragments
|
|
2676
2725
|
* @param {Number} [options.maxPayload=0] The maximum allowed message size
|
|
2677
2726
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
2678
2727
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -2684,6 +2733,8 @@ var require_websocket = __commonJS({
|
|
|
2684
2733
|
binaryType: this.binaryType,
|
|
2685
2734
|
extensions: this._extensions,
|
|
2686
2735
|
isServer: this._isServer,
|
|
2736
|
+
maxBufferedChunks: options.maxBufferedChunks,
|
|
2737
|
+
maxFragments: options.maxFragments,
|
|
2687
2738
|
maxPayload: options.maxPayload,
|
|
2688
2739
|
skipUTF8Validation: options.skipUTF8Validation
|
|
2689
2740
|
});
|
|
@@ -2722,8 +2773,8 @@ var require_websocket = __commonJS({
|
|
|
2722
2773
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
2723
2774
|
return;
|
|
2724
2775
|
}
|
|
2725
|
-
if (this._extensions[
|
|
2726
|
-
this._extensions[
|
|
2776
|
+
if (this._extensions[PerMessageDeflate2.extensionName]) {
|
|
2777
|
+
this._extensions[PerMessageDeflate2.extensionName].cleanup();
|
|
2727
2778
|
}
|
|
2728
2779
|
this._receiver.removeAllListeners();
|
|
2729
2780
|
this._readyState = _WebSocket.CLOSED;
|
|
@@ -2885,7 +2936,7 @@ var require_websocket = __commonJS({
|
|
|
2885
2936
|
fin: true,
|
|
2886
2937
|
...options
|
|
2887
2938
|
};
|
|
2888
|
-
if (!this._extensions[
|
|
2939
|
+
if (!this._extensions[PerMessageDeflate2.extensionName]) {
|
|
2889
2940
|
opts.compress = false;
|
|
2890
2941
|
}
|
|
2891
2942
|
this._sender.send(data || EMPTY_BUFFER, opts, cb);
|
|
@@ -2983,6 +3034,8 @@ var require_websocket = __commonJS({
|
|
|
2983
3034
|
autoPong: true,
|
|
2984
3035
|
closeTimeout: CLOSE_TIMEOUT,
|
|
2985
3036
|
protocolVersion: protocolVersions[1],
|
|
3037
|
+
maxBufferedChunks: 1024 * 1024,
|
|
3038
|
+
maxFragments: 128 * 1024,
|
|
2986
3039
|
maxPayload: 100 * 1024 * 1024,
|
|
2987
3040
|
skipUTF8Validation: false,
|
|
2988
3041
|
perMessageDeflate: true,
|
|
@@ -3011,7 +3064,7 @@ var require_websocket = __commonJS({
|
|
|
3011
3064
|
} else {
|
|
3012
3065
|
try {
|
|
3013
3066
|
parsedUrl = new URL2(address);
|
|
3014
|
-
} catch
|
|
3067
|
+
} catch {
|
|
3015
3068
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
3016
3069
|
}
|
|
3017
3070
|
}
|
|
@@ -3059,13 +3112,13 @@ var require_websocket = __commonJS({
|
|
|
3059
3112
|
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
3060
3113
|
opts.timeout = opts.handshakeTimeout;
|
|
3061
3114
|
if (opts.perMessageDeflate) {
|
|
3062
|
-
perMessageDeflate = new
|
|
3063
|
-
opts.perMessageDeflate
|
|
3064
|
-
false,
|
|
3065
|
-
opts.maxPayload
|
|
3066
|
-
);
|
|
3115
|
+
perMessageDeflate = new PerMessageDeflate2({
|
|
3116
|
+
...opts.perMessageDeflate,
|
|
3117
|
+
isServer: false,
|
|
3118
|
+
maxPayload: opts.maxPayload
|
|
3119
|
+
});
|
|
3067
3120
|
opts.headers["Sec-WebSocket-Extensions"] = format({
|
|
3068
|
-
[
|
|
3121
|
+
[PerMessageDeflate2.extensionName]: perMessageDeflate.offer()
|
|
3069
3122
|
});
|
|
3070
3123
|
}
|
|
3071
3124
|
if (protocols.length) {
|
|
@@ -3208,23 +3261,25 @@ var require_websocket = __commonJS({
|
|
|
3208
3261
|
return;
|
|
3209
3262
|
}
|
|
3210
3263
|
const extensionNames = Object.keys(extensions);
|
|
3211
|
-
if (extensionNames.length !== 1 || extensionNames[0] !==
|
|
3264
|
+
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate2.extensionName) {
|
|
3212
3265
|
const message = "Server indicated an extension that was not requested";
|
|
3213
3266
|
abortHandshake(websocket, socket, message);
|
|
3214
3267
|
return;
|
|
3215
3268
|
}
|
|
3216
3269
|
try {
|
|
3217
|
-
perMessageDeflate.accept(extensions[
|
|
3270
|
+
perMessageDeflate.accept(extensions[PerMessageDeflate2.extensionName]);
|
|
3218
3271
|
} catch (err) {
|
|
3219
3272
|
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
3220
3273
|
abortHandshake(websocket, socket, message);
|
|
3221
3274
|
return;
|
|
3222
3275
|
}
|
|
3223
|
-
websocket._extensions[
|
|
3276
|
+
websocket._extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
3224
3277
|
}
|
|
3225
3278
|
websocket.setSocket(socket, head, {
|
|
3226
3279
|
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
3227
3280
|
generateMask: opts.generateMask,
|
|
3281
|
+
maxBufferedChunks: opts.maxBufferedChunks,
|
|
3282
|
+
maxFragments: opts.maxFragments,
|
|
3228
3283
|
maxPayload: opts.maxPayload,
|
|
3229
3284
|
skipUTF8Validation: opts.skipUTF8Validation
|
|
3230
3285
|
});
|
|
@@ -3536,9 +3591,9 @@ var require_websocket_server = __commonJS({
|
|
|
3536
3591
|
var http = __require("http");
|
|
3537
3592
|
var { Duplex } = __require("stream");
|
|
3538
3593
|
var { createHash } = __require("crypto");
|
|
3539
|
-
var
|
|
3540
|
-
var
|
|
3541
|
-
var
|
|
3594
|
+
var extension2 = require_extension();
|
|
3595
|
+
var PerMessageDeflate2 = require_permessage_deflate();
|
|
3596
|
+
var subprotocol2 = require_subprotocol();
|
|
3542
3597
|
var WebSocket2 = require_websocket();
|
|
3543
3598
|
var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants();
|
|
3544
3599
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
@@ -3564,6 +3619,10 @@ var require_websocket_server = __commonJS({
|
|
|
3564
3619
|
* called
|
|
3565
3620
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
3566
3621
|
* @param {String} [options.host] The hostname where to bind the server
|
|
3622
|
+
* @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
|
|
3623
|
+
* buffered data chunks
|
|
3624
|
+
* @param {Number} [options.maxFragments=131072] The maximum number of message
|
|
3625
|
+
* fragments
|
|
3567
3626
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
3568
3627
|
* size
|
|
3569
3628
|
* @param {Boolean} [options.noServer=false] Enable no server mode
|
|
@@ -3585,6 +3644,8 @@ var require_websocket_server = __commonJS({
|
|
|
3585
3644
|
options = {
|
|
3586
3645
|
allowSynchronousEvents: true,
|
|
3587
3646
|
autoPong: true,
|
|
3647
|
+
maxBufferedChunks: 1024 * 1024,
|
|
3648
|
+
maxFragments: 128 * 1024,
|
|
3588
3649
|
maxPayload: 100 * 1024 * 1024,
|
|
3589
3650
|
skipUTF8Validation: false,
|
|
3590
3651
|
perMessageDeflate: false,
|
|
@@ -3761,7 +3822,7 @@ var require_websocket_server = __commonJS({
|
|
|
3761
3822
|
let protocols = /* @__PURE__ */ new Set();
|
|
3762
3823
|
if (secWebSocketProtocol !== void 0) {
|
|
3763
3824
|
try {
|
|
3764
|
-
protocols =
|
|
3825
|
+
protocols = subprotocol2.parse(secWebSocketProtocol);
|
|
3765
3826
|
} catch (err) {
|
|
3766
3827
|
const message = "Invalid Sec-WebSocket-Protocol header";
|
|
3767
3828
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
@@ -3771,16 +3832,16 @@ var require_websocket_server = __commonJS({
|
|
|
3771
3832
|
const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
|
|
3772
3833
|
const extensions = {};
|
|
3773
3834
|
if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
|
|
3774
|
-
const perMessageDeflate = new
|
|
3775
|
-
this.options.perMessageDeflate,
|
|
3776
|
-
true,
|
|
3777
|
-
this.options.maxPayload
|
|
3778
|
-
);
|
|
3835
|
+
const perMessageDeflate = new PerMessageDeflate2({
|
|
3836
|
+
...this.options.perMessageDeflate,
|
|
3837
|
+
isServer: true,
|
|
3838
|
+
maxPayload: this.options.maxPayload
|
|
3839
|
+
});
|
|
3779
3840
|
try {
|
|
3780
|
-
const offers =
|
|
3781
|
-
if (offers[
|
|
3782
|
-
perMessageDeflate.accept(offers[
|
|
3783
|
-
extensions[
|
|
3841
|
+
const offers = extension2.parse(secWebSocketExtensions);
|
|
3842
|
+
if (offers[PerMessageDeflate2.extensionName]) {
|
|
3843
|
+
perMessageDeflate.accept(offers[PerMessageDeflate2.extensionName]);
|
|
3844
|
+
extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
3784
3845
|
}
|
|
3785
3846
|
} catch (err) {
|
|
3786
3847
|
const message = "Invalid or unacceptable Sec-WebSocket-Extensions header";
|
|
@@ -3851,10 +3912,10 @@ var require_websocket_server = __commonJS({
|
|
|
3851
3912
|
ws._protocol = protocol;
|
|
3852
3913
|
}
|
|
3853
3914
|
}
|
|
3854
|
-
if (extensions[
|
|
3855
|
-
const params = extensions[
|
|
3856
|
-
const value =
|
|
3857
|
-
[
|
|
3915
|
+
if (extensions[PerMessageDeflate2.extensionName]) {
|
|
3916
|
+
const params = extensions[PerMessageDeflate2.extensionName].params;
|
|
3917
|
+
const value = extension2.format({
|
|
3918
|
+
[PerMessageDeflate2.extensionName]: [params]
|
|
3858
3919
|
});
|
|
3859
3920
|
headers.push(`Sec-WebSocket-Extensions: ${value}`);
|
|
3860
3921
|
ws._extensions = extensions;
|
|
@@ -3864,6 +3925,8 @@ var require_websocket_server = __commonJS({
|
|
|
3864
3925
|
socket.removeListener("error", socketOnError);
|
|
3865
3926
|
ws.setSocket(socket, head, {
|
|
3866
3927
|
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
3928
|
+
maxBufferedChunks: this.options.maxBufferedChunks,
|
|
3929
|
+
maxFragments: this.options.maxFragments,
|
|
3867
3930
|
maxPayload: this.options.maxPayload,
|
|
3868
3931
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
3869
3932
|
});
|
|
@@ -3924,19 +3987,25 @@ var require_websocket_server = __commonJS({
|
|
|
3924
3987
|
// ../../node_modules/ws/wrapper.mjs
|
|
3925
3988
|
var wrapper_exports = {};
|
|
3926
3989
|
__export(wrapper_exports, {
|
|
3990
|
+
PerMessageDeflate: () => import_permessage_deflate.default,
|
|
3927
3991
|
Receiver: () => import_receiver.default,
|
|
3928
3992
|
Sender: () => import_sender.default,
|
|
3929
3993
|
WebSocket: () => import_websocket.default,
|
|
3930
3994
|
WebSocketServer: () => import_websocket_server.default,
|
|
3931
3995
|
createWebSocketStream: () => import_stream.default,
|
|
3932
|
-
default: () => wrapper_default
|
|
3996
|
+
default: () => wrapper_default,
|
|
3997
|
+
extension: () => import_extension.default,
|
|
3998
|
+
subprotocol: () => import_subprotocol.default
|
|
3933
3999
|
});
|
|
3934
|
-
var import_stream, import_receiver, import_sender, import_websocket, import_websocket_server, wrapper_default;
|
|
4000
|
+
var import_stream, import_extension, import_permessage_deflate, import_receiver, import_sender, import_subprotocol, import_websocket, import_websocket_server, wrapper_default;
|
|
3935
4001
|
var init_wrapper = __esm({
|
|
3936
4002
|
"../../node_modules/ws/wrapper.mjs"() {
|
|
3937
4003
|
import_stream = __toESM(require_stream());
|
|
4004
|
+
import_extension = __toESM(require_extension());
|
|
4005
|
+
import_permessage_deflate = __toESM(require_permessage_deflate());
|
|
3938
4006
|
import_receiver = __toESM(require_receiver());
|
|
3939
4007
|
import_sender = __toESM(require_sender());
|
|
4008
|
+
import_subprotocol = __toESM(require_subprotocol());
|
|
3940
4009
|
import_websocket = __toESM(require_websocket());
|
|
3941
4010
|
import_websocket_server = __toESM(require_websocket_server());
|
|
3942
4011
|
wrapper_default = import_websocket.default;
|
|
@@ -11395,6 +11464,164 @@ async function invokeRegisteredEffect(effectMap, request) {
|
|
|
11395
11464
|
return resolved.handler(request.input, context);
|
|
11396
11465
|
}
|
|
11397
11466
|
|
|
11467
|
+
// src/client-normalizers.ts
|
|
11468
|
+
function createEmptyHeapSnapshot(now = Date.now()) {
|
|
11469
|
+
return {
|
|
11470
|
+
entriesByPath: {},
|
|
11471
|
+
listsByName: {},
|
|
11472
|
+
variablesByName: {},
|
|
11473
|
+
updatedAt: now
|
|
11474
|
+
};
|
|
11475
|
+
}
|
|
11476
|
+
function normalizeHeapSnapshot(raw) {
|
|
11477
|
+
if (!raw || typeof raw !== "object") {
|
|
11478
|
+
return createEmptyHeapSnapshot();
|
|
11479
|
+
}
|
|
11480
|
+
const heap = raw;
|
|
11481
|
+
return {
|
|
11482
|
+
entriesByPath: heap.entriesByPath && typeof heap.entriesByPath === "object" ? JSON.parse(JSON.stringify(heap.entriesByPath)) : {},
|
|
11483
|
+
listsByName: heap.listsByName && typeof heap.listsByName === "object" ? JSON.parse(JSON.stringify(heap.listsByName)) : {},
|
|
11484
|
+
variablesByName: heap.variablesByName && typeof heap.variablesByName === "object" ? JSON.parse(JSON.stringify(heap.variablesByName)) : {},
|
|
11485
|
+
updatedAt: typeof heap.updatedAt === "number" ? heap.updatedAt : Date.now()
|
|
11486
|
+
};
|
|
11487
|
+
}
|
|
11488
|
+
function normalizeGraphPathSegment(value) {
|
|
11489
|
+
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
11490
|
+
}
|
|
11491
|
+
function extractRecordIdFromGraphPath(path, className) {
|
|
11492
|
+
const normalizedPrefix = `${normalizeGraphPathSegment(className)}_`;
|
|
11493
|
+
if (path.startsWith(normalizedPrefix)) {
|
|
11494
|
+
return path.slice(normalizedPrefix.length);
|
|
11495
|
+
}
|
|
11496
|
+
const legacyPrefix = `${className}_`;
|
|
11497
|
+
if (path.startsWith(legacyPrefix)) {
|
|
11498
|
+
return path.slice(legacyPrefix.length);
|
|
11499
|
+
}
|
|
11500
|
+
return path;
|
|
11501
|
+
}
|
|
11502
|
+
function toRecordSearchResult(className, node) {
|
|
11503
|
+
const path = typeof node.path === "string" ? node.path : "";
|
|
11504
|
+
if (!path) return null;
|
|
11505
|
+
const fields = Array.isArray(node.submodels) ? node.submodels.flatMap(
|
|
11506
|
+
(submodel) => {
|
|
11507
|
+
const name = typeof submodel?.label === "string" && submodel.label.trim() ? submodel.label : typeof submodel?.path === "string" ? submodel.path.split(":").pop() || submodel.path : "";
|
|
11508
|
+
if (!name) return [];
|
|
11509
|
+
if (typeof submodel.string_value === "string") {
|
|
11510
|
+
return [{ name, type: "string", value: submodel.string_value }];
|
|
11511
|
+
}
|
|
11512
|
+
if (typeof submodel.number_value === "number") {
|
|
11513
|
+
return [{ name, type: "number", value: submodel.number_value }];
|
|
11514
|
+
}
|
|
11515
|
+
if (typeof submodel.boolean_value === "boolean") {
|
|
11516
|
+
return [
|
|
11517
|
+
{
|
|
11518
|
+
name,
|
|
11519
|
+
type: "boolean",
|
|
11520
|
+
value: submodel.boolean_value
|
|
11521
|
+
}
|
|
11522
|
+
];
|
|
11523
|
+
}
|
|
11524
|
+
return [];
|
|
11525
|
+
}
|
|
11526
|
+
) : [];
|
|
11527
|
+
return {
|
|
11528
|
+
path,
|
|
11529
|
+
className,
|
|
11530
|
+
id: extractRecordIdFromGraphPath(path, className),
|
|
11531
|
+
label: typeof node.label === "string" && node.label.trim() ? node.label : extractRecordIdFromGraphPath(path, className),
|
|
11532
|
+
description: typeof node.description === "string" && node.description.trim() ? node.description : null,
|
|
11533
|
+
fields
|
|
11534
|
+
};
|
|
11535
|
+
}
|
|
11536
|
+
function normalizeRecordSearchText(value) {
|
|
11537
|
+
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, " ").replace(/\s+/g, " ").trim();
|
|
11538
|
+
}
|
|
11539
|
+
function rankRecordSearchResult(result, query, index) {
|
|
11540
|
+
const normalizedQuery = normalizeRecordSearchText(query);
|
|
11541
|
+
if (!normalizedQuery) {
|
|
11542
|
+
return index;
|
|
11543
|
+
}
|
|
11544
|
+
const label = normalizeRecordSearchText(result.label || "");
|
|
11545
|
+
const id = normalizeRecordSearchText(result.id || "");
|
|
11546
|
+
const path = normalizeRecordSearchText(result.path || "");
|
|
11547
|
+
const className = normalizeRecordSearchText(result.className || "");
|
|
11548
|
+
const searchable = [label, id, path, className].filter(Boolean);
|
|
11549
|
+
if (label === normalizedQuery) return index;
|
|
11550
|
+
if (id === normalizedQuery || path === normalizedQuery) return 100 + index;
|
|
11551
|
+
if (label.startsWith(normalizedQuery)) return 200 + index;
|
|
11552
|
+
if (searchable.some((value) => value.startsWith(normalizedQuery))) {
|
|
11553
|
+
return 300 + index;
|
|
11554
|
+
}
|
|
11555
|
+
if (label.includes(normalizedQuery)) return 400 + index;
|
|
11556
|
+
if (searchable.some((value) => value.includes(normalizedQuery))) {
|
|
11557
|
+
return 500 + index;
|
|
11558
|
+
}
|
|
11559
|
+
return 900 + index;
|
|
11560
|
+
}
|
|
11561
|
+
function deriveRuntimeBaseUrl(apiEndpoint) {
|
|
11562
|
+
try {
|
|
11563
|
+
const endpoint = new URL(apiEndpoint);
|
|
11564
|
+
const graphqlSuffix = "/orchestrator/graphql";
|
|
11565
|
+
if (endpoint.pathname.endsWith(graphqlSuffix)) {
|
|
11566
|
+
endpoint.pathname = endpoint.pathname.slice(0, -graphqlSuffix.length);
|
|
11567
|
+
} else if (endpoint.pathname.endsWith("/graphql")) {
|
|
11568
|
+
endpoint.pathname = endpoint.pathname.slice(0, -"/graphql".length);
|
|
11569
|
+
}
|
|
11570
|
+
endpoint.search = "";
|
|
11571
|
+
endpoint.hash = "";
|
|
11572
|
+
return endpoint.toString().replace(/\/$/, "");
|
|
11573
|
+
} catch {
|
|
11574
|
+
return apiEndpoint.replace(/\/orchestrator\/graphql$/, "").replace(/\/$/, "");
|
|
11575
|
+
}
|
|
11576
|
+
}
|
|
11577
|
+
|
|
11578
|
+
// src/client-transport.ts
|
|
11579
|
+
function sleep(ms) {
|
|
11580
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11581
|
+
}
|
|
11582
|
+
function withTimeout(promise, timeoutMs, label) {
|
|
11583
|
+
let timer = null;
|
|
11584
|
+
const timeout = new Promise((_, reject) => {
|
|
11585
|
+
timer = setTimeout(() => {
|
|
11586
|
+
reject(new Error(`${label} timed out after ${timeoutMs}ms`));
|
|
11587
|
+
}, timeoutMs);
|
|
11588
|
+
});
|
|
11589
|
+
return Promise.race([promise, timeout]).finally(() => {
|
|
11590
|
+
if (timer) {
|
|
11591
|
+
clearTimeout(timer);
|
|
11592
|
+
}
|
|
11593
|
+
});
|
|
11594
|
+
}
|
|
11595
|
+
function isLocalControlUrl(url) {
|
|
11596
|
+
try {
|
|
11597
|
+
const parsed = new URL(url);
|
|
11598
|
+
return parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost" || parsed.hostname === "::1";
|
|
11599
|
+
} catch {
|
|
11600
|
+
return false;
|
|
11601
|
+
}
|
|
11602
|
+
}
|
|
11603
|
+
function isRetryableLocalWorkerRestart(status, body, url) {
|
|
11604
|
+
return isLocalControlUrl(url) && (status === 503 && body.includes("Your worker restarted mid-request") || status === 500 && body.includes("Network connection lost"));
|
|
11605
|
+
}
|
|
11606
|
+
function isRetryableRecordObjectsError(error) {
|
|
11607
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
11608
|
+
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(
|
|
11609
|
+
message
|
|
11610
|
+
);
|
|
11611
|
+
}
|
|
11612
|
+
function isRetryableEffectRegistrationError(error) {
|
|
11613
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
11614
|
+
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(
|
|
11615
|
+
message
|
|
11616
|
+
);
|
|
11617
|
+
}
|
|
11618
|
+
function isRetryableSessionDataError(error) {
|
|
11619
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
11620
|
+
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(
|
|
11621
|
+
message
|
|
11622
|
+
);
|
|
11623
|
+
}
|
|
11624
|
+
|
|
11398
11625
|
// src/spend.ts
|
|
11399
11626
|
function toGranularHttpBase(apiUrl) {
|
|
11400
11627
|
const url = new URL(apiUrl);
|
|
@@ -12880,51 +13107,6 @@ function planRecordObjectsChunks(records, batchSize) {
|
|
|
12880
13107
|
}
|
|
12881
13108
|
return plans;
|
|
12882
13109
|
}
|
|
12883
|
-
function sleep(ms) {
|
|
12884
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
12885
|
-
}
|
|
12886
|
-
function withTimeout(promise, timeoutMs, label) {
|
|
12887
|
-
let timer = null;
|
|
12888
|
-
const timeout = new Promise((_, reject) => {
|
|
12889
|
-
timer = setTimeout(() => {
|
|
12890
|
-
reject(new Error(`${label} timed out after ${timeoutMs}ms`));
|
|
12891
|
-
}, timeoutMs);
|
|
12892
|
-
});
|
|
12893
|
-
return Promise.race([promise, timeout]).finally(() => {
|
|
12894
|
-
if (timer) {
|
|
12895
|
-
clearTimeout(timer);
|
|
12896
|
-
}
|
|
12897
|
-
});
|
|
12898
|
-
}
|
|
12899
|
-
function isLocalControlUrl(url) {
|
|
12900
|
-
try {
|
|
12901
|
-
const parsed = new URL(url);
|
|
12902
|
-
return parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost" || parsed.hostname === "::1";
|
|
12903
|
-
} catch {
|
|
12904
|
-
return false;
|
|
12905
|
-
}
|
|
12906
|
-
}
|
|
12907
|
-
function isRetryableLocalWorkerRestart(status, body, url) {
|
|
12908
|
-
return isLocalControlUrl(url) && (status === 503 && body.includes("Your worker restarted mid-request") || status === 500 && body.includes("Network connection lost"));
|
|
12909
|
-
}
|
|
12910
|
-
function isRetryableRecordObjectsError(error) {
|
|
12911
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
12912
|
-
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(
|
|
12913
|
-
message
|
|
12914
|
-
);
|
|
12915
|
-
}
|
|
12916
|
-
function isRetryableEffectRegistrationError(error) {
|
|
12917
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
12918
|
-
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(
|
|
12919
|
-
message
|
|
12920
|
-
);
|
|
12921
|
-
}
|
|
12922
|
-
function isRetryableSessionDataError(error) {
|
|
12923
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
12924
|
-
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(
|
|
12925
|
-
message
|
|
12926
|
-
);
|
|
12927
|
-
}
|
|
12928
13110
|
function computeEffectKey2(effect) {
|
|
12929
13111
|
const attachedClass = effect.className?.trim();
|
|
12930
13112
|
if (!attachedClass) {
|
|
@@ -12979,115 +13161,6 @@ function buildEffectHostUrl(apiUrl, sandboxId, effectClientId, clientId, effectH
|
|
|
12979
13161
|
url.searchParams.set("clientId", clientId);
|
|
12980
13162
|
return url.toString();
|
|
12981
13163
|
}
|
|
12982
|
-
function createEmptyHeapSnapshot(now = Date.now()) {
|
|
12983
|
-
return {
|
|
12984
|
-
entriesByPath: {},
|
|
12985
|
-
listsByName: {},
|
|
12986
|
-
variablesByName: {},
|
|
12987
|
-
updatedAt: now
|
|
12988
|
-
};
|
|
12989
|
-
}
|
|
12990
|
-
function normalizeHeapSnapshot(raw) {
|
|
12991
|
-
if (!raw || typeof raw !== "object") {
|
|
12992
|
-
return createEmptyHeapSnapshot();
|
|
12993
|
-
}
|
|
12994
|
-
const heap = raw;
|
|
12995
|
-
return {
|
|
12996
|
-
entriesByPath: heap.entriesByPath && typeof heap.entriesByPath === "object" ? JSON.parse(JSON.stringify(heap.entriesByPath)) : {},
|
|
12997
|
-
listsByName: heap.listsByName && typeof heap.listsByName === "object" ? JSON.parse(JSON.stringify(heap.listsByName)) : {},
|
|
12998
|
-
variablesByName: heap.variablesByName && typeof heap.variablesByName === "object" ? JSON.parse(JSON.stringify(heap.variablesByName)) : {},
|
|
12999
|
-
updatedAt: typeof heap.updatedAt === "number" ? heap.updatedAt : Date.now()
|
|
13000
|
-
};
|
|
13001
|
-
}
|
|
13002
|
-
function normalizeGraphPathSegment(value) {
|
|
13003
|
-
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
13004
|
-
}
|
|
13005
|
-
function extractRecordIdFromGraphPath(path, className) {
|
|
13006
|
-
const normalizedPrefix = `${normalizeGraphPathSegment(className)}_`;
|
|
13007
|
-
if (path.startsWith(normalizedPrefix)) {
|
|
13008
|
-
return path.slice(normalizedPrefix.length);
|
|
13009
|
-
}
|
|
13010
|
-
const legacyPrefix = `${className}_`;
|
|
13011
|
-
if (path.startsWith(legacyPrefix)) {
|
|
13012
|
-
return path.slice(legacyPrefix.length);
|
|
13013
|
-
}
|
|
13014
|
-
return path;
|
|
13015
|
-
}
|
|
13016
|
-
function toRecordSearchResult(className, node) {
|
|
13017
|
-
const path = typeof node.path === "string" ? node.path : "";
|
|
13018
|
-
if (!path) return null;
|
|
13019
|
-
const fields = Array.isArray(node.submodels) ? node.submodels.flatMap(
|
|
13020
|
-
(submodel) => {
|
|
13021
|
-
const name = typeof submodel?.label === "string" && submodel.label.trim() ? submodel.label : typeof submodel?.path === "string" ? submodel.path.split(":").pop() || submodel.path : "";
|
|
13022
|
-
if (!name) return [];
|
|
13023
|
-
if (typeof submodel.string_value === "string") {
|
|
13024
|
-
return [{ name, type: "string", value: submodel.string_value }];
|
|
13025
|
-
}
|
|
13026
|
-
if (typeof submodel.number_value === "number") {
|
|
13027
|
-
return [{ name, type: "number", value: submodel.number_value }];
|
|
13028
|
-
}
|
|
13029
|
-
if (typeof submodel.boolean_value === "boolean") {
|
|
13030
|
-
return [
|
|
13031
|
-
{
|
|
13032
|
-
name,
|
|
13033
|
-
type: "boolean",
|
|
13034
|
-
value: submodel.boolean_value
|
|
13035
|
-
}
|
|
13036
|
-
];
|
|
13037
|
-
}
|
|
13038
|
-
return [];
|
|
13039
|
-
}
|
|
13040
|
-
) : [];
|
|
13041
|
-
return {
|
|
13042
|
-
path,
|
|
13043
|
-
className,
|
|
13044
|
-
id: extractRecordIdFromGraphPath(path, className),
|
|
13045
|
-
label: typeof node.label === "string" && node.label.trim() ? node.label : extractRecordIdFromGraphPath(path, className),
|
|
13046
|
-
description: typeof node.description === "string" && node.description.trim() ? node.description : null,
|
|
13047
|
-
fields
|
|
13048
|
-
};
|
|
13049
|
-
}
|
|
13050
|
-
function normalizeRecordSearchText(value) {
|
|
13051
|
-
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, " ").replace(/\s+/g, " ").trim();
|
|
13052
|
-
}
|
|
13053
|
-
function rankRecordSearchResult(result, query, index) {
|
|
13054
|
-
const normalizedQuery = normalizeRecordSearchText(query);
|
|
13055
|
-
if (!normalizedQuery) {
|
|
13056
|
-
return index;
|
|
13057
|
-
}
|
|
13058
|
-
const label = normalizeRecordSearchText(result.label || "");
|
|
13059
|
-
const id = normalizeRecordSearchText(result.id || "");
|
|
13060
|
-
const path = normalizeRecordSearchText(result.path || "");
|
|
13061
|
-
const className = normalizeRecordSearchText(result.className || "");
|
|
13062
|
-
const searchable = [label, id, path, className].filter(Boolean);
|
|
13063
|
-
if (label === normalizedQuery) return index;
|
|
13064
|
-
if (id === normalizedQuery || path === normalizedQuery) return 100 + index;
|
|
13065
|
-
if (label.startsWith(normalizedQuery)) return 200 + index;
|
|
13066
|
-
if (searchable.some((value) => value.startsWith(normalizedQuery))) {
|
|
13067
|
-
return 300 + index;
|
|
13068
|
-
}
|
|
13069
|
-
if (label.includes(normalizedQuery)) return 400 + index;
|
|
13070
|
-
if (searchable.some((value) => value.includes(normalizedQuery))) {
|
|
13071
|
-
return 500 + index;
|
|
13072
|
-
}
|
|
13073
|
-
return 900 + index;
|
|
13074
|
-
}
|
|
13075
|
-
function deriveRuntimeBaseUrl(apiEndpoint) {
|
|
13076
|
-
try {
|
|
13077
|
-
const endpoint = new URL(apiEndpoint);
|
|
13078
|
-
const graphqlSuffix = "/orchestrator/graphql";
|
|
13079
|
-
if (endpoint.pathname.endsWith(graphqlSuffix)) {
|
|
13080
|
-
endpoint.pathname = endpoint.pathname.slice(0, -graphqlSuffix.length);
|
|
13081
|
-
} else if (endpoint.pathname.endsWith("/graphql")) {
|
|
13082
|
-
endpoint.pathname = endpoint.pathname.slice(0, -"/graphql".length);
|
|
13083
|
-
}
|
|
13084
|
-
endpoint.search = "";
|
|
13085
|
-
endpoint.hash = "";
|
|
13086
|
-
return endpoint.toString().replace(/\/$/, "");
|
|
13087
|
-
} catch {
|
|
13088
|
-
return apiEndpoint.replace(/\/orchestrator\/graphql$/, "").replace(/\/$/, "");
|
|
13089
|
-
}
|
|
13090
|
-
}
|
|
13091
13164
|
function normalizeSubject(subject) {
|
|
13092
13165
|
const granularId = subject.granularId || subject.subjectId;
|
|
13093
13166
|
const userId = subject.userId || subject.identityId || granularId;
|