btrz-api-client 5.131.0 → 5.133.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.
- package/lib/client-standalone-min.js +5 -1
- package/lib/endpoints/inventory/operating-companies.js +31 -1
- package/lib/endpoints/notifications/pdf-data.js +3 -0
- package/lib/endpoints/notifications/pdfs.js +4 -1
- package/package.json +1 -1
- package/src/endpoints/inventory/operating-companies.js +21 -2
- package/src/endpoints/notifications/pdf-data.js +3 -0
- package/src/endpoints/notifications/pdfs.js +4 -1
- package/test/endpoints/inventory/operating-companies.test.js +28 -0
- package/test/endpoints/notifications/pdf-data.test.js +14 -0
- package/test/endpoints/notifications/pdfs.test.js +17 -3
- package/types/client.d.ts +15 -0
- package/types/constants.d.ts +1 -1
- package/types/endpoints/inventory/operating-companies.d.ts +15 -0
- package/types/initializedClient.d.ts +15 -0
- package/types/productionDefaults.d.ts +2 -2
|
@@ -64,11 +64,41 @@ function operatingCompaniesFactory(_ref) {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
var sequences = {
|
|
68
|
+
create: function create(_ref6) {
|
|
69
|
+
var jwtToken = _ref6.jwtToken,
|
|
70
|
+
token = _ref6.token,
|
|
71
|
+
operatingCompanyId = _ref6.operatingCompanyId,
|
|
72
|
+
sequence = _ref6.sequence,
|
|
73
|
+
headers = _ref6.headers;
|
|
74
|
+
|
|
75
|
+
return client({
|
|
76
|
+
url: "/operating-companies/" + operatingCompanyId + "/sequences",
|
|
77
|
+
method: "post",
|
|
78
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
79
|
+
data: sequence
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
all: function all(_ref7) {
|
|
83
|
+
var jwtToken = _ref7.jwtToken,
|
|
84
|
+
token = _ref7.token,
|
|
85
|
+
operatingCompanyId = _ref7.operatingCompanyId,
|
|
86
|
+
headers = _ref7.headers;
|
|
87
|
+
|
|
88
|
+
return client({
|
|
89
|
+
url: "/operating-companies/" + operatingCompanyId + "/sequences",
|
|
90
|
+
method: "get",
|
|
91
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
67
96
|
return {
|
|
68
97
|
all: all,
|
|
69
98
|
create: create,
|
|
70
99
|
update: update,
|
|
71
|
-
get: get
|
|
100
|
+
get: get,
|
|
101
|
+
sequences: sequences
|
|
72
102
|
};
|
|
73
103
|
}
|
|
74
104
|
|
|
@@ -85,6 +85,9 @@ function pdfDataFactory(_ref) {
|
|
|
85
85
|
if (query.type === "partialShiftDeposits") {
|
|
86
86
|
url = "/pdf-partial-shift-deposits/" + itemId;
|
|
87
87
|
}
|
|
88
|
+
if (query.type === "shiftLocationClosure") {
|
|
89
|
+
url = "/pdf-shift-location-closures/" + itemId;
|
|
90
|
+
}
|
|
88
91
|
|
|
89
92
|
return client.get(url, {
|
|
90
93
|
params: query,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _require = require("./../endpoints_helpers"),
|
|
3
|
+
var _require = require("./../endpoints_helpers.js"),
|
|
4
4
|
authorizationHeaders = _require.authorizationHeaders;
|
|
5
5
|
|
|
6
6
|
function pdfFactory(_ref) {
|
|
@@ -90,6 +90,9 @@ function pdfFactory(_ref) {
|
|
|
90
90
|
if (query.type === "partialShiftDeposits") {
|
|
91
91
|
url = "/pdf-partial-shift-deposits/" + itemId;
|
|
92
92
|
}
|
|
93
|
+
if (query.type === "shiftLocationClosure") {
|
|
94
|
+
url = "/pdf-shift-location-closures/" + itemId;
|
|
95
|
+
}
|
|
93
96
|
|
|
94
97
|
return client.get(url, {
|
|
95
98
|
params: query,
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ function operatingCompaniesFactory({ client, internalAuthTokenProvider }) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function update({ jwtToken, token, operatingCompanyId, operatingCompany, headers }) {
|
|
23
|
-
return client({
|
|
23
|
+
return client({
|
|
24
24
|
url: `/operating-companies/${operatingCompanyId}`,
|
|
25
25
|
method: "put",
|
|
26
26
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
@@ -36,11 +36,30 @@ function operatingCompaniesFactory({ client, internalAuthTokenProvider }) {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
const sequences = {
|
|
40
|
+
create({jwtToken, token, operatingCompanyId, sequence, headers}) {
|
|
41
|
+
return client({
|
|
42
|
+
url: `/operating-companies/${operatingCompanyId}/sequences`,
|
|
43
|
+
method: "post",
|
|
44
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
45
|
+
data: sequence
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
all({jwtToken, token, operatingCompanyId, headers}) {
|
|
49
|
+
return client({
|
|
50
|
+
url: `/operating-companies/${operatingCompanyId}/sequences`,
|
|
51
|
+
method: "get",
|
|
52
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
39
57
|
return {
|
|
40
58
|
all,
|
|
41
59
|
create,
|
|
42
60
|
update,
|
|
43
|
-
get
|
|
61
|
+
get,
|
|
62
|
+
sequences
|
|
44
63
|
};
|
|
45
64
|
}
|
|
46
65
|
|
|
@@ -83,6 +83,9 @@ function pdfDataFactory({
|
|
|
83
83
|
if (query.type === "partialShiftDeposits") {
|
|
84
84
|
url = `/pdf-partial-shift-deposits/${itemId}`;
|
|
85
85
|
}
|
|
86
|
+
if (query.type === "shiftLocationClosure") {
|
|
87
|
+
url = `/pdf-shift-location-closures/${itemId}`;
|
|
88
|
+
}
|
|
86
89
|
|
|
87
90
|
return client.get(url, {
|
|
88
91
|
params: query,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {
|
|
2
2
|
authorizationHeaders
|
|
3
|
-
} = require("./../endpoints_helpers");
|
|
3
|
+
} = require("./../endpoints_helpers.js");
|
|
4
4
|
|
|
5
5
|
function pdfFactory({
|
|
6
6
|
client,
|
|
@@ -88,6 +88,9 @@ function pdfFactory({
|
|
|
88
88
|
if (query.type === "partialShiftDeposits") {
|
|
89
89
|
url = `/pdf-partial-shift-deposits/${itemId}`;
|
|
90
90
|
}
|
|
91
|
+
if (query.type === "shiftLocationClosure") {
|
|
92
|
+
url = `/pdf-shift-location-closures/${itemId}`;
|
|
93
|
+
}
|
|
91
94
|
|
|
92
95
|
return client.get(url, {
|
|
93
96
|
params: query,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { axiosMock, expectRequest } = require("./../../test-helpers");
|
|
2
|
+
const {expect} = require("chai");
|
|
2
3
|
const api = require("./../../../src/client").createApiClient({ baseURL: "http://test.com" });
|
|
3
4
|
|
|
4
5
|
describe('inventory/operating-companies', () => {
|
|
@@ -55,4 +56,31 @@ describe('inventory/operating-companies', () => {
|
|
|
55
56
|
operatingCompanyId
|
|
56
57
|
});
|
|
57
58
|
});
|
|
59
|
+
|
|
60
|
+
it("should create an operating company sequence", () => {
|
|
61
|
+
const operatingCompanyId = "1234";
|
|
62
|
+
const operatingCompanySequenceData = {};
|
|
63
|
+
// eslint-disable-next-line max-len
|
|
64
|
+
axiosMock.onPost(`/operating-companies/${operatingCompanyId}/sequences`).reply(expectRequest({statusCode: 200, token, jwtToken, body: operatingCompanySequenceData}));
|
|
65
|
+
return api.inventory.operatingCompanies.sequences.create({
|
|
66
|
+
jwtToken,
|
|
67
|
+
token,
|
|
68
|
+
operatingCompanyId,
|
|
69
|
+
sequence: operatingCompanySequenceData
|
|
70
|
+
}).then((httpResponse) => {
|
|
71
|
+
expect(httpResponse.status).eql(200);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("should get operating company sequences", () => {
|
|
76
|
+
const operatingCompanyId = "1234";
|
|
77
|
+
axiosMock.onGet(`/operating-companies/${operatingCompanyId}/sequences`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
78
|
+
return api.inventory.operatingCompanies.sequences.all({
|
|
79
|
+
jwtToken,
|
|
80
|
+
token,
|
|
81
|
+
operatingCompanyId
|
|
82
|
+
}).then((httpResponse) => {
|
|
83
|
+
expect(httpResponse.status).eql(200);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
58
86
|
});
|
|
@@ -300,4 +300,18 @@ describe("notifications/pdf-data", () => {
|
|
|
300
300
|
token, query, itemId
|
|
301
301
|
});
|
|
302
302
|
});
|
|
303
|
+
|
|
304
|
+
it("should return the proper data for a shiftLocationClosure", () => {
|
|
305
|
+
const itemId = "12345";
|
|
306
|
+
const query = {
|
|
307
|
+
type: "shiftLocationClosure"
|
|
308
|
+
};
|
|
309
|
+
axiosMock.onGet(`/pdf-shift-location-closures/${itemId}`)
|
|
310
|
+
.reply(expectRequest({
|
|
311
|
+
statusCode: 200, token
|
|
312
|
+
}));
|
|
313
|
+
return api.notifications.pdfData.get({
|
|
314
|
+
token, query, itemId
|
|
315
|
+
});
|
|
316
|
+
});
|
|
303
317
|
});
|
|
@@ -256,7 +256,7 @@ describe("notifications/pdfs", () => {
|
|
|
256
256
|
.reply(expectRequest({
|
|
257
257
|
statusCode: 200, token
|
|
258
258
|
}));
|
|
259
|
-
return api.notifications.
|
|
259
|
+
return api.notifications.pdfs.get({
|
|
260
260
|
token, query, itemId
|
|
261
261
|
});
|
|
262
262
|
});
|
|
@@ -270,7 +270,7 @@ describe("notifications/pdfs", () => {
|
|
|
270
270
|
.reply(expectRequest({
|
|
271
271
|
statusCode: 200, token
|
|
272
272
|
}));
|
|
273
|
-
return api.notifications.
|
|
273
|
+
return api.notifications.pdfs.get({
|
|
274
274
|
token, query, itemId
|
|
275
275
|
});
|
|
276
276
|
});
|
|
@@ -284,7 +284,21 @@ describe("notifications/pdfs", () => {
|
|
|
284
284
|
.reply(expectRequest({
|
|
285
285
|
statusCode: 200, token
|
|
286
286
|
}));
|
|
287
|
-
return api.notifications.
|
|
287
|
+
return api.notifications.pdfs.get({
|
|
288
|
+
token, query, itemId
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
it("should return the proper data for a shiftLocationClosure", () => {
|
|
293
|
+
const itemId = "12345";
|
|
294
|
+
const query = {
|
|
295
|
+
type: "shiftLocationClosure"
|
|
296
|
+
};
|
|
297
|
+
axiosMock.onGet(`/pdf-shift-location-closures/${itemId}`)
|
|
298
|
+
.reply(expectRequest({
|
|
299
|
+
statusCode: 200, token
|
|
300
|
+
}));
|
|
301
|
+
return api.notifications.pdfs.get({
|
|
288
302
|
token, query, itemId
|
|
289
303
|
});
|
|
290
304
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -640,6 +640,21 @@ export function createApiClient(options: {
|
|
|
640
640
|
jwtToken: any;
|
|
641
641
|
headers: any;
|
|
642
642
|
}) => any;
|
|
643
|
+
sequences: {
|
|
644
|
+
create({ jwtToken, token, operatingCompanyId, sequence, headers }: {
|
|
645
|
+
jwtToken: any;
|
|
646
|
+
token: any;
|
|
647
|
+
operatingCompanyId: any;
|
|
648
|
+
sequence: any;
|
|
649
|
+
headers: any;
|
|
650
|
+
}): any;
|
|
651
|
+
all({ jwtToken, token, operatingCompanyId, headers }: {
|
|
652
|
+
jwtToken: any;
|
|
653
|
+
token: any;
|
|
654
|
+
operatingCompanyId: any;
|
|
655
|
+
headers: any;
|
|
656
|
+
}): any;
|
|
657
|
+
};
|
|
643
658
|
};
|
|
644
659
|
operationMessages: {
|
|
645
660
|
get: ({ token, operationMessageId, headers }: {
|
package/types/constants.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export let INTERNAL_AUTH_TOKEN_SYMBOL: string;
|
|
@@ -28,4 +28,19 @@ declare function operatingCompaniesFactory({ client, internalAuthTokenProvider }
|
|
|
28
28
|
jwtToken: any;
|
|
29
29
|
headers: any;
|
|
30
30
|
}) => any;
|
|
31
|
+
sequences: {
|
|
32
|
+
create({ jwtToken, token, operatingCompanyId, sequence, headers }: {
|
|
33
|
+
jwtToken: any;
|
|
34
|
+
token: any;
|
|
35
|
+
operatingCompanyId: any;
|
|
36
|
+
sequence: any;
|
|
37
|
+
headers: any;
|
|
38
|
+
}): any;
|
|
39
|
+
all({ jwtToken, token, operatingCompanyId, headers }: {
|
|
40
|
+
jwtToken: any;
|
|
41
|
+
token: any;
|
|
42
|
+
operatingCompanyId: any;
|
|
43
|
+
headers: any;
|
|
44
|
+
}): any;
|
|
45
|
+
};
|
|
31
46
|
};
|
|
@@ -594,6 +594,21 @@ declare const _exports: {
|
|
|
594
594
|
jwtToken: any;
|
|
595
595
|
headers: any;
|
|
596
596
|
}) => any;
|
|
597
|
+
sequences: {
|
|
598
|
+
create({ jwtToken, token, operatingCompanyId, sequence, headers }: {
|
|
599
|
+
jwtToken: any;
|
|
600
|
+
token: any;
|
|
601
|
+
operatingCompanyId: any;
|
|
602
|
+
sequence: any;
|
|
603
|
+
headers: any;
|
|
604
|
+
}): any;
|
|
605
|
+
all({ jwtToken, token, operatingCompanyId, headers }: {
|
|
606
|
+
jwtToken: any;
|
|
607
|
+
token: any;
|
|
608
|
+
operatingCompanyId: any;
|
|
609
|
+
headers: any;
|
|
610
|
+
}): any;
|
|
611
|
+
};
|
|
597
612
|
};
|
|
598
613
|
operationMessages: {
|
|
599
614
|
get: ({ token, operationMessageId, headers }: {
|