gap-nodejs-sdk 1.0.209 → 1.0.211
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.
- package/dist/api/appointment_api/1.0.0/models/pos.d.ts +1 -0
- package/dist/api/appointment_api/1.0.0/models/pos.d.ts.map +1 -1
- package/dist/api/appointment_api/1.0.0/models/pos.js +2 -1
- package/dist/api/appointment_api/1.0.0/types/response/pos.d.ts +1 -0
- package/dist/api/appointment_api/1.0.0/types/response/pos.d.ts.map +1 -1
- package/dist/api/pos_client_api/1.0.0/models/payroll.d.ts +1 -58
- package/dist/api/pos_client_api/1.0.0/models/payroll.d.ts.map +1 -1
- package/dist/api/pos_client_api/1.0.0/models/payroll.js +33 -20
- package/dist/api/pos_client_api/1.0.0/types/response/payroll.d.ts +14 -7
- package/dist/api/pos_client_api/1.0.0/types/response/payroll.d.ts.map +1 -1
- package/dist/clover/types.d.ts +4 -2
- package/dist/clover/types.d.ts.map +1 -1
- package/dist/gap-sdk.js +1 -1
- package/dist/http_client/http_client.d.ts.map +1 -1
- package/dist/http_client/http_client.js +40 -39
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_client.d.ts","sourceRoot":"","sources":["../../src/http_client/http_client.ts"],"names":[],"mappings":"AACA,OAAc,EAAiB,kBAAkB,EAAiB,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,EACH,mBAAmB,EACnB,gBAAgB,EAEhB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EAEhB,MAAM,SAAS,CAAC;AAGjB,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgB;IAChD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IACvC,OAAO,CAAC,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O,CAAC,eAAe,CAAC;IAIvD,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;IAI7D,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC;IA+D9D,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI9B,SAAS,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC;CAkEhF"}
|
|
@@ -101,57 +101,58 @@ export class HttpClient {
|
|
|
101
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
102
|
try {
|
|
103
103
|
const response = yield this.axios(options);
|
|
104
|
-
if ((
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
message: `GAP is throttling requests ${errorMessage}`,
|
|
116
|
-
code,
|
|
117
|
-
statusText,
|
|
118
|
-
body: response.data,
|
|
119
|
-
headers,
|
|
120
|
-
retryAfter: retryAfter ? parseFloat(retryAfter) : undefined,
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
case response.status >= StatusCode.InternalServerError:
|
|
124
|
-
throw new GapErrors.HttpInternalError({
|
|
125
|
-
message: `GAP internal error ${errorMessage}`,
|
|
126
|
-
code,
|
|
127
|
-
statusText,
|
|
128
|
-
body: response.data,
|
|
129
|
-
headers,
|
|
130
|
-
});
|
|
131
|
-
default:
|
|
132
|
-
if (((_e = response.data) === null || _e === void 0 ? void 0 : _e.status) == "FAIL") {
|
|
133
|
-
throw new GapErrors.HttpResponseError({
|
|
134
|
-
message: `Received an error: ${errorMessage} (${(_f = response.data) === null || _f === void 0 ? void 0 : _f.error})`,
|
|
104
|
+
if (!/^(2|OK)/gi.test((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.status) ||
|
|
105
|
+
!/^(2|OK)/gi.test((_c = (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.result) === null || _c === void 0 ? void 0 : _c.status)) {
|
|
106
|
+
const errorMessage = JSON.stringify(response.data.message || response.data.result.message, null, 2);
|
|
107
|
+
const headers = response.headers;
|
|
108
|
+
const code = response.status;
|
|
109
|
+
const statusText = response.statusText;
|
|
110
|
+
switch (true) {
|
|
111
|
+
case response.status === StatusCode.TooManyRequests: {
|
|
112
|
+
const retryAfter = response.headers['Retry-After'];
|
|
113
|
+
throw new GapErrors.HttpThrottlingError({
|
|
114
|
+
message: `GAP is throttling requests ${errorMessage}`,
|
|
135
115
|
code,
|
|
136
116
|
statusText,
|
|
137
117
|
body: response.data,
|
|
138
118
|
headers,
|
|
119
|
+
retryAfter: retryAfter ? parseFloat(retryAfter) : undefined,
|
|
139
120
|
});
|
|
140
121
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
122
|
+
case response.status >= StatusCode.InternalServerError:
|
|
123
|
+
throw new GapErrors.HttpInternalError({
|
|
124
|
+
message: `GAP internal error ${errorMessage}`,
|
|
125
|
+
code,
|
|
126
|
+
statusText,
|
|
127
|
+
body: response.data,
|
|
128
|
+
headers,
|
|
129
|
+
});
|
|
130
|
+
default:
|
|
131
|
+
if (((_d = response.data) === null || _d === void 0 ? void 0 : _d.status) == "FAIL") {
|
|
132
|
+
throw new GapErrors.HttpResponseError({
|
|
133
|
+
message: `Received an error: ${errorMessage} (${(_e = response.data) === null || _e === void 0 ? void 0 : _e.error})`,
|
|
134
|
+
code,
|
|
135
|
+
statusText,
|
|
136
|
+
body: response.data,
|
|
137
|
+
headers,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
throw new GapErrors.HttpResponseError({
|
|
141
|
+
message: `Received an error (${response.status} ${response.statusText && '' + response.statusText}): ${errorMessage}`,
|
|
142
|
+
code,
|
|
143
|
+
statusText,
|
|
144
|
+
body: response.data,
|
|
145
|
+
headers,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
148
|
}
|
|
149
|
+
return response.data;
|
|
149
150
|
}
|
|
150
151
|
catch (error) {
|
|
151
152
|
if (error instanceof GapErrors.GapError) {
|
|
152
153
|
throw error;
|
|
153
154
|
}
|
|
154
|
-
if (error.response.status === 401) {
|
|
155
|
+
if (((_f = error === null || error === void 0 ? void 0 : error.response) === null || _f === void 0 ? void 0 : _f.status) === 401) {
|
|
155
156
|
throw new GapErrors.HttpUnauthorizedError({
|
|
156
157
|
code: error.response.status,
|
|
157
158
|
statusText: error.response.statusText,
|