@theholocron/github-client 1.58.0-alpha.16 → 1.58.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +27 -1
- package/dist/index.mjs +14 -0
- package/package.json +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -318,6 +318,15 @@ interface GitHubIssue {
|
|
|
318
318
|
updated_at: string;
|
|
319
319
|
/** The URL of the issue's page on GitHub. */
|
|
320
320
|
html_url: string;
|
|
321
|
+
/** When the issue was created, as an ISO 8601 timestamp. */
|
|
322
|
+
created_at?: string;
|
|
323
|
+
/** The milestone the issue belongs to, or `null` when none. */
|
|
324
|
+
milestone?: {
|
|
325
|
+
number: number;
|
|
326
|
+
title: string;
|
|
327
|
+
} | null;
|
|
328
|
+
/** The issue's GraphQL node id. */
|
|
329
|
+
node_id?: string;
|
|
321
330
|
/** Set when the item is a pull request; GitHub's issues API returns pull requests too. */
|
|
322
331
|
pull_request?: unknown;
|
|
323
332
|
}
|
|
@@ -328,8 +337,23 @@ interface GitHubMilestone {
|
|
|
328
337
|
/** The milestone's title. */
|
|
329
338
|
title: string;
|
|
330
339
|
}
|
|
340
|
+
/** A comment on an issue, with only the fields this client reads. */
|
|
341
|
+
interface GitHubIssueComment {
|
|
342
|
+
/** The comment's text. */
|
|
343
|
+
body: string;
|
|
344
|
+
/** When it was written, as an ISO 8601 timestamp. */
|
|
345
|
+
created_at: string;
|
|
346
|
+
/** Who wrote it. */
|
|
347
|
+
user: {
|
|
348
|
+
login: string;
|
|
349
|
+
} | null;
|
|
350
|
+
}
|
|
331
351
|
/** Filters for listing issues. */
|
|
332
352
|
interface IssueSearchParams {
|
|
353
|
+
/** The page to read, from 1. */
|
|
354
|
+
page?: number;
|
|
355
|
+
/** A milestone number, `*` for any or `none`. */
|
|
356
|
+
milestone?: string;
|
|
333
357
|
/** Which issues to list by state; GitHub defaults to `open`. */
|
|
334
358
|
state?: "open" | "closed" | "all";
|
|
335
359
|
/** The field to sort by, passed through to GitHub. */
|
|
@@ -984,6 +1008,8 @@ export declare function createGitHubClient(opts: GitHubClientOptions): {
|
|
|
984
1008
|
addLabels: (repo: string, number: number, labels: string[]) => Promise<void>;
|
|
985
1009
|
removeLabel: (repo: string, number: number, label: string) => Promise<void>;
|
|
986
1010
|
createComment: (repo: string, number: number, body: string) => Promise<void>;
|
|
1011
|
+
listComments: (repo: string, number: number) => Promise<GitHubIssueComment[]>;
|
|
1012
|
+
createMilestone: (repo: string, title: string) => Promise<GitHubMilestone>;
|
|
987
1013
|
listMilestones: (repo: string, params?: {
|
|
988
1014
|
state?: "open" | "closed" | "all";
|
|
989
1015
|
}) => Promise<GitHubMilestone[]>;
|
|
@@ -1079,4 +1105,4 @@ export declare function createGitHubClient(opts: GitHubClientOptions): {
|
|
|
1079
1105
|
};
|
|
1080
1106
|
/** The client returned by `createGitHubClient()`: one group of methods per GitHub API area. */
|
|
1081
1107
|
export type GitHubClient = ReturnType<typeof createGitHubClient>;
|
|
1082
|
-
export type { CheckRunAnnotation, CheckRunAnnotationLevel, CheckRunConclusion, CheckRunOutput, CheckRunStatus, CodeScanningSetupResult, CreateCheckRunInput, CreatePagesPayload, CreatePullInput, CreateReviewComment, CreateReviewInput, GitBlob, GitCommit, GitContents, GitDirectoryEntry, GitHubApp, GitHubAppAccount, GitHubAppCredentials, GitHubAppInstallation, GitHubCheckRun, GitHubClientOptions, GitHubContents, GitHubEnvironment, GitHubInstallationWebhookPayload, GitHubIssue, GitHubLabel, GitHubMilestone, GitHubPages, GitHubPublicKey, GitHubPullRequest, GitHubPullRequestCommit, GitHubPullRequestFile, GitHubPullRequestReview, GitHubPullRequestWebhookPayload, GitHubPushWebhookPayload, GitHubRepo, GitHubRuleset, GitHubRulesetDetail, GitHubUser, GitHubUserWithExpiry, GitHubVariable, GitHubWebhookHeaders, GitHubWorkflowRun, GitPull, GitRef, GitTree, GitTreeItem, GraphQLClient, InstallationAccessToken, IssueSearchParams, ListDirectoryOptions, OrgProperty, PagesBuildStatus, PagesBuildType, PutContentsInput, PutContentsResult, RepoPropertyValue, RepoTeam, ReviewThread, SecretScope, TeamMember, TeamPermission, UpdateCheckRunInput, UpdatePagesPayload, VariableScope, VariableVisibility, WorkflowRunFilter };
|
|
1108
|
+
export type { CheckRunAnnotation, CheckRunAnnotationLevel, CheckRunConclusion, CheckRunOutput, CheckRunStatus, CodeScanningSetupResult, CreateCheckRunInput, CreatePagesPayload, CreatePullInput, CreateReviewComment, CreateReviewInput, GitBlob, GitCommit, GitContents, GitDirectoryEntry, GitHubApp, GitHubAppAccount, GitHubAppCredentials, GitHubAppInstallation, GitHubCheckRun, GitHubClientOptions, GitHubContents, GitHubEnvironment, GitHubInstallationWebhookPayload, GitHubIssue, GitHubIssueComment, GitHubLabel, GitHubMilestone, GitHubPages, GitHubPublicKey, GitHubPullRequest, GitHubPullRequestCommit, GitHubPullRequestFile, GitHubPullRequestReview, GitHubPullRequestWebhookPayload, GitHubPushWebhookPayload, GitHubRepo, GitHubRuleset, GitHubRulesetDetail, GitHubUser, GitHubUserWithExpiry, GitHubVariable, GitHubWebhookHeaders, GitHubWorkflowRun, GitPull, GitRef, GitTree, GitTreeItem, GraphQLClient, InstallationAccessToken, IssueSearchParams, ListDirectoryOptions, OrgProperty, PagesBuildStatus, PagesBuildType, PutContentsInput, PutContentsResult, RepoPropertyValue, RepoTeam, ReviewThread, SecretScope, TeamMember, TeamPermission, UpdateCheckRunInput, UpdatePagesPayload, VariableScope, VariableVisibility, WorkflowRunFilter };
|
package/dist/index.mjs
CHANGED
|
@@ -259,6 +259,8 @@ function issues(rest) {
|
|
|
259
259
|
if (params.per_page) qs.set("per_page", String(params.per_page));
|
|
260
260
|
if (params.filter) qs.set("filter", params.filter);
|
|
261
261
|
if (params.assignee) qs.set("assignee", params.assignee);
|
|
262
|
+
if (params.page) qs.set("page", String(params.page));
|
|
263
|
+
if (params.milestone) qs.set("milestone", params.milestone);
|
|
262
264
|
const q = qs.toString();
|
|
263
265
|
const path = q ? `${repoBase(repo)}/issues?${q}` : `${repoBase(repo)}/issues`;
|
|
264
266
|
return rest.request(path);
|
|
@@ -281,6 +283,18 @@ function issues(rest) {
|
|
|
281
283
|
method: "POST",
|
|
282
284
|
body: { body }
|
|
283
285
|
}),
|
|
286
|
+
listComments: async (repo, number) => {
|
|
287
|
+
const all = [];
|
|
288
|
+
for (let page = 1;; page++) {
|
|
289
|
+
const batch = await rest.request(`${repoBase(repo)}/issues/${number}/comments?per_page=100&page=${page}`);
|
|
290
|
+
all.push(...batch);
|
|
291
|
+
if (batch.length < 100) return all;
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
createMilestone: (repo, title) => rest.request(`${repoBase(repo)}/milestones`, {
|
|
295
|
+
method: "POST",
|
|
296
|
+
body: { title }
|
|
297
|
+
}),
|
|
284
298
|
listMilestones: (repo, params = {}) => {
|
|
285
299
|
const qs = new URLSearchParams({ per_page: "100" });
|
|
286
300
|
if (params.state) qs.set("state", params.state);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/github-client",
|
|
3
|
-
"version": "1.58.0-alpha.
|
|
3
|
+
"version": "1.58.0-alpha.18",
|
|
4
4
|
"description": "A TypeScript client for the GitHub REST API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@theholocron/
|
|
36
|
-
"@theholocron/
|
|
35
|
+
"@theholocron/observability": "^0.7.0-alpha.2",
|
|
36
|
+
"@theholocron/http-client": "^1.58.0-alpha.18"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^26",
|
|
40
|
-
"@vitest/coverage-v8": "^5.0
|
|
40
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
41
41
|
"@vitest/eslint-plugin": "^1.6.28",
|
|
42
42
|
"eslint": "^10.14.0",
|
|
43
43
|
"eslint-plugin-n": "^18.5.0",
|
|
44
44
|
"globals": "^17.14.0",
|
|
45
|
-
"tsdown": "^0.23.
|
|
45
|
+
"tsdown": "^0.23.5",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
|
-
"vitest": "^5.0
|
|
47
|
+
"vitest": "^5.1.0",
|
|
48
48
|
"@theholocron/tsconfig": "^8.9.0-alpha.11",
|
|
49
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.11",
|
|
49
50
|
"@theholocron/eslint-config": "^8.9.0-alpha.11",
|
|
50
|
-
"@theholocron/vitest-config": "^8.9.0-alpha.11"
|
|
51
|
-
"@theholocron/tsdown-config": "^8.9.0-alpha.11"
|
|
51
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.11"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22.0.0"
|