@tool-bridge/server 0.16.0 → 0.19.0

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 (115) hide show
  1. package/dist/{airtable-S3T4TAN7.js → airtable-23JBIM6X.js} +106 -114
  2. package/dist/{alt_text_generator_ai-4DIRIDKL.js → alt_text_generator_ai-ADWBTCIH.js} +25 -16
  3. package/dist/{amap-LGVGNPML.js → amap-CYQCYW2Z.js} +114 -123
  4. package/dist/{anthropic-27RFZO35.js → anthropic-5P62HDNR.js} +34 -56
  5. package/dist/{apify-6WLYAIAS.js → apify-54RZUAGW.js} +31 -49
  6. package/dist/{brave_search-K2SVJ66F.js → brave_search-AHJ6FTD5.js} +52 -77
  7. package/dist/{chunk-VK3V2WTY.js → chunk-B4P6YZFS.js} +4 -6
  8. package/dist/{chunk-BB6ZLMTU.js → chunk-CLEZ6YQ6.js} +2600 -481
  9. package/dist/chunk-JXHMDBAY.js +45 -0
  10. package/dist/chunk-LMLX3DJF.js +50 -0
  11. package/dist/{chunk-YB2FLNWI.js → chunk-OKRZPQ3R.js} +2558 -1926
  12. package/dist/chunk-SWBNHIO4.js +977 -0
  13. package/dist/chunk-U67V476Y.js +35 -0
  14. package/dist/chunk-VLOIDU5U.js +283 -0
  15. package/dist/{circleci-WV3ITU7Q.js → circleci-UM3NSQJ3.js} +36 -55
  16. package/dist/{clerk-NFQEFKS4.js → clerk-FE5LQ2CZ.js} +60 -80
  17. package/dist/{cloudflare_dns-2RK5ASBJ.js → cloudflare_dns-KEZABKUT.js} +90 -113
  18. package/dist/{cohere-5KEW7LWT.js → cohere-4IPJADXP.js} +33 -49
  19. package/dist/{confluence-SZE63S46.js → confluence-56QEKNQI.js} +79 -115
  20. package/dist/{convertapi-QPG2JC5K.js → convertapi-3QRM5K5T.js} +13 -16
  21. package/dist/{currencyapi-UO2APQRY.js → currencyapi-L6G4OND5.js} +30 -53
  22. package/dist/{deepseek-LJELIMM3.js → deepseek-LGC6HBFG.js} +30 -38
  23. package/dist/{docker_hub-2MFXSBOF.js → docker_hub-XDMK3BIU.js} +141 -157
  24. package/dist/{dropbox-GQYNTTVA.js → dropbox-4QARMFZU.js} +134 -141
  25. package/dist/{dub-KI2LHXST.js → dub-C6JSJKOT.js} +61 -93
  26. package/dist/{e2b-WO6ISY3C.js → e2b-6A6TVACJ.js} +39 -69
  27. package/dist/{exa-IZ7B3BPT.js → exa-SIWWW6AA.js} +49 -77
  28. package/dist/{fal_ai-LTMF36GJ.js → fal_ai-3IJXOKSP.js} +37 -44
  29. package/dist/{feishu-WM7SLSFD.js → feishu-L4KDA4DC.js} +4 -6
  30. package/dist/{feishu_custom_bot-66W3MXH2.js → feishu_custom_bot-SDM75H4P.js} +4 -5
  31. package/dist/{figma-2Z274VQZ.js → figma-6DD436DN.js} +56 -81
  32. package/dist/{firehydrant-IFI4R65V.js → firehydrant-SYSGYB3R.js} +40 -53
  33. package/dist/{fixer-BCCZEB3D.js → fixer-FZG7ASTF.js} +31 -43
  34. package/dist/{fly-755FXYB5.js → fly-HMRCZBUC.js} +50 -66
  35. package/dist/{front-4FZKKXXK.js → front-FAFSD7I3.js} +43 -66
  36. package/dist/{geocodio-WYKDJ3DP.js → geocodio-4D3TWENM.js} +37 -63
  37. package/dist/{ghost-5BNQTCOH.js → ghost-OSO2FOZS.js} +51 -57
  38. package/dist/{github-ULELF5VX.js → github-OR4I4RHE.js} +48 -41
  39. package/dist/{gmail-G34WT64J.js → gmail-5AOPJ63E.js} +26 -36
  40. package/dist/{googlecalendar-BQU255SC.js → googlecalendar-SOJIJUWH.js} +57 -78
  41. package/dist/{googledocs-HPCNQXYJ.js → googledocs-QSKN5TLN.js} +14 -22
  42. package/dist/{grafana-VOV24FIC.js → grafana-R3AIZM7M.js} +95 -122
  43. package/dist/{graphhopper-D5RXW6AP.js → graphhopper-4CR3QOAX.js} +32 -46
  44. package/dist/index.d.ts +108 -56
  45. package/dist/index.js +4 -3
  46. package/dist/{ip2proxy-DAYO7EKZ.js → ip2proxy-OBCG6X6J.js} +35 -42
  47. package/dist/{ipgeolocation_io-XD4PSLII.js → ipgeolocation_io-NHH3DTQW.js} +40 -60
  48. package/dist/{ipqualityscore-K27QEAWK.js → ipqualityscore-7POMCBEC.js} +30 -42
  49. package/dist/{jina_ai-E6UXFV2P.js → jina_ai-YXVKROV4.js} +32 -58
  50. package/dist/{jira-ZDSXGQ6W.js → jira-LADO3VJU.js} +116 -126
  51. package/dist/{langsmith-TIFJRREW.js → langsmith-XZ6UAQFU.js} +101 -121
  52. package/dist/{lemlist-DASEMJMA.js → lemlist-P74GLNE7.js} +57 -68
  53. package/dist/{linear-KE6UP4SP.js → linear-CXJ7D37A.js} +109 -118
  54. package/dist/{logsnag-IMNDN4R5.js → logsnag-EVVHWFLK.js} +31 -48
  55. package/dist/main.js +103 -102
  56. package/dist/{mattermost-HHHMUXQA.js → mattermost-WG2MRGBD.js} +45 -62
  57. package/dist/{mem0-D2FGGOIY.js → mem0-HQWUKG6U.js} +72 -98
  58. package/dist/{memos-4OVIGFPH.js → memos-SQMJIFOE.js} +68 -122
  59. package/dist/{metabase-33WCX5YD.js → metabase-E27G2DZI.js} +47 -60
  60. package/dist/{mistral_ai-QIMZ2JYL.js → mistral_ai-MIL63NIT.js} +35 -40
  61. package/dist/{mother_duck-M6VWS2VH.js → mother_duck-AIZVCBNR.js} +42 -62
  62. package/dist/{ngrok-Z2PKQBHH.js → ngrok-XS4DVIQS.js} +42 -58
  63. package/dist/{notes-SS4RPC4K.js → notes-JEOUSL2Y.js} +3 -5
  64. package/dist/{notion-FJCNQ6I7.js → notion-U4EZVDW2.js} +83 -97
  65. package/dist/{open_exchange_rates-WU57WTT5.js → open_exchange_rates-AZSQEYEJ.js} +35 -39
  66. package/dist/{openai-JODZ4GKT.js → openai-HW3SYMTQ.js} +51 -55
  67. package/dist/{opengraph_io-SQRAUSV5.js → opengraph_io-QX74MAEL.js} +61 -79
  68. package/dist/{openrouter-Q5XXEJZ7.js → openrouter-OXSKYL6N.js} +41 -55
  69. package/dist/{outline-RT2EHJ2X.js → outline-CCQAPDSW.js} +89 -104
  70. package/dist/{paddle-OF2V7GAC.js → paddle-6KQPSSCK.js} +34 -49
  71. package/dist/{perplexity-LNZEWLHG.js → perplexity-2TXO7IQE.js} +33 -50
  72. package/dist/{pinecone-JSJIXZYN.js → pinecone-YOO7NULI.js} +65 -91
  73. package/dist/{pipedrive-D4CKVUXR.js → pipedrive-Q6RIFIFP.js} +37 -59
  74. package/dist/{polar-M7ZYP6UR.js → polar-KUMGCES3.js} +43 -53
  75. package/dist/{posthog-YV7CZOH4.js → posthog-VXQHBSMB.js} +58 -77
  76. package/dist/{postmark-KYHLECRG.js → postmark-YLIPF52S.js} +52 -71
  77. package/dist/{prerender-HCMHBKV2.js → prerender-CRY7UJN5.js} +32 -50
  78. package/dist/{pubmed-WYVLCCN3.js → pubmed-3Z4T5AM7.js} +28 -60
  79. package/dist/{railway-TWIRD5KR.js → railway-BP37IGFL.js} +32 -39
  80. package/dist/{readwise-UZ467IQ7.js → readwise-HTKICF4K.js} +62 -78
  81. package/dist/{render-MECUC5CC.js → render-WIVTUXJH.js} +48 -64
  82. package/dist/{replicate-A5MEK3SW.js → replicate-JJYPA43D.js} +41 -58
  83. package/dist/{resend-BC6EAWJQ.js → resend-TKHZVG7A.js} +27 -37
  84. package/dist/{rootly-ZM3QDUIS.js → rootly-FRSZLG5U.js} +64 -76
  85. package/dist/{scrapfly-WAML42QJ.js → scrapfly-M5WXGQWE.js} +45 -51
  86. package/dist/{scrapingbee-DG7PET3V.js → scrapingbee-PMXNLLBK.js} +25 -33
  87. package/dist/{screenshot_fyi-HY6WTHIO.js → screenshot_fyi-HFW4TAOH.js} +29 -47
  88. package/dist/{semantic_scholar-C5IZA7IP.js → semantic_scholar-KXVH2VZQ.js} +37 -56
  89. package/dist/{sentry-OKBPSTDM.js → sentry-WWOT2LRX.js} +66 -85
  90. package/dist/{shodan-PPC6DYU4.js → shodan-FY635H35.js} +42 -53
  91. package/dist/{shopify-EWGUHBXO.js → shopify-HQLBVSA5.js} +32 -49
  92. package/dist/{stripe-6RPDPC5W.js → stripe-GJN2GOHB.js} +4 -5
  93. package/dist/{supabase-SK7DQ42N.js → supabase-BBNZGQU6.js} +69 -88
  94. package/dist/{tavily-YCG5VQMH.js → tavily-DPENIBOG.js} +37 -62
  95. package/dist/{telegram-2OES5FYB.js → telegram-L4NONG6H.js} +168 -177
  96. package/dist/{telnyx-POOSBBR4.js → telnyx-H67MAEZS.js} +30 -50
  97. package/dist/{todoist-M7YD6YSS.js → todoist-G2BSP4DX.js} +77 -89
  98. package/dist/{trello-IS6V5W3E.js → trello-7WMVFDG2.js} +108 -122
  99. package/dist/{turso-RCFHUFVH.js → turso-ZUAESFC2.js} +52 -64
  100. package/dist/{twilio-OS2RXFGO.js → twilio-EYFYIX3B.js} +48 -55
  101. package/dist/{umami-PQ2SJ2LN.js → umami-AXAUDUVF.js} +49 -69
  102. package/dist/{unsplash-C6BPZO4E.js → unsplash-UCQAWPLR.js} +35 -52
  103. package/dist/{upstash_redis-WH6UER7H.js → upstash_redis-ZPZ4ASU6.js} +28 -40
  104. package/dist/{uptimerobot-M3YZGS6Z.js → uptimerobot-4QVKKUD5.js} +11 -12
  105. package/dist/{v2ex-R4JWTEHN.js → v2ex-VGEFJTYC.js} +36 -61
  106. package/dist/{vercel-FZVYUOQD.js → vercel-JME4TSCN.js} +124 -150
  107. package/dist/{webapi-VLM4IKVB.js → webapi-GW5QXWXE.js} +1 -1
  108. package/dist/{wolfram_alpha_api-2KOLO5DC.js → wolfram_alpha_api-TRGU2MDG.js} +26 -34
  109. package/dist/{wordpress-XRWGO6LG.js → wordpress-WRUKLCZR.js} +87 -104
  110. package/dist/{workos-WR4NKOYL.js → workos-ZDW4EHS4.js} +37 -56
  111. package/dist/{zhihu-BKZIB3WA.js → zhihu-4VI67CWU.js} +35 -57
  112. package/package.json +3 -3
  113. package/dist/chunk-2O27H4Y2.js +0 -183
  114. package/dist/chunk-GKX72JMJ.js +0 -378
  115. package/dist/chunk-MLKGABMK.js +0 -9
