@isdk/ai-tool 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-DGMU4VSJ.mjs → chunk-ZXBTGYVX.mjs} +104 -127
- package/dist/funcs.js +103 -126
- package/dist/funcs.mjs +2 -2
- package/dist/index.js +103 -126
- package/dist/index.mjs +2 -2
- package/dist/test/util.js +1 -2
- package/dist/test/util.mjs +2 -3
- package/docs/classes/AbortError.md +11 -11
- package/docs/classes/AlreadyExistsError.md +11 -11
- package/docs/classes/BaseError.md +11 -11
- package/docs/classes/ClientTools.md +51 -51
- package/docs/classes/CommonError.md +11 -11
- package/docs/classes/EventClient.md +73 -73
- package/docs/classes/EventServer.md +71 -71
- package/docs/classes/EventToolFunc.md +41 -41
- package/docs/classes/FStringPromptTemplate.md +18 -18
- package/docs/classes/FewShotPromptTemplate.md +22 -22
- package/docs/classes/GolangPromptTemplate.md +18 -18
- package/docs/classes/HFEnvironment.md +9 -9
- package/docs/classes/HFInterpreter.md +17 -17
- package/docs/classes/HFTemplate.md +4 -4
- package/docs/classes/HfPromptTemplate.md +18 -18
- package/docs/classes/NotFoundError.md +11 -11
- package/docs/classes/NotImplementationError.md +11 -11
- package/docs/classes/PromptExampleSelector.md +8 -8
- package/docs/classes/PromptTemplate.md +17 -17
- package/docs/classes/ReadableStreamError.md +11 -11
- package/docs/classes/ResClientTools.md +57 -57
- package/docs/classes/ResServerTools.md +55 -55
- package/docs/classes/SSEChannel.md +15 -15
- package/docs/classes/ServerTools.md +48 -48
- package/docs/classes/ToolFunc.md +38 -38
- package/docs/enums/ErrorCode.md +19 -19
- package/docs/enums/XXHashAlgorithm.md +2 -2
- package/docs/interfaces/AIChatAssistantMessageParam.md +6 -6
- package/docs/interfaces/AIChatContentPartImage.md +2 -2
- package/docs/interfaces/AIChatContentPartText.md +2 -2
- package/docs/interfaces/AIChatMessageParamBase.md +1 -1
- package/docs/interfaces/AIChatMessageToolCall.md +3 -3
- package/docs/interfaces/AIChatSystemMessageParam.md +3 -3
- package/docs/interfaces/AIChatToolMessageParam.md +4 -4
- package/docs/interfaces/AIChatUserMessageParam.md +7 -7
- package/docs/interfaces/AIResult.md +4 -4
- package/docs/interfaces/AIStreamCallbacksAndOptions.md +6 -6
- package/docs/interfaces/AIStreamParser.md +1 -1
- package/docs/interfaces/AIStreamParserOptions.md +1 -1
- package/docs/interfaces/BaseFunc.md +7 -7
- package/docs/interfaces/BaseFuncItem.md +6 -6
- package/docs/interfaces/ClientFuncItem.md +10 -10
- package/docs/interfaces/DotenvExpandOptions.md +3 -3
- package/docs/interfaces/DotenvExpandOutput.md +2 -2
- package/docs/interfaces/EventClientFuncParams.md +4 -4
- package/docs/interfaces/EventServerFuncParams.md +5 -5
- package/docs/interfaces/FewShotPromptTemplateOptions.md +11 -11
- package/docs/interfaces/FuncItem.md +7 -7
- package/docs/interfaces/FuncParam.md +5 -5
- package/docs/interfaces/PromptExampleSelectorOptions.md +2 -2
- package/docs/interfaces/PromptTemplateOptions.md +6 -6
- package/docs/interfaces/RemoteFuncItem.md +10 -10
- package/docs/interfaces/ResClientFuncParams.md +2 -2
- package/docs/interfaces/ResServerFuncParams.md +5 -5
- package/docs/interfaces/SanitizeFilenameOptions.md +2 -2
- package/docs/interfaces/ServerFuncItem.md +11 -11
- package/docs/interfaces/ServerFuncParams.md +2 -2
- package/docs/modules.md +110 -110
- package/package.json +12 -13
- /package/dist/{chunk-EZFPVSGF.mjs → chunk-U5DDQYSF.mjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export,
|
|
3
3
|
__reExport
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-U5DDQYSF.mjs";
|
|
5
5
|
|
|
6
6
|
// src/funcs/event.ts
|
|
7
7
|
import { EventEmitter } from "events-ex";
|
|
@@ -345,8 +345,7 @@ var ToolFunc = class _ToolFunc extends AdvancePropertyManager {
|
|
|
345
345
|
runSync(params) {
|
|
346
346
|
const isPosParams = this.params && Array.isArray(this.params);
|
|
347
347
|
if (Array.isArray(params)) {
|
|
348
|
-
if (isPosParams)
|
|
349
|
-
return this.func(...params);
|
|
348
|
+
if (isPosParams) return this.func(...params);
|
|
350
349
|
throwError2("the function is not support array params, the params must be object!", this.name);
|
|
351
350
|
}
|
|
352
351
|
if (isPosParams) {
|
|
@@ -554,22 +553,19 @@ var SSEChannel = class {
|
|
|
554
553
|
* @throws Will throw an error if the channel is closed.
|
|
555
554
|
*/
|
|
556
555
|
publish(data, eventName) {
|
|
557
|
-
if (!this.active)
|
|
558
|
-
throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
|
|
556
|
+
if (!this.active) throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
|
|
559
557
|
let output;
|
|
560
558
|
let id;
|
|
561
559
|
let _eventName = eventName;
|
|
562
560
|
if (!data && !eventName) {
|
|
563
|
-
if (!this.clients.size)
|
|
564
|
-
return;
|
|
561
|
+
if (!this.clients.size) return;
|
|
565
562
|
output = "data: \n\n";
|
|
566
563
|
} else {
|
|
567
564
|
id = this.nextID++;
|
|
568
565
|
if (typeof data === "object") {
|
|
569
566
|
if (data.event) {
|
|
570
567
|
_eventName = data.event;
|
|
571
|
-
if (data.data !== void 0)
|
|
572
|
-
data = JSON.stringify(data.data);
|
|
568
|
+
if (data.data !== void 0) data = JSON.stringify(data.data);
|
|
573
569
|
} else {
|
|
574
570
|
data = JSON.stringify(data);
|
|
575
571
|
}
|
|
@@ -596,8 +592,7 @@ var SSEChannel = class {
|
|
|
596
592
|
* @throws Will throw an error if the channel is closed.
|
|
597
593
|
*/
|
|
598
594
|
subscribe(req, res, events) {
|
|
599
|
-
if (!this.active)
|
|
600
|
-
throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
|
|
595
|
+
if (!this.active) throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
|
|
601
596
|
const c = { req, res, events };
|
|
602
597
|
const maxStreamDuration = this.options.maxStreamDuration;
|
|
603
598
|
let cacheControl = "max-age=0, stale-while-revalidate=0, stale-if-error=0, no-transform";
|
|
@@ -758,8 +753,7 @@ import { env as _env, pipeline as _pipeline, cos_sim as _cos_sim } from "@xenova
|
|
|
758
753
|
import { Cache as _Cache } from "secondary-cache";
|
|
759
754
|
function _lrucache({ key, value, options } = {}) {
|
|
760
755
|
if (key === void 0) {
|
|
761
|
-
if (options)
|
|
762
|
-
this.cache.setDefaultOptions(options);
|
|
756
|
+
if (options) this.cache.setDefaultOptions(options);
|
|
763
757
|
} else if (value === null) {
|
|
764
758
|
return this.cache.del(key);
|
|
765
759
|
} else if (value !== void 0) {
|
|
@@ -1012,8 +1006,7 @@ async function _splitSegments({ texts, model } = {}) {
|
|
|
1012
1006
|
}
|
|
1013
1007
|
}
|
|
1014
1008
|
}
|
|
1015
|
-
if (segment.length)
|
|
1016
|
-
segments2.push([...segment]);
|
|
1009
|
+
if (segment.length) segments2.push([...segment]);
|
|
1017
1010
|
return segments2;
|
|
1018
1011
|
}
|
|
1019
1012
|
var splitSegments = new ServerTools("splitSegments", {
|
|
@@ -1621,8 +1614,7 @@ function tokenize(source, options = {}) {
|
|
|
1621
1614
|
while (predicate(src[cursorPosition])) {
|
|
1622
1615
|
if (src[cursorPosition] === "\\") {
|
|
1623
1616
|
++cursorPosition;
|
|
1624
|
-
if (cursorPosition >= src.length)
|
|
1625
|
-
throw new SyntaxError("Unexpected end of input");
|
|
1617
|
+
if (cursorPosition >= src.length) throw new SyntaxError("Unexpected end of input");
|
|
1626
1618
|
const escaped = src[cursorPosition++];
|
|
1627
1619
|
const unescaped = ESCAPE_CHARACTERS.get(escaped);
|
|
1628
1620
|
if (unescaped === void 0) {
|
|
@@ -1632,83 +1624,81 @@ function tokenize(source, options = {}) {
|
|
|
1632
1624
|
continue;
|
|
1633
1625
|
}
|
|
1634
1626
|
str += src[cursorPosition++];
|
|
1635
|
-
if (cursorPosition >= src.length)
|
|
1636
|
-
throw new SyntaxError("Unexpected end of input");
|
|
1627
|
+
if (cursorPosition >= src.length) throw new SyntaxError("Unexpected end of input");
|
|
1637
1628
|
}
|
|
1638
1629
|
return str;
|
|
1639
1630
|
};
|
|
1640
|
-
main:
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
continue;
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
consumeWhile((char2) => /\s/.test(char2));
|
|
1655
|
-
const char = src[cursorPosition];
|
|
1656
|
-
if (char === "-" || char === "+") {
|
|
1657
|
-
const lastTokenType2 = tokens.at(-1)?.type;
|
|
1658
|
-
if (lastTokenType2 === TOKEN_TYPES.Text || lastTokenType2 === void 0) {
|
|
1659
|
-
throw new SyntaxError(`Unexpected character: ${char}`);
|
|
1660
|
-
}
|
|
1661
|
-
switch (lastTokenType2) {
|
|
1662
|
-
case TOKEN_TYPES.Identifier:
|
|
1663
|
-
case TOKEN_TYPES.NumericLiteral:
|
|
1664
|
-
case TOKEN_TYPES.BooleanLiteral:
|
|
1665
|
-
case TOKEN_TYPES.StringLiteral:
|
|
1666
|
-
case TOKEN_TYPES.CloseParen:
|
|
1667
|
-
case TOKEN_TYPES.CloseSquareBracket:
|
|
1668
|
-
break;
|
|
1669
|
-
default: {
|
|
1670
|
-
++cursorPosition;
|
|
1671
|
-
const num = consumeWhile(isInteger);
|
|
1672
|
-
tokens.push(
|
|
1673
|
-
new Token(`${char}${num}`, num.length > 0 ? TOKEN_TYPES.NumericLiteral : TOKEN_TYPES.UnaryOperator)
|
|
1674
|
-
);
|
|
1675
|
-
continue;
|
|
1676
|
-
}
|
|
1677
|
-
}
|
|
1631
|
+
main: while (cursorPosition < src.length) {
|
|
1632
|
+
const lastTokenType = tokens.at(-1)?.type;
|
|
1633
|
+
if (lastTokenType === void 0 || lastTokenType === TOKEN_TYPES.CloseStatement || lastTokenType === TOKEN_TYPES.CloseExpression) {
|
|
1634
|
+
let text = "";
|
|
1635
|
+
while (cursorPosition < src.length && // Keep going until we hit the next Jinja statement or expression
|
|
1636
|
+
!(src[cursorPosition] === "{" && (src[cursorPosition + 1] === "%" || src[cursorPosition + 1] === "{"))) {
|
|
1637
|
+
text += src[cursorPosition++];
|
|
1638
|
+
}
|
|
1639
|
+
if (text.length > 0) {
|
|
1640
|
+
tokens.push(new Token(text, TOKEN_TYPES.Text));
|
|
1641
|
+
continue;
|
|
1678
1642
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1643
|
+
}
|
|
1644
|
+
consumeWhile((char2) => /\s/.test(char2));
|
|
1645
|
+
const char = src[cursorPosition];
|
|
1646
|
+
if (char === "-" || char === "+") {
|
|
1647
|
+
const lastTokenType2 = tokens.at(-1)?.type;
|
|
1648
|
+
if (lastTokenType2 === TOKEN_TYPES.Text || lastTokenType2 === void 0) {
|
|
1649
|
+
throw new SyntaxError(`Unexpected character: ${char}`);
|
|
1650
|
+
}
|
|
1651
|
+
switch (lastTokenType2) {
|
|
1652
|
+
case TOKEN_TYPES.Identifier:
|
|
1653
|
+
case TOKEN_TYPES.NumericLiteral:
|
|
1654
|
+
case TOKEN_TYPES.BooleanLiteral:
|
|
1655
|
+
case TOKEN_TYPES.StringLiteral:
|
|
1656
|
+
case TOKEN_TYPES.CloseParen:
|
|
1657
|
+
case TOKEN_TYPES.CloseSquareBracket:
|
|
1658
|
+
break;
|
|
1659
|
+
default: {
|
|
1660
|
+
++cursorPosition;
|
|
1661
|
+
const num = consumeWhile(isInteger);
|
|
1662
|
+
tokens.push(
|
|
1663
|
+
new Token(`${char}${num}`, num.length > 0 ? TOKEN_TYPES.NumericLiteral : TOKEN_TYPES.UnaryOperator)
|
|
1664
|
+
);
|
|
1665
|
+
continue;
|
|
1685
1666
|
}
|
|
1686
1667
|
}
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
if (isInteger(char)) {
|
|
1695
|
-
const num = consumeWhile(isInteger);
|
|
1696
|
-
tokens.push(new Token(num, TOKEN_TYPES.NumericLiteral));
|
|
1697
|
-
continue;
|
|
1668
|
+
}
|
|
1669
|
+
for (const [char2, token] of ORDERED_MAPPING_TABLE) {
|
|
1670
|
+
const slice2 = src.slice(cursorPosition, cursorPosition + char2.length);
|
|
1671
|
+
if (slice2 === char2) {
|
|
1672
|
+
tokens.push(new Token(char2, token));
|
|
1673
|
+
cursorPosition += char2.length;
|
|
1674
|
+
continue main;
|
|
1698
1675
|
}
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1676
|
+
}
|
|
1677
|
+
if (char === "'" || char === '"') {
|
|
1678
|
+
++cursorPosition;
|
|
1679
|
+
const str = consumeWhile((c) => c !== char);
|
|
1680
|
+
tokens.push(new Token(str, TOKEN_TYPES.StringLiteral));
|
|
1681
|
+
++cursorPosition;
|
|
1682
|
+
continue;
|
|
1683
|
+
}
|
|
1684
|
+
if (isInteger(char)) {
|
|
1685
|
+
const num = consumeWhile(isInteger);
|
|
1686
|
+
tokens.push(new Token(num, TOKEN_TYPES.NumericLiteral));
|
|
1687
|
+
continue;
|
|
1688
|
+
}
|
|
1689
|
+
if (isWord(char)) {
|
|
1690
|
+
const word = consumeWhile(isWord);
|
|
1691
|
+
const type = Object.hasOwn(KEYWORDS, word) ? KEYWORDS[word] : TOKEN_TYPES.Identifier;
|
|
1692
|
+
if (type === TOKEN_TYPES.In && tokens.at(-1)?.type === TOKEN_TYPES.Not) {
|
|
1693
|
+
tokens.pop();
|
|
1694
|
+
tokens.push(new Token("not in", TOKEN_TYPES.NotIn));
|
|
1695
|
+
} else {
|
|
1696
|
+
tokens.push(new Token(word, type));
|
|
1709
1697
|
}
|
|
1710
|
-
|
|
1698
|
+
continue;
|
|
1711
1699
|
}
|
|
1700
|
+
throw new SyntaxError(`Unexpected character: ${char}`);
|
|
1701
|
+
}
|
|
1712
1702
|
return tokens;
|
|
1713
1703
|
}
|
|
1714
1704
|
|
|
@@ -3004,8 +2994,7 @@ var Interpreter = class {
|
|
|
3004
2994
|
return new StringValue(result);
|
|
3005
2995
|
}
|
|
3006
2996
|
evaluate(statement, environment) {
|
|
3007
|
-
if (statement === void 0)
|
|
3008
|
-
return new UndefinedValue();
|
|
2997
|
+
if (statement === void 0) return new UndefinedValue();
|
|
3009
2998
|
switch (statement.type) {
|
|
3010
2999
|
case "Program":
|
|
3011
3000
|
return this.evalProgram(statement, environment);
|
|
@@ -3824,8 +3813,7 @@ function createEventStreamTransformer(customParser) {
|
|
|
3824
3813
|
const parsedMessage = customParser ? customParser(event2.data, {
|
|
3825
3814
|
event: event2.event
|
|
3826
3815
|
}) : event2.data;
|
|
3827
|
-
if (parsedMessage)
|
|
3828
|
-
controller.enqueue(parsedMessage);
|
|
3816
|
+
if (parsedMessage) controller.enqueue(parsedMessage);
|
|
3829
3817
|
}
|
|
3830
3818
|
}
|
|
3831
3819
|
);
|
|
@@ -3841,15 +3829,13 @@ function createCallbacksTransformer(cb) {
|
|
|
3841
3829
|
const callbacks = cb || {};
|
|
3842
3830
|
return new TransformStream({
|
|
3843
3831
|
async start() {
|
|
3844
|
-
if (callbacks.onStart)
|
|
3845
|
-
await callbacks.onStart();
|
|
3832
|
+
if (callbacks.onStart) await callbacks.onStart();
|
|
3846
3833
|
},
|
|
3847
3834
|
async transform(message, controller) {
|
|
3848
3835
|
const content = typeof message === "string" ? message : message.content;
|
|
3849
3836
|
controller.enqueue(textEncoder.encode(content));
|
|
3850
3837
|
aggregatedResponse += content;
|
|
3851
|
-
if (callbacks.onToken)
|
|
3852
|
-
await callbacks.onToken(content);
|
|
3838
|
+
if (callbacks.onToken) await callbacks.onToken(content);
|
|
3853
3839
|
if (callbacks.onText && typeof message === "string") {
|
|
3854
3840
|
await callbacks.onText(message);
|
|
3855
3841
|
}
|
|
@@ -3869,8 +3855,7 @@ function trimStartOfStreamHelper() {
|
|
|
3869
3855
|
return (text) => {
|
|
3870
3856
|
if (isStreamStart) {
|
|
3871
3857
|
text = text.trimStart();
|
|
3872
|
-
if (text)
|
|
3873
|
-
isStreamStart = false;
|
|
3858
|
+
if (text) isStreamStart = false;
|
|
3874
3859
|
}
|
|
3875
3860
|
return text;
|
|
3876
3861
|
};
|
|
@@ -3897,10 +3882,8 @@ function readableFromAsyncIterable(iterable) {
|
|
|
3897
3882
|
return new ReadableStream({
|
|
3898
3883
|
async pull(controller) {
|
|
3899
3884
|
const { done, value } = await it.next();
|
|
3900
|
-
if (done)
|
|
3901
|
-
|
|
3902
|
-
else
|
|
3903
|
-
controller.enqueue(value);
|
|
3885
|
+
if (done) controller.close();
|
|
3886
|
+
else controller.enqueue(value);
|
|
3904
3887
|
},
|
|
3905
3888
|
async cancel(reason) {
|
|
3906
3889
|
await it.return?.(reason);
|
|
@@ -3974,8 +3957,7 @@ var XXHashAlgorithm = /* @__PURE__ */ ((XXHashAlgorithm2) => {
|
|
|
3974
3957
|
return XXHashAlgorithm2;
|
|
3975
3958
|
})(XXHashAlgorithm || {});
|
|
3976
3959
|
function xxhash(value, hashAlgo = 111 /* xxhash64 */, seed = SEED) {
|
|
3977
|
-
if (value.buffer)
|
|
3978
|
-
value = value.buffer;
|
|
3960
|
+
if (value.buffer) value = value.buffer;
|
|
3979
3961
|
let result;
|
|
3980
3962
|
if (hashAlgo !== 112 /* xxhash32 */) {
|
|
3981
3963
|
result = h64(value, seed);
|
|
@@ -4164,8 +4146,7 @@ function isObject(value) {
|
|
|
4164
4146
|
return !!value && value.constructor === Object;
|
|
4165
4147
|
}
|
|
4166
4148
|
function getKeysPath(value) {
|
|
4167
|
-
if (!value)
|
|
4168
|
-
return [];
|
|
4149
|
+
if (!value) return [];
|
|
4169
4150
|
return getKeys(value, [], "");
|
|
4170
4151
|
}
|
|
4171
4152
|
function getKeys(obj, paths, dot = ".") {
|
|
@@ -4387,27 +4368,26 @@ function jsonFilterToWhere(filter, wrapKey) {
|
|
|
4387
4368
|
}
|
|
4388
4369
|
if (Array.isArray(filter)) {
|
|
4389
4370
|
andQuery.push(generateAndClause(filter, wrapKey));
|
|
4390
|
-
} else
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4371
|
+
} else for (const [key, value] of Object.entries(filter)) {
|
|
4372
|
+
if (key === "$and") {
|
|
4373
|
+
andQuery.push(`(${generateAndClause(filter[key], wrapKey)})`);
|
|
4374
|
+
} else if (key === "$or") {
|
|
4375
|
+
andQuery.push(`(${generateOrClause(filter[key], wrapKey)})`);
|
|
4376
|
+
} else {
|
|
4377
|
+
const tValue = typeof value;
|
|
4378
|
+
if (value == null) {
|
|
4379
|
+
andQuery.push(`${wrapKey(key)} IS NULL`);
|
|
4380
|
+
} else if (tValue === "object" && !Array.isArray(value)) {
|
|
4381
|
+
andQuery.push(generateCondition(wrapKey(key), value));
|
|
4382
|
+
} else if (tValue === "string") {
|
|
4383
|
+
andQuery.push(`${wrapKey(key)}='${value}'`);
|
|
4384
|
+
} else if (tValue === "number" || tValue === "boolean") {
|
|
4385
|
+
andQuery.push(`${wrapKey(key)}=${value}`);
|
|
4396
4386
|
} else {
|
|
4397
|
-
|
|
4398
|
-
if (value == null) {
|
|
4399
|
-
andQuery.push(`${wrapKey(key)} IS NULL`);
|
|
4400
|
-
} else if (tValue === "object" && !Array.isArray(value)) {
|
|
4401
|
-
andQuery.push(generateCondition(wrapKey(key), value));
|
|
4402
|
-
} else if (tValue === "string") {
|
|
4403
|
-
andQuery.push(`${wrapKey(key)}='${value}'`);
|
|
4404
|
-
} else if (tValue === "number" || tValue === "boolean") {
|
|
4405
|
-
andQuery.push(`${wrapKey(key)}=${value}`);
|
|
4406
|
-
} else {
|
|
4407
|
-
throw new Error(`Unsupported value type for key ${key}`);
|
|
4408
|
-
}
|
|
4387
|
+
throw new Error(`Unsupported value type for key ${key}`);
|
|
4409
4388
|
}
|
|
4410
4389
|
}
|
|
4390
|
+
}
|
|
4411
4391
|
;
|
|
4412
4392
|
return andQuery.length > 1 ? andQuery.join(" AND ") : andQuery[0];
|
|
4413
4393
|
}
|
|
@@ -4435,8 +4415,7 @@ var ClientTools = class _ClientTools extends ToolFunc {
|
|
|
4435
4415
|
"Content-Type": "application/json"
|
|
4436
4416
|
} });
|
|
4437
4417
|
const items = await res.json();
|
|
4438
|
-
if (items)
|
|
4439
|
-
this.loadFromSync(items);
|
|
4418
|
+
if (items) this.loadFromSync(items);
|
|
4440
4419
|
} else {
|
|
4441
4420
|
throwError2("missing apiRoot to load tools", "ClientTools");
|
|
4442
4421
|
}
|
|
@@ -4742,8 +4721,7 @@ var EventClient = class extends ResClientTools {
|
|
|
4742
4721
|
for (const event2 of events) {
|
|
4743
4722
|
if (!this._forwardEvents.has(event2)) {
|
|
4744
4723
|
this._forwardEvents.add(event2);
|
|
4745
|
-
if (this.on)
|
|
4746
|
-
this.on(event2, this.ebListener);
|
|
4724
|
+
if (this.on) this.on(event2, this.ebListener);
|
|
4747
4725
|
}
|
|
4748
4726
|
}
|
|
4749
4727
|
}
|
|
@@ -4762,8 +4740,7 @@ var EventClient = class extends ResClientTools {
|
|
|
4762
4740
|
for (const event2 of events) {
|
|
4763
4741
|
if (this._forwardEvents.has(event2)) {
|
|
4764
4742
|
this._forwardEvents.delete(event2);
|
|
4765
|
-
if (this.off)
|
|
4766
|
-
this.off(event2, this.ebListener);
|
|
4743
|
+
if (this.off) this.off(event2, this.ebListener);
|
|
4767
4744
|
}
|
|
4768
4745
|
}
|
|
4769
4746
|
}
|