@shushed/helpers 0.0.198-v2-20251110171602 → 0.0.198-v2-20251111082635

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.
@@ -269,29 +269,28 @@ function onResponse(config, options, requiredFlag) {
269
269
  return;
270
270
  }
271
271
  let responsePayload;
272
- if (outputBody.headersToSet && outputBody.body) {
273
- responsePayload = outputBody.body;
274
- headersToSet = outputBody.headersToSet;
272
+ if (outputBody?.headersToSet && outputBody?.responses) {
273
+ responsePayload = outputBody.responses;
275
274
  }
276
275
  else {
277
276
  responsePayload = outputBody;
278
277
  }
279
- if (Array.isArray(responsePayload) && responsePayload.length === numberOfInputMessages) {
278
+ if (responsePayload && Array.isArray(responsePayload) && responsePayload.length === numberOfInputMessages) {
280
279
  return {
281
- status: (responsePayload.every(x => x instanceof Error) ? 500 : (outputStatus ? outputStatus : 200)),
280
+ status: headersToSet['retry-after'] ? 429 : (outputStatus ? outputStatus : ((responsePayload && responsePayload instanceof Error) ? 500 : 200)),
282
281
  value: responsePayload.map(x => {
283
- if (x.status && x.body) {
282
+ if (x && typeof x === 'object' && x.statusCode && x.body) {
284
283
  return x;
285
284
  }
286
285
  return {
287
- status: x instanceof Error ? (headersToSet['retry-after'] ? 429 : 500) : 200,
288
- body: x instanceof Error ? x.message : (flags.includes(requiredFlag || 'product-data') ? x : '<Redacted>. No product-data permissions>')
286
+ statusCode: x instanceof Error ? (headersToSet['retry-after'] ? 429 : 500) : 200,
287
+ body: x instanceof Error ? x.message : x,
289
288
  };
290
289
  })
291
290
  };
292
291
  }
293
292
  return {
294
- status: headersToSet['retry-after'] ? 429 : (outputStatus ? outputStatus : (responsePayload instanceof Error ? 500 : 200)),
293
+ status: headersToSet['retry-after'] ? 429 : (outputStatus ? outputStatus : ((responsePayload && responsePayload instanceof Error) ? 500 : 200)),
295
294
  value: responsePayload,
296
295
  cacheMaxAge: 0,
297
296
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shushed/helpers",
3
- "version": "0.0.198-v2-20251110171602",
3
+ "version": "0.0.198-v2-20251111082635",
4
4
  "author": "",
5
5
  "license": "UNLICENSED",
6
6
  "description": "",