@artaio/node-api 1.8.0 → 1.9.1
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/lib/ArtaClient.js +57 -144
- package/dist/lib/arta.js +29 -30
- package/dist/lib/endpoint/addressVerifications.js +13 -16
- package/dist/lib/endpoint/attachment.js +13 -16
- package/dist/lib/endpoint/emailRules.js +16 -19
- package/dist/lib/endpoint/emailSubscriptions.js +16 -19
- package/dist/lib/endpoint/endpoint.js +44 -160
- package/dist/lib/endpoint/hostedSessions.js +19 -70
- package/dist/lib/endpoint/invoicePayments.js +17 -27
- package/dist/lib/endpoint/invoices.js +11 -14
- package/dist/lib/endpoint/keys.js +15 -18
- package/dist/lib/endpoint/logs.js +17 -27
- package/dist/lib/endpoint/metadata.js +63 -64
- package/dist/lib/endpoint/organization.js +12 -67
- package/dist/lib/endpoint/payments.js +17 -27
- package/dist/lib/endpoint/requests.js +35 -113
- package/dist/lib/endpoint/selfShipCollectionAvailabilityChecks.js +6 -47
- package/dist/lib/endpoint/selfShipCollections.js +13 -16
- package/dist/lib/endpoint/shipments.d.ts +3 -0
- package/dist/lib/endpoint/shipments.js +21 -23
- package/dist/lib/endpoint/tags.js +13 -16
- package/dist/lib/endpoint/trackings.js +12 -66
- package/dist/lib/endpoint/uploads.js +13 -16
- package/dist/lib/endpoint/webhookDeliveries.js +9 -12
- package/dist/lib/endpoint/webhooks.js +37 -112
- package/dist/lib/error.js +14 -35
- package/dist/lib/logging.js +18 -48
- package/dist/lib/net/FetchHttpClient.js +43 -108
- package/dist/lib/queryParams.js +5 -6
- package/dist/lib/types.d.ts +3 -3
- package/dist/lib/utils.js +10 -17
- package/dist/package.json +24 -18
- package/package.json +24 -18
|
@@ -1,45 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.OrganizationsEndpoint = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
class OrganizationsEndpoint {
|
|
6
|
+
constructor(artaClient) {
|
|
43
7
|
this.artaClient = artaClient;
|
|
44
8
|
this.path = '/organization';
|
|
45
9
|
}
|
|
@@ -48,37 +12,18 @@ var OrganizationsEndpoint = /** @class */ (function () {
|
|
|
48
12
|
* @returns The Organization
|
|
49
13
|
* @throws ArtaSDKError thrown if some problem happened while communicating with the API.
|
|
50
14
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
switch (_a.label) {
|
|
56
|
-
case 0: return [4 /*yield*/, this.artaClient.get(this.path, auth)];
|
|
57
|
-
case 1:
|
|
58
|
-
artaResponse = _a.sent();
|
|
59
|
-
return [2 /*return*/, (0, utils_1.convertDatesToUtc)(artaResponse)];
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
};
|
|
15
|
+
async get(auth) {
|
|
16
|
+
const artaResponse = await this.artaClient.get(this.path, auth);
|
|
17
|
+
return (0, utils_1.convertDatesToUtc)(artaResponse);
|
|
18
|
+
}
|
|
64
19
|
/** Updates the Organization associated with the API Key
|
|
65
20
|
* @param [auth] An optional API key.
|
|
66
21
|
* @returns The Organization
|
|
67
22
|
* @throws ArtaSDKError thrown if some problem happened while communicating with the API.
|
|
68
23
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
case 0: return [4 /*yield*/, this.artaClient.patch(this.path, { organization: organization }, auth)];
|
|
75
|
-
case 1:
|
|
76
|
-
artaResponse = _a.sent();
|
|
77
|
-
return [2 /*return*/, (0, utils_1.convertDatesToUtc)(artaResponse)];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
return OrganizationsEndpoint;
|
|
83
|
-
}());
|
|
24
|
+
async update(organization, auth) {
|
|
25
|
+
const artaResponse = await this.artaClient.patch(this.path, { organization }, auth);
|
|
26
|
+
return (0, utils_1.convertDatesToUtc)(artaResponse);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
84
29
|
exports.OrganizationsEndpoint = OrganizationsEndpoint;
|
|
@@ -1,36 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.PaymentsEndpoint = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const endpoint_1 = require("./endpoint");
|
|
6
|
+
class PaymentsEndpoint {
|
|
7
|
+
constructor(artaClient) {
|
|
19
8
|
this.artaClient = artaClient;
|
|
20
9
|
this.path = '/payments';
|
|
21
10
|
this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient, this.enrichFields);
|
|
22
11
|
}
|
|
23
|
-
|
|
12
|
+
getById(id, auth) {
|
|
24
13
|
return this.defaultEndpoint.getById(id, auth);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
14
|
+
}
|
|
15
|
+
list(page = 1, pageSize = 20, auth) {
|
|
16
|
+
return this.defaultEndpoint.list({ page, page_size: pageSize }, auth);
|
|
17
|
+
}
|
|
18
|
+
enrichFields(resource) {
|
|
19
|
+
return {
|
|
20
|
+
...resource,
|
|
21
|
+
amount: Number(resource.amount),
|
|
22
|
+
paid_on: (0, utils_1.createDateAsUTC)(resource.paid_on),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
36
26
|
exports.PaymentsEndpoint = PaymentsEndpoint;
|
|
@@ -1,140 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
3
|
exports.QuoteRequestsEndpoint = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const endpoint_1 = require("./endpoint");
|
|
6
|
+
class QuoteRequestsEndpoint {
|
|
7
|
+
constructor(artaClient) {
|
|
55
8
|
this.artaClient = artaClient;
|
|
56
9
|
this.path = '/requests';
|
|
57
10
|
this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient, this.enrichFields.bind(this));
|
|
58
11
|
}
|
|
59
|
-
|
|
60
|
-
var _this = this;
|
|
12
|
+
enrichFields(resource) {
|
|
61
13
|
if (Object.prototype.hasOwnProperty.call(resource, 'quotes')) {
|
|
62
|
-
resource.quotes.forEach(
|
|
14
|
+
resource.quotes.forEach((q) => {
|
|
63
15
|
q.total = Number(q.total);
|
|
64
16
|
q.included_services.forEach(utils_1.parseService);
|
|
65
17
|
q.optional_services.forEach(utils_1.parseService);
|
|
66
18
|
if (q.tags) {
|
|
67
|
-
q.tags.forEach(
|
|
19
|
+
q.tags.forEach((t) => {
|
|
68
20
|
q.created_at = (0, utils_1.createDateAsUTC)(t.created_at);
|
|
69
21
|
q.updated_at = (0, utils_1.createDateAsUTC)(t.updated_at);
|
|
70
22
|
});
|
|
71
23
|
}
|
|
72
24
|
});
|
|
73
25
|
if (resource.tags) {
|
|
74
|
-
resource.tags.forEach(
|
|
26
|
+
resource.tags.forEach((t) => {
|
|
75
27
|
t.created_at = (0, utils_1.createDateAsUTC)(t.created_at);
|
|
76
28
|
t.updated_at = (0, utils_1.createDateAsUTC)(t.updated_at);
|
|
77
29
|
});
|
|
78
30
|
}
|
|
79
31
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
|
|
32
|
+
const updateContacts = (contacts, auth) => this.updateContacts(resource.id, contacts, auth);
|
|
33
|
+
const requireCustomQuotes = (customQuote, auth) => this.requireCustomQuotes(resource.id, customQuote, auth);
|
|
34
|
+
const cancel = (auth) => this.cancel(resource.id, auth);
|
|
35
|
+
return { ...resource, updateContacts, requireCustomQuotes, cancel };
|
|
36
|
+
}
|
|
37
|
+
getById(id, auth) {
|
|
86
38
|
return this.defaultEndpoint.getById(id, auth);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
};
|
|
93
|
-
QuoteRequestsEndpoint.prototype.create = function (payload, auth) {
|
|
39
|
+
}
|
|
40
|
+
list(search, page = 1, pageSize = 20, auth) {
|
|
41
|
+
return this.defaultEndpoint.list({ page, page_size: pageSize, search }, auth);
|
|
42
|
+
}
|
|
43
|
+
create(payload, auth) {
|
|
94
44
|
return this.defaultEndpoint.create({ request: payload }, auth);
|
|
95
|
-
}
|
|
96
|
-
|
|
45
|
+
}
|
|
46
|
+
update(id, payload, auth) {
|
|
97
47
|
return this.defaultEndpoint.update(id, { request: payload }, auth);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
QuoteRequestsEndpoint.prototype.requireCustomQuotes = function (id, customQuote, auth) {
|
|
113
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
-
var rawReq;
|
|
115
|
-
return __generator(this, function (_a) {
|
|
116
|
-
switch (_a.label) {
|
|
117
|
-
case 0: return [4 /*yield*/, this.artaClient.patch("".concat(this.path, "/").concat(id, "/custom"), customQuote, auth)];
|
|
118
|
-
case 1:
|
|
119
|
-
rawReq = (_a.sent());
|
|
120
|
-
return [2 /*return*/, this.enrichFields(rawReq)];
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
QuoteRequestsEndpoint.prototype.cancel = function (id, auth) {
|
|
126
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
-
var rawReq;
|
|
128
|
-
return __generator(this, function (_a) {
|
|
129
|
-
switch (_a.label) {
|
|
130
|
-
case 0: return [4 /*yield*/, this.artaClient.patch("".concat(this.path, "/").concat(id, "/cancel"), undefined, auth)];
|
|
131
|
-
case 1:
|
|
132
|
-
rawReq = (_a.sent());
|
|
133
|
-
return [2 /*return*/, this.enrichFields(rawReq)];
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
return QuoteRequestsEndpoint;
|
|
139
|
-
}());
|
|
48
|
+
}
|
|
49
|
+
async updateContacts(id, contacts, auth) {
|
|
50
|
+
const rawReq = (await this.artaClient.patch(`${this.path}/${id}/contacts`, contacts, auth));
|
|
51
|
+
return this.enrichFields(rawReq);
|
|
52
|
+
}
|
|
53
|
+
async requireCustomQuotes(id, customQuote, auth) {
|
|
54
|
+
const rawReq = (await this.artaClient.patch(`${this.path}/${id}/custom`, customQuote, auth));
|
|
55
|
+
return this.enrichFields(rawReq);
|
|
56
|
+
}
|
|
57
|
+
async cancel(id, auth) {
|
|
58
|
+
const rawReq = (await this.artaClient.patch(`${this.path}/${id}/cancel`, undefined, auth));
|
|
59
|
+
return this.enrichFields(rawReq);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
140
62
|
exports.QuoteRequestsEndpoint = QuoteRequestsEndpoint;
|
|
@@ -1,54 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.SelfShipCollectionAvailabilityChecksEndpoint = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
4
|
+
class SelfShipCollectionAvailabilityChecksEndpoint {
|
|
5
|
+
constructor(artaClient) {
|
|
42
6
|
this.artaClient = artaClient;
|
|
43
7
|
this.path = '/self_ship_collection_availability_checks';
|
|
44
8
|
}
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
return SelfShipCollectionAvailabilityChecksEndpoint;
|
|
53
|
-
}());
|
|
9
|
+
async create(payload, auth) {
|
|
10
|
+
return this.artaClient.post(this.path, { self_ship_collection_availability_check: payload }, auth);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
54
13
|
exports.SelfShipCollectionAvailabilityChecksEndpoint = SelfShipCollectionAvailabilityChecksEndpoint;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SelfShipCollectionsEndpoint = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const endpoint_1 = require("./endpoint");
|
|
5
|
+
class SelfShipCollectionsEndpoint {
|
|
6
|
+
constructor(artaClient) {
|
|
7
7
|
this.artaClient = artaClient;
|
|
8
8
|
this.path = '/self_ship_collections';
|
|
9
9
|
this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient);
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
getById(id, auth) {
|
|
12
12
|
return this.defaultEndpoint.getById(id, auth);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
SelfShipCollectionsEndpoint.prototype.listAll = function (auth) {
|
|
13
|
+
}
|
|
14
|
+
list(page = 1, pageSize = 20, auth) {
|
|
15
|
+
return this.defaultEndpoint.list({ page, page_size: pageSize }, auth);
|
|
16
|
+
}
|
|
17
|
+
listAll(auth) {
|
|
20
18
|
return this.defaultEndpoint.listAll(auth);
|
|
21
|
-
}
|
|
22
|
-
|
|
19
|
+
}
|
|
20
|
+
create(payload, auth) {
|
|
23
21
|
return this.defaultEndpoint.create({ self_ship_collection: payload }, auth);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
27
24
|
exports.SelfShipCollectionsEndpoint = SelfShipCollectionsEndpoint;
|
|
@@ -5,6 +5,9 @@ import type { ShipmentsSearch } from '../search';
|
|
|
5
5
|
import type { NullableString } from '../utils';
|
|
6
6
|
import type { Shipment } from '../types';
|
|
7
7
|
export interface ShipmentCreateBody {
|
|
8
|
+
exceptions?: Array<{
|
|
9
|
+
type: 'label_hold';
|
|
10
|
+
}>;
|
|
8
11
|
internal_reference?: NullableString;
|
|
9
12
|
public_reference?: NullableString;
|
|
10
13
|
quote_id: number;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ShipmentsEndpoint = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const endpoint_1 = require("./endpoint");
|
|
6
|
+
class ShipmentsEndpoint {
|
|
7
|
+
constructor(artaClient) {
|
|
8
8
|
this.artaClient = artaClient;
|
|
9
9
|
this.path = '/shipments';
|
|
10
10
|
this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient, this.enrichFields.bind(this));
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
enrichFields(s) {
|
|
13
|
+
var _a;
|
|
13
14
|
s.total = Number(s.total);
|
|
14
15
|
if (s.emissions) {
|
|
15
16
|
s.emissions = Number(s.emissions);
|
|
@@ -21,7 +22,7 @@ var ShipmentsEndpoint = /** @class */ (function () {
|
|
|
21
22
|
s.schedule.pickup_start = (0, utils_1.createDateAsUTC)(s.schedule.pickup_start);
|
|
22
23
|
}
|
|
23
24
|
if (s.packages) {
|
|
24
|
-
s.packages.forEach(
|
|
25
|
+
s.packages.forEach((p) => {
|
|
25
26
|
p.depth = Number(p.depth);
|
|
26
27
|
p.height = Number(p.height);
|
|
27
28
|
p.weight = Number(p.weight);
|
|
@@ -29,34 +30,31 @@ var ShipmentsEndpoint = /** @class */ (function () {
|
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
if (s.exceptions) {
|
|
32
|
-
s.exceptions.forEach(
|
|
33
|
+
s.exceptions.forEach((e) => {
|
|
33
34
|
e.created_at = (0, utils_1.createDateAsUTC)(e.created_at);
|
|
34
35
|
e.updated_at = (0, utils_1.createDateAsUTC)(e.updated_at);
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
38
|
if (s.tags) {
|
|
38
|
-
s.tags.forEach(
|
|
39
|
+
s.tags.forEach((t) => {
|
|
39
40
|
t.created_at = (0, utils_1.createDateAsUTC)(t.created_at);
|
|
40
41
|
t.updated_at = (0, utils_1.createDateAsUTC)(t.updated_at);
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
|
-
s.services
|
|
44
|
+
(_a = s.services) === null || _a === void 0 ? void 0 : _a.forEach(utils_1.parseService);
|
|
44
45
|
return s;
|
|
45
|
-
}
|
|
46
|
-
|
|
46
|
+
}
|
|
47
|
+
getById(id, auth) {
|
|
47
48
|
return this.defaultEndpoint.getById(id, auth);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
ShipmentsEndpoint.prototype.create = function (payload, auth) {
|
|
49
|
+
}
|
|
50
|
+
list(search, page = 1, pageSize = 20, auth) {
|
|
51
|
+
return this.defaultEndpoint.list({ page, page_size: pageSize, search }, auth);
|
|
52
|
+
}
|
|
53
|
+
create(payload, auth) {
|
|
55
54
|
return this.defaultEndpoint.create({ shipment: payload }, auth);
|
|
56
|
-
}
|
|
57
|
-
|
|
55
|
+
}
|
|
56
|
+
update(id, payload, auth) {
|
|
58
57
|
return this.defaultEndpoint.update(id, { shipment: payload }, auth);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
62
60
|
exports.ShipmentsEndpoint = ShipmentsEndpoint;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TagsEndpoint = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const endpoint_1 = require("./endpoint");
|
|
5
|
+
class TagsEndpoint {
|
|
6
|
+
constructor(artaClient) {
|
|
7
7
|
this.artaClient = artaClient;
|
|
8
8
|
this.path = '/tags';
|
|
9
9
|
this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient);
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
getByName(name, auth) {
|
|
12
12
|
return this.defaultEndpoint.getById(name, auth);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
TagsEndpoint.prototype.create = function (payload, auth) {
|
|
13
|
+
}
|
|
14
|
+
list(search, page = 1, pageSize = 20, auth) {
|
|
15
|
+
return this.defaultEndpoint.list({ page, page_size: pageSize, search }, auth);
|
|
16
|
+
}
|
|
17
|
+
create(payload, auth) {
|
|
20
18
|
return this.defaultEndpoint.create({ tag: payload }, auth);
|
|
21
|
-
}
|
|
22
|
-
|
|
19
|
+
}
|
|
20
|
+
update(name, payload, auth) {
|
|
23
21
|
return this.defaultEndpoint.update(name, { tag: payload }, auth);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
27
24
|
exports.TagsEndpoint = TagsEndpoint;
|