@vite-hub/forge 0.5.0 → 0.5.1

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 (31) hide show
  1. package/dist/{association-Ds6Tgs0W-Cu9_YCGq.js → association-Ds6Tgs0W-CgBVH3ii.js} +1 -2
  2. package/dist/build/node.d.ts +1 -3
  3. package/dist/build/node.js +3 -5
  4. package/dist/build.d.ts +1 -1
  5. package/dist/build.js +1 -2
  6. package/dist/{definition-0wjaAw2i-BwSDtp9h.js → definition-BQFdu9ti-WxMjcAEl.js} +8 -8
  7. package/dist/{events-DW3SFUDA-D2rhS9D-.js → events-BL0zcgMf-9TwyYtCt.js} +3 -5
  8. package/dist/{events-uCMi3LHU-Bz79PQtq.js → events-DDdJnmD2-BSMoOqjV.js} +4 -5
  9. package/dist/{events-DjRw3KSr-C72gY7Vu.js → events-DHqSJ5KI-z2-5_1vo.js} +59 -60
  10. package/dist/{events-DmSWTdpS-oDiTlP1L.js → events-DXE-Ul2S-BzTkugIK.js} +4 -5
  11. package/dist/{feed-BlzdKdNv-DbxuSgsx.js → feed-B1OiHFg0-DevZZe0y.js} +3 -5
  12. package/dist/{feed-CIaAZINm-Dpe9DxwK.js → feed-DROLF1tb-CtRfA_7N.js} +3 -5
  13. package/dist/{feed-BwdcTgZq-CbyczJHA.js → feed-iWegqepj-ConxMpg4.js} +3 -5
  14. package/dist/{forgejo-DgNfNjcW.js → forgejo-4sbZukng.js} +3 -4
  15. package/dist/{gitea-Zpwj_XHC.js → gitea-Cj7qy2X3.js} +3 -4
  16. package/dist/{gitee-BXyl2_3W-dQOAjWqr.js → gitee-CKt4pEC0-BuLWggck.js} +2 -3
  17. package/dist/{github-CUiEF2FK.js → github-CHzhqYOr.js} +377 -293
  18. package/dist/{gitlab-zvWb9zOi.js → gitlab-CS0shW2u.js} +12 -10
  19. package/dist/{graphql-BDhuP5jN-BSpB8lWf.js → graphql-DxRA9BGO-BBbmTmWi.js} +43 -33
  20. package/dist/{identity-CmVEBLP5.js → identity-BwC2_3S9.js} +1 -2
  21. package/dist/{identity-CNTWZZuv.d.ts → identity-D2-HaDku.d.ts} +0 -2
  22. package/dist/index.d.ts +35 -38
  23. package/dist/index.js +26 -45
  24. package/dist/model-Biiu1CfI-CVLamGai.js +288 -0
  25. package/dist/{templates-BGDqQMu4-PSB43E1j.js → templates-0m5QBVIh-D1fZeoC-.js} +3 -3
  26. package/dist/{webhooks-Bc6QhmI8-CNgCERCq.js → webhooks-Bc6QhmI8-eK71_mJE.js} +1034 -98
  27. package/package.json +6 -6
  28. package/dist/events-C6C7lk1x-J8VCAjEX.js +0 -131
  29. package/dist/knot-bGebBK_B-CeDHcJUz.js +0 -350
  30. package/dist/tangled-8lg_73Wi-bSufNXiN.js +0 -43
  31. package/dist/utils-DC7MBR65-B7Vr2hFm.js +0 -1214
@@ -1,6 +1,6 @@
1
- import { $ as toDate, A as hexColour, B as milestoneId, C as createListing, E as firstPageEtag, G as requireIssueOrPull, I as mapConcurrent, K as requireThread, L as memo, M as isFirstPage, O as getManyConcurrently, P as iteratePages, Q as teamOrg, R as memoBy, T as degradesToWarning, U as rateLimitPart, V as phased, Y as soleMergeMethod, Z as syntheticReview, a as ForgeApiError, at as versionAtLeast, c as InsufficientScopeError, ct as isNamespaceRef, d as NotFoundError, g as UnsupportedOperationError, h as UnresolvedThreadError, i as ForbiddenError, it as toWarning, m as TokenRevokedError, n as BranchMovedError, nt as toPage, ot as withEtag, pt as reactionContent, q as resolveToken, t as AuthenticationRequiredError, tt as toMergeError, z as mergeCommitMessage } from "./utils-DC7MBR65-B7Vr2hFm.js";
2
- import { C as verb, D as rangeOf, E as lineOf, O as webUrlFor, S as toFileContent, c as changeBase64, d as eventTime, f as existingFiles, g as perKind, l as defineForgeProvider, o as verifySharedToken, p as fromBase64, r as nativeEventsFor, s as WRITE_VERBS, t as eventKindsOf } from "./webhooks-Bc6QhmI8-CNgCERCq.js";
3
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/web-tZM874Sy.mjs
1
+ import { $ as syntheticReview, A as firstPageEtag, B as memo, H as mergeCommitMessage, I as isFirstPage, J as requireIssueOrPull, K as rateLimitPart, L as iteratePages, M as getManyConcurrently, O as createListing, P as hexColour, S as webUrlFor, U as milestoneId, V as memoBy, W as phased, X as resolveToken, Y as requireThread, at as toWarning, b as lineOf, c as defineForgeProvider, ct as changeBase64, d as perKind, et as teamOrg, g as verb, k as degradesToWarning, lt as existingFiles, mt as toFileContent, o as verifySharedToken, ot as versionAtLeast, r as nativeEventsFor, rt as toPage, s as WRITE_VERBS, st as withEtag, t as eventKindsOf, tt as toDate, u as eventTime, ut as fromBase64, v as bareSha, x as rangeOf, z as mapConcurrent } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { A as toMergeError, C as TokenRevokedError, T as UnsupportedOperationError, _ as InsufficientScopeError, b as NotFoundError, f as ForbiddenError, k as soleMergeMethod, l as AuthenticationRequiredError, n as isNamespaceRef, p as ForgeApiError, s as reactionContent, u as BranchMovedError, w as UnresolvedThreadError } from "./model-Biiu1CfI-CVLamGai.js";
3
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/web-DpJoUDx4.mjs
4
4
  const SECTIONS = {
5
5
  issue: "work_items",
6
6
  pull_request: "merge_requests"
@@ -125,7 +125,7 @@ function gitlabWeb(baseUrl) {
125
125
  };
126
126
  },
