@vite-hub/forge 0.7.0 → 0.8.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 (25) hide show
  1. package/README.md +8 -2
  2. package/dist/{webhooks-Bc6QhmI8-CvF2iFBp.js → define-C9xZZNVR-C-oojQRP.js} +3 -997
  3. package/dist/{definition-BQFdu9ti-BURTyX81.js → definition-BQFdu9ti-BZgR-gkB.js} +5 -4
  4. package/dist/{github-Csy_qzZc.js → definition-s83gxg2p-JwDgFji9.js} +26 -28
  5. package/dist/{events-BL0zcgMf-DGySmhNt.js → events-BL0zcgMf-Exs7JLX1.js} +4 -2
  6. package/dist/{events-DDdJnmD2-BhNdO8U_.js → events-DDdJnmD2-CdPFePvp.js} +4 -3
  7. package/dist/{events-DHqSJ5KI-DfFbbwBb.js → events-DHqSJ5KI-mRtn-qQ0.js} +4 -3
  8. package/dist/{events-DXE-Ul2S-U2BH_jTW.js → events-DXE-Ul2S-BEUw4sQF.js} +4 -3
  9. package/dist/{feed-B1OiHFg0-a2dzl1Va.js → feed-B1OiHFg0-ppQHqkxG.js} +4 -2
  10. package/dist/{feed-DROLF1tb-A1eZev0R.js → feed-DROLF1tb-CMAanXw8.js} +4 -2
  11. package/dist/{feed-iWegqepj-id4yPYnY.js → feed-iWegqepj-DKBLqhvD.js} +4 -2
  12. package/dist/{forgejo-aZiaqKRW.js → forgejo-Deckk49p.js} +2 -2
  13. package/dist/{gitea-CCZ3fS7H.js → gitea-ChQKeRrf.js} +2 -2
  14. package/dist/{gitee-CKt4pEC0-dsy0hiLG.js → gitee-CKt4pEC0-BuzC1PrM.js} +1 -1
  15. package/dist/{gitlab-AAJN-eVR.js → gitlab-CzCikZzN.js} +5 -4
  16. package/dist/{graphql-DxRA9BGO-CiA7HWVp.js → graphql-DxRA9BGO-Cy511t8-.js} +2 -1
  17. package/dist/index.d.ts +50 -4
  18. package/dist/index.js +187 -20
  19. package/dist/kit-CrquHPqr.js +4 -0
  20. package/dist/{templates-0m5QBVIh-Bop0TOo9.js → templates-0m5QBVIh-C1DcQ_yo.js} +1 -2
  21. package/dist/utils-DEwhctg5-BM3AMnSs.js +1213 -0
  22. package/dist/webhooks-Bc6QhmI8-CgoCnwj1.js +71 -0
  23. package/package.json +2 -2
  24. package/dist/kit-UEdJKGws.js +0 -3
  25. package/dist/model-Biiu1CfI-CVLamGai.js +0 -288
@@ -1,5 +1,5 @@
1
- import { a as timingSafeEqual, n as headerValue, o as toBase64, r as hmacSha256Hex } from "./crypto-DydCoK4e-BCG61qh5.js";
2
- import { C as TokenRevokedError, D as forbiddenReason, E as WebhookVerificationError, O as isSecondaryRateLimit, S as ReadOnlyError, T as UnsupportedOperationError, _ as InsufficientScopeError, a as namespaceRef, b as NotFoundError, d as ContentNotTextError, f as ForbiddenError, g as ForgeTimeoutError, h as ForgeNetworkError, i as isUnsupported, l as AuthenticationRequiredError, m as ForgeError, n as isNamespaceRef, o as normaliseRepoName, p as ForgeApiError, r as isResolvedThread, w as UnresolvedThreadError, x as RateLimitedError } from "./model-Biiu1CfI-CVLamGai.js";
1
+ import { o as toBase64 } from "./crypto-DydCoK4e-BCG61qh5.js";
2
+ import { G as isUnsupported, K as namespaceRef, Q as ContentNotTextError, W as isResolvedThread, a as createFetcher, ct as ReadOnlyError, dt as UnsupportedOperationError, ft as WebhookVerificationError, g as iteratePages, h as isFirstPage, ot as NotFoundError, q as normaliseRepoName, s as createRequest, u as forgeIterable, y as memo } from "./utils-DEwhctg5-BM3AMnSs.js";
3
3
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/contents-NHE4zdZf.mjs
4
4
  /** Decodes base64, tolerating the newlines GitHub and Gitea wrap it in. */
