@fabrika/github-app 0.9.0-dev.12 → 0.9.0-dev.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/github-app",
3
- "version": "0.9.0-dev.12",
3
+ "version": "0.9.0-dev.14",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
package/src/client.ts CHANGED
@@ -157,6 +157,14 @@ export class GitHubAppClient {
157
157
  return this.decodeInstallation(body, organization, 'Organization')
158
158
  }
159
159
 
160
+ /** Resolve and strictly bind the installation authority owned by one personal account. A 404 is an expected miss. */
161
+ async resolveUserInstallation(user: string, signal?: AbortSignal): Promise<GitHubAppInstallation | null> {
162
+ validateRepositoryComponent(user)
163
+ const body = await this.requestJson(`/users/${user}/installation`, {}, signal, true)
164
+ if (body === NOT_FOUND) return null
165
+ return this.decodeInstallation(body, user, 'User')
166
+ }
167
+
160
168
  /** Resolve the App installation for one GitHub repository. A 404 is an expected miss. */
161
169
  async resolveInstallationId(owner: string, repository: string, signal?: AbortSignal): Promise<number | null> {
162
170
  return (await this.resolveRepositoryInstallation(owner, repository, signal))?.id ?? null
package/src/types.ts CHANGED
@@ -77,6 +77,7 @@ export interface CreatedGitHubApp {
77
77
  }
78
78
 
79
79
  export interface GitHubAppManifestInput {
80
+ /** The App owner's login, an organization's or a personal account's; validated only, GitHub's creation URL names the owner. */
80
81
  readonly organization: string
81
82
  readonly appName: string
82
83
  readonly homepageUrl: string
@@ -84,7 +85,7 @@ export interface GitHubAppManifestInput {
84
85
  readonly redirectUrl?: string
85
86
  /** Where GitHub sends the installer after an install or an installation update, with `installation_id` and `setup_action`. */
86
87
  readonly setupUrl?: string
87
- /** GitHub requires a public App when repositories outside its owner organization need it. */
88
+ /** GitHub requires a public App when repositories outside its owner account need it. */
88
89
  readonly public: boolean
89
90
  }
90
91
 
@@ -28,6 +28,8 @@ export declare class GitHubAppClient {
28
28
  resolveOrganizationInstallationId(organization: string, signal?: AbortSignal): Promise<number | null>;
29
29
  /** Resolve and strictly bind the installation authority owned by one organization. */
30
30
  resolveOrganizationInstallation(organization: string, signal?: AbortSignal): Promise<GitHubAppInstallation | null>;
31
+ /** Resolve and strictly bind the installation authority owned by one personal account. A 404 is an expected miss. */
32
+ resolveUserInstallation(user: string, signal?: AbortSignal): Promise<GitHubAppInstallation | null>;
31
33
  /** Resolve the App installation for one GitHub repository. A 404 is an expected miss. */
32
34
  resolveInstallationId(owner: string, repository: string, signal?: AbortSignal): Promise<number | null>;
33
35
  /** Resolve and strictly bind the installation authority that grants one repository. */
@@ -68,6 +68,7 @@ export interface CreatedGitHubApp {
68
68
  readonly webhookSecret: string;
69
69
  }
70
70
  export interface GitHubAppManifestInput {
71
+ /** The App owner's login, an organization's or a personal account's; validated only, GitHub's creation URL names the owner. */
71
72
  readonly organization: string;
72
73
  readonly appName: string;
73
74
  readonly homepageUrl: string;
@@ -75,7 +76,7 @@ export interface GitHubAppManifestInput {
75
76
  readonly redirectUrl?: string;
76
77
  /** Where GitHub sends the installer after an install or an installation update, with `installation_id` and `setup_action`. */
77
78
  readonly setupUrl?: string;
78
- /** GitHub requires a public App when repositories outside its owner organization need it. */
79
+ /** GitHub requires a public App when repositories outside its owner account need it. */
79
80
  readonly public: boolean;
80
81
  }
81
82
  export interface GitHubAppManifestExchangeOptions {