127
127
  reference: (ref, same, expand) => {
128
- if ("sha" in ref) return `${same ? "" : `${ref.repo.owner}/${ref.repo.name}@`}${ref.sha.slice(0, 8)}`;
128
+ if ("sha" in ref) return (same ? bareSha(ref.sha, 8) : void 0) ?? `${ref.repo.owner}/${ref.repo.name}@${ref.sha.slice(0, 8)}`;
129
129
  const prefix = PREFIXES[ref.kind];
130
130
  if (!prefix || ref.repo.kind === "namespace" || !ref.number) return;
131
131
  return `${same ? "" : `${ref.repo.owner}/${ref.repo.name}`}${prefix}${ref.number}${expand ? "+" : ""}`;
@@ -139,8 +139,7 @@ const GITLAB_WEB = {
139
139
  apiPath: "/api/v4",
140
140
  links: ({ baseUrl }) => gitlabWeb(baseUrl.replace(/\/api\/v4$/, ""))
141
141
  };
142
- //#endregion
143
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/gitlab-CoGcd7R7.mjs
142
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/gitlab-CBm_X8ZX.mjs
144
143
  /**
145
144
  * GitLab subscribes per event with a boolean flag rather than an event name,
146
145
  * so the flag names are the native events.
@@ -1084,7 +1083,7 @@ async function verifyGitLabToken(delivery, secret) {
1084
1083
  const gitlabWebhooks = ({ options, instance }) => ({
1085
1084
  events: GITLAB_WEBHOOK_EVENTS,
1086
1085
  verify: (delivery) => verifyGitLabToken(delivery, options.webhookSecret),
1087
- translate: async (delivery) => (await import("./events-uCMi3LHU-Bz79PQtq.js")).translateGitLabWebhook(instance, delivery)
1086
+ translate: async (delivery) => (await import("./events-DDdJnmD2-BSMoOqjV.js")).translateGitLabWebhook(instance, delivery)
1088
1087
  });
1089
1088
  const PROJECT_ORDER = {
1090
1089
  created: "created_at",
@@ -1646,7 +1645,7 @@ const gitlab = /* @__PURE__ */ defineForgeProvider({
1646
1645
  });
1647
1646
  const warnings = [];
1648
1647
  if (!repo) await resolveProjects([...new Set((result.data ?? []).flatMap((raw) => typeof raw.project_id === "number" ? [raw.project_id] : []))].filter((id) => !projectRefs.has(id)), listOptions.signal, warnings);
1649
- const { toFeedEvent } = await import("./feed-BlzdKdNv-DbxuSgsx.js");
1648
+ const { toFeedEvent } = await import("./feed-B1OiHFg0-DevZZe0y.js");
1650
1649
  return toPage(result, (raw) => toFeedEvent(instance, raw, repo ?? (typeof raw.project_id === "number" ? projectRefs.get(raw.project_id) : void 0)), warnings);
1651
1650
  }