5
5
  function fromBase64(value) {
@@ -80,931 +80,6 @@ function splitMessage(message) {
80
80
  function isSha(ref) {
81
81
  return /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i.test(ref);
82
82
  }
83
- // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/utils-DEwhctg5.mjs
84
- const BODY_EXCERPT_LENGTH = 512;
85
- const REDIRECT_STATUSES = /* @__PURE__ */ new Set([
86
- 301,
87
- 302,
88
- 303,
89
- 307,
90
- 308
91
- ]);
92
- /** A forge's plain-text rate limit refusal, such as Gitee's `403 Forbidden (Rate Limit Exceeded)`. */
93
- const PLAIN_RATE_LIMIT_RE = /^[^{<]{0,80}\brate limit exceeded\b/i;
94
- const DOT_SEGMENT_RE = /^(?:\.|%2e){1,2}$/i;
95
- /** Parses an RFC 5988 `Link` header into a map of rel to URL. */
96
- function parseLinkHeader(header) {
97
- const links = {};
98
- if (!header) return links;
99
- for (const part of header.split(",")) {
100
- const match = /^<([^>]+)>\s*;\s*(.+)/.exec(part.trim());
101
- if (!match?.[1] || !match[2]) continue;
102
- const rel = /rel\s*=\s*"?([^";]+)"?/.exec(match[2])?.[1];
103
- if (rel) links[rel.trim()] = match[1];
104
- }
105
- return links;
106
- }
107
- function cursorFrom(response) {
108
- const next = parseLinkHeader(response.headers.get("link")).next;
109
- const etag = response.headers.get("etag") ?? void 0;
110
- if (!next && !etag) return;
111
- return {
112
- nextUrl: next,
113
- etag
114
- };
115
- }
116
- /** The page size a URL carries, under the names forges use for it. */
117
- function pageSize(url) {
118
- for (const name of [
119
- "per_page",
120
- "limit",
121
- "perPage",
122
- "pagelen"
123
- ]) {
124
- const value = Number(url.searchParams.get(name));
125
- if (Number.isInteger(value) && value > 0) return value;
126
- }
127
- }
128
- /**
129
- * The exact total a response reports in a pagination header. GitLab sends
130
- * `x-total`, and Forgejo and Gitea send `x-total-count`. A Forgejo or Gitea
131
- * timeline reports the page's own length there, so a count no larger than the
132
- * page is ignored for timeline requests; everywhere else it is exact, even
133
- * when it equals the number of items on a single page.
134
- */
135
- function headerTotal(response, itemCount, requestUrl) {
136
- const total = headerNumber(response, "x-total");
137
- if (total !== void 0) return total;
138
- const counted = headerNumber(response, "x-total-count");
139
- if (counted === void 0) return;
140
- return counted <= itemCount && /\/timeline(?:\?|$)/.test(requestUrl) ? void 0 : counted;
141
- }
142
- /**
143
- * The total a `Link` header implies: the page number of its `rel="last"`
144
- * entry times the page size that URL, or the request URL, reports. GitHub,
145
- * GitLab, Forgejo and Gitea page by number, so their last page times their
146
- * page size approximates the total. A last page of one means a single page,
147
- * whose total is the items on it. `undefined` when the header carries no
148
- * usable last page.
149
- */
150
- function linkTotal(header, requestUrl, itemCount) {
151
- const last = parseLinkHeader(header).last;
152
- if (!last) return;
153
- let lastUrl;
154
- let request;
155
- try {
156
- lastUrl = new URL(last);
157
- request = new URL(requestUrl);
158
- } catch {
159
- return;
160
- }
161
- const page = Number(lastUrl.searchParams.get("page"));
162
- if (!Number.isInteger(page) || page < 1) return;
163
- if (page === 1) return itemCount;
164
- const size = pageSize(lastUrl) ?? pageSize(request);
165
- return size === void 0 ? void 0 : page * size;
166
- }
167
- function retryAfterMs(response) {
168
- const header = response.headers.get("retry-after");
169
- if (!header) return;
170
- const seconds = Number(header);
171
- if (Number.isFinite(seconds)) return seconds * 1e3;
172
- const date = Date.parse(header);
173
- return Number.isNaN(date) ? void 0 : Math.max(0, date - Date.now());
174
- }
175
- /** `x-ratelimit-reset` and `ratelimit-reset` hold a Unix time in seconds on some forges, and seconds from now on others. */
176
- function resetDate(response, now) {
177
- const reset = headerNumber(response, "x-ratelimit-reset", "ratelimit-reset");
178
- if (reset === void 0) return;
179
- return new Date(reset > 1e9 ? reset * 1e3 : now + reset * 1e3);
180
- }
181
- /** A budget with requests left resets on its own schedule, which says nothing about when a secondary limit lifts. */
182
- function rateLimitReset(response, budget) {
183
- const after = retryAfterMs(response);
184
- if (after !== void 0) return new Date(Date.now() + after);
185
- return budget?.remaining ? void 0 : budget?.resetAt;
186
- }
187
- /** The leading number of the first of `names` to hold one, such as `60` of `60, 60;w=3600`. */
188
- function headerNumber(response, ...names) {
189
- for (const name of names) {
190
- const value = response.headers.get(name)?.split(/[,;]/, 1)[0].trim();
191
- if (value && Number.isFinite(Number(value))) return Number(value);
192
- }
193
- }
194
- /** The members of a structured-field list such as `"burst";r=10;t=5, "day";r=900;t=3600`, by name. */
195
- function fieldMembers(response, name) {
196
- const members = /* @__PURE__ */ new Map();
197
- for (const member of response.headers.get(name)?.split(",") ?? []) {
198
- const [key = "", ...params] = member.split(";");
199
- members.set(key.trim().replace(/^"(.*)"$/, "$1"), Object.fromEntries(params.map((param) => {
200
- const [field = "", value] = param.split("=");
201
- return [field.trim(), Number(value)];
202
- })));
203
- }
204
- return members;
205
- }
206
- /** The IETF `ratelimit` and `ratelimit-policy` fields, for the policy with the fewest requests left. */
207
- function structuredRateLimit(response, now) {
208
- const [name, state] = [...fieldMembers(response, "ratelimit")].filter(([, params]) => Number.isFinite(params.r)).sort(([, a], [, b]) => a.r - b.r)[0] ?? [];
209
- if (!state) return;
210
- const limit = fieldMembers(response, "ratelimit-policy").get(name)?.q;
211
- return {
212
- ...Number.isFinite(limit) ? { limit } : {},
213
- remaining: state.r,
214
- ...Number.isFinite(state.t) ? { resetAt: new Date(now + state.t * 1e3) } : {},
215
- ...name ? { resource: name } : {}
216
- };
217
- }
218
- /** The request budget a response reports, from `x-ratelimit-*` or `ratelimit-*` headers, or the IETF `ratelimit` field. */
219
- function rateLimitOf(response, now = Date.now()) {
220
- const limit = headerNumber(response, "x-ratelimit-limit", "ratelimit-limit");
221
- const remaining = headerNumber(response, "x-ratelimit-remaining", "ratelimit-remaining");
222
- const reset = resetDate(response, now);
223
- if (limit === void 0 && remaining === void 0 && reset === void 0) return structuredRateLimit(response, now);
224
- const resource = response.headers.get("x-ratelimit-resource") || response.headers.get("ratelimit-name") || void 0;
225
- return {
226
- ...limit === void 0 ? {} : { limit },
227
- ...remaining === void 0 ? {} : { remaining },
228
- ...reset === void 0 ? {} : { resetAt: reset },
229
- ...resource === void 0 ? {} : { resource }
230
- };
231
- }
232
- /** Whether the `message` or an `errors[].message` of a JSON error body names a secondary rate limit. */
233
- function scopeList(header) {
234
- return header === null ? void 0 : header.split(",").map((scope) => scope.trim()).filter(Boolean);
235
- }
236
- function namesSecondaryRateLimit(body) {
237
- let parsed;
238
- try {
239
- parsed = JSON.parse(body);
240
- } catch {
241
- return false;
242
- }
243
- const { message, errors } = parsed ?? {};
244
- return [message, ...Array.isArray(errors) ? errors.map((error) => error?.message) : []].some((text) => typeof text === "string" && isSecondaryRateLimit(text));
245
- }
246
- /** GitHub sends a secondary limit as a 403 or a 429, and its content creation limit can arrive as a 422. */
247
- function isRateLimited(response, budget, body) {
248
- if (response.status === 429) return true;
249
- if ((response.status === 403 || response.status === 422) && namesSecondaryRateLimit(body)) return true;
250
- if (response.status !== 403 || budget?.limit === 0) return false;
251
- return budget?.remaining === 0 || response.headers.has("retry-after") || !budget && PLAIN_RATE_LIMIT_RE.test(body.trim());
252
- }
253
- /**
254
- * One signal that aborts when any of `signals` does. `AbortSignal.any` would
255
- * do this, but StarlingMonkey (the wasm runtime) does not implement it.
256
- */
257
- function anySignal(signals) {
258
- const aborted = signals.find((signal) => signal.aborted);
259
- if (aborted) return aborted;
260
- if (signals.length === 1) return signals[0];
261
- const controller = new AbortController();
262
- const listeners = [];
263
- for (const signal of signals) {
264
- const listener = () => {
265
- controller.abort(signal.reason);
266
- for (const [other, removed] of listeners) other.removeEventListener("abort", removed);
267
- };
268
- listeners.push([signal, listener]);
269
- signal.addEventListener("abort", listener, { once: true });
270
- }
271
- return controller.signal;
272
- }
273
- function assertUrl(url) {
274
- if (url.protocol !== "https:" && url.protocol !== "http:" || url.username || url.password) throw new TypeError("Invalid request URL");
275
- return url;
276
- }
277
- function assertInput(input) {
278
- for (const char of input) {
279
- const code = char.charCodeAt(0);
280
- if (code <= 32 || code === 127) throw new TypeError("Invalid request URL");
281
- }
282
- }
283
- function assertRelativePath(path) {
284
- const pathname = path.split("?", 1)[0];
285
- if (path.includes("#") || pathname.includes("\\") || pathname.split("/").some((segment) => DOT_SEGMENT_RE.test(segment))) throw new TypeError(`Unsafe request path ${JSON.stringify(path)}; check the refs passed to the provider`);
286
- return path;
287
- }
288
- function sleep(ms, signal) {
289
- return new Promise((resolve, reject) => {
290
- if (signal?.aborted) {
291
- reject(signal.reason);
292
- return;
293
- }
294
- const timer = setTimeout(() => {
295
- signal?.removeEventListener("abort", onAbort);
296
- resolve();
297
- }, ms);
298
- function onAbort() {
299
- clearTimeout(timer);
300
- reject(signal.reason);
301
- }
302
- signal?.addEventListener("abort", onAbort, { once: true });
303
- });
304
- }
305
- /** Settles as `promise` does, or rejects with the signal's reason once it aborts, leaving `promise` running. */
306
- function abortable(promise, signal) {
307
- if (!signal) return promise;
308
- if (signal.aborted) return Promise.reject(signal.reason);
309
- return new Promise((resolve, reject) => {
310
- const onAbort = () => reject(signal.reason);
311
- signal.addEventListener("abort", onAbort, { once: true });
312
- promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
313
- });
314
- }
315
- /**
316
- * Creates a fetcher for one forge API.
317
- * @param options The base URL and the credentials, timeout and error context of every request.
318
- */
319
- function createFetcher(options) {
320
- const timeout = options.timeout ?? 3e4;
321
- const doFetch = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
322
- assertInput(options.baseUrl);
323
- const base = assertUrl(new URL(options.baseUrl));
324
- if (base.search || base.hash) throw new TypeError("Invalid API base URL");
325
- base.pathname = `${base.pathname.replace(/\/$/, "")}/`;
326
- const baseOrigin = base.origin;
327
- function resolve(path, query) {
328
- assertInput(path);
329
- let url;
330
- try {
331
- url = new URL(path);
332
- } catch {
333
- if (path.startsWith("//") || path.split("/", 1)[0].includes(":")) throw new TypeError("Invalid request URL");
334
- }
335
- url = assertUrl(url ?? new URL(assertRelativePath(path).replace(/^\//, ""), base));
336
- for (const [key, value] of Object.entries(query ?? {})) if (value !== void 0) url.searchParams.set(key, String(value));
337
- return url.toString();
338
- }
339
- function withDefaultQuery(url) {
340
- if (!options.query) return url;
341
- const target = new URL(url);
342
- for (const [key, value] of Object.entries(options.query)) if (!target.searchParams.has(key)) target.searchParams.set(key, value);
343
- return target.toString();
344
- }
345
- async function send(url, options_, attempt, authenticated = true, download = false, redirects = 0, streaming = false, follow = false) {
346
- const target = assertUrl(new URL(url));
347
- const trusted = authenticated && target.origin === baseOrigin;
348
- const controller = streaming ? new AbortController() : void 0;
349
- const timer = controller ? setTimeout(() => controller.abort(new DOMException("Request timed out", "TimeoutError")), timeout) : void 0;
350
- const signals = [controller?.signal ?? AbortSignal.timeout(timeout)];
351
- if (options_.signal) signals.push(options_.signal);
352
- const headers = new Headers(trusted ? options.headers : void 0);
353
- for (const [key, value] of Object.entries(trusted ? await (options.authHeaders?.() ?? {}) : {})) headers.set(key, value);
354
- for (const [key, value] of new Headers(options_.headers)) headers.set(key, value);
355
- if (options_.etag) headers.set("if-none-match", options_.etag);
356
- const { json: payload, mapError: _mapError, ...init } = options_;
357
- if (payload !== void 0) headers.set("content-type", "application/json");
358
- let response;
359
- try {
360
- response = await doFetch(trusted ? withDefaultQuery(url) : url, {
361
- ...init,
362
- redirect: follow ? "follow" : "manual",
363
- credentials: trusted ? init.credentials : "omit",
364
- headers,
365
- body: payload === void 0 ? init.body : JSON.stringify(payload),
366
- signal: anySignal(signals)
367
- });
368
- } catch (cause) {
369
- if (options_.signal?.aborted) throw options_.signal.reason ?? cause;
370
- if (cause instanceof Error && (cause.name === "TimeoutError" || cause.name === "AbortError")) throw new ForgeTimeoutError(`Request to ${url} timed out after ${timeout}ms`, timeout, {
371
- ...options.context,
372
- url,
373
- method: options_.method ?? "GET"
374
- }, { cause });
375
- const inner = cause instanceof Error ? cause.cause : void 0;
376
- const reason = typeof inner?.code === "string" ? inner.code : inner?.message;
377
- throw new ForgeNetworkError(`Request to ${url} failed: ${cause instanceof Error ? cause.message : String(cause)}${typeof reason === "string" && reason ? ` (${reason})` : ""}`, {
378
- ...options.context,
379
- url,
380
- method: options_.method ?? "GET"
381
- }, { cause });
382
- } finally {
383
- clearTimeout(timer);
384
- }
385
- if (response.type === "opaqueredirect" && options_.redirect !== "manual") {
386
- const method = (options_.method ?? "GET").toUpperCase();
387
- if (options_.redirect === "error" || method !== "GET" && method !== "HEAD") throw new TypeError("Hidden redirect refused");
388
- return send(url, options_, attempt, authenticated, download, redirects, streaming, true);
389
- }
390
- if (follow && response.redirected && response.url) {
391
- const final = assertUrl(new URL(response.url));
392
- if (final.origin !== target.origin && !download || target.protocol === "https:" && final.protocol !== "https:") {
393
- await response.body?.cancel();
394
- throw new TypeError("Unsafe request redirect");
395
- }
396
- }
397
- const budget = rateLimitOf(response);
398
- if (budget && options.onRateLimit && target.origin === baseOrigin) options.onRateLimit({
399
- url,
400
- method: options_.method ?? "GET",
401
- rateLimit: budget
402
- });
403
- const location = REDIRECT_STATUSES.has(response.status) ? response.headers.get("location") : null;
404
- if (location && options_.redirect !== "manual") {
405
- await response.body?.cancel();
406
- if (options_.redirect === "error" || redirects >= 20) throw new TypeError("Request redirect refused");
407
- assertInput(location);
408
- const next = assertUrl(new URL(location, target));
409
- const sameOrigin = next.origin === target.origin;
410
- if (!sameOrigin && !download || target.protocol === "https:" && next.protocol !== "https:") throw new TypeError("Unsafe request redirect");
411
- const method = (options_.method ?? "GET").toUpperCase();
412
- if (!sameOrigin && method !== "GET" && method !== "HEAD") throw new TypeError("Unsafe request redirect");
413
- let nextOptions = options_;
414
- if (!sameOrigin) nextOptions = {
415
- method,
416
- signal: options_.signal,
417
- credentials: "omit"
418
- };
419
- else if (response.status === 303 && method !== "HEAD" || (response.status === 301 || response.status === 302) && method === "POST") {
420
- const nextHeaders = new Headers(options_.headers);
421
- for (const name of [
422
- "content-type",
423
- "content-length",
424
- "content-encoding",
425
- "content-language",
426
- "content-location"
427
- ]) nextHeaders.delete(name);
428
- nextOptions = {
429
- ...options_,
430
- method: "GET",
431
- body: void 0,
432
- json: void 0,
433
- headers: nextHeaders
434
- };
435
- }
436
- return send(next.toString(), nextOptions, attempt, authenticated && sameOrigin, download, redirects + 1, streaming);
437
- }
438
- if (response.ok || response.status === 304 || options_.redirect === "manual" && (response.type === "opaqueredirect" || response.status >= 300 && response.status < 400)) return response;
439
- const text = await response.text();
440
- const body = text.slice(0, BODY_EXCERPT_LENGTH);
441
- const context = {
442
- ...options.context,
443
- url,
444
- method: options_.method ?? "GET"
445
- };
446
- const credentialed = trusted && options.authenticated || headers.has("authorization");
447
- if (response.status === 401) throw credentialed ? new TokenRevokedError("Credentials were rejected by the forge", 401, body, context) : new AuthenticationRequiredError("Credentials are required for this request", 401, body, context);
448
- if (response.status === 403 && !credentialed && budget?.limit === 0) throw new AuthenticationRequiredError("Credentials are required for this request", 403, body, context);
449
- if (response.status === 404) throw new NotFoundError(`Nothing found at ${options_.method ?? "GET"} ${url}, or the credential cannot see it`, 404, body, context);
450
- if (isRateLimited(response, budget, text)) {
451
- const secondary = namesSecondaryRateLimit(text) || budget?.remaining !== 0 && (response.status !== 429 || response.headers.has("retry-after"));
452
- const wait = retryAfterMs(response);
453
- if (attempt === 0 && wait !== void 0 && wait <= 6e4) {
454
- options.onRetry?.({
455
- url,
456
- method: options_.method ?? "GET",
457
- wait
458
- });
459
- await sleep(wait, options_.signal);
460
- return send(url, options_, attempt + 1, authenticated, download, redirects, streaming, follow);
461
- }
462
- throw new RateLimitedError("Rate limited by the forge", response.status, body, {
463
- ...context,
464
- resetAt: rateLimitReset(response, budget),
465
- secondary
466
- });
467
- }
468
- if (response.status === 403) {
469
- const acceptedScopes = scopeList(response.headers.get("x-accepted-oauth-scopes"));
470
- const grantedScopes = scopeList(response.headers.get("x-oauth-scopes"));
471
- const missingScope = acceptedScopes?.length && !acceptedScopes.some((scope) => grantedScopes?.includes(scope));
472
- const ssoUrl = response.headers.get("x-github-sso")?.match(/\burl=(\S+)/)?.[1];
473
- const forbidden = missingScope ? void 0 : ssoUrl ? {
474
- reason: "sso_required",
475
- reasonRaw: forbiddenReason(body)?.reasonRaw
476
- } : forbiddenReason(body);
477
- if (!forbidden) {
478
- const acceptedPermissionsRaw = response.headers.get("x-accepted-github-permissions") || void 0;
479
- throw new InsufficientScopeError("Credentials lack the scope or permission for this request", 403, body, {
480
- ...context,
481
- acceptedScopes,
482
- grantedScopes,
483
- acceptedPermissionsRaw
484
- });
485
- }
486
- throw new ForbiddenError(`Forge refused the request (${forbidden.reason})`, 403, body, forbidden.reason, {
487
- ...context,
488
- reasonRaw: forbidden.reasonRaw,
489
- ssoUrl
490
- });
491
- }
492
- throw new ForgeApiError(`Forge responded with ${response.status} for ${options_.method ?? "GET"} ${url}`, response.status, body, context);
493
- }
494
- async function raw(path, options_ = {}) {
495
- try {
496
- return await send(resolve(path, options_.query), options_, 0);
497
- } catch (error) {
498
- throw options_.mapError ? options_.mapError(error) : error;
499
- }
500
- }
501
- async function json(path, options_ = {}) {
502
- const response = await raw(path, options_);
503
- if (response.status === 304 || response.status === 204) return {
504
- data: void 0,
505
- response,
506
- notModified: response.status === 304,
507
- cursor: cursorFrom(response)
508
- };
509
- const text = await response.text();
510
- return {
511
- data: text ? parseJson(text) : void 0,
512
- response,
513
- notModified: false,
514
- cursor: cursorFrom(response)
515
- };
516
- }
517
- async function page(path, options_ = {}) {
518
- const { select, cursor, conditional = true, ...requestOptions } = options_;
519
- const initial = resolve(path, requestOptions.query);
520
- const url = cursor?.nextUrl ? resolve(cursor.nextUrl) : initial;
521
- if (new URL(url).origin !== new URL(initial).origin) throw new TypeError("Pagination URL must remain on the requested origin");
522
- const first = conditional && !cursor?.nextUrl && !cursor?.token;
523
- const sent = first ? requestOptions.etag ?? cursor?.etag : void 0;
524
- const result = await json(url, {
525
- ...requestOptions,
526
- etag: sent,
527
- query: void 0
528
- });
529
- const validator = first ? result.response.headers.get("etag") ?? (result.notModified ? sent : void 0) : void 0;
530
- const etag = validator ? { etag: validator } : {};
531
- if (result.notModified) return {
532
- ...result,
533
- data: [],
534
- cursor: void 0,
535
- ...etag
536
- };
537
- const next = select ? select(result.data, result.cursor?.nextUrl) : void 0;
538
- const items = next ? next.items : result.data ?? [];
539
- const total = next?.total ?? headerTotal(result.response, items.length, url) ?? linkTotal(result.response.headers.get("link"), url, items.length);
540
- if (!next) return {
541
- ...result,
542
- data: items,
543
- cursor: result.cursor?.nextUrl ? result.cursor : void 0,
544
- ...total !== void 0 ? { total } : {},
545
- ...etag
546
- };
547
- return {
548
- ...result,
549
- data: items,
550
- cursor: next.next ? {
551
- ...result.cursor,
552
- nextUrl: next.next
553
- } : void 0,
554
- ...total !== void 0 ? { total } : {},
555
- ...etag
556
- };
557
- }
558
- async function* items(path, options_ = {}) {
559
- let cursor;
560
- do {
561
- const result = await page(path, {
562
- ...options_,
563
- cursor
564
- });
565
- yield* result.data ?? [];
566
- cursor = result.notModified ? void 0 : result.cursor;
567
- } while (cursor?.nextUrl);
568
- }
569
- async function stream(path, options_ = {}) {
570
- try {
571
- const response = await send(resolve(path, options_.query), options_, 0, true, true, 0, true);
572
- return {
573
- status: response.status,
574
- headers: response.headers,
575
- body: response.body ?? emptyStream()
576
- };
577
- } catch (error) {
578
- throw options_.mapError ? options_.mapError(error) : error;
579
- }
580
- }
581
- return {
582
- raw,
583
- stream,
584
- json,
585
- page,
586
- items,
587
- resolve
588
- };
589
- }
590
- const LONG_NUMBER_RE = /\d{16}/;
591
- const INTEGER_RE = /^-?\d+$/;
592
- /**
593
- * Parses JSON, keeping integers beyond `Number.MAX_SAFE_INTEGER` (such as
594
- * GitHub webhook delivery ids) as their exact digits, where the runtime gives
595
- * the reviver the source text.
596
- */
597
- function parseJson(text) {
598
- if (!LONG_NUMBER_RE.test(text)) return JSON.parse(text);
599
- return JSON.parse(text, (_key, value, context) => typeof value === "number" && !Number.isSafeInteger(value) && context?.source && INTEGER_RE.test(context.source) ? context.source : value);
600
- }
601
- function emptyStream() {
602
- return new Blob([]).stream();
603
- }
604
- const SAFE_METHODS = /* @__PURE__ */ new Set([
605
- "GET",
606
- "HEAD",
607
- "OPTIONS"
608
- ]);
609
- /**
610
- * Builds a provider's `request()` escape hatch on top of its fetcher.
611
- * @param fetcher The fetcher to send requests with.
612
- * @param createOptions Where to reject writes, for a read-only provider.
613
- */
614
- function createRequest(fetcher, createOptions = {}) {
615
- const { readOnly } = createOptions;
616
- return (async (method, path, options = {}) => {
617
- const upperMethod = method.toUpperCase();
618
- if (readOnly && (options.mutates ?? !SAFE_METHODS.has(upperMethod))) throw readOnly(upperMethod, path);
619
- const json = options.body !== void 0 && isJsonBody(options.body);
620
- const init = {
621
- method: upperMethod,
622
- query: options.query,
623
- signal: options.signal,
624
- headers: {
625
- ...json ? { "content-type": "application/json" } : {},
626
- ...options.headers
627
- },
628
- body: options.body === void 0 ? void 0 : json ? JSON.stringify(options.body) : options.body
629
- };
630
- if ("raw" in options && options.raw) return fetcher.stream(path, init);
631
- const result = await fetcher.json(path, init);
632
- const rateLimit = rateLimitOf(result.response);
633
- return {
634
- status: result.response.status,
635
- data: result.data,
636
- headers: result.response.headers,
637
- ...rateLimit ? { rateLimit } : {}
638
- };
639
- });
640
- }
641
- function isJsonBody(value) {
642
- return typeof value !== "string" && !(value instanceof ArrayBuffer) && !ArrayBuffer.isView(value) && !(typeof Blob !== "undefined" && value instanceof Blob) && !(typeof FormData !== "undefined" && value instanceof FormData) && !(value instanceof URLSearchParams) && !(typeof ReadableStream !== "undefined" && value instanceof ReadableStream);
643
- }
644
- /**
645
- * Wraps a generator so warnings it reports are collected on the returned
646
- * iterable rather than interrupting iteration.
647
- */
648
- function forgeIterable(run) {
649
- const warnings = [];
650
- return {
651
- warnings,
652
- [Symbol.asyncIterator]: () => run((warning) => warnings.push(warning))[Symbol.asyncIterator]()
653
- };
654
- }
655
- /** Drives a `page()` function until it reports no further cursor, collecting page warnings. */
656
- function iteratePages(page, options = {}) {
657
- return forgeIterable(async function* (warn) {
658
- let cursor = options.cursor;
659
- while (true) {
660
- const result = await page({
661
- ...options,
662
- cursor
663
- });
664
- result.warnings?.forEach(warn);
665
- yield* result.items;
666
- if (!result.cursor?.nextUrl && !result.cursor?.token || result.notModified) return;
667
- cursor = result.cursor;
668
- }
669
- });
670
- }
671
- /** Turns a caught error into a serialisable warning. */
672
- function toWarning(code, error, subject) {
673
- const err = error instanceof Error ? error : new Error(String(error));
674
- return {
675
- code,
676
- message: err.message,
677
- subject,
678
- cause: {
679
- name: err.name,
680
- message: err.message,
681
- status: err instanceof ForgeApiError ? err.status : void 0
682
- }
683
- };
684
- }
685
- /** Whether a failed side read may become a warning; rate limits, revoked tokens and errors from outside forges still stop the read. */
686
- function degradesToWarning(error) {
687
- return error instanceof ForgeError && !(error instanceof RateLimitedError) && !(error instanceof TokenRevokedError);
688
- }
689
- /** Maps with at most `limit` calls in flight, preserving order. Once a call rejects, no further calls start. */
690
- async function mapConcurrent(items, limit, fn) {
691
- const results = Array.from({ length: items.length });
692
- let next = 0;
693
- let failed = false;
694
- await Promise.all(Array.from({ length: Math.min(limit, items.length) }, async () => {
695
- while (!failed && next < items.length) {
696
- const index = next++;
697
- try {
698
- results[index] = await fn(items[index]);
699
- } catch (error) {
700
- failed = true;
701
- throw error;
702
- }
703
- }
704
- }));
705
- return results;
706
- }
707
- /** `threads.getMany` for forges without a batch endpoint. A rate limit or a rejected credential rejects the call; other failures become per-item warnings. */
708
- function getManyConcurrently(refs, get, options = {}) {
709
- return mapConcurrent(refs, 4, (ref) => get(ref, options).then((thread) => ({
710
- ok: true,
711
- ref,
712
- thread
713
- }), (error) => {
714
- if (options.signal?.aborted) throw options.signal.reason;
715
- if (error instanceof ForgeError && !degradesToWarning(error)) throw error;
716
- return {
717
- ok: false,
718
- ref,
719
- warning: toWarning(error instanceof UnresolvedThreadError ? "thread_unresolved" : "thread_unreadable", error, ref.number)
720
- };
721
- }));
722
- }
723
- /** The comment that a notification's `latest_comment_url` names: an issue comment on a thread subject with a number, or a comment on a commit subject. */
724
- function latestCommentOf(subject, url) {
725
- if (subject.type === "commit") {
726
- const id = /\/repos\/[^/]+\/[^/]+\/comments\/(\d+)$/.exec(url ?? "")?.[1];
727
- return id ? {
728
- forge: subject.commit.forge,
729
- instance: subject.commit.instance,
730
- commit: subject.commit,
731
- id
732
- } : void 0;
733
- }
734
- const id = /\/issues\/comments\/(\d+)$/.exec(url ?? "")?.[1];
735
- if (!id || subject.type !== "thread" || !isResolvedThread(subject.thread)) return;
736
- return {
737
- forge: subject.thread.forge,
738
- instance: subject.thread.instance,
739
- thread: subject.thread,
740
- id
741
- };
742
- }
743
- /** Compares dotted numeric versions, ignoring any suffix after the numbers. */
744
- function versionAtLeast(version, minimum) {
745
- if (!version) return false;
746
- const parts = (value) => (/^\D*(\d+(?:\.\d+)*)/.exec(value)?.[1] ?? "0").split(".").map(Number);
747
- const [a, b] = [parts(version), parts(minimum)];
748
- for (let index = 0; index < Math.max(a.length, b.length); index++) {
749
- const difference = (a[index] ?? 0) - (b[index] ?? 0);
750
- if (difference !== 0) return difference > 0;
751
- }
752
- return true;
753
- }
754
- /** Reads a timestamp from a forge response, or `undefined` when it is empty or not a date. */
755
- function toDate(value) {
756
- if (value === null || value === void 0 || value === "") return;
757
- const date = new Date(value);
758
- return Number.isNaN(date.getTime()) ? void 0 : date;
759
- }
760
- /** The host of `baseUrl`, including the port when there is one. */
761
- function hostOf(baseUrl) {
762
- return new URL(baseUrl).host;
763
- }
764
- /** The namespace ref of `ref`'s owner, for the `org` of a team's ref. */
765
- function teamOrg(ref) {
766
- return isNamespaceRef(ref) ? ref : namespaceRef(ref, ref.owner);
767
- }
768
- /** Narrows a ref to one a provider can address, or throws {@link UnresolvedThreadError}. */
769
- function requireThread(ref, context) {
770
- if (!isResolvedThread(ref)) throw new UnresolvedThreadError("Thread ref has no number; resolve it before calling the forge", context ?? {
771
- forge: ref.forge,
772
- instance: ref.instance
773
- });
774
- return ref;
775
- }
776
- /**
777
- * Narrows a ref to an issue or pull request, or throws
778
- * {@link UnsupportedOperationError} naming the verb that needs one.
779
- */
780
- function requireIssueOrPull(ref, context, verb) {
781
- const thread = requireThread(ref, context);
782
- if (thread.kind !== "issue" && thread.kind !== "pull_request") throw new UnsupportedOperationError(`${context.forge ?? "This forge"} cannot ${verb} a ${thread.kind}`, context);
783
- return thread;
784
- }
785
- /** The token in `auth`, read again on every call when it is a function. */
786
- async function resolveToken(auth) {
787
- return typeof auth.token === "function" ? await auth.token() : auth.token;
788
- }
789
- /**
790
- * The forge-native id `threads.setMilestone` sends: the milestone's `id`, a
791
- * string of digits as it is, or the id of the milestone with that title.
792
- */
793
- async function milestoneId(milestone, page, context, options = {}) {
794
- const value = typeof milestone === "string" ? milestone : milestone.id;
795
- if (/^\d+$/.test(value)) return Number(value);
796
- for await (const candidate of iteratePages(page, {
797
- state: "all",
798
- signal: options.signal
799
- })) if (candidate.title === value) return Number(candidate.id);
800
- throw new UnsupportedOperationError(`No milestone titled ${value}`, context);
801
- }
802
- /** Joins the merge commit title and message for a forge that takes them as one string. */
803
- function mergeCommitMessage({ title, message }) {
804
- return title && message ? `${title}\n\n${message}` : title || message;
805
- }
806
- /** A login from either a login string or an actor. */
807
- function actorLogin(actor) {
808
- return typeof actor === "string" ? actor : actor.login;
809
- }
810
- /** Maps one fetched page into a {@link Page}. The cursor is kept only when there is a next page. */
811
- function toPage(result, map, warnings) {
812
- return {
813
- items: (result.data ?? []).flatMap((raw) => {
814
- const item = map(raw);
815
- return item === void 0 ? [] : [item];
816
- }),
817
- ...result.total !== void 0 ? { total: result.total } : {},
818
- cursor: result.cursor?.nextUrl || result.cursor?.token ? result.cursor : void 0,
819
- ...result.etag ? { etag: result.etag } : {},
820
- notModified: result.notModified || void 0,
821
- ...warnings?.length ? { warnings } : {},
822
- ...rateLimitPart(result.response)
823
- };
824
- }
825
- /**
826
- * Adds the validator of a listing's first page to `page`: the response's `etag`, or on a `304` the one
827
- * `cursor` sent. Later pages are left as they are.
828
- */
829
- function withEtag(page, result, cursor) {
830
- if (!isFirstPage(cursor)) return page;
831
- const etag = result.response.headers.get("etag") ?? (result.notModified ? cursor?.etag : void 0);
832
- return etag ? {
833
- ...page,
834
- etag
835
- } : page;
836
- }
837
- /** Whether `cursor` asks for the first page of a listing: it has neither `nextUrl` nor `token`, though it may have an `etag`. */
838
- function isFirstPage(cursor) {
839
- return !cursor?.nextUrl && !cursor?.token;
840
- }
841
- /** The `etag` of `cursor` when it asks for the first page, to send as `If-None-Match`. */
842
- function firstPageEtag(cursor) {
843
- return isFirstPage(cursor) ? cursor?.etag : void 0;
844
- }
845
- /** Builds a {@link Listing} for a forge that names its page-size parameter `pageParam`. */
846
- function createListing(fetcher, pageParam, defaultPerPage) {
847
- return async (path, options, map, { warnings, query, ...extras } = {}) => toPage(await fetcher.page(path, {
848
- ...extras,
849
- query: {
850
- ...query,
851
- [pageParam]: options.perPage ?? defaultPerPage
852
- },
853
- cursor: options.cursor,
854
- signal: options.signal
855
- }), map, warnings);
856
- }
857
- /** The `rateLimit` of a page built by hand: the budget of the response behind it, or of the page it maps. */
858
- function rateLimitPart(source) {
859
- const rateLimit = source && ("headers" in source ? rateLimitOf(source) : source.rateLimit);
860
- return rateLimit ? { rateLimit } : {};
861
- }
862
- /**
863
- * Chains listings that a forge serves from separate endpoints. The cursor
864
- * `token` records which phase is next, ahead of the phase's own token. With
865
- * one phase, the first page is conditional as that phase's is; with more,
866
- * one validator cannot cover every endpoint, so no page has an `etag`.
867
- */
868
- async function phased(phases, cursor) {
869
- const match = /^(\d+):(.*)$/s.exec(cursor?.token ?? "");
870
- const index = match ? Number(match[1]) : 0;
871
- const conditional = phases.length === 1;
872
- const inner = cursor && (cursor.nextUrl || match?.[2]) ? {
873
- ...cursor,
874
- token: match?.[2] || void 0
875
- } : conditional && cursor?.etag ? { etag: cursor.etag } : void 0;
876
- const { etag, ...rest } = await phases[index](inner);
877
- const page = conditional && etag ? {
878
- ...rest,
879
- etag
880
- } : rest;
881
- if (page.cursor) return {
882
- ...page,
883
- cursor: {
884
- ...page.cursor,
885
- token: `${index}:${page.cursor.token ?? ""}`
886
- }
887
- };
888
- return index + 1 < phases.length ? {
889
- ...page,
890
- cursor: { token: `${index + 1}:` }
891
- } : page;
892
- }
893
- /** Whether `labels` include every name in `wanted`; true when nothing is wanted. */
894
- function hasEveryLabel(labels, wanted) {
895
- return !wanted?.length || wanted.every((name) => labels?.some((label) => label.name === name));
896
- }
897
- /** The counts that are numbers, or `undefined` when none are. */
898
- function toPullStats(counts) {
899
- const known = Object.entries(counts).filter(([, count]) => typeof count === "number");
900
- return known.length ? Object.fromEntries(known) : void 0;
901
- }
902
- /** Any failure fails, else any pending is pending, else any unknown (or none at all) is unknown, else success. */
903
- function summariseChecks(states, url) {
904
- const failed = states.filter((state) => state === "failure").length;
905
- return {
906
- state: failed ? "failure" : states.includes("pending") ? "pending" : !states.length || states.includes("unknown") ? "unknown" : "success",
907
- total: states.length,
908
- failed,
909
- ...url ? { url } : {}
910
- };
911
- }
912
- const FAILED_CONCLUSIONS = /* @__PURE__ */ new Set([
913
- "failure",
914
- "timed_out",
915
- "cancelled",
916
- "action_required",
917
- "startup_failure"
918
- ]);
919
- /**
920
- * State of a check run reported as a status plus a conclusion once completed.
921
- * Cancelled, timed-out, action-required and startup failures count as
922
- * failures; skipped and neutral runs as neutral.
923
- */
924
- function checkRunState(status, conclusion) {
925
- if (status !== "completed") return "pending";
926
- if (conclusion === "success") return "success";
927
- if (conclusion && FAILED_CONCLUSIONS.has(conclusion)) return "failure";
928
- return conclusion === "neutral" || conclusion === "skipped" ? "neutral" : "unknown";
929
- }
930
- /** Maps a forge's own file-change word onto {@link FileStatus}; unknown words become `'changed'`. */
931
- function toFileStatus(raw) {
932
- switch (raw?.toLowerCase()) {
933
- case "added":
934
- case "new":
935
- case "add": return "added";
936
- case "removed":
937
- case "deleted":
938
- case "remove": return "removed";
939
- case "renamed":
940
- case "rename": return "renamed";
941
- case "copied":
942
- case "copy": return "copied";
943
- case "modified":
944
- case "edit":
945
- case "change": return "modified";
946
- default: return "changed";
947
- }
948
- }
949
- /**
950
- * Caches the result of `load` after its first call. A rejected load is
951
- * forgotten so the next call retries; with `ttl` (milliseconds) a resolved
952
- * value is reloaded once it is older than that.
953
- */
954
- function memo(load, ttl) {
955
- let cached;
956
- return () => {
957
- if (!cached || ttl !== void 0 && Date.now() - cached.at > ttl) {
958
- const promise = load();
959
- cached = {
960
- promise,
961
- at: Date.now()
962
- };
963
- promise.catch(() => {
964
- if (cached?.promise === promise) cached = void 0;
965
- });
966
- }
967
- return cached.promise;
968
- };
969
- }
970
- /** {@link memo} per key. */
971
- function memoBy(load) {
972
- const cache = /* @__PURE__ */ new Map();
973
- return (key) => {
974
- let entry = cache.get(key);
975
- if (!entry) {
976
- entry = memo(() => load(key));
977
- cache.set(key, entry);
978
- }
979
- return entry();
980
- };
981
- }
982
- /**
983
- * A review standing in for an approval, vote or participant state on a forge
984
- * that has no review objects. `comments` is `false` because there is nothing
985
- * to hang inline comments on.
986
- */
987
- function syntheticReview(thread, id, state, extras) {
988
- const { author, stateRaw, submittedAt, raw } = extras;
989
- return {
990
- ref: {
991
- forge: thread.forge,
992
- instance: thread.instance,
993
- thread,
994
- id
995
- },
996
- author,
997
- state,
998
- stateRaw,
999
- submittedAt,
1000
- comments: false,
1001
- raw
1002
- };
1003
- }
1004
- /** A label colour as six hex digits, with the `#` prefix the forge expects. `ededed` when none is given. */
1005
- function hexColour(colour, prefix = "") {
1006
- return `${prefix}${(colour ?? "ededed").replace(/^#/, "")}`;
1007
- }
1008
83
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/web-CpD15Y5a.mjs
1009
84
  function sameRepo(a, b) {
1010
85
  if (!b || a.forge !== b.forge || a.instance !== b.instance) return false;
@@ -2633,73 +1708,4 @@ function createProvider(definition, givenOptions, givenState) {
2633
1708
  function defineForgeProvider(definition) {
2634
1709
  return ((options = {}) => createProvider(definition, options));
2635
1710
  }
2636
- // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/webhooks-Bc6QhmI8.mjs
2637
- /** The first of `names` the delivery carries a non-empty value for. */
2638
- function firstHeader(delivery, names) {
2639
- for (const name of typeof names === "string" ? [names] : names) {
2640
- const value = headerValue(delivery.headers, name);
2641
- if (value) return value;
2642
- }
2643
- }
2644
- /**
2645
- * Checks a hex HMAC-SHA256 of the raw body, sent in the first of `header`
2646
- * present, after an optional `prefix` such as `sha256=`. The delivery's own
2647
- * `secret` takes precedence over the provider's.
2648
- */
2649
- async function verifyHmacSignature(delivery, secret, { header, prefix = "" }) {
2650
- const signature = firstHeader(delivery, header);
2651
- const key = delivery.secret ?? secret;
2652
- if (!key || !signature) return false;
2653
- return timingSafeEqual(signature.toLowerCase(), `${prefix}${await hmacSha256Hex(key, delivery.body)}`);
2654
- }
2655
- /** Checks a secret sent verbatim in `header`. */
2656
- function verifySharedToken(delivery, secret, header) {
2657
- const token = headerValue(delivery.headers, header);
2658
- const key = delivery.secret ?? secret;
2659
- return Boolean(key && token && timingSafeEqual(token, key));
2660
- }
2661
- /**
2662
- * The kind, detail and summary of one ref update in a push: a deletion, a creation, or new commits. Without
2663
- * `commits` or `commitCount`, the detail has no `commitCount`.
2664
- */
2665
- function refEvent(who, change) {
2666
- const name = change.ref.replace(/^refs\/(?:heads|tags)\//, "");
2667
- const refType = change.refType ?? (change.ref.startsWith("refs/tags/") ? "tag" : "branch");
2668
- if (change.deleted || change.created) return {
2669
- kind: "ref",
2670
- action: change.deleted ? "deleted" : "created",
2671
- detail: {
2672
- type: "ref",
2673
- ref: change.ref,
2674
- refType
2675
- },
2676
- summary: `${who} ${change.deleted ? "deleted" : "created"} ${name}`
2677
- };
2678
- const count = change.commitCount ?? change.commits?.length;
2679
- return {
2680
- kind: "push",
2681
- detail: {
2682
- type: "push",
2683
- ref: change.ref,
2684
- before: change.before,
2685
- after: change.after,
2686
- commitCount: count,
2687
- forced: change.forced ?? false,
2688
- commits: change.commits ?? []
2689
- },
2690
- summary: count === void 0 ? `${who} pushed to ${name}` : `${who} pushed ${count} commit(s) to ${name}`
2691
- };
2692
- }
2693
- /** The forge's own event names for `events`, plus any `nativeEvents` passed through unchanged. */
2694
- function nativeEventsFor(map, events, nativeEvents) {
2695
- const names = new Set(nativeEvents ?? []);
2696
- for (const kind of events ?? []) for (const name of map[kind] ?? []) names.add(name);
2697
- return [...names];
2698
- }
2699
- /** The normalised kinds a subscription to `nativeEvents` covers. */
2700
- function eventKindsOf(map, nativeEvents) {
2701
- const kinds = /* @__PURE__ */ new Set();
2702
- for (const [kind, names] of Object.entries(map)) if (nativeEvents.includes("*") || names.some((name) => nativeEvents.includes(name))) kinds.add(kind);
2703
- return [...kinds];
2704
- }
2705
- export { requireThread as $, createListing as A, iteratePages as B, rangeOf as C, anySignal as D, actorLogin as E, getManyConcurrently as F, mergeCommitMessage as G, mapConcurrent as H, hasEveryLabel as I, phased as J, milestoneId as K, hexColour as L, degradesToWarning as M, firstPageEtag as N, checkRunState as O, forgeIterable as P, requireIssueOrPull as Q, hostOf as R, lineOf as S, abortable as T, memo as U, latestCommentOf as V, memoBy as W, rateLimitPart as X, rateLimitOf as Y, rateLimitReset as Z, threadSnapshot as _, splitMessage as _t, verifyHmacSignature as a, toDate as at, bareSha as b, WRITE_VERBS as c, toPullStats as ct, eventAction as d, withEtag as dt, resolveToken as et, eventTime as f, changeBase64 as ft, supportOnly as g, isSha as gt, snapshotOfThread as h, inDirectories as ht, refEvent as i, teamOrg as it, createRequest as j, createFetcher as k, completeEvent as l, toWarning as lt, reviewState as m, fromBase64 as mt, firstHeader as n, summariseChecks as nt, verifySharedToken as o, toFileStatus as ot, perKind as p, existingFiles as pt, parseLinkHeader as q, nativeEventsFor as r, syntheticReview as rt, CAPABILITY_TABLE as s, toPage as st, eventKindsOf as t, sleep as tt, defineForgeProvider as u, versionAtLeast as ut, verb as v, toFileContent as vt, webUrlFor as w, githubShapedWeb as x, OWNER_NAME as y, isFirstPage as z };
1711
+ export { isSha as C, inDirectories as S, toFileContent as T, rangeOf as _, eventAction as a, existingFiles as b, reviewState as c, threadSnapshot as d, verb as f, lineOf as g, githubShapedWeb as h, defineForgeProvider as i, snapshotOfThread as l, bareSha as m, WRITE_VERBS as n, eventTime as o, OWNER_NAME as p, completeEvent as r, perKind as s, CAPABILITY_TABLE as t, supportOnly as u, webUrlFor as v, splitMessage as w, fromBase64 as x, changeBase64 as y };