@vite-hub/forge 0.5.0 → 0.6.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 (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,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/association-Ds6Tgs0W.mjs
1
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/association-Ds6Tgs0W.mjs
2
2
  const AUTHOR_ASSOCIATIONS = {
3
3
  OWNER: "owner",
4
4
  MEMBER: "member",
@@ -15,5 +15,4 @@ function toAuthorAssociation(raw) {
15
15
  authorAssociationRaw: raw
16
16
  } : {};
17
17
  }
18
- //#endregion
19
18
  export { toAuthorAssociation as t };
@@ -1,5 +1,4 @@
1
- import { a as buildMetaName, i as buildMetaContent, n as ForgeBuild, o as parseBuildMeta, r as buildIdentity, t as BuildIdentity } from "../identity-CNTWZZuv.js";
2
- //#region src/build/read.d.ts
1
+ import { a as buildMetaName, i as buildMetaContent, n as ForgeBuild, o as parseBuildMeta, r as buildIdentity, t as BuildIdentity } from "../identity-D2-HaDku.js";
3
2
  /** `owner/name` of a GitHub or Enterprise remote. The forge's API URL selects the server at runtime. */
4
3
  export declare function githubRepository(remote: string | undefined): string | undefined;
5
4
  /**
@@ -8,5 +7,4 @@ export declare function githubRepository(remote: string | undefined): string | u
8
7
  * that have neither CI variables nor `.git`, such as a Docker build. Empty outside a Git checkout.
9
8
  */
10
9
  export declare function readForgeBuild(root: string, env?: Record<string, string | undefined>): Promise<ForgeBuild>;
11
- //#endregion
12
10
  export { type BuildIdentity, type ForgeBuild, buildIdentity, buildMetaContent, buildMetaName, parseBuildMeta };
@@ -1,8 +1,8 @@
1
- import { i as parseBuildMeta, n as buildMetaContent, r as buildMetaName, t as buildIdentity } from "../identity-CmVEBLP5.js";
1
+ import { i as parseBuildMeta, n as buildMetaContent, r as buildMetaName, t as buildIdentity } from "../identity-BwC2_3S9.js";
2
2
  import { execFile } from "node:child_process";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { promisify } from "node:util";
5
- //#region ../internal/src/build/revision.ts
5
+ // ../internal/src/build/revision.ts
6
6
  /** CI and host variables that name the commit and branch of a build, in the order they are read. */
7
7
  const buildVariables = [
8
8
  ["VERCEL_GIT_COMMIT_SHA", "VERCEL_GIT_COMMIT_REF"],
@@ -72,8 +72,7 @@ async function readBuildRevision(root, env = process.env, git = (args) => readGi
72
72
  ...branch ? { branch } : {}
73
73
  };
74
74
  }
75
- //#endregion
76
- //#region src/build/read.ts
75
+ // src/build/read.ts
77
76
  /** `owner/name` of a GitHub or Enterprise remote. The forge's API URL selects the server at runtime. */
78
77
  function githubRepository(remote) {
79
78
  return remote ? /^(?:(?:https?|ssh|git):\/\/[^/]+\/|(?:[^@/:]+@)?[\w.-]+:)([\w.-]+\/[\w.-]+?)(?:\.git)?\/?$/.exec(remote.trim())?.[1] : void 0;
@@ -101,5 +100,4 @@ async function readForgeBuild(root, env = process.env) {
101
100
  ...pullRequest ? { pullRequest } : {}
102
101
  };
103
102
  }
104
- //#endregion
105
103
  export { buildIdentity, buildMetaContent, buildMetaName, githubRepository, parseBuildMeta, readForgeBuild };
package/dist/build.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as buildMetaName, i as buildMetaContent, n as ForgeBuild, o as parseBuildMeta, r as buildIdentity, t as BuildIdentity } from "./identity-CNTWZZuv.js";
1
+ import { a as buildMetaName, i as buildMetaContent, n as ForgeBuild, o as parseBuildMeta, r as buildIdentity, t as BuildIdentity } from "./identity-D2-HaDku.js";
2
2
  export { type BuildIdentity, type ForgeBuild, buildIdentity, buildMetaContent, buildMetaName, parseBuildMeta };
