@compassdigital/sdk.typescript 3.0.0-beta.9 → 3.0.0-rc.2
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/README.md +121 -8
- package/bin/gen.js +484 -0
- package/bin/index.js +3 -0
- package/gen.ts +98 -40
- package/lib/base.d.ts +129 -9
- package/lib/base.d.ts.map +1 -1
- package/lib/base.js +276 -53
- package/lib/base.js.map +1 -1
- package/lib/index.d.ts +592 -337
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +317 -18
- package/lib/index.js.map +1 -1
- package/lib/interface/announcement.d.ts.map +1 -0
- package/lib/interface/announcement.js +4 -0
- package/lib/interface/announcement.js.map +1 -0
- package/lib/interface/brand.d.ts.map +1 -0
- package/lib/interface/brand.js +4 -0
- package/lib/interface/brand.js.map +1 -0
- package/lib/{calendar.d.ts → interface/calendar.d.ts} +4 -1
- package/lib/interface/calendar.d.ts.map +1 -0
- package/lib/interface/calendar.js +4 -0
- package/lib/interface/calendar.js.map +1 -0
- package/lib/interface/config.d.ts.map +1 -0
- package/lib/interface/config.js +4 -0
- package/lib/interface/config.js.map +1 -0
- package/lib/interface/datalake.d.ts.map +1 -0
- package/lib/interface/datalake.js +4 -0
- package/lib/interface/datalake.js.map +1 -0
- package/lib/interface/delivery.d.ts.map +1 -0
- package/lib/interface/delivery.js +4 -0
- package/lib/interface/delivery.js.map +1 -0
- package/lib/interface/dh.d.ts.map +1 -0
- package/lib/interface/dh.js +4 -0
- package/lib/interface/dh.js.map +1 -0
- package/lib/interface/email.d.ts +21 -0
- package/lib/interface/email.d.ts.map +1 -0
- package/lib/interface/email.js +4 -0
- package/lib/interface/email.js.map +1 -0
- package/lib/interface/file.d.ts.map +1 -0
- package/lib/interface/file.js +4 -0
- package/lib/interface/file.js.map +1 -0
- package/lib/{kds.d.ts → interface/kds.d.ts} +1 -0
- package/lib/interface/kds.d.ts.map +1 -0
- package/lib/interface/kds.js +4 -0
- package/lib/interface/kds.js.map +1 -0
- package/lib/{location.d.ts → interface/location.d.ts} +53 -23
- package/lib/interface/location.d.ts.map +1 -0
- package/lib/interface/location.js +4 -0
- package/lib/interface/location.js.map +1 -0
- package/lib/interface/logger.d.ts.map +1 -0
- package/lib/interface/logger.js +4 -0
- package/lib/interface/logger.js.map +1 -0
- package/lib/interface/loyalty.d.ts.map +1 -0
- package/lib/interface/loyalty.js +4 -0
- package/lib/interface/loyalty.js.map +1 -0
- package/lib/interface/mealplan.d.ts.map +1 -0
- package/lib/interface/mealplan.js +4 -0
- package/lib/interface/mealplan.js.map +1 -0
- package/lib/interface/menu.d.ts +448 -0
- package/lib/interface/menu.d.ts.map +1 -0
- package/lib/interface/menu.js +4 -0
- package/lib/interface/menu.js.map +1 -0
- package/lib/interface/message.d.ts.map +1 -0
- package/lib/interface/message.js +4 -0
- package/lib/interface/message.js.map +1 -0
- package/lib/{order.d.ts → interface/order.d.ts} +11 -4
- package/lib/interface/order.d.ts.map +1 -0
- package/lib/interface/order.js +4 -0
- package/lib/interface/order.js.map +1 -0
- package/lib/{partner.d.ts → interface/partner.d.ts} +243 -4
- package/lib/interface/partner.d.ts.map +1 -0
- package/lib/interface/partner.js +4 -0
- package/lib/interface/partner.js.map +1 -0
- package/lib/{payment.d.ts → interface/payment.d.ts} +1 -0
- package/lib/interface/payment.d.ts.map +1 -0
- package/lib/interface/payment.js +4 -0
- package/lib/interface/payment.js.map +1 -0
- package/lib/{promo.d.ts → interface/promo.d.ts} +1 -0
- package/lib/interface/promo.d.ts.map +1 -0
- package/lib/interface/promo.js +4 -0
- package/lib/interface/promo.js.map +1 -0
- package/lib/{report.d.ts → interface/report.d.ts} +2 -0
- package/lib/interface/report.d.ts.map +1 -0
- package/lib/interface/report.js +4 -0
- package/lib/interface/report.js.map +1 -0
- package/lib/interface/schedule.d.ts.map +1 -0
- package/lib/interface/schedule.js +4 -0
- package/lib/interface/schedule.js.map +1 -0
- package/lib/{shoppingcart.d.ts → interface/shoppingcart.d.ts} +10 -1
- package/lib/interface/shoppingcart.d.ts.map +1 -0
- package/lib/interface/shoppingcart.js +4 -0
- package/lib/interface/shoppingcart.js.map +1 -0
- package/lib/interface/task.d.ts.map +1 -0
- package/lib/interface/task.js +4 -0
- package/lib/interface/task.js.map +1 -0
- package/lib/{user.d.ts → interface/user.d.ts} +19 -0
- package/lib/interface/user.d.ts.map +1 -0
- package/lib/interface/user.js +4 -0
- package/lib/interface/user.js.map +1 -0
- package/lib/interface/vote.d.ts.map +1 -0
- package/lib/interface/vote.js +4 -0
- package/lib/interface/vote.js.map +1 -0
- package/manifest.json +4 -0
- package/package.json +15 -5
- package/src/base.ts +274 -43
- package/src/index.ts +1319 -764
- package/src/{announcement.ts → interface/announcement.ts} +2 -0
- package/src/{brand.ts → interface/brand.ts} +2 -0
- package/src/{calendar.ts → interface/calendar.ts} +7 -1
- package/src/{config.ts → interface/config.ts} +2 -0
- package/src/{datalake.ts → interface/datalake.ts} +2 -0
- package/src/{delivery.ts → interface/delivery.ts} +2 -0
- package/src/{dh.ts → interface/dh.ts} +2 -0
- package/src/interface/email.ts +30 -0
- package/src/{file.ts → interface/file.ts} +2 -0
- package/src/{kds.ts → interface/kds.ts} +4 -0
- package/src/{location.ts → interface/location.ts} +79 -38
- package/src/{logger.ts → interface/logger.ts} +2 -0
- package/src/{loyalty.ts → interface/loyalty.ts} +2 -0
- package/src/{mealplan.ts → interface/mealplan.ts} +2 -0
- package/src/interface/menu.ts +649 -0
- package/src/{message.ts → interface/message.ts} +2 -0
- package/src/{order.ts → interface/order.ts} +21 -6
- package/src/{partner.ts → interface/partner.ts} +291 -5
- package/src/{payment.ts → interface/payment.ts} +4 -0
- package/src/{promo.ts → interface/promo.ts} +3 -0
- package/src/{report.ts → interface/report.ts} +4 -0
- package/src/{schedule.ts → interface/schedule.ts} +2 -0
- package/src/{shoppingcart.ts → interface/shoppingcart.ts} +14 -1
- package/src/{task.ts → interface/task.ts} +2 -0
- package/src/{user.ts → interface/user.ts} +34 -1
- package/src/{vote.ts → interface/vote.ts} +2 -0
- package/template.ejs +3 -3
- package/test/client.test.ts +192 -0
- package/test/gen.test.ts +22 -0
- package/lib/announcement.d.ts.map +0 -1
- package/lib/announcement.js +0 -3
- package/lib/announcement.js.map +0 -1
- package/lib/brand.d.ts.map +0 -1
- package/lib/brand.js +0 -3
- package/lib/brand.js.map +0 -1
- package/lib/calendar.d.ts.map +0 -1
- package/lib/calendar.js +0 -3
- package/lib/calendar.js.map +0 -1
- package/lib/config.d.ts.map +0 -1
- package/lib/config.js +0 -3
- package/lib/config.js.map +0 -1
- package/lib/datalake.d.ts.map +0 -1
- package/lib/datalake.js +0 -3
- package/lib/datalake.js.map +0 -1
- package/lib/delivery.d.ts.map +0 -1
- package/lib/delivery.js +0 -3
- package/lib/delivery.js.map +0 -1
- package/lib/dh.d.ts.map +0 -1
- package/lib/dh.js +0 -3
- package/lib/dh.js.map +0 -1
- package/lib/email.d.ts +0 -5
- package/lib/email.d.ts.map +0 -1
- package/lib/email.js +0 -3
- package/lib/email.js.map +0 -1
- package/lib/file.d.ts.map +0 -1
- package/lib/file.js +0 -3
- package/lib/file.js.map +0 -1
- package/lib/kds.d.ts.map +0 -1
- package/lib/kds.js +0 -3
- package/lib/kds.js.map +0 -1
- package/lib/location.d.ts.map +0 -1
- package/lib/location.js +0 -3
- package/lib/location.js.map +0 -1
- package/lib/logger.d.ts.map +0 -1
- package/lib/logger.js +0 -3
- package/lib/logger.js.map +0 -1
- package/lib/loyalty.d.ts.map +0 -1
- package/lib/loyalty.js +0 -3
- package/lib/loyalty.js.map +0 -1
- package/lib/mealplan.d.ts.map +0 -1
- package/lib/mealplan.js +0 -3
- package/lib/mealplan.js.map +0 -1
- package/lib/message.d.ts.map +0 -1
- package/lib/message.js +0 -3
- package/lib/message.js.map +0 -1
- package/lib/order.d.ts.map +0 -1
- package/lib/order.js +0 -3
- package/lib/order.js.map +0 -1
- package/lib/partner.d.ts.map +0 -1
- package/lib/partner.js +0 -3
- package/lib/partner.js.map +0 -1
- package/lib/payment.d.ts.map +0 -1
- package/lib/payment.js +0 -3
- package/lib/payment.js.map +0 -1
- package/lib/promo.d.ts.map +0 -1
- package/lib/promo.js +0 -3
- package/lib/promo.js.map +0 -1
- package/lib/report.d.ts.map +0 -1
- package/lib/report.js +0 -3
- package/lib/report.js.map +0 -1
- package/lib/schedule.d.ts.map +0 -1
- package/lib/schedule.js +0 -3
- package/lib/schedule.js.map +0 -1
- package/lib/shoppingcart.d.ts.map +0 -1
- package/lib/shoppingcart.js +0 -3
- package/lib/shoppingcart.js.map +0 -1
- package/lib/task.d.ts.map +0 -1
- package/lib/task.js +0 -3
- package/lib/task.js.map +0 -1
- package/lib/user.d.ts.map +0 -1
- package/lib/user.js +0 -3
- package/lib/user.js.map +0 -1
- package/lib/vote.d.ts.map +0 -1
- package/lib/vote.js +0 -3
- package/lib/vote.js.map +0 -1
- package/src/email.ts +0 -4
- /package/lib/{announcement.d.ts → interface/announcement.d.ts} +0 -0
- /package/lib/{brand.d.ts → interface/brand.d.ts} +0 -0
- /package/lib/{config.d.ts → interface/config.d.ts} +0 -0
- /package/lib/{datalake.d.ts → interface/datalake.d.ts} +0 -0
- /package/lib/{delivery.d.ts → interface/delivery.d.ts} +0 -0
- /package/lib/{dh.d.ts → interface/dh.d.ts} +0 -0
- /package/lib/{file.d.ts → interface/file.d.ts} +0 -0
- /package/lib/{logger.d.ts → interface/logger.d.ts} +0 -0
- /package/lib/{loyalty.d.ts → interface/loyalty.d.ts} +0 -0
- /package/lib/{mealplan.d.ts → interface/mealplan.d.ts} +0 -0
- /package/lib/{message.d.ts → interface/message.d.ts} +0 -0
- /package/lib/{schedule.d.ts → interface/schedule.d.ts} +0 -0
- /package/lib/{task.d.ts → interface/task.d.ts} +0 -0
- /package/lib/{vote.d.ts → interface/vote.d.ts} +0 -0
package/lib/base.js
CHANGED
|
@@ -64,9 +64,70 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
64
64
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
65
65
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
66
66
|
};
|
|
67
|
+
var _a;
|
|
67
68
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68
|
-
exports.BaseServiceClient = exports.ServiceError = void 0;
|
|
69
|
+
exports.BaseServiceClient = exports.ServiceError = exports.ResponsePromise = void 0;
|
|
69
70
|
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
71
|
+
/**
|
|
72
|
+
* We have to re-implement the promise methods instead of just existing
|
|
73
|
+
* the existing Promise class due to: https://github.com/microsoft/TypeScript/issues/15202
|
|
74
|
+
*/
|
|
75
|
+
var ResponsePromise = /** @class */ (function () {
|
|
76
|
+
function ResponsePromise(promise) {
|
|
77
|
+
this.promise = promise;
|
|
78
|
+
/**
|
|
79
|
+
* Implements Promise interface.
|
|
80
|
+
*/
|
|
81
|
+
this[_a] = "[object ResponsePromise]";
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Implements Promise interface.
|
|
85
|
+
*/
|
|
86
|
+
ResponsePromise.prototype.then = function (onfulfilled, onrejected) {
|
|
87
|
+
return new ResponsePromise(this.promise.then(onfulfilled, onrejected));
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Implements Promise interface.
|
|
91
|
+
*/
|
|
92
|
+
ResponsePromise.prototype.catch = function (onrejected) {
|
|
93
|
+
return new ResponsePromise(this.promise.catch(onrejected));
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Implements Promise interface.
|
|
97
|
+
*/
|
|
98
|
+
ResponsePromise.prototype.finally = function (onfinally) {
|
|
99
|
+
return new ResponsePromise(this.promise.finally(onfinally));
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Returns a promise that resolves to null if http status code
|
|
103
|
+
* or service error code matches one of the provided codes.
|
|
104
|
+
* If no codes are specified, all codes are ignored.
|
|
105
|
+
*/
|
|
106
|
+
ResponsePromise.prototype.ignore = function () {
|
|
107
|
+
var codes = [];
|
|
108
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
109
|
+
codes[_i] = arguments[_i];
|
|
110
|
+
}
|
|
111
|
+
return new ResponsePromise(ServiceError.ignore(codes, this.promise));
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Returns a promise that resolves to either the response body
|
|
115
|
+
* or a ServiceError.
|
|
116
|
+
*/
|
|
117
|
+
ResponsePromise.prototype.combine = function () {
|
|
118
|
+
var codes = [];
|
|
119
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
120
|
+
codes[_i] = arguments[_i];
|
|
121
|
+
}
|
|
122
|
+
return new ResponsePromise(ServiceError.combine(codes, this.promise));
|
|
123
|
+
};
|
|
124
|
+
return ResponsePromise;
|
|
125
|
+
}());
|
|
126
|
+
exports.ResponsePromise = ResponsePromise;
|
|
127
|
+
_a = Symbol.toStringTag;
|
|
128
|
+
/**
|
|
129
|
+
* An error returned from an api service.
|
|
130
|
+
*/
|
|
70
131
|
var ServiceError = /** @class */ (function (_super) {
|
|
71
132
|
__extends(ServiceError, _super);
|
|
72
133
|
function ServiceError(status, // http status
|
|
@@ -77,36 +138,136 @@ var ServiceError = /** @class */ (function (_super) {
|
|
|
77
138
|
_this.status = status;
|
|
78
139
|
_this.code = code;
|
|
79
140
|
_this.name = "ServiceError(" + code + ")";
|
|
141
|
+
// TODO: remove this if we change compilation target > es5
|
|
142
|
+
Object.setPrototypeOf(_this, ServiceError.prototype);
|
|
80
143
|
return _this;
|
|
81
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Returns the http status code from err.
|
|
147
|
+
* If err isn't an instance of ServiceError, -1 is returned.
|
|
148
|
+
*/
|
|
82
149
|
ServiceError.status = function (err) {
|
|
83
150
|
if (err instanceof ServiceError) {
|
|
84
151
|
return err.status;
|
|
85
152
|
}
|
|
86
153
|
return -1;
|
|
87
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* Returns the service error code from err.
|
|
157
|
+
* If err isn't an instance of ServiceError, -1 is returned.
|
|
158
|
+
*/
|
|
88
159
|
ServiceError.code = function (err) {
|
|
89
160
|
if (err instanceof ServiceError) {
|
|
90
161
|
return err.code;
|
|
91
162
|
}
|
|
92
163
|
return -1;
|
|
93
164
|
};
|
|
94
|
-
|
|
95
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Returns a promise that resolves to null if http status code
|
|
167
|
+
* or service error code matches one of the provided codes.
|
|
168
|
+
* If no codes are specified, all codes are ignored.
|
|
169
|
+
*/
|
|
170
|
+
ServiceError.ignore = function (codes, response) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
172
|
+
var err_1, _i, codes_1, code;
|
|
173
|
+
return __generator(this, function (_b) {
|
|
174
|
+
switch (_b.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
_b.trys.push([0, 2, , 3]);
|
|
177
|
+
return [4 /*yield*/, response];
|
|
178
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
179
|
+
case 2:
|
|
180
|
+
err_1 = _b.sent();
|
|
181
|
+
if (err_1 instanceof ServiceError) {
|
|
182
|
+
if (codes.length === 0) {
|
|
183
|
+
return [2 /*return*/, null];
|
|
184
|
+
}
|
|
185
|
+
for (_i = 0, codes_1 = codes; _i < codes_1.length; _i++) {
|
|
186
|
+
code = codes_1[_i];
|
|
187
|
+
if (err_1.status === code || err_1.code === code) {
|
|
188
|
+
return [2 /*return*/, null];
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
throw err_1;
|
|
193
|
+
case 3: return [2 /*return*/];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Returns a promise that resolves to either T or a ServiceError.
|
|
200
|
+
*/
|
|
201
|
+
ServiceError.combine = function (codes, response) {
|
|
202
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
203
|
+
var data, err_2, _i, codes_2, code;
|
|
204
|
+
return __generator(this, function (_b) {
|
|
205
|
+
switch (_b.label) {
|
|
206
|
+
case 0:
|
|
207
|
+
_b.trys.push([0, 2, , 3]);
|
|
208
|
+
return [4 /*yield*/, response];
|
|
209
|
+
case 1:
|
|
210
|
+
data = _b.sent();
|
|
211
|
+
return [2 /*return*/, { ok: true, data: data, err: null }];
|
|
212
|
+
case 2:
|
|
213
|
+
err_2 = _b.sent();
|
|
214
|
+
if (err_2 instanceof ServiceError) {
|
|
215
|
+
if (codes.length === 0) {
|
|
216
|
+
return [2 /*return*/, { ok: false, data: null, err: err_2 }];
|
|
217
|
+
}
|
|
218
|
+
for (_i = 0, codes_2 = codes; _i < codes_2.length; _i++) {
|
|
219
|
+
code = codes_2[_i];
|
|
220
|
+
if (err_2.status === code || err_2.code === code) {
|
|
221
|
+
return [2 /*return*/, { ok: false, data: null, err: err_2 }];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
throw err_2;
|
|
226
|
+
case 3: return [2 /*return*/];
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Constructs a ServiceError from the provided response data.
|
|
233
|
+
*/
|
|
234
|
+
ServiceError.from_res = function (res) {
|
|
235
|
+
var message = res.body;
|
|
96
236
|
var code = res.status;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
237
|
+
if (res.err) {
|
|
238
|
+
// network error
|
|
239
|
+
if (res.err instanceof Error) {
|
|
240
|
+
message = res.err.message;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
message = "Network Error";
|
|
102
244
|
}
|
|
245
|
+
code = 0;
|
|
103
246
|
}
|
|
104
|
-
|
|
105
|
-
|
|
247
|
+
else {
|
|
248
|
+
try {
|
|
249
|
+
var data = JSON.parse(res.body);
|
|
250
|
+
if (data.code && (data.message || data.error)) {
|
|
251
|
+
code = data.code;
|
|
252
|
+
message = data.message || data.error;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
catch (_) { }
|
|
256
|
+
}
|
|
257
|
+
var err = new ServiceError(res.status, code, message);
|
|
258
|
+
// override the stack trace so that it doesn't include the from_res helper.
|
|
259
|
+
if (Error.captureStackTrace) {
|
|
260
|
+
Error.captureStackTrace(err, ServiceError.from_res);
|
|
261
|
+
}
|
|
262
|
+
return err;
|
|
106
263
|
};
|
|
107
264
|
return ServiceError;
|
|
108
265
|
}(Error));
|
|
109
266
|
exports.ServiceError = ServiceError;
|
|
267
|
+
/**
|
|
268
|
+
* BaseServiceClient contains the logic for executing http requests.
|
|
269
|
+
* This class is meant to be extended by the generated code.
|
|
270
|
+
*/
|
|
110
271
|
var BaseServiceClient = /** @class */ (function () {
|
|
111
272
|
function BaseServiceClient(options) {
|
|
112
273
|
this.options = options !== null && options !== void 0 ? options : {};
|
|
@@ -114,8 +275,8 @@ var BaseServiceClient = /** @class */ (function () {
|
|
|
114
275
|
/**
|
|
115
276
|
* Combine the route and query parameters into a full url.
|
|
116
277
|
*/
|
|
117
|
-
BaseServiceClient.prototype.build_url = function (route,
|
|
118
|
-
var base_url =
|
|
278
|
+
BaseServiceClient.prototype.build_url = function (route, _b, params) {
|
|
279
|
+
var base_url = _b.base_url, _c = _b.stage, stage = _c === void 0 ? "dev" : _c;
|
|
119
280
|
var url = "https://api.compassdigital.org/" + stage + route;
|
|
120
281
|
// use the base url if one was provided.
|
|
121
282
|
if (base_url) {
|
|
@@ -126,8 +287,8 @@ var BaseServiceClient = /** @class */ (function () {
|
|
|
126
287
|
}
|
|
127
288
|
// add query parameters.
|
|
128
289
|
var query = [];
|
|
129
|
-
for (var _i = 0,
|
|
130
|
-
var
|
|
290
|
+
for (var _i = 0, _d = Object.entries(params); _i < _d.length; _i++) {
|
|
291
|
+
var _e = _d[_i], name_1 = _e[0], value = _e[1];
|
|
131
292
|
query.push(encodeURIComponent(name_1) + "=" + encodeURIComponent(value));
|
|
132
293
|
}
|
|
133
294
|
if (query.length > 0) {
|
|
@@ -135,66 +296,128 @@ var BaseServiceClient = /** @class */ (function () {
|
|
|
135
296
|
}
|
|
136
297
|
return url;
|
|
137
298
|
};
|
|
138
|
-
|
|
139
|
-
|
|
299
|
+
/**
|
|
300
|
+
* Perform the http request or pass it to the intercept function
|
|
301
|
+
* if one was configured.
|
|
302
|
+
*/
|
|
303
|
+
BaseServiceClient.prototype.fetch = function (req, options) {
|
|
304
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
305
|
+
var res, err_3;
|
|
306
|
+
var _b;
|
|
307
|
+
return __generator(this, function (_c) {
|
|
308
|
+
switch (_c.label) {
|
|
309
|
+
case 0:
|
|
310
|
+
if (options === null || options === void 0 ? void 0 : options.intercept) {
|
|
311
|
+
return [2 /*return*/, options.intercept(req, this.fetch.bind(this))];
|
|
312
|
+
}
|
|
313
|
+
_c.label = 1;
|
|
314
|
+
case 1:
|
|
315
|
+
_c.trys.push([1, 4, , 5]);
|
|
316
|
+
return [4 /*yield*/, (0, cross_fetch_1.default)(req.url, {
|
|
317
|
+
method: req.method,
|
|
318
|
+
body: req.body,
|
|
319
|
+
headers: req.headers,
|
|
320
|
+
})];
|
|
321
|
+
case 2:
|
|
322
|
+
res = _c.sent();
|
|
323
|
+
_b = {
|
|
324
|
+
ok: res.ok,
|
|
325
|
+
status: res.status
|
|
326
|
+
};
|
|
327
|
+
return [4 /*yield*/, res.text()];
|
|
328
|
+
case 3: return [2 /*return*/, (_b.body = _c.sent(),
|
|
329
|
+
_b)];
|
|
330
|
+
case 4:
|
|
331
|
+
err_3 = _c.sent();
|
|
332
|
+
return [2 /*return*/, {
|
|
333
|
+
ok: false,
|
|
334
|
+
status: 0,
|
|
335
|
+
body: "",
|
|
336
|
+
err: err_3,
|
|
337
|
+
}];
|
|
338
|
+
case 5: return [2 /*return*/];
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
});
|
|
140
342
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
343
|
+
/**
|
|
344
|
+
* Returns true if the status code represents a transient error
|
|
345
|
+
* or it's a network error.
|
|
346
|
+
*/
|
|
347
|
+
BaseServiceClient.prototype.should_retry = function (res) {
|
|
348
|
+
if (res.err) {
|
|
349
|
+
return true;
|
|
350
|
+
}
|
|
351
|
+
switch (res.status) {
|
|
352
|
+
case 408: // timeout
|
|
353
|
+
case 413: // too large
|
|
354
|
+
case 429: // too many requests
|
|
355
|
+
case 500: // generic error response
|
|
356
|
+
case 502: // invalid upstream response
|
|
357
|
+
case 503: // service unavailable
|
|
358
|
+
case 504: // gateway timeout
|
|
359
|
+
case 522: // tcp connection timeout
|
|
360
|
+
return true;
|
|
361
|
+
default:
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
146
364
|
};
|
|
365
|
+
/**
|
|
366
|
+
* Returns the merged options.
|
|
367
|
+
*/
|
|
368
|
+
BaseServiceClient.prototype.get_options = function (options) {
|
|
369
|
+
return __assign(__assign(__assign({}, this.options), options), { headers: __assign(__assign({}, this.options.headers), options.headers) });
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* A delegate to _request that wraps the response in a ResponsePromise.
|
|
373
|
+
*/
|
|
147
374
|
BaseServiceClient.prototype.request = function (service, name, method, route, body, options) {
|
|
148
|
-
|
|
375
|
+
if (options === void 0) { options = {}; }
|
|
376
|
+
var promise = this._request(service, name, method, route, body, options);
|
|
377
|
+
return new ResponsePromise(promise);
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* The main logic for fulfilling a request as perscribed by
|
|
381
|
+
* the request options.
|
|
382
|
+
*/
|
|
383
|
+
BaseServiceClient.prototype._request = function (service, name, method, route, body, options) {
|
|
384
|
+
var _b;
|
|
149
385
|
if (options === void 0) { options = {}; }
|
|
150
386
|
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
-
var url, headers, req, res,
|
|
152
|
-
return __generator(this, function (
|
|
153
|
-
switch (
|
|
387
|
+
var url, headers, req, res, err, data;
|
|
388
|
+
return __generator(this, function (_c) {
|
|
389
|
+
switch (_c.label) {
|
|
154
390
|
case 0:
|
|
155
|
-
options = this.get_options(
|
|
156
|
-
url = this.build_url(route, options, (
|
|
391
|
+
options = this.get_options(options);
|
|
392
|
+
url = this.build_url(route, options, (_b = options.query) !== null && _b !== void 0 ? _b : {});
|
|
157
393
|
headers = Object.assign({
|
|
158
394
|
"User-Agent": "CDL/ServiceClient"
|
|
159
395
|
}, options.headers);
|
|
160
396
|
if (options.token) {
|
|
161
397
|
headers["Authorization"] = "Bearer " + options.token;
|
|
162
398
|
}
|
|
163
|
-
req = {
|
|
164
|
-
method: method,
|
|
165
|
-
headers: headers,
|
|
166
|
-
};
|
|
399
|
+
req = { name: name, service: service, url: url, method: method, headers: headers };
|
|
167
400
|
if (body) {
|
|
168
401
|
req.body = JSON.stringify(body);
|
|
169
402
|
}
|
|
170
403
|
if (options.debug) {
|
|
171
404
|
console.log("REQ(" + method.toUpperCase() + ")", url, JSON.stringify(req, null, 2));
|
|
172
405
|
}
|
|
173
|
-
return [4 /*yield*/,
|
|
406
|
+
return [4 /*yield*/, this.fetch(req, options)];
|
|
174
407
|
case 1:
|
|
175
|
-
res =
|
|
176
|
-
if (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
err = ServiceError.from_res(res, text);
|
|
181
|
-
if (options.debug) {
|
|
182
|
-
console.log("ERR(" + res.status + ")", url, err.message);
|
|
183
|
-
}
|
|
184
|
-
for (_i = 0, _c = (_b = options.allow) !== null && _b !== void 0 ? _b : []; _i < _c.length; _i++) {
|
|
185
|
-
code = _c[_i];
|
|
186
|
-
if (err.status === code || err.code === code) {
|
|
187
|
-
return [2 /*return*/, null];
|
|
408
|
+
res = _c.sent();
|
|
409
|
+
if (!res.ok) {
|
|
410
|
+
err = ServiceError.from_res(res);
|
|
411
|
+
if (options.debug) {
|
|
412
|
+
console.log("ERR(" + res.status + ")", url, err.message);
|
|
188
413
|
}
|
|
414
|
+
if (typeof options.retry === "number" && options.retry > 0 && this.should_retry(res)) {
|
|
415
|
+
options.retry--;
|
|
416
|
+
return [2 /*return*/, this.request(service, name, method, route, body, options)];
|
|
417
|
+
}
|
|
418
|
+
throw err;
|
|
189
419
|
}
|
|
190
|
-
|
|
191
|
-
options.retry--;
|
|
192
|
-
return [2 /*return*/, this.request(service, name, method, route, body, options)];
|
|
193
|
-
}
|
|
194
|
-
throw err;
|
|
195
|
-
case 3: return [4 /*yield*/, res.json()];
|
|
196
|
-
case 4:
|
|
197
|
-
data = _d.sent();
|
|
420
|
+
data = res.body ? JSON.parse(res.body) : res.body;
|
|
198
421
|
if (options.debug) {
|
|
199
422
|
console.log("RES(" + res.status + ")", url, JSON.stringify(data, null, 2));
|
|
200
423
|
}
|
package/lib/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4DAAgC;AAsDhC;;;GAGG;AACH;IAOE,yBAAoB,OAAmB;QAAnB,YAAO,GAAP,OAAO,CAAY;QALvC;;WAEG;QACH,QAAoB,GAAG,0BAA0B,CAAC;IAER,CAAC;IAE3C;;OAEG;IACH,8BAAI,GAAJ,UACE,WAAqE,EACrE,UAAuE;QAEvE,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;IACzE,CAAC;IAED;;OAEG;IACH,+BAAK,GAAL,UACE,UAAqE;QAErE,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH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