@tool-bridge/server 0.16.0 → 0.17.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.
- package/dist/{airtable-S3T4TAN7.js → airtable-NOSOMOVB.js} +106 -114
- package/dist/{alt_text_generator_ai-4DIRIDKL.js → alt_text_generator_ai-BHIJ4LW5.js} +25 -16
- package/dist/{amap-LGVGNPML.js → amap-QRLP4TWZ.js} +114 -123
- package/dist/{anthropic-27RFZO35.js → anthropic-IEOI36EV.js} +34 -56
- package/dist/{apify-6WLYAIAS.js → apify-3CCYTQVK.js} +31 -49
- package/dist/{brave_search-K2SVJ66F.js → brave_search-PZNYDQG7.js} +52 -77
- package/dist/chunk-JXHMDBAY.js +45 -0
- package/dist/chunk-LMLX3DJF.js +50 -0
- package/dist/{chunk-YB2FLNWI.js → chunk-RVWZN3CI.js} +2103 -1775
- package/dist/{chunk-BB6ZLMTU.js → chunk-TLNUIPFZ.js} +492 -300
- package/dist/chunk-U5UHT7CX.js +977 -0
- package/dist/chunk-U67V476Y.js +35 -0
- package/dist/chunk-WW2IMPQK.js +283 -0
- package/dist/{chunk-VK3V2WTY.js → chunk-YASUMV2K.js} +4 -6
- package/dist/{circleci-WV3ITU7Q.js → circleci-VSJ4O5FC.js} +36 -55
- package/dist/{clerk-NFQEFKS4.js → clerk-CC2JZBZI.js} +60 -80
- package/dist/{cloudflare_dns-2RK5ASBJ.js → cloudflare_dns-PJEBSEYQ.js} +90 -113
- package/dist/{cohere-5KEW7LWT.js → cohere-KBACYSPF.js} +33 -49
- package/dist/{confluence-SZE63S46.js → confluence-2PX3O7G5.js} +79 -115
- package/dist/{convertapi-QPG2JC5K.js → convertapi-BVOTD2PJ.js} +13 -16
- package/dist/{currencyapi-UO2APQRY.js → currencyapi-6ZQ2VNQ7.js} +30 -53
- package/dist/{deepseek-LJELIMM3.js → deepseek-MB3WVVTB.js} +30 -38
- package/dist/{docker_hub-2MFXSBOF.js → docker_hub-7CLQL2IJ.js} +141 -157
- package/dist/{dropbox-GQYNTTVA.js → dropbox-VFYDVUNK.js} +134 -141
- package/dist/{dub-KI2LHXST.js → dub-QN3EETJY.js} +61 -93
- package/dist/{e2b-WO6ISY3C.js → e2b-NKC3Y776.js} +39 -69
- package/dist/{exa-IZ7B3BPT.js → exa-KKZ6F25K.js} +49 -77
- package/dist/{fal_ai-LTMF36GJ.js → fal_ai-25LYJD2O.js} +37 -44
- package/dist/{feishu-WM7SLSFD.js → feishu-NRT55B3Q.js} +4 -6
- package/dist/{feishu_custom_bot-66W3MXH2.js → feishu_custom_bot-3W3XXUG4.js} +4 -5
- package/dist/{figma-2Z274VQZ.js → figma-4FLP35TC.js} +56 -81
- package/dist/{firehydrant-IFI4R65V.js → firehydrant-BLXPLZ3X.js} +40 -53
- package/dist/{fixer-BCCZEB3D.js → fixer-4OR62TGE.js} +31 -43
- package/dist/{fly-755FXYB5.js → fly-MYCKOZZK.js} +50 -66
- package/dist/{front-4FZKKXXK.js → front-3DFYVMF3.js} +43 -66
- package/dist/{geocodio-WYKDJ3DP.js → geocodio-CXMD6VKA.js} +37 -63
- package/dist/{ghost-5BNQTCOH.js → ghost-4UUE737W.js} +51 -57
- package/dist/{github-ULELF5VX.js → github-WFS2ON2N.js} +48 -41
- package/dist/{gmail-G34WT64J.js → gmail-KW7FXA7A.js} +26 -36
- package/dist/{googlecalendar-BQU255SC.js → googlecalendar-AMH5JQMC.js} +57 -78
- package/dist/{googledocs-HPCNQXYJ.js → googledocs-R5VA6CKD.js} +14 -22
- package/dist/{grafana-VOV24FIC.js → grafana-IT6DWIVB.js} +95 -122
- package/dist/{graphhopper-D5RXW6AP.js → graphhopper-TYFDJZWC.js} +32 -46
- package/dist/index.d.ts +57 -50
- package/dist/index.js +4 -3
- package/dist/{ip2proxy-DAYO7EKZ.js → ip2proxy-GJ4HXVXO.js} +35 -42
- package/dist/{ipgeolocation_io-XD4PSLII.js → ipgeolocation_io-OAGR6PRF.js} +40 -60
- package/dist/{ipqualityscore-K27QEAWK.js → ipqualityscore-BCKAMDGL.js} +30 -42
- package/dist/{jina_ai-E6UXFV2P.js → jina_ai-N3NXRVIZ.js} +32 -58
- package/dist/{jira-ZDSXGQ6W.js → jira-CHLBKWLO.js} +116 -126
- package/dist/{langsmith-TIFJRREW.js → langsmith-OIKOTPY3.js} +101 -121
- package/dist/{lemlist-DASEMJMA.js → lemlist-VAKYPKS3.js} +57 -68
- package/dist/{linear-KE6UP4SP.js → linear-Q6QTPJ5R.js} +109 -118
- package/dist/{logsnag-IMNDN4R5.js → logsnag-SQOQBTES.js} +31 -48
- package/dist/main.js +103 -102
- package/dist/{mattermost-HHHMUXQA.js → mattermost-G2KBEICM.js} +45 -62
- package/dist/{mem0-D2FGGOIY.js → mem0-D2FPLYDX.js} +72 -98
- package/dist/{memos-4OVIGFPH.js → memos-76PTWV5V.js} +68 -122
- package/dist/{metabase-33WCX5YD.js → metabase-TWSIDVBM.js} +47 -60
- package/dist/{mistral_ai-QIMZ2JYL.js → mistral_ai-TP7TQUEJ.js} +35 -40
- package/dist/{mother_duck-M6VWS2VH.js → mother_duck-UXY5THYU.js} +42 -62
- package/dist/{ngrok-Z2PKQBHH.js → ngrok-RZW2ISJK.js} +42 -58
- package/dist/{notes-SS4RPC4K.js → notes-B2I6FWK2.js} +3 -5
- package/dist/{notion-FJCNQ6I7.js → notion-QOKRUE6M.js} +83 -97
- package/dist/{open_exchange_rates-WU57WTT5.js → open_exchange_rates-ODLFWEJ7.js} +35 -39
- package/dist/{openai-JODZ4GKT.js → openai-ZPBPPPGT.js} +51 -55
- package/dist/{opengraph_io-SQRAUSV5.js → opengraph_io-EOI5UJKT.js} +61 -79
- package/dist/{openrouter-Q5XXEJZ7.js → openrouter-BUWLF3BG.js} +41 -55
- package/dist/{outline-RT2EHJ2X.js → outline-NXS3QRXO.js} +89 -104
- package/dist/{paddle-OF2V7GAC.js → paddle-T4MSKQ76.js} +34 -49
- package/dist/{perplexity-LNZEWLHG.js → perplexity-WW5N2LW7.js} +33 -50
- package/dist/{pinecone-JSJIXZYN.js → pinecone-RY5AZPQM.js} +65 -91
- package/dist/{pipedrive-D4CKVUXR.js → pipedrive-OHYQNZTU.js} +37 -59
- package/dist/{polar-M7ZYP6UR.js → polar-XZIAHXS5.js} +43 -53
- package/dist/{posthog-YV7CZOH4.js → posthog-DTPTWORY.js} +58 -77
- package/dist/{postmark-KYHLECRG.js → postmark-F4UCQKC3.js} +52 -71
- package/dist/{prerender-HCMHBKV2.js → prerender-P3Y2MLIC.js} +32 -50
- package/dist/{pubmed-WYVLCCN3.js → pubmed-RHU3GXFB.js} +28 -60
- package/dist/{railway-TWIRD5KR.js → railway-VB6SRLI6.js} +32 -39
- package/dist/{readwise-UZ467IQ7.js → readwise-DIMSKJZR.js} +62 -78
- package/dist/{render-MECUC5CC.js → render-XCCDCEEK.js} +48 -64
- package/dist/{replicate-A5MEK3SW.js → replicate-IUEOQ4JC.js} +41 -58
- package/dist/{resend-BC6EAWJQ.js → resend-N5MJZH5E.js} +27 -37
- package/dist/{rootly-ZM3QDUIS.js → rootly-25T4NBTU.js} +64 -76
- package/dist/{scrapfly-WAML42QJ.js → scrapfly-PK4XFXUA.js} +45 -51
- package/dist/{scrapingbee-DG7PET3V.js → scrapingbee-ITPBMWQU.js} +25 -33
- package/dist/{screenshot_fyi-HY6WTHIO.js → screenshot_fyi-5U6ZYPKR.js} +29 -47
- package/dist/{semantic_scholar-C5IZA7IP.js → semantic_scholar-BJGCI2MU.js} +37 -56
- package/dist/{sentry-OKBPSTDM.js → sentry-63IC263P.js} +66 -85
- package/dist/{shodan-PPC6DYU4.js → shodan-2WBIFHFN.js} +42 -53
- package/dist/{shopify-EWGUHBXO.js → shopify-XLLJRAGM.js} +32 -49
- package/dist/{stripe-6RPDPC5W.js → stripe-WLVCY3UN.js} +4 -5
- package/dist/{supabase-SK7DQ42N.js → supabase-BKNZ35ER.js} +69 -88
- package/dist/{tavily-YCG5VQMH.js → tavily-YFSDEUTL.js} +37 -62
- package/dist/{telegram-2OES5FYB.js → telegram-FC35W74G.js} +168 -177
- package/dist/{telnyx-POOSBBR4.js → telnyx-MI32XZUG.js} +30 -50
- package/dist/{todoist-M7YD6YSS.js → todoist-4ZFJKZC6.js} +77 -89
- package/dist/{trello-IS6V5W3E.js → trello-UOGFNMK4.js} +108 -122
- package/dist/{turso-RCFHUFVH.js → turso-YTSTW3ZS.js} +52 -64
- package/dist/{twilio-OS2RXFGO.js → twilio-XAJDFUQH.js} +48 -55
- package/dist/{umami-PQ2SJ2LN.js → umami-ZVIUBPAI.js} +49 -69
- package/dist/{unsplash-C6BPZO4E.js → unsplash-IU3PLDNS.js} +35 -52
- package/dist/{upstash_redis-WH6UER7H.js → upstash_redis-3EYJW7SY.js} +28 -40
- package/dist/{uptimerobot-M3YZGS6Z.js → uptimerobot-PJG2ASRU.js} +11 -12
- package/dist/{v2ex-R4JWTEHN.js → v2ex-KFQWWGFC.js} +36 -61
- package/dist/{vercel-FZVYUOQD.js → vercel-I2ZDOQRL.js} +124 -150
- package/dist/{webapi-VLM4IKVB.js → webapi-GW5QXWXE.js} +1 -1
- package/dist/{wolfram_alpha_api-2KOLO5DC.js → wolfram_alpha_api-BNXOJMB6.js} +26 -34
- package/dist/{wordpress-XRWGO6LG.js → wordpress-36D7BSMP.js} +87 -104
- package/dist/{workos-WR4NKOYL.js → workos-6X4JJRRC.js} +37 -56
- package/dist/{zhihu-BKZIB3WA.js → zhihu-CIXKCHIU.js} +35 -57
- package/package.json +5 -5
- package/dist/chunk-2O27H4Y2.js +0 -183
- package/dist/chunk-GKX72JMJ.js +0 -378
- package/dist/chunk-MLKGABMK.js +0 -9
|
@@ -1,92 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderHttpClient
|
|
3
|
+
} from "./chunk-WW2IMPQK.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-
|
|
6
|
-
import
|
|
7
|
-
guardedFetch
|
|
8
|
-
} from "./chunk-2O27H4Y2.js";
|
|
9
|
-
import "./chunk-GKX72JMJ.js";
|
|
14
|
+
} from "./chunk-YASUMV2K.js";
|
|
15
|
+
import "./chunk-U5UHT7CX.js";
|
|
10
16
|
import {
|
|
11
17
|
TBError,
|
|
12
18
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-RVWZN3CI.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
|
|
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) =>
|
|
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 =
|
|
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(
|
|
61
|
-
if (typeof
|
|
62
|
-
const body =
|
|
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 =
|
|
55
|
+
const direct = trimmedText(body.message) ?? trimmedText(body.detail);
|
|
65
56
|
if (direct !== void 0) return direct;
|
|
66
|
-
const 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 =
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
|
83
|
+
const auth = credential(ctx);
|
|
84
|
+
const result = await http.request({
|
|
85
|
+
path: TOKEN_PATH,
|
|
106
86
|
method: "POST",
|
|
107
|
-
headers: {
|
|
108
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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(
|
|
141
|
-
const body = requireRecord(
|
|
124
|
+
function pageContainer(payload2) {
|
|
125
|
+
const body = requireRecord(payload2);
|
|
142
126
|
return {
|
|
143
|
-
count:
|
|
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(
|
|
150
|
-
const body = requireRecord(
|
|
133
|
+
function repositorySummary(payload2) {
|
|
134
|
+
const body = requireRecord(payload2);
|
|
151
135
|
return {
|
|
152
|
-
name:
|
|
153
|
-
namespace:
|
|
136
|
+
name: trimmedText(body.name) ?? "",
|
|
137
|
+
namespace: trimmedText(body.namespace) ?? "",
|
|
154
138
|
repositoryType: nullableText(body.repository_type),
|
|
155
|
-
status:
|
|
156
|
-
statusDescription:
|
|
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:
|
|
160
|
-
pullCount:
|
|
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:
|
|
169
|
-
slug:
|
|
152
|
+
name: trimmedText(item.name) ?? "",
|
|
153
|
+
slug: trimmedText(item.slug) ?? ""
|
|
170
154
|
})),
|
|
171
|
-
storageSize:
|
|
155
|
+
storageSize: integerValue(body.storage_size) ?? null
|
|
172
156
|
};
|
|
173
157
|
}
|
|
174
|
-
function repositoryDetail(
|
|
175
|
-
const body = requireRecord(
|
|
176
|
-
const permissions =
|
|
177
|
-
const immutable =
|
|
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:
|
|
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(
|
|
191
|
-
const body = requireRecord(
|
|
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:
|
|
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:
|
|
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
|
|
197
|
+
return asJsonObject(value) === void 0 ? [] : [image(value)];
|
|
214
198
|
}
|
|
215
|
-
function tag(
|
|
216
|
-
const body = requireRecord(
|
|
199
|
+
function tag(payload2) {
|
|
200
|
+
const body = requireRecord(payload2);
|
|
217
201
|
return {
|
|
218
|
-
id:
|
|
219
|
-
name:
|
|
220
|
-
creator:
|
|
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:
|
|
206
|
+
lastUpdater: integerValue(body.last_updater) ?? null,
|
|
223
207
|
lastUpdaterUsername: nullableText(body.last_updater_username),
|
|
224
|
-
repository:
|
|
225
|
-
fullSize:
|
|
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(
|
|
233
|
-
const body = requireRecord(
|
|
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(
|
|
250
|
-
const body = requireRecord(
|
|
233
|
+
function team(payload2) {
|
|
234
|
+
const body = requireRecord(payload2);
|
|
251
235
|
return {
|
|
252
|
-
id:
|
|
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:
|
|
240
|
+
memberCount: integerValue(body.member_count) ?? null
|
|
257
241
|
};
|
|
258
242
|
}
|
|
259
|
-
function teamMember(
|
|
260
|
-
const body = requireRecord(
|
|
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(
|
|
274
|
-
const body = requireRecord(
|
|
275
|
-
return
|
|
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(
|
|
295
|
-
const body = requireRecord(
|
|
296
|
-
const nested =
|
|
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 =
|
|
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(
|
|
314
|
-
const page = pageContainer(
|
|
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
|
|
308
|
+
const payload2 = await requestJson(ctx, {
|
|
325
309
|
path: path.repositories(input.namespace),
|
|
326
|
-
query:
|
|
310
|
+
query: compactDefined({
|
|
327
311
|
page: input.page,
|
|
328
312
|
page_size: input.pageSize,
|
|
329
|
-
name:
|
|
330
|
-
ordering:
|
|
313
|
+
name: trimmedText(input.name),
|
|
314
|
+
ordering: trimmedText(input.ordering)
|
|
331
315
|
})
|
|
332
316
|
});
|
|
333
|
-
return mapPage(
|
|
317
|
+
return mapPage(payload2, repositorySummary);
|
|
334
318
|
}
|
|
335
319
|
async function getRepository(input, ctx) {
|
|
336
|
-
const
|
|
337
|
-
return { repository: repositoryDetail(
|
|
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
|
|
324
|
+
const payload2 = await requestJson(ctx, {
|
|
341
325
|
path: path.repositories(input.namespace),
|
|
342
326
|
method: "POST",
|
|
343
|
-
body:
|
|
327
|
+
body: compactDefined({
|
|
344
328
|
namespace: input.namespace,
|
|
345
329
|
name: input.name,
|
|
346
|
-
description:
|
|
347
|
-
full_description:
|
|
348
|
-
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(
|
|
336
|
+
return { repository: repositoryDetail(payload2) };
|
|
353
337
|
}
|
|
354
338
|
async function getTag(input, ctx) {
|
|
355
|
-
const
|
|
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(
|
|
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
|
|
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(
|
|
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
|
|
363
|
+
const payload2 = await requestJson(ctx, {
|
|
380
364
|
path: `${path.org(input.orgName)}/members`,
|
|
381
|
-
query:
|
|
382
|
-
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:
|
|
387
|
-
role:
|
|
370
|
+
type: trimmedText(input.type),
|
|
371
|
+
role: trimmedText(input.role)
|
|
388
372
|
})
|
|
389
373
|
});
|
|
390
|
-
const unwrapped = Array.isArray(
|
|
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
|
|
378
|
+
const payload2 = await requestJson(ctx, {
|
|
395
379
|
path: "/v2/invites/bulk",
|
|
396
380
|
method: "POST",
|
|
397
|
-
body:
|
|
381
|
+
body: compactDefined({
|
|
398
382
|
org: input.orgName,
|
|
399
|
-
team:
|
|
400
|
-
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(
|
|
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
|
|
400
|
+
const payload2 = await requestJson(ctx, {
|
|
417
401
|
path: `${path.org(input.orgName)}/access-tokens`,
|
|
418
|
-
query:
|
|
402
|
+
query: compactDefined({ page: input.page, page_size: input.pageSize })
|
|
419
403
|
});
|
|
420
|
-
const body = requireRecord(
|
|
404
|
+
const body = requireRecord(payload2);
|
|
421
405
|
return {
|
|
422
|
-
total:
|
|
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
|
|
413
|
+
const payload2 = await requestJson(ctx, {
|
|
430
414
|
path: `${path.org(input.orgName)}/groups`,
|
|
431
|
-
query:
|
|
415
|
+
query: compactDefined({
|
|
432
416
|
page: input.page,
|
|
433
417
|
page_size: input.pageSize,
|
|
434
|
-
username:
|
|
435
|
-
search:
|
|
418
|
+
username: trimmedText(input.username),
|
|
419
|
+
search: trimmedText(input.search)
|
|
436
420
|
})
|
|
437
421
|
});
|
|
438
|
-
return mapPage(
|
|
422
|
+
return mapPage(payload2, team);
|
|
439
423
|
}
|
|
440
424
|
async function getTeam(input, ctx) {
|
|
441
|
-
const
|
|
442
|
-
return { team: team(
|
|
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
|
|
433
|
+
const payload2 = await requestJson(ctx, {
|
|
450
434
|
path: `${path.team(input.orgName, input.teamName)}/members`,
|
|
451
|
-
query:
|
|
435
|
+
query: compactDefined({ page: input.page, page_size: input.pageSize, search: trimmedText(input.search) })
|
|
452
436
|
});
|
|
453
|
-
return mapPage(
|
|
437
|
+
return mapPage(payload2, teamMember);
|
|
454
438
|
}
|
|
455
439
|
async function removeTeamMember(input, ctx) {
|
|
456
440
|
await requestNoContent(ctx, {
|