repo-sdk 0.3.3 → 0.3.4

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.
Files changed (2) hide show
  1. package/dist/github.js +10 -1
  2. package/package.json +1 -1
package/dist/github.js CHANGED
@@ -3,6 +3,15 @@ import { a as isRecord, c as assertSameOriginUrl, d as bytesToBase64Url, i as fi
3
3
  import { t as HttpClient } from "./http-DOXOhL_I.js";
4
4
  import { a as headShaOrUndefined, i as verifyHmacSignature, r as toIncomingWebhook } from "./verify-BBMVxz8q.js";
5
5
  //#region src/providers/github/app-auth.ts
6
+ /** GitHub repository ids are positive integers; anything else would only surface as an opaque 422. */
7
+ function toRepositoryId(value) {
8
+ const id = typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
9
+ if (typeof id !== "number" || !Number.isSafeInteger(id) || id <= 0) throw new RepoError(`Invalid GitHub repository id: ${String(value)}`, {
10
+ code: "validation",
11
+ provider: "github"
12
+ });
13
+ return id;
14
+ }
6
15
  const RSA_ALGORITHM_IDENTIFIER = [
7
16
  48,
8
17
  13,
@@ -146,7 +155,7 @@ var AppTokenSource = class {
146
155
  this.installationId = options.installationId === void 0 ? void 0 : String(options.installationId);
147
156
  this.owner = options.owner;
148
157
  this.repositories = options.repositories;
149
- this.repositoryIds = options.repositoryIds?.map(Number);
158
+ this.repositoryIds = options.repositoryIds?.map(toRepositoryId);
150
159
  }
151
160
  async getToken() {
152
161
  return (await this.resolveToken()).token;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-sdk",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Unified TypeScript SDK for git providers — GitHub, GitLab, Bitbucket, Azure DevOps, Gitea",
5
5
  "license": "MIT",
6
6
  "author": "Robin Genz <mail@robingenz.dev>",