repo-sdk 0.0.0 → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Robin Genz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1 +1,92 @@
1
1
  # repo-sdk
2
+
3
+ [![npm version](https://img.shields.io/npm/v/repo-sdk)](https://www.npmjs.com/package/repo-sdk)
4
+ [![npm downloads](https://img.shields.io/npm/dm/repo-sdk)](https://www.npmjs.com/package/repo-sdk)
5
+ [![license](https://img.shields.io/npm/l/repo-sdk)](https://github.com/capawesome-team/repo-sdk/blob/main/LICENSE)
6
+
7
+ A unified, normalized, zero-dependency, edge-compatible TypeScript SDK over GitHub, GitLab, Bitbucket Cloud, Azure DevOps, and Gitea — plus generic git smart-HTTP remotes. Write your discovery, commit, tag, download, and webhook logic once against one normalized API — built on raw `fetch` and Web Crypto, so it runs on Node, Cloudflare Workers, and other Web-standard runtimes.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install repo-sdk
13
+ ```
14
+
15
+ ## Quickstart
16
+
17
+ ```ts
18
+ import { createClient } from 'repo-sdk';
19
+ import { github } from 'repo-sdk/github';
20
+
21
+ const client = createClient({
22
+ provider: github({ auth: { token: process.env.GITHUB_TOKEN! } }),
23
+ });
24
+
25
+ // Resolve a ref (branch, tag, or SHA) to a single commit.
26
+ const head = await client.commits.get({ repo: 'capawesome-team/repo-sdk', ref: 'main' });
27
+ console.log(head.sha, head.message);
28
+
29
+ // List commits on a branch.
30
+ const { data: commits } = await client.commits.list({
31
+ repo: 'capawesome-team/repo-sdk',
32
+ ref: 'main',
33
+ limit: 20,
34
+ });
35
+ ```
36
+
37
+ Switching providers means swapping the `provider` — the rest of your code stays the same.
38
+
39
+ ## Documentation
40
+
41
+ Full documentation lives at **[repo-sdk.dev](https://repo-sdk.dev)** ([docs](https://repo-sdk.dev/docs)):
42
+
43
+ - [Quickstart](https://repo-sdk.dev/docs/quickstart)
44
+ - [Authentication](https://repo-sdk.dev/docs/authentication)
45
+ - [Guides](https://repo-sdk.dev/docs/guides)
46
+ - [API Reference](https://repo-sdk.dev/docs/reference)
47
+
48
+ ## Providers
49
+
50
+ | Provider | Import | Notes |
51
+ | ------------ | ----------------------- | ---------------------------------------------------------------- |
52
+ | GitHub | `repo-sdk/github` | Token and GitHub App auth |
53
+ | GitLab | `repo-sdk/gitlab` | PAT, group/project, or OAuth token |
54
+ | Bitbucket | `repo-sdk/bitbucket` | Bitbucket Cloud |
55
+ | Azure DevOps | `repo-sdk/azure-devops` | PAT or Entra ID |
56
+ | Gitea | `repo-sdk/gitea` | Gitea ≥ 1.20 and Forgejo |
57
+ | Generic git | `repo-sdk/git-http` | Any git smart-HTTP remote (read-only ref discovery + clone URLs) |
58
+
59
+ Self-hosted deployments — GitHub Enterprise Server, GitLab self-managed, Azure DevOps Server, and Gitea/Forgejo instances — are supported via `baseUrl`.
60
+
61
+ ## Development
62
+
63
+ **Prerequisites:** Node >= 20.
64
+
65
+ ```bash
66
+ npm install
67
+ ```
68
+
69
+ | Script | Description |
70
+ | -------------------- | --------------------------------------------------------------- |
71
+ | `npm run build` | Build with tsdown |
72
+ | `npm test` | Run the unit + contract test suite |
73
+ | `npm run test:watch` | Run tests in watch mode |
74
+ | `npm run test:live` | Gated live provider tests (env vars documented in CONTRIBUTING) |
75
+ | `npm run typecheck` | Type-check without emitting |
76
+ | `npm run lint` | Lint the codebase |
77
+ | `npm run format` | Format with prettier |
78
+
79
+ Docs site:
80
+
81
+ - `npm run docs:dev` — run the docs dev server
82
+ - `npm run docs:build` — build the static site to `.blume-dist/`
83
+
84
+ Releases are automated with [release-please](https://github.com/googleapis/release-please), driven by [Conventional Commits](https://www.conventionalcommits.org/). While pre-`1.0.0`, breaking changes bump the minor version and features bump the patch version. Merging the release pull request publishes to npm. See [CONTRIBUTING.md](./CONTRIBUTING.md) for details.
85
+
86
+ ## About
87
+
88
+ repo-sdk is developed and maintained by [Genz IT Solutions GmbH](http://genz-its.de/). It powers [Capawesome](https://capawesome.io/), a cloud platform for mobile apps.
89
+
90
+ ## License
91
+
92
+ [MIT](./LICENSE)
@@ -0,0 +1,72 @@
1
+ import { O as ParsedWebhookEvent, P as RepoProvider, v as IncomingWebhookRequest, z as TokenProvider } from "./types-CTeiAxMy.js";
2
+ import { t as VerifyWebhookParams$1 } from "./verify-p6JsExms.js";
3
+ //#region src/providers/azure-devops/auth.d.ts
4
+ /**
5
+ * Azure DevOps supports three credential shapes: a Personal Access Token
6
+ * (encoded into HTTP Basic auth internally), an OAuth access token (sent as a
7
+ * bearer token), or a pluggable Entra ID `tokenProvider` that mints short-lived
8
+ * bearer tokens (re-invoked with `forceRefresh` after a 401, then retried
9
+ * once). Callers pass whichever they have.
10
+ */
11
+ type AzureDevOpsAuth = {
12
+ pat: string;
13
+ } | {
14
+ accessToken: string;
15
+ } | {
16
+ tokenProvider: TokenProvider;
17
+ };
18
+ //#endregion
19
+ //#region src/providers/azure-devops/index.d.ts
20
+ interface AzureDevOpsProviderOptions {
21
+ organization: string;
22
+ auth: AzureDevOpsAuth;
23
+ baseUrl?: string;
24
+ fetch?: typeof fetch;
25
+ /**
26
+ * When set, webhooks are registered to deliver the secret verbatim in this
27
+ * custom HTTP header (via the service hook's `httpHeaders` consumer input)
28
+ * instead of HTTP Basic auth. Pass the same header name to `verifyWebhook`.
29
+ */
30
+ webhookSecretHeader?: string;
31
+ }
32
+ /**
33
+ * Builds the human-facing web URL for a commit from the repository's web URL
34
+ * (`Repository.urls.web`) and a commit SHA — no API request needed.
35
+ */
36
+ declare const commitWebUrl: (repoWebUrl: string, sha: string) => string;
37
+ declare function azureDevOps(options: AzureDevOpsProviderOptions): RepoProvider;
38
+ //#endregion
39
+ //#region src/providers/azure-devops/webhooks.d.ts
40
+ /**
41
+ * Azure-only extension: `header` names the custom HTTP header carrying the secret
42
+ * for hooks registered with the provider's `webhookSecretHeader` option.
43
+ */
44
+ type VerifyWebhookParams = VerifyWebhookParams$1 & {
45
+ header?: string;
46
+ };
47
+ /**
48
+ * Azure DevOps service hooks carry no HMAC signature. By default the SDK
49
+ * registers hooks with HTTP Basic auth (username `repo-sdk`, password = secret),
50
+ * so verification is a constant-time comparison of the incoming `Authorization`
51
+ * header. For hooks registered with a `webhookSecretHeader`, pass the same
52
+ * header name as `header` and the secret is compared against that header instead.
53
+ */
54
+ declare function verifyWebhook(params: VerifyWebhookParams): Promise<boolean>;
55
+ declare function parseWebhookEvent(input: Request | IncomingWebhookRequest): Promise<ParsedWebhookEvent>;
56
+ //#endregion
57
+ //#region src/providers/azure-devops/organizations.d.ts
58
+ interface Organization {
59
+ id: string;
60
+ name: string;
61
+ url: string;
62
+ }
63
+ /**
64
+ * Lists the organizations (accounts) the authenticated identity belongs to.
65
+ * Organizations live on the `app.vssps.visualstudio.com` host — outside the
66
+ * org-pinned provider — so this ships as a standalone helper.
67
+ */
68
+ declare function listOrganizations(options: AzureDevOpsAuth, init?: {
69
+ fetch?: typeof fetch;
70
+ }): Promise<Organization[]>;
71
+ //#endregion
72
+ export { type AzureDevOpsAuth, type AzureDevOpsProviderOptions, type Organization, type VerifyWebhookParams, azureDevOps, commitWebUrl, listOrganizations, parseWebhookEvent, verifyWebhook };