btrz-api-client 9.15.0 → 9.16.0
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.
|
@@ -3,7 +3,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
3
3
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
/* eslint-disable max-len */
|
|
7
6
|
const {
|
|
8
7
|
authorizationHeaders
|
|
9
8
|
} = require("./../endpoints_helpers.js");
|
|
@@ -80,6 +79,25 @@ const {
|
|
|
80
79
|
* @property {boolean} [bypassValidations] - If true, bypass driver validations
|
|
81
80
|
*/
|
|
82
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Query params for GET /manifests/item-capacity-over-limit (btrz-api-operations).
|
|
84
|
+
* @typedef {Object} ItemCapacityOverLimitQuery
|
|
85
|
+
* @property {string} itemId - Catalog item id (sourceItemId)
|
|
86
|
+
* @property {number|string} limit - Proposed Manifest Item Capacity Limit (>= 1)
|
|
87
|
+
* @property {number|string} [page] - Page number (>= 1)
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Query params for GET /manifests/item-capacity-used (btrz-api-operations).
|
|
92
|
+
* @typedef {Object} ItemCapacityUsedQuery
|
|
93
|
+
* @property {string} routeId - Route id
|
|
94
|
+
* @property {string} scheduleId - Schedule id (manifest schedule key)
|
|
95
|
+
* @property {string} date - Travel date yyyy-mm-dd
|
|
96
|
+
* @property {string} fromId - Origin station id
|
|
97
|
+
* @property {string} toId - Destination station id
|
|
98
|
+
* @property {string} [itemIds] - Optional comma-separated catalog item ids
|
|
99
|
+
*/
|
|
100
|
+
|
|
83
101
|
/**
|
|
84
102
|
* Factory for manifests API (btrz-api-operations).
|
|
85
103
|
* @param {Object} deps
|
|
@@ -209,6 +227,62 @@ function manifestFactory({
|
|
|
209
227
|
});
|
|
210
228
|
}
|
|
211
229
|
|
|
230
|
+
/**
|
|
231
|
+
* GET /manifests/item-capacity-over-limit - future manifests over a proposed item capacity limit.
|
|
232
|
+
* @param {Object} opts
|
|
233
|
+
* @param {string} [opts.token] - API key
|
|
234
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
235
|
+
* @param {ItemCapacityOverLimitQuery} opts.query - itemId, limit, optional page
|
|
236
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
237
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
238
|
+
*/
|
|
239
|
+
function itemCapacityOverLimit({
|
|
240
|
+
token,
|
|
241
|
+
jwtToken,
|
|
242
|
+
query = {},
|
|
243
|
+
headers
|
|
244
|
+
}) {
|
|
245
|
+
return client({
|
|
246
|
+
url: "/manifests/item-capacity-over-limit",
|
|
247
|
+
method: "get",
|
|
248
|
+
params: query,
|
|
249
|
+
headers: authorizationHeaders({
|
|
250
|
+
token,
|
|
251
|
+
jwtToken,
|
|
252
|
+
internalAuthTokenProvider,
|
|
253
|
+
headers
|
|
254
|
+
})
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* GET /manifests/item-capacity-used - path max qty used per attach-to-ticket item.
|
|
260
|
+
* @param {Object} opts
|
|
261
|
+
* @param {string} [opts.token] - API key
|
|
262
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
263
|
+
* @param {ItemCapacityUsedQuery} opts.query - routeId, scheduleId, date, fromId, toId, optional itemIds
|
|
264
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
265
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
266
|
+
*/
|
|
267
|
+
function itemCapacityUsed({
|
|
268
|
+
token,
|
|
269
|
+
jwtToken,
|
|
270
|
+
query = {},
|
|
271
|
+
headers
|
|
272
|
+
}) {
|
|
273
|
+
return client({
|
|
274
|
+
url: "/manifests/item-capacity-used",
|
|
275
|
+
method: "get",
|
|
276
|
+
params: query,
|
|
277
|
+
headers: authorizationHeaders({
|
|
278
|
+
token,
|
|
279
|
+
jwtToken,
|
|
280
|
+
internalAuthTokenProvider,
|
|
281
|
+
headers
|
|
282
|
+
})
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
212
286
|
/**
|
|
213
287
|
* GET /manifests/:manifestId - get manifest by id. API does not accept query params.
|
|
214
288
|
* @param {Object} opts
|
|
@@ -1030,16 +1104,16 @@ function manifestFactory({
|
|
|
1030
1104
|
};
|
|
1031
1105
|
|
|
1032
1106
|
/**
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1107
|
+
* POST manifests/:manifestId/boarding/:stationId - board passengers at station.
|
|
1108
|
+
* @param {Object} opts
|
|
1109
|
+
* @param {string} [opts.token] - API key
|
|
1110
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
1111
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
1112
|
+
* @param {string} opts.manifestId - Manifest id
|
|
1113
|
+
* @param {string} opts.stationId - Station id
|
|
1114
|
+
* @param {Object} opts.data - Request body
|
|
1115
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
1116
|
+
*/
|
|
1043
1117
|
function stationBoarding({
|
|
1044
1118
|
token,
|
|
1045
1119
|
jwtToken,
|
|
@@ -1098,16 +1172,16 @@ function manifestFactory({
|
|
|
1098
1172
|
}
|
|
1099
1173
|
|
|
1100
1174
|
/**
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1175
|
+
* POST manifests/:manifestId/sales-closure/:stationId - close sales at station.
|
|
1176
|
+
* @param {Object} opts
|
|
1177
|
+
* @param {string} [opts.token] - API key
|
|
1178
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
1179
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
1180
|
+
* @param {string} opts.manifestId - Manifest id
|
|
1181
|
+
* @param {string} opts.stationId - Station id
|
|
1182
|
+
* @param {Object} opts.data - Request body
|
|
1183
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
1184
|
+
*/
|
|
1111
1185
|
function stationSalesClosure({
|
|
1112
1186
|
token,
|
|
1113
1187
|
jwtToken,
|
|
@@ -1134,6 +1208,8 @@ function manifestFactory({
|
|
|
1134
1208
|
get,
|
|
1135
1209
|
getAll,
|
|
1136
1210
|
getById,
|
|
1211
|
+
itemCapacityOverLimit,
|
|
1212
|
+
itemCapacityUsed,
|
|
1137
1213
|
outlook,
|
|
1138
1214
|
patch,
|
|
1139
1215
|
save,
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
const {
|
|
3
3
|
authorizationHeaders
|
|
4
4
|
} = require("./../endpoints_helpers.js");
|
|
@@ -75,6 +75,25 @@ const {
|
|
|
75
75
|
* @property {boolean} [bypassValidations] - If true, bypass driver validations
|
|
76
76
|
*/
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Query params for GET /manifests/item-capacity-over-limit (btrz-api-operations).
|
|
80
|
+
* @typedef {Object} ItemCapacityOverLimitQuery
|
|
81
|
+
* @property {string} itemId - Catalog item id (sourceItemId)
|
|
82
|
+
* @property {number|string} limit - Proposed Manifest Item Capacity Limit (>= 1)
|
|
83
|
+
* @property {number|string} [page] - Page number (>= 1)
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Query params for GET /manifests/item-capacity-used (btrz-api-operations).
|
|
88
|
+
* @typedef {Object} ItemCapacityUsedQuery
|
|
89
|
+
* @property {string} routeId - Route id
|
|
90
|
+
* @property {string} scheduleId - Schedule id (manifest schedule key)
|
|
91
|
+
* @property {string} date - Travel date yyyy-mm-dd
|
|
92
|
+
* @property {string} fromId - Origin station id
|
|
93
|
+
* @property {string} toId - Destination station id
|
|
94
|
+
* @property {string} [itemIds] - Optional comma-separated catalog item ids
|
|
95
|
+
*/
|
|
96
|
+
|
|
78
97
|
/**
|
|
79
98
|
* Factory for manifests API (btrz-api-operations).
|
|
80
99
|
* @param {Object} deps
|
|
@@ -160,6 +179,42 @@ function manifestFactory({
|
|
|
160
179
|
});
|
|
161
180
|
}
|
|
162
181
|
|
|
182
|
+
/**
|
|
183
|
+
* GET /manifests/item-capacity-over-limit - future manifests over a proposed item capacity limit.
|
|
184
|
+
* @param {Object} opts
|
|
185
|
+
* @param {string} [opts.token] - API key
|
|
186
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
187
|
+
* @param {ItemCapacityOverLimitQuery} opts.query - itemId, limit, optional page
|
|
188
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
189
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
190
|
+
*/
|
|
191
|
+
function itemCapacityOverLimit({token, jwtToken, query = {}, headers}) {
|
|
192
|
+
return client({
|
|
193
|
+
url: "/manifests/item-capacity-over-limit",
|
|
194
|
+
method: "get",
|
|
195
|
+
params: query,
|
|
196
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* GET /manifests/item-capacity-used - path max qty used per attach-to-ticket item.
|
|
202
|
+
* @param {Object} opts
|
|
203
|
+
* @param {string} [opts.token] - API key
|
|
204
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
205
|
+
* @param {ItemCapacityUsedQuery} opts.query - routeId, scheduleId, date, fromId, toId, optional itemIds
|
|
206
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
207
|
+
* @returns {Promise<import("axios").AxiosResponse>}
|
|
208
|
+
*/
|
|
209
|
+
function itemCapacityUsed({token, jwtToken, query = {}, headers}) {
|
|
210
|
+
return client({
|
|
211
|
+
url: "/manifests/item-capacity-used",
|
|
212
|
+
method: "get",
|
|
213
|
+
params: query,
|
|
214
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
163
218
|
/**
|
|
164
219
|
* GET /manifests/:manifestId - get manifest by id. API does not accept query params.
|
|
165
220
|
* @param {Object} opts
|
|
@@ -730,7 +785,7 @@ function manifestFactory({
|
|
|
730
785
|
}
|
|
731
786
|
};
|
|
732
787
|
|
|
733
|
-
|
|
788
|
+
/**
|
|
734
789
|
* POST manifests/:manifestId/boarding/:stationId - board passengers at station.
|
|
735
790
|
* @param {Object} opts
|
|
736
791
|
* @param {string} [opts.token] - API key
|
|
@@ -741,16 +796,16 @@ function manifestFactory({
|
|
|
741
796
|
* @param {Object} opts.data - Request body
|
|
742
797
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
743
798
|
*/
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
799
|
+
function stationBoarding({token, jwtToken, headers, manifestId, stationId, data, query}) {
|
|
800
|
+
return client({
|
|
801
|
+
url: `/manifests/${manifestId}/boarding/${stationId}`,
|
|
802
|
+
method: "post",
|
|
803
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
804
|
+
data,
|
|
805
|
+
params: query
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
|
|
754
809
|
/**
|
|
755
810
|
* POST manifests/:manifestId/dispatch/:stationId - dispatch manifest at station.
|
|
756
811
|
* @param {Object} opts
|
|
@@ -762,17 +817,17 @@ function manifestFactory({
|
|
|
762
817
|
* @param {Object} opts.data - Request body
|
|
763
818
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
764
819
|
*/
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
820
|
+
function stationDispatch({token, jwtToken, headers, manifestId, stationId, data, query}) {
|
|
821
|
+
return client({
|
|
822
|
+
url: `/manifests/${manifestId}/dispatch/${stationId}`,
|
|
823
|
+
method: "post",
|
|
824
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
825
|
+
data,
|
|
826
|
+
params: query
|
|
827
|
+
});
|
|
828
|
+
}
|
|
774
829
|
|
|
775
|
-
|
|
830
|
+
/**
|
|
776
831
|
* POST manifests/:manifestId/sales-closure/:stationId - close sales at station.
|
|
777
832
|
* @param {Object} opts
|
|
778
833
|
* @param {string} [opts.token] - API key
|
|
@@ -783,20 +838,22 @@ function manifestFactory({
|
|
|
783
838
|
* @param {Object} opts.data - Request body
|
|
784
839
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
785
840
|
*/
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
841
|
+
function stationSalesClosure({token, jwtToken, headers, manifestId, stationId, data, query}) {
|
|
842
|
+
return client({
|
|
843
|
+
url: `/manifests/${manifestId}/sales-closure/${stationId}`,
|
|
844
|
+
method: "post",
|
|
845
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
846
|
+
data,
|
|
847
|
+
params: query
|
|
848
|
+
});
|
|
849
|
+
}
|
|
795
850
|
|
|
796
851
|
return {
|
|
797
852
|
get,
|
|
798
853
|
getAll,
|
|
799
854
|
getById,
|
|
855
|
+
itemCapacityOverLimit,
|
|
856
|
+
itemCapacityUsed,
|
|
800
857
|
outlook,
|
|
801
858
|
patch,
|
|
802
859
|
save,
|
|
@@ -40,6 +40,41 @@ describe("operations/manifest", () => {
|
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
+
it("should get item capacity over limit manifests", async () => {
|
|
44
|
+
const query = {
|
|
45
|
+
itemId: "507f1f77bcf86cd799439011",
|
|
46
|
+
limit: 5,
|
|
47
|
+
page: 1
|
|
48
|
+
};
|
|
49
|
+
axiosMock.onGet("/manifests/item-capacity-over-limit").reply(expectRequest({
|
|
50
|
+
statusCode: 200, token, jwtToken
|
|
51
|
+
}));
|
|
52
|
+
const call = await api.operations.manifest.itemCapacityOverLimit({
|
|
53
|
+
token, jwtToken, query
|
|
54
|
+
});
|
|
55
|
+
assert.deepStrictEqual(call.config.params, query);
|
|
56
|
+
return call;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("should get item capacity used on a path", async () => {
|
|
60
|
+
const query = {
|
|
61
|
+
routeId: "507f1f77bcf86cd799439011",
|
|
62
|
+
scheduleId: "5cab127c-2c70-4fea-9031-4131e2751cdb",
|
|
63
|
+
date: "2035-07-20",
|
|
64
|
+
fromId: "507f1f77bcf86cd799439012",
|
|
65
|
+
toId: "507f1f77bcf86cd799439013",
|
|
66
|
+
itemIds: "507f1f77bcf86cd799439014"
|
|
67
|
+
};
|
|
68
|
+
axiosMock.onGet("/manifests/item-capacity-used").reply(expectRequest({
|
|
69
|
+
statusCode: 200, token, jwtToken
|
|
70
|
+
}));
|
|
71
|
+
const call = await api.operations.manifest.itemCapacityUsed({
|
|
72
|
+
token, jwtToken, query
|
|
73
|
+
});
|
|
74
|
+
assert.deepStrictEqual(call.config.params, query);
|
|
75
|
+
return call;
|
|
76
|
+
});
|
|
77
|
+
|
|
43
78
|
it("should get many manifests", () => {
|
|
44
79
|
const data = {
|
|
45
80
|
query: [{
|