@memberjunction/react-test-harness 2.102.0 → 2.103.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-linter.d.ts","sourceRoot":"","sources":["../../src/lib/component-linter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAiC,MAAM,6CAA6C,CAAC;AAG3G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAG/D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,cAAc,CAAC;IACnF,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAiFD,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,cAAc,CAAqB;IAGlD,OAAO,CAA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else {
|
|
5975
|
+
// Missing QueryName property
|
|
5976
|
+
violations.push({
|
|
5977
|
+
rule: 'runquery-runview-validation',
|
|
5978
|
+
severity: 'critical',
|
|
5979
|
+
line: path.node.loc?.start.line || 0,
|
|
5980
|
+
column: path.node.loc?.start.column || 0,
|
|
5981
|
+
message: `RunQuery call is missing the required "QueryName" property.`,
|
|
5982
|
+
code: path.toString().substring(0, 100)
|
|
5983
|
+
});
|
|
5984
|
+
}
|
|
5974
5985
|
}
|
|
5975
5986
|
}
|
|
5976
5987
|
// RunView validation removed - handled by data-requirements-validation
|
|
@@ -8763,6 +8774,83 @@ const extendedCallbacks = { ...callbacks, onCustomEvent: handler };
|
|
|
8763
8774
|
});
|
|
8764
8775
|
return violations;
|
|
8765
8776
|
}
|
|
8777
|
+
},
|
|
8778
|
+
{
|
|
8779
|
+
name: 'required-queries-not-called',
|
|
8780
|
+
appliesTo: 'root', // Only apply to root components
|
|
8781
|
+
test: (ast, componentName, componentSpec) => {
|
|
8782
|
+
const violations = [];
|
|
8783
|
+
// Check the mode - only enforce for 'queries' or 'hybrid' mode
|
|
8784
|
+
const mode = componentSpec?.dataRequirements?.mode;
|
|
8785
|
+
if (mode !== 'queries' && mode !== 'hybrid') {
|
|
8786
|
+
// Mode is not 'queries' or 'hybrid', so this rule doesn't apply
|
|
8787
|
+
return violations;
|
|
8788
|
+
}
|
|
8789
|
+
// Check if there are any queries defined in dataRequirements
|
|
8790
|
+
const hasQueries = componentSpec?.dataRequirements?.queries &&
|
|
8791
|
+
componentSpec.dataRequirements.queries.length > 0;
|
|
8792
|
+
if (!hasQueries) {
|
|
8793
|
+
// No queries defined, so no violation
|
|
8794
|
+
return violations;
|
|
8795
|
+
}
|
|
8796
|
+
// Track whether RunQuery is called anywhere
|
|
8797
|
+
let hasRunQueryCall = false;
|
|
8798
|
+
const queryNames = componentSpec.dataRequirements.queries.map(q => q.name).filter(Boolean);
|
|
8799
|
+
(0, traverse_1.default)(ast, {
|
|
8800
|
+
CallExpression(path) {
|
|
8801
|
+
// Check for utilities.rq.RunQuery pattern
|
|
8802
|
+
if (t.isMemberExpression(path.node.callee) &&
|
|
8803
|
+
t.isMemberExpression(path.node.callee.object) &&
|
|
8804
|
+
t.isIdentifier(path.node.callee.object.object) &&
|
|
8805
|
+
path.node.callee.object.object.name === 'utilities' &&
|
|
8806
|
+
t.isIdentifier(path.node.callee.object.property) &&
|
|
8807
|
+
path.node.callee.object.property.name === 'rq' &&
|
|
8808
|
+
t.isIdentifier(path.node.callee.property) &&
|
|
8809
|
+
path.node.callee.property.name === 'RunQuery') {
|
|
8810
|
+
hasRunQueryCall = true;
|
|
8811
|
+
}
|
|
8812
|
+
// Also check for destructured pattern: rq.RunQuery
|
|
8813
|
+
if (t.isMemberExpression(path.node.callee) &&
|
|
8814
|
+
t.isIdentifier(path.node.callee.object) &&
|
|
8815
|
+
path.node.callee.object.name === 'rq' &&
|
|
8816
|
+
t.isIdentifier(path.node.callee.property) &&
|
|
8817
|
+
path.node.callee.property.name === 'RunQuery') {
|
|
8818
|
+
hasRunQueryCall = true;
|
|
8819
|
+
}
|
|
8820
|
+
}
|
|
8821
|
+
});
|
|
8822
|
+
// If queries are defined but RunQuery is never called, that's a critical violation
|
|
8823
|
+
if (!hasRunQueryCall) {
|
|
8824
|
+
violations.push({
|
|
8825
|
+
rule: 'required-queries-not-called',
|
|
8826
|
+
severity: 'critical',
|
|
8827
|
+
line: 1,
|
|
8828
|
+
column: 0,
|
|
8829
|
+
message: `Component has ${queryNames.length} defined ${queryNames.length === 1 ? 'query' : 'queries'} in dataRequirements (mode: '${mode}') but never calls RunQuery. Queries defined: ${queryNames.join(', ')}`,
|
|
8830
|
+
suggestion: {
|
|
8831
|
+
text: `When dataRequirements.mode is '${mode}' and includes queries, you must use utilities.rq.RunQuery to execute them, not RunView.`,
|
|
8832
|
+
example: `// Your dataRequirements defines these queries: ${queryNames.join(', ')}
|
|
8833
|
+
// Mode is set to: '${mode}'
|
|
8834
|
+
|
|
8835
|
+
// ❌ WRONG - Using RunView for a query:
|
|
8836
|
+
const result = await utilities.rv.RunView({
|
|
8837
|
+
EntityName: '${queryNames[0] || 'QueryName'}'
|
|
8838
|
+
});
|
|
8839
|
+
|
|
8840
|
+
// ✅ CORRECT - Using RunQuery for queries:
|
|
8841
|
+
const result = await utilities.rq.RunQuery({
|
|
8842
|
+
QueryName: '${queryNames[0] || 'QueryName'}'
|
|
8843
|
+
});
|
|
8844
|
+
|
|
8845
|
+
// Key differences:
|
|
8846
|
+
// - RunView: For entity-based data access (uses EntityName)
|
|
8847
|
+
// - RunQuery: For pre-defined queries (uses QueryName)
|
|
8848
|
+
// - dataRequirements.mode: '${mode}' requires RunQuery for queries`
|
|
8849
|
+
}
|
|
8850
|
+
});
|
|
8851
|
+
}
|
|
8852
|
+
return violations;
|
|
8853
|
+
}
|
|
8766
8854
|
}
|
|
8767
8855
|
];
|
|
8768
8856
|
//# sourceMappingURL=component-linter.js.map
|