1652
1651
  async function setSubscribed(thread, subscribed, options) {
@@ -1799,7 +1798,11 @@ const gitlab = /* @__PURE__ */ defineForgeProvider({
1799
1798
  labelLength: 255
1800
1799
  }
1801
1800
  },
1802
- notApplicable: ["threads.hideComment"],
1801
+ notApplicable: [
1802
+ "users.sponsorable",
1803
+ "users.sponsorableMany",
1804
+ "threads.hideComment"
1805
+ ],
1803
1806
  probeVersion: async () => (await fetcher.json("/version")).data.version,
1804
1807
  web,
1805
1808
  webhooks: {
@@ -2585,5 +2588,4 @@ function gitlabScopesFor(verb) {
2585
2588
  };
2586
2589
  return { token: [WRITE_VERBS.has(verb) ? "api" : "read_api"] };
2587
2590
  }
2588
- //#endregion
2589
2591
  export { toRepoRef as a, gitlab, toLabel as i, approvalId as n, toState as o, toActor as r, toThreadKind as s, FORGE as t };
@@ -1,8 +1,6 @@
1
- import { $ as toDate, rt as toPullStats } from "./utils-DC7MBR65-B7Vr2hFm.js";
2
- import { d as eventTime } from "./webhooks-Bc6QhmI8-CNgCERCq.js";
3
- import { t as toAuthorAssociation } from "./association-Ds6Tgs0W-Cu9_YCGq.js";
4
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/graphql-BDhuP5jN.mjs
5
- const FORGE = "github";
1
+ import { it as toPullStats, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { t as toAuthorAssociation } from "./association-Ds6Tgs0W-CgBVH3ii.js";
3
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/graphql-DxRA9BGO.mjs
6
4
  const ACTOR_FIELDS = `__typename login avatarUrl url ... on User { databaseId name } ... on Bot { databaseId }`;
7
5
  const USER_FIELDS = `__typename login avatarUrl url databaseId name`;
8
6
  const DISCUSSION_FIELDS = `id number title body closed stateReason url createdAt updatedAt closedAt locked
@@ -57,9 +55,9 @@ const CREATE_COMMIT_ON_BRANCH = `mutation CreateCommitOnBranch($input: CreateCom
57
55
  commit { oid message url author { ${GIT_ACTOR_FIELDS} } committer { ${GIT_ACTOR_FIELDS} } parents(first: 2) { nodes { oid } } }
58
56
  }
59
57
  }`;
60
- function toCommitSignature(instance, raw) {
58
+ function toCommitSignature(origin, raw) {
61
59
  return {
62
- actor: toGraphQLActor(instance, raw?.user),
60
+ actor: toGraphQLActor(origin, raw?.user),
63
61
  name: raw?.name ?? void 0,
64
62
  email: raw?.email ?? void 0,
65
63
  date: toDate(raw?.date)
@@ -68,15 +66,15 @@ function toCommitSignature(instance, raw) {
68
66
  function toGraphQLCommit(repo, raw) {
69
67
  return {
70
68
  ref: {
71
- forge: FORGE,
69
+ forge: repo.forge,
72
70
  instance: repo.instance,
73
71
  repo,
74
72
  sha: raw.oid
75
73
  },
76
74
  sha: raw.oid,
77
75
  message: raw.message,
78
- author: toCommitSignature(repo.instance, raw.author),
79
- committer: toCommitSignature(repo.instance, raw.committer),
76
+ author: toCommitSignature(repo, raw.author),
77
+ committer: toCommitSignature(repo, raw.committer),
80
78
  parents: raw.parents.nodes.map((parent) => parent.oid),
81
79
  url: raw.url,
82
80
  raw
@@ -87,6 +85,20 @@ const SPONSORABLE = `query Sponsorable($login: String!) {
87
85
  ... on Sponsorable { hasSponsorsListing }
88
86
  }
89
87
  }`;
88
+ /** One aliased `repositoryOwner` field per login, so a chunk costs one GraphQL request. */
89
+ function sponsorableBatchQuery(logins) {
90
+ const variables = {};
91
+ const declarations = [];
92
+ const fields = logins.map((login, index) => {
93
+ variables[`l${index}`] = login;
94
+ declarations.push(`$l${index}: String!`);
95
+ return `u${index}: repositoryOwner(login: $l${index}) { ... on Sponsorable { hasSponsorsListing } }`;
96
+ });
97
+ return {
98
+ query: `query SponsorableMany(${declarations.join(", ")}) {\n ${fields.join("\n ")}\n}`,
99
+ variables
100
+ };
101
+ }
90
102
  const ISSUE_FIELDS = `id number title body state stateReason createdAt updatedAt closedAt url locked
91
103
  author { ${ACTOR_FIELDS} } authorAssociation
92
104
  assignees(first: 20) { nodes { ${USER_FIELDS} } }
@@ -188,7 +200,6 @@ function toRollupSummary(rollup, url) {
188
200
  };
189
201
  }
