repo-sdk 0.1.3 → 0.1.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/bitbucket.js +13 -29
  2. package/package.json +1 -1
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.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>",