@ankhorage/repository 0.6.16 → 0.8.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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/github/index.d.ts +6 -0
- package/dist/github/index.d.ts.map +1 -1
- package/dist/github/index.js +3 -0
- package/dist/github/index.js.map +1 -1
- package/dist/github/index.test.d.ts +2 -0
- package/dist/github/index.test.d.ts.map +1 -0
- package/dist/github/index.test.js +6 -0
- package/dist/github/index.test.js.map +1 -0
- package/dist/providers/github/adapters/createGitHubHttpClient.d.ts +17 -0
- package/dist/providers/github/adapters/createGitHubHttpClient.d.ts.map +1 -0
- package/dist/providers/github/adapters/createGitHubHttpClient.js +209 -0
- package/dist/providers/github/adapters/createGitHubHttpClient.js.map +1 -0
- package/dist/providers/github/adapters/createGitHubHttpClient.test.d.ts +2 -0
- package/dist/providers/github/adapters/createGitHubHttpClient.test.d.ts.map +1 -0
- package/dist/providers/github/adapters/createGitHubHttpClient.test.js +195 -0
- package/dist/providers/github/adapters/createGitHubHttpClient.test.js.map +1 -0
- package/dist/providers/github/adapters/createGitHubHttpRepositoryDiscoveryGateway.d.ts +9 -0
- package/dist/providers/github/adapters/createGitHubHttpRepositoryDiscoveryGateway.d.ts.map +1 -0
- package/dist/providers/github/adapters/createGitHubHttpRepositoryDiscoveryGateway.js +91 -0
- package/dist/providers/github/adapters/createGitHubHttpRepositoryDiscoveryGateway.js.map +1 -0
- package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.d.ts +3 -1
- package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.d.ts.map +1 -1
- package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.js +41 -60
- package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.js.map +1 -1
- package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.test.js +168 -0
- package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.test.js.map +1 -1
- package/dist/providers/github/adapters/rateLimitResponseAsync.d.ts +9 -0
- package/dist/providers/github/adapters/rateLimitResponseAsync.d.ts.map +1 -0
- package/dist/providers/github/adapters/rateLimitResponseAsync.js +44 -0
- package/dist/providers/github/adapters/rateLimitResponseAsync.js.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryDiscoveryOptions.d.ts +10 -0
- package/dist/providers/github/definitions/GitHubRepositoryDiscoveryOptions.d.ts.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryDiscoveryOptions.js +2 -0
- package/dist/providers/github/definitions/GitHubRepositoryDiscoveryOptions.js.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryDiscoveryResult.d.ts +25 -0
- package/dist/providers/github/definitions/GitHubRepositoryDiscoveryResult.d.ts.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryDiscoveryResult.js +12 -0
- package/dist/providers/github/definitions/GitHubRepositoryDiscoveryResult.js.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryMaterializationOptions.d.ts +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryMaterializationOptions.d.ts.map +1 -1
- package/dist/providers/github/definitions/GitHubRepositoryRevisionResolutionOptions.d.ts +9 -0
- package/dist/providers/github/definitions/GitHubRepositoryRevisionResolutionOptions.d.ts.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryRevisionResolutionOptions.js +2 -0
- package/dist/providers/github/definitions/GitHubRepositoryRevisionResolutionOptions.js.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryRevisionResolutionResult.d.ts +15 -0
- package/dist/providers/github/definitions/GitHubRepositoryRevisionResolutionResult.d.ts.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryRevisionResolutionResult.js +2 -0
- package/dist/providers/github/definitions/GitHubRepositoryRevisionResolutionResult.js.map +1 -0
- package/dist/providers/github/ports/GitHubRepositoryDiscoveryGateway.d.ts +18 -0
- package/dist/providers/github/ports/GitHubRepositoryDiscoveryGateway.d.ts.map +1 -0
- package/dist/providers/github/ports/GitHubRepositoryDiscoveryGateway.js +2 -0
- package/dist/providers/github/ports/GitHubRepositoryDiscoveryGateway.js.map +1 -0
- package/dist/providers/github/ports/GitHubRepositoryReadGateway.d.ts +7 -4
- package/dist/providers/github/ports/GitHubRepositoryReadGateway.d.ts.map +1 -1
- package/dist/providers/github/services/discoverGitHubRepositoriesAsync.d.ts +5 -0
- package/dist/providers/github/services/discoverGitHubRepositoriesAsync.d.ts.map +1 -0
- package/dist/providers/github/services/discoverGitHubRepositoriesAsync.js +9 -0
- package/dist/providers/github/services/discoverGitHubRepositoriesAsync.js.map +1 -0
- package/dist/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.d.ts +6 -0
- package/dist/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.d.ts.map +1 -0
- package/dist/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.js +91 -0
- package/dist/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.js.map +1 -0
- package/dist/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.test.d.ts +2 -0
- package/dist/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.test.d.ts.map +1 -0
- package/dist/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.test.js +55 -0
- package/dist/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.test.js.map +1 -0
- package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.d.ts.map +1 -1
- package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.js +17 -110
- package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.js.map +1 -1
- package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.test.js +8 -1
- package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.test.js.map +1 -1
- package/dist/providers/github/services/parseGitHubRepositoryUrl.d.ts +8 -0
- package/dist/providers/github/services/parseGitHubRepositoryUrl.d.ts.map +1 -0
- package/dist/providers/github/services/parseGitHubRepositoryUrl.js +80 -0
- package/dist/providers/github/services/parseGitHubRepositoryUrl.js.map +1 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionAsync.d.ts +5 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionAsync.d.ts.map +1 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionAsync.js +9 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionAsync.js.map +1 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionWithGatewayAsync.d.ts +6 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionWithGatewayAsync.d.ts.map +1 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionWithGatewayAsync.js +20 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionWithGatewayAsync.js.map +1 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionWithGatewayAsync.test.d.ts +2 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionWithGatewayAsync.test.d.ts.map +1 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionWithGatewayAsync.test.js +111 -0
- package/dist/providers/github/services/resolveGitHubRepositoryRevisionWithGatewayAsync.test.js.map +1 -0
- package/dist/providers/github/services/resolveGitHubUrlRevisionAsync.d.ts +9 -0
- package/dist/providers/github/services/resolveGitHubUrlRevisionAsync.d.ts.map +1 -0
- package/dist/providers/github/services/resolveGitHubUrlRevisionAsync.js +22 -0
- package/dist/providers/github/services/resolveGitHubUrlRevisionAsync.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type GitHubOwnerType = 'organization' | 'user';
|
|
2
|
+
export interface GitHubRepositoryDiscoveryRepository {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly owner: string;
|
|
6
|
+
readonly url: string;
|
|
7
|
+
readonly visibility: 'private' | 'public';
|
|
8
|
+
}
|
|
9
|
+
export interface GitHubRepositoryDiscoveryResult {
|
|
10
|
+
readonly owner: {
|
|
11
|
+
readonly login: string;
|
|
12
|
+
readonly type: GitHubOwnerType;
|
|
13
|
+
readonly url: string;
|
|
14
|
+
};
|
|
15
|
+
readonly repositories: readonly GitHubRepositoryDiscoveryRepository[];
|
|
16
|
+
readonly selectedRepository?: GitHubRepositoryDiscoveryRepository;
|
|
17
|
+
}
|
|
18
|
+
export type GitHubRepositoryDiscoveryErrorCode = 'api-failure' | 'cancelled' | 'invalid-source' | 'owner-not-found' | 'permission-denied' | 'rate-limited' | 'timeout';
|
|
19
|
+
/** A stable, credential-free error reported by GitHub repository discovery. */
|
|
20
|
+
export declare class GitHubRepositoryDiscoveryError extends Error {
|
|
21
|
+
readonly code: GitHubRepositoryDiscoveryErrorCode;
|
|
22
|
+
readonly retryAfterMilliseconds?: number | undefined;
|
|
23
|
+
constructor(code: GitHubRepositoryDiscoveryErrorCode, message: string, retryAfterMilliseconds?: number | undefined);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=GitHubRepositoryDiscoveryResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubRepositoryDiscoveryResult.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/definitions/GitHubRepositoryDiscoveryResult.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,MAAM,CAAC;AAEtD,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC3C;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;QAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,QAAQ,CAAC,YAAY,EAAE,SAAS,mCAAmC,EAAE,CAAC;IACtE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,mCAAmC,CAAC;CACnE;AAED,MAAM,MAAM,kCAAkC,GAC1C,aAAa,GACb,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,mBAAmB,GACnB,cAAc,GACd,SAAS,CAAC;AAEd,+EAA+E;AAC/E,qBAAa,8BAA+B,SAAQ,KAAK;aAErC,IAAI,EAAE,kCAAkC;aAExC,sBAAsB,CAAC,EAAE,MAAM;gBAF/B,IAAI,EAAE,kCAAkC,EACxD,OAAO,EAAE,MAAM,EACC,sBAAsB,CAAC,EAAE,MAAM,YAAA;CAKlD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A stable, credential-free error reported by GitHub repository discovery. */
|
|
2
|
+
export class GitHubRepositoryDiscoveryError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
retryAfterMilliseconds;
|
|
5
|
+
constructor(code, message, retryAfterMilliseconds) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.retryAfterMilliseconds = retryAfterMilliseconds;
|
|
9
|
+
this.name = 'GitHubRepositoryDiscoveryError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=GitHubRepositoryDiscoveryResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubRepositoryDiscoveryResult.js","sourceRoot":"","sources":["../../../../src/providers/github/definitions/GitHubRepositoryDiscoveryResult.ts"],"names":[],"mappings":"AA6BA,+EAA+E;AAC/E,MAAM,OAAO,8BAA+B,SAAQ,KAAK;IAErC;IAEA;IAHlB,YACkB,IAAwC,EACxD,OAAe,EACC,sBAA+B;QAE/C,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,SAAI,GAAJ,IAAI,CAAoC;QAExC,2BAAsB,GAAtB,sBAAsB,CAAS;QAG/C,IAAI,CAAC,IAAI,GAAG,gCAAgC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubRepositoryMaterializationOptions.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/definitions/GitHubRepositoryMaterializationOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sCAAsC;IACrD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"GitHubRepositoryMaterializationOptions.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/definitions/GitHubRepositoryMaterializationOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sCAAsC;IACrD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GitHubRepositoryAuthentication } from './GitHubRepositoryDiscoveryOptions.js';
|
|
2
|
+
/** Options for resolving a GitHub repository URL to one immutable revision. */
|
|
3
|
+
export interface GitHubRepositoryRevisionResolutionOptions {
|
|
4
|
+
readonly url: string;
|
|
5
|
+
/** Defaults to anonymous access so public resolution cannot inherit server credentials. */
|
|
6
|
+
readonly authentication?: GitHubRepositoryAuthentication;
|
|
7
|
+
readonly signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=GitHubRepositoryRevisionResolutionOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubRepositoryRevisionResolutionOptions.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/definitions/GitHubRepositoryRevisionResolutionOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AAE5F,+EAA+E;AAC/E,MAAM,WAAW,yCAAyC;IACxD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,QAAQ,CAAC,cAAc,CAAC,EAAE,8BAA8B,CAAC;IACzD,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubRepositoryRevisionResolutionOptions.js","sourceRoot":"","sources":["../../../../src/providers/github/definitions/GitHubRepositoryRevisionResolutionOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** A verified GitHub repository identity and the immutable revision selected from its URL. */
|
|
2
|
+
export interface GitHubRepositoryRevisionResolutionResult {
|
|
3
|
+
readonly repository: {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly owner: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly url: string;
|
|
8
|
+
readonly defaultBranch: string;
|
|
9
|
+
};
|
|
10
|
+
readonly revision: {
|
|
11
|
+
readonly commitSha: string;
|
|
12
|
+
readonly ref: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=GitHubRepositoryRevisionResolutionResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubRepositoryRevisionResolutionResult.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/definitions/GitHubRepositoryRevisionResolutionResult.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,WAAW,wCAAwC;IACvD,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;KAChC,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;KACtB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubRepositoryRevisionResolutionResult.js","sourceRoot":"","sources":["../../../../src/providers/github/definitions/GitHubRepositoryRevisionResolutionResult.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface GitHubRepositoryOwner {
|
|
2
|
+
readonly login: string;
|
|
3
|
+
readonly type: 'organization' | 'user';
|
|
4
|
+
readonly url: string;
|
|
5
|
+
}
|
|
6
|
+
export interface GitHubDiscoveredRepository {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly owner: string;
|
|
10
|
+
readonly url: string;
|
|
11
|
+
readonly visibility: 'private' | 'public';
|
|
12
|
+
}
|
|
13
|
+
/** Read-only provider boundary for GitHub owner resolution and repository discovery. */
|
|
14
|
+
export interface GitHubRepositoryDiscoveryGateway {
|
|
15
|
+
resolveOwnerAsync(owner: string, signal?: AbortSignal): Promise<GitHubRepositoryOwner>;
|
|
16
|
+
listOwnerRepositoriesAsync(owner: GitHubRepositoryOwner, signal?: AbortSignal): Promise<readonly GitHubDiscoveredRepository[]>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=GitHubRepositoryDiscoveryGateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubRepositoryDiscoveryGateway.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/ports/GitHubRepositoryDiscoveryGateway.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAAC;IACvC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC3C;AAED,wFAAwF;AACxF,MAAM,WAAW,gCAAgC;IAC/C,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACvF,0BAA0B,CACxB,KAAK,EAAE,qBAAqB,EAC5B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,SAAS,0BAA0B,EAAE,CAAC,CAAC;CACnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubRepositoryDiscoveryGateway.js","sourceRoot":"","sources":["../../../../src/providers/github/ports/GitHubRepositoryDiscoveryGateway.ts"],"names":[],"mappings":""}
|
|
@@ -4,6 +4,9 @@ export interface GitHubRepositoryReadTarget {
|
|
|
4
4
|
readonly url: string;
|
|
5
5
|
}
|
|
6
6
|
export interface GitHubRepositoryReadMetadata {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly owner: string;
|
|
9
|
+
readonly name: string;
|
|
7
10
|
readonly defaultBranch: string;
|
|
8
11
|
readonly url: string;
|
|
9
12
|
}
|
|
@@ -23,9 +26,9 @@ export interface GitHubRepositoryTree {
|
|
|
23
26
|
readonly truncated: boolean;
|
|
24
27
|
}
|
|
25
28
|
export interface GitHubRepositoryReadGateway {
|
|
26
|
-
inspectRepositoryAsync(target: GitHubRepositoryReadTarget): Promise<GitHubRepositoryReadMetadata>;
|
|
27
|
-
resolveRevisionAsync(target: GitHubRepositoryReadTarget, ref: string): Promise<GitHubRepositoryRevision>;
|
|
28
|
-
readTreeAsync(target: GitHubRepositoryReadTarget, treeSha: string): Promise<GitHubRepositoryTree>;
|
|
29
|
-
readFileAsync(target: GitHubRepositoryReadTarget, revision: string, path: string): Promise<Uint8Array>;
|
|
29
|
+
inspectRepositoryAsync(target: GitHubRepositoryReadTarget, signal?: AbortSignal): Promise<GitHubRepositoryReadMetadata>;
|
|
30
|
+
resolveRevisionAsync(target: GitHubRepositoryReadTarget, ref: string, signal?: AbortSignal): Promise<GitHubRepositoryRevision>;
|
|
31
|
+
readTreeAsync(target: GitHubRepositoryReadTarget, treeSha: string, signal?: AbortSignal): Promise<GitHubRepositoryTree>;
|
|
32
|
+
readFileAsync(target: GitHubRepositoryReadTarget, revision: string, path: string, signal?: AbortSignal): Promise<Uint8Array>;
|
|
30
33
|
}
|
|
31
34
|
//# sourceMappingURL=GitHubRepositoryReadGateway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubRepositoryReadGateway.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/ports/GitHubRepositoryReadGateway.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CA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I,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;CAC3C;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACvD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,2BAA2B;IAC1C,sBAAsB,CACpB,MAAM,EAAE,0BAA0B,EAClC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACzC,oBAAoB,CAClB,MAAM,EAAE,0BAA0B,EAClC,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACrC,aAAa,CACX,MAAM,EAAE,0BAA0B,EAClC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,aAAa,CACX,MAAM,EAAE,0BAA0B,EAClC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAAC;CACxB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { GitHubRepositoryDiscoveryOptions } from '../definitions/GitHubRepositoryDiscoveryOptions.js';
|
|
2
|
+
import type { GitHubRepositoryDiscoveryResult } from '../definitions/GitHubRepositoryDiscoveryResult.js';
|
|
3
|
+
/** Discover accessible repositories through the canonical anonymous-capable GitHub HTTPS adapter. */
|
|
4
|
+
export declare function discoverGitHubRepositoriesAsync(options: GitHubRepositoryDiscoveryOptions): Promise<GitHubRepositoryDiscoveryResult>;
|
|
5
|
+
//# sourceMappingURL=discoverGitHubRepositoriesAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverGitHubRepositoriesAsync.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/services/discoverGitHubRepositoriesAsync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,oDAAoD,CAAC;AAC3G,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AAGzG,qGAAqG;AACrG,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,gCAAgC,GACxC,OAAO,CAAC,+BAA+B,CAAC,CAO1C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createGitHubHttpRepositoryReadGateway } from '../adapters/createGitHubHttpRepositoryReadGateway.js';
|
|
2
|
+
import { discoverGitHubRepositoriesWithGatewayAsync } from './discoverGitHubRepositoriesWithGatewayAsync.js';
|
|
3
|
+
/** Discover accessible repositories through the canonical anonymous-capable GitHub HTTPS adapter. */
|
|
4
|
+
export function discoverGitHubRepositoriesAsync(options) {
|
|
5
|
+
return discoverGitHubRepositoriesWithGatewayAsync(options, createGitHubHttpRepositoryReadGateway(fetch, {
|
|
6
|
+
authentication: options.authentication ?? 'anonymous',
|
|
7
|
+
}));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=discoverGitHubRepositoriesAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverGitHubRepositoriesAsync.js","sourceRoot":"","sources":["../../../../src/providers/github/services/discoverGitHubRepositoriesAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,sDAAsD,CAAC;AAG7G,OAAO,EAAE,0CAA0C,EAAE,MAAM,iDAAiD,CAAC;AAE7G,qGAAqG;AACrG,MAAM,UAAU,+BAA+B,CAC7C,OAAyC;IAEzC,OAAO,0CAA0C,CAC/C,OAAO,EACP,qCAAqC,CAAC,KAAK,EAAE;QAC3C,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,WAAW;KACtD,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GitHubRepositoryDiscoveryOptions } from '../definitions/GitHubRepositoryDiscoveryOptions.js';
|
|
2
|
+
import { type GitHubRepositoryDiscoveryResult } from '../definitions/GitHubRepositoryDiscoveryResult.js';
|
|
3
|
+
import type { GitHubRepositoryDiscoveryGateway } from '../ports/GitHubRepositoryDiscoveryGateway.js';
|
|
4
|
+
/** Discover every accessible repository for a normalized GitHub owner source. */
|
|
5
|
+
export declare function discoverGitHubRepositoriesWithGatewayAsync(options: GitHubRepositoryDiscoveryOptions, gateway: GitHubRepositoryDiscoveryGateway): Promise<GitHubRepositoryDiscoveryResult>;
|
|
6
|
+
//# sourceMappingURL=discoverGitHubRepositoriesWithGatewayAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverGitHubRepositoriesWithGatewayAsync.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,oDAAoD,CAAC;AAC3G,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAOrG,iFAAiF;AACjF,wBAAsB,0CAA0C,CAC9D,OAAO,EAAE,gCAAgC,EACzC,OAAO,EAAE,gCAAgC,GACxC,OAAO,CAAC,+BAA+B,CAAC,CAc1C"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { GitHubRepositoryDiscoveryError, } from '../definitions/GitHubRepositoryDiscoveryResult.js';
|
|
2
|
+
/** Discover every accessible repository for a normalized GitHub owner source. */
|
|
3
|
+
export async function discoverGitHubRepositoriesWithGatewayAsync(options, gateway) {
|
|
4
|
+
const source = parseGitHubSource(options.source);
|
|
5
|
+
throwIfAborted(options.signal);
|
|
6
|
+
const owner = await gateway.resolveOwnerAsync(source.owner, options.signal);
|
|
7
|
+
const repositories = [...(await gateway.listOwnerRepositoriesAsync(owner, options.signal))].sort(compareRepositories);
|
|
8
|
+
const selectedRepository = source.selectedRepositoryName
|
|
9
|
+
? repositories.find((repository) => repository.name.toLowerCase() === source.selectedRepositoryName?.toLowerCase())
|
|
10
|
+
: undefined;
|
|
11
|
+
return { owner, repositories, ...(selectedRepository ? { selectedRepository } : {}) };
|
|
12
|
+
}
|
|
13
|
+
/** Preserve a deterministic canonical owner/name ordering across gateway implementations. */
|
|
14
|
+
function compareRepositories(left, right) {
|
|
15
|
+
const leftIdentity = `${left.owner.toLowerCase()}/${left.name.toLowerCase()}`;
|
|
16
|
+
const rightIdentity = `${right.owner.toLowerCase()}/${right.name.toLowerCase()}`;
|
|
17
|
+
return leftIdentity < rightIdentity ? -1 : leftIdentity > rightIdentity ? 1 : 0;
|
|
18
|
+
}
|
|
19
|
+
/** Parse supported owner and repository source forms without accepting arbitrary GitHub pages. */
|
|
20
|
+
function parseGitHubSource(value) {
|
|
21
|
+
const trimmed = value.trim();
|
|
22
|
+
if (trimmed === '')
|
|
23
|
+
throw invalidSource();
|
|
24
|
+
if (isOwnerTokenSource(trimmed))
|
|
25
|
+
return { owner: normalizeOwner(trimmed) };
|
|
26
|
+
return parseGitHubUrlSource(trimmed);
|
|
27
|
+
}
|
|
28
|
+
/** Identify a bare owner form before interpreting the remaining input as a URL. */
|
|
29
|
+
function isOwnerTokenSource(value) {
|
|
30
|
+
return !value.includes('/') && !value.includes(':');
|
|
31
|
+
}
|
|
32
|
+
/** Parse supported GitHub owner and repository URLs without accepting arbitrary GitHub pages. */
|
|
33
|
+
function parseGitHubUrlSource(value) {
|
|
34
|
+
const url = parseSourceUrl(value);
|
|
35
|
+
if (url.protocol !== 'https:' || url.hostname.toLowerCase() !== 'github.com')
|
|
36
|
+
throw invalidSource();
|
|
37
|
+
if (url.username !== '' || url.password !== '' || url.search !== '' || url.hash !== '')
|
|
38
|
+
throw invalidSource();
|
|
39
|
+
const segments = url.pathname.split('/').filter(Boolean).map(decodeSegment);
|
|
40
|
+
if (segments.length < 1 || segments.length > 2)
|
|
41
|
+
throw invalidSource();
|
|
42
|
+
const [owner = '', repository = undefined] = segments;
|
|
43
|
+
const normalizedOwner = normalizeOwner(owner);
|
|
44
|
+
const selectedRepositoryName = repository === undefined ? undefined : normalizeRepositoryName(repository);
|
|
45
|
+
return { owner: normalizedOwner, ...(selectedRepositoryName ? { selectedRepositoryName } : {}) };
|
|
46
|
+
}
|
|
47
|
+
/** Parse a scheme-less GitHub host form as HTTPS while retaining strict URL validation. */
|
|
48
|
+
function parseSourceUrl(value) {
|
|
49
|
+
try {
|
|
50
|
+
return new URL(value.startsWith('github.com/') ? `https://${value}` : value);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
throw new GitHubRepositoryDiscoveryError('invalid-source', 'GitHub source is invalid.');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Validate an owner token accepted by GitHub's owner routes. */
|
|
57
|
+
function normalizeOwner(value) {
|
|
58
|
+
const normalized = value.startsWith('@') ? value.slice(1) : value;
|
|
59
|
+
if (!/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38}[A-Za-z0-9])?$/u.test(normalized)) {
|
|
60
|
+
throw invalidSource();
|
|
61
|
+
}
|
|
62
|
+
return normalized;
|
|
63
|
+
}
|
|
64
|
+
/** Validate a repository segment while retaining GitHub's case-insensitive identity. */
|
|
65
|
+
function normalizeRepositoryName(value) {
|
|
66
|
+
const normalized = value.endsWith('.git') ? value.slice(0, -4) : value;
|
|
67
|
+
if (!/^[A-Za-z0-9._-]{1,100}$/u.test(normalized) || normalized === '.' || normalized === '..') {
|
|
68
|
+
throw invalidSource();
|
|
69
|
+
}
|
|
70
|
+
return normalized;
|
|
71
|
+
}
|
|
72
|
+
/** Decode one path segment and surface malformed encodings as an invalid source. */
|
|
73
|
+
function decodeSegment(value) {
|
|
74
|
+
try {
|
|
75
|
+
return decodeURIComponent(value);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
throw invalidSource();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** Construct the stable caller-facing invalid-source error. */
|
|
82
|
+
function invalidSource() {
|
|
83
|
+
return new GitHubRepositoryDiscoveryError('invalid-source', 'GitHub source must be an owner, github.com owner URL, or GitHub repository URL.');
|
|
84
|
+
}
|
|
85
|
+
/** Stop before starting an adapter request when cancellation has already been requested. */
|
|
86
|
+
function throwIfAborted(signal) {
|
|
87
|
+
if (signal?.aborted) {
|
|
88
|
+
throw new GitHubRepositoryDiscoveryError('cancelled', 'GitHub repository discovery was cancelled.');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=discoverGitHubRepositoriesWithGatewayAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverGitHubRepositoriesWithGatewayAsync.js","sourceRoot":"","sources":["../../../../src/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.ts"],"names":[],"mappings":"AACA,OAAO,EACL,8BAA8B,GAE/B,MAAM,mDAAmD,CAAC;AAQ3D,iFAAiF;AACjF,MAAM,CAAC,KAAK,UAAU,0CAA0C,CAC9D,OAAyC,EACzC,OAAyC;IAEzC,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5E,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,0BAA0B,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,I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;AACH,CAAC;AAED,+DAA+D;AAC/D,SAAS,aAAa;IACpB,OAAO,IAAI,8BAA8B,CACvC,gBAAgB,EAChB,iFAAiF,CAClF,CAAC;AACJ,CAAC;AAED,4FAA4F;AAC5F,SAAS,cAAc,CAAC,MAA+B;IACrD,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,8BAA8B,CACtC,WAAW,EACX,4CAA4C,CAC7C,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.test.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverGitHubRepositoriesWithGatewayAsync.test.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/services/discoverGitHubRepositoriesWithGatewayAsync.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
import { discoverGitHubRepositoriesWithGatewayAsync } from './discoverGitHubRepositoriesWithGatewayAsync.js';
|
|
3
|
+
test.each(['ankhorage', '@ankhorage', 'github.com/ankhorage', 'https://github.com/ankhorage'])('normalizes the GitHub owner source %s', async (source) => {
|
|
4
|
+
const requests = [];
|
|
5
|
+
const result = await discoverGitHubRepositoriesWithGatewayAsync({ source }, createGateway(requests));
|
|
6
|
+
expect(requests).toEqual(['ankhorage']);
|
|
7
|
+
expect(result.owner).toEqual({
|
|
8
|
+
login: 'Ankhorage',
|
|
9
|
+
type: 'organization',
|
|
10
|
+
url: 'https://github.com/Ankhorage',
|
|
11
|
+
});
|
|
12
|
+
expect(result.repositories.map((repository) => repository.name)).toEqual(['atlas', 'zora']);
|
|
13
|
+
});
|
|
14
|
+
test('preselects a repository URL without narrowing the owner repository list', async () => {
|
|
15
|
+
const result = await discoverGitHubRepositoriesWithGatewayAsync({ source: 'https://github.com/ankhorage/zora' }, createGateway([]));
|
|
16
|
+
expect(result.selectedRepository?.name).toBe('zora');
|
|
17
|
+
expect(result.repositories).toHaveLength(2);
|
|
18
|
+
});
|
|
19
|
+
test('rejects malformed and cancelled discovery before an adapter request', () => {
|
|
20
|
+
const requests = [];
|
|
21
|
+
const controller = new AbortController();
|
|
22
|
+
controller.abort();
|
|
23
|
+
expect(discoverGitHubRepositoriesWithGatewayAsync({ source: 'https://example.com/ankhorage' }, createGateway(requests))).rejects.toMatchObject({ code: 'invalid-source' });
|
|
24
|
+
expect(discoverGitHubRepositoriesWithGatewayAsync({ source: 'ankhorage', signal: controller.signal }, createGateway(requests))).rejects.toMatchObject({ code: 'cancelled' });
|
|
25
|
+
expect(requests).toEqual([]);
|
|
26
|
+
});
|
|
27
|
+
function createGateway(requests) {
|
|
28
|
+
return {
|
|
29
|
+
resolveOwnerAsync: (owner) => {
|
|
30
|
+
requests.push(owner);
|
|
31
|
+
return Promise.resolve({
|
|
32
|
+
login: 'Ankhorage',
|
|
33
|
+
type: 'organization',
|
|
34
|
+
url: 'https://github.com/Ankhorage',
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
listOwnerRepositoriesAsync: () => Promise.resolve([
|
|
38
|
+
{
|
|
39
|
+
id: '2',
|
|
40
|
+
name: 'zora',
|
|
41
|
+
owner: 'Ankhorage',
|
|
42
|
+
url: 'https://github.com/Ankhorage/zora',
|
|
43
|
+
visibility: 'public',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: '1',
|
|
47
|
+
name: 'atlas',
|
|
48
|
+
owner: 'Ankhorage',
|
|
49
|
+
url: 'https://github.com/Ankhorage/atlas',
|
|
50
|
+
visibility: 'public',
|
|
51
|
+
},
|
|
52
|
+
]),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=discoverGitHubRepositoriesWithGatewayAsync.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverGitHubRepositoriesWithGatewayAsync.test.js","sourceRoot":"","sources":["../../../../src/providers/github/services/discover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W;gBAClB,GAAG,EAAE,oCAAoC;gBACzC,UAAU,EAAE,QAAQ;aACrB;SACF,CAAC;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"materializeGitHubRepositoryWithGatewayAsync.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,0DAA0D,CAAC;AACvH,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,yDAAyD,CAAC;AACrH,OAAO,KAAK,EACV,2BAA2B,
|
|
1
|
+
{"version":3,"file":"materializeGitHubRepositoryWithGatewayAsync.d.ts","sourceRoot":"","sources":["../../../../src/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,0DAA0D,CAAC;AACvH,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,yDAAyD,CAAC;AACrH,OAAO,KAAK,EACV,2BAA2B,EAG5B,MAAM,yCAAyC,CAAC;AAIjD,mGAAmG;AACnG,wBAAsB,2CAA2C,CAC/D,OAAO,EAAE,sCAAsC,EAC/C,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,qCAAqC,CAAC,CAgDhD"}
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import { chmod, mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
3
|
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
4
|
+
import { parseGitHubRepositoryUrl } from './parseGitHubRepositoryUrl.js';
|
|
5
|
+
import { resolveGitHubUrlRevisionAsync } from './resolveGitHubUrlRevisionAsync.js';
|
|
4
6
|
/*** Materialize a GitHub repository through an injected read gateway for deterministic testing. */
|
|
5
7
|
export async function materializeGitHubRepositoryWithGatewayAsync(options, gateway) {
|
|
6
8
|
const parsed = parseGitHubRepositoryUrl(options.url);
|
|
7
|
-
const repository = await gateway.inspectRepositoryAsync(parsed.target);
|
|
9
|
+
const repository = await gateway.inspectRepositoryAsync(parsed.target, options.signal);
|
|
10
|
+
const target = { owner: repository.owner, name: repository.name, url: repository.url };
|
|
8
11
|
const explicitRef = normalizeRef(options.ref);
|
|
9
12
|
const revision = explicitRef === undefined
|
|
10
|
-
? await
|
|
11
|
-
:
|
|
12
|
-
|
|
13
|
+
? await resolveGitHubUrlRevisionAsync(gateway, parsed, target, repository.defaultBranch, options.signal)
|
|
14
|
+
: {
|
|
15
|
+
...(await gateway.resolveRevisionAsync(target, explicitRef, options.signal)),
|
|
16
|
+
ref: explicitRef,
|
|
17
|
+
};
|
|
18
|
+
const tree = await gateway.readTreeAsync(target, revision.treeSha, options.signal);
|
|
13
19
|
const validated = validateTree(tree.entries, tree.truncated);
|
|
14
20
|
const rootPath = await createMaterializationRootAsync(options.destinationPath);
|
|
15
21
|
try {
|
|
16
|
-
await writeFileBatchesAsync(gateway,
|
|
22
|
+
await writeFileBatchesAsync(gateway, target, revision.commitSha, rootPath, validated.files, options.signal);
|
|
17
23
|
}
|
|
18
24
|
catch (error) {
|
|
19
25
|
await rm(rootPath, { force: true, recursive: true });
|
|
@@ -24,8 +30,8 @@ export async function materializeGitHubRepositoryWithGatewayAsync(options, gatew
|
|
|
24
30
|
revision: revision.commitSha,
|
|
25
31
|
diagnostics: validated.diagnostics,
|
|
26
32
|
repository: {
|
|
27
|
-
owner:
|
|
28
|
-
name:
|
|
33
|
+
owner: repository.owner,
|
|
34
|
+
name: repository.name,
|
|
29
35
|
url: repository.url,
|
|
30
36
|
defaultBranch: repository.defaultBranch,
|
|
31
37
|
},
|
|
@@ -35,105 +41,6 @@ export async function materializeGitHubRepositoryWithGatewayAsync(options, gatew
|
|
|
35
41
|
const MAX_FILE_COUNT = 20_000;
|
|
36
42
|
const MAX_TOTAL_BYTES = 256 * 1024 * 1024;
|
|
37
43
|
const WRITE_BATCH_SIZE = 8;
|
|
38
|
-
/*** Parse a normal GitHub repository, tree, blob, or commit URL into repository and ref intent. */
|
|
39
|
-
function parseGitHubRepositoryUrl(value) {
|
|
40
|
-
const url = parseRepositoryUrl(value);
|
|
41
|
-
assertGitHubRepositoryUrl(url);
|
|
42
|
-
const segments = decodePathSegments(url);
|
|
43
|
-
if (segments.length < 2) {
|
|
44
|
-
throw invalidRepositoryUrl();
|
|
45
|
-
}
|
|
46
|
-
const [owner = '', repositorySegment = '', route] = segments;
|
|
47
|
-
const name = repositorySegment.endsWith('.git')
|
|
48
|
-
? repositorySegment.slice(0, -4)
|
|
49
|
-
: repositorySegment;
|
|
50
|
-
assertRepositoryIdentity(owner, name);
|
|
51
|
-
const routeSegments = segments.slice(3);
|
|
52
|
-
if (route === undefined) {
|
|
53
|
-
return {
|
|
54
|
-
target: { owner, name, url: `https://github.com/${owner}/${name}` },
|
|
55
|
-
refCandidates: [],
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
if (route === 'commit') {
|
|
59
|
-
if (routeSegments.length !== 1)
|
|
60
|
-
throw invalidRepositoryUrl();
|
|
61
|
-
return {
|
|
62
|
-
target: { owner, name, url: `https://github.com/${owner}/${name}` },
|
|
63
|
-
refCandidates: [routeSegments[0] ?? ''],
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
if (route !== 'tree' && route !== 'blob')
|
|
67
|
-
throw invalidRepositoryUrl();
|
|
68
|
-
if (routeSegments.length === 0)
|
|
69
|
-
throw invalidRepositoryUrl();
|
|
70
|
-
return {
|
|
71
|
-
target: { owner, name, url: `https://github.com/${owner}/${name}` },
|
|
72
|
-
refCandidates: createRefCandidates(routeSegments),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
/*** Parse a repository URL while preserving the original parsing failure as the cause. */
|
|
76
|
-
function parseRepositoryUrl(value) {
|
|
77
|
-
try {
|
|
78
|
-
return new URL(value);
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
throw new Error('Repository URL must be a valid GitHub HTTPS URL.', { cause: error });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/*** Reject non-GitHub origins and embedded credentials while ignoring normal page query/anchor state. */
|
|
85
|
-
function assertGitHubRepositoryUrl(url) {
|
|
86
|
-
if (url.protocol !== 'https:' ||
|
|
87
|
-
url.hostname.toLowerCase() !== 'github.com' ||
|
|
88
|
-
url.username !== '' ||
|
|
89
|
-
url.password !== '') {
|
|
90
|
-
throw invalidRepositoryUrl();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/*** Decode normal GitHub path segments and reject malformed encoded paths. */
|
|
94
|
-
function decodePathSegments(url) {
|
|
95
|
-
try {
|
|
96
|
-
return url.pathname
|
|
97
|
-
.split('/')
|
|
98
|
-
.filter(Boolean)
|
|
99
|
-
.map((segment) => decodeURIComponent(segment));
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
throw new Error('Repository URL contains an invalid encoded path.', { cause: error });
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/*** Build longest-first ref candidates so slash-containing branch/tag names resolve like GitHub URLs. */
|
|
106
|
-
function createRefCandidates(segments) {
|
|
107
|
-
return Array.from({ length: segments.length }, (_, index) => segments.slice(0, segments.length - index).join('/'));
|
|
108
|
-
}
|
|
109
|
-
/*** Resolve URL-derived ref candidates, falling back to the repository default branch. */
|
|
110
|
-
async function resolveUrlRevisionAsync(gateway, parsed, defaultBranch) {
|
|
111
|
-
if (parsed.refCandidates.length === 0) {
|
|
112
|
-
return gateway.resolveRevisionAsync(parsed.target, defaultBranch);
|
|
113
|
-
}
|
|
114
|
-
for (const candidate of parsed.refCandidates) {
|
|
115
|
-
try {
|
|
116
|
-
return await gateway.resolveRevisionAsync(parsed.target, candidate);
|
|
117
|
-
}
|
|
118
|
-
catch {
|
|
119
|
-
// GitHub tree/blob URLs can contain both slash-containing refs and trailing repository paths.
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
throw new Error('GitHub repository URL does not resolve to a branch, tag, or commit.');
|
|
123
|
-
}
|
|
124
|
-
/*** Create the consistent public error for unsupported GitHub URL shapes. */
|
|
125
|
-
function invalidRepositoryUrl() {
|
|
126
|
-
return new Error('Repository URL must be a GitHub repository, tree, blob, or commit HTTPS URL.');
|
|
127
|
-
}
|
|
128
|
-
/*** Validate canonical GitHub owner and repository path segments. */
|
|
129
|
-
function assertRepositoryIdentity(owner, name) {
|
|
130
|
-
if (!/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,98}[A-Za-z0-9])?$/u.test(owner)) {
|
|
131
|
-
throw new Error('GitHub repository owner is invalid.');
|
|
132
|
-
}
|
|
133
|
-
if (!/^[A-Za-z0-9._-]{1,100}$/u.test(name) || name === '.' || name === '..') {
|
|
134
|
-
throw new Error('GitHub repository name is invalid.');
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
44
|
/*** Normalize an optional requested ref while rejecting an explicitly empty value. */
|
|
138
45
|
function normalizeRef(value) {
|
|
139
46
|
if (value === undefined)
|
|
@@ -183,16 +90,16 @@ async function createMaterializationRootAsync(destinationPath) {
|
|
|
183
90
|
return rootPath;
|
|
184
91
|
}
|
|
185
92
|
/*** Download and write bounded groups so large repositories do not fan out unbounded requests. */
|
|
186
|
-
async function writeFileBatchesAsync(gateway, target, revision, rootPath, entries) {
|
|
93
|
+
async function writeFileBatchesAsync(gateway, target, revision, rootPath, entries, signal) {
|
|
187
94
|
const batches = Array.from({ length: Math.ceil(entries.length / WRITE_BATCH_SIZE) }, (_, index) => entries.slice(index * WRITE_BATCH_SIZE, (index + 1) * WRITE_BATCH_SIZE));
|
|
188
95
|
for (const batch of batches) {
|
|
189
|
-
await Promise.all(batch.map((entry) => materializeFileAsync(gateway, target, revision, rootPath, entry)));
|
|
96
|
+
await Promise.all(batch.map((entry) => materializeFileAsync(gateway, target, revision, rootPath, entry, signal)));
|
|
190
97
|
}
|
|
191
98
|
}
|
|
192
99
|
/*** Materialize one ordinary Git blob beneath the isolated root and preserve executable mode. */
|
|
193
|
-
async function materializeFileAsync(gateway, target, revision, rootPath, entry) {
|
|
100
|
+
async function materializeFileAsync(gateway, target, revision, rootPath, entry, signal) {
|
|
194
101
|
const destination = resolveMaterializationPath(rootPath, entry.path);
|
|
195
|
-
const content = await gateway.readFileAsync(target, revision, entry.path);
|
|
102
|
+
const content = await gateway.readFileAsync(target, revision, entry.path, signal);
|
|
196
103
|
if (entry.size !== content.byteLength) {
|
|
197
104
|
throw new Error(`GitHub repository file size changed while reading ${entry.path}.`);
|
|
198
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"materializeGitHubRepositoryWithGatewayAsync.js","sourceRoot":"","sources":["../../../../src/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"materializeGitHubRepositoryWithGatewayAsync.js","sourceRoot":"","sources":["../../../../src/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAS9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,O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