@fabrika/github-app 0.9.0-dev.1 → 0.9.0-dev.2

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.1",
3
+ "version": "0.9.0-dev.2",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,12 +9,13 @@
9
9
  },
10
10
  "files": [
11
11
  "src",
12
- "!src/**/__tests__/**"
12
+ "!src/**/__tests__/**",
13
+ "types"
13
14
  ],
14
15
  "exports": {
15
16
  ".": {
16
17
  "bun": "./src/index.ts",
17
- "types": "./src/index.ts",
18
+ "types": "./types/src/index.d.ts",
18
19
  "default": "./src/index.ts"
19
20
  }
20
21
  },
package/src/repository.ts CHANGED
@@ -89,6 +89,8 @@ export function createRepositoryClient(config: RepositoryClientConfig): GitHubRe
89
89
 
90
90
  class RepositoryClient implements GitHubRepositoryClient {
91
91
  readonly #config: RepositoryClientConfig
92
+ /** Commits and trees this client read, by request path: a sha names immutable content, so one client reads each once. */
93
+ readonly #objects = new Map<string, Promise<unknown>>()
92
94
 
93
95
  constructor(config: RepositoryClientConfig) {
94
96
  this.#config = config
@@ -230,9 +232,11 @@ class RepositoryClient implements GitHubRepositoryClient {
230
232
  const changes = treeChanges(input.changes)
231
233
 
232
234
  // Known limit: REST has no compare-and-swap, so a concurrent reset to an ancestor still lets the non-force PATCH fast-forward.
235
+ const parentRead = this.#readCommit(input.expectedHeadSha, input.signal)
236
+ parentRead.catch(() => undefined)
233
237
  const head = await this.readRef(input.branch, input.signal)
234
238
  if (head?.sha !== input.expectedHeadSha) throw new GitHubStaleHeadError()
235
- const parent = await this.#readCommit(input.expectedHeadSha, input.signal)
239
+ const parent = await parentRead
236
240
  const tree = await this.#resolveModes(changes, parent.treeSha, input.signal)
237
241
 
238
242
  const createdTree = await this.#request('/git/trees', {
@@ -318,7 +322,17 @@ class RepositoryClient implements GitHubRepositoryClient {
318
322
  }
319
323
 
320
324
  /** Reads a commit, tree or blob by sha; GitHub answers 404 or 422 for an unknown one. */
321
- async #readGitObject(path: string, signal: AbortSignal | undefined, maxResponseBytes?: number): Promise<unknown> {
325
+ #readGitObject(path: string, signal: AbortSignal | undefined, maxResponseBytes?: number): Promise<unknown> {
326
+ if (path.startsWith('/git/blobs/')) return this.#fetchGitObject(path, signal, maxResponseBytes)
327
+ const cached = this.#objects.get(path)
328
+ if (cached !== undefined) return cached
329
+ const read = this.#fetchGitObject(path, signal, maxResponseBytes)
330
+ this.#objects.set(path, read)
331
+ read.catch(() => this.#objects.delete(path))
332
+ return read
333
+ }
334
+
335
+ async #fetchGitObject(path: string, signal: AbortSignal | undefined, maxResponseBytes?: number): Promise<unknown> {
322
336
  const result = await this.#request(path, { signal, maxResponseBytes, expectedFailures: [404, 422] })
323
337
  if (!result.ok) throw new GitHubNotFoundError()
324
338
  return result.body
@@ -0,0 +1,39 @@
1
+ import type { GitHubRepositoryClient, GitHubRepositoryOpenRequest } from './repository-types';
2
+ import type { GitHubAppClientConfig, GitHubAppIdentity, GitHubAppInstallation, GitHubAppWebhookConfig, GitHubAppWebhookUpdate, GitHubInstallationToken, GitHubRepositoryTokenRequest } from './types';
3
+ /** GitHub App machine identity. Webhook authentication belongs to the receiving service. */
4
+ export declare class GitHubAppClient {
5
+ private readonly appId;
6
+ private readonly privateKey;
7
+ private readonly apiBaseUrl;
8
+ private readonly fetchImplementation;
9
+ private readonly clock;
10
+ private readonly timeoutMs;
11
+ private constructor();
12
+ /** Validate all configuration and import the RSA key before a credential-owning service boots. */
13
+ static create(config: GitHubAppClientConfig): Promise<GitHubAppClient>;
14
+ /** Read and bind the public identity represented by this client's App credentials. */
15
+ getAuthenticatedApp(signal?: AbortSignal): Promise<GitHubAppIdentity>;
16
+ /** Read the App webhook transport settings without exposing GitHub's masked secret field. */
17
+ getWebhookConfig(signal?: AbortSignal): Promise<GitHubAppWebhookConfig>;
18
+ /** Set the App webhook to JSON over verified TLS and bind GitHub's response to that request. */
19
+ updateWebhookConfig(input: GitHubAppWebhookUpdate): Promise<GitHubAppWebhookConfig>;
20
+ /** Resolve the App installation owned by one organization. A 404 is an expected miss. */
21
+ resolveOrganizationInstallationId(organization: string, signal?: AbortSignal): Promise<number | null>;
22
+ /** Resolve and strictly bind the installation authority owned by one organization. */
23
+ resolveOrganizationInstallation(organization: string, signal?: AbortSignal): Promise<GitHubAppInstallation | null>;
24
+ /** Resolve the App installation for one GitHub repository. A 404 is an expected miss. */
25
+ resolveInstallationId(owner: string, repository: string, signal?: AbortSignal): Promise<number | null>;
26
+ /** Resolve and strictly bind the installation authority that grants one repository. */
27
+ resolveRepositoryInstallation(owner: string, repository: string, signal?: AbortSignal): Promise<GitHubAppInstallation | null>;
28
+ /** Mint a read-only token restricted to one repository in the selected installation. */
29
+ mintRepositoryToken(input: GitHubRepositoryTokenRequest): Promise<GitHubInstallationToken>;
30
+ /**
31
+ * Mint a token restricted to one repository with `contents: write` and `pull_requests: write`,
32
+ * and return a client bound to it. The token never leaves the returned client.
33
+ */
34
+ openRepository(input: GitHubRepositoryOpenRequest): Promise<GitHubRepositoryClient>;
35
+ private mintToken;
36
+ private requestJson;
37
+ private decodeInstallation;
38
+ private now;
39
+ }
@@ -0,0 +1,20 @@
1
+ export declare function configurationError(): Error;
2
+ /** GitHub answered a request with an unexpected status; the message never carries GitHub's response text. */
3
+ export declare class GitHubRequestError extends Error {
4
+ readonly status: number;
5
+ constructor(status: number);
6
+ }
7
+ export declare function requestStatusError(status: number): GitHubRequestError;
8
+ export declare function responseError(): Error;
9
+ /** The branch moved since the caller read it; re-read the head and retry the change on top of it. */
10
+ export declare class GitHubStaleHeadError extends Error {
11
+ constructor();
12
+ }
13
+ /** The branch exists at a different commit than the one it was to be created from. */
14
+ export declare class GitHubBranchConflictError extends Error {
15
+ constructor();
16
+ }
17
+ /** A commit, tree or blob sha the caller named does not exist in the repository. */
18
+ export declare class GitHubNotFoundError extends Error {
19
+ constructor();
20
+ }
@@ -0,0 +1,6 @@
1
+ export { GitHubAppClient } from './client';
2
+ export { GitHubBranchConflictError, GitHubNotFoundError, GitHubRequestError, GitHubStaleHeadError } from './errors';
3
+ export { buildGitHubAppManifest, exchangeGitHubAppManifestCode } from './manifest';
4
+ export type { GitHubBlobRead, GitHubBlobRef, GitHubChangedFile, GitHubChangedFileStatus, GitHubCommit, GitHubCommitFilesInput, GitHubComparison, GitHubCreateBranchInput, GitHubFileChange, GitHubFileRead, GitHubOpenPullRequestInput, GitHubPullRequestRef, GitHubRef, GitHubRepositoryClient, GitHubRepositoryOpenRequest, GitHubTextFile, GitHubTreeEntry, GitHubTreeListing, GitHubUnreadablePath, GitHubUnreadableReason, } from './repository-types';
5
+ export { pemToPkcs8 } from './signing';
6
+ export type { CreatedGitHubApp, GitHubAppClientConfig, GitHubAppFetch, GitHubAppIdentity, GitHubAppInstallation, GitHubAppManifestExchangeOptions, GitHubAppManifestInput, GitHubAppWebhookConfig, GitHubAppWebhookUpdate, GitHubInstallationToken, GitHubRepositoryTokenRequest, } from './types';
@@ -0,0 +1,8 @@
1
+ import type { CreatedGitHubApp, GitHubAppManifestExchangeOptions, GitHubAppManifestInput } from './types';
2
+ /**
3
+ * Build the one App manifest used by Fabrika repository source and MCP authoring. The write permissions serve
4
+ * MCP authoring's branches and pull requests (`openRepository`); deploy tokens are minted with Contents read only.
5
+ */
6
+ export declare function buildGitHubAppManifest(input: GitHubAppManifestInput): Readonly<Record<string, unknown>>;
7
+ /** Exchange a bounded one-time GitHub manifest code without exposing response details. */
8
+ export declare function exchangeGitHubAppManifestCode(code: string, options?: GitHubAppManifestExchangeOptions): Promise<CreatedGitHubApp>;
@@ -0,0 +1,146 @@
1
+ export interface GitHubRef {
2
+ readonly branch: string;
3
+ readonly sha: string;
4
+ }
5
+ export interface GitHubCommit {
6
+ readonly sha: string;
7
+ readonly treeSha: string;
8
+ readonly parents: readonly string[];
9
+ }
10
+ export type GitHubTreeEntry = {
11
+ readonly path: string;
12
+ readonly sha: string;
13
+ } & ({
14
+ readonly type: 'tree';
15
+ readonly mode: '040000';
16
+ } | {
17
+ readonly type: 'blob';
18
+ readonly mode: '100644' | '100755' | '120000';
19
+ readonly size: number;
20
+ } | {
21
+ readonly type: 'commit';
22
+ readonly mode: '160000';
23
+ });
24
+ export interface GitHubTreeListing {
25
+ readonly commitSha: string;
26
+ /** Empty for the root; entries use repository-relative paths. */
27
+ readonly directory: string;
28
+ /** Every entry below `directory`, recursively, up to the client's bound. */
29
+ readonly entries: readonly GitHubTreeEntry[];
30
+ /** True when the bound cut the listing short. */
31
+ readonly truncated: boolean;
32
+ }
33
+ export interface GitHubTextFile {
34
+ readonly path: string;
35
+ readonly content: string;
36
+ }
37
+ /**
38
+ * Why a requested path was not read: `missing` (no such path), `not_a_file` (a directory, symlink or submodule),
39
+ * `too_large` (over the per-file bound), `binary` (not UTF-8), `budget` (past the read's total byte bound).
40
+ */
41
+ export type GitHubUnreadableReason = 'missing' | 'not_a_file' | 'too_large' | 'binary' | 'budget';
42
+ export interface GitHubUnreadablePath {
43
+ readonly path: string;
44
+ readonly reason: GitHubUnreadableReason;
45
+ }
46
+ export interface GitHubFileRead {
47
+ readonly commitSha: string;
48
+ readonly files: readonly GitHubTextFile[];
49
+ /** Requested paths that were not read at `commitSha`, in request order. */
50
+ readonly unreadable: readonly GitHubUnreadablePath[];
51
+ }
52
+ /** A blob named by a tree listing of the same repository. */
53
+ export interface GitHubBlobRef {
54
+ readonly path: string;
55
+ readonly sha: string;
56
+ readonly size: number;
57
+ }
58
+ export interface GitHubBlobRead {
59
+ readonly files: readonly GitHubTextFile[];
60
+ /** Blobs that were not read (`too_large`, `budget` or `binary`), in request order. */
61
+ readonly unreadable: readonly GitHubUnreadablePath[];
62
+ }
63
+ export type GitHubChangedFileStatus = 'added' | 'removed' | 'modified' | 'renamed' | 'copied' | 'changed' | 'unchanged';
64
+ export interface GitHubChangedFile {
65
+ readonly path: string;
66
+ /** The path before a rename or copy. */
67
+ readonly previousPath: string | null;
68
+ readonly status: GitHubChangedFileStatus;
69
+ readonly additions: number;
70
+ readonly deletions: number;
71
+ /** The unified diff hunk; null when GitHub omits it (a binary file or a very large change). */
72
+ readonly patch: string | null;
73
+ }
74
+ export interface GitHubComparison {
75
+ readonly baseSha: string;
76
+ readonly headSha: string;
77
+ /** Commits on head that are not on base. */
78
+ readonly aheadBy: number;
79
+ readonly behindBy: number;
80
+ readonly files: readonly GitHubChangedFile[];
81
+ /** GitHub lists at most 300 files of a comparison; true when it listed that many, so more may have changed. */
82
+ readonly filesCapped: boolean;
83
+ }
84
+ export interface GitHubFileChange {
85
+ readonly path: string;
86
+ /** UTF-8 regular-file contents, or null to delete the path. */
87
+ readonly content: string | null;
88
+ }
89
+ export interface GitHubCreateBranchInput {
90
+ readonly branch: string;
91
+ readonly fromSha: string;
92
+ readonly signal?: AbortSignal;
93
+ }
94
+ export interface GitHubCommitFilesInput {
95
+ readonly branch: string;
96
+ /** The branch head the changes were made against; a different live head fails with `GitHubStaleHeadError`. */
97
+ readonly expectedHeadSha: string;
98
+ readonly message: string;
99
+ readonly author: {
100
+ readonly name: string;
101
+ readonly email: string;
102
+ };
103
+ readonly changes: readonly GitHubFileChange[];
104
+ readonly signal?: AbortSignal;
105
+ }
106
+ export interface GitHubOpenPullRequestInput {
107
+ readonly head: string;
108
+ readonly base: string;
109
+ readonly title: string;
110
+ readonly body: string;
111
+ readonly signal?: AbortSignal;
112
+ }
113
+ export interface GitHubPullRequestRef {
114
+ readonly number: number;
115
+ readonly url: string;
116
+ /** False when an open pull request for the same head and base already existed and was returned instead. */
117
+ readonly created: boolean;
118
+ }
119
+ /**
120
+ * One repository, reached with an installation token restricted to it. The caller (Source) decides
121
+ * which branches it may write; the client only refuses a non-fast-forward or stale update.
122
+ */
123
+ export interface GitHubRepositoryClient {
124
+ readRef(branch: string, signal?: AbortSignal): Promise<GitHubRef | null>;
125
+ readTree(commitSha: string, directory?: string, signal?: AbortSignal): Promise<GitHubTreeListing>;
126
+ readFiles(commitSha: string, paths: readonly string[], signal?: AbortSignal): Promise<GitHubFileRead>;
127
+ /** Reads listed blobs as text without walking the tree again, within the same per-file and total bounds as `readFiles`. */
128
+ readBlobTexts(blobs: readonly GitHubBlobRef[], signal?: AbortSignal): Promise<GitHubBlobRead>;
129
+ /** The changes from the merge base of `baseSha` and `headSha` to `headSha`. */
130
+ compareCommits(baseSha: string, headSha: string, signal?: AbortSignal): Promise<GitHubComparison>;
131
+ /** Idempotent: an existing branch already at `fromSha` is returned; one elsewhere is a conflict. */
132
+ createBranch(input: GitHubCreateBranchInput): Promise<GitHubRef>;
133
+ /** Idempotent: `deleted` is false when the branch did not exist. GitHub closes an open pull request from it. */
134
+ deleteBranch(branch: string, signal?: AbortSignal): Promise<{
135
+ readonly deleted: boolean;
136
+ }>;
137
+ /** Creates exactly one commit on top of `expectedHeadSha` and moves the branch to it without force. */
138
+ commitFiles(input: GitHubCommitFilesInput): Promise<GitHubCommit>;
139
+ openPullRequest(input: GitHubOpenPullRequestInput): Promise<GitHubPullRequestRef>;
140
+ }
141
+ export interface GitHubRepositoryOpenRequest {
142
+ readonly installationId: number;
143
+ readonly owner: string;
144
+ readonly repository: string;
145
+ readonly signal?: AbortSignal;
146
+ }
@@ -0,0 +1,39 @@
1
+ import type { GitHubCommit, GitHubComparison, GitHubPullRequestRef, GitHubRef, GitHubTreeEntry } from './repository-types';
2
+ export declare const MAX_TREE_ENTRIES = 5000;
3
+ export declare const MAX_TREE_RESPONSE_BYTES: number;
4
+ export declare const MAX_READ_PATHS = 100;
5
+ export declare const MAX_FILE_BYTES: number;
6
+ export declare const MAX_READ_BYTES: number;
7
+ export declare const MAX_BLOB_RESPONSE_BYTES: number;
8
+ export declare const MAX_CHANGED_FILES = 256;
9
+ export declare const MAX_CHANGED_BYTES: number;
10
+ export declare const MAX_COMMIT_MESSAGE_BYTES: number;
11
+ export declare const MAX_PULL_REQUEST_TITLE_BYTES = 1024;
12
+ export declare const MAX_PULL_REQUEST_BODY_BYTES: number;
13
+ export declare const MAX_PULL_REQUEST_RESPONSE_BYTES: number;
14
+ export declare const MAX_COMMIT_RESPONSE_BYTES: number;
15
+ export declare const MAX_PATH_SEGMENTS = 64;
16
+ /** GitHub's own bound on the files of one comparison. */
17
+ export declare const MAX_COMPARE_FILES = 300;
18
+ export declare const MAX_COMPARE_RESPONSE_BYTES: number;
19
+ export declare function validateSha(value: string): void;
20
+ /** A subset of `git check-ref-format` that is safe to place in a URL path segment by segment. */
21
+ export declare function validateBranch(value: string): void;
22
+ /** Repository-relative path: no leading, trailing or doubled slash, no `.`/`..` segment, never inside `.git`. */
23
+ export declare function validatePath(value: string): void;
24
+ export declare function validateText(value: string, maxBytes: number, allowEmpty: boolean): void;
25
+ export declare function utf8Length(value: string): number;
26
+ export declare function encodeBranch(branch: string): string;
27
+ export declare function decodeRef(body: unknown, branch: string): GitHubRef;
28
+ export declare function decodeCommit(body: unknown): GitHubCommit;
29
+ export interface DecodedTree {
30
+ readonly entries: readonly GitHubTreeEntry[];
31
+ readonly truncated: boolean;
32
+ }
33
+ export declare function decodeTree(body: unknown, expectedSha: string): DecodedTree;
34
+ export declare function decodeCreatedTreeSha(body: unknown): string;
35
+ /** The blob's bytes as UTF-8 text, or null when they are not valid UTF-8. */
36
+ export declare function decodeTextBlob(body: unknown, expectedSha: string, expectedSize: number): string | null;
37
+ export declare function decodeComparison(body: unknown, headSha: string): GitHubComparison;
38
+ export declare function decodePullRequest(body: unknown, created: boolean): GitHubPullRequestRef;
39
+ export declare function decodePullRequestList(body: unknown): unknown[];
@@ -0,0 +1,12 @@
1
+ import type { GitHubRepositoryClient } from './repository-types';
2
+ import type { GitHubAppFetch, GitHubInstallationToken } from './types';
3
+ export interface RepositoryClientConfig {
4
+ readonly owner: string;
5
+ readonly repository: string;
6
+ readonly token: GitHubInstallationToken;
7
+ readonly now: () => number;
8
+ readonly apiBaseUrl: string;
9
+ readonly fetch: GitHubAppFetch;
10
+ readonly timeoutMs: number;
11
+ }
12
+ export declare function createRepositoryClient(config: RepositoryClientConfig): GitHubRepositoryClient;
@@ -0,0 +1,3 @@
1
+ export declare function signAppJwt(appId: string, privateKey: CryptoKey, clock: () => number): Promise<string>;
2
+ /** Convert a GitHub App PKCS1 or PKCS8 PEM key into PKCS8 DER for WebCrypto. */
3
+ export declare function pemToPkcs8(pem: string): Uint8Array<ArrayBuffer>;
@@ -0,0 +1,11 @@
1
+ export declare const GITHUB_ACCEPT = "application/vnd.github+json";
2
+ export declare const GITHUB_API_VERSION = "2022-11-28";
3
+ export declare const GITHUB_USER_AGENT = "vozka";
4
+ interface RequestCancellation {
5
+ readonly signal: AbortSignal;
6
+ throwIfCancelled(): void;
7
+ dispose(): void;
8
+ }
9
+ export declare function createCancellation(callerSignal: AbortSignal | undefined, timeoutMs: number): RequestCancellation;
10
+ export declare function readBoundedJson(response: Response, cancellation: RequestCancellation, maxResponseBytes?: number): Promise<unknown>;
11
+ export {};
@@ -0,0 +1,79 @@
1
+ export interface GitHubAppClientConfig {
2
+ /** Numeric GitHub App id, kept as a string because it is the JWT issuer. */
3
+ appId: string;
4
+ /** GitHub App RSA private key in PKCS1 or PKCS8 PEM form. */
5
+ privateKeyPem: string;
6
+ /** GitHub API base URL. Defaults to the public GitHub API. */
7
+ apiBaseUrl?: string;
8
+ /** HTTP implementation for the current runtime. */
9
+ fetch?: GitHubAppFetch;
10
+ /** Millisecond Unix clock. */
11
+ now?: () => number;
12
+ /** Upper bound for each GitHub API request, including its response body. */
13
+ timeoutMs?: number;
14
+ }
15
+ export interface GitHubInstallationToken {
16
+ token: string;
17
+ expiresAt: number;
18
+ }
19
+ export interface GitHubAppInstallation {
20
+ readonly id: number;
21
+ readonly accountLogin: string;
22
+ readonly accountType: 'Organization' | 'User';
23
+ readonly repositorySelection: 'all' | 'selected';
24
+ }
25
+ export interface GitHubAppIdentity {
26
+ readonly id: number;
27
+ readonly slug: string;
28
+ readonly htmlUrl: string;
29
+ readonly public: boolean;
30
+ readonly permissions: {
31
+ readonly contents: 'read' | 'write';
32
+ readonly pull_requests?: 'read' | 'write';
33
+ };
34
+ readonly events: readonly string[];
35
+ readonly owner: {
36
+ readonly login: string;
37
+ readonly type: 'Organization' | 'User';
38
+ };
39
+ }
40
+ export interface GitHubAppWebhookConfig {
41
+ readonly url: string;
42
+ readonly contentType: 'json' | 'form';
43
+ readonly insecureSsl: '0' | '1';
44
+ }
45
+ export interface GitHubAppWebhookUpdate {
46
+ readonly url: string;
47
+ readonly secret: string;
48
+ readonly signal?: AbortSignal;
49
+ }
50
+ export interface GitHubRepositoryTokenRequest {
51
+ installationId: number;
52
+ owner: string;
53
+ repository: string;
54
+ signal?: AbortSignal;
55
+ }
56
+ export type GitHubAppFetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
57
+ export interface CreatedGitHubApp {
58
+ readonly id: number;
59
+ readonly slug: string;
60
+ readonly htmlUrl: string;
61
+ readonly pem: string;
62
+ readonly webhookSecret: string;
63
+ }
64
+ export interface GitHubAppManifestInput {
65
+ readonly organization: string;
66
+ readonly appName: string;
67
+ readonly homepageUrl: string;
68
+ readonly webhookUrl: string;
69
+ readonly redirectUrl?: string;
70
+ /** Where GitHub sends the installer after an install or an installation update, with `installation_id` and `setup_action`. */
71
+ readonly setupUrl?: string;
72
+ /** GitHub requires a public App when repositories outside its owner organization need it. */
73
+ readonly public: boolean;
74
+ }
75
+ export interface GitHubAppManifestExchangeOptions {
76
+ readonly fetch?: GitHubAppFetch;
77
+ readonly signal?: AbortSignal;
78
+ readonly timeoutMs?: number;
79
+ }
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod';
2
+ import type { GitHubAppIdentity, GitHubAppWebhookConfig } from './types';
3
+ export declare const APP_SLUG_PATTERN: RegExp;
4
+ export declare const appReferenceSchema: z.ZodObject<{
5
+ id: z.ZodNumber;
6
+ slug: z.ZodString;
7
+ html_url: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ id: number;
10
+ slug: string;
11
+ html_url: string;
12
+ }, {
13
+ id: number;
14
+ slug: string;
15
+ html_url: string;
16
+ }>;
17
+ export declare const installationSchema: z.ZodObject<{
18
+ id: z.ZodNumber;
19
+ app_id: z.ZodNumber;
20
+ target_type: z.ZodEnum<["Organization", "User"]>;
21
+ account: z.ZodObject<{
22
+ login: z.ZodString;
23
+ type: z.ZodEnum<["Organization", "User"]>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ type: "Organization" | "User";
26
+ login: string;
27
+ }, {
28
+ type: "Organization" | "User";
29
+ login: string;
30
+ }>;
31
+ repository_selection: z.ZodEnum<["all", "selected"]>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ id: number;
34
+ app_id: number;
35
+ target_type: "Organization" | "User";
36
+ account: {
37
+ type: "Organization" | "User";
38
+ login: string;
39
+ };
40
+ repository_selection: "all" | "selected";
41
+ }, {
42
+ id: number;
43
+ app_id: number;
44
+ target_type: "Organization" | "User";
45
+ account: {
46
+ type: "Organization" | "User";
47
+ login: string;
48
+ };
49
+ repository_selection: "all" | "selected";
50
+ }>;
51
+ export declare const installationTokenSchema: z.ZodObject<{
52
+ token: z.ZodEffects<z.ZodString, string, string>;
53
+ expires_at: z.ZodEffects<z.ZodString, number, string>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ token: string;
56
+ expires_at: number;
57
+ }, {
58
+ token: string;
59
+ expires_at: string;
60
+ }>;
61
+ export declare function normalizeApiBaseUrl(value: string): string;
62
+ export declare function validateRepositoryComponent(value: string): void;
63
+ export declare function normalizeWebhookUrl(value: string): string;
64
+ export declare function validateWebhookSecret(value: string): void;
65
+ export declare function decodeAppIdentity(value: unknown): Omit<GitHubAppIdentity, 'public'> | null;
66
+ export declare function sameAppIdentity(left: Omit<GitHubAppIdentity, 'public'>, right: Omit<GitHubAppIdentity, 'public'>): boolean;
67
+ export declare function decodeWebhookConfig(value: unknown): GitHubAppWebhookConfig | null;
68
+ export declare function hasAsciiControl(value: string): boolean;
69
+ export declare function isPositiveSafeInteger(value: number): boolean;