diff --git a/modules/vf-graphql-holochain/mutations/index.ts b/modules/vf-graphql-holochain/mutations/index.ts index 3dac8771..ba5b52b8 100644 --- a/modules/vf-graphql-holochain/mutations/index.ts +++ b/modules/vf-graphql-holochain/mutations/index.ts @@ -23,6 +23,8 @@ import ProposedIntent from './proposedIntent.js' import Agreement from './agreement.js' import Plan from './plan.js' import Agent from './agent.js' +import RecipeFlow from './recipeFlow.js' +import RecipeProcess from './recipeProcess.js' // generic deletion calling format used by all mutations export type deleteHandler = (root: any, args: ByRevision) => Promise @@ -41,6 +43,7 @@ export default (enabledVFModules: VfModule[] = DEFAULT_VF_MODULES, dnaConfig: DN const hasProposal = -1 !== enabledVFModules.indexOf(VfModule.Proposal) const hasAgreement = -1 !== enabledVFModules.indexOf(VfModule.Agreement) const hasPlan = -1 !== enabledVFModules.indexOf(VfModule.Plan) + const hasRecipe = -1 !== enabledVFModules.indexOf(VfModule.Recipe) return Object.assign( (hasMeasurement ? { ...Unit(dnaConfig, conductorUri) } : {}), @@ -79,5 +82,9 @@ export default (enabledVFModules: VfModule[] = DEFAULT_VF_MODULES, dnaConfig: DN (hasAgreement ? { ...Agreement(dnaConfig, conductorUri) } : {}), (hasPlan ? { ...Plan(dnaConfig, conductorUri) } : {}), (hasAgent ? { ...Agent(dnaConfig, conductorUri) } : {}), + (hasRecipe ? { + ...RecipeFlow(dnaConfig, conductorUri), + ...RecipeProcess(dnaConfig, conductorUri), + } : {}), ) } diff --git a/modules/vf-graphql-holochain/queries/index.ts b/modules/vf-graphql-holochain/queries/index.ts index 9d207d60..1836d916 100644 --- a/modules/vf-graphql-holochain/queries/index.ts +++ b/modules/vf-graphql-holochain/queries/index.ts @@ -22,6 +22,8 @@ import Satisfaction from './satisfaction.js' import Proposal from './proposal.js' import Agreement from './agreement.js' import Plan from './plan.js' +import RecipeFlow from './recipeFlow.js' +import RecipeProcess from './recipeFlow.js' export default (enabledVFModules: VfModule[] = DEFAULT_VF_MODULES, dnaConfig: DNAIdMappings, conductorUri: string) => { const hasAgent = -1 !== enabledVFModules.indexOf(VfModule.Agent) @@ -38,6 +40,7 @@ export default (enabledVFModules: VfModule[] = DEFAULT_VF_MODULES, dnaConfig: DN const hasProposal = -1 !== enabledVFModules.indexOf(VfModule.Proposal) const hasAgreement = -1 !== enabledVFModules.indexOf(VfModule.Agreement) const hasPlan = -1 !== enabledVFModules.indexOf(VfModule.Plan) + const hasRecipe = -1 !== enabledVFModules.indexOf(VfModule.Recipe) return Object.assign( (hasAction ? { @@ -73,5 +76,9 @@ export default (enabledVFModules: VfModule[] = DEFAULT_VF_MODULES, dnaConfig: DN (hasProposal ? { ...Proposal(dnaConfig, conductorUri) } : {}), (hasAgreement ? { ...Agreement(dnaConfig, conductorUri) } : {}), (hasPlan ? { ...Plan(dnaConfig, conductorUri) } : {}), + (hasRecipe ? { + ...RecipeFlow(dnaConfig, conductorUri), + ...RecipeProcess(dnaConfig, conductorUri) + } : {}), ) } diff --git a/modules/vf-graphql-holochain/queries/recipeFlow.ts b/modules/vf-graphql-holochain/queries/recipeFlow.ts index 3ecb9dbe..144548b8 100644 --- a/modules/vf-graphql-holochain/queries/recipeFlow.ts +++ b/modules/vf-graphql-holochain/queries/recipeFlow.ts @@ -14,8 +14,8 @@ import { import { PagingParams } from '../resolvers/zomeSearchInputTypes.js' export default (dnaConfig: DNAIdMappings, conductorUri: string) => { - const readOne = mapZomeFn(dnaConfig, conductorUri, 'planning', 'recipe_flow', 'get_recipe_flow') - const readAll = mapZomeFn(dnaConfig, conductorUri, 'planning', 'recipe_flow_index', 'read_all_recipe_flows') + const readOne = mapZomeFn(dnaConfig, conductorUri, 'recipe', 'recipe_flow', 'get_recipe_flow') + const readAll = mapZomeFn(dnaConfig, conductorUri, 'recipe', 'recipe_flow_index', 'read_all_recipe_flows') return { recipeFlow: async (root, args): Promise => { diff --git a/modules/vf-graphql-holochain/resolvers/index.ts b/modules/vf-graphql-holochain/resolvers/index.ts index f8fe69b3..ecc535fb 100644 --- a/modules/vf-graphql-holochain/resolvers/index.ts +++ b/modules/vf-graphql-holochain/resolvers/index.ts @@ -39,6 +39,9 @@ import ProposedIntent from './proposedIntent.js' import Agreement from './agreement.js' import Plan from './plan.js' +import RecipeFlow from './recipeFlow.js' +import RecipeProcess from './recipeProcess.js' + // union type disambiguation const EventOrCommitment = { __resolveType: (obj, ctx, info) => obj.__typename, @@ -78,6 +81,7 @@ const generateResolvers = async (options: ResolverOptions) => { const hasProposal = -1 !== enabledVFModules.indexOf(VfModule.Proposal) const hasAgreement = -1 !== enabledVFModules.indexOf(VfModule.Agreement) const hasPlan = -1 !== enabledVFModules.indexOf(VfModule.Plan) + const hasRecipe = -1 !== enabledVFModules.indexOf(VfModule.Recipe) // prefetch connection for this API schema // and also this makes calls to the admin conductor to authorize a set of signing @@ -141,6 +145,10 @@ const generateResolvers = async (options: ResolverOptions) => { } : {}), (hasAgreement ? { Agreement: Agreement(enabledVFModules, dnaConfig, conductorUri) } : {}), (hasPlan ? { Plan: Plan(enabledVFModules, dnaConfig, conductorUri) } : {}), + (hasRecipe ? { + RecipeFlow: RecipeFlow(enabledVFModules, dnaConfig, conductorUri), + RecipeProcess: RecipeProcess(enabledVFModules, dnaConfig, conductorUri), + } : {}), ) } diff --git a/modules/vf-graphql-holochain/resolvers/recipeFlow.ts b/modules/vf-graphql-holochain/resolvers/recipeFlow.ts index e7d314a0..fd679bfd 100644 --- a/modules/vf-graphql-holochain/resolvers/recipeFlow.ts +++ b/modules/vf-graphql-holochain/resolvers/recipeFlow.ts @@ -36,44 +36,35 @@ const extractProposedIntent = (data): ProposedIntent => data.proposedIntent export default (enabledVFModules: VfModule[] = DEFAULT_VF_MODULES, dnaConfig: DNAIdMappings, conductorUri: string) => { const hasResourceSpecification = -1 !== enabledVFModules.indexOf(VfModule.ResourceSpecification) - const hasProcessSpecification = -1 !== enabledVFModules.indexOf(VfModule.ProcessSpecification) - const hasAction = -1 !== enabledVFModules.indexOf(VfModule.Action) - const hasRecipeInput = -1 !== enabledVFModules.indexOf(VfModule.RecipeProcess) - const hasRecipeOutput = -1 !== enabledVFModules.indexOf(VfModule.RecipeProcess) + // const hasProcessSpecification = -1 !== enabledVFModules.indexOf(VfModule.ProcessSpecification) + // const hasAction = -1 !== enabledVFModules.indexOf(VfModule.Action) const hasHistory = -1 !== enabledVFModules.indexOf(VfModule.History) const readResourceSpecification = mapZomeFn(dnaConfig, conductorUri, 'specification', 'resource_specification', 'get_resource_specification') - const readProcessSpecification = mapZomeFn(dnaConfig, conductorUri, 'specification', 'process_specification', 'get_process_specification') - const readAction = mapZomeFn(dnaConfig, conductorUri, 'specification', 'action', 'get_action') - const readRecipeProcess = mapZomeFn(dnaConfig, conductorUri, 'planning', 'recipe_process', 'get_recipe_process') - const readRevision = mapZomeFn(dnaConfig, conductorUri, 'planning', 'recipe_flow', 'get_revision') + // const readProcessSpecification = mapZomeFn(dnaConfig, conductorUri, 'specification', 'process_specification', 'get_process_specification') + // const readAction = mapZomeFn(dnaConfig, conductorUri, 'specification', 'action', 'get_action') + const readRecipeProcess = mapZomeFn(dnaConfig, conductorUri, 'recipe', 'recipe_process', 'get_recipe_process') + const readRevision = mapZomeFn(dnaConfig, conductorUri, 'recipe', 'recipe_flow', 'get_revision') return Object.assign( - (hasResourceSpecification ? { - resourceConformsTo: async (record: { resourceConformsTo: ResourceSpecificationAddress }): Promise => { - return (await readResourceSpecification({ address: record.resourceConformsTo })).resourceSpecification - }, - } : {}), - (hasProcessSpecification ? { - processConformsTo: async (record: { stage: ProcessSpecificationAddress }): Promise => { - return (await readProcessSpecification({ address: record.stage })).processSpecification - }, - } : {}), - (hasAction ? { - action: async (record: { action: AddressableIdentifier }): Promise => { - return (await readAction({ id: record.action })) - }, - } : {}), - (hasRecipeInput ? { + { recipeInputOf: async (record: { recipeInputOf: RecipeProcessAddress }): Promise => { return (await readRecipeProcess({ address: record.recipeInputOf })).recipeProcess }, - } : {}), - (hasRecipeOutput ? { recipeOutputOf: async (record: { recipeOutputOf: RecipeProcessAddress }): Promise => { return (await readRecipeProcess({ address: record.recipeOutputOf })).recipeProcess }, + }, + (hasResourceSpecification ? { + resourceConformsTo: async (record: { resourceConformsTo: ResourceSpecificationAddress }): Promise => { + return (await readResourceSpecification({ address: record.resourceConformsTo })).resourceSpecification + }, } : {}), + // (hasAction ? { + // action: async (record: { action: AddressableIdentifier }): Promise => { + // return (await readAction({ id: record.action })) + // }, + // } : {}), (hasHistory ? { revision: async (record: RecipeFlow, args: { revisionId: AddressableIdentifier }): Promise => { return (await readRevision(args)).recipeFlow diff --git a/modules/vf-graphql-holochain/resolvers/recipeProcess.ts b/modules/vf-graphql-holochain/resolvers/recipeProcess.ts index ed539e2f..cc5025b3 100644 --- a/modules/vf-graphql-holochain/resolvers/recipeProcess.ts +++ b/modules/vf-graphql-holochain/resolvers/recipeProcess.ts @@ -21,12 +21,12 @@ import { // const extractProposedIntent = (data): ProposedIntent => data.proposedIntent export default (enabledVFModules: VfModule[] = DEFAULT_VF_MODULES, dnaConfig: DNAIdMappings, conductorUri: string) => { - const hasAction = -1 !== enabledVFModules.indexOf(VfModule.Action) + // const hasAction = -1 !== enabledVFModules.indexOf(VfModule.Action) const hasHistory = -1 !== enabledVFModules.indexOf(VfModule.History) const hasProcessSpecification = -1 !== enabledVFModules.indexOf(VfModule.ProcessSpecification) - const readRevision = mapZomeFn(dnaConfig, conductorUri, 'planning', 'recipe_process', 'get_revision') - const readAction = mapZomeFn(dnaConfig, conductorUri, 'specification', 'action', 'get_action') + const readRevision = mapZomeFn(dnaConfig, conductorUri, 'recipe', 'recipe_process', 'get_revision') + // const readAction = mapZomeFn(dnaConfig, conductorUri, 'specification', 'action', 'get_action') const readProcessSpecification = mapZomeFn(dnaConfig, conductorUri, 'specification', 'process_specification', 'get_process_specification') // const readProcesses = mapZomeFn(dnaConfig, conductorUri, 'observation', 'process_index', 'query_processes') @@ -36,11 +36,11 @@ export default (enabledVFModules: VfModule[] = DEFAULT_VF_MODULES, dnaConfig: DN return (await readRevision(args)).recipeProcess }, } : {}), - (hasAction ? { - action: async (record: { action: AddressableIdentifier }): Promise => { - return (await readAction({ id: record.action })) - }, - } : {}), + // (hasAction ? { + // action: async (record: { action: AddressableIdentifier }): Promise => { + // return (await readAction({ id: record.action })) + // }, + // } : {}), (hasProcessSpecification ? { processConformsTo: async (record: { processConformsTo: ProcessSpecificationAddress }): Promise => { return (await readProcessSpecification({ address: record.processConformsTo })).processSpecification diff --git a/modules/vf-graphql-holochain/types.ts b/modules/vf-graphql-holochain/types.ts index c8bd12bf..465fa756 100644 --- a/modules/vf-graphql-holochain/types.ts +++ b/modules/vf-graphql-holochain/types.ts @@ -168,8 +168,7 @@ export enum VfModule { Commitment = 'commitment', Satisfaction = 'satisfaction', Proposal = 'proposal', - RecipeFlow = 'recipe', - RecipeProcess = 'recipe', + Recipe = 'recipe', } // default 'full suite' VF module set supported by hREA @@ -196,8 +195,8 @@ export const DEFAULT_VF_MODULES = [ VfModule.Intent, VfModule.Commitment, VfModule.Satisfaction, - VfModule.RecipeFlow, - VfModule.RecipeProcess, + // Recipe DNA + VfModule.Recipe, ] // scalar types