@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,92 +1,70 @@
1
+ import {
2
+ createProviderHttpClient
3
+ } from "./chunk-VLOIDU5U.js";
4
+ import {
5
+ asJsonObject,
6
+ compactDefined,
7
+ integerValue,
8
+ trimmedText
9
+ } from "./chunk-JXHMDBAY.js";
1
10
  import {
2
11
  createProviderPlugin,
3
12
  requireApiKey,
4
13
  upstreamError
5
- } from "./chunk-VK3V2WTY.js";
6
- import {
7
- guardedFetch
8
- } from "./chunk-2O27H4Y2.js";
9
- import "./chunk-GKX72JMJ.js";
14
+ } from "./chunk-B4P6YZFS.js";
15
+ import "./chunk-SWBNHIO4.js";
10
16
  import {
11
17
  TBError,
12
18
  external_exports
13
- } from "./chunk-YB2FLNWI.js";
14
- import "./chunk-MLKGABMK.js";
19
+ } from "./chunk-OKRZPQ3R.js";
20
+ import "./chunk-U67V476Y.js";
15
21
 
16
22
  // ../plugins/src/docker_hub/api.ts
17
23
  var SERVICE = "docker_hub";
18
24
  var API_BASE = "https://hub.docker.com";
19
25
  var TOKEN_PATH = "/v2/auth/token";
26
+ var http = createProviderHttpClient({ baseUrl: API_BASE, service: SERVICE });
20
27
  var DEFAULT_IMAGE_PAGE_SIZE = 25;
21
28
  var DEFAULT_IMAGE_MAX_PAGES = 20;
22
- function record(value) {
23
- return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
24
- }
25
- function text(value) {
26
- if (typeof value !== "string") return void 0;
27
- const trimmed = value.trim();
28
- return trimmed === "" ? void 0 : trimmed;
29
- }
30
29
  function nullableText(value) {
31
- return text(value) ?? null;
32
- }
33
- function int(value) {
34
- return typeof value === "number" && Number.isInteger(value) ? value : void 0;
30
+ return trimmedText(value) ?? null;
35
31
  }
36
32
  function nullableBool(value) {
37
33
  return typeof value === "boolean" ? value : null;
38
34
  }
39
35
  function objectArray(value) {
40
36
  if (!Array.isArray(value)) return [];
41
- return value.filter((item) => record(item) !== void 0);
37
+ return value.filter((item) => asJsonObject(item) !== void 0);
42
38
  }
43
39
  function stringArray(value) {
44
40
  if (!Array.isArray(value)) return [];
45
41
  return value.filter((item) => typeof item === "string");
46
42
  }
47
- function compact(input) {
48
- return Object.fromEntries(
49
- Object.entries(input).filter(([, value]) => value !== void 0)
50
- );
51
- }
52
43
  function responseError(message) {
53
44
  return new TBError("unavailable", message, { retryable: true });
54
45
  }
55
46
  function requireRecord(value) {
56
- const result = record(value);
47
+ const result = asJsonObject(value);
57
48
  if (result === void 0) throw responseError("Docker Hub \u54CD\u5E94\u4E0D\u662F\u5BF9\u8C61");
58
49
  return result;
59
50
  }
