btrz-api-client 9.22.0 → 9.25.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 -5
- package/lib/endpoints/accounts/accounts.js +46 -2
- package/lib/endpoints/operations/manifest.js +26 -4
- package/package.json +1 -1
- package/src/endpoints/accounts/accounts.js +34 -2
- package/src/endpoints/operations/manifest.js +26 -4
- package/test/endpoints/accounts/accounts.js +27 -0
- package/types/endpoints/accounts/accounts.d.ts +4 -1
|
@@ -7,7 +7,7 @@ const {
|
|
|
7
7
|
* @param {Object} deps
|
|
8
8
|
* @param {import("axios").AxiosInstance} deps.client
|
|
9
9
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
10
|
-
* @returns {{ get: function, defaultUsers: { create: function }, configurationReplication: { create: function } }}
|
|
10
|
+
* @returns {{ get: function, defaultUsers: { create: function }, configurationReplication: { create: function }, sessionRecordingSettings: { update: function } }}
|
|
11
11
|
*/
|
|
12
12
|
function accountsFactory({
|
|
13
13
|
client,
|
|
@@ -106,10 +106,54 @@ function accountsFactory({
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Query params for PUT /accounts/:accountId/session-recording-settings (btrz-api-accounts).
|
|
112
|
+
* @typedef {Object} SessionRecordingSettingsUpdateQuery
|
|
113
|
+
* @property {string} superUserId - Super user id (ObjectId)
|
|
114
|
+
* @property {string} superUserHash - Super user hash
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
const sessionRecordingSettings = {
|
|
118
|
+
/**
|
|
119
|
+
* PUT /accounts/:accountId/session-recording-settings — replace logRocket and rrweb preferences.
|
|
120
|
+
* Requires SuperUser query credentials.
|
|
121
|
+
* @param {Object} opts
|
|
122
|
+
* @param {string} [opts.token] - API key
|
|
123
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
124
|
+
* @param {string} opts.accountId - Account _id (ObjectId)
|
|
125
|
+
* @param {SessionRecordingSettingsUpdateQuery} [opts.query] - superUserId, superUserHash
|
|
126
|
+
* @param {Object} opts.data - { logRocket, rrweb }
|
|
127
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
128
|
+
* @returns {Promise<import("axios").AxiosResponse>} 200 { logRocket, rrweb }
|
|
129
|
+
*/
|
|
130
|
+
update({
|
|
131
|
+
token,
|
|
132
|
+
jwtToken,
|
|
133
|
+
accountId,
|
|
134
|
+
query,
|
|
135
|
+
data,
|
|
136
|
+
headers
|
|
137
|
+
}) {
|
|
138
|
+
return client({
|
|
139
|
+
url: `/accounts/${accountId}/session-recording-settings`,
|
|
140
|
+
method: "put",
|
|
141
|
+
headers: authorizationHeaders({
|
|
142
|
+
token,
|
|
143
|
+
jwtToken,
|
|
144
|
+
internalAuthTokenProvider,
|
|
145
|
+
headers
|
|
146
|
+
}),
|
|
147
|
+
params: query,
|
|
148
|
+
data
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
};
|
|
109
152
|
return {
|
|
110
153
|
get,
|
|
111
154
|
defaultUsers,
|
|
112
|
-
configurationReplication
|
|
155
|
+
configurationReplication,
|
|
156
|
+
sessionRecordingSettings
|
|
113
157
|
};
|
|
114
158
|
}
|
|
115
159
|
module.exports = accountsFactory;
|
|
@@ -17,7 +17,7 @@ const {
|
|
|
17
17
|
* @property {string} [dateFrom] - Start date range (yyyy-mm-dd)
|
|
18
18
|
* @property {string} [dateTo] - End date range (yyyy-mm-dd)
|
|
19
19
|
* @property {string} [seatmapId] - Seatmap ID
|
|
20
|
-
* @property {string} [vehicleId] -
|
|
20
|
+
* @property {string} [vehicleId] - Inventory vehicle document ID (MongoDB ObjectId). Filters by manifest.vehicleId. Legacy exact display-name matching may still resolve server-side; do not rely on it for new clients
|
|
21
21
|
* @property {string} [assignedUserId] - Assigned user ID
|
|
22
22
|
* @property {boolean} [dispatched] - If manifest was dispatched
|
|
23
23
|
* @property {boolean} [reviewed] - If manifest was reviewed
|
|
@@ -30,6 +30,19 @@ const {
|
|
|
30
30
|
* @property {string} [status] - Comma-separated manifest statuses
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Body for PUT /manifests (btrz-api-operations ManifestSaveData). See put-manifest.
|
|
35
|
+
* @typedef {Object} ManifestSaveData
|
|
36
|
+
* @property {string} routeId - Route ID
|
|
37
|
+
* @property {string} scheduleId - Schedule ID
|
|
38
|
+
* @property {string} date - Date in YYYY-MM-DD format
|
|
39
|
+
* @property {string} [busSelected] - Human-readable vehicle name to assign or clear (legacy). Resolves by exact inventory name only when inventoryVehicleId is not provided. When inventoryVehicleId is also provided, the server resolves only by that ID and persists the resolved name for display/audit. Empty string unassigns only when inventoryVehicleId is absent
|
|
40
|
+
* @property {string} [inventoryVehicleId] - Stable inventory vehicle document ID (MongoDB ObjectId as string). When provided, bus assignment resolves only by this ID; there is no fallback to busSelected name. BUS_NOT_FOUND when the target vehicle cannot be resolved (invalid, disabled, deleted, or other account). Not returned when cleaning up a previous assignment whose vehicle was renamed or removed
|
|
41
|
+
* @property {number} [capacity] - Manifest capacity
|
|
42
|
+
* @property {string} [seatMapId] - Seatmap ID
|
|
43
|
+
* @property {string} [comments] - Comments
|
|
44
|
+
*/
|
|
45
|
+
|
|
33
46
|
/**
|
|
34
47
|
* Query params for PUT /manifests (btrz-api-operations). See put-manifest getSpec().
|
|
35
48
|
* @typedef {Object} ManifestSaveQuery
|
|
@@ -49,6 +62,15 @@ const {
|
|
|
49
62
|
* @property {string} [newdesign] - "true" when using new seatmap design
|
|
50
63
|
*/
|
|
51
64
|
|
|
65
|
+
/**
|
|
66
|
+
* assign_bus operation item for PATCH /manifests (btrz-api-operations ManifestUpdateOperation). See patch-manifest.
|
|
67
|
+
* @typedef {Object} ManifestPatchAssignBusOperation
|
|
68
|
+
* @property {"assign_bus"} op - Operation type
|
|
69
|
+
* @property {Object} manifest - Manifest data to update (ManifestUpdateCapacityNotificationSent)
|
|
70
|
+
* @property {string} [busId] - Case-sensitive inventory vehicle display name (legacy). Used only when inventoryVehicleId is not provided
|
|
71
|
+
* @property {string} [inventoryVehicleId] - Stable inventory vehicle document ID. When provided, the vehicle is resolved only by this ID (no name fallback); busId is persisted as the resolved vehicle name for display and audit. BUS_NOT_FOUND if the ID does not resolve (missing, disabled, deleted, or other account)
|
|
72
|
+
*/
|
|
73
|
+
|
|
52
74
|
/**
|
|
53
75
|
* Query params for GET /outlook-manifests (btrz-api-operations). See get-outlook-manifests getSpec().
|
|
54
76
|
* @typedef {Object} OutlookManifestsListQuery
|
|
@@ -417,9 +439,9 @@ function manifestFactory({
|
|
|
417
439
|
* @param {string} [opts.token] - API key
|
|
418
440
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
419
441
|
* @param {ManifestPatchQuery} [opts.query] - Query params (providerId required)
|
|
420
|
-
* @param {Object} opts.operations -
|
|
442
|
+
* @param {Array<ManifestPatchAssignBusOperation|Object>} opts.operations - Predefined operations (e.g. assign_bus, remove_bus, add_tickets). assign_bus vehicle fields: see ManifestPatchAssignBusOperation
|
|
421
443
|
* @param {Object} [opts.headers] - Optional headers
|
|
422
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
444
|
+
* @returns {Promise<import("axios").AxiosResponse>} PatchedManifest; 400 BUS_NOT_FOUND (assign_bus target vehicle only; no name fallback when inventoryVehicleId is sent), INVALID_OPERATION, MANIFEST_ALREADY_DISPATCHED
|
|
423
445
|
*/
|
|
424
446
|
function patch({
|
|
425
447
|
token,
|
|
@@ -450,7 +472,7 @@ function manifestFactory({
|
|
|
450
472
|
* @param {string} [opts.token] - API key
|
|
451
473
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
452
474
|
* @param {string} [opts.providerId] - Provider id (required by API as query)
|
|
453
|
-
* @param {
|
|
475
|
+
* @param {ManifestSaveData} opts.data - Request body
|
|
454
476
|
* @param {Object} [opts.headers] - Optional headers
|
|
455
477
|
* @param {ManifestSaveQuery} [opts.query] - Query params (providerId required; manifestId, bypassBusValidation optional)
|
|
456
478
|
* @returns {Promise<import("axios").AxiosResponse>}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ const {
|
|
|
7
7
|
* @param {Object} deps
|
|
8
8
|
* @param {import("axios").AxiosInstance} deps.client
|
|
9
9
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
10
|
-
* @returns {{ get: function, defaultUsers: { create: function }, configurationReplication: { create: function } }}
|
|
10
|
+
* @returns {{ get: function, defaultUsers: { create: function }, configurationReplication: { create: function }, sessionRecordingSettings: { update: function } }}
|
|
11
11
|
*/
|
|
12
12
|
function accountsFactory({client, internalAuthTokenProvider}) {
|
|
13
13
|
/**
|
|
@@ -75,10 +75,42 @@ function accountsFactory({client, internalAuthTokenProvider}) {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Query params for PUT /accounts/:accountId/session-recording-settings (btrz-api-accounts).
|
|
80
|
+
* @typedef {Object} SessionRecordingSettingsUpdateQuery
|
|
81
|
+
* @property {string} superUserId - Super user id (ObjectId)
|
|
82
|
+
* @property {string} superUserHash - Super user hash
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
const sessionRecordingSettings = {
|
|
86
|
+
/**
|
|
87
|
+
* PUT /accounts/:accountId/session-recording-settings — replace logRocket and rrweb preferences.
|
|
88
|
+
* Requires SuperUser query credentials.
|
|
89
|
+
* @param {Object} opts
|
|
90
|
+
* @param {string} [opts.token] - API key
|
|
91
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
92
|
+
* @param {string} opts.accountId - Account _id (ObjectId)
|
|
93
|
+
* @param {SessionRecordingSettingsUpdateQuery} [opts.query] - superUserId, superUserHash
|
|
94
|
+
* @param {Object} opts.data - { logRocket, rrweb }
|
|
95
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
96
|
+
* @returns {Promise<import("axios").AxiosResponse>} 200 { logRocket, rrweb }
|
|
97
|
+
*/
|
|
98
|
+
update({token, jwtToken, accountId, query, data, headers}) {
|
|
99
|
+
return client({
|
|
100
|
+
url: `/accounts/${accountId}/session-recording-settings`,
|
|
101
|
+
method: "put",
|
|
102
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
103
|
+
params: query,
|
|
104
|
+
data
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
78
109
|
return {
|
|
79
110
|
get,
|
|
80
111
|
defaultUsers,
|
|
81
|
-
configurationReplication
|
|
112
|
+
configurationReplication,
|
|
113
|
+
sessionRecordingSettings
|
|
82
114
|
};
|
|
83
115
|
}
|
|
84
116
|
|
|
@@ -13,7 +13,7 @@ const {
|
|
|
13
13
|
* @property {string} [dateFrom] - Start date range (yyyy-mm-dd)
|
|
14
14
|
* @property {string} [dateTo] - End date range (yyyy-mm-dd)
|
|
15
15
|
* @property {string} [seatmapId] - Seatmap ID
|
|
16
|
-
* @property {string} [vehicleId] -
|
|
16
|
+
* @property {string} [vehicleId] - Inventory vehicle document ID (MongoDB ObjectId). Filters by manifest.vehicleId. Legacy exact display-name matching may still resolve server-side; do not rely on it for new clients
|
|
17
17
|
* @property {string} [assignedUserId] - Assigned user ID
|
|
18
18
|
* @property {boolean} [dispatched] - If manifest was dispatched
|
|
19
19
|
* @property {boolean} [reviewed] - If manifest was reviewed
|
|
@@ -26,6 +26,19 @@ const {
|
|
|
26
26
|
* @property {string} [status] - Comma-separated manifest statuses
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Body for PUT /manifests (btrz-api-operations ManifestSaveData). See put-manifest.
|
|
31
|
+
* @typedef {Object} ManifestSaveData
|
|
32
|
+
* @property {string} routeId - Route ID
|
|
33
|
+
* @property {string} scheduleId - Schedule ID
|
|
34
|
+
* @property {string} date - Date in YYYY-MM-DD format
|
|
35
|
+
* @property {string} [busSelected] - Human-readable vehicle name to assign or clear (legacy). Resolves by exact inventory name only when inventoryVehicleId is not provided. When inventoryVehicleId is also provided, the server resolves only by that ID and persists the resolved name for display/audit. Empty string unassigns only when inventoryVehicleId is absent
|
|
36
|
+
* @property {string} [inventoryVehicleId] - Stable inventory vehicle document ID (MongoDB ObjectId as string). When provided, bus assignment resolves only by this ID; there is no fallback to busSelected name. BUS_NOT_FOUND when the target vehicle cannot be resolved (invalid, disabled, deleted, or other account). Not returned when cleaning up a previous assignment whose vehicle was renamed or removed
|
|
37
|
+
* @property {number} [capacity] - Manifest capacity
|
|
38
|
+
* @property {string} [seatMapId] - Seatmap ID
|
|
39
|
+
* @property {string} [comments] - Comments
|
|
40
|
+
*/
|
|
41
|
+
|
|
29
42
|
/**
|
|
30
43
|
* Query params for PUT /manifests (btrz-api-operations). See put-manifest getSpec().
|
|
31
44
|
* @typedef {Object} ManifestSaveQuery
|
|
@@ -45,6 +58,15 @@ const {
|
|
|
45
58
|
* @property {string} [newdesign] - "true" when using new seatmap design
|
|
46
59
|
*/
|
|
47
60
|
|
|
61
|
+
/**
|
|
62
|
+
* assign_bus operation item for PATCH /manifests (btrz-api-operations ManifestUpdateOperation). See patch-manifest.
|
|
63
|
+
* @typedef {Object} ManifestPatchAssignBusOperation
|
|
64
|
+
* @property {"assign_bus"} op - Operation type
|
|
65
|
+
* @property {Object} manifest - Manifest data to update (ManifestUpdateCapacityNotificationSent)
|
|
66
|
+
* @property {string} [busId] - Case-sensitive inventory vehicle display name (legacy). Used only when inventoryVehicleId is not provided
|
|
67
|
+
* @property {string} [inventoryVehicleId] - Stable inventory vehicle document ID. When provided, the vehicle is resolved only by this ID (no name fallback); busId is persisted as the resolved vehicle name for display and audit. BUS_NOT_FOUND if the ID does not resolve (missing, disabled, deleted, or other account)
|
|
68
|
+
*/
|
|
69
|
+
|
|
48
70
|
/**
|
|
49
71
|
* Query params for GET /outlook-manifests (btrz-api-operations). See get-outlook-manifests getSpec().
|
|
50
72
|
* @typedef {Object} OutlookManifestsListQuery
|
|
@@ -313,9 +335,9 @@ function manifestFactory({
|
|
|
313
335
|
* @param {string} [opts.token] - API key
|
|
314
336
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
315
337
|
* @param {ManifestPatchQuery} [opts.query] - Query params (providerId required)
|
|
316
|
-
* @param {Object} opts.operations -
|
|
338
|
+
* @param {Array<ManifestPatchAssignBusOperation|Object>} opts.operations - Predefined operations (e.g. assign_bus, remove_bus, add_tickets). assign_bus vehicle fields: see ManifestPatchAssignBusOperation
|
|
317
339
|
* @param {Object} [opts.headers] - Optional headers
|
|
318
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
340
|
+
* @returns {Promise<import("axios").AxiosResponse>} PatchedManifest; 400 BUS_NOT_FOUND (assign_bus target vehicle only; no name fallback when inventoryVehicleId is sent), INVALID_OPERATION, MANIFEST_ALREADY_DISPATCHED
|
|
319
341
|
*/
|
|
320
342
|
function patch({
|
|
321
343
|
token, jwtToken, query = {}, operations, headers
|
|
@@ -337,7 +359,7 @@ function manifestFactory({
|
|
|
337
359
|
* @param {string} [opts.token] - API key
|
|
338
360
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
339
361
|
* @param {string} [opts.providerId] - Provider id (required by API as query)
|
|
340
|
-
* @param {
|
|
362
|
+
* @param {ManifestSaveData} opts.data - Request body
|
|
341
363
|
* @param {Object} [opts.headers] - Optional headers
|
|
342
364
|
* @param {ManifestSaveQuery} [opts.query] - Query params (providerId required; manifestId, bypassBusValidation optional)
|
|
343
365
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
@@ -68,4 +68,31 @@ describe("accounts/accounts", () => {
|
|
|
68
68
|
query
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
|
+
|
|
72
|
+
it("should PUT session recording settings for an account", () => {
|
|
73
|
+
const accountId = "5976090487a7f1e158000041";
|
|
74
|
+
const query = {
|
|
75
|
+
superUserId: "superUserId",
|
|
76
|
+
superUserHash: "superUserHash"
|
|
77
|
+
};
|
|
78
|
+
const data = {
|
|
79
|
+
logRocket: {enabled: true, pathPrefixes: ["/manifests"]},
|
|
80
|
+
rrweb: {enabled: true, pathGroups: [["/manifests"]]}
|
|
81
|
+
};
|
|
82
|
+
axiosMock.onPut(`/accounts/${accountId}/session-recording-settings`)
|
|
83
|
+
.reply(expectRequest({
|
|
84
|
+
statusCode: 200,
|
|
85
|
+
token,
|
|
86
|
+
jwtToken,
|
|
87
|
+
query,
|
|
88
|
+
body: data
|
|
89
|
+
}));
|
|
90
|
+
return api.accounts.accounts.sessionRecordingSettings.update({
|
|
91
|
+
token,
|
|
92
|
+
jwtToken,
|
|
93
|
+
accountId,
|
|
94
|
+
query,
|
|
95
|
+
data
|
|
96
|
+
});
|
|
97
|
+
});
|
|
71
98
|
});
|
|
@@ -4,7 +4,7 @@ export = accountsFactory;
|
|
|
4
4
|
* @param {Object} deps
|
|
5
5
|
* @param {import("axios").AxiosInstance} deps.client
|
|
6
6
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
7
|
-
* @returns {{ get: function, defaultUsers: { create: function }, configurationReplication: { create: function } }}
|
|
7
|
+
* @returns {{ get: function, defaultUsers: { create: function }, configurationReplication: { create: function }, sessionRecordingSettings: { update: function } }}
|
|
8
8
|
*/
|
|
9
9
|
declare function accountsFactory({ client, internalAuthTokenProvider }: {
|
|
10
10
|
client: import("axios").AxiosInstance;
|
|
@@ -19,4 +19,7 @@ declare function accountsFactory({ client, internalAuthTokenProvider }: {
|
|
|
19
19
|
configurationReplication: {
|
|
20
20
|
create: Function;
|
|
21
21
|
};
|
|
22
|
+
sessionRecordingSettings: {
|
|
23
|
+
update: Function;
|
|
24
|
+
};
|
|
22
25
|
};
|