@isdk/ai-tool 0.0.3 → 0.0.5

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.
Files changed (67) hide show
  1. package/dist/{chunk-DGMU4VSJ.mjs → chunk-6JC4ABGE.mjs} +130 -146
  2. package/dist/funcs.js +129 -145
  3. package/dist/funcs.mjs +2 -2
  4. package/dist/index.js +129 -145
  5. package/dist/index.mjs +2 -2
  6. package/dist/test/util.js +1 -2
  7. package/dist/test/util.mjs +2 -3
  8. package/docs/classes/AbortError.md +11 -11
  9. package/docs/classes/AlreadyExistsError.md +11 -11
  10. package/docs/classes/BaseError.md +11 -11
  11. package/docs/classes/ClientTools.md +51 -51
  12. package/docs/classes/CommonError.md +11 -11
  13. package/docs/classes/EventClient.md +73 -73
  14. package/docs/classes/EventServer.md +71 -71
  15. package/docs/classes/EventToolFunc.md +41 -41
  16. package/docs/classes/FStringPromptTemplate.md +18 -18
  17. package/docs/classes/FewShotPromptTemplate.md +22 -22
  18. package/docs/classes/GolangPromptTemplate.md +18 -18
  19. package/docs/classes/HFEnvironment.md +9 -9
  20. package/docs/classes/HFInterpreter.md +17 -17
  21. package/docs/classes/HFTemplate.md +4 -4
  22. package/docs/classes/HfPromptTemplate.md +18 -18
  23. package/docs/classes/NotFoundError.md +11 -11
  24. package/docs/classes/NotImplementationError.md +11 -11
  25. package/docs/classes/PromptExampleSelector.md +8 -8
  26. package/docs/classes/PromptTemplate.md +17 -17
  27. package/docs/classes/ReadableStreamError.md +11 -11
  28. package/docs/classes/ResClientTools.md +57 -57
  29. package/docs/classes/ResServerTools.md +55 -55
  30. package/docs/classes/SSEChannel.md +15 -15
  31. package/docs/classes/ServerTools.md +48 -48
  32. package/docs/classes/ToolFunc.md +38 -38
  33. package/docs/enums/ErrorCode.md +19 -19
  34. package/docs/enums/XXHashAlgorithm.md +2 -2
  35. package/docs/interfaces/AIChatAssistantMessageParam.md +6 -6
  36. package/docs/interfaces/AIChatContentPartImage.md +2 -2
  37. package/docs/interfaces/AIChatContentPartText.md +2 -2
  38. package/docs/interfaces/AIChatMessageParamBase.md +1 -1
  39. package/docs/interfaces/AIChatMessageToolCall.md +3 -3
  40. package/docs/interfaces/AIChatSystemMessageParam.md +3 -3
  41. package/docs/interfaces/AIChatToolMessageParam.md +4 -4
  42. package/docs/interfaces/AIChatUserMessageParam.md +7 -7
  43. package/docs/interfaces/AIResult.md +4 -4
  44. package/docs/interfaces/AIStreamCallbacksAndOptions.md +6 -6
  45. package/docs/interfaces/AIStreamParser.md +1 -1
  46. package/docs/interfaces/AIStreamParserOptions.md +1 -1
  47. package/docs/interfaces/BaseFunc.md +7 -7
  48. package/docs/interfaces/BaseFuncItem.md +6 -6
  49. package/docs/interfaces/ClientFuncItem.md +10 -10
  50. package/docs/interfaces/DotenvExpandOptions.md +3 -3
  51. package/docs/interfaces/DotenvExpandOutput.md +2 -2
  52. package/docs/interfaces/EventClientFuncParams.md +4 -4
  53. package/docs/interfaces/EventServerFuncParams.md +5 -5
  54. package/docs/interfaces/FewShotPromptTemplateOptions.md +11 -11
  55. package/docs/interfaces/FuncItem.md +7 -7
  56. package/docs/interfaces/FuncParam.md +5 -5
  57. package/docs/interfaces/PromptExampleSelectorOptions.md +2 -2
  58. package/docs/interfaces/PromptTemplateOptions.md +6 -6
  59. package/docs/interfaces/RemoteFuncItem.md +10 -10
  60. package/docs/interfaces/ResClientFuncParams.md +2 -2
  61. package/docs/interfaces/ResServerFuncParams.md +5 -5
  62. package/docs/interfaces/SanitizeFilenameOptions.md +2 -2
  63. package/docs/interfaces/ServerFuncItem.md +11 -11
  64. package/docs/interfaces/ServerFuncParams.md +2 -2
  65. package/docs/modules.md +110 -110
  66. package/package.json +12 -13
  67. /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-EZFPVSGF.mjs";
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
- while (cursorPosition < src.length) {
1642
- const lastTokenType = tokens.at(-1)?.type;
1643
- if (lastTokenType === void 0 || lastTokenType === TOKEN_TYPES.CloseStatement || lastTokenType === TOKEN_TYPES.CloseExpression) {
1644
- let text = "";
1645
- while (cursorPosition < src.length && // Keep going until we hit the next Jinja statement or expression
1646
- !(src[cursorPosition] === "{" && (src[cursorPosition + 1] === "%" || src[cursorPosition + 1] === "{"))) {
1647
- text += src[cursorPosition++];
1648
- }
1649
- if (text.length > 0) {
1650
- tokens.push(new Token(text, TOKEN_TYPES.Text));
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
- for (const [char2, token] of ORDERED_MAPPING_TABLE) {
1680
- const slice2 = src.slice(cursorPosition, cursorPosition + char2.length);
1681
- if (slice2 === char2) {
1682
- tokens.push(new Token(char2, token));
1683
- cursorPosition += char2.length;
1684
- continue main;
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
- if (char === "'" || char === '"') {
1688
- ++cursorPosition;
1689
- const str = consumeWhile((c) => c !== char);
1690
- tokens.push(new Token(str, TOKEN_TYPES.StringLiteral));
1691
- ++cursorPosition;
1692
- continue;
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
- if (isWord(char)) {
1700
- const word = consumeWhile(isWord);
1701
- const type = Object.hasOwn(KEYWORDS, word) ? KEYWORDS[word] : TOKEN_TYPES.Identifier;
1702
- if (type === TOKEN_TYPES.In && tokens.at(-1)?.type === TOKEN_TYPES.Not) {
1703
- tokens.pop();
1704
- tokens.push(new Token("not in", TOKEN_TYPES.NotIn));
1705
- } else {
1706
- tokens.push(new Token(word, type));
1707
- }
1708
- continue;
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
- throw new SyntaxError(`Unexpected character: ${char}`);
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
- controller.close();
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 = ".") {
@@ -4199,30 +4180,14 @@ function loadFileFromPaths(filename, searchPaths, extNames) {
4199
4180
  if (path2.isAbsolute(filename)) {
4200
4181
  if (fs.existsSync(filename)) {
4201
4182
  result = filename;
4183
+ } else {
4184
+ result = tryGetFilepath(path2.basename(filename), [path2.dirname(filename)], extNames);
4202
4185
  }
4203
4186
  } else {
4204
4187
  if (!searchPaths) {
4205
4188
  searchPaths = ["."];
4206
4189
  }
4207
- let exts = extNames ? extNames.map((ext) => getMultiLevelExtname(filename, extNameLevel(ext))) : void 0;
4208
- for (const searchPath of searchPaths) {
4209
- const filePath = path2.resolve(searchPath, filename);
4210
- if (exts) {
4211
- for (let i = 0; i < exts.length; i++) {
4212
- const extName = exts[i] !== extNames[i] ? extNames[i] : "";
4213
- const filenameWithExt = filePath + extName;
4214
- if (fs.existsSync(filenameWithExt)) {
4215
- result = filenameWithExt;
4216
- break;
4217
- }
4218
- }
4219
- } else {
4220
- if (fs.existsSync(filePath)) {
4221
- result = filePath;
4222
- break;
4223
- }
4224
- }
4225
- }
4190
+ result = tryGetFilepath(filename, searchPaths, extNames);
4226
4191
  }
4227
4192
  if (result) {
4228
4193
  result = fs.readFileSync(result);
@@ -4231,6 +4196,29 @@ function loadFileFromPaths(filename, searchPaths, extNames) {
4231
4196
  }
4232
4197
  return result;
4233
4198
  }
4199
+ function tryGetFilepath(filename, searchPaths, extNames) {
4200
+ let result;
4201
+ const exts = extNames ? extNames.map((ext) => getMultiLevelExtname(filename, extNameLevel(ext))) : void 0;
4202
+ for (const searchPath of searchPaths) {
4203
+ const filePath = path2.resolve(searchPath, filename);
4204
+ if (exts) {
4205
+ for (let i = 0; i < exts.length; i++) {
4206
+ const extName = exts[i] !== extNames[i] ? extNames[i] : "";
4207
+ const filenameWithExt = filePath + extName;
4208
+ if (fs.existsSync(filenameWithExt)) {
4209
+ result = filenameWithExt;
4210
+ break;
4211
+ }
4212
+ }
4213
+ } else {
4214
+ if (fs.existsSync(filePath)) {
4215
+ result = filePath;
4216
+ break;
4217
+ }
4218
+ }
4219
+ }
4220
+ return result;
4221
+ }
4234
4222
  function loadTextFromPaths(filename, searchPaths, extNames, encoding = "utf8") {
4235
4223
  const result = loadFileFromPaths(filename, searchPaths, extNames);
4236
4224
  return result.toString(encoding);
@@ -4387,27 +4375,26 @@ function jsonFilterToWhere(filter, wrapKey) {
4387
4375
  }
4388
4376
  if (Array.isArray(filter)) {
4389
4377
  andQuery.push(generateAndClause(filter, wrapKey));
4390
- } else
4391
- for (const [key, value] of Object.entries(filter)) {
4392
- if (key === "$and") {
4393
- andQuery.push(`(${generateAndClause(filter[key], wrapKey)})`);
4394
- } else if (key === "$or") {
4395
- andQuery.push(`(${generateOrClause(filter[key], wrapKey)})`);
4378
+ } else for (const [key, value] of Object.entries(filter)) {
4379
+ if (key === "$and") {
4380
+ andQuery.push(`(${generateAndClause(filter[key], wrapKey)})`);
4381
+ } else if (key === "$or") {
4382
+ andQuery.push(`(${generateOrClause(filter[key], wrapKey)})`);
4383
+ } else {
4384
+ const tValue = typeof value;
4385
+ if (value == null) {
4386
+ andQuery.push(`${wrapKey(key)} IS NULL`);
4387
+ } else if (tValue === "object" && !Array.isArray(value)) {
4388
+ andQuery.push(generateCondition(wrapKey(key), value));
4389
+ } else if (tValue === "string") {
4390
+ andQuery.push(`${wrapKey(key)}='${value}'`);
4391
+ } else if (tValue === "number" || tValue === "boolean") {
4392
+ andQuery.push(`${wrapKey(key)}=${value}`);
4396
4393
  } else {
4397
- const tValue = typeof value;
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
- }
4394
+ throw new Error(`Unsupported value type for key ${key}`);
4409
4395
  }
4410
4396
  }
4397
+ }
4411
4398
  ;
4412
4399
  return andQuery.length > 1 ? andQuery.join(" AND ") : andQuery[0];
4413
4400
  }
@@ -4435,8 +4422,7 @@ var ClientTools = class _ClientTools extends ToolFunc {
4435
4422
  "Content-Type": "application/json"
4436
4423
  } });
4437
4424
  const items = await res.json();
4438
- if (items)
4439
- this.loadFromSync(items);
4425
+ if (items) this.loadFromSync(items);
4440
4426
  } else {
4441
4427
  throwError2("missing apiRoot to load tools", "ClientTools");
4442
4428
  }
@@ -4742,8 +4728,7 @@ var EventClient = class extends ResClientTools {
4742
4728
  for (const event2 of events) {
4743
4729
  if (!this._forwardEvents.has(event2)) {
4744
4730
  this._forwardEvents.add(event2);
4745
- if (this.on)
4746
- this.on(event2, this.ebListener);
4731
+ if (this.on) this.on(event2, this.ebListener);
4747
4732
  }
4748
4733
  }
4749
4734
  }
@@ -4762,8 +4747,7 @@ var EventClient = class extends ResClientTools {
4762
4747
  for (const event2 of events) {
4763
4748
  if (this._forwardEvents.has(event2)) {
4764
4749
  this._forwardEvents.delete(event2);
4765
- if (this.off)
4766
- this.off(event2, this.ebListener);
4750
+ if (this.off) this.off(event2, this.ebListener);
4767
4751
  }
4768
4752
  }
4769
4753
  }