190
202
  function toGraphQLThread(ref, raw) {
191
- const instance = ref.instance;
192
203
  const isPull = raw.__typename === "PullRequest";
193
204
  const kind = isPull ? "pull_request" : "issue";
194
205
  const state = raw.state === "MERGED" ? "merged" : raw.state === "OPEN" ? "open" : raw.state === "CLOSED" ? "closed" : "unknown";
@@ -201,15 +212,15 @@ function toGraphQLThread(ref, raw) {
201
212
  if (!reviewer) return [];
202
213
  const isTeam = reviewer.__typename === "Team";
203
214
  const actor = isTeam ? {
204
- forge: FORGE,
205
- instance,
215
+ forge: ref.forge,
216
+ instance: ref.instance,
206
217
  login: reviewer.slug ?? "",
207
218
  id: String(reviewer.databaseId ?? reviewer.slug),
208
219
  name: reviewer.name,
209
220
  url: reviewer.url,
210
221
  typeRaw: "Team",
211
222
  isBotHint: false
212
- } : toGraphQLActor(instance, reviewer);
223
+ } : toGraphQLActor(ref, reviewer);
213
224
  const at = requestedAt.get(`${reviewer.__typename}:${isTeam ? reviewer.slug : reviewer.login}`);
214
225
  return [{
215
226
  actor,
@@ -232,10 +243,10 @@ function toGraphQLThread(ref, raw) {
232
243
  stateRaw: raw.state.toLowerCase(),
233
244
  stateReason: raw.stateReason?.toLowerCase() ?? void 0,
234
245
  isDraft: raw.isDraft ?? false,
235
- author: toGraphQLActor(instance, raw.author),
246
+ author: toGraphQLActor(ref, raw.author),
236
247
  ...toAuthorAssociation(raw.authorAssociation),
237
- assignees: (raw.assignees?.nodes ?? []).flatMap((actor) => toGraphQLActor(instance, actor) ?? []),
238
- participants: (raw.participants?.nodes ?? []).flatMap((actor) => toGraphQLActor(instance, actor) ?? []),
248
+ assignees: (raw.assignees?.nodes ?? []).flatMap((actor) => toGraphQLActor(ref, actor) ?? []),
249
+ participants: (raw.participants?.nodes ?? []).flatMap((actor) => toGraphQLActor(ref, actor) ?? []),
239
250
  milestone: toGraphQLMilestone(raw.milestone),
240
251
  issueType: toGraphQLIssueType(raw.issueType),
241
252
  subscription: toViewerSubscription(raw.viewerSubscription),
@@ -250,7 +261,7 @@ function toGraphQLThread(ref, raw) {
250
261
  updatedAt: toDate(raw.updatedAt),
251
262
  closedAt: toDate(raw.closedAt),
252
263
  mergedAt: toDate(raw.mergedAt),
253
- mergedBy: toGraphQLActor(instance, raw.mergedBy),
264
+ mergedBy: toGraphQLActor(ref, raw.mergedBy),
254
265
  lastActivityAt: toDate(raw.updatedAt),
255
266
  locked: raw.locked,
256
267
  commentCount: raw.comments?.totalCount,
@@ -260,8 +271,8 @@ function toGraphQLThread(ref, raw) {
260
271
  ref: raw.headRefName,
261
272
  sha: raw.headRefOid,
262
273
  repo: raw.headRepository ? {
263
- forge: FORGE,
264
- instance,
274
+ forge: ref.forge,
275
+ instance: ref.instance,
265
276
  owner: raw.headRepository.owner.login,
266
277
  name: raw.headRepository.name,
267
278
  externalId: raw.headRepository.databaseId === void 0 ? void 0 : String(raw.headRepository.databaseId)
@@ -320,13 +331,13 @@ const CLOSE_DISCUSSION = `mutation CloseDiscussion($id: ID!, $reason: Discussion
320
331
  const REOPEN_DISCUSSION = `mutation ReopenDiscussion($id: ID!) {
321
332
  reopenDiscussion(input: { discussionId: $id }) { discussion { ${DISCUSSION_FIELDS} } }
322
333
  }`;
323
- function toGraphQLActor(instance, actor) {
334
+ function toGraphQLActor(origin, actor) {
324
335
  if (!actor) return;
325
336
  const isBot = actor.__typename === "Bot";
326
337
  const slug = isBot ? actor.login.replace(/\[bot\]$/, "") : void 0;
327
338
  return {
328
- forge: FORGE,
329
- instance,
339
+ forge: origin.forge,
340
+ instance: origin.instance,
330
341
  login: slug ? `${slug}[bot]` : actor.login,
331
342
  id: String(actor.databaseId ?? actor.login),
332
343
  name: actor.name,
@@ -350,7 +361,7 @@ function toDiscussionThread(ref, raw) {
350
361
  stateRaw: raw.closed ? "closed" : "open",
351
362
  stateReason: raw.stateReason?.toLowerCase(),
352
363
  isDraft: false,
353
- author: toGraphQLActor(ref.instance, raw.author),
364
+ author: toGraphQLActor(ref, raw.author),
354
365
  ...toAuthorAssociation(raw.authorAssociation),
355
366
  assignees: [],
356
367
  reviewers: [],
@@ -370,9 +381,9 @@ function toDiscussionThread(ref, raw) {
370
381
  };
371
382
  }
372
383
  function toDiscussionCommentEvent(ref, comment, isReply) {
373
- const actor = toGraphQLActor(ref.instance, comment.author);
384
+ const actor = toGraphQLActor(ref, comment.author);
374
385
  return {
375
- forge: FORGE,
386
+ forge: ref.forge,
376
387
  instance: ref.instance,
377
388
  id: comment.id,
378
389
  kind: "comment",
@@ -385,7 +396,7 @@ function toDiscussionCommentEvent(ref, comment, isReply) {
385
396
  detail: {
386
397
  type: "comment",
387
398
  comment: {
388
- forge: FORGE,
399
+ forge: ref.forge,
389
400
  instance: ref.instance,
390
401
  thread: ref,
391
402
  id: comment.id
@@ -399,13 +410,13 @@ function toDiscussionCommentEvent(ref, comment, isReply) {
399
410
  function toDiscussionComment(thread, raw) {
400
411
  return {
401
412
  ref: {
402
- forge: FORGE,
413
+ forge: thread.forge,
403
414
  instance: thread.instance,
404
415
  thread,
405
416
  id: raw.id
406
417
  },
407
418
  body: raw.body ?? "",
408
- author: toGraphQLActor(thread.instance, raw.author),
419
+ author: toGraphQLActor(thread, raw.author),
409
420
  ...toAuthorAssociation(raw.authorAssociation),
410
421
  createdAt: toDate(raw.createdAt),
411
422
  updatedAt: toDate(raw.updatedAt),
@@ -497,13 +508,13 @@ function toReviewThread(ref, raw) {
497
508
  side,
498
509
  comments: raw.comments.nodes.map((comment) => ({
499
510
  ...comment.databaseId === null ? {} : { ref: {
500
- forge: FORGE,
511
+ forge: ref.forge,
501
512
  instance: ref.instance,
502
513
  thread: ref,
503
514
  id: String(comment.databaseId)
504
515
  } },
505
516
  body: comment.body ?? "",
506
- author: toGraphQLActor(ref.instance, comment.author),
517
+ author: toGraphQLActor(ref, comment.author),
507
518
  path: comment.path ?? void 0,
508
519
  line: comment.line ?? comment.originalLine ?? void 0,
509
520
  side,
@@ -537,5 +548,4 @@ const UNMINIMIZE_COMMENT = `mutation UnminimizeComment($id: ID!) {
537
548
  const UPDATE_PULL_REQUEST_BRANCH = `mutation UpdatePullRequestBranch($id: ID!, $sha: GitObjectID, $method: PullRequestBranchUpdateMethod) {
538
549
  updatePullRequestBranch(input: { pullRequestId: $id, expectedHeadOid: $sha, updateMethod: $method }) { pullRequest { headRefOid } }
539
550
  }`;
540
- //#endregion
541
- export { ADD_DISCUSSION_COMMENT, ADD_REACTION, CLOSE_DISCUSSION, CLOSING_ISSUES, CLOSING_PULL_REQUESTS, CREATE_COMMIT_ON_BRANCH, DELETE_DISCUSSION_COMMENT, DISCUSSIONS_LIST, DISCUSSION_COMMENTS, DISCUSSION_THREAD, GET_DISCUSSION_COMMENT, GRAPHQL_REACTIONS, LOCK_LOCKABLE, MARK_DUPLICATE, MINIMIZE_COMMENT, NODE_REACTIONS, REACTION_CONTENT, REMOVE_REACTION, REOPEN_DISCUSSION, REPOSITORY_ID, RESOLVE_REVIEW_THREAD, REVIEW_THREADS, REVIEW_THREAD_PAGE, SPONSORABLE, SUBSCRIPTION_STATE, TRANSFER_ISSUE, UNLOCK_LOCKABLE, UNMINIMIZE_COMMENT, UNRESOLVE_REVIEW_THREAD, UPDATE_DISCUSSION, UPDATE_DISCUSSION_COMMENT, UPDATE_PULL_REQUEST_BRANCH, UPDATE_REFS, UPDATE_SUBSCRIPTION, recentDiscussionsQuery, threadsBatchQuery, toDiscussionComment, toDiscussionCommentEvent, toDiscussionThread, toGraphQLActor, toGraphQLCommit, toGraphQLMilestone, toGraphQLThread, toReviewThread, toViewerSubscription };
551
+ export { ADD_DISCUSSION_COMMENT, ADD_REACTION, CLOSE_DISCUSSION, CLOSING_ISSUES, CLOSING_PULL_REQUESTS, CREATE_COMMIT_ON_BRANCH, DELETE_DISCUSSION_COMMENT, DISCUSSIONS_LIST, DISCUSSION_COMMENTS, DISCUSSION_THREAD, GET_DISCUSSION_COMMENT, GRAPHQL_REACTIONS, LOCK_LOCKABLE, MARK_DUPLICATE, MINIMIZE_COMMENT, NODE_REACTIONS, REACTION_CONTENT, REMOVE_REACTION, REOPEN_DISCUSSION, REPOSITORY_ID, RESOLVE_REVIEW_THREAD, REVIEW_THREADS, REVIEW_THREAD_PAGE, SPONSORABLE, SUBSCRIPTION_STATE, TRANSFER_ISSUE, UNLOCK_LOCKABLE, UNMINIMIZE_COMMENT, UNRESOLVE_REVIEW_THREAD, UPDATE_DISCUSSION, UPDATE_DISCUSSION_COMMENT, UPDATE_PULL_REQUEST_BRANCH, UPDATE_REFS, UPDATE_SUBSCRIPTION, recentDiscussionsQuery, sponsorableBatchQuery, threadsBatchQuery, toDiscussionComment, toDiscussionCommentEvent, toDiscussionThread, toGraphQLActor, toGraphQLCommit, toGraphQLMilestone, toGraphQLThread, toReviewThread, toViewerSubscription };
@@ -1,4 +1,4 @@
1
- //#region src/build/identity.ts
1
+ // src/build/identity.ts
2
2
  /** The `name` of the `<meta>` tag that holds a page's {@link BuildIdentity}. */
3
3
  const buildMetaName = "vitehub:build";
4
4
  const repositoryPattern = /^[\w.-]+\/[\w.-]+$/;
@@ -34,5 +34,4 @@ function parseBuildMeta(content) {
34
34
  commit
35
35
  }) : void 0;
36
36
  }
37
- //#endregion
38
37
  export { parseBuildMeta as i, buildMetaContent as n, buildMetaName as r, buildIdentity as t };
@@ -1,4 +1,3 @@
1
- //#region src/build/identity.d.ts
2
1
  /** The build of an app: the commit and branch, the GitHub repository, and the pull request when the host names it. */
3
2
  interface ForgeBuild {
4
3
  commit?: string;
@@ -23,5 +22,4 @@ declare function buildIdentity(build: ForgeBuild): BuildIdentity | undefined;
23
22
  declare function buildMetaContent(build: ForgeBuild): string | undefined;
24
23
  /** The identity in a `vitehub:build` meta tag's `content`, or `undefined` when it is missing or malformed. */
25
24
  declare function parseBuildMeta(content: string | null | undefined): BuildIdentity | undefined;
26
- //#endregion
27
25
  export { buildMetaName as a, buildMetaContent as i, ForgeBuild as n, parseBuildMeta as o, buildIdentity as r, BuildIdentity as t };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Result } from "@vite-hub/runtime";
2
2
  import { Diagnostic } from "nostics";
3
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/model-tYVNrXXO.d.mts
4
3
  /**
5
4
  * Every public type in this module is JSON-serialisable except `Date`, which
6
5
  * serialises to an ISO 8601 string through `JSON.stringify`, and the bytes of
@@ -13,7 +12,7 @@ import { Diagnostic } from "nostics";
13
12
  */
14
13
  type ForgeKind$1 = KnownForgeKind | (string & {});
15
14
  /** The forges this package ships providers for. */
16
- type KnownForgeKind = "github" | "gitlab" | "bitbucket" | "forgejo" | "gitea" | "tangled" | "gitee" | "azure-devops" | "cursor-origin" | "pushin" | "cloudflare-artifacts" | "sourcehut";
15
+ type KnownForgeKind = "github" | "gitlab" | "bitbucket" | "forgejo" | "gitea" | "tangled" | "gitee" | "azure-devops" | "cursor-origin" | "pushin" | "cloudflare-artifacts" | "sourcehut" | "entire" | "gitbucket" | "gitcafe" | "upstream";
17
16
  /**
18
17
  * Capability flag. Every value other than `false` and `'not_applicable'` means the
19
18
  * operation is available:
@@ -448,6 +447,16 @@ interface User extends Actor {
448
447
  publicRepos?: number;
449
448
  raw: unknown;
450
449
  }
450
+ /** One `users.sponsorableMany()` entry, in input order; narrow on `ok`. */
451
+ type SponsorableManyResult = {
452
+ ok: true;
453
+ login: string;
454
+ sponsorable: boolean;
455
+ } | {
456
+ ok: false;
457
+ login: string;
458
+ warning: ForgeWarning;
459
+ };
451
460
  /** A label that a repository defines. */
452
461
  interface Label {
453
462
  name: string;
@@ -1082,7 +1091,7 @@ interface SecurityAlertListOptions extends PageOptions {
1082
1091
  state?: "open" | "closed" | "all";
1083
1092
  }
1084
1093
  /** The warning codes providers emit; providers may add codes in a minor release. */
1085
- type ForgeWarningCode = "checks_unreadable" | "collaborators_unreachable" | "discussion_unresolved" | "feed_throttled" | "files_approximate" | "filter_unsupported" | "index_possibly_stale" | "insufficient_scope" | "kind_unsupported" | "notifications_failed" | "record_unreachable" | "recursive_unsupported" | "search_failed" | "search_incomplete" | "sort_unsupported" | "state_record_unreachable" | "thread_unreadable" | "thread_unresolved" | "tree_truncated" | (string & {});
1094
+ type ForgeWarningCode = "account_not_found" | "account_unreadable" | "checks_unreadable" | "collaborators_unreachable" | "commits_truncated" | "discussion_unresolved" | "feed_throttled" | "files_approximate" | "filter_unsupported" | "index_possibly_stale" | "insufficient_scope" | "kind_unsupported" | "notifications_failed" | "record_unreachable" | "recursive_unsupported" | "search_failed" | "search_incomplete" | "sort_unsupported" | "state_record_unreachable" | "thread_unreadable" | "thread_unresolved" | "tree_truncated" | (string & {});
1086
1095
  /** A non-fatal problem encountered while producing a result. */
1087
1096
  interface ForgeWarning {
1088
1097
  /** Stable machine-readable code. */
@@ -1847,8 +1856,6 @@ interface Installation extends ForgeOrigin {
1847
1856
  repositorySelectionRaw?: string;
1848
1857
  raw: unknown;
1849
1858
  }
1850
- //#endregion
1851
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/fetch-BUdyK5-h.d.mts
1852
1859
  /** Where an error happened: the forge, the instance and the request. */
1853
1860
  interface ForgeErrorContext {
1854
1861
  forge?: ForgeKind$1;
@@ -1958,8 +1965,6 @@ interface ForgeRequest {
1958
1965
  (method: string, path: string, options: ForgeRawRequestOptions): Promise<RawResponse>;
1959
1966
  <T = unknown>(method: string, path: string, options?: ForgeRequestOptions): Promise<ForgeResponse<T>>;
1960
1967
  }
1961
- //#endregion
1962
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/web-DhBCh_Iq.d.mts
1963
1968
  /** A repository's section, for linking to the section itself rather than one entry in it. */
1964
1969
  type RepoSection = "issues" | "pullRequests" | "compare" | "releases" | "stargazers" | "forks" | "watchers";
1965
1970
  /**
@@ -2050,8 +2055,6 @@ interface ParsedReference {
2050
2055
  /** The thread or commit it refers to. A commit `sha` is as written, so it can be abbreviated. */
2051
2056
  ref: ThreadRef | CommitRef;
2052
2057
  }
2053
- //#endregion
2054
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/provider-Dpahb8tR.d.mts
2055
2058
  /**
2056
2059
  * Rows omit what follows from the rest. `verbs` defaults to the capability,
2057
2060
  * and `spec` to the capability, or its page for a `listing` (`repos.labels`
@@ -2074,6 +2077,9 @@ declare const TABLE: readonly [{
2074
2077
  }, {
2075
2078
  readonly capability: "users.sponsorable";
2076
2079
  readonly account: true;
2080
+ }, {
2081
+ readonly capability: "users.sponsorableMany";
2082
+ readonly account: true;
2077
2083
  }, {
2078
2084
  readonly capability: "users.events";
2079
2085
  readonly listing: true;
@@ -2554,6 +2560,8 @@ interface ForgeCapabilities {
2554
2560
  me: Support;
2555
2561
  /** Support for `users.sponsorable()`. */
2556
2562
  sponsorable: Support;
2563
+ /** Support for `users.sponsorableMany()`. */
2564
+ sponsorableMany: Support;
2557
2565
  /** Support for `users.events()`. */
2558
2566
  events: Support;
2559
2567
  /** Support for `users.block()`. */
@@ -3546,6 +3554,24 @@ interface UsersApi {
3546
3554
  * ```
3547
3555
  */
3548
3556
  sponsorable: (login: string, options?: BaseOptions) => Promise<boolean>;
3557
+ /**
3558
+ * Whether several accounts accept sponsorship, batched where the forge allows. Returns one entry per login, in
3559
+ * input order. GitHub reads up to 50 logins per request, so a few dozen maintainers cost one request rather than
3560
+ * one each. An unknown or renamed login becomes an `ok: false` entry with an `account_not_found` warning, and an
3561
+ * account that cannot be read for another reason becomes `account_unreadable`, rather than rejecting the call. A
3562
+ * request-level failure, such as a transport error, rate limit, or rejected credential, rejects the whole call.
3563
+ * Other GraphQL failures without `data` return an `ok: false` warning for each login in the affected chunk.
3564
+ * @param logins The accounts to check. A repeated login gets an entry of its own.
3565
+ * @example
3566
+ * ```ts
3567
+ * for (const result of await provider.users.sponsorableMany(['danielroe', 'octocat'])) {
3568
+ * if (result.ok && result.sponsorable) {
3569
+ * console.log(`https://github.com/sponsors/${result.login}`)
3570
+ * }
3571
+ * }
3572
+ * ```
3573
+ */
3574
+ sponsorableMany: (logins: string[], options?: BaseOptions) => Promise<SponsorableManyResult[]>;
3549
3575
  /**
3550
3576
  * Lists what an account did across the repositories the credential can see, in the feed's order as for
3551
3577
  * {@link ReposApi.events}, with the same conditional requests and throttling. Each event has `source: 'poll'`.
@@ -3695,8 +3721,6 @@ interface ForgeProvider<HasWeb extends boolean = boolean> {
3695
3721
  */
3696
3722
  parseReferences: (text: string, options: ParseReferencesOptions) => ParsedReference[];
3697
3723
  }
3698
- //#endregion
3699
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/index-DlB9rINi.d.mts
3700
3724
  /**
3701
3725
  * A GraphQL document that carries the types of its result and variables, such as a `TypedDocumentString`
3702
3726
  * from GraphQL Code Generator with `documentMode: 'string'`.
@@ -3728,8 +3752,6 @@ interface GitHubProvider extends ForgeProvider<true> {
3728
3752
  */
3729
3753
  graphql: GitHubGraphQL;
3730
3754
  }
3731
- //#endregion
3732
- //#region src/conditional.d.ts
3733
3755
  /** A response body that a later request can revalidate with `If-None-Match`. */
3734
3756
  interface ForgeCachedResponse {
3735
3757
  etag: string;
@@ -3766,8 +3788,6 @@ export declare function forgeMemoryCache(options?: ForgeMemoryCacheOptions): For
3766
3788
  * Every read still reaches the Forge, so a cached body is only returned when the Forge says it is current.
3767
3789
  */
3768
3790
  export declare function conditionalFetch(fetcher: typeof fetch, options?: ForgeConditionalRequests): typeof fetch;
3769
- //#endregion
3770
- //#region ../internal/src/forge.d.ts
3771
3791
  /**
3772
3792
  * The Server Env names of each Forge, and the HTTP status of a failed Forge request. `@vite-hub/forge` exports them.
3773
3793
  * Channels and Workspaces import them from here, so an app without a Forge does not install or bundle `@vite-hub/forge`.
@@ -3799,8 +3819,6 @@ export declare const forgeEnv: ForgeEnv;
3799
3819
  export declare function readForgeEnv(field: ForgeEnvField, env?: Record<string, unknown> | ((name: string) => unknown)): string | undefined;
3800
3820
  /** The HTTP status of a failed Forge request, or undefined for other errors. */
3801
3821
  export declare function forgeErrorStatus(error: unknown): number | undefined;
3802
- //#endregion
3803
- //#region src/provider.d.ts
3804
3822
  /** The Forges that ViteHub supports. */
3805
3823
  type ForgeKind = "github" | "gitlab" | "forgejo" | "gitea";
3806
3824
  interface ForgeConnection {
@@ -3840,8 +3858,6 @@ export declare function isForgeResponseError(error: unknown): boolean;
3840
3858
  export declare function abortError(signal: AbortSignal): Error;
3841
3859
  /** Reject with the abort reason when `signal` aborts before `promise` settles. */
3842
3860
  export declare function withSignal<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T>;
3843
- //#endregion
3844
- //#region src/use-forge.d.ts
3845
3861
  /** Where `useForge()` reads its env: a record such as `process.env`, or a lookup by variable name. */
3846
3862
  type ForgeEnvSource = Record<string, unknown> | ((name: string) => unknown);
3847
3863
  interface UseForgeOptions<TKind extends ForgeKind = "github"> {
@@ -3925,8 +3941,6 @@ interface Forge$1<TKind extends ForgeKind = ForgeKind> {
3925
3941
  * ```
3926
3942
  */
3927
3943
  export declare function useForge<TKind extends ForgeKind = "github">(options?: UseForgeOptions<TKind>): Forge$1<TKind>;
3928
- //#endregion
3929
- //#region src/gaps/archive.d.ts
3930
3944
  interface ForgeArchiveOptions {
3931
3945
  /** Branch, tag or commit sha. */
3932
3946
  ref: string;
@@ -3940,8 +3954,6 @@ interface ForgeArchiveOptions {
3940
3954
  * (https://github.com/danielroe/forges/issues/191).
3941
3955
  */
3942
3956
  export declare function forgeArchive(provider: ForgeProvider, repo: RepoRef, options: ForgeArchiveOptions): Promise<ReadableStream<Uint8Array>>;
3943
- //#endregion
3944
- //#region src/gaps/blob.d.ts
3945
3957
  /**
3946
3958
  * The bytes of one Git blob, by its sha. The blob of a symlink holds the link target.
3947
3959
  * Gap: `forges` reads files by path only, and GitHub follows a symlink path to its target.
@@ -3950,8 +3962,6 @@ export declare function forgeArchive(provider: ForgeProvider, repo: RepoRef, opt
3950
3962
  export declare function forgeBlob(provider: ForgeProvider, repo: RepoRef, sha: string, options?: {
3951
3963
  signal?: AbortSignal;
3952
3964
  }): Promise<Uint8Array>;
3953
- //#endregion
3954
- //#region src/gaps/branch-rules.d.ts
3955
3965
  /** What GitHub branch rules ask for beyond `BranchRules` from `provider.repos.branchRules()`. */
3956
3966
  interface GitHubBranchRuleDetails {
3957
3967
  /** An active ruleset requires workflows, which cannot be reduced to check names. */
@@ -3975,8 +3985,6 @@ export declare function githubBranchRuleDetails(rules: BranchRules): GitHubBranc
3975
3985
  * branch unprotected, this returns no rules. Any other 403 still rejects, so a missing permission never reads as no rules.
3976
3986
  */
3977
3987
  export declare function forgeBranchRules(provider: ForgeProvider, repo: RepoRef, branch: string, options?: BaseOptions): Promise<BranchRules>;
3978
- //#endregion
3979
- //#region src/gaps/commit-files.d.ts
3980
3988
  /** Git file modes: a regular file, an executable file and a symlink. The content of a symlink is its target. */
3981
3989
  type ForgeFileMode = "100644" | "100755" | "120000";
3982
3990
  interface ForgeFileChange extends FileChange {
@@ -3993,8 +4001,6 @@ interface ForgeCommitFilesInput extends Omit<CommitFilesInput, "changes"> {
3993
4001
  * Proposed upstream as `FileChange.mode` (https://github.com/danielroe/forges/issues/296).
3994
4002
  */
3995
4003
  export declare function forgeCommitFiles(provider: ForgeProvider, repo: RepoRef, input: ForgeCommitFilesInput, options?: BaseOptions): Promise<string>;
3996
- //#endregion
3997
- //#region src/gaps/git-credentials.d.ts
3998
4004
  interface ForgeGitCredentialsInput {
3999
4005
  forge: ForgeKind;
4000
4006
  /** The same `baseUrl` as `forgeProvider()`. GitHub: API base. GitLab, Forgejo and Gitea: instance root. */
@@ -4025,8 +4031,6 @@ export declare function forgeGitAuthHeader(credentials: ForgeGitCredentials): {
4025
4031
  key: string;
4026
4032
  value: string;
4027
4033
  } | undefined;
4028
- //#endregion
4029
- //#region src/gaps/merge.d.ts
4030
4034
  interface ForgeMergeOptions extends MergeOptions {
4031
4035
  /**
4032
4036
  * GitHub only. Merge past failing branch rules, such as a required check. GitHub accepts it only from an
@@ -4038,12 +4042,8 @@ interface ForgeMergeOptions extends MergeOptions {
4038
4042
  }
4039
4043
  /** `threads.merge()`, which can also bypass GitHub branch rules. */
4040
4044
  export declare function forgeMerge(provider: ForgeProvider, thread: ThreadRef, options?: ForgeMergeOptions): Promise<MergeResult>;
4041
- //#endregion
4042
- //#region src/gaps/retarget.d.ts
4043
4045
  /** Change the base branch of a GitHub pull request. */
4044
4046
  export declare function retargetPullRequest(provider: ForgeProvider, thread: ThreadRef, base: string, options?: BaseOptions): Promise<void>;
4045
- //#endregion
4046
- //#region src/github-app.d.ts
4047
4047
  interface GitHubAppCredentials {
4048
4048
  installationToken(installationId: number | string, options?: {
4049
4049
  refresh?: boolean;
@@ -4114,8 +4114,6 @@ interface GitHubAppInput {
4114
4114
  export declare function githubAppCredentials(input: GitHubAppInput): GitHubAppCredentials;
4115
4115
  /** Read a GitHub App private key from an inline value or a file path. Escaped "\\n" becomes a newline. */
4116
4116
  export declare function readGitHubAppPrivateKey(inline: string | undefined, path: string | undefined): Promise<string | undefined>;
4117
- //#endregion
4118
- //#region src/github-installations.d.ts
4119
4117
  /**
4120
4118
  * Which GitHub App installation serves each repository owner. Every reader of the GitHub Server Env routes with it,
4121
4119
  * so `useForge()`, Capabilities, Comments, and presets pick the same installation.
@@ -4145,5 +4143,4 @@ export declare function githubInstallationRouting(env: GitHubInstallationEnv): G
4145
4143
  * reach the repository.
4146
4144
  */
4147
4145
  export declare function githubInstallationFor(routing: GitHubInstallationRouting, repository: string | undefined): number | undefined;
4148
- //#endregion
4149
4146
  export { type BaseOptions, BranchMovedError, type BranchRules, type Check, type CiRun, type CiRunRef, type Commit, type Forge$1 as Forge, ForgeApiError, type ForgeAppIdentity, type ForgeArchiveOptions, type ForgeCachedResponse, type ForgeCallOptions, type ForgeCommitFilesInput, type ForgeConditionalRequests, type ForgeConnection, type ForgeEnv, type ForgeEnvField, type ForgeEnvSource, type ForgeErrorCode, type ForgeFileChange, type ForgeFileMode, type ForgeGitCredentials, type ForgeGitCredentialsInput, type ForgeKind, type ForgeMemoryCacheOptions, type ForgeMergeOptions, type ForgeProvider, type ForgeProviderOf, type ForgeResponseCache, ForgeTimeoutError, type ForgeToken, type ForgeTokenErrorCode, type GitHubAppCredentials, type GitHubAppDelivery, type GitHubAppInput, type GitHubAppRepository, type GitHubBranchRuleDetails, type GitHubInstallationEnv, type GitHubInstallationRouting, type GitHubProvider, MergeBlockedError, type MergeMethod, type MergeOptions, type MergeResult, NotFoundError, type Page, RateLimitedError, type RepoRef, type RequiredCheck, type Thread, type ThreadRef, type TreeEntry, type UseForgeOptions, repoRef };