@vibedropio/publisher 0.24.1 → 0.25.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,7 +1,7 @@
1
1
  {
2
2
  "name": "git-publisher",
3
3
  "displayName": "Git Publisher",
4
- "version": "0.24.1",
4
+ "version": "0.25.0",
5
5
  "description": "Publish an app folder to the platform and keep it updated (\"publish my app\", \"update my app\", \"fetch the engineered version\").",
6
6
  "author": { "name": "VibeDrop" },
7
7
  "keywords": ["git", "publish", "deploy", "serverless"]
@@ -21945,6 +21945,10 @@ var ERROR_CODES = [
21945
21945
  // code rather than FORBIDDEN: a caller can act on it (sign in again, choosing a workspace),
21946
21946
  // and a test that could not tell it from "you may not" would prove nothing about the check.
21947
21947
  "WORKSPACE_REQUIRED",
21948
+ // The person's credential names another workspace than the repository's: a terminal signed in to
21949
+ // another workspace (credentials ADR-0035, ADR-0043). Its own code, and not retryable: the person
21950
+ // signs in to the repository's workspace, and a retry would give the same answer.
21951
+ "WORKSPACE_MISMATCH",
21948
21952
  // A repository is created only by the platform's application maker (the portal), for a person,
21949
21953
  // after it has made the application the repository will belong to. Its own code: a terminal that
21950
21954
  // meets it is an older client calling this route directly, and can say "upgrade" rather than
@@ -22092,7 +22096,7 @@ var Transport = class {
22092
22096
  return { status: res.status, body: parsed, headers: res.headers };
22093
22097
  }
22094
22098
  const err = parsed?.error;
22095
- const code = err && ERROR_CODES.includes(err.code) ? err.code : fallbackCode(res.status);
22099
+ const code = codeOf(err?.code, res.status);
22096
22100
  throw new PublisherError(code, err?.message ?? `HTTP ${res.status}`, {
22097
22101
  isRetryable: err?.isRetryable ?? (res.status === 429 || res.status >= 500),
22098
22102
  httpStatus: res.status,
@@ -22104,6 +22108,23 @@ var Transport = class {
22104
22108
  }
22105
22109
  }
22106
22110
  };
22111
+ var PLATFORM_CODES = {
22112
+ "no-such-route": "NOT_FOUND",
22113
+ "method-not-allowed": "METHOD_NOT_ALLOWED",
22114
+ "body-too-large": "LIMIT_EXCEEDED",
22115
+ "bad-request": "INVALID_REQUEST",
22116
+ unauthorized: "UNAUTHORIZED",
22117
+ forbidden: "FORBIDDEN",
22118
+ "workspace-required": "WORKSPACE_REQUIRED",
22119
+ unavailable: "UNAVAILABLE",
22120
+ misconfigured: "UNAVAILABLE"
22121
+ };
22122
+ function codeOf(sent, status2) {
22123
+ if (sent !== void 0 && ERROR_CODES.includes(sent)) {
22124
+ return sent;
22125
+ }
22126
+ return (sent !== void 0 && Object.hasOwn(PLATFORM_CODES, sent) ? PLATFORM_CODES[sent] : void 0) ?? fallbackCode(status2);
22127
+ }
22107
22128
  function fallbackCode(status2) {
22108
22129
  if (status2 === 401) {
22109
22130
  return "UNAUTHORIZED";
@@ -25229,6 +25250,7 @@ var EXIT_CODE = {
25229
25250
  METHOD_NOT_ALLOWED: 1,
25230
25251
  REF_FORBIDDEN: 1,
25231
25252
  WORKSPACE_REQUIRED: 1,
25253
+ WORKSPACE_MISMATCH: 1,
25232
25254
  OWNER_REQUIRED: 1,
25233
25255
  REPOSITORY_NOT_FOUND: 1,
25234
25256
  REPOSITORY_CONFLICT: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedropio/publisher",
3
- "version": "0.24.1",
3
+ "version": "0.25.0",
4
4
  "description": "publisher: publish an app's Git history to the serverless Git backend",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",