@stackfactor/client-api 1.2.16 → 1.2.18

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,9 @@
1
1
  import { AxiosError } from "axios";
2
2
  export declare const client: import("axios").AxiosInstance;
3
+ export declare const FORBIDDEN_MESSAGE = "You don't have permission to do this. Ask your administrator for access.";
3
4
  /**
4
- * Returns the error as a string
5
+ * Returns the error as a string. A permission refusal (403) reads as
6
+ * FORBIDDEN_MESSAGE unless the server wrote a message of its own for it.
5
7
  * @param {AxiosError} error
6
8
  * @returns {string}
7
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"axiosClient.d.ts","sourceRoot":"","sources":["../../../src/lib/axiosClient.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,UAAU,EAAiB,MAAM,OAAO,CAAC;AAsBzD,eAAO,MAAM,MAAM,+BAGjB,CAAC;AAoDH;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,UAAU,KAAG,MA2BjD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,UAAU,KAAG,MAIhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,UAAU,KAChB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAKnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,qBAAqB,OAAO,EAC5B,OAAO,UAAU,KAChB,OAMF,CAAC"}
1
+ {"version":3,"file":"axiosClient.d.ts","sourceRoot":"","sources":["../../../src/lib/axiosClient.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,UAAU,EAAiB,MAAM,OAAO,CAAC;AAsBzD,eAAO,MAAM,MAAM,+BAGjB,CAAC;AAgEH,eAAO,MAAM,iBAAiB,6EAC8C,CAAC;AAkD7E;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,UAAU,KAAG,MAejD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,UAAU,KAAG,MAIhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,UAAU,KAChB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAKnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,qBAAqB,OAAO,EAC5B,OAAO,UAAU,KAChB,OAMF,CAAC"}
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.shouldReturnError = exports.getErrorInformation = exports.getErrorType = exports.errorToString = exports.client = void 0;
39
+ exports.shouldReturnError = exports.getErrorInformation = exports.getErrorType = exports.errorToString = exports.FORBIDDEN_MESSAGE = exports.client = void 0;
40
40
  const axios_1 = __importDefault(require("axios"));
41
41
  const constants_js_1 = require("./constants.js");
42
42
  const utils = __importStar(require("./utils.js"));
@@ -62,6 +62,22 @@ const REDACTED_FIELDS = [
62
62
  //Long values (a pasted document, a base64 blob) would bury the message they are meant
63
63
  //to illustrate.
64
64
  const MAX_VALUE_LENGTH = 60;
65
+ /**
66
+ * The rejected value as it should appear in a message: null when there is nothing
67
+ * worth showing, cut short when it would bury the message it illustrates.
68
+ */
69
+ const displayValue = (value) => {
70
+ if (value === null || value === undefined) {
71
+ return null;
72
+ }
73
+ const text = typeof value === "object" ? JSON.stringify(value) : String(value);
74
+ if (text.length === 0) {
75
+ return null;
76
+ }
77
+ return text.length > MAX_VALUE_LENGTH
78
+ ? `${text.slice(0, MAX_VALUE_LENGTH)}…`
79
+ : text;
80
+ };
65
81
  /**
66
82
  * Renders one validation error as a sentence: the server's message, then the field it
67
83
  * is about and the value that was rejected.
@@ -78,59 +94,79 @@ const validationErrorToString = (item) => {
78
94
  return message;
79
95
  }
80
96
  const redacted = REDACTED_FIELDS.indexOf(field.toLowerCase()) >= 0;
81
- let value = null;
82
- if (!redacted && item.value !== null && item.value !== undefined) {
83
- value =
84
- typeof item.value === "object"
85
- ? JSON.stringify(item.value)
86
- : String(item.value);
87
- if (value.length === 0) {
88
- value = null;
89
- }
90
- else if (value.length > MAX_VALUE_LENGTH) {
91
- value = `${value.slice(0, MAX_VALUE_LENGTH)}…`;
92
- }
97
+ const value = redacted ? null : displayValue(item.value);
98
+ const subject = value === null ? field : `${field}: "${value}"`;
99
+ return `${message} (${subject})`;
100
+ };
101
+ //What a signed-in user reads when the server refuses them (403). A validator's own
102
+ //refusal is "Unauthorized request" on the authorization header: the same words for
103
+ //every refusal, and they mean nothing to the reader. The client doesn't know the
104
+ //brand it runs under, so the sentence names no product.
105
+ exports.FORBIDDEN_MESSAGE = "You don't have permission to do this. Ask your administrator for access.";
106
+ //A validator's permission refusal only ever names the authorization header
107
+ const isAuthorizationError = (item) => (item.path ?? item.param) === "authorization";
108
+ /**
109
+ * True for a 403 that says nothing better than the generic refusal: only a
110
+ * validator's authorization errors, or no message the server wrote itself.
111
+ */
112
+ const isGenericRefusal = (error) => {
113
+ if (error?.response?.status !== constants_js_1.RESPONSE_TYPE.FORBIDDEN) {
114
+ return false;
93
115
  }
94
- return `${message} (${field}${value === null ? "" : `: "${value}"`})`;
116
+ const responseData = error.response?.data;
117
+ const errors = responseData?.errors;
118
+ if (Array.isArray(errors)) {
119
+ return errors.every(isAuthorizationError);
120
+ }
121
+ return !responseData?.error;
122
+ };
123
+ //What a failure reads as when nothing more specific can be said about it
124
+ const UNKNOWN_ERROR = "Unknown error";
125
+ /**
126
+ * The message a server response carries, most specific first: the validation
127
+ * errors, the server's own message, then whatever else the response offers.
128
+ * @param {AxiosResponse} response
129
+ * @returns {string}
130
+ */
131
+ const responseToString = (response) => {
132
+ const responseData = response.data;
133
+ if (Array.isArray(responseData.errors)) {
134
+ return responseData.errors
135
+ .map((item) => validationErrorToString(item))
136
+ .join("; ");
137
+ }
138
+ if (responseData.error) {
139
+ return responseData.error;
140
+ }
141
+ if (responseData.errors) {
142
+ return JSON.stringify(responseData.errors);
143
+ }
144
+ if (response.statusText) {
145
+ return response.statusText.toString();
146
+ }
147
+ return responseData.toString();
95
148
  };