@@ -1,17 +1,21 @@
1
+ import {
2
+ asJsonObject,
3
+ booleanValue,
4
+ compactDefined
5
+ } from "./chunk-JXHMDBAY.js";
1
6
  import {
2
7
  createProviderPlugin,
3
8
  requireApiKey,
4
9
  upstreamError
5
- } from "./chunk-VK3V2WTY.js";
10
+ } from "./chunk-B4P6YZFS.js";
6
11
  import {
7
12
  guardedFetch
8
- } from "./chunk-2O27H4Y2.js";
9
- import "./chunk-GKX72JMJ.js";
13
+ } from "./chunk-SWBNHIO4.js";
10
14
  import {
11
15
  TBError,
12
16
  external_exports
13
- } from "./chunk-YB2FLNWI.js";
14
- import "./chunk-MLKGABMK.js";
17
+ } from "./chunk-OKRZPQ3R.js";
18
+ import "./chunk-U67V476Y.js";
15
19
 
16
20
  // ../plugins/src/linear/api.ts
17
21
  var SERVICE = "linear";
@@ -240,27 +244,14 @@ var detailedIssueFields = `
240
244
  ${reactionFields}
241
245
  }
242
246
  `;
243
- function asRecord(value) {
244
- return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
245
- }
246
247
  function str(value) {
247
248
  return typeof value === "string" && value.length > 0 ? value : void 0;
248
249
  }
