@adcp/sdk 13.0.0-rc.20 → 13.0.0-rc.21
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/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/testing/storyboard/runner.d.mts +5 -1
- package/dist/lib/testing/storyboard/runner.d.ts +5 -1
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/runner.js +9 -0
- package/dist/lib/testing/storyboard/runner.js.map +1 -1
- package/dist/lib/testing/storyboard/runner.mjs +9 -0
- package/dist/lib/testing/storyboard/runner.mjs.map +1 -1
- package/dist/lib/testing/storyboard/types.d.mts +21 -2
- package/dist/lib/testing/storyboard/types.d.ts +21 -2
- package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/types.js.map +1 -1
- package/dist/lib/testing/storyboard/types.mjs.map +1 -1
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/validations.js +69 -0
- package/dist/lib/testing/storyboard/validations.js.map +1 -1
- package/dist/lib/testing/storyboard/validations.mjs +69 -0
- package/dist/lib/testing/storyboard/validations.mjs.map +1 -1
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.js.map +1 -1
- package/dist/lib/version.mjs +3 -3
- package/dist/lib/version.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -104,6 +104,8 @@ function runValidation(validation, ctx) {
|
|
|
104
104
|
return validateNumericComparison(validation, ctx, NUMERIC_OPS.at_least);
|
|
105
105
|
case "field_equals_context":
|
|
106
106
|
return validateFieldEqualsContext(validation, ctx);
|
|
107
|
+
case "field_in_context_array":
|
|
108
|
+
return validateFieldInContextArray(validation, ctx);
|
|
107
109
|
case "upstream_traffic":
|
|
108
110
|
return validateUpstreamTraffic(validation, ctx);
|
|
109
111
|
case "replay_not_cached_rate_limit":
|
|
@@ -1843,6 +1845,73 @@ function validateFieldEqualsContext(validation, ctx) {
|
|
|
1843
1845
|
actual: actual ?? null
|
|
1844
1846
|
};
|
|
1845
1847
|
}
|
|
1848
|
+
function validateFieldInContextArray(validation, ctx) {
|
|
1849
|
+
if (!validation.path) {
|
|
1850
|
+
return {
|
|
1851
|
+
check: "field_in_context_array",
|
|
1852
|
+
passed: false,
|
|
1853
|
+
description: validation.description,
|
|
1854
|
+
error: "No path specified for field_in_context_array validation",
|
|
1855
|
+
json_pointer: null,
|
|
1856
|
+
expected: "path must be set in storyboard validation entry",
|
|
1857
|
+
actual: null
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1860
|
+
if (!validation.context_key) {
|
|
1861
|
+
return {
|
|
1862
|
+
check: "field_in_context_array",
|
|
1863
|
+
passed: false,
|
|
1864
|
+
description: validation.description,
|
|
1865
|
+
error: "field_in_context_array requires context_key to be set",
|
|
1866
|
+
json_pointer: null,
|
|
1867
|
+
expected: "context_key must be set in storyboard validation entry",
|
|
1868
|
+
actual: null
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
const comparandResult = resolveContextComparand(validation, ctx);
|
|
1872
|
+
if (!comparandResult.found) {
|
|
1873
|
+
return {
|
|
1874
|
+
check: "field_in_context_array",
|
|
1875
|
+
passed: true,
|
|
1876
|
+
description: validation.description,
|
|
1877
|
+
observations: [comparandResult.observation]
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
const allowed = comparandResult.value;
|
|
1881
|
+
const actual = resolvePath(resolveTarget(ctx).data, validation.path);
|
|
1882
|
+
const pointer = toJsonPointer(validation.path);
|
|
1883
|
+
if (!Array.isArray(allowed)) {
|
|
1884
|
+
return {
|
|
1885
|
+
check: "field_in_context_array",
|
|
1886
|
+
passed: false,
|
|
1887
|
+
description: validation.description,
|
|
1888
|
+
path: validation.path,
|
|
1889
|
+
error: `Expected context["${validation.context_key}"] to be an array; got ${JSON.stringify(allowed)}`,
|
|
1890
|
+
json_pointer: pointer,
|
|
1891
|
+
expected: "context value must be an array",
|
|
1892
|
+
actual: allowed
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
if (allowed.some((candidate) => valuesMatch(actual, candidate))) {
|
|
1896
|
+
return {
|
|
1897
|
+
check: "field_in_context_array",
|
|
1898
|
+
passed: true,
|
|
1899
|
+
description: validation.description,
|
|
1900
|
+
path: validation.path,
|
|
1901
|
+
json_pointer: pointer
|
|
1902
|
+
};
|
|
1903
|
+
}
|
|
1904
|
+
return {
|
|
1905
|
+
check: "field_in_context_array",
|
|
1906
|
+
passed: false,
|
|
1907
|
+
description: validation.description,
|
|
1908
|
+
path: validation.path,
|
|
1909
|
+
error: `Expected ${JSON.stringify(actual ?? null)} to be a member of context["${validation.context_key}"] (${JSON.stringify(allowed)})`,
|
|
1910
|
+
json_pointer: pointer,
|
|
1911
|
+
expected: allowed,
|
|
1912
|
+
actual: actual ?? null
|
|
1913
|
+
};
|
|
1914
|
+
}
|
|
1846
1915
|
function validateUpstreamTraffic(validation, ctx) {
|
|
1847
1916
|
const expected = buildUpstreamTrafficExpected(validation);
|
|
1848
1917
|
const invalidIdentifierPaths = collectInvalidIdentifierPaths(validation.identifier_paths);
|