forges 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENCE +21 -0
- package/README.md +72 -0
- package/dist/azure-devops/index.d.mts +2 -0
- package/dist/azure-devops/index.mjs +1 -0
- package/dist/azure-devops-DwQvL4TV.mjs +1355 -0
- package/dist/bitbucket/index.d.mts +2 -0
- package/dist/bitbucket/index.mjs +1 -0
- package/dist/bitbucket-CpcfJlYi.mjs +1171 -0
- package/dist/crypto-CQNEyYHD.mjs +156 -0
- package/dist/cursor-origin/index.d.mts +2 -0
- package/dist/cursor-origin/index.mjs +1 -0
- package/dist/cursor-origin-BhqYx2oW.mjs +980 -0
- package/dist/define-B2_4ob2i.d.mts +307 -0
- package/dist/define-D3yEXtKK.mjs +2276 -0
- package/dist/env.d.mts +46 -0
- package/dist/env.mjs +283 -0
- package/dist/fake/index.d.mts +227 -0
- package/dist/fake/index.mjs +1001 -0
- package/dist/fetch-D4pSRvvA.d.mts +1723 -0
- package/dist/forgejo/index.d.mts +2 -0
- package/dist/forgejo/index.mjs +1 -0
- package/dist/forgejo-BCefbHUN.mjs +2005 -0
- package/dist/gitea/index.d.mts +2 -0
- package/dist/gitea/index.mjs +22 -0
- package/dist/gitee/index.d.mts +2 -0
- package/dist/gitee/index.mjs +1 -0
- package/dist/gitee-CA-f7Rs8.mjs +1272 -0
- package/dist/github/index.d.mts +2 -0
- package/dist/github/index.mjs +1 -0
- package/dist/github-B0umL8_f.mjs +3259 -0
- package/dist/gitlab/index.d.mts +2 -0
- package/dist/gitlab/index.mjs +1 -0
- package/dist/gitlab-Bsr__Z0C.mjs +2378 -0
- package/dist/graphql-D7uGzZTf.mjs +366 -0
- package/dist/index-BQ6VS31s.d.mts +32 -0
- package/dist/index-C-jz9Mo3.d.mts +16 -0
- package/dist/index-C4fYzmK3.d.mts +102 -0
- package/dist/index-CQiIX4SH.d.mts +27 -0
- package/dist/index-CTj5gQzl.d.mts +35 -0
- package/dist/index-CliBWzOF.d.mts +23 -0
- package/dist/index-Cz_y-t3d.d.mts +36 -0
- package/dist/index-DEt25E1w.d.mts +77 -0
- package/dist/index-DIuS0EOy.d.mts +43 -0
- package/dist/index-uSpsMCrC.d.mts +26 -0
- package/dist/index.d.mts +41 -0
- package/dist/index.mjs +13 -0
- package/dist/kit.d.mts +183 -0
- package/dist/kit.mjs +4 -0
- package/dist/provider-CoZ7cCxp.d.mts +1439 -0
- package/dist/provider-Ed1YhkQN.mjs +169 -0
- package/dist/pushin/index.d.mts +2 -0
- package/dist/pushin/index.mjs +1 -0
- package/dist/pushin-CkxgJ2cU.mjs +343 -0
- package/dist/schema/Actor.json +96 -0
- package/dist/schema/AlertSupport.json +49 -0
- package/dist/schema/AuthKind.json +15 -0
- package/dist/schema/Branch.json +31 -0
- package/dist/schema/ChangedFile.json +58 -0
- package/dist/schema/Check.json +169 -0
- package/dist/schema/CheckRef.json +114 -0
- package/dist/schema/CheckState.json +14 -0
- package/dist/schema/ChecksSummary.json +34 -0
- package/dist/schema/CiJob.json +186 -0
- package/dist/schema/CiJobRef.json +132 -0
- package/dist/schema/CiRun.json +234 -0
- package/dist/schema/CiRunRef.json +103 -0
- package/dist/schema/CodeFragment.json +19 -0
- package/dist/schema/CodeMatch.json +128 -0
- package/dist/schema/Collaborator.json +169 -0
- package/dist/schema/Comment.json +336 -0
- package/dist/schema/CommentRef.json +158 -0
- package/dist/schema/Commit.json +307 -0
- package/dist/schema/CommitRef.json +104 -0
- package/dist/schema/CommitSignature.json +118 -0
- package/dist/schema/Comparison.json +355 -0
- package/dist/schema/Cursor.json +21 -0
- package/dist/schema/EventAction.json +33 -0
- package/dist/schema/EventDetail.json +649 -0
- package/dist/schema/EventKind.json +26 -0
- package/dist/schema/FileContent.json +73 -0
- package/dist/schema/FileStatus.json +15 -0
- package/dist/schema/ForgeCapabilities.json +737 -0
- package/dist/schema/ForgeEvent.json +789 -0
- package/dist/schema/ForgeInstance.json +7 -0
- package/dist/schema/ForgeKind.json +32 -0
- package/dist/schema/ForgeWarning.json +49 -0
- package/dist/schema/ForgeWarningCode.json +7 -0
- package/dist/schema/GetManyResult.json +699 -0
- package/dist/schema/Installation.json +131 -0
- package/dist/schema/InstallationToken.json +31 -0
- package/dist/schema/KnownForgeKind.json +19 -0
- package/dist/schema/Label.json +22 -0
- package/dist/schema/MergeMethod.json +14 -0
- package/dist/schema/Milestone.json +40 -0
- package/dist/schema/Notification.json +498 -0
- package/dist/schema/NotificationReason.json +28 -0
- package/dist/schema/NotificationRef.json +60 -0
- package/dist/schema/NotificationSubject.json +376 -0
- package/dist/schema/PerKind.json +49 -0
- package/dist/schema/PullBranches.json +125 -0
- package/dist/schema/PushCommit.json +24 -0
- package/dist/schema/Reaction.json +148 -0
- package/dist/schema/ReactionContent.json +17 -0
- package/dist/schema/ReactionSummary.json +70 -0
- package/dist/schema/Release.json +286 -0
- package/dist/schema/ReleaseAsset.json +169 -0
- package/dist/schema/ReleaseAssetRef.json +138 -0
- package/dist/schema/ReleaseRef.json +107 -0
- package/dist/schema/Repo.json +354 -0
- package/dist/schema/RepoFeatures.json +35 -0
- package/dist/schema/RepoPermissions.json +35 -0
- package/dist/schema/RepoRef.json +77 -0
- package/dist/schema/RepoRole.json +15 -0
- package/dist/schema/RepoVisibility.json +12 -0
- package/dist/schema/Review.json +371 -0
- package/dist/schema/ReviewComment.json +280 -0
- package/dist/schema/ReviewCommentInput.json +34 -0
- package/dist/schema/ReviewRef.json +158 -0
- package/dist/schema/ReviewState.json +15 -0
- package/dist/schema/Reviewer.json +133 -0
- package/dist/schema/SecurityAlert.json +219 -0
- package/dist/schema/SecurityAlertKind.json +14 -0
- package/dist/schema/SecurityAlertRef.json +122 -0
- package/dist/schema/SecuritySeverity.json +14 -0
- package/dist/schema/SourceKind.json +12 -0
- package/dist/schema/SubscriptionState.json +12 -0
- package/dist/schema/Support.json +23 -0
- package/dist/schema/Tag.json +25 -0
- package/dist/schema/TextLimits.json +18 -0
- package/dist/schema/Thread.json +653 -0
- package/dist/schema/ThreadKind.json +14 -0
- package/dist/schema/ThreadRef.json +131 -0
- package/dist/schema/ThreadStack.json +146 -0
- package/dist/schema/ThreadState.json +13 -0
- package/dist/schema/TreeEntry.json +46 -0
- package/dist/schema/TreeEntryType.json +13 -0
- package/dist/schema/UpsertCommentResult.json +355 -0
- package/dist/schema/User.json +123 -0
- package/dist/schema/Webhook.json +188 -0
- package/dist/schema/WebhookDeliveryRecord.json +173 -0
- package/dist/schema/WebhookDeliveryRef.json +135 -0
- package/dist/schema/WebhookRef.json +105 -0
- package/dist/schema/index.d.mts +4 -0
- package/dist/schema/index.mjs +3219 -0
- package/dist/tangled/index.d.mts +2 -0
- package/dist/tangled/index.mjs +1 -0
- package/dist/tangled-ChdPmiv-.mjs +1570 -0
- package/dist/testing/index.d.mts +123 -0
- package/dist/testing/index.mjs +242 -0
- package/dist/webhooks-rn9-8lxT.mjs +70 -0
- package/package.json +115 -3
- package/dist/.gitkeep +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { B as Actor, Dt as ForgeOrigin, at as Comment, on as Repo, zn as ThreadRef } from "./fetch-D4pSRvvA.mjs";
|
|
2
|
+
import { M as TokenAuth, P as VerbScopes, m as ForgeOptionsBase, n as AnonymousAuth, q as ForgeVerb } from "./provider-CoZ7cCxp.mjs";
|
|
3
|
+
import { c as ProviderFactoryFunction } from "./define-B2_4ob2i.mjs";
|
|
4
|
+
//#region src/pushin/types.d.ts
|
|
5
|
+
interface PushinUser {
|
|
6
|
+
id?: number | string;
|
|
7
|
+
login: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
name?: string | null;
|
|
10
|
+
company?: string | null;
|
|
11
|
+
avatar_url?: string;
|
|
12
|
+
html_url?: string;
|
|
13
|
+
}
|
|
14
|
+
interface PushinRepository {
|
|
15
|
+
id: number | string;
|
|
16
|
+
node_id?: string;
|
|
17
|
+
name: string;
|
|
18
|
+
full_name: string;
|
|
19
|
+
owner?: PushinUser | null;
|
|
20
|
+
private?: boolean;
|
|
21
|
+
visibility?: string;
|
|
22
|
+
description?: string | null;
|
|
23
|
+
homepage?: string | null;
|
|
24
|
+
default_branch?: string;
|
|
25
|
+
url?: string;
|
|
26
|
+
html_url?: string;
|
|
27
|
+
clone_url?: string;
|
|
28
|
+
topics?: string[];
|
|
29
|
+
created_at?: string;
|
|
30
|
+
updated_at?: string;
|
|
31
|
+
forks_count?: number;
|
|
32
|
+
stargazers_count?: number;
|
|
33
|
+
watchers_count?: number;
|
|
34
|
+
permissions?: {
|
|
35
|
+
admin?: boolean;
|
|
36
|
+
maintain?: boolean;
|
|
37
|
+
push?: boolean;
|
|
38
|
+
triage?: boolean;
|
|
39
|
+
pull?: boolean;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
interface PushinComment {
|
|
43
|
+
id: number | string;
|
|
44
|
+
user?: PushinUser | null;
|
|
45
|
+
body: string;
|
|
46
|
+
created_at?: string;
|
|
47
|
+
updated_at?: string;
|
|
48
|
+
in_reply_to_id?: number | string | null;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/pushin/normalise.d.ts
|
|
52
|
+
declare function toActor(origin: ForgeOrigin, user: PushinUser | undefined | null): Actor | undefined;
|
|
53
|
+
declare function toRepo(origin: ForgeOrigin, raw: PushinRepository): Repo;
|
|
54
|
+
declare function toComment(thread: ThreadRef, raw: PushinComment): Comment;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/pushin/index.d.ts
|
|
57
|
+
/** A personal access token created in Settings (`pun_pat_…`), sent as `Authorization: Bearer`. */
|
|
58
|
+
type PushinAuth = TokenAuth | AnonymousAuth;
|
|
59
|
+
/** Options for `pushin()`. */
|
|
60
|
+
interface PushinOptions extends ForgeOptionsBase {
|
|
61
|
+
/**
|
|
62
|
+
* How to authenticate. Without credentials, only public reads work.
|
|
63
|
+
* @default { type: 'anonymous' }
|
|
64
|
+
*/
|
|
65
|
+
auth?: PushinAuth;
|
|
66
|
+
/**
|
|
67
|
+
* Instance root. `/api/v1` is appended.
|
|
68
|
+
* @default https://pushin.eu
|
|
69
|
+
*/
|
|
70
|
+
baseUrl?: string;
|
|
71
|
+
}
|
|
72
|
+
/** Creates a Pushin.eu provider. */
|
|
73
|
+
declare const pushin: ProviderFactoryFunction<PushinOptions>;
|
|
74
|
+
/** Scope requirements for a Pushin.eu operation. */
|
|
75
|
+
declare function pushinScopesFor(_verb: ForgeVerb): VerbScopes;
|
|
76
|
+
//#endregion
|
|
77
|
+
export { toActor as a, pushinScopesFor as i, PushinOptions as n, toComment as o, pushin as r, toRepo as s, PushinAuth as t };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { M as TokenAuth, P as VerbScopes, m as ForgeOptionsBase, n as AnonymousAuth, q as ForgeVerb } from "./provider-CoZ7cCxp.mjs";
|
|
2
|
+
import { c as ProviderFactoryFunction, s as ProviderDefinition } from "./define-B2_4ob2i.mjs";
|
|
3
|
+
//#region src/forgejo/webhook-events.d.ts
|
|
4
|
+
/** Header names a deployment signs and labels deliveries with, first match wins. */
|
|
5
|
+
interface WebhookHeaderNames {
|
|
6
|
+
signature: readonly string[];
|
|
7
|
+
event: readonly string[];
|
|
8
|
+
delivery: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/forgejo/index.d.ts
|
|
12
|
+
/** Forgejo and Gitea have no app-installation credential, so only tokens are accepted. */
|
|
13
|
+
type ForgejoAuth = TokenAuth | AnonymousAuth;
|
|
14
|
+
/** Options for `forgejo()`. */
|
|
15
|
+
interface ForgejoOptions extends ForgeOptionsBase {
|
|
16
|
+
/**
|
|
17
|
+
* How to authenticate. Without credentials, only public reads work.
|
|
18
|
+
* @default { type: 'anonymous' }
|
|
19
|
+
*/
|
|
20
|
+
auth?: ForgejoAuth;
|
|
21
|
+
/** Instance root, for example `https://codeberg.org`. */
|
|
22
|
+
baseUrl?: string;
|
|
23
|
+
}
|
|
24
|
+
/** What distinguishes a deployment family sharing the Forgejo implementation. */
|
|
25
|
+
interface ForgejoProfile {
|
|
26
|
+
forge: "forgejo" | "gitea";
|
|
27
|
+
defaultBaseUrl: string;
|
|
28
|
+
headers: WebhookHeaderNames;
|
|
29
|
+
}
|
|
30
|
+
declare const FORGEJO_PROFILE: ForgejoProfile;
|
|
31
|
+
/** The Forgejo implementation for one deployment family. Shared by `forgejo()` and `gitea()`. */
|
|
32
|
+
declare function forgejoDefinition(profile: ForgejoProfile): ProviderDefinition<ForgejoOptions>;
|
|
33
|
+
/** Creates a Forgejo provider for Codeberg or any self-hosted Forgejo instance. */
|
|
34
|
+
declare const forgejo: ProviderFactoryFunction<ForgejoOptions>;
|
|
35
|
+
/** `forgejo()` without webhook ingestion, for bundles that never receive a delivery. */
|
|
36
|
+
declare const forgejoLite: ProviderFactoryFunction<ForgejoOptions>;
|
|
37
|
+
/**
|
|
38
|
+
* Forgejo and Gitea token scopes, which are per resource group with a
|
|
39
|
+
* `read:` or `write:` prefix.
|
|
40
|
+
*/
|
|
41
|
+
declare function forgejoScopesFor(verb: ForgeVerb): VerbScopes;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { forgejo as a, forgejoScopesFor as c, ForgejoProfile as i, ForgejoAuth as n, forgejoDefinition as o, ForgejoOptions as r, forgejoLite as s, FORGEJO_PROFILE as t };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { M as TokenAuth, P as VerbScopes, m as ForgeOptionsBase, n as AnonymousAuth, q as ForgeVerb } from "./provider-CoZ7cCxp.mjs";
|
|
2
|
+
import { c as ProviderFactoryFunction } from "./define-B2_4ob2i.mjs";
|
|
3
|
+
//#region src/gitee/index.d.ts
|
|
4
|
+
/** A personal access token or OAuth access token, sent as `Authorization: token`. */
|
|
5
|
+
type GiteeAuth = TokenAuth | AnonymousAuth;
|
|
6
|
+
/** Options for `gitee()`. */
|
|
7
|
+
interface GiteeOptions extends ForgeOptionsBase {
|
|
8
|
+
/**
|
|
9
|
+
* How to authenticate. Without credentials, only public reads work.
|
|
10
|
+
* @default { type: 'anonymous' }
|
|
11
|
+
*/
|
|
12
|
+
auth?: GiteeAuth;
|
|
13
|
+
/**
|
|
14
|
+
* Instance root. `/api/v5` is appended.
|
|
15
|
+
* @default https://gitee.com
|
|
16
|
+
*/
|
|
17
|
+
baseUrl?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Creates a Gitee provider for gitee.com. The enterprise edition (`e.gitee.com`) is not covered. */
|
|
20
|
+
declare const gitee: ProviderFactoryFunction<GiteeOptions>;
|
|
21
|
+
/** `gitee()` without webhook ingestion, for bundles that never receive a delivery. */
|
|
22
|
+
declare const giteeLite: ProviderFactoryFunction<GiteeOptions>;
|
|
23
|
+
/** Gitee OAuth scopes, one per resource group. */
|
|
24
|
+
declare function giteeScopesFor(verb: ForgeVerb): VerbScopes;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { giteeScopesFor as a, giteeLite as i, GiteeOptions as n, gitee as r, GiteeAuth as t };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { $ as CiRunQuery, $n as WebhookInput, $t as ReactionSummary, A as RateLimitedError, An as SourceKind, At as GetManyResult, B as Actor, Bn as ThreadStack, Bt as Notification, C as ForgeNetworkError, Cn as Reviewer, Ct as ForgeEvent, D as MergeConflictError, Dn as SecurityAlertListOptions, Dt as ForgeOrigin, E as MergeBlockedError, En as SecurityAlertKind, Et as ForgeKind, F as UnresolvedThreadError, Fn as Thread, Ft as LabelInput, G as Check, Gn as TreeOptions, Gt as Page, H as BaseOptions, Hn as ThreadUpdateInput, Ht as NotificationReason, I as UnsupportedOperationError, In as ThreadCreateInput, It as ListOptions, J as CheckState, Jn as User, Jt as PushCommit, K as CheckRef, Kn as UpsertCommentInput, Kt as PageOptions, L as WebhookVerificationError, Ln as ThreadKind, Lt as MergeMethod, M as SubscriptionClosedError, Mn as Support, Mt as InstallationToken, N as TokenRevokedError, Nn as Tag, Nt as KnownForgeKind, O as MergeMethodRequiredError, On as SecurityAlertRef, Ot as ForgeWarning, P as UnknownForgeError, Pn as TextLimits, Pt as Label, Q as CiRun, Qn as WebhookEventType, Qt as ReactionContent, Rn as ThreadQuery, Rt as MergeOptions, S as ForgeErrorContext, Sn as ReviewState, St as FileStatus, T as InsufficientScopeError, Tn as SecurityAlert, Tt as ForgeInstance, U as Branch, Un as TreeEntry, Ut as NotificationRef, V as ApproveAndMergeOptions, Vn as ThreadState, Vt as NotificationListOptions, W as ChangedFile, Wn as TreeEntryType, Wt as NotificationSubject, X as CiJob, Xn as WebhookDeliveryRecord, Xt as RateLimit, Y as ChecksSummary, Yn as Webhook, Yt as REACTION_CONTENTS, Z as CiJobRef, Zn as WebhookDeliveryRef, Zt as Reaction, _ as ContentNotTextError, _n as ReviewComment, _r as threadKey, _t as EventKind, an as ReleaseUpdate, ar as isResolvedThread, at as Comment, b as ForgeApiError, bn as ReviewInput, bt as FileMetadata, c as ForgeRequestOptions, cn as RepoFeatures, cr as notificationKey, ct as CommitQuery, d as RawResponse, dn as RepoRef, dr as parseRepoKey, dt as CommitSignature, en as Release, er as WebhookRef, et as CiRunRef, fn as RepoRole, fr as parseThreadKey, ft as Comparison, g as AuthenticationRequiredError, gn as Review, gr as reviveDates, gt as EventDetail, hn as ResolvedThreadRef, hr as repoSlug, ht as EventAction, in as ReleaseRef, ir as isNamespaceRef, it as Collaborator, j as ReadOnlyError, jn as SubscriptionState, jt as Installation, k as NotFoundError, kn as SecuritySeverity, kt as ForgeWarningCode, l as ForgeResponse, ln as RepoPermissions, lr as notificationThread, lt as CommitRef, mn as RepoVisibility, mr as repoKey, mt as DATE_FIELDS, n as FetchLike, nn as ReleaseAssetRef, nr as commentMarker, nt as CodeMatch, o as ForgeRawRequestOptions, on as Repo, or as namesAreCaseInsensitive, ot as CommentRef, pn as RepoSearchQuery, pt as Cursor, q as CheckReportInput, qn as UpsertCommentResult, qt as PullBranches, rn as ReleaseInput, rr as hasCommentMarker, rt as CodeSearchQuery, s as ForgeRequest, sn as RepoAffiliation, sr as normaliseRepoName, st as Commit, tn as ReleaseAsset, tr as WebhookUpdate, tt as CodeFragment, un as RepoQuery, ur as parseNotificationKey, ut as CommitSearchQuery, v as ForbiddenError, vn as ReviewCommentInput, vr as threadSlug, vt as FileContent, w as ForgeTimeoutError, wn as SearchQuery, x as ForgeError, xn as ReviewRef, xt as FileOptions, y as ForbiddenReason, yn as ReviewEvent, yt as FileEncoding, zn as ThreadRef, zt as Milestone } from "./fetch-D4pSRvvA.mjs";
|
|
2
|
+
import { A as SubscriptionItem, B as ReferenceOptions, C as ReleasesApi, D as SecurityAlertsApi, E as SearchApi, F as WebhookDelivery, I as WebhooksApi, L as createForges, M as TokenAuth, N as UsersApi, O as SourcesApi, P as VerbScopes, S as PerKind, T as ReposApi, V as UrlTarget, W as parseForgeUrl, _ as Forges, a as BasicAuth, b as NotificationWriteOptions, c as CiApi, d as ContentsApi, f as ForgeCapabilities, g as ForgeProviderFactory, h as ForgeProvider, i as AuthKind, j as ThreadsApi, k as SubscribeOptions, l as CloseOptions, m as ForgeOptionsBase, n as AnonymousAuth, o as BulkNotificationOptions, p as ForgeIterable, q as ForgeVerb, r as AppAuth, s as ChecksApi, t as AlertSupport, u as CloseReason, v as InstallationsApi, w as RepoGetOptions, x as NotificationsApi, y as MilestoneListOptions, z as ParsedForgeUrl } from "./provider-CoZ7cCxp.mjs";
|
|
3
|
+
import { c as ProviderFactoryFunction } from "./define-B2_4ob2i.mjs";
|
|
4
|
+
import { a as azureDevOpsLite, i as azureDevOps, n as AzureDevOpsAuth, r as AzureDevOpsOptions, t as AZURE_DEVOPS_API_VERSION } from "./index-CTj5gQzl.mjs";
|
|
5
|
+
import { i as bitbucketLite, n as BitbucketOptions, r as bitbucket, t as BitbucketAuth } from "./index-BQ6VS31s.mjs";
|
|
6
|
+
import { a as CursorOriginAuth, i as cursorOriginLite, n as ORIGIN_API_VERSION, r as cursorOrigin, t as CursorOriginOptions } from "./index-Cz_y-t3d.mjs";
|
|
7
|
+
import { a as forgejo, n as ForgejoAuth, r as ForgejoOptions, s as forgejoLite } from "./index-DIuS0EOy.mjs";
|
|
8
|
+
import { i as giteaLite, n as GiteaOptions, r as gitea } from "./index-C-jz9Mo3.mjs";
|
|
9
|
+
import { i as giteeLite, n as GiteeOptions, r as gitee, t as GiteeAuth } from "./index-uSpsMCrC.mjs";
|
|
10
|
+
import { a as GitHubAuth, n as github, r as githubLite, t as GitHubOptions } from "./index-CQiIX4SH.mjs";
|
|
11
|
+
import { i as gitlabLite, n as GitLabOptions, r as gitlab, t as GitLabAuth } from "./index-CliBWzOF.mjs";
|
|
12
|
+
import { n as PushinOptions, r as pushin, t as PushinAuth } from "./index-DEt25E1w.mjs";
|
|
13
|
+
import { a as WebSocketFactory, i as tangledLite, n as TangledOptions, o as WebSocketLike, r as tangled, t as TangledAuth } from "./index-C4fYzmK3.mjs";
|
|
14
|
+
//#region src/supports.d.ts
|
|
15
|
+
/**
|
|
16
|
+
* Whether `verb` is supported according to `capabilities`, for `kind` where
|
|
17
|
+
* support differs by thread kind (or by alert kind for `securityAlerts`).
|
|
18
|
+
* Without `kind`, a per-kind verb counts as supported when any kind is.
|
|
19
|
+
* @param capabilities The capabilities of a provider, such as `provider.capabilities`.
|
|
20
|
+
* @param verb The operation, named by its path on the provider, such as `threads.comment`.
|
|
21
|
+
* @param kind The thread or alert kind, for an operation whose support differs by kind.
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* if (supports(provider.capabilities, 'threads.merge')) {
|
|
25
|
+
* await provider.threads.merge(ref)
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function supports(capabilities: ForgeCapabilities, verb: ForgeVerb, kind?: ThreadKind | SecurityAlertKind): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* How well `verb` is supported according to `capabilities`: `true`,
|
|
32
|
+
* `'experimental'`, `'emulated'`, `'unverified'` or `false`, for `kind` where support differs
|
|
33
|
+
* by thread kind (or by alert kind for `securityAlerts`). Without `kind`, a
|
|
34
|
+
* per-kind verb reports its strongest level across kinds.
|
|
35
|
+
* @param capabilities The capabilities of a provider, such as `provider.capabilities`.
|
|
36
|
+
* @param verb The operation, named by its path on the provider, such as `threads.comment`.
|
|
37
|
+
* @param kind The thread or alert kind, for an operation whose support differs by kind.
|
|
38
|
+
*/
|
|
39
|
+
export declare function supportOf(capabilities: ForgeCapabilities, verb: ForgeVerb, kind?: ThreadKind | SecurityAlertKind): Support;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { AZURE_DEVOPS_API_VERSION, type Actor, type AlertSupport, type AnonymousAuth, type AppAuth, type ApproveAndMergeOptions, type AuthKind, AuthenticationRequiredError, type AzureDevOpsAuth, type AzureDevOpsOptions, type BaseOptions, type BasicAuth, type BitbucketAuth, type BitbucketOptions, type Branch, type BulkNotificationOptions, type ChangedFile, type Check, type CheckRef, type CheckReportInput, type CheckState, type ChecksApi, type ChecksSummary, type CiApi, type CiJob, type CiJobRef, type CiRun, type CiRunQuery, type CiRunRef, type CloseOptions, type CloseReason, type CodeFragment, type CodeMatch, type CodeSearchQuery, type Collaborator, type Comment, type CommentRef, type Commit, type CommitQuery, type CommitRef, type CommitSearchQuery, type CommitSignature, type Comparison, ContentNotTextError, type ContentsApi, type Cursor, type CursorOriginAuth, type CursorOriginOptions, DATE_FIELDS, type EventAction, type EventDetail, type EventKind, type FetchLike, type FileContent, type FileEncoding, type FileMetadata, type FileOptions, type FileStatus, ForbiddenError, type ForbiddenReason, ForgeApiError, type ForgeCapabilities, ForgeError, type ForgeErrorContext, type ForgeEvent, type ForgeInstance, type ForgeIterable, type ForgeKind, ForgeNetworkError, type ForgeOptionsBase, type ForgeOrigin, type ForgeProvider, type ForgeProviderFactory, type ForgeRawRequestOptions, type ForgeRequest, type ForgeRequestOptions, type ForgeResponse, ForgeTimeoutError, type ForgeVerb, type ForgeWarning, type ForgeWarningCode, type ForgejoAuth, type ForgejoOptions, type Forges, type GetManyResult, type GitHubAuth, type GitHubOptions, type GitLabAuth, type GitLabOptions, type GiteaOptions, type GiteeAuth, type GiteeOptions, type Installation, type InstallationToken, type InstallationsApi, InsufficientScopeError, type KnownForgeKind, type Label, type LabelInput, type ListOptions, MergeBlockedError, MergeConflictError, type MergeMethod, MergeMethodRequiredError, type MergeOptions, type Milestone, type MilestoneListOptions, NotFoundError, type Notification, type NotificationListOptions, type NotificationReason, type NotificationRef, type NotificationSubject, type NotificationWriteOptions, type NotificationsApi, ORIGIN_API_VERSION, type Page, type PageOptions, type ParsedForgeUrl, type PerKind, type ProviderFactoryFunction, type PullBranches, type PushCommit, type PushinAuth, type PushinOptions, REACTION_CONTENTS, type RateLimit, RateLimitedError, type RawResponse, type Reaction, type ReactionContent, type ReactionSummary, ReadOnlyError, type ReferenceOptions, type Release, type ReleaseAsset, type ReleaseAssetRef, type ReleaseInput, type ReleaseRef, type ReleaseUpdate, type ReleasesApi, type Repo, type RepoAffiliation, type RepoFeatures, type RepoGetOptions, type RepoPermissions, type RepoQuery, type RepoRef, type RepoRole, type RepoSearchQuery, type RepoVisibility, type ReposApi, type ResolvedThreadRef, type Review, type ReviewComment, type ReviewCommentInput, type ReviewEvent, type ReviewInput, type ReviewRef, type ReviewState, type Reviewer, type SearchApi, type SearchQuery, type SecurityAlert, type SecurityAlertKind, type SecurityAlertListOptions, type SecurityAlertRef, type SecurityAlertsApi, type SecuritySeverity, type SourceKind, type SourcesApi, type SubscribeOptions, SubscriptionClosedError, type SubscriptionItem, type SubscriptionState, type Support, type Tag, type TangledAuth, type TangledOptions, type TextLimits, type Thread, type ThreadCreateInput, type ThreadKind, type ThreadQuery, type ThreadRef, type ThreadStack, type ThreadState, type ThreadUpdateInput, type ThreadsApi, type TokenAuth, TokenRevokedError, type TreeEntry, type TreeEntryType, type TreeOptions, UnknownForgeError, UnresolvedThreadError, UnsupportedOperationError, type UpsertCommentInput, type UpsertCommentResult, type UrlTarget, type User, type UsersApi, type VerbScopes, type WebSocketFactory, type WebSocketLike, type Webhook, type WebhookDelivery, type WebhookDeliveryRecord, type WebhookDeliveryRef, type WebhookEventType, type WebhookInput, type WebhookRef, type WebhookUpdate, WebhookVerificationError, type WebhooksApi, azureDevOps, azureDevOpsLite, bitbucket, bitbucketLite, commentMarker, createForges, cursorOrigin, cursorOriginLite, forgejo, forgejoLite, gitea, giteaLite, gitee, giteeLite, github, githubLite, gitlab, gitlabLite, hasCommentMarker, isNamespaceRef, isResolvedThread, namesAreCaseInsensitive, normaliseRepoName, notificationKey, notificationThread, parseForgeUrl, parseNotificationKey, parseRepoKey, parseThreadKey, pushin, repoKey, repoSlug, reviveDates, tangled, tangledLite, threadKey, threadSlug };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { $ as threadKey, At as UnresolvedThreadError, B as isNamespaceRef, Ct as MergeMethodRequiredError, Dt as SubscriptionClosedError, Et as ReadOnlyError, F as supports, G as notificationThread, H as namesAreCaseInsensitive, I as DATE_FIELDS, J as parseThreadKey, K as parseNotificationKey, L as REACTION_CONTENTS, Mt as WebhookVerificationError, Ot as TokenRevokedError, P as supportOf, Q as reviveDates, R as commentMarker, St as MergeConflictError, Tt as RateLimitedError, U as normaliseRepoName, V as isResolvedThread, W as notificationKey, X as repoKey, Z as repoSlug, _t as ForgeError, a as parseForgeUrl, bt as InsufficientScopeError, et as threadSlug, gt as ForgeApiError, ht as ForbiddenError, jt as UnsupportedOperationError, kt as UnknownForgeError, mt as ContentNotTextError, pt as AuthenticationRequiredError, q as parseRepoKey, vt as ForgeNetworkError, wt as NotFoundError, xt as MergeBlockedError, yt as ForgeTimeoutError, z as hasCommentMarker } from "./define-D3yEXtKK.mjs";
|
|
2
|
+
import { n as azureDevOps, r as azureDevOpsLite, t as AZURE_DEVOPS_API_VERSION } from "./azure-devops-DwQvL4TV.mjs";
|
|
3
|
+
import { n as bitbucketLite, t as bitbucket } from "./bitbucket-CpcfJlYi.mjs";
|
|
4
|
+
import { n as cursorOrigin, r as cursorOriginLite, t as ORIGIN_API_VERSION } from "./cursor-origin-BhqYx2oW.mjs";
|
|
5
|
+
import { i as forgejoLite, n as forgejo } from "./forgejo-BCefbHUN.mjs";
|
|
6
|
+
import { gitea, giteaLite } from "./gitea/index.mjs";
|
|
7
|
+
import { n as giteeLite, t as gitee } from "./gitee-CA-f7Rs8.mjs";
|
|
8
|
+
import { n as githubLite, t as github } from "./github-B0umL8_f.mjs";
|
|
9
|
+
import { n as gitlabLite, t as gitlab } from "./gitlab-Bsr__Z0C.mjs";
|
|
10
|
+
import { t as createForges } from "./provider-Ed1YhkQN.mjs";
|
|
11
|
+
import { t as pushin } from "./pushin-CkxgJ2cU.mjs";
|
|
12
|
+
import { n as tangledLite, t as tangled } from "./tangled-ChdPmiv-.mjs";
|
|
13
|
+
export { AZURE_DEVOPS_API_VERSION, AuthenticationRequiredError, ContentNotTextError, DATE_FIELDS, ForbiddenError, ForgeApiError, ForgeError, ForgeNetworkError, ForgeTimeoutError, InsufficientScopeError, MergeBlockedError, MergeConflictError, MergeMethodRequiredError, NotFoundError, ORIGIN_API_VERSION, REACTION_CONTENTS, RateLimitedError, ReadOnlyError, SubscriptionClosedError, TokenRevokedError, UnknownForgeError, UnresolvedThreadError, UnsupportedOperationError, WebhookVerificationError, azureDevOps, azureDevOpsLite, bitbucket, bitbucketLite, commentMarker, createForges, cursorOrigin, cursorOriginLite, forgejo, forgejoLite, gitea, giteaLite, gitee, giteeLite, github, githubLite, gitlab, gitlabLite, hasCommentMarker, isNamespaceRef, isResolvedThread, namesAreCaseInsensitive, normaliseRepoName, notificationKey, notificationThread, parseForgeUrl, parseNotificationKey, parseRepoKey, parseThreadKey, pushin, repoKey, repoSlug, reviveDates, supportOf, supports, tangled, tangledLite, threadKey, threadSlug };
|
package/dist/kit.d.mts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { At as GetManyResult, B as Actor, Ct as ForgeEvent, Fn as Thread, Gt as Page, H as BaseOptions, It as ListOptions, J as CheckState, Jt as PushCommit, Kt as PageOptions, Ot as ForgeWarning, R as soleMergeMethod, S as ForgeErrorContext, Sn as ReviewState, Y as ChecksSummary, _t as EventKind, a as FetcherOptions, bt as FileMetadata, f as RequestOptions, gn as Review, h as parseLinkHeader, hn as ResolvedThreadRef, ht as EventAction, i as Fetcher, m as createRequest, p as createFetcher, pr as reactionContent, pt as Cursor, r as FetchResult, t as CreateRequestOptions, u as PaginateOptions, vt as FileContent, wt as ForgeEventInput, xt as FileOptions, z as toMergeError, zn as ThreadRef } from "./fetch-D4pSRvvA.mjs";
|
|
2
|
+
import { F as WebhookDelivery, G as CAPABILITY_TABLE, H as WebLinks, K as CapabilityEntry, M as TokenAuth, R as GitHubShape, U as githubShapedWeb, p as ForgeIterable } from "./provider-CoZ7cCxp.mjs";
|
|
3
|
+
import { a as ProviderBase, c as ProviderFactoryFunction, d as Verb, f as VerbKind, g as verb, h as perKind, i as MergeHooks, l as ProviderSpec, m as defineForgeProvider, n as CapabilityEnv, o as ProviderContext, p as WebhookHandlers, r as KindVerb, s as ProviderDefinition, t as AlertKind, u as SupportInput } from "./define-B2_4ob2i.mjs";
|
|
4
|
+
//#region src/webhooks.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Checks a hex HMAC-SHA256 of the raw body, sent in the first of `header`
|
|
7
|
+
* present, after an optional `prefix` such as `sha256=`. The delivery's own
|
|
8
|
+
* `secret` takes precedence over the provider's.
|
|
9
|
+
*/
|
|
10
|
+
export declare function verifyHmacSignature(delivery: WebhookDelivery, secret: string | undefined, { header, prefix }: {
|
|
11
|
+
header: string | readonly string[];
|
|
12
|
+
prefix?: string;
|
|
13
|
+
}): Promise<boolean>;
|
|
14
|
+
/** Checks a secret sent verbatim in `header`. */
|
|
15
|
+
export declare function verifySharedToken(delivery: WebhookDelivery, secret: string | undefined, header: string): boolean;
|
|
16
|
+
/** One ref update in a push delivery. */
|
|
17
|
+
interface RefChange {
|
|
18
|
+
/** A full ref such as `refs/heads/main`, or a bare name when `refType` is given. */
|
|
19
|
+
ref: string;
|
|
20
|
+
/** Whether the ref is a branch or a tag. */
|
|
21
|
+
refType?: "branch" | "tag";
|
|
22
|
+
before?: string;
|
|
23
|
+
after?: string;
|
|
24
|
+
created?: boolean;
|
|
25
|
+
deleted?: boolean;
|
|
26
|
+
forced?: boolean;
|
|
27
|
+
commits?: PushCommit[];
|
|
28
|
+
/** Commits pushed, when the forge reports more than it sends. */
|
|
29
|
+
commitCount?: number;
|
|
30
|
+
}
|
|
31
|
+
/** The kind, detail and summary of one ref update in a push: a deletion, a creation, or new commits. */
|
|
32
|
+
export declare function refEvent(who: string, change: RefChange): Pick<ForgeEventInput, "kind" | "action" | "detail" | "summary">;
|
|
33
|
+
/** Native event names per normalised kind, as a forge names them in a hook subscription. */
|
|
34
|
+
type NativeEventMap = Partial<Record<EventKind, readonly string[]>>;
|
|
35
|
+
/** The forge's own event names for `events`, plus any `nativeEvents` passed through unchanged. */
|
|
36
|
+
export declare function nativeEventsFor(map: NativeEventMap, events: EventKind[] | undefined, nativeEvents: string[] | undefined): string[];
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/contents.d.ts
|
|
39
|
+
/** Decodes base64, tolerating the newlines GitHub and Gitea wrap it in. */
|
|
40
|
+
export declare function fromBase64(value: string): Uint8Array;
|
|
41
|
+
/**
|
|
42
|
+
* Shapes bytes as the caller asked: UTF-8 text for `as: 'text'`, bytes
|
|
43
|
+
* otherwise. Rejects with {@link ContentNotTextError} when text was asked for
|
|
44
|
+
* and the bytes are not valid UTF-8.
|
|
45
|
+
*/
|
|
46
|
+
export declare function toFileContent(bytes: Uint8Array, file: FileMetadata, options: FileOptions | undefined, context?: {
|
|
47
|
+
forge?: string;
|
|
48
|
+
instance?: string;
|
|
49
|
+
}): FileContent;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/crypto.d.ts
|
|
52
|
+
/** Base64 for arbitrary bytes, a byte at a time so a large buffer cannot overflow the call stack. */
|
|
53
|
+
export declare function toBase64(bytes: Uint8Array): string;
|
|
54
|
+
/** Lowercase hex HMAC-SHA256 of `body` under `secret`. */
|
|
55
|
+
export declare function hmacSha256Hex(secret: string, body: string | Uint8Array): Promise<string>;
|
|
56
|
+
/** Constant-time comparison of two ASCII strings. */
|
|
57
|
+
export declare function timingSafeEqual(a: string, b: string): boolean;
|
|
58
|
+
/** The claims of a signed JWT. Other claims are passed through. */
|
|
59
|
+
interface JwtClaims {
|
|
60
|
+
/** The issuer, such as the app ID. */
|
|
61
|
+
iss: string;
|
|
62
|
+
/** When the token was issued, in seconds since the epoch. */
|
|
63
|
+
iat: number;
|
|
64
|
+
/** When the token expires, in seconds since the epoch. */
|
|
65
|
+
exp: number;
|
|
66
|
+
[claim: string]: unknown;
|
|
67
|
+
}
|
|
68
|
+
/** Signs an RS256 JWT with a PEM-encoded RSA private key. */
|
|
69
|
+
export declare function signRs256Jwt(privateKeyPem: string, claims: JwtClaims): Promise<string>;
|
|
70
|
+
/** The value of a header, whatever the casing of `name`, from a `Headers` object or a plain record. */
|
|
71
|
+
export declare function headerValue(headers: Headers | Record<string, string>, name: string): string | undefined;
|
|
72
|
+
/** A request body as text. */
|
|
73
|
+
export declare function bodyText(body: string | Uint8Array): string;
|
|
74
|
+
/** Lowercase hex SHA-256 of `body`. */
|
|
75
|
+
export declare function sha256Hex(body: string | Uint8Array): Promise<string>;
|
|
76
|
+
/** Signs an EdDSA (Ed25519) JWT with a PKCS#8 PEM private key. `kid` goes in the JOSE header. */
|
|
77
|
+
export declare function signEdDsaJwt(privateKeyPem: string, claims: JwtClaims, kid?: string): Promise<string>;
|
|
78
|
+
/** An Ed25519 public key in JWK form, as served from a JWKS endpoint. */
|
|
79
|
+
interface Ed25519Jwk {
|
|
80
|
+
/** The key type, always `OKP`. */
|
|
81
|
+
kty: "OKP";
|
|
82
|
+
/** The curve, always `Ed25519`. */
|
|
83
|
+
crv: "Ed25519";
|
|
84
|
+
/** The public key, base64url encoded. */
|
|
85
|
+
x: string;
|
|
86
|
+
kid?: string;
|
|
87
|
+
}
|
|
88
|
+
/** Verifies an Ed25519 signature (base64) over `data` with a JWK public key. */
|
|
89
|
+
export declare function verifyEd25519(jwk: Ed25519Jwk, data: string | Uint8Array, signatureBase64: string): Promise<boolean>;
|
|
90
|
+
/** Base64 HMAC-SHA256 of `body` under `secret`. */
|
|
91
|
+
export declare function hmacSha256Base64(secret: string, body: string | Uint8Array): Promise<string>;
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/events.d.ts
|
|
94
|
+
/** Normalises a forge-native verb (`closed`, `close`, `synchronize`, ...) into an {@link EventAction}. */
|
|
95
|
+
export declare function eventAction(raw: string | undefined): EventAction | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Fills `action` from `actionRaw`, or from the last `.`/`:` segment of
|
|
98
|
+
* `kindRaw`, falling back to the kind's default verb, then `other`.
|
|
99
|
+
*/
|
|
100
|
+
export declare function completeEvent(event: ForgeEventInput): ForgeEvent;
|
|
101
|
+
/** Normalises a forge-native review verdict (`APPROVED`, `changes_requested`, ...) into a {@link ReviewState}. */
|
|
102
|
+
export declare function reviewState(raw: string | undefined): ReviewState;
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/utils.d.ts
|
|
105
|
+
/**
|
|
106
|
+
* Wraps a generator so warnings it reports are collected on the returned
|
|
107
|
+
* iterable rather than interrupting iteration.
|
|
108
|
+
*/
|
|
109
|
+
export declare function forgeIterable<T>(run: (warn: (warning: ForgeWarning) => void) => AsyncIterable<T>): ForgeIterable<T>;
|
|
110
|
+
/** Drives a `page()` function until it reports no further cursor, collecting page warnings. */
|
|
111
|
+
export declare function iteratePages<T, O extends {
|
|
112
|
+
cursor?: Cursor;
|
|
113
|
+
} = ListOptions>(page: (options: O) => Promise<Page<T>>, options?: O): ForgeIterable<T>;
|
|
114
|
+
/** Turns a caught error into a serialisable warning. */
|
|
115
|
+
export declare function toWarning(code: string, error: unknown, subject?: string): ForgeWarning;
|
|
116
|
+
/** Maps with at most `limit` calls in flight, preserving order. */
|
|
117
|
+
export declare function mapConcurrent<T, R>(items: readonly T[], limit: number, fn: (item: T) => Promise<R>): Promise<R[]>;
|
|
118
|
+
/** `threads.getMany` for forges without a batch endpoint. */
|
|
119
|
+
export declare function getManyConcurrently(refs: ThreadRef[], get: (ref: ThreadRef, options?: BaseOptions) => Promise<Thread>, options?: BaseOptions): Promise<GetManyResult[]>;
|
|
120
|
+
/** Compares dotted numeric versions, ignoring any suffix after the numbers. */
|
|
121
|
+
export declare function versionAtLeast(version: string | undefined, minimum: string): boolean;
|
|
122
|
+
/** Reads a timestamp from a forge response, or `undefined` when it is empty or not a date. */
|
|
123
|
+
export declare function toDate(value: string | number | null | undefined): Date | undefined;
|
|
124
|
+
/** The host of `baseUrl`, including the port when there is one. */
|
|
125
|
+
export declare function hostOf(baseUrl: string): string;
|
|
126
|
+
/** Narrows a ref to one a provider can address, or throws {@link UnresolvedThreadError}. */
|
|
127
|
+
export declare function requireThread(ref: ThreadRef, context?: ForgeErrorContext): ResolvedThreadRef;
|
|
128
|
+
/**
|
|
129
|
+
* Narrows a ref to an issue or pull request, or throws
|
|
130
|
+
* {@link UnsupportedOperationError} naming the verb that needs one.
|
|
131
|
+
*/
|
|
132
|
+
export declare function requireIssueOrPull(ref: ThreadRef, context: ForgeErrorContext, verb: string): ResolvedThreadRef & {
|
|
133
|
+
kind: "issue" | "pull_request";
|
|
134
|
+
};
|
|
135
|
+
/** The token in `auth`, read again on every call when it is a function. */
|
|
136
|
+
export declare function resolveToken(auth: TokenAuth): Promise<string>;
|
|
137
|
+
/** A login from either a login string or an actor. */
|
|
138
|
+
export declare function actorLogin(actor: string | Actor): string;
|
|
139
|
+
/** Maps one fetched page into a {@link Page}. The cursor is kept only when there is a next page. */
|
|
140
|
+
export declare function toPage<R, T>(result: FetchResult<R[]>, map: (raw: R) => T | undefined, warnings?: ForgeWarning[]): Page<T>;
|
|
141
|
+
/** Extra options for a listing: the query, how to select the items and map errors, and where to collect warnings. */
|
|
142
|
+
interface ListingExtras extends Pick<PaginateOptions, "query" | "select" | "mapError"> {
|
|
143
|
+
/** Collects the non-fatal warnings of the listing. */
|
|
144
|
+
warnings?: ForgeWarning[];
|
|
145
|
+
}
|
|
146
|
+
/** One page of `path` as the model, with `options` mapped onto the forge's page-size parameter. */
|
|
147
|
+
type Listing = <R, T>(path: string, options: PageOptions, map: (raw: R) => T | undefined, extras?: ListingExtras) => Promise<Page<T>>;
|
|
148
|
+
/** Builds a {@link Listing} for a forge that names its page-size parameter `pageParam`. */
|
|
149
|
+
export declare function createListing(fetcher: Fetcher, pageParam: string, defaultPerPage?: number): Listing;
|
|
150
|
+
/**
|
|
151
|
+
* Chains listings that a forge serves from separate endpoints. The cursor
|
|
152
|
+
* `token` records which phase is next, ahead of the phase's own token.
|
|
153
|
+
*/
|
|
154
|
+
export declare function phased<T>(phases: Array<(cursor?: Cursor) => Promise<Page<T>>>, cursor?: Cursor): Promise<Page<T>>;
|
|
155
|
+
/** Whether `labels` include every name in `wanted`; true when nothing is wanted. */
|
|
156
|
+
export declare function hasEveryLabel(labels: ReadonlyArray<{
|
|
157
|
+
name: string;
|
|
158
|
+
}> | undefined, wanted: readonly string[] | undefined): boolean;
|
|
159
|
+
/** Any failure fails, else any pending is pending, else any unknown (or none at all) is unknown, else success. */
|
|
160
|
+
export declare function summariseChecks(states: CheckState[], url?: string): ChecksSummary;
|
|
161
|
+
/**
|
|
162
|
+
* Caches the result of `load` after its first call. A rejected load is
|
|
163
|
+
* forgotten so the next call retries; with `ttl` (milliseconds) a resolved
|
|
164
|
+
* value is reloaded once it is older than that.
|
|
165
|
+
*/
|
|
166
|
+
export declare function memo<T>(load: () => Promise<T>, ttl?: number): () => Promise<T>;
|
|
167
|
+
/** {@link memo} per key. */
|
|
168
|
+
export declare function memoBy<K, T>(load: (key: K) => Promise<T>): (key: K) => Promise<T>;
|
|
169
|
+
/**
|
|
170
|
+
* A review standing in for an approval, vote or participant state on a forge
|
|
171
|
+
* that has no review objects. `comments` is `false` because there is nothing
|
|
172
|
+
* to hang inline comments on.
|
|
173
|
+
*/
|
|
174
|
+
export declare function syntheticReview(thread: ResolvedThreadRef, id: string, state: ReviewState, extras: {
|
|
175
|
+
author?: Actor;
|
|
176
|
+
stateRaw?: string;
|
|
177
|
+
submittedAt?: Date;
|
|
178
|
+
raw: unknown;
|
|
179
|
+
}): Review;
|
|
180
|
+
/** A label colour as six hex digits, with the `#` prefix the forge expects. `ededed` when none is given. */
|
|
181
|
+
export declare function hexColour(colour: string | undefined, prefix?: "#" | ""): string;
|
|
182
|
+
//#endregion
|
|
183
|
+
export { type AlertKind, CAPABILITY_TABLE, type CapabilityEntry, type CapabilityEnv, type CreateRequestOptions, type Ed25519Jwk, type FetchResult, type Fetcher, type FetcherOptions, type ForgeEventInput, type GitHubShape, type JwtClaims, type KindVerb, type Listing, type ListingExtras, type MergeHooks, type NativeEventMap, type PaginateOptions, type ProviderBase, type ProviderContext, type ProviderDefinition, type ProviderFactoryFunction, type ProviderSpec, type RefChange, type RequestOptions, type SupportInput, type Verb, type VerbKind, type WebLinks, type WebhookHandlers, createFetcher, createRequest, defineForgeProvider, githubShapedWeb, parseLinkHeader, perKind, reactionContent, soleMergeMethod, toMergeError, verb };
|
package/dist/kit.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { A as toPage, C as requireIssueOrPull, D as syntheticReview, E as summariseChecks, M as versionAtLeast, Nt as soleMergeMethod, O as toDate, Pt as toMergeError, S as phased, T as resolveToken, Y as reactionContent, _ as mapConcurrent, at as parseLinkHeader, ct as eventAction, d as forgeIterable, dt as fromBase64, f as getManyConcurrently, ft as toFileContent, g as iteratePages, h as hostOf, i as githubShapedWeb, it as createRequest, j as toWarning, l as createListing, lt as reviewState, m as hexColour, n as perKind, p as hasEveryLabel, r as verb, rt as createFetcher, s as actorLogin, st as completeEvent, t as defineForgeProvider, ut as CAPABILITY_TABLE, v as memo, w as requireThread, y as memoBy } from "./define-D3yEXtKK.mjs";
|
|
2
|
+
import { a as sha256Hex, c as timingSafeEqual, i as hmacSha256Hex, l as toBase64, n as headerValue, o as signEdDsaJwt, r as hmacSha256Base64, s as signRs256Jwt, t as bodyText, u as verifyEd25519 } from "./crypto-CQNEyYHD.mjs";
|
|
3
|
+
import { a as verifyHmacSignature, i as refEvent, o as verifySharedToken, r as nativeEventsFor } from "./webhooks-rn9-8lxT.mjs";
|
|
4
|
+
export { CAPABILITY_TABLE, actorLogin, bodyText, completeEvent, createFetcher, createListing, createRequest, defineForgeProvider, eventAction, forgeIterable, fromBase64, getManyConcurrently, githubShapedWeb, hasEveryLabel, headerValue, hexColour, hmacSha256Base64, hmacSha256Hex, hostOf, iteratePages, mapConcurrent, memo, memoBy, nativeEventsFor, parseLinkHeader, perKind, phased, reactionContent, refEvent, requireIssueOrPull, requireThread, resolveToken, reviewState, sha256Hex, signEdDsaJwt, signRs256Jwt, soleMergeMethod, summariseChecks, syntheticReview, timingSafeEqual, toBase64, toDate, toFileContent, toMergeError, toPage, toWarning, verb, verifyEd25519, verifyHmacSignature, verifySharedToken, versionAtLeast };
|