@es-joy/jsoe 0.28.1 → 0.29.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.
- package/CHANGES.md +23 -0
- package/README.md +2 -0
- package/badges/coverage-badge.svg +1 -1
- package/badges/tests-badge.svg +1 -1
- package/dist/deepEqual.d.ts +3 -0
- package/dist/deepEqual.d.ts.map +1 -0
- package/dist/formatAndTypeChoices.d.ts +6 -6
- package/dist/formatAndTypeChoices.d.ts.map +1 -1
- package/dist/formats/schema.d.ts +5 -0
- package/dist/formats/schema.d.ts.map +1 -1
- package/dist/formats.d.ts +2 -2
- package/dist/formats.d.ts.map +1 -1
- package/dist/fundamentalTypes/dateType.d.ts +21 -2
- package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
- package/dist/fundamentalTypes/domexceptionType.d.ts +7 -0
- package/dist/fundamentalTypes/domexceptionType.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/jtltExtensions.d.ts +112 -0
- package/dist/jtltExtensions.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/arraySearchType.d.ts +15 -0
- package/dist/search/fundamentalTypes/arraySearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/bigintSearchType.d.ts +10 -0
- package/dist/search/fundamentalTypes/bigintSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/blobSearchType.d.ts +19 -0
- package/dist/search/fundamentalTypes/blobSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/booleanSearchType.d.ts +11 -0
- package/dist/search/fundamentalTypes/booleanSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/catchSearchType.d.ts +18 -0
- package/dist/search/fundamentalTypes/catchSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/dateSearchType.d.ts +10 -0
- package/dist/search/fundamentalTypes/dateSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/domexceptionSearchType.d.ts +16 -0
- package/dist/search/fundamentalTypes/domexceptionSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/enumSearchType.d.ts +22 -0
- package/dist/search/fundamentalTypes/enumSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/errorSearchType.d.ts +9 -0
- package/dist/search/fundamentalTypes/errorSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/fileSearchType.d.ts +19 -0
- package/dist/search/fundamentalTypes/fileSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/filelistSearchType.d.ts +32 -0
- package/dist/search/fundamentalTypes/filelistSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/functionSearchType.d.ts +18 -0
- package/dist/search/fundamentalTypes/functionSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/mapSearchType.d.ts +18 -0
- package/dist/search/fundamentalTypes/mapSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/nanSearchType.d.ts +7 -0
- package/dist/search/fundamentalTypes/nanSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/nullSearchType.d.ts +7 -0
- package/dist/search/fundamentalTypes/nullSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/numberSearchType.d.ts +11 -0
- package/dist/search/fundamentalTypes/numberSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/objectSearchType.d.ts +15 -0
- package/dist/search/fundamentalTypes/objectSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/promiseSearchType.d.ts +20 -0
- package/dist/search/fundamentalTypes/promiseSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/regexpSearchType.d.ts +14 -0
- package/dist/search/fundamentalTypes/regexpSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/setSearchType.d.ts +14 -0
- package/dist/search/fundamentalTypes/setSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/stringSearchType.d.ts +13 -0
- package/dist/search/fundamentalTypes/stringSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/symbolSearchType.d.ts +16 -0
- package/dist/search/fundamentalTypes/symbolSearchType.d.ts.map +1 -0
- package/dist/search/fundamentalTypes/undefinedSearchType.d.ts +7 -0
- package/dist/search/fundamentalTypes/undefinedSearchType.d.ts.map +1 -0
- package/dist/search/index.d.ts +60 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/queryTree.d.ts +180 -0
- package/dist/search/queryTree.d.ts.map +1 -0
- package/dist/search/queryTreeBuilders.d.ts +168 -0
- package/dist/search/queryTreeBuilders.d.ts.map +1 -0
- package/dist/search/searchDispatch.d.ts +121 -0
- package/dist/search/searchDispatch.d.ts.map +1 -0
- package/dist/search/searchElementUtils.d.ts +97 -0
- package/dist/search/searchElementUtils.d.ts.map +1 -0
- package/dist/search/searchUtils.d.ts +225 -0
- package/dist/search/searchUtils.d.ts.map +1 -0
- package/dist/search/subTypes/blobHTMLSearchType.d.ts +16 -0
- package/dist/search/subTypes/blobHTMLSearchType.d.ts.map +1 -0
- package/dist/search/subTypes/recordSearchType.d.ts +18 -0
- package/dist/search/subTypes/recordSearchType.d.ts.map +1 -0
- package/dist/search/subTypes/tupleSearchType.d.ts +21 -0
- package/dist/search/subTypes/tupleSearchType.d.ts.map +1 -0
- package/dist/search/superTypes/SpecialRealNumberSearchType.d.ts +14 -0
- package/dist/search/superTypes/SpecialRealNumberSearchType.d.ts.map +1 -0
- package/dist/search/superTypes/buffersourceSearchType.d.ts +17 -0
- package/dist/search/superTypes/buffersourceSearchType.d.ts.map +1 -0
- package/dist/search/superTypes/dommatrixSearchType.d.ts +11 -0
- package/dist/search/superTypes/dommatrixSearchType.d.ts.map +1 -0
- package/dist/search/superTypes/dompointSearchType.d.ts +9 -0
- package/dist/search/superTypes/dompointSearchType.d.ts.map +1 -0
- package/dist/search/superTypes/domrectSearchType.d.ts +9 -0
- package/dist/search/superTypes/domrectSearchType.d.ts.map +1 -0
- package/dist/search/superTypes/errorsSpecialSearchType.d.ts +11 -0
- package/dist/search/superTypes/errorsSpecialSearchType.d.ts.map +1 -0
- package/dist/search/unions/discriminatedUnionSearchType.d.ts +12 -0
- package/dist/search/unions/discriminatedUnionSearchType.d.ts.map +1 -0
- package/dist/search/unions/unionFamilySearchType.d.ts +36 -0
- package/dist/search/unions/unionFamilySearchType.d.ts.map +1 -0
- package/dist/search/unions/unionSearchType.d.ts +8 -0
- package/dist/search/unions/unionSearchType.d.ts.map +1 -0
- package/dist/search/unions/xorSearchType.d.ts +12 -0
- package/dist/search/unions/xorSearchType.d.ts.map +1 -0
- package/dist/superTypes/buffersourceType.d.ts.map +1 -1
- package/dist/typeChoices.d.ts +3 -3
- package/dist/typeChoices.d.ts.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/rawTypesonEditor.d.ts.map +1 -1
- package/docs/proposals/search-plan.md +166 -0
- package/package.json +5 -4
- package/pnpm-workspace.yaml +1 -1
- package/rollup.config.js +12 -0
- package/src/formatAndTypeChoices.js +4 -4
- package/src/formats/schema.js +2 -1
- package/src/formats.js +1 -1
- package/src/fundamentalTypes/dateType.js +35 -14
- package/src/fundamentalTypes/domexceptionType.js +41 -33
- package/src/index.js +6 -0
- package/src/jtltExtensions.js +103 -0
- package/src/search/fundamentalTypes/arraySearchType.js +66 -0
- package/src/search/fundamentalTypes/bigintSearchType.js +62 -0
- package/src/search/fundamentalTypes/blobSearchType.js +41 -0
- package/src/search/fundamentalTypes/booleanSearchType.js +40 -0
- package/src/search/fundamentalTypes/catchSearchType.js +59 -0
- package/src/search/fundamentalTypes/dateSearchType.js +73 -0
- package/src/search/fundamentalTypes/domexceptionSearchType.js +55 -0
- package/src/search/fundamentalTypes/enumSearchType.js +58 -0
- package/src/search/fundamentalTypes/errorSearchType.js +11 -0
- package/src/search/fundamentalTypes/fileSearchType.js +41 -0
- package/src/search/fundamentalTypes/filelistSearchType.js +78 -0
- package/src/search/fundamentalTypes/functionSearchType.js +78 -0
- package/src/search/fundamentalTypes/mapSearchType.js +87 -0
- package/src/search/fundamentalTypes/nanSearchType.js +11 -0
- package/src/search/fundamentalTypes/nullSearchType.js +11 -0
- package/src/search/fundamentalTypes/numberSearchType.js +52 -0
- package/src/search/fundamentalTypes/objectSearchType.js +148 -0
- package/src/search/fundamentalTypes/promiseSearchType.js +61 -0
- package/src/search/fundamentalTypes/regexpSearchType.js +48 -0
- package/src/search/fundamentalTypes/setSearchType.js +65 -0
- package/src/search/fundamentalTypes/stringSearchType.js +35 -0
- package/src/search/fundamentalTypes/symbolSearchType.js +38 -0
- package/src/search/fundamentalTypes/undefinedSearchType.js +11 -0
- package/src/search/index.js +79 -0
- package/src/search/queryTree.js +235 -0
- package/src/search/queryTreeBuilders.js +224 -0
- package/src/search/searchDispatch.js +291 -0
- package/src/search/searchElementUtils.js +289 -0
- package/src/search/searchUtils.js +355 -0
- package/src/search/subTypes/blobHTMLSearchType.js +65 -0
- package/src/search/subTypes/recordSearchType.js +84 -0
- package/src/search/subTypes/tupleSearchType.js +111 -0
- package/src/search/superTypes/SpecialRealNumberSearchType.js +42 -0
- package/src/search/superTypes/buffersourceSearchType.js +47 -0
- package/src/search/superTypes/dommatrixSearchType.js +24 -0
- package/src/search/superTypes/dompointSearchType.js +15 -0
- package/src/search/superTypes/domrectSearchType.js +15 -0
- package/src/search/superTypes/errorsSpecialSearchType.js +15 -0
- package/src/search/unions/discriminatedUnionSearchType.js +16 -0
- package/src/search/unions/unionFamilySearchType.js +160 -0
- package/src/search/unions/unionSearchType.js +12 -0
- package/src/search/unions/xorSearchType.js +16 -0
- package/src/superTypes/buffersourceType.js +13 -15
- package/src/typeChoices.js +2 -2
- package/src/types.js +2 -2
- package/src/utils/rawTypesonEditor.js +12 -2
- package/tsconfig-prod.json +12 -0
- package/tsconfig.json +5 -10
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {buildPathLabel, buildLengthSizeControls, readLengthSizeQuery} from '../searchUtils.js';
|
|
2
|
+
import {combineAnd} from '../queryTreeBuilders.js';
|
|
3
|
+
import {findSearchElement, getQueryViaElement, hasGetQuery} from '../searchElementUtils.js';
|
|
4
|
+
import {buildSearchWidget} from '../searchDispatch.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Has length/size of <number>; Is/Is not sparse (README), plus - by
|
|
12
|
+
* recursing into the element schema's own search widget (search plan §6
|
|
13
|
+
* build order) - "the array contains at least one element matching Y",
|
|
14
|
+
* expressed via a `*` path segment (`queryTree.js`) so no dedicated wrapper
|
|
15
|
+
* leaf kind is needed: the two constraints simply combine with `$and`.
|
|
16
|
+
* @type {SearchTypeObject}
|
|
17
|
+
*/
|
|
18
|
+
const arraySearchType = {
|
|
19
|
+
buildUI ({schemaObject, path, typeNamespace, topRoot, types, originalJSON}) {
|
|
20
|
+
const label = buildPathLabel(schemaObject, path);
|
|
21
|
+
const name = `${typeNamespace}-array`;
|
|
22
|
+
const arraySchemaObject = /** @type {import('zodexy').SzArray} */ (
|
|
23
|
+
schemaObject
|
|
24
|
+
);
|
|
25
|
+
const elementPath = `${path}/*`;
|
|
26
|
+
const elementArr = buildSearchWidget({
|
|
27
|
+
schemaObject: arraySchemaObject.element,
|
|
28
|
+
path: elementPath,
|
|
29
|
+
typeNamespace,
|
|
30
|
+
topRoot,
|
|
31
|
+
types,
|
|
32
|
+
originalJSON
|
|
33
|
+
});
|
|
34
|
+
return ['jsoe-search-array', {
|
|
35
|
+
dataset: {searchPath: path, searchKind: 'array'},
|
|
36
|
+
title: label,
|
|
37
|
+
$define: {
|
|
38
|
+
/** @this {HTMLElement} */
|
|
39
|
+
getQuery () {
|
|
40
|
+
const searchPath = this.dataset.searchPath ?? '';
|
|
41
|
+
const lengthLeaf = readLengthSizeQuery(this, searchPath);
|
|
42
|
+
const elementEl = findSearchElement(this, `${searchPath}/*`);
|
|
43
|
+
const elementLeaf = elementEl && hasGetQuery(elementEl)
|
|
44
|
+
? elementEl.getQuery()
|
|
45
|
+
: undefined;
|
|
46
|
+
return combineAnd([lengthLeaf, elementLeaf]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, [
|
|
50
|
+
['span', {class: 'searchLabel'}, [label]],
|
|
51
|
+
...buildLengthSizeControls({
|
|
52
|
+
name,
|
|
53
|
+
min: arraySchemaObject.minLength,
|
|
54
|
+
max: arraySchemaObject.maxLength,
|
|
55
|
+
includeSparse: true
|
|
56
|
+
}),
|
|
57
|
+
['div', {class: 'searchArrayElement'}, [
|
|
58
|
+
['span', ['Element matches: ']],
|
|
59
|
+
elementArr
|
|
60
|
+
]]
|
|
61
|
+
]];
|
|
62
|
+
},
|
|
63
|
+
getQuery: getQueryViaElement
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default arraySearchType;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {buildPathLabel, buildRangeInputsPair, readRangeInputsPair} from '../searchUtils.js';
|
|
2
|
+
import {makeRangeLeaf} from '../queryTreeBuilders.js';
|
|
3
|
+
import {getQueryViaElement} from '../searchElementUtils.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {string} str
|
|
11
|
+
* @returns {string|undefined}
|
|
12
|
+
*/
|
|
13
|
+
function parseBigIntBound (str) {
|
|
14
|
+
if (!str) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
// Kept as a decimal string (not a runtime `BigInt`) so the tree stays
|
|
19
|
+
// JSON-serializable, mirroring `dateSearchType.js`'s ISO-string bounds.
|
|
20
|
+
return String(BigInt(str));
|
|
21
|
+
} catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* OR Ranges/Is Not Range (README) - text inputs rather than
|
|
28
|
+
* `<input type="number">`, since a native number input silently loses
|
|
29
|
+
* precision beyond `Number.MAX_SAFE_INTEGER`.
|
|
30
|
+
* @type {SearchTypeObject}
|
|
31
|
+
*/
|
|
32
|
+
const bigintSearchType = {
|
|
33
|
+
buildUI ({schemaObject, path, typeNamespace}) {
|
|
34
|
+
const label = buildPathLabel(schemaObject, path);
|
|
35
|
+
const name = `${typeNamespace}-bigint`;
|
|
36
|
+
return ['jsoe-search-bigint', {
|
|
37
|
+
dataset: {searchPath: path, searchKind: 'bigint'},
|
|
38
|
+
title: label,
|
|
39
|
+
$define: {
|
|
40
|
+
/** @this {HTMLElement} */
|
|
41
|
+
getQuery () {
|
|
42
|
+
const {gte: gteStr, lte: lteStr} = readRangeInputsPair(this);
|
|
43
|
+
const $gte = parseBigIntBound(gteStr);
|
|
44
|
+
const $lte = parseBigIntBound(lteStr);
|
|
45
|
+
if ($gte === undefined && $lte === undefined) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return makeRangeLeaf(this.dataset.searchPath ?? '', 'bigint', {
|
|
49
|
+
...($gte === undefined ? {} : {$gte}),
|
|
50
|
+
...($lte === undefined ? {} : {$lte})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, [
|
|
55
|
+
['span', {class: 'searchLabel'}, [label]],
|
|
56
|
+
...buildRangeInputsPair({name, type: 'text'})
|
|
57
|
+
]];
|
|
58
|
+
},
|
|
59
|
+
getQuery: getQueryViaElement
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default bigintSearchType;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {buildPathLabel, buildLiteralRegexControls, readLiteralRegexQuery} from '../searchUtils.js';
|
|
2
|
+
import {getQueryViaElement} from '../searchElementUtils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Blob: OR literal or regex search/Does Not contain search (README, grouped
|
|
10
|
+
* with string/StringObject/File/regexp-source/symbol-description) - against
|
|
11
|
+
* the Blob's `.type` (MIME string), a value-level facet the schema itself
|
|
12
|
+
* carries no constraint for (`blob` is one of jsoe's "checked" types,
|
|
13
|
+
* `{type: 'any', checks: [{name: 'blob'}]}`, with no further structural
|
|
14
|
+
* fields to read), the same way `symbolSearchType.js` targets
|
|
15
|
+
* `.description`. Matching *content* rather than the MIME type belongs to
|
|
16
|
+
* `blobHTMLSearchType.js` (XPath/CSS-selector/full-text/raw-HTML-regex,
|
|
17
|
+
* README) for the Blob-as-HTML case specifically, not this generic module.
|
|
18
|
+
* @type {SearchTypeObject}
|
|
19
|
+
*/
|
|
20
|
+
const blobSearchType = {
|
|
21
|
+
buildUI ({schemaObject, path, typeNamespace}) {
|
|
22
|
+
const label = buildPathLabel(schemaObject, path);
|
|
23
|
+
const name = `${typeNamespace}-blob`;
|
|
24
|
+
return ['jsoe-search-blob', {
|
|
25
|
+
dataset: {searchPath: path, searchKind: 'blob'},
|
|
26
|
+
title: label,
|
|
27
|
+
$define: {
|
|
28
|
+
/** @this {HTMLElement} */
|
|
29
|
+
getQuery () {
|
|
30
|
+
return readLiteralRegexQuery(this, this.dataset.searchPath ?? '');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, [
|
|
34
|
+
['span', {class: 'searchLabel'}, [`${label} (MIME type)`]],
|
|
35
|
+
buildLiteralRegexControls({name})
|
|
36
|
+
]];
|
|
37
|
+
},
|
|
38
|
+
getQuery: getQueryViaElement
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default blobSearchType;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {buildPathLabel, buildTriStateSelect, readTriStateSelect} from '../searchUtils.js';
|
|
2
|
+
import {makeBooleanEqualsLeaf} from '../queryTreeBuilders.js';
|
|
3
|
+
import {getQueryViaElement} from '../searchElementUtils.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* True or false (README).
|
|
11
|
+
* @type {SearchTypeObject}
|
|
12
|
+
*/
|
|
13
|
+
const booleanSearchType = {
|
|
14
|
+
buildUI ({schemaObject, path, typeNamespace}) {
|
|
15
|
+
const label = buildPathLabel(schemaObject, path);
|
|
16
|
+
const name = `${typeNamespace}-boolean`;
|
|
17
|
+
return ['jsoe-search-boolean', {
|
|
18
|
+
dataset: {searchPath: path, searchKind: 'boolean'},
|
|
19
|
+
title: label,
|
|
20
|
+
$define: {
|
|
21
|
+
/** @this {HTMLElement} */
|
|
22
|
+
getQuery () {
|
|
23
|
+
const value = readTriStateSelect(this);
|
|
24
|
+
return value === undefined
|
|
25
|
+
? undefined
|
|
26
|
+
: makeBooleanEqualsLeaf(this.dataset.searchPath ?? '', value);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, [
|
|
30
|
+
['span', {class: 'searchLabel'}, [label]],
|
|
31
|
+
['label', [
|
|
32
|
+
`${label}: `,
|
|
33
|
+
buildTriStateSelect({name, trueLabel: 'True', falseLabel: 'False'})
|
|
34
|
+
]]
|
|
35
|
+
]];
|
|
36
|
+
},
|
|
37
|
+
getQuery: getQueryViaElement
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default booleanSearchType;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {buildPathLabel} from '../searchUtils.js';
|
|
2
|
+
import {makePassThroughLeaf} from '../queryTreeBuilders.js';
|
|
3
|
+
import {findSearchElement, getQueryViaElement, hasGetQuery} from '../searchElementUtils.js';
|
|
4
|
+
import {buildSearchWidget} from '../searchDispatch.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Promise, Literal, catch: pass on children (README) - same shape as
|
|
12
|
+
* `promiseSearchType.js`'s pass-through (recurse into `.innerType` at the
|
|
13
|
+
* same path, wrap in a `passThrough` leaf), except `getSchemaType`
|
|
14
|
+
* (`src/formats/schema.js`) has no case for `catch` at all - unlike
|
|
15
|
+
* `promise`/`function`, which `zodexToStructuredCloningTypeMap` already
|
|
16
|
+
* maps - so `getSearchSchemaType` adds `catch` as its own extra case purely
|
|
17
|
+
* for the search side, the same way it already does for `tuple`/`record`/
|
|
18
|
+
* the union family.
|
|
19
|
+
* @type {SearchTypeObject}
|
|
20
|
+
*/
|
|
21
|
+
const catchSearchType = {
|
|
22
|
+
buildUI ({schemaObject, path, typeNamespace, topRoot, types, originalJSON}) {
|
|
23
|
+
const label = buildPathLabel(schemaObject, path);
|
|
24
|
+
const catchSchemaObject = /** @type {import('zodexy').SzCatch} */ (
|
|
25
|
+
schemaObject
|
|
26
|
+
);
|
|
27
|
+
const childArr = buildSearchWidget({
|
|
28
|
+
schemaObject: catchSchemaObject.innerType,
|
|
29
|
+
path,
|
|
30
|
+
typeNamespace,
|
|
31
|
+
topRoot,
|
|
32
|
+
types,
|
|
33
|
+
originalJSON
|
|
34
|
+
});
|
|
35
|
+
return ['jsoe-search-catch', {
|
|
36
|
+
dataset: {searchPath: path, searchKind: 'catch'},
|
|
37
|
+
title: label,
|
|
38
|
+
$define: {
|
|
39
|
+
/** @this {HTMLElement} */
|
|
40
|
+
getQuery () {
|
|
41
|
+
const searchPath = this.dataset.searchPath ?? '';
|
|
42
|
+
const childEl = findSearchElement(this, searchPath);
|
|
43
|
+
const childQuery = childEl && hasGetQuery(childEl)
|
|
44
|
+
? childEl.getQuery()
|
|
45
|
+
: undefined;
|
|
46
|
+
return childQuery === undefined
|
|
47
|
+
? undefined
|
|
48
|
+
: makePassThroughLeaf(searchPath, childQuery);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, [
|
|
52
|
+
['span', {class: 'searchLabel'}, [label]],
|
|
53
|
+
childArr
|
|
54
|
+
]];
|
|
55
|
+
},
|
|
56
|
+
getQuery: getQueryViaElement
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default catchSearchType;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {buildDateInputControl} from '../../fundamentalTypes/dateType.js';
|
|
2
|
+
import {buildPathLabel} from '../searchUtils.js';
|
|
3
|
+
import {makeRangeLeaf} from '../queryTreeBuilders.js';
|
|
4
|
+
import {getQueryViaElement} from '../searchElementUtils.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Reads the two `datetime-local` inputs directly off the element rather
|
|
12
|
+
* than off any closed-over reference, since a custom element's mixin
|
|
13
|
+
* methods (`$define`, search plan §8) are installed once on the shared
|
|
14
|
+
* prototype the first time the tag is defined - every instance must read
|
|
15
|
+
* its own state off `this`, never off a build-time closure variable.
|
|
16
|
+
* @param {HTMLElement} el
|
|
17
|
+
* @returns {{gte: string, lte: string}}
|
|
18
|
+
*/
|
|
19
|
+
function readInputs (el) {
|
|
20
|
+
const [gteInput, lteInput] = /** @type {HTMLInputElement[]} */ (
|
|
21
|
+
[...el.querySelectorAll('input[type="datetime-local"]')]
|
|
22
|
+
);
|
|
23
|
+
return {gte: gteInput.value, lte: lteInput.value};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* OR date range/Is Not Range (README). `dateType.js`'s own
|
|
28
|
+
* `buildDateInputControl` is reused twice (range start/end) so the min/max
|
|
29
|
+
* wiring and ISO-slicing stay in one place.
|
|
30
|
+
* @type {SearchTypeObject}
|
|
31
|
+
*/
|
|
32
|
+
const dateSearchType = {
|
|
33
|
+
buildUI ({schemaObject, path, typeNamespace}) {
|
|
34
|
+
const label = buildPathLabel(schemaObject, path);
|
|
35
|
+
const dateSchemaObject = /** @type {import('zodexy').SzDate} */ (
|
|
36
|
+
schemaObject
|
|
37
|
+
);
|
|
38
|
+
return ['jsoe-search-date', {
|
|
39
|
+
dataset: {searchPath: path, searchKind: 'date'},
|
|
40
|
+
title: label,
|
|
41
|
+
$define: {
|
|
42
|
+
/** @this {HTMLElement} */
|
|
43
|
+
getQuery () {
|
|
44
|
+
const {gte, lte} = readInputs(this);
|
|
45
|
+
if (!gte && !lte) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return makeRangeLeaf(
|
|
49
|
+
this.dataset.searchPath ?? '',
|
|
50
|
+
'date',
|
|
51
|
+
{
|
|
52
|
+
...(gte ? {$gte: new Date(gte).toISOString()} : {}),
|
|
53
|
+
...(lte ? {$lte: new Date(lte).toISOString()} : {})
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}, [
|
|
59
|
+
['span', {class: 'searchLabel'}, [label]],
|
|
60
|
+
['label', [
|
|
61
|
+
'From: ',
|
|
62
|
+
buildDateInputControl({name: `${typeNamespace}-date-gte`, dateSchemaObject})
|
|
63
|
+
]],
|
|
64
|
+
['label', [
|
|
65
|
+
'To: ',
|
|
66
|
+
buildDateInputControl({name: `${typeNamespace}-date-lte`, dateSchemaObject})
|
|
67
|
+
]]
|
|
68
|
+
]];
|
|
69
|
+
},
|
|
70
|
+
getQuery: getQueryViaElement
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default dateSearchType;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {domExceptionNames} from '../../fundamentalTypes/domexceptionType.js';
|
|
2
|
+
import {buildPathLabel, buildMultiSelect, readMultiSelect, buildLiteralRegexControls, readLiteralRegexQuery} from '../searchUtils.js';
|
|
3
|
+
import {makeMultiSelectLeaf, combineAnd} from '../queryTreeBuilders.js';
|
|
4
|
+
import {getQueryViaElement} from '../searchElementUtils.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* DOMException: Literal/Regex search of child string properties; also
|
|
12
|
+
* pull-down of name for DOMException (README) - `.name` gets the
|
|
13
|
+
* multi-select pull-down (its standard predefined values, imported as-is
|
|
14
|
+
* from `domexceptionType.js`'s own `domExceptionNames` export rather than a
|
|
15
|
+
* second copy of the list), `.message` gets the usual literal/regex/
|
|
16
|
+
* does-not-contain control, combined via `$and`.
|
|
17
|
+
* @type {SearchTypeObject}
|
|
18
|
+
*/
|
|
19
|
+
const domexceptionSearchType = {
|
|
20
|
+
buildUI ({schemaObject, path, typeNamespace}) {
|
|
21
|
+
const label = buildPathLabel(schemaObject, path);
|
|
22
|
+
const name = `${typeNamespace}-domexception`;
|
|
23
|
+
return ['jsoe-search-domexception', {
|
|
24
|
+
dataset: {searchPath: path, searchKind: 'domexception'},
|
|
25
|
+
title: label,
|
|
26
|
+
$define: {
|
|
27
|
+
/** @this {HTMLElement} */
|
|
28
|
+
getQuery () {
|
|
29
|
+
const searchPath = this.dataset.searchPath ?? '';
|
|
30
|
+
const selectedNames = readMultiSelect(this);
|
|
31
|
+
const nameLeaf = selectedNames.length
|
|
32
|
+
? makeMultiSelectLeaf(`${searchPath}/name`, {$in: selectedNames})
|
|
33
|
+
: undefined;
|
|
34
|
+
const messageLeaf = readLiteralRegexQuery(
|
|
35
|
+
this, `${searchPath}/message`, 'message'
|
|
36
|
+
);
|
|
37
|
+
return combineAnd([nameLeaf, messageLeaf]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, [
|
|
41
|
+
['span', {class: 'searchLabel'}, [label]],
|
|
42
|
+
['div', {class: 'domexceptionName'}, [
|
|
43
|
+
['span', ['Name: ']],
|
|
44
|
+
buildMultiSelect({name: `${name}-name`, options: domExceptionNames})
|
|
45
|
+
]],
|
|
46
|
+
['div', {class: 'domexceptionMessage'}, [
|
|
47
|
+
['span', ['Message: ']],
|
|
48
|
+
buildLiteralRegexControls({name: `${name}-message`, key: 'message'})
|
|
49
|
+
]]
|
|
50
|
+
]];
|
|
51
|
+
},
|
|
52
|
+
getQuery: getQueryViaElement
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default domexceptionSearchType;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {buildPathLabel, buildMultiSelect, readMultiSelect} from '../searchUtils.js';
|
|
2
|
+
import {makeMultiSelectLeaf} from '../queryTreeBuilders.js';
|
|
3
|
+
import {getQueryViaElement} from '../searchElementUtils.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Enum, Native Enum: multiple select (README). The value-editing side has
|
|
11
|
+
* no dedicated `enumType.js` (`getSchemaType` resolves `enum` to whatever
|
|
12
|
+
* its underlying value type is), but search needs the actual allowed
|
|
13
|
+
* values listed, so this is one of the search-only dedicated modules
|
|
14
|
+
* (search plan §1).
|
|
15
|
+
*
|
|
16
|
+
* The README's further "native enum also can search key vs. value" is not
|
|
17
|
+
* implemented by this pass - only the plain multi-select-of-values
|
|
18
|
+
* affordance every enum gets either way. A native enum whose keys differ
|
|
19
|
+
* from its values (unlike a plain `z.enum([...])`, where they're the same)
|
|
20
|
+
* still gets a usable widget here, just not that extra key-vs-value mode
|
|
21
|
+
* yet; `values`'s keys are shown alongside their value as a hint.
|
|
22
|
+
* @type {SearchTypeObject}
|
|
23
|
+
*/
|
|
24
|
+
const enumSearchType = {
|
|
25
|
+
buildUI ({schemaObject, path, typeNamespace}) {
|
|
26
|
+
const label = buildPathLabel(schemaObject, path);
|
|
27
|
+
const name = `${typeNamespace}-enum`;
|
|
28
|
+
const {values} = /** @type {import('zodexy').SzEnum} */ (
|
|
29
|
+
schemaObject
|
|
30
|
+
);
|
|
31
|
+
const options = Object.entries(values).map(([key, value]) => {
|
|
32
|
+
const strValue = String(value);
|
|
33
|
+
return /** @type {[string, string]} */ ([
|
|
34
|
+
strValue,
|
|
35
|
+
key === strValue ? strValue : `${strValue} (${key})`
|
|
36
|
+
]);
|
|
37
|
+
});
|
|
38
|
+
return ['jsoe-search-enum', {
|
|
39
|
+
dataset: {searchPath: path, searchKind: 'enum'},
|
|
40
|
+
title: label,
|
|
41
|
+
$define: {
|
|
42
|
+
/** @this {HTMLElement} */
|
|
43
|
+
getQuery () {
|
|
44
|
+
const selected = readMultiSelect(this);
|
|
45
|
+
return selected.length
|
|
46
|
+
? makeMultiSelectLeaf(this.dataset.searchPath ?? '', {$in: selected})
|
|
47
|
+
: undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, [
|
|
51
|
+
['span', {class: 'searchLabel'}, [label]],
|
|
52
|
+
buildMultiSelect({name, options})
|
|
53
|
+
]];
|
|
54
|
+
},
|
|
55
|
+
getQuery: getQueryViaElement
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default enumSearchType;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {makeErrorFamilySearchType} from '../searchElementUtils.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Error: Literal/Regex search of child string properties, numeric of
|
|
5
|
+
* number children (README) - see `searchElementUtils.js`'s
|
|
6
|
+
* `makeErrorFamilySearchType` for the shared implementation.
|
|
7
|
+
* @type {import('../searchDispatch.js').SearchTypeObject}
|
|
8
|
+
*/
|
|
9
|
+
const errorSearchType = makeErrorFamilySearchType({tagName: 'jsoe-search-error'});
|
|
10
|
+
|
|
11
|
+
export default errorSearchType;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {buildPathLabel, buildLiteralRegexControls, readLiteralRegexQuery} from '../searchUtils.js';
|
|
2
|
+
import {getQueryViaElement} from '../searchElementUtils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* File: OR literal or regex search/Does Not contain search (README, grouped
|
|
10
|
+
* with string/StringObject/Blob/regexp-source/symbol-description) - against
|
|
11
|
+
* the File's `.name`, a value-level facet the schema itself carries no
|
|
12
|
+
* constraint for (`SzFile` only has `min`/`max`/`mime`), the same way
|
|
13
|
+
* `symbolSearchType.js` targets `.description` rather than anything the
|
|
14
|
+
* schema declares. `SzFile`'s own `min`/`max` (byte size) is left for a
|
|
15
|
+
* later pass - the README's literal/regex bullet doesn't ask for a size
|
|
16
|
+
* range here, and README explicitly reserves that shape of control
|
|
17
|
+
* ("OR Range/Is Not Range") for `buffersource` instead.
|
|
18
|
+
* @type {SearchTypeObject}
|
|
19
|
+
*/
|
|
20
|
+
const fileSearchType = {
|
|
21
|
+
buildUI ({schemaObject, path, typeNamespace}) {
|
|
22
|
+
const label = buildPathLabel(schemaObject, path);
|
|
23
|
+
const name = `${typeNamespace}-file`;
|
|
24
|
+
return ['jsoe-search-file', {
|
|
25
|
+
dataset: {searchPath: path, searchKind: 'file'},
|
|
26
|
+
title: label,
|
|
27
|
+
$define: {
|
|
28
|
+
/** @this {HTMLElement} */
|
|
29
|
+
getQuery () {
|
|
30
|
+
return readLiteralRegexQuery(this, this.dataset.searchPath ?? '');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, [
|
|
34
|
+
['span', {class: 'searchLabel'}, [`${label} (name)`]],
|
|
35
|
+
buildLiteralRegexControls({name})
|
|
36
|
+
]];
|
|
37
|
+
},
|
|
38
|
+
getQuery: getQueryViaElement
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default fileSearchType;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {buildPathLabel, buildLengthSizeControls, readLengthSizeQuery} from '../searchUtils.js';
|
|
2
|
+
import {combineAnd} from '../queryTreeBuilders.js';
|
|
3
|
+
import {findSearchElement, getQueryViaElement, hasGetQuery} from '../searchElementUtils.js';
|
|
4
|
+
import {buildSearchWidget} from '../searchDispatch.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {{
|
|
12
|
+
* type: 'array',
|
|
13
|
+
* element: import('../../formats/schema.js').ZodexSchema,
|
|
14
|
+
* minLength?: number,
|
|
15
|
+
* maxLength?: number
|
|
16
|
+
* }} FilelistOutputSchema
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Has length/size of <number> (README, grouped with array/set/
|
|
21
|
+
* tuple-with-rest) - no sparse toggle, matching `setSearchType.js`. A
|
|
22
|
+
* `FileList` schema serializes as `{type: 'codec', name: 'filelist',
|
|
23
|
+
* output: {type: 'array', element: {type: 'file', ...}}}`
|
|
24
|
+
* (`src/formats/schema.js`'s `codec`/`filelist` handling); the length
|
|
25
|
+
* bounds and element schema both live on that `output` array shape, whose
|
|
26
|
+
* element recurses into `fileSearchType.js` under the same `*` path-segment
|
|
27
|
+
* convention `arraySearchType.js` uses.
|
|
28
|
+
* @type {SearchTypeObject}
|
|
29
|
+
*/
|
|
30
|
+
const filelistSearchType = {
|
|
31
|
+
buildUI ({schemaObject, path, typeNamespace, topRoot, types, originalJSON}) {
|
|
32
|
+
const label = buildPathLabel(schemaObject, path);
|
|
33
|
+
const name = `${typeNamespace}-filelist`;
|
|
34
|
+
const outputSchema = /** @type {FilelistOutputSchema} */ (
|
|
35
|
+
/** @type {{output: unknown}} */ (schemaObject).output
|
|
36
|
+
);
|
|
37
|
+
const elementPath = `${path}/*`;
|
|
38
|
+
const elementArr = buildSearchWidget({
|
|
39
|
+
schemaObject: outputSchema.element,
|
|
40
|
+
path: elementPath,
|
|
41
|
+
typeNamespace,
|
|
42
|
+
topRoot,
|
|
43
|
+
types,
|
|
44
|
+
originalJSON
|
|
45
|
+
});
|
|
46
|
+
return ['jsoe-search-filelist', {
|
|
47
|
+
dataset: {searchPath: path, searchKind: 'filelist'},
|
|
48
|
+
title: label,
|
|
49
|
+
$define: {
|
|
50
|
+
/** @this {HTMLElement} */
|
|
51
|
+
getQuery () {
|
|
52
|
+
const searchPath = this.dataset.searchPath ?? '';
|
|
53
|
+
const lengthLeaf = readLengthSizeQuery(this, searchPath);
|
|
54
|
+
const elementEl = findSearchElement(this, `${searchPath}/*`);
|
|
55
|
+
const elementLeaf = elementEl && hasGetQuery(elementEl)
|
|
56
|
+
? elementEl.getQuery()
|
|
57
|
+
: undefined;
|
|
58
|
+
return combineAnd([lengthLeaf, elementLeaf]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, [
|
|
62
|
+
['span', {class: 'searchLabel'}, [label]],
|
|
63
|
+
...buildLengthSizeControls({
|
|
64
|
+
name,
|
|
65
|
+
min: outputSchema.minLength,
|
|
66
|
+
max: outputSchema.maxLength,
|
|
67
|
+
includeSparse: false
|
|
68
|
+
}),
|
|
69
|
+
['div', {class: 'searchFilelistElement'}, [
|
|
70
|
+
['span', ['File matches: ']],
|
|
71
|
+
elementArr
|
|
72
|
+
]]
|
|
73
|
+
]];
|
|
74
|
+
},
|
|
75
|
+
getQuery: getQueryViaElement
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default filelistSearchType;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {buildPathLabel} from '../searchUtils.js';
|
|
2
|
+
import {combineAnd} from '../queryTreeBuilders.js';
|
|
3
|
+
import {findSearchElement, getQueryViaElement, hasGetQuery} from '../searchElementUtils.js';
|
|
4
|
+
import {buildSearchWidget} from '../searchDispatch.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Function; pass on args, return type (README) - recurses into both
|
|
12
|
+
* `.input` (itself a tuple, so its own per-position controls come for free
|
|
13
|
+
* via `tupleSearchType.js`) and `.output`, at `*args`/`*output` path
|
|
14
|
+
* segments (`queryTree.js`), combined via `$and`. The build order's own
|
|
15
|
+
* note that `function` is "fuzzy" in the README and could ship as a
|
|
16
|
+
* minimal stub predates `tupleSearchType.js` existing; now that it does,
|
|
17
|
+
* recursing into `.input` through it is no more work than `.output` alone
|
|
18
|
+
* would have been.
|
|
19
|
+
* @type {SearchTypeObject}
|
|
20
|
+
*/
|
|
21
|
+
const functionSearchType = {
|
|
22
|
+
buildUI ({schemaObject, path, typeNamespace, topRoot, types, originalJSON}) {
|
|
23
|
+
const label = buildPathLabel(schemaObject, path);
|
|
24
|
+
const functionSchemaObject = /** @type {import('zodexy').SzFunction<any, any>} */ (
|
|
25
|
+
schemaObject
|
|
26
|
+
);
|
|
27
|
+
const argsPath = `${path}/*args`;
|
|
28
|
+
const outputPath = `${path}/*output`;
|
|
29
|
+
const argsArr = buildSearchWidget({
|
|
30
|
+
schemaObject: functionSchemaObject.input,
|
|
31
|
+
path: argsPath,
|
|
32
|
+
typeNamespace,
|
|
33
|
+
topRoot,
|
|
34
|
+
types,
|
|
35
|
+
originalJSON
|
|
36
|
+
});
|
|
37
|
+
const outputArr = buildSearchWidget({
|
|
38
|
+
schemaObject: functionSchemaObject.output,
|
|
39
|
+
path: outputPath,
|
|
40
|
+
typeNamespace,
|
|
41
|
+
topRoot,
|
|
42
|
+
types,
|
|
43
|
+
originalJSON
|
|
44
|
+
});
|
|
45
|
+
return ['jsoe-search-function', {
|
|
46
|
+
dataset: {searchPath: path, searchKind: 'function'},
|
|
47
|
+
title: label,
|
|
48
|
+
$define: {
|
|
49
|
+
/** @this {HTMLElement} */
|
|
50
|
+
getQuery () {
|
|
51
|
+
const searchPath = this.dataset.searchPath ?? '';
|
|
52
|
+
const argsEl = findSearchElement(this, `${searchPath}/*args`);
|
|
53
|
+
const outputEl = findSearchElement(this, `${searchPath}/*output`);
|
|
54
|
+
const argsQuery = argsEl && hasGetQuery(argsEl)
|
|
55
|
+
? argsEl.getQuery()
|
|
56
|
+
: undefined;
|
|
57
|
+
const outputQuery = outputEl && hasGetQuery(outputEl)
|
|
58
|
+
? outputEl.getQuery()
|
|
59
|
+
: undefined;
|
|
60
|
+
return combineAnd([argsQuery, outputQuery]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, [
|
|
64
|
+
['span', {class: 'searchLabel'}, [label]],
|
|
65
|
+
['div', {class: 'searchFunctionArgs'}, [
|
|
66
|
+
['span', ['Args match: ']],
|
|
67
|
+
argsArr
|
|
68
|
+
]],
|
|
69
|
+
['div', {class: 'searchFunctionOutput'}, [
|
|
70
|
+
['span', ['Return value matches: ']],
|
|
71
|
+
outputArr
|
|
72
|
+
]]
|
|
73
|
+
]];
|
|
74
|
+
},
|
|
75
|
+
getQuery: getQueryViaElement
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default functionSearchType;
|