package/dist/build.js CHANGED
@@ -1,2 +1 @@
1
- import { i as parseBuildMeta, n as buildMetaContent, r as buildMetaName, t as buildIdentity } from "./identity-CmVEBLP5.js";
2
- export { buildIdentity, buildMetaContent, buildMetaName, parseBuildMeta };
1
+ export { t as buildIdentity, n as buildMetaContent, r as buildMetaName, i as parseBuildMeta } from "./identity-BwC2_3S9.js";
@@ -1,6 +1,6 @@
1
- import { $ as toDate, A as hexColour, B as milestoneId, C as createListing, F as latestCommentOf, G as requireIssueOrPull, I as mapConcurrent, K as requireThread, L as memo, M as isFirstPage, O as getManyConcurrently, Q as teamOrg, R as memoBy, U as rateLimitPart, X as summariseChecks, Y as soleMergeMethod, at as versionAtLeast, ct as isNamespaceRef, d as NotFoundError, et as toFileStatus, g as UnsupportedOperationError, it as toWarning, j as hostOf, k as hasEveryLabel, n as BranchMovedError, nt as toPage, o as ForgeError, pt as reactionContent, q as resolveToken, rt as toPullStats, tt as toMergeError, y as actorLogin } from "./utils-DC7MBR65-B7Vr2hFm.js";
2
- import { C as verb, S as toFileContent, T as githubShapedWeb, _ as reviewState, a as verifyHmacSignature, c as changeBase64, d as eventTime, f as existingFiles, g as perKind, m as inDirectories, 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-khKJ7nW8.mjs
1
+ import { B as memo, F as hostOf, I as isFirstPage, J as requireIssueOrPull, K as rateLimitPart, M as getManyConcurrently, N as hasEveryLabel, O as createListing, P as hexColour, Q as summariseChecks, R as latestCommentOf, U as milestoneId, V as memoBy, X as resolveToken, Y as requireThread, a as verifyHmacSignature, at as toWarning, ct as changeBase64, d as perKind, dt as inDirectories, et as teamOrg, f as reviewState, g as verb, it as toPullStats, lt as existingFiles, mt as toFileContent, nt as toFileStatus, ot as versionAtLeast, r as nativeEventsFor, rt as toPage, s as WRITE_VERBS, t as eventKindsOf, tt as toDate, u as eventTime, ut as fromBase64, w as actorLogin, y as githubShapedWeb, z as mapConcurrent } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { A as toMergeError, T as UnsupportedOperationError, b as NotFoundError, k as soleMergeMethod, m as ForgeError, n as isNamespaceRef, s as reactionContent, u as BranchMovedError } from "./model-Biiu1CfI-CVLamGai.js";
3
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/web-C0rMyC0A.mjs
4
4
  const RESERVED_PATHS = [
5
5
  "-",
6
6
  ".well-known",
@@ -50,8 +50,7 @@ function forgejoWeb(forge, baseUrl) {
50
50
  }
51
51
  const FORGEJO_WEB = /* @__PURE__ */ forgejoWeb("forgejo", "https://codeberg.org");
52
52
  const GITEA_WEB = /* @__PURE__ */ forgejoWeb("gitea", "https://gitea.com");
53
- //#endregion
54
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/definition-0wjaAw2i.mjs
53
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/definition-BQFdu9ti.mjs
55
54
  const FORGEJO_HEADERS = {
56
55
  signature: ["x-forgejo-signature", "x-gitea-signature"],
57
56
  event: [
@@ -1028,7 +1027,7 @@ function forgejoWebhooks(profile) {
1028
1027
  return ({ options, origin }) => ({
1029
1028
  events: FORGEJO_WEBHOOK_EVENTS,
1030
1029
  verify: (delivery) => verifyForgejoSignature(delivery, options.webhookSecret, profile.headers),
1031
- translate: async (delivery) => (await import("./events-DmSWTdpS-oDiTlP1L.js")).translateForgejoWebhook(origin, delivery, profile.headers)
1030
+ translate: async (delivery) => (await import("./events-DXE-Ul2S-BzTkugIK.js")).translateForgejoWebhook(origin, delivery, profile.headers)
1032
1031
  });
1033
1032
  }
1034
1033
  const YAML_FILE = /\.ya?ml$/i;
@@ -1529,7 +1528,7 @@ function setupForgejo({ options, origin, fetcher: baseFetcher, baseUrl }, profil
1529
1528
  return released(isGitea ? giteaMinimum : forgejoMinimum);
1530
1529
  }
1531
1530
  async function feedPage(path, listOptions, query) {
1532
- const { toFeedEvent } = await import("./feed-BwdcTgZq-CbyczJHA.js");
1531
+ const { toFeedEvent } = await import("./feed-iWegqepj-ConxMpg4.js");
1533
1532
  return list(path, listOptions, (raw) => toFeedEvent(origin, raw), { query });
1534
1533
  }
1535
1534
  async function setBlocked(scope, login, blocked, options) {
@@ -1713,6 +1712,8 @@ function setupForgejo({ options, origin, fetcher: baseFetcher, baseUrl }, profil
1713
1712
  authKinds: ["token", "anonymous"]
1714
1713
  },
1715
1714
  notApplicable: [
1715
+ "users.sponsorable",
1716
+ "users.sponsorableMany",
1716
1717
  ...isGitea ? [] : ["threads.lock"],
1717
1718
  "threads.hideComment",
1718
1719
  "threads.resolveReviewThread",
@@ -2322,5 +2323,4 @@ function forgejoScopesFor(verb) {
2322
2323
  if (group === "threads" || group === "repos" || group === "contents" || group === "releases" || group === "checks" || group === "ci") return { token: [write ? "write:issue" : "read:issue", write ? "write:repository" : "read:repository"] };
2323
2324
  return {};
2324
2325
  }
2325
- //#endregion
2326
2326
  export { toActor as a, GITEA_WEB as c, forgejoDefinition as i, FORGEJO_PROFILE as n, toRepoRef as o, GITEA_HEADERS as r, toThread as s, FORGEJO_HEADERS as t };
@@ -1,7 +1,6 @@
1
- import { $ as toDate } from "./utils-DC7MBR65-B7Vr2hFm.js";
2
- import { A as headerValue, d as eventTime, i as refEvent, k as bodyText, v as snapshotOfThread } from "./webhooks-Bc6QhmI8-CNgCERCq.js";
3
- import { a as toRepoRef, i as toPullThread, n as toActor, r as toIssueThread, t as FORGE } from "./gitee-BXyl2_3W-dQOAjWqr.js";
4
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/events-DW3SFUDA.mjs
1
+ import { gt as headerValue, ht as bodyText, i as refEvent, p as snapshotOfThread, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { a as toRepoRef, i as toPullThread, n as toActor, r as toIssueThread, t as FORGE } from "./gitee-CKt4pEC0-BuLWggck.js";
3
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/events-BL0zcgMf.mjs
5
4
  const STATES = {
6
5
  open: "open",
7
6
  reopen: "open",
@@ -120,5 +119,4 @@ function translateGiteeWebhook(instance, delivery) {
120
119
  summary: `${who} ${payload.action ?? "changed"} ${thread ? `${thread.kind === "issue" ? "" : "!"}${thread.number}` : hook}`
121
120
  }];
122
121
  }
123
- //#endregion
124
122
  export { translateGiteeWebhook };
@@ -1,7 +1,7 @@
1
- import { $ as toDate, _ as WebhookVerificationError } from "./utils-DC7MBR65-B7Vr2hFm.js";
2
- import { A as headerValue, d as eventTime, i as refEvent, k as bodyText, u as eventAction, x as threadSnapshot } from "./webhooks-Bc6QhmI8-CNgCERCq.js";
3
- import { a as toRepoRef, i as toLabel, n as approvalId, o as toState, r as toActor, t as FORGE } from "./gitlab-zvWb9zOi.js";
4
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/events-uCMi3LHU.mjs
1
+ import { gt as headerValue, h as threadSnapshot, ht as bodyText, i as refEvent, l as eventAction, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { E as WebhookVerificationError } from "./model-Biiu1CfI-CVLamGai.js";
3
+ import { a as toRepoRef, i as toLabel, n as approvalId, o as toState, r as toActor, t as FORGE } from "./gitlab-CS0shW2u.js";
4
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/events-DDdJnmD2.mjs
5
5
  const EVENT_HEADER = "x-gitlab-event";
6
6
  function snapshotOf(instance, raw) {
7
7
  return raw && threadSnapshot({
@@ -350,5 +350,4 @@ function translateGitLabWebhook(instance, delivery) {
350
350
  payload
351
351
  }];
352
352
  }
353
- //#endregion
354
353
  export { translateGitLabWebhook };
@@ -1,7 +1,7 @@
1
- import { $ as toDate, _ as WebhookVerificationError, rt as toPullStats } from "./utils-DC7MBR65-B7Vr2hFm.js";
2
- import { A as headerValue, _ as reviewState, d as eventTime, i as refEvent, k as bodyText, u as eventAction, x as threadSnapshot } from "./webhooks-Bc6QhmI8-CNgCERCq.js";
3
- import { a as toRepoRef, i as toLabels, n as toActor, o as toThreadState, r as toIssueType, t as FORGE } from "./github-CUiEF2FK.js";
4
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/events-DjRw3KSr.mjs
1
+ import { f as reviewState, gt as headerValue, h as threadSnapshot, ht as bodyText, i as refEvent, it as toPullStats, l as eventAction, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { E as WebhookVerificationError } from "./model-Biiu1CfI-CVLamGai.js";
3
+ import { a as toThreadState, i as toRepoRef, n as toIssueType, r as toLabels, t as toActor } from "./github-CHzhqYOr.js";
4
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/events-DHqSJ5KI.mjs
5
5
  const EVENT_HEADER = "x-github-event";
6
6
  const DELIVERY_HEADER = "x-github-delivery";
7
7
  function visibilityChange(isPublic, who, payload) {
@@ -16,7 +16,7 @@ function visibilityChange(isPublic, who, payload) {
16
16
  occurredAt: toDate(payload.repository?.updated_at)
17
17
  };
18
18
  }
19
- function repoLevel(instance, event, payload, who, repo) {
19
+ function repoLevel(origin, event, payload, who, repo) {
20
20
  switch (event) {
21
21
  case "push": return {
22
22
  ...refEvent(who, {
@@ -103,7 +103,7 @@ function repoLevel(instance, event, payload, who, repo) {
103
103
  action: "created",
104
104
  detail: {
105
105
  type: "fork",
106
- fork: payload.forkee ? toRepoRef(instance, payload.forkee) : void 0
106
+ fork: payload.forkee ? toRepoRef(origin, payload.forkee) : void 0
107
107
  },
108
108
  summary: `${who} forked the repository${payload.forkee ? ` to ${payload.forkee.full_name}` : ""}`,
109
109
  occurredAt: toDate(payload.forkee?.created_at)
@@ -128,8 +128,8 @@ function repoLevel(instance, event, payload, who, repo) {
128
128
  type: "installation",
129
129
  actionRaw: payload.action ?? event,
130
130
  installationId: payload.installation ? String(payload.installation.id) : void 0,
131
- added: (payload.repositories_added ?? (payload.action === "created" ? payload.repositories : void 0) ?? []).map((repo) => toRepoRef(instance, repo)),
132
- removed: (payload.repositories_removed ?? []).map((repo) => toRepoRef(instance, repo))
131
+ added: (payload.repositories_added ?? (payload.action === "created" ? payload.repositories : void 0) ?? []).map((repo) => toRepoRef(origin, repo)),
132
+ removed: (payload.repositories_removed ?? []).map((repo) => toRepoRef(origin, repo))
133
133
  },
134
134
  summary: `${who} ${payload.action ?? "changed"} the installation`
135
135
  };
@@ -139,7 +139,7 @@ function repoLevel(instance, event, payload, who, repo) {
139
139
  detail: {
140
140
  type: "membership",
141
141
  actionRaw: payload.action ?? event,
142
- member: toActor(instance, payload.member ?? payload.membership?.user)
142
+ member: toActor(origin, payload.member ?? payload.membership?.user)
143
143
  },
144
144
  summary: `${who} ${payload.action ?? "changed"} a member`
145
145
  };
@@ -151,8 +151,8 @@ function repoLevel(instance, event, payload, who, repo) {
151
151
  detail: {
152
152
  type: "release",
153
153
  release: {
154
- forge: FORGE,
155
- instance,
154
+ forge: origin.forge,
155
+ instance: origin.instance,
156
156
  repo,
157
157
  id: String(payload.release.id),
158
158
  tag: payload.release.tag_name
@@ -177,7 +177,7 @@ const THREAD_EVENT_KIND = {
177
177
  pull_request_review: "review",
178
178
  pull_request_review_comment: "review_comment"
179
179
  };
180
- function threadOf(payload, repo, instance) {
180
+ function threadOf(payload, repo, origin) {
181
181
  if (!repo) return;
182
182
  const candidates = [
183
183
  ["pull_request", payload.pull_request],
@@ -185,8 +185,8 @@ function threadOf(payload, repo, instance) {
185
185
  [payload.issue?.pull_request ? "pull_request" : "issue", payload.issue]
186
186
  ];
187
187
  for (const [kind, subject] of candidates) if (subject) return {
188
- forge: FORGE,
189
- instance,
188
+ forge: origin.forge,
189
+ instance: origin.instance,
190
190
  repo,
191
191
  kind,
192
192
  number: String(subject.number),
@@ -194,27 +194,27 @@ function threadOf(payload, repo, instance) {
194
194
  };
195
195
  }
196
196
  /** The commit of a comment on a commit, which names no thread. */
197
- function commitOf(payload, thread, repo, instance) {
197
+ function commitOf(payload, thread, repo, origin) {
198
198
  return !thread && repo && payload.comment?.commit_id ? {
199
- forge: FORGE,
200
- instance,
199
+ forge: origin.forge,
200
+ instance: origin.instance,
201
201
  repo,
202
202
  sha: payload.comment.commit_id
203
203
  } : void 0;
204
204
  }
205
205
  /** The repository a pull request's head is on. Activity feeds name it by an API `url` alone. */
206
- function headRepo(instance, repo) {
207
- if (repo?.full_name) return toRepoRef(instance, repo);
206
+ function headRepo(origin, repo) {
207
+ if (repo?.full_name) return toRepoRef(origin, repo);
208
208
  const [, owner, name] = repo?.url?.match(/\/repos\/([^/]+)\/([^/]+)$/) ?? [];
209
209
  return owner && name ? {
210
- forge: FORGE,
211
- instance,
210
+ forge: origin.forge,
211
+ instance: origin.instance,
212
212
  owner,
213
213
  name,
214
214
  externalId: repo?.id === void 0 ? void 0 : String(repo.id)
215
215
  } : void 0;
216
216
  }
217
- function snapshotOf(instance, payload) {
217
+ function snapshotOf(origin, payload) {
218
218
  const raw = payload.pull_request ?? payload.discussion ?? payload.issue;
219
219
  return raw && threadSnapshot({
220
220
  title: raw.title,
@@ -228,7 +228,7 @@ function snapshotOf(instance, payload) {
228
228
  stateRaw: raw.state,
229
229
  stateReason: raw.state_reason ?? void 0,
230
230
  isDraft: raw.draft,
231
- author: toActor(instance, raw.user),
231
+ author: toActor(origin, raw.user),
232
232
  labels: raw.labels && toLabels(raw.labels),
233
233
  issueType: toIssueType(raw.type),
234
234
  url: raw.html_url,
@@ -236,7 +236,7 @@ function snapshotOf(instance, payload) {
236
236
  head: {
237
237
  ref: raw.head.ref,
238
238
  sha: raw.head.sha,
239
- repo: headRepo(instance, raw.head.repo)
239
+ repo: headRepo(origin, raw.head.repo)
240
240
  },
241
241
  base: {
242
242
  ref: raw.base.ref,
@@ -250,7 +250,7 @@ function snapshotOf(instance, payload) {
250
250
  changedFileCount: raw.changed_files,
251
251
  commitCount: raw.commits
252
252
  }),
253
- mergedBy: toActor(instance, raw.merged_by)
253
+ mergedBy: toActor(origin, raw.merged_by)
254
254
  });
255
255
  }
256
256
  function eventKindFor(event, payload) {
@@ -308,11 +308,11 @@ function actionOf(event, payload) {
308
308
  if (event === "pull_request" && payload.action === "closed" && payload.pull_request?.merged) return "merged";
309
309
  return eventAction(payload.action);
310
310
  }
311
- function detailOf(kind, thread, commit, instance, payload) {
311
+ function detailOf(kind, thread, commit, origin, payload) {
312
312
  const comment = payload.comment;
313
313
  const commentRef = comment?.id !== void 0 && thread ? {
314
- forge: FORGE,
315
- instance,
314
+ forge: origin.forge,
315
+ instance: origin.instance,
316
316
  thread,
317
317
  id: thread.kind === "discussion" && comment.node_id ? comment.node_id : String(comment.id)
318
318
  } : void 0;
@@ -320,8 +320,8 @@ function detailOf(kind, thread, commit, instance, payload) {
320
320
  case "comment": return {
321
321
  type: "comment",
322
322
  comment: commentRef ?? (comment?.id !== void 0 && commit ? {
323
- forge: "github",
324
- instance,
323
+ forge: origin.forge,
324
+ instance: origin.instance,
325
325
  commit,
326
326
  id: String(comment.id)
327
327
  } : void 0),
@@ -340,8 +340,8 @@ function detailOf(kind, thread, commit, instance, payload) {
340
340
  stateRaw: payload.review?.state,
341
341
  body: payload.review?.body ?? void 0,
342
342
  review: payload.review?.id !== void 0 && thread ? {
343
- forge: FORGE,
344
- instance,
343
+ forge: origin.forge,
344
+ instance: origin.instance,
345
345
  thread,
346
346
  id: String(payload.review.id)
347
347
  } : void 0
@@ -356,7 +356,7 @@ function detailOf(kind, thread, commit, instance, payload) {
356
356
  } : void 0;
357
357
  case "assignment": return {
358
358
  type: "assignment",
359
- assignee: toActor(instance, payload.assignee ?? payload.requested_reviewer ?? void 0)
359
+ assignee: toActor(origin, payload.assignee ?? payload.requested_reviewer ?? void 0)
360
360
  };
361
361
  case "state_change": {
362
362
  const pull = payload.pull_request;
@@ -373,12 +373,12 @@ function detailOf(kind, thread, commit, instance, payload) {
373
373
  }
374
374
  }
375
375
  /** Normalises a GitHub event, named as a webhook names it, from a webhook delivery or an activity feed. */
376
- function toGitHubEvent(instance, event, payload, context) {
376
+ function toGitHubEvent(origin, event, payload, context) {
377
377
  const { actor, repo } = context;
378
- const level = repoLevel(instance, event, payload, actor?.login ?? "someone", repo);
378
+ const level = repoLevel(origin, event, payload, actor?.login ?? "someone", repo);
379
379
  if (level) return {
380
- forge: FORGE,
381
- instance,
380
+ forge: origin.forge,
381
+ instance: origin.instance,
382
382
  id: context.id,
383
383
  kind: level.kind,
384
384
  action: level.action,
@@ -393,45 +393,45 @@ function toGitHubEvent(instance, event, payload, context) {
393
393
  source: context.source,
394
394
  payload: context.payload ?? payload
395
395
  };
396
- const thread = threadOf(payload, repo, instance);
397
- const commit = commitOf(payload, thread, repo, instance);
396
+ const thread = threadOf(payload, repo, origin);
397
+ const commit = commitOf(payload, thread, repo, origin);
398
398
  const kind = eventKindFor(event, payload);
399
399
  return {
400
- forge: FORGE,
401
- instance,
400
+ forge: origin.forge,
401
+ instance: origin.instance,
402
402
  id: context.id,
403
403
  kind,
404
404
  kindRaw: context.kindRaw,
405
405
  action: actionOf(event, payload),
406
406
  actionRaw: context.actionRaw,
407
- detail: detailOf(kind, thread, commit, instance, payload),
407
+ detail: detailOf(kind, thread, commit, origin, payload),
408
408
  summary: summarise(event, payload, actor?.login ?? "someone"),
409
409
  ...eventTime(context.occurredAt ?? threadTime(payload)),
410
410
  actor,
411
411
  repo,
412
412
  thread,
413
413
  commit,
414
- threadSnapshot: snapshotOf(instance, payload),
414
+ threadSnapshot: snapshotOf(origin, payload),
415
415
  installationId: context.installationId,
416
416
  source: context.source,
417
417
  payload: context.payload ?? payload
418
418
  };
419
419
  }
420
- function translateGitHubWebhook(instance, delivery) {
420
+ function translateGitHubWebhook(origin, delivery) {
421
421
  const event = headerValue(delivery.headers, EVENT_HEADER);
422
422
  if (!event) throw new WebhookVerificationError(`Missing ${EVENT_HEADER} header`, {
423
- forge: FORGE,
424
- instance
423
+ forge: origin.forge,
424
+ instance: origin.instance
425
425
  });
426
426
  const payload = JSON.parse(bodyText(delivery.body));
427
427
  const id = headerValue(delivery.headers, DELIVERY_HEADER) ?? crypto.randomUUID();
428
- return perPage(event, payload).map(([page, suffix]) => toGitHubEvent(instance, event, page, {
428
+ return perPage(event, payload).map(([page, suffix]) => toGitHubEvent(origin, event, page, {
429
429
  id: `${id}${suffix}`,
430
430
  kindRaw: verbOf(page) ? `${event}.${verbOf(page)}` : event,
431
431
  actionRaw: verbOf(page),
432
432
  source: "webhook",
433
- actor: toActor(instance, payload.sender),
434
- repo: payload.repository ? toRepoRef(instance, payload.repository) : void 0,
433
+ actor: toActor(origin, payload.sender),
434
+ repo: payload.repository ? toRepoRef(origin, payload.repository) : void 0,
435
435
  installationId: payload.installation ? String(payload.installation.id) : void 0
436
436
  }));
437
437
  }
@@ -469,30 +469,30 @@ const FEED_EVENTS = {
469
469
  /** Summaries of the feed event types that have no shared kind. */
470
470
  const FEED_SUMMARIES = { SponsorshipEvent: "changed a sponsorship" };
471
471
  /** Normalises an item of an activity feed into one event per wiki page, and one event otherwise. */
472
- function toFeedEvents(instance, raw) {
472
+ function toFeedEvents(origin, raw) {
473
473
  const pages = raw.type === "GollumEvent" ? perPage("gollum", raw.payload ?? {}) : [];
474
474
  return pages.length > 1 ? pages.map(([payload, suffix]) => ({
475
- ...toFeedEvent(instance, {
475
+ ...toFeedEvent(origin, {
476
476
  ...raw,
477
477
  payload
478
478
  }),
479
479
  id: `${raw.id}${suffix}`,
480
480
  payload: raw
481
- })) : [toFeedEvent(instance, raw)];
481
+ })) : [toFeedEvent(origin, raw)];
482
482
  }
483
483
  /** Normalises an item of a repository's or an account's activity feed. */
484
- function toFeedEvent(instance, raw) {
484
+ function toFeedEvent(origin, raw) {
485
485
  const type = raw.type ?? "Event";
486
486
  const payload = raw.payload ?? {};
487
487
  const [owner = "", name = ""] = raw.repo?.name.split("/") ?? [];
488
488
  const repo = raw.repo ? {
489
- forge: FORGE,
490
- instance,
489
+ forge: origin.forge,
490
+ instance: origin.instance,
491
491
  owner,
492
492
  name,
493
493
  externalId: String(raw.repo.id)
494
494
  } : void 0;
495
- const actor = toActor(instance, raw.actor);
495
+ const actor = toActor(origin, raw.actor);
496
496
  const visibility = typeof raw.public === "boolean" ? { isPublic: raw.public } : {};
497
497
  const context = {
498
498
  id: raw.id,
@@ -506,8 +506,8 @@ function toFeedEvent(instance, raw) {
506
506
  };
507
507
  const event = FEED_EVENTS[type];
508
508
  if (!event) return {
509
- forge: FORGE,
510
- instance,
509
+ forge: origin.forge,
510
+ instance: origin.instance,
511
511
  ...context,
512
512
  kind: "other",
513
513
  summary: `${actor?.login ?? "someone"} ${FEED_SUMMARIES[type] ?? type}`,
@@ -516,12 +516,11 @@ function toFeedEvent(instance, raw) {
516
516
  payload: raw
517
517
  };
518
518
  return {
519
- ...toGitHubEvent(instance, event, type === "PullRequestReviewEvent" && payload.action === "created" ? {
519
+ ...toGitHubEvent(origin, event, type === "PullRequestReviewEvent" && payload.action === "created" ? {
520
520
  ...payload,
521
521
  action: "submitted"
522
522
  } : payload, context),
523
523
  ...visibility
524
524
  };
525
525
  }
526
- //#endregion
527
526
  export { toFeedEvents, translateGitHubWebhook };
@@ -1,7 +1,7 @@
1
- import { $ as toDate, _ as WebhookVerificationError } from "./utils-DC7MBR65-B7Vr2hFm.js";
2
- import { _ as reviewState, d as eventTime, i as refEvent, k as bodyText, n as firstHeader, u as eventAction, v as snapshotOfThread } from "./webhooks-Bc6QhmI8-CNgCERCq.js";
3
- import { a as toActor, o as toRepoRef, s as toThread, t as FORGEJO_HEADERS } from "./definition-0wjaAw2i-BwSDtp9h.js";
4
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/events-DmSWTdpS.mjs
1
+ import { f as reviewState, ht as bodyText, i as refEvent, l as eventAction, n as firstHeader, p as snapshotOfThread, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { E as WebhookVerificationError } from "./model-Biiu1CfI-CVLamGai.js";
3
+ import { a as toActor, o as toRepoRef, s as toThread, t as FORGEJO_HEADERS } from "./definition-BQFdu9ti-WxMjcAEl.js";
4
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/events-DXE-Ul2S.mjs
5
5
  const EVENT_KINDS = {
6
6
  issue_comment: "comment",
7
7
  pull_request_comment: "comment",
@@ -210,5 +210,4 @@ function translateForgejoWebhook(origin, delivery, names = FORGEJO_HEADERS) {
210
210
  payload
211
211
  }];
212
212
  }
213
- //#endregion
214
213
  export { translateForgejoWebhook };
@@ -1,7 +1,6 @@
1
- import { $ as toDate } from "./utils-DC7MBR65-B7Vr2hFm.js";
2
- import { d as eventTime, i as refEvent, u as eventAction } from "./webhooks-Bc6QhmI8-CNgCERCq.js";
3
- import { n as approvalId, r as toActor, s as toThreadKind, t as FORGE } from "./gitlab-zvWb9zOi.js";
4
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/feed-BlzdKdNv.mjs
1
+ import { i as refEvent, l as eventAction, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { n as approvalId, r as toActor, s as toThreadKind, t as FORGE } from "./gitlab-CS0shW2u.js";
3
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/feed-B1OiHFg0.mjs
5
4
  const FEED_STATES = {
6
5
  opened: {
7
6
  action: "opened",
@@ -175,5 +174,4 @@ function toFeedEvent(instance, raw, repo) {
175
174
  payload: raw
176
175
  };
177
176
  }
178
- //#endregion
179
177
  export { toFeedEvent };
@@ -1,7 +1,6 @@
1
- import { $ as toDate } from "./utils-DC7MBR65-B7Vr2hFm.js";
2
- import { d as eventTime, i as refEvent, u as eventAction } from "./webhooks-Bc6QhmI8-CNgCERCq.js";
3
- import { a as toRepoRef, n as toActor, t as FORGE } from "./gitee-BXyl2_3W-dQOAjWqr.js";
4
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/feed-CIaAZINm.mjs
1
+ import { i as refEvent, l as eventAction, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { a as toRepoRef, n as toActor, t as FORGE } from "./gitee-CKt4pEC0-BuLWggck.js";
3
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/feed-DROLF1tb.mjs
5
4
  /** Summaries of the feed event types that have no shared kind. */
6
5
  const FEED_SUMMARIES = { WatchEvent: "watched the repository" };
7
6
  const THREAD_TYPES = {
@@ -130,5 +129,4 @@ function toFeedEvent(instance, raw) {
130
129
  payload: raw
131
130
  };
132
131
  }
133
- //#endregion
134
132
  export { toFeedEvent };
@@ -1,7 +1,6 @@
1
- import { $ as toDate } from "./utils-DC7MBR65-B7Vr2hFm.js";
2
- import { d as eventTime, i as refEvent } from "./webhooks-Bc6QhmI8-CNgCERCq.js";
3
- import { a as toActor, o as toRepoRef } from "./definition-0wjaAw2i-BwSDtp9h.js";
4
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/feed-BwdcTgZq.mjs
1
+ import { i as refEvent, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { a as toActor, o as toRepoRef } from "./definition-BQFdu9ti-WxMjcAEl.js";
3
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/feed-iWegqepj.mjs
5
4
  /** Activity types about an issue or a pull request, whose `content` starts with its number. */
6
5
  const FEED_THREAD_OPS = {
7
6
  create_issue: {
@@ -244,5 +243,4 @@ function toFeedEvent(origin, raw) {
244
243
  payload: raw
245
244
  };
246
245
  }
247
- //#endregion
248
246
  export { toFeedEvent };
@@ -1,7 +1,6 @@
1
- import { l as defineForgeProvider } from "./webhooks-Bc6QhmI8-CNgCERCq.js";
2
- import { i as forgejoDefinition, n as FORGEJO_PROFILE } from "./definition-0wjaAw2i-BwSDtp9h.js";
3
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/forgejo/index.mjs
1
+ import { c as defineForgeProvider } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { i as forgejoDefinition, n as FORGEJO_PROFILE } from "./definition-BQFdu9ti-WxMjcAEl.js";
3
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/forgejo/index.mjs
4
4
  /** Creates a Forgejo provider for Codeberg or any self-hosted Forgejo instance. */
5
5
  const forgejo = /* @__PURE__ */ defineForgeProvider(/* @__PURE__ */ forgejoDefinition(FORGEJO_PROFILE));
6
- //#endregion
7
6
  export { forgejo };
@@ -1,11 +1,10 @@
1
- import { l as defineForgeProvider } from "./webhooks-Bc6QhmI8-CNgCERCq.js";
2
- import { c as GITEA_WEB, i as forgejoDefinition, r as GITEA_HEADERS } from "./definition-0wjaAw2i-BwSDtp9h.js";
3
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/gitea/index.mjs
1
+ import { c as defineForgeProvider } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ import { c as GITEA_WEB, i as forgejoDefinition, r as GITEA_HEADERS } from "./definition-BQFdu9ti-WxMjcAEl.js";
3
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/gitea/index.mjs
4
4
  /** Creates a Gitea provider for gitea.com or any self-hosted Gitea instance. */
5
5
  const gitea = /* @__PURE__ */ defineForgeProvider(/* @__PURE__ */ forgejoDefinition({
6
6
  forge: "gitea",
7
7
  web: GITEA_WEB,
8
8
  headers: GITEA_HEADERS
9
9
  }));
10
- //#endregion
11
10
  export { gitea };
@@ -1,5 +1,5 @@
1
- import { $ as toDate } from "./utils-DC7MBR65-B7Vr2hFm.js";
2
- //#region ../../node_modules/.pnpm/forges@0.3.1/node_modules/forges/dist/gitee-BXyl2_3W.mjs
1
+ import { tt as toDate } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
+ // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/gitee-CKt4pEC0.mjs
3
3
  const FORGE = "gitee";
4
4
  function toActor(instance, user) {
5
5
  if (!user) return;
@@ -109,5 +109,4 @@ function toPullThread(ref, raw) {
109
109
  raw
110
110
  };
111
111
  }
112
- //#endregion
113
112
  export { toRepoRef as a, toPullThread as i, toActor as n, toIssueThread as r, FORGE as t };