From 77fc589466fc0c04326231638c5ec6026e7948d4 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 11 Jan 2025 20:49:26 -0400 Subject: data: soupy reverse --- .../wiki-data/withReverseReferenceList.js | 46 +++++++++++----------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'src/data/composite/wiki-data/withReverseReferenceList.js') diff --git a/src/data/composite/wiki-data/withReverseReferenceList.js b/src/data/composite/wiki-data/withReverseReferenceList.js index c62408cf..906f5bc5 100644 --- a/src/data/composite/wiki-data/withReverseReferenceList.js +++ b/src/data/composite/wiki-data/withReverseReferenceList.js @@ -1,34 +1,36 @@ // Check out the info on reverseReferenceList! // This is its composable form. -import withReverseList_template from './helpers/withReverseList-template.js'; +import {input, templateCompositeFrom} from '#composite'; -import {input} from '#composite'; +import gobbleSoupyReverse from './gobbleSoupyReverse.js'; +import inputSoupyReverse from './inputSoupyReverse.js'; +import inputWikiData from './inputWikiData.js'; -import {withPropertyFromList} from '#composite/data'; +import withResolvedReverse from './helpers/withResolvedReverse.js'; -export default withReverseList_template({ +export default templateCompositeFrom({ annotation: `withReverseReferenceList`, - propertyInputName: 'list', - outputName: '#reverseReferenceList', - - customCompositionSteps: () => [ - { - dependencies: [input('data')], - compute: (continuation, { - [input('data')]: data, - }) => continuation({ - ['#referencingThings']: - data, - }), - }, - - withPropertyFromList({ - list: '#referencingThings', - property: input('list'), + inputs: { + data: inputWikiData({allowMixedTypes: true}), + reverse: inputSoupyReverse(), + }, + + outputs: ['#reverseReferenceList'], + + steps: () => [ + gobbleSoupyReverse({ + reverse: input('reverse'), + }), + + // TODO: Check that the reverse spec returns a list. + + withResolvedReverse({ + data: input('data'), + reverse: '#reverse', }).outputs({ - '#values': '#referencedThings', + '#resolvedReverse': '#reverseReferenceList', }), ], }); -- cgit 1.3.0-6-gf8a5