diff options
Diffstat (limited to 'src/data/composite/wiki-data')
-rw-r--r-- | src/data/composite/wiki-data/withResolvedAnnotatedReferenceList.js | 18 | ||||
-rw-r--r-- | src/data/composite/wiki-data/withReverseAnnotatedReferenceList.js | 10 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/data/composite/wiki-data/withResolvedAnnotatedReferenceList.js b/src/data/composite/wiki-data/withResolvedAnnotatedReferenceList.js index e2b8a0a1..789a8844 100644 --- a/src/data/composite/wiki-data/withResolvedAnnotatedReferenceList.js +++ b/src/data/composite/wiki-data/withResolvedAnnotatedReferenceList.js @@ -1,6 +1,6 @@ import {input, templateCompositeFrom} from '#composite'; import {stitchArrays} from '#sugar'; -import {isObject, validateArrayItems} from '#validators'; +import {isDate, isObject, validateArrayItems} from '#validators'; import {withPropertyFromList} from '#composite/data'; @@ -24,6 +24,11 @@ export default templateCompositeFrom({ acceptsNull: true, }), + date: input({ + validate: isDate, + acceptsNull: true, + }), + reference: input({type: 'string', defaultValue: 'reference'}), annotation: input({type: 'string', defaultValue: 'annotation'}), thing: input({type: 'string', defaultValue: 'thing'}), @@ -93,6 +98,17 @@ export default templateCompositeFrom({ }), }, + { + dependencies: ['#matches', input('date')], + compute: (continuation, { + ['#matches']: matches, + [input('date')]: date, + }) => continuation({ + ['#matches']: + matches.map(match => ({...match, date})), + }), + }, + withAvailabilityFilter({ from: '#resolvedReferenceList', }), diff --git a/src/data/composite/wiki-data/withReverseAnnotatedReferenceList.js b/src/data/composite/wiki-data/withReverseAnnotatedReferenceList.js index debc68e4..feae9ccb 100644 --- a/src/data/composite/wiki-data/withReverseAnnotatedReferenceList.js +++ b/src/data/composite/wiki-data/withReverseAnnotatedReferenceList.js @@ -67,12 +67,20 @@ export default withReverseList_template({ '#values': '#annotations', }), + withPropertyFromList({ + list: '#references', + property: input.value('date'), + }).outputs({ + '#references.date': '#dates', + }), + { dependencies: [ input('backward'), input('annotation'), '#things', '#annotations', + '#dates', ], compute: (continuation, { @@ -80,11 +88,13 @@ export default withReverseList_template({ [input('annotation')]: annotationProperty, ['#things']: things, ['#annotations']: annotations, + ['#dates']: dates, }) => continuation({ '#referencingThings': stitchArrays({ [thingProperty]: things, [annotationProperty]: annotations, + date: dates, }), }), }, |