diff options
Diffstat (limited to 'src/data/composite/wiki-properties/referenceList.js')
-rw-r--r-- | src/data/composite/wiki-properties/referenceList.js | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/data/composite/wiki-properties/referenceList.js b/src/data/composite/wiki-properties/referenceList.js index af634a68..4f8207b5 100644 --- a/src/data/composite/wiki-properties/referenceList.js +++ b/src/data/composite/wiki-properties/referenceList.js @@ -1,5 +1,6 @@ // Stores and exposes a list of references to other data objects; all items -// must be references to the same type, which is specified on the class input. +// must be references to the same type, which is either implied from the class +// input, or explicitly set on the referenceType input. // // See also: // - singleReference @@ -7,10 +8,14 @@ // import {input, templateCompositeFrom} from '#composite'; -import {isThingClass, validateReferenceList} from '#validators'; +import {validateReferenceList} from '#validators'; import {exposeDependency} from '#composite/control-flow'; -import {inputWikiData, withResolvedReferenceList} from '#composite/wiki-data'; +import {inputSoupyFind, inputWikiData, withResolvedReferenceList} + from '#composite/wiki-data'; + +import {referenceListInputDescriptions, referenceListUpdateDescription} + from './helpers/reference-list-helpers.js'; export default templateCompositeFrom({ annotation: `referenceList`, @@ -18,20 +23,16 @@ export default templateCompositeFrom({ compose: false, inputs: { - class: input.staticValue({validate: isThingClass}), - - data: inputWikiData({allowMixedTypes: false}), + ...referenceListInputDescriptions(), - find: input({type: 'function'}), + data: inputWikiData({allowMixedTypes: true}), + find: inputSoupyFind(), }, - update: ({ - [input.staticValue('class')]: thingClass, - }) => ({ - validate: - validateReferenceList( - thingClass[Symbol.for('Thing.referenceType')]), - }), + update: + referenceListUpdateDescription({ + validateReferenceList: validateReferenceList, + }), steps: () => [ withResolvedReferenceList({ |