@rebuy/rebuy 3.60.0 → 3.60.1
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/dist/server/index.cjs +21 -2
- package/dist/server/index.mjs +21 -2
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -5620,6 +5620,18 @@ var reportUnreadableVerdict = (metadata, report) => {
|
|
|
5620
5620
|
if (RuleVerdict.safeParse(metadata).success || isDefinitiveRuleAnswer(metadata)) return;
|
|
5621
5621
|
report?.({ detail: "rule verdict lacks readable custom.shouldShow", kind: "ruleVerdict" });
|
|
5622
5622
|
};
|
|
5623
|
+
var NAMED_ENVELOPE_KEYS = /* @__PURE__ */ new Set(["data", "error", "errors", "message", "metadata", "products", "status"]);
|
|
5624
|
+
var describeShape = (value) => {
|
|
5625
|
+
if (Array.isArray(value)) return `array (${value.length} items)`;
|
|
5626
|
+
if (typeof value !== "object") return typeof value;
|
|
5627
|
+
const keys = Object.keys(value);
|
|
5628
|
+
if (keys.length === 0) return "object (no keys)";
|
|
5629
|
+
if (keys.every((key) => /^\d+$/.test(key))) return `object (${keys.length} numeric keys)`;
|
|
5630
|
+
const named = keys.filter((key) => NAMED_ENVELOPE_KEYS.has(key)).sort();
|
|
5631
|
+
const others = keys.length - named.length;
|
|
5632
|
+
return `object (${[...named, ...others ? [`${others} other keys`] : []].join(", ")})`;
|
|
5633
|
+
};
|
|
5634
|
+
var describePath = (dataSourcePath) => /^(?:\/[\w-]{1,64}){1,6}$/.test(dataSourcePath) ? dataSourcePath : "an unrecognized path";
|
|
5623
5635
|
var withReviews = (product, integrations, report) => {
|
|
5624
5636
|
const { reviews: engineReviews, ...rest } = product;
|
|
5625
5637
|
const reviews = projectOfferProductReviews(integrations, product, report);
|
|
@@ -5650,8 +5662,15 @@ var fetchDataSourceResults = async (input, ctx) => {
|
|
|
5650
5662
|
const rawProducts = Array.isArray(raw.data) ? deepCamelCase(raw.data) : [];
|
|
5651
5663
|
const metadata = raw.metadata == null ? null : deepCamelCase(raw.metadata);
|
|
5652
5664
|
if (input.limit === 0) reportUnreadableVerdict(metadata, ctx.reportDrift);
|
|
5653
|
-
if (input.limit !== 0
|
|
5654
|
-
|
|
5665
|
+
if (input.limit !== 0) {
|
|
5666
|
+
const shape2 = upstream != null && (typeof upstream !== "object" || Array.isArray(upstream)) ? `body is ${describeShape(upstream)}` : raw.data != null && !Array.isArray(raw.data) ? `data is ${describeShape(raw.data)}` : void 0;
|
|
5667
|
+
if (shape2) {
|
|
5668
|
+
ctx.reportDrift?.({
|
|
5669
|
+
detail: `data-source products payload is not an array: ${shape2} from ${describePath(input.dataSourcePath)}`,
|
|
5670
|
+
kind: "dataSource"
|
|
5671
|
+
});
|
|
5672
|
+
}
|
|
5673
|
+
}
|
|
5655
5674
|
const products = dedupeById(rawProducts.filter((product) => keepValidProduct(product, ctx.reportDrift))).map(
|
|
5656
5675
|
(product) => withReviews(product, input.integrations, ctx.reportDrift)
|
|
5657
5676
|
);
|
package/dist/server/index.mjs
CHANGED
|
@@ -5547,6 +5547,18 @@ var reportUnreadableVerdict = (metadata, report) => {
|
|
|
5547
5547
|
if (RuleVerdict.safeParse(metadata).success || isDefinitiveRuleAnswer(metadata)) return;
|
|
5548
5548
|
report?.({ detail: "rule verdict lacks readable custom.shouldShow", kind: "ruleVerdict" });
|
|
5549
5549
|
};
|
|
5550
|
+
var NAMED_ENVELOPE_KEYS = /* @__PURE__ */ new Set(["data", "error", "errors", "message", "metadata", "products", "status"]);
|
|
5551
|
+
var describeShape = (value) => {
|
|
5552
|
+
if (Array.isArray(value)) return `array (${value.length} items)`;
|
|
5553
|
+
if (typeof value !== "object") return typeof value;
|
|
5554
|
+
const keys = Object.keys(value);
|
|
5555
|
+
if (keys.length === 0) return "object (no keys)";
|
|
5556
|
+
if (keys.every((key) => /^\d+$/.test(key))) return `object (${keys.length} numeric keys)`;
|
|
5557
|
+
const named = keys.filter((key) => NAMED_ENVELOPE_KEYS.has(key)).sort();
|
|
5558
|
+
const others = keys.length - named.length;
|
|
5559
|
+
return `object (${[...named, ...others ? [`${others} other keys`] : []].join(", ")})`;
|
|
5560
|
+
};
|
|
5561
|
+
var describePath = (dataSourcePath) => /^(?:\/[\w-]{1,64}){1,6}$/.test(dataSourcePath) ? dataSourcePath : "an unrecognized path";
|
|
5550
5562
|
var withReviews = (product, integrations, report) => {
|
|
5551
5563
|
const { reviews: engineReviews, ...rest } = product;
|
|
5552
5564
|
const reviews = projectOfferProductReviews(integrations, product, report);
|
|
@@ -5577,8 +5589,15 @@ var fetchDataSourceResults = async (input, ctx) => {
|
|
|
5577
5589
|
const rawProducts = Array.isArray(raw.data) ? deepCamelCase(raw.data) : [];
|
|
5578
5590
|
const metadata = raw.metadata == null ? null : deepCamelCase(raw.metadata);
|
|
5579
5591
|
if (input.limit === 0) reportUnreadableVerdict(metadata, ctx.reportDrift);
|
|
5580
|
-
if (input.limit !== 0
|
|
5581
|
-
|
|
5592
|
+
if (input.limit !== 0) {
|
|
5593
|
+
const shape2 = upstream != null && (typeof upstream !== "object" || Array.isArray(upstream)) ? `body is ${describeShape(upstream)}` : raw.data != null && !Array.isArray(raw.data) ? `data is ${describeShape(raw.data)}` : void 0;
|
|
5594
|
+
if (shape2) {
|
|
5595
|
+
ctx.reportDrift?.({
|
|
5596
|
+
detail: `data-source products payload is not an array: ${shape2} from ${describePath(input.dataSourcePath)}`,
|
|
5597
|
+
kind: "dataSource"
|
|
5598
|
+
});
|
|
5599
|
+
}
|
|
5600
|
+
}
|
|
5582
5601
|
const products = dedupeById(rawProducts.filter((product) => keepValidProduct(product, ctx.reportDrift))).map(
|
|
5583
5602
|
(product) => withReviews(product, input.integrations, ctx.reportDrift)
|
|
5584
5603
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuy/rebuy",
|
|
3
|
-
"version": "3.60.
|
|
3
|
+
"version": "3.60.1",
|
|
4
4
|
"description": "Shared zod schemas, legacy-to-CAB widget transforms, and server orchestrators for Rebuy's Shopify consumers (rebuy-api, admin-nextjs, rebuy-shopify-extensions)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Rebuy, Inc.",
|