@memberjunction/react-test-harness 2.107.0 → 2.108.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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
+
{
|
|
4549
|
+
name: 'runquery-missing-categorypath',
|
|
4550
|
+
appliesTo: 'all',
|
|
4551
|
+
test: (ast, componentName, componentSpec) => {
|
|
4552
|
+
const violations = [];
|
|
4553
|
+
// Build a map of query names to their category paths from the spec
|
|
4554
|
+
const queryCategories = new Map();
|
|
4555
|
+
if (componentSpec?.dataRequirements?.queries) {
|
|
4556
|
+
for (const query of componentSpec.dataRequirements.queries) {
|
|
4557
|
+
// Only track queries with non-empty categoryPath (empty string means no categoryPath requirement)
|
|
4558
|
+
if (query.name && query.categoryPath && query.categoryPath.trim().length > 0) {
|
|
4559
|
+
queryCategories.set(query.name, query.categoryPath);
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4562
|
+
}
|
|
4563
|
+
// If no queries with categoryPath in spec, this rule doesn't apply
|
|
4564
|
+
if (queryCategories.size === 0) {
|
|
4565
|
+
return violations;
|
|
4566
|
+
}
|
|
4567
|
+
(0, traverse_1.default)(ast, {
|
|
4568
|
+
CallExpression(path) {
|
|
4569
|
+
const callee = path.node.callee;
|
|
4570
|
+
// Check for utilities.rq.RunQuery
|
|
4571
|
+
if (t.isMemberExpression(callee) &&
|
|
4572
|
+
t.isMemberExpression(callee.object) &&
|
|
4573
|
+
t.isIdentifier(callee.object.object) &&
|
|
4574
|
+
callee.object.object.name === 'utilities' &&
|
|
4575
|
+
t.isIdentifier(callee.object.property) &&
|
|
4576
|
+
callee.object.property.name === 'rq' &&
|
|
4577
|
+
t.isIdentifier(callee.property) &&
|
|
4578
|
+
callee.property.name === 'RunQuery') {
|
|
4579
|
+
// Get the first argument (RunQuery params object)
|
|
4580
|
+
const runQueryParams = path.node.arguments[0];
|
|
4581
|
+
if (!t.isObjectExpression(runQueryParams))
|
|
4582
|
+
return;
|
|
4583
|
+
// Extract QueryName and CategoryPath from the call
|
|
4584
|
+
let queryName = null;
|
|
4585
|
+
let hasCategoryPath = false;
|
|
4586
|
+
let queryNameProp;
|
|
4587
|
+
for (const prop of runQueryParams.properties) {
|
|
4588
|
+
if (t.isObjectProperty(prop) && t.isIdentifier(prop.key)) {
|
|
4589
|
+
if (prop.key.name === 'QueryName' && t.isStringLiteral(prop.value)) {
|
|
4590
|
+
queryName = prop.value.value;
|
|
4591
|
+
queryNameProp = prop;
|
|
4592
|
+
}
|
|
4593
|
+
else if (prop.key.name === 'CategoryPath') {
|
|
4594
|
+
hasCategoryPath = true;
|
|
4595
|
+
}
|
|
4596
|
+
}
|
|
4597
|
+
}
|
|
4598
|
+
// Check if this query requires a CategoryPath based on the spec
|
|
4599
|
+
if (queryName && queryCategories.has(queryName) && !hasCategoryPath) {
|
|
4600
|
+
const expectedCategoryPath = queryCategories.get(queryName);
|
|
4601
|
+
violations.push({
|
|
4602
|
+
rule: 'runquery-missing-categorypath',
|
|
4603
|
+
severity: 'critical',
|
|
4604
|
+
line: queryNameProp?.loc?.start.line || path.node.loc?.start.line || 0,
|
|
4605
|
+
column: queryNameProp?.loc?.start.column || path.node.loc?.start.column || 0,
|
|
4606
|
+
message: `RunQuery with QueryName '${queryName}' is missing required CategoryPath parameter. Queries are uniquely identified by both QueryName and CategoryPath together. Without CategoryPath, RunQuery may find a different query with the same name, causing collisions and unintended behavior.`,
|
|
4607
|
+
code: `RunQuery({ QueryName: '${queryName}' }) // Missing: CategoryPath`,
|
|
4608
|
+
suggestion: {
|
|
4609
|
+
text: `Add CategoryPath property to uniquely identify the query. The CategoryPath should match what's defined in your dataRequirements.queries[].categoryPath`,
|
|
4610
|
+
example: `await utilities.rq.RunQuery({
|
|
4611
|
+
QueryName: '${queryName}',
|
|
4612
|
+
CategoryPath: '${expectedCategoryPath}', // Required: ensures correct query is used
|
|
4613
|
+
Parameters: {
|
|
4614
|
+
// Your query parameters here
|
|
4615
|
+
}
|
|
4616
|
+
})`
|
|
4617
|
+
}
|
|
4618
|
+
});
|
|
4619
|
+
}
|
|
4620
|
+
}
|
|
4621
|
+
}
|
|
4622
|
+
});
|
|
4623
|
+
return violations;
|
|
4624
|
+
}
|
|
4625
|
+
},
|
|
4548
4626
|
{
|
|
4549
4627
|
name: 'runquery-parameters-validation',
|
|
4550
4628
|
appliesTo: 'all',
|