60
- function errorMessage(payload) {
61
- if (typeof payload === "string") return text(payload);
62
- const body = record(payload);
51
+ function errorMessage(payload2) {
52
+ if (typeof payload2 === "string") return trimmedText(payload2);
53
+ const body = asJsonObject(payload2);
63
54
  if (body === void 0) return void 0;
64
- const direct = text(body.message) ?? text(body.detail);
55
+ const direct = trimmedText(body.message) ?? trimmedText(body.detail);
65
56
  if (direct !== void 0) return direct;
66
- const errinfo = record(body.errinfo);
57
+ const errinfo = asJsonObject(body.errinfo);
67
58
  if (errinfo === void 0) return void 0;
68
59
  for (const value of Object.values(errinfo)) {
69
- const item = text(value) ?? (Array.isArray(value) ? stringArray(value).map(text).find(Boolean) : void 0);
60
+ const item = trimmedText(value) ?? (Array.isArray(value) ? stringArray(value).map(trimmedText).find(Boolean) : void 0);
70
61
  if (item !== void 0) return item;
71
62
  }
72
63
  return void 0;
73
64
  }
74
- async function readPayload(response) {
75
- const raw = await response.text();
76
- if (raw === "") return null;
77
- try {
78
- return JSON.parse(raw);
79
- } catch {
80
- return { message: raw };
81
- }
82
- }
83
- function buildUrl(path2, query) {
84
- const url = new URL(path2, API_BASE);
85
- for (const [key, value] of Object.entries(query ?? {})) {
86
- if (value === void 0) continue;
87
- url.searchParams.set(key, String(value));
88
- }
89
- return url.toString();
65
+ function payload(data, bodyKind) {
66
+ if (bodyKind === "empty") return null;
67
+ return bodyKind === "invalid-json" ? { message: data } : data;
90
68
  }
91
69
  function credential(ctx) {
92
70
  const raw = requireApiKey(ctx, SERVICE).trim();
@@ -102,62 +80,68 @@ function credential(ctx) {
102
80
  return { identifier, secret };
103
81
  }
104
82
  async function accessToken(ctx) {
105
- const response = await guardedFetch(buildUrl(TOKEN_PATH), {
83
+ const auth = credential(ctx);
84
+ const result = await http.request({
85
+ path: TOKEN_PATH,
106
86
  method: "POST",
107
- headers: { "accept": "application/json", "content-type": "application/json" },
108
- body: JSON.stringify(credential(ctx))
87
+ headers: { accept: "application/json" },
88
+ json: auth,
89
+ invalidJson: "text",
90
+ sensitiveValues: [auth.identifier, auth.secret],
91
+ mapError: ({ data, bodyKind, status }) => upstreamError(
92
+ status,
93
+ errorMessage(payload(data, bodyKind)) ?? `Docker Hub \u6362\u53D6\u4EE4\u724C\u5931\u8D25(HTTP ${status})`
94
+ )
109
95
  });
110
- const payload = await readPayload(response);
111
- if (!response.ok) {
112
- throw upstreamError(response.status, errorMessage(payload) ?? `Docker Hub \u6362\u53D6\u4EE4\u724C\u5931\u8D25(HTTP ${response.status})`);
113
- }
114
- const token = text(requireRecord(payload).access_token);
96
+ const token = trimmedText(requireRecord(payload(result.data, result.bodyKind)).access_token);
115
97
  if (token === void 0) throw responseError("Docker Hub \u6362\u53D6\u4EE4\u724C\u7684\u54CD\u5E94\u91CC\u6CA1\u6709 access_token");
116
98
  return token;
117
99
  }
118
100
  async function send(ctx, input) {
119
- const response = await guardedFetch(buildUrl(input.path, input.query), {
101
+ const result = await http.request({
102
+ path: input.path,
120
103
  method: input.method ?? "GET",
104
+ query: Object.entries(input.query ?? {}),
121
105
  headers: {
122
106
  accept: "application/json",
123
- authorization: `Bearer ${await accessToken(ctx)}`,
124
- ...input.body === void 0 ? {} : { "content-type": "application/json" }
107
+ authorization: `Bearer ${await accessToken(ctx)}`
125
108
  },
126
- body: input.body === void 0 ? void 0 : JSON.stringify(input.body)
109
+ ...input.body === void 0 ? {} : { json: input.body },
110
+ invalidJson: "text",
111
+ mapError: ({ data, bodyKind, status }) => upstreamError(
112
+ status,
113
+ errorMessage(payload(data, bodyKind)) ?? `Docker Hub \u8FD4\u56DE HTTP ${status}`
114
+ )
127
115
  });
128
- const payload = await readPayload(response);
129
- if (!response.ok) {
130
- throw upstreamError(response.status, errorMessage(payload) ?? `Docker Hub \u8FD4\u56DE HTTP ${response.status}`);
131
- }
132
- return { payload, response };
116
+ return payload(result.data, result.bodyKind);
133
117
  }
134
118
  async function requestJson(ctx, input) {
135
- return (await send(ctx, input)).payload;
119
+ return send(ctx, input);
136
120
  }
137
121
  async function requestNoContent(ctx, input) {
138
122
  await send(ctx, input);
139
123
  }
140
- function pageContainer(payload) {
141
- const body = requireRecord(payload);
124
+ function pageContainer(payload2) {
125
+ const body = requireRecord(payload2);
142
126
  return {
143
- count: int(body.count) ?? 0,
127
+ count: integerValue(body.count) ?? 0,
144
128
  next: nullableText(body.next),
145
129
  previous: nullableText(body.previous),
146
130
  results: objectArray(body.results)
147
131
  };
148
132
  }
149
- function repositorySummary(payload) {
150
- const body = requireRecord(payload);
133
+ function repositorySummary(payload2) {
134
+ const body = requireRecord(payload2);
151
135
  return {
152
- name: text(body.name) ?? "",
153
- namespace: text(body.namespace) ?? "",
136
+ name: trimmedText(body.name) ?? "",
137
+ namespace: trimmedText(body.namespace) ?? "",
154
138
  repositoryType: nullableText(body.repository_type),
155
- status: int(body.status) ?? 0,
156
- statusDescription: text(body.status_description) ?? "",
139
+ status: integerValue(body.status) ?? 0,
140
+ statusDescription: trimmedText(body.status_description) ?? "",
157
141
  description: nullableText(body.description),
158
142
  isPrivate: Boolean(body.is_private),
159
- starCount: int(body.star_count) ?? 0,
160
- pullCount: int(body.pull_count) ?? 0,
143
+ starCount: integerValue(body.star_count) ?? 0,
144
+ pullCount: integerValue(body.pull_count) ?? 0,
161
145
  lastUpdated: nullableText(body.last_updated),
162
146
  lastModified: nullableText(body.last_modified),
163
147
  dateRegistered: nullableText(body.date_registered),
@@ -165,21 +149,21 @@ function repositorySummary(payload) {
165
149
  mediaTypes: stringArray(body.media_types),
166
150
  contentTypes: stringArray(body.content_types),
167
151
  categories: objectArray(body.categories).map((item) => ({
168
- name: text(item.name) ?? "",
169
- slug: text(item.slug) ?? ""
152
+ name: trimmedText(item.name) ?? "",
153
+ slug: trimmedText(item.slug) ?? ""
170
154
  })),
171
- storageSize: int(body.storage_size) ?? null
155
+ storageSize: integerValue(body.storage_size) ?? null
172
156
  };
173
157
  }
174
- function repositoryDetail(payload) {
175
- const body = requireRecord(payload);
176
- const permissions = record(body.permissions);
177
- const immutable = record(body.immutable_tags_settings);
158
+ function repositoryDetail(payload2) {
159
+ const body = requireRecord(payload2);
160
+ const permissions = asJsonObject(body.permissions);
161
+ const immutable = asJsonObject(body.immutable_tags_settings);
178
162
  return {
179
163
  ...repositorySummary(body),
180
164
  user: nullableText(body.user),
181
165
  hubUser: nullableText(body.hub_user),
182
- collaboratorCount: int(body.collaborator_count) ?? null,
166
+ collaboratorCount: integerValue(body.collaborator_count) ?? null,
183
167
  fullDescription: nullableText(body.full_description),
184
168
  hasStarred: nullableBool(body.has_starred),
185
169
  permissions: permissions === void 0 ? null : { read: Boolean(permissions.read), write: Boolean(permissions.write), admin: Boolean(permissions.admin) },
@@ -187,8 +171,8 @@ function repositoryDetail(payload) {
187
171
  source: nullableText(body.source)
188
172
  };
189
173
  }
190
- function image(payload) {
191
- const body = requireRecord(payload);
174
+ function image(payload2) {
175
+ const body = requireRecord(payload2);
192
176
  return {
193
177
  architecture: nullableText(body.architecture),
194
178
  features: nullableText(body.features),
@@ -196,13 +180,13 @@ function image(payload) {
196
180
  digest: nullableText(body.digest),
197
181
  layers: objectArray(body.layers).map((layer) => ({
198
182
  digest: nullableText(layer.digest),
199
- size: int(layer.size) ?? null,
183
+ size: integerValue(layer.size) ?? null,
200
184
  instruction: nullableText(layer.instruction)
201
185
  })),
202
186
  os: nullableText(body.os),
203
187
  osFeatures: nullableText(body.os_features),
204
188
  osVersion: nullableText(body.os_version),
205
- size: int(body.size) ?? null,
189
+ size: integerValue(body.size) ?? null,
206
190
  status: nullableText(body.status),
207
191
  lastPulled: nullableText(body.last_pulled),
208
192
  lastPushed: nullableText(body.last_pushed)
@@ -210,27 +194,27 @@ function image(payload) {
210
194
  }
211
195
  function imageCollection(value) {
212
196
  if (Array.isArray(value)) return value.map((item) => image(item));
213
- return record(value) === void 0 ? [] : [image(value)];
197
+ return asJsonObject(value) === void 0 ? [] : [image(value)];
214
198
  }
215
- function tag(payload) {
216
- const body = requireRecord(payload);
199
+ function tag(payload2) {
200
+ const body = requireRecord(payload2);
217
201
  return {
218
- id: int(body.id) ?? null,
219
- name: text(body.name) ?? "",
220
- creator: int(body.creator) ?? null,
202
+ id: integerValue(body.id) ?? null,
203
+ name: trimmedText(body.name) ?? "",
204
+ creator: integerValue(body.creator) ?? null,
221
205
  lastUpdated: nullableText(body.last_updated),
222
- lastUpdater: int(body.last_updater) ?? null,
206
+ lastUpdater: integerValue(body.last_updater) ?? null,
223
207
  lastUpdaterUsername: nullableText(body.last_updater_username),
224
- repository: int(body.repository) ?? null,
225
- fullSize: int(body.full_size) ?? null,
208
+ repository: integerValue(body.repository) ?? null,
209
+ fullSize: integerValue(body.full_size) ?? null,
226
210
  status: nullableText(body.status),
227
211
  tagLastPulled: nullableText(body.tag_last_pulled),
228
212
  tagLastPushed: nullableText(body.tag_last_pushed),
229
213
  images: imageCollection(body.images)
230
214
  };
231
215
  }
232
- function orgMember(payload) {
233
- const body = requireRecord(payload);
216
+ function orgMember(payload2) {
217
+ const body = requireRecord(payload2);
234
218
  return {
235
219
  id: nullableText(body.id),
236
220
  username: nullableText(body.username),
@@ -246,18 +230,18 @@ function orgMember(payload) {
246
230
  lastDesktopVersion: nullableText(body.last_desktop_version)
247
231
  };
248
232
  }
249
- function team(payload) {
250
- const body = requireRecord(payload);
233
+ function team(payload2) {
234
+ const body = requireRecord(payload2);
251
235
  return {
252
- id: int(body.id) ?? null,
236
+ id: integerValue(body.id) ?? null,
253
237
  uuid: nullableText(body.uuid),
254
238
  name: nullableText(body.name),
255
239
  description: nullableText(body.description),
256
- memberCount: int(body.member_count) ?? null
240
+ memberCount: integerValue(body.member_count) ?? null
257
241
  };
258
242
  }
259
- function teamMember(payload) {
260
- const body = requireRecord(payload);
243
+ function teamMember(payload2) {
244
+ const body = requireRecord(payload2);
261
245
  return {
262
246
  id: nullableText(body.id),
263
247
  username: nullableText(body.username),
@@ -270,9 +254,9 @@ function teamMember(payload) {
270
254
  dateJoined: nullableText(body.date_joined)
271
255
  };
272
256
  }
273
- function orgAccessToken(payload) {
274
- const body = requireRecord(payload);
275
- return compact({
257
+ function orgAccessToken(payload2) {
258
+ const body = requireRecord(payload2);
259
+ return compactDefined({
276
260
  id: nullableText(body.id),
277
261
  label: nullableText(body.label),
278
262
  createdBy: nullableText(body.created_by),
@@ -291,11 +275,11 @@ function orgAccessToken(payload) {
291
275
  }) : void 0
292
276
  });
293
277
  }
294
- function bulkInviteResults(payload) {
295
- const body = requireRecord(payload);
296
- const nested = record(body.invitees)?.invitees ?? body.invitees;
278
+ function bulkInviteResults(payload2) {
279
+ const body = requireRecord(payload2);
280
+ const nested = asJsonObject(body.invitees)?.invitees ?? body.invitees;
297
281
  return objectArray(nested).map((item) => {
298
- const invite = record(item.invite);
282
+ const invite = asJsonObject(item.invite);
299
283
  return {
300
284
  invitee: nullableText(item.invitee),
301
285
  status: nullableText(item.status),
@@ -310,8 +294,8 @@ function bulkInviteResults(payload) {
310
294
  };
311
295
  });
312
296
  }
313
- function mapPage(payload, item) {
314
- const page = pageContainer(payload);
297
+ function mapPage(payload2, item) {
298
+ const page = pageContainer(payload2);
315
299
  return { count: page.count, next: page.next, previous: page.previous, results: page.results.map(item) };
316
300
  }
317
301
  var path = {
@@ -321,51 +305,51 @@ var path = {
321
305
  team: (orgName, teamName) => `${path.org(orgName)}/groups/${encodeURIComponent(teamName)}`
322
306
  };
323
307
  async function listRepositories(input, ctx) {
324
- const payload = await requestJson(ctx, {
308
+ const payload2 = await requestJson(ctx, {
325
309
  path: path.repositories(input.namespace),
326
- query: compact({
310
+ query: compactDefined({
327
311
  page: input.page,
328
312
  page_size: input.pageSize,
329
- name: text(input.name),
330
- ordering: text(input.ordering)
313
+ name: trimmedText(input.name),
314
+ ordering: trimmedText(input.ordering)
331
315
  })
332
316
  });
333
- return mapPage(payload, repositorySummary);
317
+ return mapPage(payload2, repositorySummary);
334
318
  }
335
319
  async function getRepository(input, ctx) {
336
- const payload = await requestJson(ctx, { path: path.repository(input.namespace, input.repository) });
337
- return { repository: repositoryDetail(payload) };
320
+ const payload2 = await requestJson(ctx, { path: path.repository(input.namespace, input.repository) });
321
+ return { repository: repositoryDetail(payload2) };
338
322
  }
339
323
  async function createRepository(input, ctx) {
340
- const payload = await requestJson(ctx, {
324
+ const payload2 = await requestJson(ctx, {
341
325
  path: path.repositories(input.namespace),
342
326
  method: "POST",
343
- body: compact({
327
+ body: compactDefined({
344
328
  namespace: input.namespace,
345
329
  name: input.name,
346
- description: text(input.description),
347
- full_description: text(input.fullDescription),
348
- registry: text(input.registry),
330
+ description: trimmedText(input.description),
331
+ full_description: trimmedText(input.fullDescription),
332
+ registry: trimmedText(input.registry),
349
333
  is_private: input.isPrivate
350
334
  })
351
335
  });
352
- return { repository: repositoryDetail(payload) };
336
+ return { repository: repositoryDetail(payload2) };
353
337
  }
354
338
  async function getTag(input, ctx) {
355
- const payload = await requestJson(ctx, {
339
+ const payload2 = await requestJson(ctx, {
356
340
  path: `${path.repository(input.namespace, input.repository)}/tags/${encodeURIComponent(input.tag)}`
357
341
  });
358
- return { tag: tag(payload) };
342
+ return { tag: tag(payload2) };
359
343
  }
360
344
  async function getImage(input, ctx) {
361
345
  const pageSize = input.pageSize ?? DEFAULT_IMAGE_PAGE_SIZE;
362
346
  const maxPages = input.maxPages ?? DEFAULT_IMAGE_MAX_PAGES;
363
347
  for (let page = 1; page <= maxPages; page += 1) {
364
- const payload = await requestJson(ctx, {
348
+ const payload2 = await requestJson(ctx, {
365
349
  path: `${path.repository(input.namespace, input.repository)}/tags`,
366
350
  query: { page, page_size: pageSize }
367
351
  });
368
- const current = pageContainer(payload);
352
+ const current = pageContainer(payload2);
369
353
  for (const item of current.results) {
370
354
  const normalized = tag(item);
371
355
  const found = normalized.images.find((candidate) => candidate.digest === input.digest);
@@ -376,34 +360,34 @@ async function getImage(input, ctx) {
376
360
  throw upstreamError(404, `\u5728 ${input.namespace}/${input.repository} \u91CC\u6CA1\u627E\u5230 digest \u4E3A ${input.digest} \u7684\u955C\u50CF`);
377
361
  }
378
362
  async function listOrgMembers(input, ctx) {
379
- const payload = await requestJson(ctx, {
363
+ const payload2 = await requestJson(ctx, {
380
364
  path: `${path.org(input.orgName)}/members`,
381
- query: compact({
382
- search: text(input.search),
365
+ query: compactDefined({
366
+ search: trimmedText(input.search),
383
367
  page: input.page,
384
368
  page_size: input.pageSize,
385
369
  invites: input.invites,
386
- type: text(input.type),
387
- role: text(input.role)
370
+ type: trimmedText(input.type),
371
+ role: trimmedText(input.role)
388
372
  })
389
373
  });
390
- const unwrapped = Array.isArray(payload) && payload.length > 0 && payload.every((item) => record(item) !== void 0) ? payload[0] : payload;
374
+ const unwrapped = Array.isArray(payload2) && payload2.length > 0 && payload2.every((item) => asJsonObject(item) !== void 0) ? payload2[0] : payload2;
391
375
  return mapPage(unwrapped, orgMember);
392
376
  }
393
377
  async function addOrgMember(input, ctx) {
394
- const payload = await requestJson(ctx, {
378
+ const payload2 = await requestJson(ctx, {
395
379
  path: "/v2/invites/bulk",
396
380
  method: "POST",
397
- body: compact({
381
+ body: compactDefined({
398
382
  org: input.orgName,
399
- team: text(input.teamName),
400
- role: text(input.role),
383
+ team: trimmedText(input.teamName),
384
+ role: trimmedText(input.role),
401
385
  // 单人邀请也走批量接口,故 invitee 要包成数组。
402
386
  invitees: [input.invitee],
403
387
  dry_run: input.dryRun
404
388
  })
405
389
  });
406
- return { invitees: bulkInviteResults(payload) };
390
+ return { invitees: bulkInviteResults(payload2) };
407
391
  }
408
392
  async function removeOrgMember(input, ctx) {
409
393
  await requestNoContent(ctx, {
@@ -413,44 +397,44 @@ async function removeOrgMember(input, ctx) {
413
397
  return { removed: true };
414
398
  }
415
399
  async function listOrgAccessTokens(input, ctx) {
416
- const payload = await requestJson(ctx, {
400
+ const payload2 = await requestJson(ctx, {
417
401
  path: `${path.org(input.orgName)}/access-tokens`,
418
- query: compact({ page: input.page, page_size: input.pageSize })
402
+ query: compactDefined({ page: input.page, page_size: input.pageSize })
419
403
  });
420
- const body = requireRecord(payload);
404
+ const body = requireRecord(payload2);
421
405
  return {
422
- total: int(body.total) ?? 0,
406
+ total: integerValue(body.total) ?? 0,
423
407
  next: nullableText(body.next),
424
408
  previous: nullableText(body.previous),
425
409
  results: objectArray(body.results).map((item) => orgAccessToken(item))
426
410
  };
427
411
  }
428
412
  async function listTeams(input, ctx) {
429
- const payload = await requestJson(ctx, {
413
+ const payload2 = await requestJson(ctx, {
430
414
  path: `${path.org(input.orgName)}/groups`,
431
- query: compact({
415
+ query: compactDefined({
432
416
  page: input.page,
433
417
  page_size: input.pageSize,
434
- username: text(input.username),
435
- search: text(input.search)
418
+ username: trimmedText(input.username),
419
+ search: trimmedText(input.search)
436
420
  })
437
421
  });
438
- return mapPage(payload, team);
422
+ return mapPage(payload2, team);
439
423
  }
440
424
  async function getTeam(input, ctx) {
441
- const payload = await requestJson(ctx, { path: path.team(input.orgName, input.teamName) });
442
- return { team: team(payload) };
425
+ const payload2 = await requestJson(ctx, { path: path.team(input.orgName, input.teamName) });
426
+ return { team: team(payload2) };
443
427
  }
444
428
  async function deleteTeam(input, ctx) {
445
429
  await requestNoContent(ctx, { path: path.team(input.orgName, input.teamName), method: "DELETE" });
446
430
  return { deleted: true };
447
431
  }
448
432
  async function listTeamMembers(input, ctx) {
449
- const payload = await requestJson(ctx, {
433
+ const payload2 = await requestJson(ctx, {
450
434
  path: `${path.team(input.orgName, input.teamName)}/members`,
451
- query: compact({ page: input.page, page_size: input.pageSize, search: text(input.search) })
435
+ query: compactDefined({ page: input.page, page_size: input.pageSize, search: trimmedText(input.search) })
452
436
  });
453
- return mapPage(payload, teamMember);
437
+ return mapPage(payload2, teamMember);
454
438
  }
455
439
  async function removeTeamMember(input, ctx) {
456
440
  await requestNoContent(ctx, {