249
250
  function num(value) {
250
251
  return typeof value === "number" ? value : void 0;
251
252
  }
252
- function bool(value) {
253
- return typeof value === "boolean" ? value : void 0;
254
- }
255
- function compact(input) {
256
- const output = {};
257
- for (const [key, value] of Object.entries(input)) {
258
- if (value !== void 0) output[key] = value;
259
- }
260
- return output;
261
- }
262
253
  function nodesOf(connection) {
263
- const nodes = asRecord(connection)?.nodes;
254
+ const nodes = asJsonObject(connection)?.nodes;
264
255
  return Array.isArray(nodes) ? nodes : [];
265
256
  }
266
257
  function basenameFromUrl(url) {
@@ -279,7 +270,7 @@ async function readJson(response) {
279
270
  const text = await response.text().catch(() => "");
280
271
  if (text === "") return {};
281
272
  try {
282
- return asRecord(JSON.parse(text)) ?? { message: text };
273
+ return asJsonObject(JSON.parse(text)) ?? { message: text };
283
274
  } catch {
284
275
  return { message: text };
285
276
  }
@@ -288,7 +279,7 @@ function extractErrorMessage(body) {
288
279
  const direct = str(body.message);
289
280
  if (direct !== void 0) return direct;
290
281
  if (Array.isArray(body.errors) && body.errors.length > 0) {
291
- const joined = body.errors.map((error) => str(asRecord(error)?.message)).filter((message) => message !== void 0).join("; ");
282
+ const joined = body.errors.map((error) => str(asJsonObject(error)?.message)).filter((message) => message !== void 0).join("; ");
292
283
  if (joined !== "") return joined;
293
284
  }
294
285
  return "linear \u8BF7\u6C42\u5931\u8D25";
@@ -319,7 +310,7 @@ async function graphqlRequest(ctx, query, variables) {
319
310
  "authorization": authorization,
320
311
  "content-type": "application/json"
321
312
  },
322
- body: JSON.stringify(compact({ query, variables }))
313
+ body: JSON.stringify(compactDefined({ query, variables }))
323
314
  });
324
315
  body = await readJson(response);
325
316
  } catch (error) {
@@ -327,12 +318,12 @@ async function graphqlRequest(ctx, query, variables) {
327
318
  throw upstreamError(502, error instanceof Error ? `linear \u8BF7\u6C42\u5931\u8D25: ${error.message}` : "linear \u8BF7\u6C42\u5931\u8D25");
328
319
  }
329
320
  if (!response.ok) throw upstreamError(response.status, extractErrorMessage(body));
330
- const errors = Array.isArray(body.errors) ? body.errors.map((error) => asRecord(error) ?? { message: String(error) }) : void 0;
321
+ const errors = Array.isArray(body.errors) ? body.errors.map((error) => asJsonObject(error) ?? { message: String(error) }) : void 0;
331
322
  return {
332
323
  // `data: null` 与"没有 data 字段"要分开:前者是 GraphQL 明确说"这次没有数据"。
333
- data: body.data === null ? null : asRecord(body.data),
324
+ data: body.data === null ? null : asJsonObject(body.data),
334
325
  errors,
335
- extensions: asRecord(body.extensions)
326
+ extensions: asJsonObject(body.extensions)
336
327
  };
337
328
  }
