@minnovate/shadow-publisher 0.11.2 → 0.11.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "git-publisher",
3
3
  "displayName": "Git Publisher",
4
- "version": "0.11.2",
4
+ "version": "0.11.4",
5
5
  "description": "Publish an app folder's Git history to the serverless Git publishing backend and keep it updated (\"publish my app\", \"update my app\", \"fetch the engineered version\").",
6
6
  "author": { "name": "git-publisher project" },
7
7
  "keywords": ["git", "publish", "deploy", "serverless"]
@@ -102,6 +102,11 @@ var ERROR_CODES = [
102
102
  // meets it is an older client calling this route directly, and can say "upgrade" rather than
103
103
  // "you may not".
104
104
  "APPLICATION_REQUIRED",
105
+ // The subject can read the repository and the route needs admin. Its own code rather than
106
+ // FORBIDDEN: the portal tells "this person does not administer it" from "the portal was refused"
107
+ // (a delegation the service would not take), and before this code it could only compare the
108
+ // English message. A client that does not know it reads the 403 as FORBIDDEN, as it did before.
109
+ "ADMIN_REQUIRED",
105
110
  // repositories
106
111
  "REPOSITORY_NOT_FOUND",
107
112
  "REPOSITORY_CONFLICT",
@@ -145,6 +150,7 @@ var HTTP_STATUS_FOR_CODE = {
145
150
  REF_FORBIDDEN: 403,
146
151
  ORGANISATION_REQUIRED: 403,
147
152
  APPLICATION_REQUIRED: 403,
153
+ ADMIN_REQUIRED: 403,
148
154
  REPOSITORY_NOT_FOUND: 404,
149
155
  REPOSITORY_CONFLICT: 409,
150
156
  REPOSITORY_ARCHIVED: 409,
@@ -6706,6 +6712,50 @@ function replacedLine(t) {
6706
6712
  return t.replaced === null ? null : `note: the temporary directory ${t.replaced.path} ${t.replaced.reason}; using ${t.path} instead`;
6707
6713
  }
6708
6714
 
6715
+ // src/exit-code.ts
6716
+ var EXIT_CODE = {
6717
+ UNAUTHORIZED: 4,
6718
+ FORBIDDEN: 4,
6719
+ ADMIN_REQUIRED: 4,
6720
+ OUTCOME_UNKNOWN: 3,
6721
+ NETWORK: 3,
6722
+ UNAVAILABLE: 3,
6723
+ INVALID_REQUEST: 1,
6724
+ UNSUPPORTED_PROTOCOL_VERSION: 1,
6725
+ UNSUPPORTED_SCHEMA_VERSION: 1,
6726
+ NOT_FOUND: 1,
6727
+ METHOD_NOT_ALLOWED: 1,
6728
+ REF_FORBIDDEN: 1,
6729
+ ORGANISATION_REQUIRED: 1,
6730
+ APPLICATION_REQUIRED: 1,
6731
+ REPOSITORY_NOT_FOUND: 1,
6732
+ REPOSITORY_CONFLICT: 1,
6733
+ REPOSITORY_ARCHIVED: 1,
6734
+ ACCESS_CONFLICT: 1,
6735
+ PUBLICATION_NOT_FOUND: 1,
6736
+ PUBLICATION_CONFLICT: 1,
6737
+ PUBLICATION_EXPIRED: 1,
6738
+ UPLOAD_MISSING: 1,
6739
+ LIMIT_EXCEEDED: 1,
6740
+ STALE_GENERATION: 1,
6741
+ NON_FAST_FORWARD: 1,
6742
+ EXPECTED_OLD_MISMATCH: 1,
6743
+ INVALID_REF_NAME: 1,
6744
+ REF_CONFLICT: 1,
6745
+ PACK_INVALID: 1,
6746
+ MISSING_OBJECTS: 1,
6747
+ UPLOAD_MISMATCH: 1,
6748
+ INVALID_TARGET: 1,
6749
+ EXPIRED: 1,
6750
+ INTERNAL: 1,
6751
+ CANCELLED: 1,
6752
+ LOCAL_STATE: 1,
6753
+ GIT: 1
6754
+ };
6755
+ function exitCodeFor(code) {
6756
+ return EXIT_CODE[code];
6757
+ }
6758
+
6709
6759
  // src/main.ts
6710
6760
  var USAGE = `publisher \u2014 publish an app's Git history to the serverless Git backend
6711
6761
 
@@ -7212,7 +7262,7 @@ main(process.argv.slice(2)).then(
7212
7262
  const hint = e.code === "NETWORK" ? `
7213
7263
  if this folder's service moved, "publisher doctor" says where to` : "";
7214
7264
  process.stdout.write((json ? JSON.stringify(payload) : `error [${e.code}]: ${e.message}${hint}`) + "\n");
7215
- process.exit(e.code === "UNAUTHORIZED" || e.code === "FORBIDDEN" ? 4 : e.code === "OUTCOME_UNKNOWN" || e.code === "NETWORK" || e.code === "UNAVAILABLE" ? 3 : 1);
7265
+ process.exit(exitCodeFor(e.code));
7216
7266
  }
7217
7267
  process.stdout.write(
7218
7268
  (json ? JSON.stringify({ error: { code: "INTERNAL", message: String(e?.message ?? e) } }) : `error: ${String(e?.message ?? e)}`) + "\n"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minnovate/shadow-publisher",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
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",