files.com 1.0.149 → 1.0.150
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/_VERSION +1 -1
- package/lib/models/As2IncomingMessage.js +160 -0
- package/lib/models/As2OutgoingMessage.js +151 -0
- package/lib/models/{As2Key.js → As2Partner.js} +104 -87
- package/lib/models/As2Station.js +504 -0
- package/package.json +1 -1
- package/src/models/As2IncomingMessage.js +94 -0
- package/src/models/As2OutgoingMessage.js +85 -0
- package/src/models/As2Partner.js +233 -0
- package/src/models/As2Station.js +264 -0
- package/src/models/HistoryExport.js +2 -2
- package/src/models/HistoryExportResult.js +1 -1
- package/src/models/As2Key.js +0 -221
@@ -0,0 +1,504 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
exports.__esModule = true;
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
9
|
+
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
11
|
+
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
13
|
+
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
15
|
+
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
17
|
+
|
18
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
19
|
+
|
20
|
+
var _Api = _interopRequireDefault(require("../Api"));
|
21
|
+
|
22
|
+
var _Logger = _interopRequireDefault(require("../Logger"));
|
23
|
+
|
24
|
+
var _utils = require("../utils");
|
25
|
+
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
27
|
+
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Class As2Station
|
32
|
+
*/
|
33
|
+
var As2Station = /*#__PURE__*/(0, _createClass2.default)(function As2Station() {
|
34
|
+
var _this = this;
|
35
|
+
|
36
|
+
var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
37
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
38
|
+
(0, _classCallCheck2.default)(this, As2Station);
|
39
|
+
(0, _defineProperty2.default)(this, "attributes", {});
|
40
|
+
(0, _defineProperty2.default)(this, "options", {});
|
41
|
+
(0, _defineProperty2.default)(this, "isLoaded", function () {
|
42
|
+
return !!_this.attributes.id;
|
43
|
+
});
|
44
|
+
(0, _defineProperty2.default)(this, "getId", function () {
|
45
|
+
return _this.attributes.id;
|
46
|
+
});
|
47
|
+
(0, _defineProperty2.default)(this, "setId", function (value) {
|
48
|
+
_this.attributes.id = value;
|
49
|
+
});
|
50
|
+
(0, _defineProperty2.default)(this, "getName", function () {
|
51
|
+
return _this.attributes.name;
|
52
|
+
});
|
53
|
+
(0, _defineProperty2.default)(this, "setName", function (value) {
|
54
|
+
_this.attributes.name = value;
|
55
|
+
});
|
56
|
+
(0, _defineProperty2.default)(this, "getUri", function () {
|
57
|
+
return _this.attributes.uri;
|
58
|
+
});
|
59
|
+
(0, _defineProperty2.default)(this, "setUri", function (value) {
|
60
|
+
_this.attributes.uri = value;
|
61
|
+
});
|
62
|
+
(0, _defineProperty2.default)(this, "getDomain", function () {
|
63
|
+
return _this.attributes.domain;
|
64
|
+
});
|
65
|
+
(0, _defineProperty2.default)(this, "setDomain", function (value) {
|
66
|
+
_this.attributes.domain = value;
|
67
|
+
});
|
68
|
+
(0, _defineProperty2.default)(this, "getPublicCertificate", function () {
|
69
|
+
return _this.attributes.public_certificate;
|
70
|
+
});
|
71
|
+
(0, _defineProperty2.default)(this, "setPublicCertificate", function (value) {
|
72
|
+
_this.attributes.public_certificate = value;
|
73
|
+
});
|
74
|
+
(0, _defineProperty2.default)(this, "getPublicCertificateMd5", function () {
|
75
|
+
return _this.attributes.public_certificate_md5;
|
76
|
+
});
|
77
|
+
(0, _defineProperty2.default)(this, "setPublicCertificateMd5", function (value) {
|
78
|
+
_this.attributes.public_certificate_md5 = value;
|
79
|
+
});
|
80
|
+
(0, _defineProperty2.default)(this, "getPrivateKeyMd5", function () {
|
81
|
+
return _this.attributes.private_key_md5;
|
82
|
+
});
|
83
|
+
(0, _defineProperty2.default)(this, "setPrivateKeyMd5", function (value) {
|
84
|
+
_this.attributes.private_key_md5 = value;
|
85
|
+
});
|
86
|
+
(0, _defineProperty2.default)(this, "getPrivateKey", function () {
|
87
|
+
return _this.attributes.private_key;
|
88
|
+
});
|
89
|
+
(0, _defineProperty2.default)(this, "setPrivateKey", function (value) {
|
90
|
+
_this.attributes.private_key = value;
|
91
|
+
});
|
92
|
+
(0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
93
|
+
var params,
|
94
|
+
_args = arguments;
|
95
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
96
|
+
while (1) {
|
97
|
+
switch (_context.prev = _context.next) {
|
98
|
+
case 0:
|
99
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
100
|
+
|
101
|
+
if (_this.attributes.id) {
|
102
|
+
_context.next = 3;
|
103
|
+
break;
|
104
|
+
}
|
105
|
+
|
106
|
+
throw new Error('Current object has no id');
|
107
|
+
|
108
|
+
case 3:
|
109
|
+
if ((0, _utils.isObject)(params)) {
|
110
|
+
_context.next = 5;
|
111
|
+
break;
|
112
|
+
}
|
113
|
+
|
114
|
+
throw new Error("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
115
|
+
|
116
|
+
case 5:
|
117
|
+
params.id = _this.attributes.id;
|
118
|
+
|
119
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
120
|
+
_context.next = 8;
|
121
|
+
break;
|
122
|
+
}
|
123
|
+
|
124
|
+
throw new Error("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
125
|
+
|
126
|
+
case 8:
|
127
|
+
if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
|
128
|
+
_context.next = 10;
|
129
|
+
break;
|
130
|
+
}
|
131
|
+
|
132
|
+
throw new Error("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(name)));
|
133
|
+
|
134
|
+
case 10:
|
135
|
+
if (!(params['domain'] && !(0, _utils.isString)(params['domain']))) {
|
136
|
+
_context.next = 12;
|
137
|
+
break;
|
138
|
+
}
|
139
|
+
|
140
|
+
throw new Error("Bad parameter: domain must be of type String, received ".concat((0, _utils.getType)(domain)));
|
141
|
+
|
142
|
+
case 12:
|
143
|
+
if (!(params['uri'] && !(0, _utils.isString)(params['uri']))) {
|
144
|
+
_context.next = 14;
|
145
|
+
break;
|
146
|
+
}
|
147
|
+
|
148
|
+
throw new Error("Bad parameter: uri must be of type String, received ".concat((0, _utils.getType)(uri)));
|
149
|
+
|
150
|
+
case 14:
|
151
|
+
if (!(params['public_certificate'] && !(0, _utils.isString)(params['public_certificate']))) {
|
152
|
+
_context.next = 16;
|
153
|
+
break;
|
154
|
+
}
|
155
|
+
|
156
|
+
throw new Error("Bad parameter: public_certificate must be of type String, received ".concat((0, _utils.getType)(public_certificate)));
|
157
|
+
|
158
|
+
case 16:
|
159
|
+
if (!(params['private_key'] && !(0, _utils.isString)(params['private_key']))) {
|
160
|
+
_context.next = 18;
|
161
|
+
break;
|
162
|
+
}
|
163
|
+
|
164
|
+
throw new Error("Bad parameter: private_key must be of type String, received ".concat((0, _utils.getType)(private_key)));
|
165
|
+
|
166
|
+
case 18:
|
167
|
+
if (params['id']) {
|
168
|
+
_context.next = 24;
|
169
|
+
break;
|
170
|
+
}
|
171
|
+
|
172
|
+
if (!_this.attributes.id) {
|
173
|
+
_context.next = 23;
|
174
|
+
break;
|
175
|
+
}
|
176
|
+
|
177
|
+
params['id'] = _this.id;
|
178
|
+
_context.next = 24;
|
179
|
+
break;
|
180
|
+
|
181
|
+
case 23:
|
182
|
+
throw new Error('Parameter missing: id');
|
183
|
+
|
184
|
+
case 24:
|
185
|
+
return _context.abrupt("return", _Api.default.sendRequest("/as2_stations/".concat(params['id']), 'PATCH', params, _this.options));
|
186
|
+
|
187
|
+
case 25:
|
188
|
+
case "end":
|
189
|
+
return _context.stop();
|
190
|
+
}
|
191
|
+
}
|
192
|
+
}, _callee);
|
193
|
+
})));
|
194
|
+
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
195
|
+
var params,
|
196
|
+
_args2 = arguments;
|
197
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
198
|
+
while (1) {
|
199
|
+
switch (_context2.prev = _context2.next) {
|
200
|
+
case 0:
|
201
|
+
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
202
|
+
|
203
|
+
if (_this.attributes.id) {
|
204
|
+
_context2.next = 3;
|
205
|
+
break;
|
206
|
+
}
|
207
|
+
|
208
|
+
throw new Error('Current object has no id');
|
209
|
+
|
210
|
+
case 3:
|
211
|
+
if ((0, _utils.isObject)(params)) {
|
212
|
+
_context2.next = 5;
|
213
|
+
break;
|
214
|
+
}
|
215
|
+
|
216
|
+
throw new Error("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
217
|
+
|
218
|
+
case 5:
|
219
|
+
params.id = _this.attributes.id;
|
220
|
+
|
221
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
222
|
+
_context2.next = 8;
|
223
|
+
break;
|
224
|
+
}
|
225
|
+
|
226
|
+
throw new Error("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
227
|
+
|
228
|
+
case 8:
|
229
|
+
if (params['id']) {
|
230
|
+
_context2.next = 14;
|
231
|
+
break;
|
232
|
+
}
|
233
|
+
|
234
|
+
if (!_this.attributes.id) {
|
235
|
+
_context2.next = 13;
|
236
|
+
break;
|
237
|
+
}
|
238
|
+
|
239
|
+
params['id'] = _this.id;
|
240
|
+
_context2.next = 14;
|
241
|
+
break;
|
242
|
+
|
243
|
+
case 13:
|
244
|
+
throw new Error('Parameter missing: id');
|
245
|
+
|
246
|
+
case 14:
|
247
|
+
return _context2.abrupt("return", _Api.default.sendRequest("/as2_stations/".concat(params['id']), 'DELETE', params, _this.options));
|
248
|
+
|
249
|
+
case 15:
|
250
|
+
case "end":
|
251
|
+
return _context2.stop();
|
252
|
+
}
|
253
|
+
}
|
254
|
+
}, _callee2);
|
255
|
+
})));
|
256
|
+
(0, _defineProperty2.default)(this, "destroy", function () {
|
257
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
258
|
+
return _this.delete(params);
|
259
|
+
});
|
260
|
+
(0, _defineProperty2.default)(this, "save", function () {
|
261
|
+
if (_this.attributes['id']) {
|
262
|
+
return _this.update(_this.attributes);
|
263
|
+
} else {
|
264
|
+
var newObject = As2Station.create(_this.attributes, _this.options);
|
265
|
+
_this.attributes = _objectSpread({}, newObject.attributes);
|
266
|
+
return true;
|
267
|
+
}
|
268
|
+
});
|
269
|
+
Object.entries(attributes).forEach(function (_ref3) {
|
270
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
271
|
+
key = _ref4[0],
|
272
|
+
value = _ref4[1];
|
273
|
+
|
274
|
+
var normalizedKey = key.replace('?', '');
|
275
|
+
_this.attributes[normalizedKey] = value;
|
276
|
+
Object.defineProperty(_this, normalizedKey, {
|
277
|
+
value: value,
|
278
|
+
writable: false
|
279
|
+
});
|
280
|
+
});
|
281
|
+
this.options = _objectSpread({}, options);
|
282
|
+
});
|
283
|
+
(0, _defineProperty2.default)(As2Station, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
284
|
+
var _response$data;
|
285
|
+
|
286
|
+
var params,
|
287
|
+
options,
|
288
|
+
response,
|
289
|
+
_args3 = arguments;
|
290
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
291
|
+
while (1) {
|
292
|
+
switch (_context3.prev = _context3.next) {
|
293
|
+
case 0:
|
294
|
+
params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
295
|
+
options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
296
|
+
|
297
|
+
if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
|
298
|
+
_context3.next = 4;
|
299
|
+
break;
|
300
|
+
}
|
301
|
+
|
302
|
+
throw new Error("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(cursor)));
|
303
|
+
|
304
|
+
case 4:
|
305
|
+
if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
|
306
|
+
_context3.next = 6;
|
307
|
+
break;
|
308
|
+
}
|
309
|
+
|
310
|
+
throw new Error("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(per_page)));
|
311
|
+
|
312
|
+
case 6:
|
313
|
+
_context3.next = 8;
|
314
|
+
return _Api.default.sendRequest("/as2_stations", 'GET', params, options);
|
315
|
+
|
316
|
+
case 8:
|
317
|
+
response = _context3.sent;
|
318
|
+
return _context3.abrupt("return", (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
319
|
+
return new As2Station(obj, options);
|
320
|
+
})) || []);
|
321
|
+
|
322
|
+
case 10:
|
323
|
+
case "end":
|
324
|
+
return _context3.stop();
|
325
|
+
}
|
326
|
+
}
|
327
|
+
}, _callee3);
|
328
|
+
})));
|
329
|
+
(0, _defineProperty2.default)(As2Station, "all", function () {
|
330
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
331
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
332
|
+
return As2Station.list(params, options);
|
333
|
+
});
|
334
|
+
(0, _defineProperty2.default)(As2Station, "find", /*#__PURE__*/function () {
|
335
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(id) {
|
336
|
+
var params,
|
337
|
+
options,
|
338
|
+
response,
|
339
|
+
_args4 = arguments;
|
340
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
341
|
+
while (1) {
|
342
|
+
switch (_context4.prev = _context4.next) {
|
343
|
+
case 0:
|
344
|
+
params = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
345
|
+
options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
|
346
|
+
|
347
|
+
if ((0, _utils.isObject)(params)) {
|
348
|
+
_context4.next = 4;
|
349
|
+
break;
|
350
|
+
}
|
351
|
+
|
352
|
+
throw new Error("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
353
|
+
|
354
|
+
case 4:
|
355
|
+
params['id'] = id;
|
356
|
+
|
357
|
+
if (params['id']) {
|
358
|
+
_context4.next = 7;
|
359
|
+
break;
|
360
|
+
}
|
361
|
+
|
362
|
+
throw new Error('Parameter missing: id');
|
363
|
+
|
364
|
+
case 7:
|
365
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
366
|
+
_context4.next = 9;
|
367
|
+
break;
|
368
|
+
}
|
369
|
+
|
370
|
+
throw new Error("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
371
|
+
|
372
|
+
case 9:
|
373
|
+
_context4.next = 11;
|
374
|
+
return _Api.default.sendRequest("/as2_stations/".concat(params['id']), 'GET', params, options);
|
375
|
+
|
376
|
+
case 11:
|
377
|
+
response = _context4.sent;
|
378
|
+
return _context4.abrupt("return", new As2Station(response === null || response === void 0 ? void 0 : response.data, options));
|
379
|
+
|
380
|
+
case 13:
|
381
|
+
case "end":
|
382
|
+
return _context4.stop();
|
383
|
+
}
|
384
|
+
}
|
385
|
+
}, _callee4);
|
386
|
+
}));
|
387
|
+
|
388
|
+
return function (_x) {
|
389
|
+
return _ref6.apply(this, arguments);
|
390
|
+
};
|
391
|
+
}());
|
392
|
+
(0, _defineProperty2.default)(As2Station, "get", function (id) {
|
393
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
394
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
395
|
+
return As2Station.find(id, params, options);
|
396
|
+
});
|
397
|
+
(0, _defineProperty2.default)(As2Station, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
398
|
+
var params,
|
399
|
+
options,
|
400
|
+
response,
|
401
|
+
_args5 = arguments;
|
402
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
403
|
+
while (1) {
|
404
|
+
switch (_context5.prev = _context5.next) {
|
405
|
+
case 0:
|
406
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
407
|
+
options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
408
|
+
|
409
|
+
if (params['name']) {
|
410
|
+
_context5.next = 4;
|
411
|
+
break;
|
412
|
+
}
|
413
|
+
|
414
|
+
throw new Error('Parameter missing: name');
|
415
|
+
|
416
|
+
case 4:
|
417
|
+
if (params['domain']) {
|
418
|
+
_context5.next = 6;
|
419
|
+
break;
|
420
|
+
}
|
421
|
+
|
422
|
+
throw new Error('Parameter missing: domain');
|
423
|
+
|
424
|
+
case 6:
|
425
|
+
if (params['uri']) {
|
426
|
+
_context5.next = 8;
|
427
|
+
break;
|
428
|
+
}
|
429
|
+
|
430
|
+
throw new Error('Parameter missing: uri');
|
431
|
+
|
432
|
+
case 8:
|
433
|
+
if (params['public_certificate']) {
|
434
|
+
_context5.next = 10;
|
435
|
+
break;
|
436
|
+
}
|
437
|
+
|
438
|
+
throw new Error('Parameter missing: public_certificate');
|
439
|
+
|
440
|
+
case 10:
|
441
|
+
if (params['private_key']) {
|
442
|
+
_context5.next = 12;
|
443
|
+
break;
|
444
|
+
}
|
445
|
+
|
446
|
+
throw new Error('Parameter missing: private_key');
|
447
|
+
|
448
|
+
case 12:
|
449
|
+
if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
|
450
|
+
_context5.next = 14;
|
451
|
+
break;
|
452
|
+
}
|
453
|
+
|
454
|
+
throw new Error("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(name)));
|
455
|
+
|
456
|
+
case 14:
|
457
|
+
if (!(params['domain'] && !(0, _utils.isString)(params['domain']))) {
|
458
|
+
_context5.next = 16;
|
459
|
+
break;
|
460
|
+
}
|
461
|
+
|
462
|
+
throw new Error("Bad parameter: domain must be of type String, received ".concat((0, _utils.getType)(domain)));
|
463
|
+
|
464
|
+
case 16:
|
465
|
+
if (!(params['uri'] && !(0, _utils.isString)(params['uri']))) {
|
466
|
+
_context5.next = 18;
|
467
|
+
break;
|
468
|
+
}
|
469
|
+
|
470
|
+
throw new Error("Bad parameter: uri must be of type String, received ".concat((0, _utils.getType)(uri)));
|
471
|
+
|
472
|
+
case 18:
|
473
|
+
if (!(params['public_certificate'] && !(0, _utils.isString)(params['public_certificate']))) {
|
474
|
+
_context5.next = 20;
|
475
|
+
break;
|
476
|
+
}
|
477
|
+
|
478
|
+
throw new Error("Bad parameter: public_certificate must be of type String, received ".concat((0, _utils.getType)(public_certificate)));
|
479
|
+
|
480
|
+
case 20:
|
481
|
+
if (!(params['private_key'] && !(0, _utils.isString)(params['private_key']))) {
|
482
|
+
_context5.next = 22;
|
483
|
+
break;
|
484
|
+
}
|
485
|
+
|
486
|
+
throw new Error("Bad parameter: private_key must be of type String, received ".concat((0, _utils.getType)(private_key)));
|
487
|
+
|
488
|
+
case 22:
|
489
|
+
_context5.next = 24;
|
490
|
+
return _Api.default.sendRequest("/as2_stations", 'POST', params, options);
|
491
|
+
|
492
|
+
case 24:
|
493
|
+
response = _context5.sent;
|
494
|
+
return _context5.abrupt("return", new As2Station(response === null || response === void 0 ? void 0 : response.data, options));
|
495
|
+
|
496
|
+
case 26:
|
497
|
+
case "end":
|
498
|
+
return _context5.stop();
|
499
|
+
}
|
500
|
+
}
|
501
|
+
}, _callee5);
|
502
|
+
})));
|
503
|
+
var _default = As2Station;
|
504
|
+
exports.default = _default;
|
package/package.json
CHANGED
@@ -0,0 +1,94 @@
|
|
1
|
+
import Api from '../Api'
|
2
|
+
import Logger from '../Logger'
|
3
|
+
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Class As2IncomingMessage
|
7
|
+
*/
|
8
|
+
class As2IncomingMessage {
|
9
|
+
attributes = {}
|
10
|
+
options = {}
|
11
|
+
|
12
|
+
constructor(attributes = {}, options = {}) {
|
13
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
14
|
+
const normalizedKey = key.replace('?', '')
|
15
|
+
|
16
|
+
this.attributes[normalizedKey] = value
|
17
|
+
|
18
|
+
Object.defineProperty(this, normalizedKey, { value, writable: false })
|
19
|
+
})
|
20
|
+
|
21
|
+
this.options = { ...options }
|
22
|
+
}
|
23
|
+
|
24
|
+
isLoaded = () => !!this.attributes.id
|
25
|
+
// int64 # Id of the AS2 Partner.
|
26
|
+
getId = () => this.attributes.id
|
27
|
+
|
28
|
+
// int64 # Id of the AS2 Partner associated with this message.
|
29
|
+
getAs2PartnerId = () => this.attributes.as2_partner_id
|
30
|
+
|
31
|
+
// string # UUID assigned to this message.
|
32
|
+
getUuid = () => this.attributes.uuid
|
33
|
+
|
34
|
+
// string # Content Type header of the incoming message.
|
35
|
+
getContentType = () => this.attributes.content_type
|
36
|
+
|
37
|
+
// object # HTTP Headers sent with this message.
|
38
|
+
getHttpHeaders = () => this.attributes.http_headers
|
39
|
+
|
40
|
+
// string # JSON Structure of the activity log.
|
41
|
+
getActivityLog = () => this.attributes.activity_log
|
42
|
+
|
43
|
+
// string # Result of processing. Valid values: `unable_to_find_station`, `unable_to_find_partner`, `unable_to_validate_signature`, `decrypt_fail`, `file_save_fail`, `success`
|
44
|
+
getProcessingResult = () => this.attributes.processing_result
|
45
|
+
|
46
|
+
// string # AS2 TO header of message
|
47
|
+
getAs2To = () => this.attributes.as2_to
|
48
|
+
|
49
|
+
// string # AS2 FROM header of message
|
50
|
+
getAs2From = () => this.attributes.as2_from
|
51
|
+
|
52
|
+
// string # AS2 Message Id
|
53
|
+
getMessageId = () => this.attributes.message_id
|
54
|
+
|
55
|
+
// string # AS2 Subject Header
|
56
|
+
getSubject = () => this.attributes.subject
|
57
|
+
|
58
|
+
// string # Encrypted Payload Body Size
|
59
|
+
getBodySize = () => this.attributes.body_size
|
60
|
+
|
61
|
+
// string # Filename of the file being received.
|
62
|
+
getAttachmentFilename = () => this.attributes.attachment_filename
|
63
|
+
|
64
|
+
// date-time # Message creation date/time
|
65
|
+
getCreatedAt = () => this.attributes.created_at
|
66
|
+
|
67
|
+
|
68
|
+
// Parameters:
|
69
|
+
// cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
|
70
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
71
|
+
// as2_partner_id - int64 - As2 Partner ID. If provided, will return message specific to that partner.
|
72
|
+
static list = async (params = {}, options = {}) => {
|
73
|
+
if (params['cursor'] && !isString(params['cursor'])) {
|
74
|
+
throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
|
75
|
+
}
|
76
|
+
|
77
|
+
if (params['per_page'] && !isInt(params['per_page'])) {
|
78
|
+
throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
|
79
|
+
}
|
80
|
+
|
81
|
+
if (params['as2_partner_id'] && !isInt(params['as2_partner_id'])) {
|
82
|
+
throw new Error(`Bad parameter: as2_partner_id must be of type Int, received ${getType(as2_partner_id)}`)
|
83
|
+
}
|
84
|
+
|
85
|
+
const response = await Api.sendRequest(`/as2_incoming_messages`, 'GET', params, options)
|
86
|
+
|
87
|
+
return response?.data?.map(obj => new As2IncomingMessage(obj, options)) || []
|
88
|
+
}
|
89
|
+
|
90
|
+
static all = (params = {}, options = {}) =>
|
91
|
+
As2IncomingMessage.list(params, options)
|
92
|
+
}
|
93
|
+
|
94
|
+
export default As2IncomingMessage
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import Api from '../Api'
|
2
|
+
import Logger from '../Logger'
|
3
|
+
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Class As2OutgoingMessage
|
7
|
+
*/
|
8
|
+
class As2OutgoingMessage {
|
9
|
+
attributes = {}
|
10
|
+
options = {}
|
11
|
+
|
12
|
+
constructor(attributes = {}, options = {}) {
|
13
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
14
|
+
const normalizedKey = key.replace('?', '')
|
15
|
+
|
16
|
+
this.attributes[normalizedKey] = value
|
17
|
+
|
18
|
+
Object.defineProperty(this, normalizedKey, { value, writable: false })
|
19
|
+
})
|
20
|
+
|
21
|
+
this.options = { ...options }
|
22
|
+
}
|
23
|
+
|
24
|
+
isLoaded = () => !!this.attributes.id
|
25
|
+
// int64 # Id of the AS2 Partner.
|
26
|
+
getId = () => this.attributes.id
|
27
|
+
|
28
|
+
// int64 # Id of the AS2 Partner associated with this message.
|
29
|
+
getAs2PartnerId = () => this.attributes.as2_partner_id
|
30
|
+
|
31
|
+
// string # UUID assigned to this message.
|
32
|
+
getUuid = () => this.attributes.uuid
|
33
|
+
|
34
|
+
// object # HTTP Headers sent with this message.
|
35
|
+
getHttpHeaders = () => this.attributes.http_headers
|
36
|
+
|
37
|
+
// string # JSON Structure of the activity log.
|
38
|
+
getActivityLog = () => this.attributes.activity_log
|
39
|
+
|
40
|
+
// string # Result of processing. Valid values: `send_failed`, `send_success`
|
41
|
+
getProcessingResult = () => this.attributes.processing_result
|
42
|
+
|
43
|
+
// string # AS2 Message Integrity Check
|
44
|
+
getMic = () => this.attributes.mic
|
45
|
+
|
46
|
+
// string # AS2 Message Id
|
47
|
+
getMessageId = () => this.attributes.message_id
|
48
|
+
|
49
|
+
// string # Encrypted Payload Body Size
|
50
|
+
getBodySize = () => this.attributes.body_size
|
51
|
+
|
52
|
+
// string # Filename of the file being sent.
|
53
|
+
getAttachmentFilename = () => this.attributes.attachment_filename
|
54
|
+
|
55
|
+
// date-time # Message creation date/time
|
56
|
+
getCreatedAt = () => this.attributes.created_at
|
57
|
+
|
58
|
+
|
59
|
+
// Parameters:
|
60
|
+
// cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
|
61
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
62
|
+
// as2_partner_id - int64 - As2 Partner ID. If provided, will return message specific to that partner.
|
63
|
+
static list = async (params = {}, options = {}) => {
|
64
|
+
if (params['cursor'] && !isString(params['cursor'])) {
|
65
|
+
throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
|
66
|
+
}
|
67
|
+
|
68
|
+
if (params['per_page'] && !isInt(params['per_page'])) {
|
69
|
+
throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
|
70
|
+
}
|
71
|
+
|
72
|
+
if (params['as2_partner_id'] && !isInt(params['as2_partner_id'])) {
|
73
|
+
throw new Error(`Bad parameter: as2_partner_id must be of type Int, received ${getType(as2_partner_id)}`)
|
74
|
+
}
|
75
|
+
|
76
|
+
const response = await Api.sendRequest(`/as2_outgoing_messages`, 'GET', params, options)
|
77
|
+
|
78
|
+
return response?.data?.map(obj => new As2OutgoingMessage(obj, options)) || []
|
79
|
+
}
|
80
|
+
|
81
|
+
static all = (params = {}, options = {}) =>
|
82
|
+
As2OutgoingMessage.list(params, options)
|
83
|
+
}
|
84
|
+
|
85
|
+
export default As2OutgoingMessage
|