338
329
  async function operation(ctx, query, variables) {
@@ -348,7 +339,7 @@ async function operation(ctx, query, variables) {
348
339
  async function rawDocument(ctx, document, variables) {
349
340
  const response = await graphqlRequest(ctx, document, variables);
350
341
  const hasErrors = response.errors !== void 0 && response.errors.length > 0;
351
- return compact({
342
+ return compactDefined({
352
343
  data: response.data === null ? null : response.data,
353
344
  errors: response.errors,
354
345
  extensions: response.extensions,
@@ -363,17 +354,17 @@ async function fetchAllNodes(ctx, query, extract) {
363
354
  throw upstreamError(502, `linear \u7FFB\u9875\u8D85\u8FC7 ${MAX_PAGES} \u9875,\u4E0A\u6E38\u6E38\u6807\u53EF\u80FD\u6CA1\u6709\u63A8\u8FDB`);
364
355
  }
365
356
  const data = await operation(ctx, query, { after });
366
- const connection = asRecord(extract(data));
357
+ const connection = asJsonObject(extract(data));
367
358
  if (connection === void 0) return nodes;
368
359
  nodes.push(...nodesOf(connection));
369
- const pageInfo = asRecord(connection.pageInfo);
360
+ const pageInfo = asJsonObject(connection.pageInfo);
370
361
  const endCursor = str(pageInfo?.endCursor);
371
362
  if (pageInfo?.hasNextPage !== true || endCursor === void 0) return nodes;
372
363
  after = endCursor;
373
364
  }
374
365
  }
375
366
  function requireEntity(value, message) {
376
- const record = asRecord(value);
367
+ const record = asJsonObject(value);
377
368
  if (record === void 0) throw new TBError("invalid_argument", message);
378
369
  return record;
379
370
  }
@@ -523,7 +514,7 @@ async function fetchViewer(ctx) {
523
514
  }
524
515
  }
525
516
  `, {});
526
- const viewer = asRecord(payload.viewer);
517
+ const viewer = asJsonObject(payload.viewer);
527
518
  if (viewer === void 0) throw upstreamError(502, "linear viewer \u67E5\u8BE2\u56DE\u4E86\u7A7A\u54CD\u5E94");
528
519
  return viewer;
529
520
  }
@@ -609,7 +600,7 @@ async function resolveAssigneeFilterId(ctx, assigneeId) {
609
600
  return String((await fetchViewer(ctx)).id);
610
601
  }
611
602
  function buildIssuesFilter(projectId, assigneeId) {
612
- const filter = compact({
603
+ const filter = compactDefined({
613
604
  project: projectId === void 0 ? void 0 : { id: { eq: projectId } },
614
605
  assignee: assigneeId === void 0 ? void 0 : { id: { eq: assigneeId } }
615
606
  });
@@ -626,30 +617,30 @@ async function resolveProjectStatusId(ctx, statusType) {
626
617
  }
627
618
  }
628
619
  `, {});
629
- const statuses = asRecord(payload.organization)?.projectStatuses;
620
+ const statuses = asJsonObject(payload.organization)?.projectStatuses;
630
621
  const list = Array.isArray(statuses) ? statuses : [];
631
- const matched = list.map((item) => asRecord(item)).find((item) => item?.type === statusType);
622
+ const matched = list.map((item) => asJsonObject(item)).find((item) => item?.type === statusType);
632
623
  const id = str(matched?.id);
633
624
  if (id === void 0) throw new TBError("invalid_argument", `linear \u6CA1\u6709 state \u4E3A ${statusType} \u7684 project status`);
634
625
  return id;
635
626
  }
636
627
  function mutationEntityId(payload, entityKey, message) {
637
- const record = asRecord(payload);
638
- const id = str(asRecord(record?.[entityKey])?.id);
628
+ const record = asJsonObject(payload);
629
+ const id = str(asJsonObject(record?.[entityKey])?.id);
639
630
  if (record?.success !== true || id === void 0) throw upstreamError(502, message);
640
631
  return id;
641
632
  }
642
633
  function archiveEntityId(payload, message) {
643
- const record = asRecord(payload);
644
- const id = str(asRecord(record?.entity)?.id);
634
+ const record = asJsonObject(payload);
635
+ const id = str(asJsonObject(record?.entity)?.id);
645
636
  if (record?.success !== true || id === void 0) throw upstreamError(502, message);
646
637
  return id;
647
638
  }
648
639
  function requireSuccess(payload, message) {
649
- if (asRecord(payload)?.success !== true) throw upstreamError(502, message);
640
+ if (asJsonObject(payload)?.success !== true) throw upstreamError(502, message);
650
641
  }
651
642
  function mapPageInfo(pageInfo) {
652
- const info = asRecord(pageInfo);
643
+ const info = asJsonObject(pageInfo);
653
644
  return {
654
645
  startCursor: info?.startCursor ?? null,
655
646
  endCursor: info?.endCursor ?? null,
@@ -658,35 +649,35 @@ function mapPageInfo(pageInfo) {
658
649
  };
659
650
  }
660
651
  function mapSnakePageInfo(pageInfo) {
661
- const info = asRecord(pageInfo);
652
+ const info = asJsonObject(pageInfo);
662
653
  return {
663
654
  end_cursor: info?.endCursor ?? null,
664
655
  has_next_page: Boolean(info?.hasNextPage)
665
656
  };
666
657
  }
667
658
  function mapUser(user) {
668
- const record = asRecord(user);
659
+ const record = asJsonObject(user);
669
660
  if (record === void 0) return null;
670
- return compact({
661
+ return compactDefined({
671
662
  id: str(record.id),
672
663
  name: str(record.name),
673
664
  displayName: str(record.displayName),
674
665
  email: str(record.email),
675
666
  avatarUrl: str(record.avatarUrl),
676
- active: bool(record.active),
677
- admin: bool(record.admin),
667
+ active: booleanValue(record.active),
668
+ admin: booleanValue(record.admin),
678
669
  createdAt: str(record.createdAt)
679
670
  });
680
671
  }
681
672
  function mapTeam(team) {
682
- const record = asRecord(team);
673
+ const record = asJsonObject(team);
683
674
  if (record === void 0) return null;
684
- return compact({ id: str(record.id), name: str(record.name), key: str(record.key) });
675
+ return compactDefined({ id: str(record.id), name: str(record.name), key: str(record.key) });
685
676
  }
686
677
  function mapWorkflowState(state) {
687
- const record = asRecord(state);
678
+ const record = asJsonObject(state);
688
679
  if (record === void 0) return null;
689
- return compact({
680
+ return compactDefined({
690
681
  id: str(record.id),
691
682
  name: str(record.name),
692
683
  type: str(record.type),
@@ -695,22 +686,22 @@ function mapWorkflowState(state) {
695
686
  });
696
687
  }
697
688
  function mapLabel(label) {
698
- const record = asRecord(label);
689
+ const record = asJsonObject(label);
699
690
  if (record === void 0) return null;
700
- const parent = asRecord(record.parent);
701
- return compact({
691
+ const parent = asJsonObject(record.parent);
692
+ return compactDefined({
702
693
  id: str(record.id),
703
694
  name: str(record.name),
704
695
  color: str(record.color),
705
696
  description: str(record.description),
706
- is_group: bool(record.isGroup),
707
- parent: parent === void 0 ? null : compact({ id: str(parent.id), name: str(parent.name) })
697
+ is_group: booleanValue(record.isGroup),
698
+ parent: parent === void 0 ? null : compactDefined({ id: str(parent.id), name: str(parent.name) })
708
699
  });
709
700
  }
710
701
  function mapCycle(cycle) {
711
- const record = asRecord(cycle);
702
+ const record = asJsonObject(cycle);
712
703
  if (record === void 0) return null;
713
- return compact({
704
+ return compactDefined({
714
705
  id: str(record.id),
715
706
  name: str(record.name),
716
707
  number: num(record.number),
@@ -718,16 +709,16 @@ function mapCycle(cycle) {
718
709
  startsAt: str(record.startsAt),
719
710
  endsAt: str(record.endsAt),
720
711
  completedAt: str(record.completedAt),
721
- isActive: bool(record.isActive),
722
- isFuture: bool(record.isFuture),
723
- isPast: bool(record.isPast),
712
+ isActive: booleanValue(record.isActive),
713
+ isFuture: booleanValue(record.isFuture),
714
+ isPast: booleanValue(record.isPast),
724
715
  team: mapTeam(record.team)
725
716
  });
726
717
  }
727
718
  function mapProjectStatus(status) {
728
- const record = asRecord(status);
719
+ const record = asJsonObject(status);
729
720
  if (record === void 0) return null;
730
- return compact({
721
+ return compactDefined({
731
722
  id: str(record.id),
732
723
  name: str(record.name),
733
724
  type: str(record.type),
@@ -736,9 +727,9 @@ function mapProjectStatus(status) {
736
727
  });
737
728
  }
738
729
  function mapProject(project, options = {}) {
739
- const record = asRecord(project);
730
+ const record = asJsonObject(project);
740
731
  if (record === void 0) return null;
741
- return compact({
732
+ return compactDefined({
742
733
  id: str(record.id),
743
734
  name: str(record.name),
744
735
  description: str(record.description),
@@ -764,8 +755,8 @@ function mapProject(project, options = {}) {
764
755
  members: options.includeMembers === true && record.members !== void 0 ? { nodes: nodesOf(record.members).map(mapUser) } : void 0,
765
756
  initiatives: options.includeInitiatives === true && record.initiatives !== void 0 ? {
766
757
  nodes: nodesOf(record.initiatives).map((initiative) => {
767
- const item = asRecord(initiative) ?? {};
768
- return compact({
758
+ const item = asJsonObject(initiative) ?? {};
759
+ return compactDefined({
769
760
  id: str(item.id),
770
761
  name: str(item.name),
771
762
  description: str(item.description),
@@ -776,43 +767,43 @@ function mapProject(project, options = {}) {
776
767
  });
777
768
  }
778
769
  function mapAttachment(attachment) {
779
- const record = asRecord(attachment);
770
+ const record = asJsonObject(attachment);
780
771
  if (record === void 0) return null;
781
- const issue = asRecord(record.issue);
782
- return compact({
772
+ const issue = asJsonObject(record.issue);
773
+ return compactDefined({
783
774
  id: str(record.id),
784
775
  title: str(record.title),
785
776
  subtitle: str(record.subtitle),
786
777
  url: str(record.url),
787
778
  sourceType: str(record.sourceType),
788
- metadata: asRecord(record.metadata),
789
- source: asRecord(record.source),
790
- issue: issue === void 0 ? null : compact({ id: str(issue.id), identifier: str(issue.identifier), title: str(issue.title) }),
779
+ metadata: asJsonObject(record.metadata),
780
+ source: asJsonObject(record.source),
781
+ issue: issue === void 0 ? null : compactDefined({ id: str(issue.id), identifier: str(issue.identifier), title: str(issue.title) }),
791
782
  createdAt: str(record.createdAt),
792
783
  updatedAt: str(record.updatedAt)
793
784
  });
794
785
  }
795
786
  function mapReaction(reaction) {
796
- const record = asRecord(reaction);
787
+ const record = asJsonObject(reaction);
797
788
  if (record === void 0) return null;
798
- const comment = asRecord(record.comment);
799
- const issue = asRecord(record.issue);
800
- const projectUpdate = asRecord(record.projectUpdate);
801
- return compact({
789
+ const comment = asJsonObject(record.comment);
790
+ const issue = asJsonObject(record.issue);
791
+ const projectUpdate = asJsonObject(record.projectUpdate);
792
+ return compactDefined({
802
793
  id: str(record.id),
803
794
  emoji: str(record.emoji),
804
795
  createdAt: str(record.createdAt),
805
796
  updatedAt: str(record.updatedAt),
806
797
  user: mapUser(record.user),
807
798
  comment: comment === void 0 ? null : { id: str(comment.id) },
808
- issue: issue === void 0 ? null : compact({ id: str(issue.id), identifier: str(issue.identifier) }),
799
+ issue: issue === void 0 ? null : compactDefined({ id: str(issue.id), identifier: str(issue.identifier) }),
809
800
  projectUpdate: projectUpdate === void 0 ? null : { id: str(projectUpdate.id) }
810
801
  });
811
802
  }
812
803
  function mapComment(comment) {
813
- const record = asRecord(comment);
804
+ const record = asJsonObject(comment);
814
805
  if (record === void 0) return null;
815
- return compact({
806
+ return compactDefined({
816
807
  id: str(record.id),
817
808
  body: str(record.body),
818
809
  url: str(record.url),
@@ -830,9 +821,9 @@ function mapComment(comment) {
830
821
  });
831
822
  }
832
823
  function mapIssueSummary(issue) {
833
- const record = asRecord(issue);
824
+ const record = asJsonObject(issue);
834
825
  if (record === void 0) return null;
835
- return compact({
826
+ return compactDefined({
836
827
  id: str(record.id),
837
828
  identifier: str(record.identifier),
838
829
  title: str(record.title),
@@ -854,41 +845,41 @@ function mapIssueSummary(issue) {
854
845
  function mapDetailedIssue(issue) {
855
846
  const base = mapIssueSummary(issue);
856
847
  if (base === null) return null;
857
- const record = asRecord(issue) ?? {};
858
- const parent = asRecord(record.parent);
859
- return compact({
848
+ const record = asJsonObject(issue) ?? {};
849
+ const parent = asJsonObject(record.parent);
850
+ return compactDefined({
860
851
  ...base,
861
852
  creator: mapUser(record.creator),
862
853
  cycle: mapCycle(record.cycle),
863
- parent: parent === void 0 ? null : compact({ id: str(parent.id), identifier: str(parent.identifier), title: str(parent.title) }),
854
+ parent: parent === void 0 ? null : compactDefined({ id: str(parent.id), identifier: str(parent.identifier), title: str(parent.title) }),
864
855
  attachments: {
865
856
  nodes: nodesOf(record.attachments).map(mapAttachment),
866
- pageInfo: mapPageInfo(asRecord(record.attachments)?.pageInfo)
857
+ pageInfo: mapPageInfo(asJsonObject(record.attachments)?.pageInfo)
867
858
  },
868
859
  comments: {
869
860
  nodes: nodesOf(record.comments).map(mapComment),
870
- pageInfo: mapPageInfo(asRecord(record.comments)?.pageInfo)
861
+ pageInfo: mapPageInfo(asJsonObject(record.comments)?.pageInfo)
871
862
  },
872
863
  subscribers: {
873
864
  nodes: nodesOf(record.subscribers).map(mapUser),
874
- pageInfo: mapPageInfo(asRecord(record.subscribers)?.pageInfo)
865
+ pageInfo: mapPageInfo(asJsonObject(record.subscribers)?.pageInfo)
875
866
  },
876
867
  reactions: Array.isArray(record.reactions) ? record.reactions.map(mapReaction) : []
877
868
  });
878
869
  }
879
870
  function mapDraft(draft) {
880
- const record = asRecord(draft);
871
+ const record = asJsonObject(draft);
881
872
  if (record === void 0) return null;
882
- const issue = asRecord(record.issue);
883
- const project = asRecord(record.project);
884
- const projectUpdate = asRecord(record.projectUpdate);
885
- return compact({
873
+ const issue = asJsonObject(record.issue);
874
+ const project = asJsonObject(record.project);
875
+ const projectUpdate = asJsonObject(record.projectUpdate);
876
+ return compactDefined({
886
877
  id: str(record.id),
887
- data: asRecord(record.data),
878
+ data: asJsonObject(record.data),
888
879
  bodyData: str(record.bodyData),
889
880
  createdAt: str(record.createdAt),
890
881
  updatedAt: str(record.updatedAt),
891
- isAutogenerated: bool(record.isAutogenerated),
882
+ isAutogenerated: booleanValue(record.isAutogenerated),
892
883
  team: mapTeam(record.team),
893
884
  issue: issue === void 0 ? null : { id: str(issue.id) },
894
885
  project: project === void 0 ? null : { id: str(project.id) },
@@ -907,7 +898,7 @@ async function createAttachment(input, ctx) {
907
898
  }
908
899
  }
909
900
  `, {
910
- input: compact({
901
+ input: compactDefined({
911
902
  issueId: input.issue_id,
912
903
  title: input.title,
913
904
  url: input.url,
@@ -918,7 +909,7 @@ async function createAttachment(input, ctx) {
918
909
  const attachment = await fetchAttachmentById(ctx, attachmentId);
919
910
  return {
920
911
  id: attachment.id,
921
- issue_id: asRecord(attachment.issue)?.id ?? input.issue_id,
912
+ issue_id: asJsonObject(attachment.issue)?.id ?? input.issue_id,
922
913
  title: attachment.title,
923
914
  url: attachment.url,
924
915
  subtitle: attachment.subtitle ?? null
@@ -971,7 +962,7 @@ async function createLinearIssue(input, ctx) {
971
962
  }
972
963
  }
973
964
  `, {
974
- input: compact({
965
+ input: compactDefined({
975
966
  title: input.title,
976
967
  teamId: input.team_id,
977
968
  cycleId: str(input.cycle_id),
@@ -1021,8 +1012,8 @@ async function createLinearIssueRelation(input, ctx) {
1021
1012
  const relation = await fetchIssueRelationById(ctx, relationId);
1022
1013
  return {
1023
1014
  id: relation.id,
1024
- issue_id: asRecord(relation.issue)?.id ?? input.issue_id,
1025
- related_issue_id: asRecord(relation.relatedIssue)?.id ?? input.related_issue_id,
1015
+ issue_id: asJsonObject(relation.issue)?.id ?? input.issue_id,
1016
+ related_issue_id: asJsonObject(relation.relatedIssue)?.id ?? input.related_issue_id,
1026
1017
  relation_type: relation.type ?? input.relation_type
1027
1018
  };
1028
1019
  }
@@ -1037,7 +1028,7 @@ async function createLinearLabel(input, ctx) {
1037
1028
  }
1038
1029
  }
1039
1030
  `, {
1040
- input: compact({
1031
+ input: compactDefined({
1041
1032
  teamId: input.team_id,
1042
1033
  name: input.name,
1043
1034
  color: input.color,
@@ -1048,7 +1039,7 @@ async function createLinearLabel(input, ctx) {
1048
1039
  const label = await fetchIssueLabelById(ctx, labelId);
1049
1040
  return {
1050
1041
  id: label.id,
1051
- team_id: asRecord(label.team)?.id ?? input.team_id,
1042
+ team_id: asJsonObject(label.team)?.id ?? input.team_id,
1052
1043
  name: label.name,
1053
1044
  color: label.color ?? input.color,
1054
1045
  description: label.description ?? null
@@ -1067,7 +1058,7 @@ async function createLinearProject(input, ctx) {
1067
1058
  `, {
1068
1059
  // 入参声明里还有 `status_id` 与 `state`,上游**不往 create 里发**(只有 update 认它们)。
1069
1060
  // 保留这个取舍:替上游发一个没验证过的字段,失败方式会比"这个字段没生效"更难查。
1070
- input: compact({
1061
+ input: compactDefined({
1071
1062
  icon: str(input.icon),
1072
1063
  name: input.name,
1073
1064
  color: str(input.color),
@@ -1094,7 +1085,7 @@ async function createProjectMilestone(input, ctx) {
1094
1085
  }
1095
1086
  }
1096
1087
  `, {
1097
- input: compact({
1088
+ input: compactDefined({
1098
1089
  name: input.name,
1099
1090
  projectId: input.project_id,
1100
1091
  sortOrder: input.sort_order,
@@ -1110,7 +1101,7 @@ async function createProjectMilestone(input, ctx) {
1110
1101
  const milestone = await fetchProjectMilestoneById(ctx, milestoneId);
1111
1102
  return {
1112
1103
  id: milestone.id,
1113
- project_id: asRecord(milestone.project)?.id ?? input.project_id,
1104
+ project_id: asJsonObject(milestone.project)?.id ?? input.project_id,
1114
1105
  name: milestone.name,
1115
1106
  target_date: milestone.targetDate ?? null
1116
1107
  };
@@ -1126,7 +1117,7 @@ async function createProjectUpdate(input, ctx) {
1126
1117
  }
1127
1118
  }
1128
1119
  `, {
1129
- input: compact({
1120
+ input: compactDefined({
1130
1121
  body: input.body,
1131
1122
  health: str(input.health),
1132
1123
  projectId: input.project_id,
@@ -1141,7 +1132,7 @@ async function createProjectUpdate(input, ctx) {
1141
1132
  const projectUpdate = await fetchProjectUpdateById(ctx, projectUpdateId);
1142
1133
  return {
1143
1134
  id: projectUpdate.id,
1144
- project_id: asRecord(projectUpdate.project)?.id ?? input.project_id,
1135
+ project_id: asJsonObject(projectUpdate.project)?.id ?? input.project_id,
1145
1136
  body: projectUpdate.body ?? null,
1146
1137
  health: projectUpdate.health ?? null,
1147
1138
  is_diff_hidden: Boolean(projectUpdate.isDiffHidden)
@@ -1184,7 +1175,7 @@ async function getAttachment(input, ctx) {
1184
1175
  }
1185
1176
  const attachments = await fetchIssueAttachments(ctx, input.issue_id);
1186
1177
  const matched = attachments.find((item) => {
1187
- const attachment = asRecord(item);
1178
+ const attachment = asJsonObject(item);
1188
1179
  if (attachmentId !== void 0 && attachment?.id === attachmentId) return true;
1189
1180
  if (fileName !== void 0 && attachment?.title === fileName) return true;
1190
1181
  return fileName !== void 0 && basenameFromUrl(String(attachment?.url ?? "")) === fileName;
@@ -1214,7 +1205,7 @@ async function getIssueDefaults(input, ctx) {
1214
1205
  }
1215
1206
  `, { id: input.team_id });
1216
1207
  const team = requireEntity(data.team, "linear team \u4E0D\u5B58\u5728");
1217
- const defaultState = asRecord(team.defaultIssueState);
1208
+ const defaultState = asJsonObject(team.defaultIssueState);
1218
1209
  return {
1219
1210
  team: {
1220
1211
  defaultIssueState: defaultState === void 0 ? null : { id: String(defaultState.id), name: String(defaultState.name) },
@@ -1254,7 +1245,7 @@ async function listIssuesByTeamId(input, ctx) {
1254
1245
  includeArchived: input.include_archived
1255
1246
  });
1256
1247
  const team = requireEntity(payload.team, "linear team \u4E0D\u5B58\u5728");
1257
- const issues = asRecord(team.issues);
1248
+ const issues = asJsonObject(team.issues);
1258
1249
  return {
1259
1250
  team: mapTeam(team),
1260
1251
  issues: nodesOf(issues).map(mapIssueSummary),
@@ -1297,7 +1288,7 @@ async function listIssueDrafts(input, ctx) {
1297
1288
  }
1298
1289
  }
1299
1290
  `, { after: str(input.after), first: input.first });
1300
- const drafts = asRecord(asRecord(payload.viewer)?.drafts);
1291
+ const drafts = asJsonObject(asJsonObject(payload.viewer)?.drafts);
1301
1292
  return { drafts: nodesOf(drafts).map(mapDraft), page_info: mapPageInfo(drafts?.pageInfo) };
1302
1293
  }
1303
1294
  async function listLinearCycles(_input, ctx) {
@@ -1333,7 +1324,7 @@ async function listLinearIssues(input, ctx) {
1333
1324
  first: input.first,
1334
1325
  filter: buildIssuesFilter(str(input.project_id), assigneeId)
1335
1326
  });
1336
- const issues = asRecord(payload.issues);
1327
+ const issues = asJsonObject(payload.issues);
1337
1328
  return { issues: nodesOf(issues).map(mapIssueSummary), page_info: mapPageInfo(issues?.pageInfo) };
1338
1329
  }
1339
1330
  async function listLinearLabels(input, ctx) {
@@ -1378,12 +1369,12 @@ async function listLinearTeams(input, ctx) {
1378
1369
  const teams = await fetchAllNodes(ctx, LIST_TEAMS_QUERY, (data) => data.teams);
1379
1370
  const projectId = str(input.project_id);
1380
1371
  const detailedTeams = await mapWithConcurrency(teams, 5, async (team) => {
1381
- const teamId = str(asRecord(team)?.id);
1382
- const detailed = teamId === void 0 ? asRecord(team) ?? {} : await fetchTeamDetails(ctx, teamId);
1372
+ const teamId = str(asJsonObject(team)?.id);
1373
+ const detailed = teamId === void 0 ? asJsonObject(team) ?? {} : await fetchTeamDetails(ctx, teamId);
1383
1374
  return {
1384
1375
  ...mapTeam(detailed),
1385
1376
  members: nodesOf(detailed.members).map(mapUser),
1386
- projects: nodesOf(detailed.projects).filter((project) => projectId === void 0 || String(asRecord(project)?.id) === projectId).map((project) => mapProject(project))
1377
+ projects: nodesOf(detailed.projects).filter((project) => projectId === void 0 || String(asJsonObject(project)?.id) === projectId).map((project) => mapProject(project))
1387
1378
  };
1388
1379
  });
1389
1380
  return { teams: detailedTeams };
@@ -1406,7 +1397,7 @@ async function listLinearUsers(input, ctx) {
1406
1397
  }
1407
1398
  }
1408
1399
  `, { after: str(input.after), first: input.first });
1409
- const users = asRecord(payload.users);
1400
+ const users = asJsonObject(payload.users);
1410
1401
  return { users: nodesOf(users).map(mapUser), page_info: mapPageInfo(users?.pageInfo) };
1411
1402
  }
1412
1403
  async function removeIssueLabel(input, ctx) {
@@ -1466,7 +1457,7 @@ async function searchIssues(input, ctx) {
1466
1457
  // 入参叫 query,GraphQL 变量叫 term —— 别顺手改名。
1467
1458
  term: input.query
1468
1459
  });
1469
- const results = asRecord(payload.searchIssues);
1460
+ const results = asJsonObject(payload.searchIssues);
1470
1461
  return {
1471
1462
  issues: nodesOf(results).map(mapIssueSummary),
1472
1463
  page_info: mapPageInfo(results?.pageInfo),
@@ -1485,7 +1476,7 @@ async function updateIssue(input, ctx) {
1485
1476
  }
1486
1477
  `, {
1487
1478
  id: input.issueId,
1488
- input: compact({
1479
+ input: compactDefined({
1489
1480
  title: str(input.title),
1490
1481
  teamId: str(input.teamId),
1491
1482
  cycleId: str(input.cycleId),
@@ -1531,7 +1522,7 @@ async function updateLinearProject(input, ctx) {
1531
1522
  }
1532
1523
  `, {
1533
1524
  id: input.project_id,
1534
- input: compact({
1525
+ input: compactDefined({
1535
1526
  icon: str(input.icon),
1536
1527
  name: str(input.name),
1537
1528
  color: str(input.color),