@theholocron/github-client 1.58.0-alpha.4 → 1.58.0-alpha.9

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  import "@theholocron/http-client";
2
2
  import { ErrorSink, Logger } from "@theholocron/observability/core";
3
+ /**
4
+ * GitHub's GraphQL API has exactly one endpoint (`POST /graphql`, always) —
5
+ * unlike REST's per-resource paths, there's nothing here for `createRestClient()`
6
+ * to route on. Reused anyway for the transport it already gets right (auth
7
+ * header, JSON body/parsing, network-failure wrapping into `ProviderApiError`
8
+ * with `status: 0`) — only the response-shape difference needs handling on
9
+ * top: GraphQL always answers `200 OK`, even for a query error, with the
10
+ * error(s) in the response body's own `errors` array rather than the HTTP
11
+ * status. `createRestClient()`'s own `!res.ok` branch never fires for a
12
+ * GraphQL error — this wrapper's the one place that translates a 200 with a
13
+ * populated `errors` array into a thrown `ProviderApiError`, matching the
14
+ * REST client's own error-throwing contract so callers don't need to know
15
+ * which transport they're talking to.
16
+ */
17
+ interface GraphQLClient {
18
+ query<T>(document: string, variables?: Record<string, unknown>): Promise<T>;
19
+ }
3
20
  /** Options for creating a GitHub client. */
4
21
  interface GitHubClientOptions {
5
22
  /** The token sent as the bearer credential. */
@@ -844,6 +861,8 @@ export declare function createGitHubClient(opts: GitHubClientOptions): {
844
861
  updateRef: (repo: string, ref: string, sha: string, force?: boolean) => Promise<GitRef>;
845
862
  createPull: (repo: string, input: CreatePullInput) => Promise<GitPull>;
846
863
  };
864
+ /** The GraphQL client, for the callers whose API (Projects v2) has no REST form. */
865
+ graphql: GraphQLClient;
847
866
  issues: {
848
867
  listIssues: (repo: string, params?: IssueSearchParams) => Promise<GitHubIssue[]>;
849
868
  getIssue: (repo: string, number: number) => Promise<GitHubIssue>;
@@ -945,4 +964,4 @@ export declare function createGitHubClient(opts: GitHubClientOptions): {
945
964
  };
946
965
  /** The client returned by `createGitHubClient()`: one group of methods per GitHub API area. */
947
966
  export type GitHubClient = ReturnType<typeof createGitHubClient>;
948
- export type { CheckRunAnnotation, CheckRunAnnotationLevel, CheckRunConclusion, CheckRunOutput, CheckRunStatus, CodeScanningSetupResult, CreateCheckRunInput, CreatePagesPayload, CreatePullInput, CreateReviewComment, CreateReviewInput, GitBlob, GitCommit, GitContents, GitHubAppCredentials, 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, InstallationAccessToken, IssueSearchParams, OrgProperty, PagesBuildStatus, PagesBuildType, PutContentsInput, PutContentsResult, RepoPropertyValue, RepoTeam, ReviewThread, SecretScope, TeamMember, TeamPermission, UpdateCheckRunInput, UpdatePagesPayload, VariableScope, VariableVisibility, WorkflowRunFilter };
967
+ export type { CheckRunAnnotation, CheckRunAnnotationLevel, CheckRunConclusion, CheckRunOutput, CheckRunStatus, CodeScanningSetupResult, CreateCheckRunInput, CreatePagesPayload, CreatePullInput, CreateReviewComment, CreateReviewInput, GitBlob, GitCommit, GitContents, GitHubAppCredentials, 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, OrgProperty, PagesBuildStatus, PagesBuildType, PutContentsInput, PutContentsResult, RepoPropertyValue, RepoTeam, ReviewThread, SecretScope, TeamMember, TeamPermission, UpdateCheckRunInput, UpdatePagesPayload, VariableScope, VariableVisibility, WorkflowRunFilter };
package/dist/index.mjs CHANGED
@@ -900,6 +900,8 @@ function createGitHubClient(opts) {
900
900
  checks: checks(rest),
901
901
  environments: environments(rest),
902
902
  git: git(rest),
903
+ /** The GraphQL client, for the callers whose API (Projects v2) has no REST form. */
904
+ graphql,
903
905
  issues: issues(rest),
904
906
  labels: labels(rest),
905
907
  pages: pages(rest),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/github-client",
3
- "version": "1.58.0-alpha.4",
3
+ "version": "1.58.0-alpha.9",
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/http-client": "^1.58.0-alpha.4",
36
- "@theholocron/observability": "^0.6.1-alpha.1"
35
+ "@theholocron/observability": "^0.7.0-alpha.1",
36
+ "@theholocron/http-client": "^1.58.0-alpha.9"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^26",
40
40
  "@vitest/coverage-v8": "^5.0.5",
41
- "@vitest/eslint-plugin": "^1.6.27",
42
- "eslint": "^10.8.1",
43
- "eslint-plugin-n": "^18.3.0",
44
- "globals": "^17.11.0",
45
- "tsdown": "^0.23.3",
41
+ "@vitest/eslint-plugin": "^1.6.28",
42
+ "eslint": "^10.14.0",
43
+ "eslint-plugin-n": "^18.5.0",
44
+ "globals": "^17.14.0",
45
+ "tsdown": "^0.23.4",
46
46
  "typescript": "^5.9.3",
47
47
  "vitest": "^5.0.5",
48
- "@theholocron/tsconfig": "^8.9.0-alpha.5",
49
- "@theholocron/tsdown-config": "^8.9.0-alpha.5",
50
- "@theholocron/vitest-config": "^8.9.0-alpha.5",
51
- "@theholocron/eslint-config": "^8.9.0-alpha.5"
48
+ "@theholocron/eslint-config": "^8.9.0-alpha.8",
49
+ "@theholocron/tsconfig": "^8.9.0-alpha.8",
50
+ "@theholocron/vitest-config": "^8.9.0-alpha.8",
51
+ "@theholocron/tsdown-config": "^8.9.0-alpha.8"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22.0.0"
@@ -57,10 +57,10 @@
57
57
  "access": "public"
58
58
  },
59
59
  "scripts": {
60
- "delivery.build": "tsdown && node ../scripts/check-bundle-size.mjs",
61
- "sourceQuality.staticAnalysis": "eslint .",
60
+ "build": "tsdown && node ../scripts/check-bundle-size.mjs",
61
+ "lint:code": "eslint .",
62
+ "test:unit": "vitest run --coverage",
62
63
  "test:watch": "vitest",
63
- "verification.typeSafety": "tsc --noEmit",
64
- "verification.unitTests": "vitest run"
64
+ "typecheck": "tsc --noEmit"
65
65
  }
66
66
  }