@sourceaxis/provider-github 0.1.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/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # @sourceaxis/provider-github
2
+
3
+ GitHub provider and GitHub-first convenience helpers for SourceAxis.
4
+
5
+ ## Install
6
+
7
+ For GitHub-only alpha releases before npm publishing, install commands are shown as the intended npm
8
+ usage. Until packages are published, use the repository source/tag directly.
9
+
10
+ ```sh
11
+ pnpm add @sourceaxis/provider-github
12
+ ```
13
+
14
+ ## Quick Start
15
+
16
+ ```ts
17
+ import { createGitHubClient } from "@sourceaxis/provider-github";
18
+
19
+ const client = createGitHubClient();
20
+ const repository = await client.open("https://github.com/microsoft/TypeScript");
21
+
22
+ console.log(await repository.readText("README.md"));
23
+ ```
24
+
25
+ ## Authenticated Access
26
+
27
+ ```ts
28
+ import { createGitHubClient } from "@sourceaxis/provider-github";
29
+
30
+ const token = process.env.SOURCEAXIS_GITHUB_TOKEN;
31
+ const client = createGitHubClient(token === undefined ? {} : { token });
32
+ ```
33
+
34
+ ## Public Helpers
35
+
36
+ - `createGitHubClient(config?)` creates a SourceAxis client with the GitHub provider registered.
37
+ - `githubProvider(config?)` creates the GitHub provider for explicit registration.
38
+ - `githubTokenAuth(token, options?)` creates a GitHub-scoped token authentication strategy.
39
+ - `createGitHubProvider(config?)` is the explicit provider factory.
40
+ - `createGitHubProviderConfig(config?)` returns a provider config fragment for `sourceaxis` or
41
+ `@sourceaxis/core`.
42
+
43
+ ## Provider-Neutral Setup
44
+
45
+ Use this form when your application wants to register providers explicitly:
46
+
47
+ ```ts
48
+ import { createSourceAxisClient } from "sourceaxis";
49
+ import { createGitHubProviderConfig, githubTokenAuth } from "@sourceaxis/provider-github";
50
+
51
+ const token = process.env.SOURCEAXIS_GITHUB_TOKEN;
52
+
53
+ const client = createSourceAxisClient({
54
+ ...createGitHubProviderConfig(),
55
+ authentication: token === undefined ? undefined : githubTokenAuth(token)
56
+ });
57
+ ```
58
+
59
+ ## Capabilities
60
+
61
+ GitHub currently supports files, tree, history/commits, search, branches, tags, releases, issues,
62
+ and pull requests.
63
+
64
+ ## Package Choice
65
+
66
+ - Use `@sourceaxis/provider-github` for GitHub-first application setup.
67
+ - Use `sourceaxis` for provider-neutral apps that register providers explicitly.
68
+ - Use `@sourceaxis/testing` when certifying providers or writing provider contract tests.
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GitHubProviderVersion = exports.GitHubProviderName = exports.GitHubProviderId = void 0;
4
+ exports.GitHubProviderId = "github";
5
+ exports.GitHubProviderName = "GitHub";
6
+ exports.GitHubProviderVersion = "0.0.0";
7
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAC5B,QAAA,kBAAkB,GAAG,QAAQ,CAAC;AAC9B,QAAA,qBAAqB,GAAG,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=github-models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-models.js","sourceRoot":"","sources":["github-models.ts"],"names":[],"mappings":""}