How to use the resolve-query.createFacade function in resolve-query

To help you get started, we’ve selected a few resolve-query examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reimagined / resolve / packages / resolve-scripts / src / server / express.js View on Github external
config.readModels.forEach(readModel => {
  if (!readModel.name && config.readModels.length === 1) {
    readModel.name = 'default'
  } else if (!readModel.name) {
    raiseError(message.readModelMandatoryName, readModel)
  } else if (queryExecutors[readModel.name]) {
    raiseError(message.dublicateName, readModel)
  }

  const facade = createFacade({
    model: createReadModel({
      projection: readModel.projection,
      adapter: readModel.adapter,
      eventStore
    }),
    resolvers: readModel.resolvers
  })

  queryExecutors[readModel.name] = facade.executeQuery

  queryExecutors[readModel.name].makeSubscriber = facade.makeReactiveReader

  queryExecutors[readModel.name].mode = 'read'
})
github reimagined / resolve / packages / resolve-scripts / src / server / express.js View on Github external
config.viewModels.forEach(viewModel => {
  if (!viewModel.name && config.viewModels.length === 1) {
    viewModel.name = 'reduxinitial'
  } else if (!viewModel.name) {
    raiseError(message.viewModelMandatoryName, viewModel)
  } else if (queryExecutors[viewModel.name]) {
    raiseError(message.dublicateName, viewModel)
  }

  if (!viewModel.serializeState || !viewModel.deserializeState) {
    raiseError(message.viewModelSerializable, viewModel)
  }

  const facade = createFacade({
    model: createViewModel({
      projection: viewModel.projection,
      eventStore
    }),
    resolvers: {
      view: async (model, { jwtToken }) =>
        await viewModel.serializeState(model, jwtToken)
    }
  })

  queryExecutors[viewModel.name] = facade.executeQuery

  queryExecutors[viewModel.name].mode = 'view'
})

resolve-query

Provides an interface used to create and querry read models and view models in a reSolve application.

MIT
Latest version published 4 years ago

Package Health Score

48 / 100
Full package analysis