repo-sdk 0.1.3 → 0.2.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.
@@ -1,4 +1,4 @@
1
- import { B as TokenProvider, F as RepoProvider, O as ParsedWebhookEvent, v as IncomingWebhookRequest } from "./types-DfiRluvJ.js";
1
+ import { B as TokenProvider, F as RepoProvider, O as ParsedWebhookEvent, v as IncomingWebhookRequest } from "./types-B9oMHTeP.js";
2
2
  import { t as VerifyWebhookParams$1 } from "./verify-p6JsExms.js";
3
3
  //#region src/providers/azure-devops/auth.d.ts
4
4
  /**
@@ -400,10 +400,7 @@ function azureDevOps(options) {
400
400
  if ("pat" in auth) return { url: `https://pat:${encodeURIComponent(auth.pat)}@${host}/${repoPath}` };
401
401
  if ("accessToken" in auth) return { url: `https://oauth2:${encodeURIComponent(auth.accessToken)}@${host}/${repoPath}` };
402
402
  const token = await auth.tokenProvider({ forceRefresh: false });
403
- return {
404
- url: `https://${host}/${repoPath}`,
405
- headers: { Authorization: `Bearer ${token}` }
406
- };
403
+ return { url: `https://oauth2:${encodeURIComponent(token)}@${host}/${repoPath}` };
407
404
  },
408
405
  async createWebhook(params) {
409
406
  if (!params.events.includes("push") || !params.events.includes("tag_push")) throw new RepoError("Azure DevOps delivers branch and tag pushes together via a single 'git.push' subscription and cannot filter to a subset; request both 'push' and 'tag_push'", {
@@ -1,4 +1,4 @@
1
- import { B as TokenProvider, F as RepoProvider, O as ParsedWebhookEvent, v as IncomingWebhookRequest } from "./types-DfiRluvJ.js";
1
+ import { B as TokenProvider, F as RepoProvider, O as ParsedWebhookEvent, v as IncomingWebhookRequest } from "./types-B9oMHTeP.js";
2
2
  import { t as VerifyWebhookParams } from "./verify-p6JsExms.js";
3
3
  //#region src/providers/bitbucket/index.d.ts
4
4
  interface BitbucketProviderOptions {
package/dist/bitbucket.js CHANGED
@@ -26,16 +26,6 @@ function nextCursor(body) {
26
26
  function bbqlNameQuery(text) {
27
27
  return `name ~ "${text.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}"`;
28
28
  }
29
- function toNamespace(workspace) {
30
- return {
31
- id: workspace.uuid,
32
- slug: workspace.slug,
33
- name: workspace.name,
34
- kind: "workspace",
35
- avatarUrl: workspace.links?.avatar?.href,
36
- raw: workspace
37
- };
38
- }
39
29
  function toRepository(repo) {
40
30
  const clone = repo.links?.clone ?? [];
41
31
  return {
@@ -123,6 +113,10 @@ function toWebhook(hook) {
123
113
  function mapError(status, body) {
124
114
  let message;
125
115
  if (isRecord(body) && body.type === "error" && isRecord(body.error) && typeof body.error.message === "string") message = body.error.message;
116
+ if (status === 410 || message !== void 0 && message.includes("CHANGE-2770")) return {
117
+ code: "unsupported",
118
+ message: "Bitbucket Cloud removed this API (CHANGE-2770)."
119
+ };
126
120
  return {
127
121
  code: void 0,
128
122
  message
@@ -187,24 +181,11 @@ function bitbucket(options) {
187
181
  raw: data
188
182
  };
189
183
  },
190
- async listNamespaces(params) {
191
- if (params.cursor) {
192
- const { url } = decodeCursor("bitbucket", params.cursor);
193
- assertSameOriginUrl("bitbucket", BASE_URL, url);
194
- const { data } = await http.json(url, { signal: params.signal });
195
- return {
196
- data: (data.values ?? []).map(toNamespace),
197
- cursor: nextCursor(data)
198
- };
199
- }
200
- const { data } = await http.json("/workspaces", {
201
- query: { pagelen: clampPerPage(params.limit) },
202
- signal: params.signal
184
+ async listNamespaces() {
185
+ throw new RepoError("Bitbucket Cloud removed workspace enumeration (CHANGE-2770); query repositories with an explicit workspace/namespace instead.", {
186
+ code: "unsupported",
187
+ provider: "bitbucket"
203
188
  });
204
- return {
205
- data: (data.values ?? []).map(toNamespace),
206
- cursor: nextCursor(data)
207
- };
208
189
  },
209
190
  async listRepositories(params) {
210
191
  if (params.cursor) {
@@ -216,8 +197,11 @@ function bitbucket(options) {
216
197
  cursor: nextCursor(data)
217
198
  };
218
199
  }
219
- const path = params.namespace ? `/repositories/${encodeURIComponent(params.namespace)}` : "/repositories";
220
- const { data } = await http.json(path, {
200
+ if (params.namespace === void 0) throw new RepoError("Bitbucket Cloud removed cross-workspace repository listing (CHANGE-2770); pass a namespace (workspace slug) to list repositories.", {
201
+ code: "unsupported",
202
+ provider: "bitbucket"
203
+ });
204
+ const { data } = await http.json(`/repositories/${encodeURIComponent(params.namespace)}`, {
221
205
  query: {
222
206
  role: params.owned ? "owner" : "member",
223
207
  q: params.query !== void 0 ? bbqlNameQuery(params.query) : void 0,
@@ -1,4 +1,4 @@
1
- import { B as TokenProvider, F as RepoProvider } from "./types-DfiRluvJ.js";
1
+ import { B as TokenProvider, F as RepoProvider } from "./types-B9oMHTeP.js";
2
2
  //#region src/providers/git-http/index.d.ts
3
3
  interface GitHttpProviderOptions {
4
4
  /**
package/dist/gitea.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as TokenProvider, F as RepoProvider, O as ParsedWebhookEvent, v as IncomingWebhookRequest } from "./types-DfiRluvJ.js";
1
+ import { B as TokenProvider, F as RepoProvider, O as ParsedWebhookEvent, v as IncomingWebhookRequest } from "./types-B9oMHTeP.js";
2
2
  import { t as VerifyWebhookParams } from "./verify-p6JsExms.js";
3
3
  //#region src/providers/gitea/index.d.ts
4
4
  interface GiteaProviderOptions {
package/dist/github.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as TokenProvider, D as Page, F as RepoProvider, O as ParsedWebhookEvent, v as IncomingWebhookRequest } from "./types-DfiRluvJ.js";
1
+ import { B as TokenProvider, D as Page, F as RepoProvider, O as ParsedWebhookEvent, v as IncomingWebhookRequest } from "./types-B9oMHTeP.js";
2
2
  import { t as VerifyWebhookParams } from "./verify-p6JsExms.js";
3
3
  //#region src/providers/github/app-auth.d.ts
4
4
  interface InstallationToken {
package/dist/gitlab.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as TokenProvider, F as RepoProvider, O as ParsedWebhookEvent, v as IncomingWebhookRequest } from "./types-DfiRluvJ.js";
1
+ import { B as TokenProvider, F as RepoProvider, O as ParsedWebhookEvent, v as IncomingWebhookRequest } from "./types-B9oMHTeP.js";
2
2
  import { t as VerifyWebhookParams } from "./verify-p6JsExms.js";
3
3
  //#region src/providers/gitlab/index.d.ts
4
4
  interface GitLabProviderOptions {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ProviderRefMatch, B as TokenProvider, C as ListTagsParams, D as Page, E as NamespaceKind, F as RepoProvider, G as WebhookVerificationMethod, H as UserRef, I as Repository, L as ResolveRefParams, M as RefMatch, N as RefType, O as ParsedWebhookEvent, P as RepoCapabilities, R as SearchRefsParams, S as ListRepositoriesParams, T as Namespace, U as Webhook, V as UpdateWebhookParams, W as WebhookEventType, _ as GitActor, a as CloneUrl, b as ListCommitsParams, c as DeleteWebhookParams, d as GetBranchParams, f as GetCloneUrlParams, g as GetWebhookParams, h as GetTagParams, i as Branch, j as ProviderSearchRefsParams, k as ProviderName, l as DownloadArchiveParams, m as GetRepositoryParams, n as ArchiveFormat, o as Commit, p as GetCommitParams, r as AuthenticatedUser, s as CreateWebhookParams, t as Archive, u as GetAuthenticatedUserParams, v as IncomingWebhookRequest, w as ListWebhooksParams, x as ListNamespacesParams, y as ListBranchesParams, z as Tag } from "./types-DfiRluvJ.js";
1
+ import { A as ProviderRefMatch, B as TokenProvider, C as ListTagsParams, D as Page, E as NamespaceKind, F as RepoProvider, G as WebhookVerificationMethod, H as UserRef, I as Repository, L as ResolveRefParams, M as RefMatch, N as RefType, O as ParsedWebhookEvent, P as RepoCapabilities, R as SearchRefsParams, S as ListRepositoriesParams, T as Namespace, U as Webhook, V as UpdateWebhookParams, W as WebhookEventType, _ as GitActor, a as CloneUrl, b as ListCommitsParams, c as DeleteWebhookParams, d as GetBranchParams, f as GetCloneUrlParams, g as GetWebhookParams, h as GetTagParams, i as Branch, j as ProviderSearchRefsParams, k as ProviderName, l as DownloadArchiveParams, m as GetRepositoryParams, n as ArchiveFormat, o as Commit, p as GetCommitParams, r as AuthenticatedUser, s as CreateWebhookParams, t as Archive, u as GetAuthenticatedUserParams, v as IncomingWebhookRequest, w as ListWebhooksParams, x as ListNamespacesParams, y as ListBranchesParams, z as Tag } from "./types-B9oMHTeP.js";
2
2
  //#region src/client.d.ts
3
3
  interface RetryOptions {
4
4
  rateLimit?: boolean;
package/dist/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { E as NamespaceKind, F as RepoProvider, I as Repository, P as RepoCapabilities, T as Namespace, U as Webhook, W as WebhookEventType, i as Branch, k as ProviderName, o as Commit, z as Tag } from "./types-DfiRluvJ.js";
1
+ import { E as NamespaceKind, F as RepoProvider, I as Repository, P as RepoCapabilities, T as Namespace, U as Webhook, W as WebhookEventType, i as Branch, k as ProviderName, o as Commit, z as Tag } from "./types-B9oMHTeP.js";
2
2
  //#region src/providers/testing/index.d.ts
3
3
  interface InMemoryNamespaceSeed {
4
4
  id: string;
@@ -41,8 +41,8 @@ interface Repository {
41
41
  raw: unknown;
42
42
  }
43
43
  interface CloneUrl {
44
+ /** Always carries the resolved credential embedded in the URL. */
44
45
  url: string;
45
- headers?: Record<string, string>;
46
46
  expiresAt?: Date;
47
47
  }
48
48
  /** The account behind the configured credentials (see the `userProfile` capability). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-sdk",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
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>",