@ordergroove/smi-serve 1.12.3 → 1.12.5
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/CHANGELOG.md +19 -0
- package/coverage/cobertura-coverage.xml +70 -60
- package/coverage/coverage.txt +3 -3
- package/package.json +3 -3
- package/src/impersonate.js +11 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.12.5](https://github.com/ordergroove/plush-toys/compare/@ordergroove/smi-serve@1.12.4...@ordergroove/smi-serve@1.12.5) (2026-03-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* cancel in-flight impersonate requests to avoid race condition ([f097390](https://github.com/ordergroove/plush-toys/commit/f09739033a095184194e63c7529856abfbbeff00))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.12.4](https://github.com/ordergroove/plush-toys/compare/@ordergroove/smi-serve@1.12.3...@ordergroove/smi-serve@1.12.4) (2026-03-04)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @ordergroove/smi-serve
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [1.12.3](https://github.com/ordergroove/plush-toys/compare/@ordergroove/smi-serve@1.12.2...@ordergroove/smi-serve@1.12.3) (2026-03-04)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @ordergroove/smi-serve
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<?xml version="1.0" ?>
|
|
2
2
|
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
|
|
3
|
-
<coverage lines-valid="
|
|
3
|
+
<coverage lines-valid="652" lines-covered="228" line-rate="0.3496" branches-valid="234" branches-covered="45" branch-rate="0.1923" timestamp="1772660095201" complexity="0" version="0.1">
|
|
4
4
|
<sources>
|
|
5
5
|
<source>/home/jenkins/agent/workspace/Ordergroove_plush-toys_master/plush-toys/packages/smi-serve</source>
|
|
6
6
|
</sources>
|
|
7
7
|
<packages>
|
|
8
|
-
<package name="smi-serve" line-rate="0.
|
|
8
|
+
<package name="smi-serve" line-rate="0.3689" branch-rate="0.2184">
|
|
9
9
|
<classes>
|
|
10
10
|
<class name="auth-monitor.js" filename="src/auth-monitor.js" line-rate="0.12" branch-rate="0">
|
|
11
11
|
<methods>
|
|
@@ -157,61 +157,66 @@
|
|
|
157
157
|
<line number="35" hits="1" branch="false"/>
|
|
158
158
|
</lines>
|
|
159
159
|
</class>
|
|
160
|
-
<class name="impersonate.js" filename="src/impersonate.js" line-rate="0.
|
|
160
|
+
<class name="impersonate.js" filename="src/impersonate.js" line-rate="0.1617" branch-rate="0">
|
|
161
161
|
<methods>
|
|
162
162
|
<method name="searchCustomers" hits="0" signature="()V">
|
|
163
163
|
<lines>
|
|
164
|
-
<line number="
|
|
164
|
+
<line number="20" hits="0"/>
|
|
165
165
|
</lines>
|
|
166
166
|
</method>
|
|
167
|
-
<method name="
|
|
167
|
+
<method name="(anonymous_1)" hits="0" signature="()V">
|
|
168
168
|
<lines>
|
|
169
|
-
<line number="
|
|
169
|
+
<line number="33" hits="0"/>
|
|
170
170
|
</lines>
|
|
171
171
|
</method>
|
|
172
|
-
<method name="
|
|
172
|
+
<method name="tryToLoadSelectedCustomer" hits="0" signature="()V">
|
|
173
173
|
<lines>
|
|
174
|
-
<line number="
|
|
174
|
+
<line number="42" hits="0"/>
|
|
175
175
|
</lines>
|
|
176
176
|
</method>
|
|
177
|
-
<method name="
|
|
177
|
+
<method name="impersonate" hits="0" signature="()V">
|
|
178
178
|
<lines>
|
|
179
|
-
<line number="
|
|
179
|
+
<line number="54" hits="0"/>
|
|
180
180
|
</lines>
|
|
181
181
|
</method>
|
|
182
182
|
<method name="(anonymous_4)" hits="0" signature="()V">
|
|
183
183
|
<lines>
|
|
184
|
-
<line number="
|
|
184
|
+
<line number="61" hits="0"/>
|
|
185
185
|
</lines>
|
|
186
186
|
</method>
|
|
187
187
|
<method name="(anonymous_5)" hits="0" signature="()V">
|
|
188
188
|
<lines>
|
|
189
|
-
<line number="
|
|
189
|
+
<line number="73" hits="0"/>
|
|
190
190
|
</lines>
|
|
191
191
|
</method>
|
|
192
192
|
<method name="(anonymous_6)" hits="0" signature="()V">
|
|
193
193
|
<lines>
|
|
194
|
-
<line number="
|
|
194
|
+
<line number="83" hits="0"/>
|
|
195
195
|
</lines>
|
|
196
196
|
</method>
|
|
197
197
|
<method name="(anonymous_7)" hits="0" signature="()V">
|
|
198
198
|
<lines>
|
|
199
|
-
<line number="
|
|
199
|
+
<line number="107" hits="0"/>
|
|
200
|
+
</lines>
|
|
201
|
+
</method>
|
|
202
|
+
<method name="(anonymous_8)" hits="0" signature="()V">
|
|
203
|
+
<lines>
|
|
204
|
+
<line number="110" hits="0"/>
|
|
200
205
|
</lines>
|
|
201
206
|
</method>
|
|
202
207
|
<method name="saveSelectedCustomer" hits="0" signature="()V">
|
|
203
208
|
<lines>
|
|
204
|
-
<line number="
|
|
209
|
+
<line number="119" hits="0"/>
|
|
205
210
|
</lines>
|
|
206
211
|
</method>
|
|
207
212
|
<method name="loadSelectedCustomer" hits="0" signature="()V">
|
|
208
213
|
<lines>
|
|
209
|
-
<line number="
|
|
214
|
+
<line number="128" hits="0"/>
|
|
210
215
|
</lines>
|
|
211
216
|
</method>
|
|
212
217
|
<method name="cliCallSelectCustomer" hits="0" signature="()V">
|
|
213
218
|
<lines>
|
|
214
|
-
<line number="
|
|
219
|
+
<line number="140" hits="0"/>
|
|
215
220
|
</lines>
|
|
216
221
|
</method>
|
|
217
222
|
</methods>
|
|
@@ -222,63 +227,68 @@
|
|
|
222
227
|
<line number="4" hits="1" branch="false"/>
|
|
223
228
|
<line number="5" hits="1" branch="false"/>
|
|
224
229
|
<line number="7" hits="1" branch="false"/>
|
|
225
|
-
<line number="
|
|
226
|
-
<line number="33" hits="0" branch="
|
|
227
|
-
<line number="
|
|
228
|
-
<line number="
|
|
229
|
-
<line number="
|
|
230
|
-
<line number="43" hits="0" branch="
|
|
231
|
-
<line number="
|
|
232
|
-
<line number="
|
|
233
|
-
<line number="
|
|
234
|
-
<line number="
|
|
235
|
-
<line number="
|
|
236
|
-
<line number="58" hits="0" branch="false"/>
|
|
230
|
+
<line number="21" hits="0" branch="false"/>
|
|
231
|
+
<line number="33" hits="0" branch="false"/>
|
|
232
|
+
<line number="35" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
233
|
+
<line number="36" hits="0" branch="false"/>
|
|
234
|
+
<line number="39" hits="0" branch="false"/>
|
|
235
|
+
<line number="43" hits="0" branch="false"/>
|
|
236
|
+
<line number="45" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
237
|
+
<line number="46" hits="0" branch="false"/>
|
|
238
|
+
<line number="49" hits="0" branch="false"/>
|
|
239
|
+
<line number="50" hits="0" branch="false"/>
|
|
240
|
+
<line number="55" hits="0" branch="false"/>
|
|
237
241
|
<line number="59" hits="0" branch="false"/>
|
|
238
242
|
<line number="60" hits="0" branch="false"/>
|
|
239
|
-
<line number="61" hits="0" branch="
|
|
243
|
+
<line number="61" hits="0" branch="false"/>
|
|
244
|
+
<line number="62" hits="0" branch="false"/>
|
|
240
245
|
<line number="63" hits="0" branch="false"/>
|
|
241
|
-
<line number="
|
|
246
|
+
<line number="64" hits="0" branch="false"/>
|
|
242
247
|
<line number="66" hits="0" branch="false"/>
|
|
243
|
-
<line number="
|
|
248
|
+
<line number="67" hits="0" branch="false"/>
|
|
249
|
+
<line number="68" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
250
|
+
<line number="70" hits="0" branch="false"/>
|
|
244
251
|
<line number="72" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
245
252
|
<line number="73" hits="0" branch="false"/>
|
|
246
|
-
<line number="74" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
247
253
|
<line number="75" hits="0" branch="false"/>
|
|
248
|
-
<line number="
|
|
249
|
-
<line number="77" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
250
|
-
<line number="78" hits="0" branch="false"/>
|
|
254
|
+
<line number="79" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
251
255
|
<line number="80" hits="0" branch="false"/>
|
|
252
|
-
<line number="
|
|
256
|
+
<line number="81" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
257
|
+
<line number="82" hits="0" branch="false"/>
|
|
258
|
+
<line number="83" hits="0" branch="false"/>
|
|
259
|
+
<line number="84" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
260
|
+
<line number="85" hits="0" branch="false"/>
|
|
253
261
|
<line number="87" hits="0" branch="false"/>
|
|
254
|
-
<line number="
|
|
255
|
-
<line number="89" hits="0" branch="false"/>
|
|
256
|
-
<line number="93" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
262
|
+
<line number="93" hits="0" branch="true" condition-coverage="0% (0/5)"/>
|
|
257
263
|
<line number="94" hits="0" branch="false"/>
|
|
264
|
+
<line number="95" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
265
|
+
<line number="96" hits="0" branch="false"/>
|
|
258
266
|
<line number="100" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
259
|
-
<line number="
|
|
260
|
-
<line number="
|
|
261
|
-
<line number="
|
|
267
|
+
<line number="101" hits="0" branch="false"/>
|
|
268
|
+
<line number="107" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
269
|
+
<line number="111" hits="0" branch="false"/>
|
|
262
270
|
<line number="113" hits="0" branch="false"/>
|
|
263
|
-
<line number="
|
|
264
|
-
<line number="
|
|
265
|
-
<line number="
|
|
266
|
-
<line number="127" hits="0" branch="false"/>
|
|
271
|
+
<line number="116" hits="0" branch="false"/>
|
|
272
|
+
<line number="120" hits="0" branch="false"/>
|
|
273
|
+
<line number="129" hits="0" branch="false"/>
|
|
267
274
|
<line number="130" hits="0" branch="false"/>
|
|
268
|
-
<line number="
|
|
269
|
-
<line number="
|
|
270
|
-
<line number="137" hits="0" branch="
|
|
271
|
-
<line number="
|
|
272
|
-
<line number="
|
|
273
|
-
<line number="144" hits="0" branch="
|
|
275
|
+
<line number="133" hits="0" branch="true" condition-coverage="0% (0/5)"/>
|
|
276
|
+
<line number="134" hits="0" branch="false"/>
|
|
277
|
+
<line number="137" hits="0" branch="false"/>
|
|
278
|
+
<line number="142" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
279
|
+
<line number="143" hits="0" branch="false"/>
|
|
280
|
+
<line number="144" hits="0" branch="true" condition-coverage="0% (0/4)"/>
|
|
274
281
|
<line number="145" hits="0" branch="false"/>
|
|
275
|
-
<line number="
|
|
276
|
-
<line number="
|
|
277
|
-
<line number="
|
|
278
|
-
<line number="
|
|
279
|
-
<line number="
|
|
280
|
-
<line number="
|
|
281
|
-
<line number="
|
|
282
|
+
<line number="148" hits="0" branch="false"/>
|
|
283
|
+
<line number="151" hits="0" branch="false"/>
|
|
284
|
+
<line number="152" hits="0" branch="false"/>
|
|
285
|
+
<line number="154" hits="0" branch="false"/>
|
|
286
|
+
<line number="163" hits="0" branch="false"/>
|
|
287
|
+
<line number="166" hits="1" branch="false"/>
|
|
288
|
+
<line number="167" hits="1" branch="false"/>
|
|
289
|
+
<line number="168" hits="1" branch="false"/>
|
|
290
|
+
<line number="169" hits="1" branch="false"/>
|
|
291
|
+
<line number="170" hits="1" branch="false"/>
|
|
282
292
|
</lines>
|
|
283
293
|
</class>
|
|
284
294
|
<class name="init.js" filename="src/init.js" line-rate="0.875" branch-rate="0.375">
|
package/coverage/coverage.txt
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---------------------|---------|----------|---------|---------|-------------------------------------------------------------------------
|
|
2
2
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
3
3
|
---------------------|---------|----------|---------|---------|-------------------------------------------------------------------------
|
|
4
|
-
All files | 34.
|
|
5
|
-
src |
|
|
4
|
+
All files | 34.71 | 19.23 | 26.4 | 34.96 |
|
|
5
|
+
src | 36.61 | 21.84 | 27.96 | 36.89 |
|
|
6
6
|
auth-monitor.js | 12 | 0 | 0 | 12 | 12-127
|
|
7
7
|
auth.js | 93.33 | 83.33 | 100 | 93.33 | 14
|
|
8
8
|
hmac-refresh.js | 28.57 | 0 | 0 | 28.57 | 14-29
|
|
9
|
-
impersonate.js |
|
|
9
|
+
impersonate.js | 15.71 | 0 | 0 | 16.17 | 21-163
|
|
10
10
|
init.js | 84.09 | 37.5 | 87.5 | 87.5 | 38,53-54,64,83
|
|
11
11
|
login.js | 13.46 | 16.66 | 6.66 | 14 | 6-87
|
|
12
12
|
pull-theme.js | 77.77 | 56.25 | 93.75 | 76.84 | 25-28,37-38,69-70,77,94,102-103,117,130,145,156-157,163-166,178,234-239
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/smi-serve",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.5",
|
|
4
4
|
"description": "Utility to serve a Subscription Manager template locally",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Eugenio Lattanzio <eugenio.lattanzio@ordergroove.com>",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/ordergroove/plush-toys/tree/master/packages/smi-serve#readme",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@ordergroove/smi-precompile": "^1.12.
|
|
24
|
+
"@ordergroove/smi-precompile": "^1.12.3",
|
|
25
25
|
"adm-zip": "^0.5.10",
|
|
26
26
|
"esbuild": "^0.19.2",
|
|
27
27
|
"esbuild-plugin-less": "^1.2.4",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"memfs": "^4.8.2"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "3ff31e125a6bfe71d120e3fcc1e1056e8d6aa416"
|
|
38
38
|
}
|
package/src/impersonate.js
CHANGED
|
@@ -14,9 +14,10 @@ inquirer.registerPrompt('autocomplete', inquirerPrompt);
|
|
|
14
14
|
* @param {object} params.merchant - Merchant object
|
|
15
15
|
* @param {string} params.query - Search query
|
|
16
16
|
* @param {number} [params.pageLimit=10] - Maximum number of results
|
|
17
|
+
* @param {AbortSignal} params.signal - Signal to cancel the request
|
|
17
18
|
* @returns {Promise<object>} Response with customers array and hmac_timestamp
|
|
18
19
|
*/
|
|
19
|
-
async function searchCustomers({ args, token, merchant, query, pageLimit = 10 }) {
|
|
20
|
+
async function searchCustomers({ args, token, merchant, query, pageLimit = 10, signal }) {
|
|
20
21
|
const fetchRes = await fetch(
|
|
21
22
|
`${getRC3Url(args)}csa/customer_search_req_keyword.json?${new URLSearchParams([
|
|
22
23
|
['merchant_id', merchant.public_id],
|
|
@@ -26,9 +27,10 @@ async function searchCustomers({ args, token, merchant, query, pageLimit = 10 })
|
|
|
26
27
|
{
|
|
27
28
|
headers: {
|
|
28
29
|
authorization: `Bearer ${token}`
|
|
29
|
-
}
|
|
30
|
+
},
|
|
31
|
+
signal
|
|
30
32
|
}
|
|
31
|
-
);
|
|
33
|
+
).catch(() => ({ customers: [], hmac_timestamp: null }));
|
|
32
34
|
|
|
33
35
|
if (fetchRes.status !== 200) {
|
|
34
36
|
return { customers: [], hmac_timestamp: null };
|
|
@@ -55,12 +57,17 @@ async function impersonate(args, autoSelectSingleResult = true) {
|
|
|
55
57
|
let customersResponse, az;
|
|
56
58
|
|
|
57
59
|
const impersonateInput = args.impersonate;
|
|
60
|
+
let abortController = null;
|
|
58
61
|
const search = async input => {
|
|
62
|
+
abortController?.abort(); // cancel any in-flight search to avoid race conditions
|
|
63
|
+
abortController = new AbortController();
|
|
64
|
+
const { signal } = abortController;
|
|
65
|
+
|
|
59
66
|
az = [];
|
|
60
67
|
customersResponse = [];
|
|
61
68
|
if (!input) return [];
|
|
62
69
|
|
|
63
|
-
customersResponse = await searchCustomers({ args, token, merchant, query: input, pageLimit: 10 });
|
|
70
|
+
customersResponse = await searchCustomers({ args, token, merchant, query: input, pageLimit: 10, signal });
|
|
64
71
|
|
|
65
72
|
az = (customersResponse.customers || []).map(
|
|
66
73
|
({ first_name, last_name, email }) => `${first_name} ${last_name} (${email})`
|