96
149
  /**
97
- * Returns the error as a string
150
+ * Returns the error as a string. A permission refusal (403) reads as
151
+ * FORBIDDEN_MESSAGE unless the server wrote a message of its own for it.
98
152
  * @param {AxiosError} error
99
153
  * @returns {string}
100
154
  */
101
155
  const errorToString = (error) => {
156
+ if (isGenericRefusal(error)) {
157
+ return exports.FORBIDDEN_MESSAGE;
158
+ }
102
159
  try {
103
- if (error != null) {
104
- if (error.response?.data) {
105
- const responseData = error.response.data;
106
- if (Array.isArray(responseData.errors)) {
107
- return responseData.errors
108
- .map((item) => validationErrorToString(item))
109
- .join("; ");
110
- }
111
- else if (responseData.error) {
112
- return responseData.error;
113
- }
114
- else if (responseData.errors) {
115
- return JSON.stringify(responseData.errors);
116
- }
117
- else if (error.response.statusText) {
118
- return error.response.statusText.toString();
119
- }
120
- else {
121
- return responseData.toString();
122
- }
123
- }
124
- else {
125
- return error.message ? error.message : "Unknown error";
126
- }
160
+ if (error == null) {
161
+ return UNKNOWN_ERROR;
127
162
  }
128
- else {
129
- return "Unknown error";
163
+ if (error.response?.data) {
164
+ return responseToString(error.response);
130
165
  }
166
+ return error.message || UNKNOWN_ERROR;
131
167
  }
132
168
  catch {
133
- return "Unknown error";
169
+ return UNKNOWN_ERROR;
134
170
  }
135
171
  };
136
172
  exports.errorToString = errorToString;
@@ -1 +1 @@
1
- {"version":3,"file":"axiosClient.js","sourceRoot":"","sources":["../../../src/lib/axiosClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAyD;AACzD,iDAA+C;AAC/C,kDAAoC;AAkBpC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,EAA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;IACvB,CAAC;AACH,CAAC,CAAC;AAfW,QAAA,aAAa,iBAexB;AAEF;;;;GAIG;AACI,MAAM,YAAY,GAAG,CAAC,KAAiB,EAAU,EAAE;IACxD,IAAI,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC/B,CAAC;;QAAM,OAAO,4BAAa,CAAC,mBAAmB,CAAC;AAClD,CAAC,CAAC;AAJW,QAAA,YAAY,gBAIvB;AAEF;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CACjC,KAAiB,EACoB,EAAE;IACvC,OAAO;QACL,MAAM,EAAE,IAAA,oBAAY,EAAC,KAAK,CAAC;QAC3B,OAAO,EAAE,IAAA,qBAAa,EAAC,KAAK,CAAC;KAC9B,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,mBAAmB,uBAO9B;AAEF;;;;;GAKG;AACI,MAAM,iBAAiB,GAAG,CAC/B,mBAA4B,EAC5B,KAAiB,EACR,EAAE;IACX,IAAI,IAAA,oBAAY,EAAC,KAAK,CAAC,KAAK,4BAAa,CAAC,YAAY,EAAE,CAAC;QACvD,OAAO,mBAAmB,CAAC;IAC7B,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AATW,QAAA,iBAAiB,qBAS5B"}
@@ -1,7 +1,9 @@
1
1
  import { AxiosError } from "axios";
2
2
  export declare const client: import("axios").AxiosInstance;
3
+ export declare const FORBIDDEN_MESSAGE = "You don't have permission to do this. Ask your administrator for access.";
3
4
  /**
4
- * Returns the error as a string
5
+ * Returns the error as a string. A permission refusal (403) reads as
6
+ * FORBIDDEN_MESSAGE unless the server wrote a message of its own for it.
5
7
  * @param {AxiosError} error
6
8
  * @returns {string}
7
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"axiosClient.d.ts","sourceRoot":"","sources":["../../../src/lib/axiosClient.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,UAAU,EAAiB,MAAM,OAAO,CAAC;AAsBzD,eAAO,MAAM,MAAM,+BAGjB,CAAC;AAoDH;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,UAAU,KAAG,MA2BjD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,UAAU,KAAG,MAIhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,UAAU,KAChB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAKnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,qBAAqB,OAAO,EAC5B,OAAO,UAAU,KAChB,OAMF,CAAC"}
1
+ {"version":3,"file":"axiosClient.d.ts","sourceRoot":"","sources":["../../../src/lib/axiosClient.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,UAAU,EAAiB,MAAM,OAAO,CAAC;AAsBzD,eAAO,MAAM,MAAM,+BAGjB,CAAC;AAgEH,eAAO,MAAM,iBAAiB,6EAC8C,CAAC;AAkD7E;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,UAAU,KAAG,MAejD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,UAAU,KAAG,MAIhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,UAAU,KAChB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAKnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,qBAAqB,OAAO,EAC5B,OAAO,UAAU,KAChB,OAMF,CAAC"}
@@ -23,6 +23,22 @@ const REDACTED_FIELDS = [
23
23
  //Long values (a pasted document, a base64 blob) would bury the message they are meant
24
24
  //to illustrate.
25
25
  const MAX_VALUE_LENGTH = 60;
26
+ /**
27
+ * The rejected value as it should appear in a message: null when there is nothing
28
+ * worth showing, cut short when it would bury the message it illustrates.
29
+ */
30
+ const displayValue = (value) => {
31
+ if (value === null || value === undefined) {
32
+ return null;
33
+ }
34
+ const text = typeof value === "object" ? JSON.stringify(value) : String(value);
35
+ if (text.length === 0) {
36
+ return null;
37
+ }
38
+ return text.length > MAX_VALUE_LENGTH
39
+ ? `${text.slice(0, MAX_VALUE_LENGTH)}…`
40
+ : text;
41
+ };
26
42
  /**
27
43
  * Renders one validation error as a sentence: the server's message, then the field it
28
44
  * is about and the value that was rejected.
@@ -39,59 +55,79 @@ const validationErrorToString = (item) => {
39
55
  return message;
40
56
  }
41
57
  const redacted = REDACTED_FIELDS.indexOf(field.toLowerCase()) >= 0;
42
- let value = null;
43
- if (!redacted && item.value !== null && item.value !== undefined) {
44
- value =
45
- typeof item.value === "object"
46
- ? JSON.stringify(item.value)
47
- : String(item.value);
48
- if (value.length === 0) {
49
- value = null;
50
- }
51
- else if (value.length > MAX_VALUE_LENGTH) {
52
- value = `${value.slice(0, MAX_VALUE_LENGTH)}…`;
53
- }
58
+ const value = redacted ? null : displayValue(item.value);
59
+ const subject = value === null ? field : `${field}: "${value}"`;
60
+ return `${message} (${subject})`;
61
+ };
62
+ //What a signed-in user reads when the server refuses them (403). A validator's own
63
+ //refusal is "Unauthorized request" on the authorization header: the same words for
64
+ //every refusal, and they mean nothing to the reader. The client doesn't know the
65
+ //brand it runs under, so the sentence names no product.
66
+ export const FORBIDDEN_MESSAGE = "You don't have permission to do this. Ask your administrator for access.";
67
+ //A validator's permission refusal only ever names the authorization header
68
+ const isAuthorizationError = (item) => (item.path ?? item.param) === "authorization";
69
+ /**
70
+ * True for a 403 that says nothing better than the generic refusal: only a
71
+ * validator's authorization errors, or no message the server wrote itself.
72
+ */
73
+ const isGenericRefusal = (error) => {
74
+ if (error?.response?.status !== RESPONSE_TYPE.FORBIDDEN) {
75
+ return false;
54
76
  }
55
- return `${message} (${field}${value === null ? "" : `: "${value}"`})`;
77
+ const responseData = error.response?.data;
78
+ const errors = responseData?.errors;
79
+ if (Array.isArray(errors)) {
80
+ return errors.every(isAuthorizationError);
81
+ }
82
+ return !responseData?.error;
83
+ };
84
+ //What a failure reads as when nothing more specific can be said about it
85
+ const UNKNOWN_ERROR = "Unknown error";
86
+ /**
87
+ * The message a server response carries, most specific first: the validation
88
+ * errors, the server's own message, then whatever else the response offers.
89
+ * @param {AxiosResponse} response
90
+ * @returns {string}
91
+ */
92
+ const responseToString = (response) => {
93
+ const responseData = response.data;
94
+ if (Array.isArray(responseData.errors)) {
95
+ return responseData.errors
96
+ .map((item) => validationErrorToString(item))
97
+ .join("; ");
98
+ }
99
+ if (responseData.error) {
100
+ return responseData.error;
101
+ }
102
+ if (responseData.errors) {
103
+ return JSON.stringify(responseData.errors);
104
+ }
105
+ if (response.statusText) {
106
+ return response.statusText.toString();
107
+ }
108
+ return responseData.toString();
56
109
  };
57
110
  /**
58
- * Returns the error as a string
111
+ * Returns the error as a string. A permission refusal (403) reads as
112
+ * FORBIDDEN_MESSAGE unless the server wrote a message of its own for it.
59
113
  * @param {AxiosError} error
60
114
  * @returns {string}
61
115
  */
62
116
  export const errorToString = (error) => {
117
+ if (isGenericRefusal(error)) {
118
+ return FORBIDDEN_MESSAGE;
119
+ }
63
120
  try {
64
- if (error != null) {
65
- if (error.response?.data) {
66
- const responseData = error.response.data;
67
- if (Array.isArray(responseData.errors)) {
68
- return responseData.errors
69
- .map((item) => validationErrorToString(item))
70
- .join("; ");
71
- }
72
- else if (responseData.error) {
73
- return responseData.error;
74
- }
75
- else if (responseData.errors) {
76
- return JSON.stringify(responseData.errors);
77
- }
78
- else if (error.response.statusText) {
79
- return error.response.statusText.toString();
80
- }
81
- else {
82
- return responseData.toString();
83
- }
84
- }
85
- else {
86
- return error.message ? error.message : "Unknown error";
87
- }
121
+ if (error == null) {
122
+ return UNKNOWN_ERROR;
88
123
  }
89
- else {
90
- return "Unknown error";
124
+ if (error.response?.data) {
125
+ return responseToString(error.response);
91
126
  }
127
+ return error.message || UNKNOWN_ERROR;
92
128
  }
93
129
  catch {
94
- return "Unknown error";
130
+ return UNKNOWN_ERROR;
95
131
  }
96
132
  };
97
133
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"axiosClient.js","sourceRoot":"","sources":["../../../src/lib/axiosClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAkBpC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;AAEnC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IACjC,OAAO,EAAE,OAAO;IAChB,eAAe,EAAE,IAAI;CACtB,CAAC,CAAC;AAEH,mFAAmF;AACnF,mFAAmF;AACnF,wCAAwC;AACxC,MAAM,eAAe,GAAG;IACtB,UAAU;IACV,aAAa;IACb,iBAAiB;IACjB,OAAO;IACP,QAAQ;IACR,eAAe;IACf,QAAQ;IACR,aAAa;IACb,cAAc;CACf,CAAC;AAEF,sFAAsF;AACtF,gBAAgB;AAChB,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,CAAC,IAAmB,EAAU,EAAE;IAC9D,oFAAoF;IACpF,sEAAsE;IACtE,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,eAAe,CAAC;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;IACnE,IAAI,KAAK,GAAkB,IAAI,CAAC;IAChC,IAAI,CAAC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3
+ "version": "1.2.18",
4
4
  "description": "Node.js library for the StackFactor API",
5
5
  "publishConfig": {
6
6
  "access": "public"