btrz-api-client 9.22.0 → 9.26.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.js CHANGED
@@ -191,6 +191,10 @@ function createInventory({
191
191
  client,
192
192
  internalAuthTokenProvider
193
193
  }),
194
+ cloverTerminals: require("./endpoints/inventory/clover-terminals.js")({
195
+ client,
196
+ internalAuthTokenProvider
197
+ }),
194
198
  giftCertificateDefinitions: require("./endpoints/inventory/gift-certificate-definitions.js")({
195
199
  client,
196
200
  internalAuthTokenProvider
@@ -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;
@@ -0,0 +1,181 @@
1
+ const {
2
+ authorizationHeaders
3
+ } = require("../endpoints_helpers.js");
4
+
5
+ /**
6
+ * Query params for GET /clover-terminals (btrz-api-inventory). See get-handler getSpec().
7
+ * @typedef {Object} CloverTerminalsQuery
8
+ * @property {number} [page] - The page number to retrieve
9
+ * @property {string} [stationId] - Filter terminals by station (location) ID
10
+ * @property {string} [serialNumber] - Filter terminals by serial number
11
+ */
12
+
13
+ /**
14
+ * Factory for clover-terminals API (btrz-api-inventory).
15
+ * @param {Object} deps
16
+ * @param {import("axios").AxiosInstance} deps.client
17
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
18
+ * @returns {{ all: function, get: function, create: function, remove: function, update: function }}
19
+ */
20
+ function cloverTerminalFactory({
21
+ client,
22
+ internalAuthTokenProvider
23
+ }) {
24
+ /**
25
+ * GET /clover-terminals - list Clover terminals (paginated).
26
+ * @param {Object} opts
27
+ * @param {string} [opts.token] - API key
28
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
29
+ * @param {CloverTerminalsQuery} [opts.query] - Query params (page, stationId, serialNumber)
30
+ * @param {Object} [opts.headers] - Optional headers
31
+ * @returns {Promise<import("axios").AxiosResponse<{ cloverTerminals: Array, next?: string, previous?: string, count: number }>>}
32
+ * @throws When response is 4xx/5xx (400 INVALID_PAGE, 401, 500)
33
+ */
34
+ function all({
35
+ token,
36
+ jwtToken,
37
+ query = {},
38
+ headers
39
+ }) {
40
+ return client.get("/clover-terminals", {
41
+ params: query,
42
+ headers: authorizationHeaders({
43
+ token,
44
+ jwtToken,
45
+ internalAuthTokenProvider,
46
+ headers
47
+ })
48
+ });
49
+ }
50
+
51
+ /**
52
+ * GET /clover-terminals/:cloverTerminalId - get a Clover terminal by id.
53
+ * @param {Object} opts
54
+ * @param {string} [opts.token] - API key
55
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
56
+ * @param {string} opts.cloverTerminalId - Clover terminal id (24 hex characters)
57
+ * @param {Object} [opts.headers] - Optional headers
58
+ * @returns {Promise<import("axios").AxiosResponse<{ cloverTerminal: Object }>>}
59
+ * @throws When response is 4xx/5xx (400 INVALID_CLOVER_TERMINAL_ID, 401, 404 CLOVER_TERMINAL_NOT_FOUND, 500)
60
+ */
61
+ function get({
62
+ cloverTerminalId,
63
+ token,
64
+ jwtToken,
65
+ headers
66
+ }) {
67
+ return client.get(`/clover-terminals/${cloverTerminalId}`, {
68
+ headers: authorizationHeaders({
69
+ token,
70
+ jwtToken,
71
+ internalAuthTokenProvider,
72
+ headers
73
+ })
74
+ });
75
+ }
76
+
77
+ /**
78
+ * POST /clover-terminals - create Clover terminal.
79
+ * @param {Object} opts
80
+ * @param {string} [opts.token] - API key
81
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
82
+ * @param {Object} opts.cloverTerminal - Clover terminal payload (name, serialNumber, stationId optional)
83
+ * @param {Object} [opts.headers] - Optional headers
84
+ * @returns {Promise<import("axios").AxiosResponse<{ cloverTerminal: Object }>>}
85
+ * @throws When response is 4xx/5xx (400 WRONG_DATA/INVALID_STATION_ID/STATION_NOT_FOUND, 401, 409 duplicate name/serial, 500)
86
+ */
87
+ function create({
88
+ jwtToken,
89
+ token,
90
+ cloverTerminal,
91
+ headers
92
+ }) {
93
+ return client({
94
+ url: "/clover-terminals",
95
+ method: "post",
96
+ headers: authorizationHeaders({
97
+ token,
98
+ jwtToken,
99
+ internalAuthTokenProvider,
100
+ headers
101
+ }),
102
+ data: {
103
+ cloverTerminal
104
+ }
105
+ });
106
+ }
107
+
108
+ /**
109
+ * DELETE /clover-terminals/:cloverTerminalId - remove Clover terminal.
110
+ * @param {Object} opts
111
+ * @param {string} [opts.token] - API key
112
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
113
+ * @param {string} opts.cloverTerminalId - Clover terminal id (24 hex characters)
114
+ * @param {Object} [opts.headers] - Optional headers
115
+ * @returns {Promise<import("axios").AxiosResponse<{ cloverTerminalId: string }>>}
116
+ * @throws When response is 4xx/5xx (400 INVALID_CLOVER_TERMINAL_ID, 401, 404 CLOVER_TERMINAL_NOT_FOUND, 500)
117
+ */
118
+ function remove({
119
+ jwtToken,
120
+ cloverTerminalId,
121
+ token,
122
+ headers
123
+ }) {
124
+ return client({
125
+ url: `/clover-terminals/${cloverTerminalId}`,
126
+ method: "delete",
127
+ headers: authorizationHeaders({
128
+ token,
129
+ jwtToken,
130
+ internalAuthTokenProvider,
131
+ headers
132
+ })
133
+ });
134
+ }
135
+
136
+ /**
137
+ * PUT /clover-terminals/:cloverTerminalId - update Clover terminal.
138
+ * @param {Object} opts
139
+ * @param {string} [opts.token] - API key
140
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
141
+ * @param {string} opts.cloverTerminalId - Clover terminal id (24 hex characters)
142
+ * @param {Object} opts.cloverTerminal - Clover terminal payload (name, serialNumber, stationId)
143
+ * @param {Object} [opts.headers] - Optional headers
144
+ * @returns {Promise<import("axios").AxiosResponse<{ cloverTerminal: Object }>>}
145
+ * @throws When response is 4xx/5xx (400, 401, 404 CLOVER_TERMINAL_NOT_FOUND, 409 duplicate name/serial, 500)
146
+ */
147
+ function update({
148
+ jwtToken,
149
+ token,
150
+ cloverTerminalId,
151
+ cloverTerminal,
152
+ headers
153
+ }) {
154
+ const _cloverTerminalId = cloverTerminalId || cloverTerminal._id;
155
+ return client({
156
+ url: `/clover-terminals/${_cloverTerminalId}`,
157
+ method: "put",
158
+ headers: authorizationHeaders({
159
+ token,
160
+ jwtToken,
161
+ internalAuthTokenProvider,
162
+ headers
163
+ }),
164
+ data: {
165
+ cloverTerminal: {
166
+ name: cloverTerminal.name,
167
+ serialNumber: cloverTerminal.serialNumber,
168
+ stationId: cloverTerminal.stationId
169
+ }
170
+ }
171
+ });
172
+ }
173
+ return {
174
+ all,
175
+ get,
176
+ create,
177
+ remove,
178
+ update
179
+ };
180
+ }
181
+ module.exports = cloverTerminalFactory;
@@ -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] - Vehicle ID
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 - JSON Patch 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 {Object} opts.data - Request body
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "9.22.0",
3
+ "version": "9.26.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/client.js CHANGED
@@ -86,6 +86,7 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
86
86
  garages: require("./endpoints/inventory/garages.js")({client, internalAuthTokenProvider}),
87
87
  banorteTerminals: require("./endpoints/inventory/banorte-terminals.js")({client, internalAuthTokenProvider}),
88
88
  getnetTerminals: require("./endpoints/inventory/getnet-terminals.js")({client, internalAuthTokenProvider}),
89
+ cloverTerminals: require("./endpoints/inventory/clover-terminals.js")({client, internalAuthTokenProvider}),
89
90
  giftCertificateDefinitions: require("./endpoints/inventory/gift-certificate-definitions.js")({client, internalAuthTokenProvider}),
90
91
  healthCheck: require("./endpoints/inventory/healthcheck.js")({client, internalAuthTokenProvider}),
91
92
  holidays: require("./endpoints/inventory/holidays.js")({client, internalAuthTokenProvider}),
@@ -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
 
@@ -0,0 +1,156 @@
1
+ const {
2
+ authorizationHeaders
3
+ } = require("../endpoints_helpers.js");
4
+
5
+ /**
6
+ * Query params for GET /clover-terminals (btrz-api-inventory). See get-handler getSpec().
7
+ * @typedef {Object} CloverTerminalsQuery
8
+ * @property {number} [page] - The page number to retrieve
9
+ * @property {string} [stationId] - Filter terminals by station (location) ID
10
+ * @property {string} [serialNumber] - Filter terminals by serial number
11
+ */
12
+
13
+ /**
14
+ * Factory for clover-terminals API (btrz-api-inventory).
15
+ * @param {Object} deps
16
+ * @param {import("axios").AxiosInstance} deps.client
17
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
18
+ * @returns {{ all: function, get: function, create: function, remove: function, update: function }}
19
+ */
20
+ function cloverTerminalFactory({client, internalAuthTokenProvider}) {
21
+ /**
22
+ * GET /clover-terminals - list Clover terminals (paginated).
23
+ * @param {Object} opts
24
+ * @param {string} [opts.token] - API key
25
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
26
+ * @param {CloverTerminalsQuery} [opts.query] - Query params (page, stationId, serialNumber)
27
+ * @param {Object} [opts.headers] - Optional headers
28
+ * @returns {Promise<import("axios").AxiosResponse<{ cloverTerminals: Array, next?: string, previous?: string, count: number }>>}
29
+ * @throws When response is 4xx/5xx (400 INVALID_PAGE, 401, 500)
30
+ */
31
+ function all({
32
+ token,
33
+ jwtToken,
34
+ query = {},
35
+ headers
36
+ }) {
37
+ return client.get("/clover-terminals", {
38
+ params: query,
39
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
40
+ });
41
+ }
42
+
43
+ /**
44
+ * GET /clover-terminals/:cloverTerminalId - get a Clover terminal by id.
45
+ * @param {Object} opts
46
+ * @param {string} [opts.token] - API key
47
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
48
+ * @param {string} opts.cloverTerminalId - Clover terminal id (24 hex characters)
49
+ * @param {Object} [opts.headers] - Optional headers
50
+ * @returns {Promise<import("axios").AxiosResponse<{ cloverTerminal: Object }>>}
51
+ * @throws When response is 4xx/5xx (400 INVALID_CLOVER_TERMINAL_ID, 401, 404 CLOVER_TERMINAL_NOT_FOUND, 500)
52
+ */
53
+ function get({
54
+ cloverTerminalId,
55
+ token,
56
+ jwtToken,
57
+ headers
58
+ }) {
59
+ return client.get(`/clover-terminals/${cloverTerminalId}`, {
60
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
61
+ });
62
+ }
63
+
64
+ /**
65
+ * POST /clover-terminals - create Clover terminal.
66
+ * @param {Object} opts
67
+ * @param {string} [opts.token] - API key
68
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
69
+ * @param {Object} opts.cloverTerminal - Clover terminal payload (name, serialNumber, stationId optional)
70
+ * @param {Object} [opts.headers] - Optional headers
71
+ * @returns {Promise<import("axios").AxiosResponse<{ cloverTerminal: Object }>>}
72
+ * @throws When response is 4xx/5xx (400 WRONG_DATA/INVALID_STATION_ID/STATION_NOT_FOUND, 401, 409 duplicate name/serial, 500)
73
+ */
74
+ function create({
75
+ jwtToken,
76
+ token,
77
+ cloverTerminal,
78
+ headers
79
+ }) {
80
+ return client({
81
+ url: "/clover-terminals",
82
+ method: "post",
83
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
84
+ data: {
85
+ cloverTerminal
86
+ }
87
+ });
88
+ }
89
+
90
+ /**
91
+ * DELETE /clover-terminals/:cloverTerminalId - remove Clover terminal.
92
+ * @param {Object} opts
93
+ * @param {string} [opts.token] - API key
94
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
95
+ * @param {string} opts.cloverTerminalId - Clover terminal id (24 hex characters)
96
+ * @param {Object} [opts.headers] - Optional headers
97
+ * @returns {Promise<import("axios").AxiosResponse<{ cloverTerminalId: string }>>}
98
+ * @throws When response is 4xx/5xx (400 INVALID_CLOVER_TERMINAL_ID, 401, 404 CLOVER_TERMINAL_NOT_FOUND, 500)
99
+ */
100
+ function remove({
101
+ jwtToken,
102
+ cloverTerminalId,
103
+ token,
104
+ headers
105
+ }) {
106
+ return client({
107
+ url: `/clover-terminals/${cloverTerminalId}`,
108
+ method: "delete",
109
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
110
+ });
111
+ }
112
+
113
+ /**
114
+ * PUT /clover-terminals/:cloverTerminalId - update Clover terminal.
115
+ * @param {Object} opts
116
+ * @param {string} [opts.token] - API key
117
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
118
+ * @param {string} opts.cloverTerminalId - Clover terminal id (24 hex characters)
119
+ * @param {Object} opts.cloverTerminal - Clover terminal payload (name, serialNumber, stationId)
120
+ * @param {Object} [opts.headers] - Optional headers
121
+ * @returns {Promise<import("axios").AxiosResponse<{ cloverTerminal: Object }>>}
122
+ * @throws When response is 4xx/5xx (400, 401, 404 CLOVER_TERMINAL_NOT_FOUND, 409 duplicate name/serial, 500)
123
+ */
124
+ function update({
125
+ jwtToken,
126
+ token,
127
+ cloverTerminalId,
128
+ cloverTerminal,
129
+ headers
130
+ }) {
131
+ const _cloverTerminalId = cloverTerminalId || cloverTerminal._id;
132
+
133
+ return client({
134
+ url: `/clover-terminals/${_cloverTerminalId}`,
135
+ method: "put",
136
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
137
+ data: {
138
+ cloverTerminal: {
139
+ name: cloverTerminal.name,
140
+ serialNumber: cloverTerminal.serialNumber,
141
+ stationId: cloverTerminal.stationId
142
+ }
143
+ }
144
+ });
145
+ }
146
+
147
+ return {
148
+ all,
149
+ get,
150
+ create,
151
+ remove,
152
+ update
153
+ };
154
+ }
155
+
156
+ module.exports = cloverTerminalFactory;
@@ -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] - Vehicle ID
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 - JSON Patch 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 {Object} opts.data - Request body
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>}
package/test/all.test.js CHANGED
@@ -98,6 +98,7 @@ require("./endpoints/inventory/filtered-trips.test.js");
98
98
  require("./endpoints/inventory/financing-costs.test.js");
99
99
  require("./endpoints/inventory/garages.test.js");
100
100
  require("./endpoints/inventory/banorte-terminals.test.js");
101
+ require("./endpoints/inventory/clover-terminals.test.js");
101
102
  require("./endpoints/inventory/getnet-terminals.test.js");
102
103
  require("./endpoints/inventory/gift-certificate-definitions.test.js");
103
104
  require("./endpoints/inventory/holidays.test.js");
@@ -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
  });