How to use the resolve-query.createReadModel 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 / runtime / read_model_query_executors.js View on Github external
readModels.forEach(readModel => {
  if (!readModel.name && readModels.length === 1) {
    readModel.name = 'default'
  } else if (!readModel.name) {
    raiseError(message.readModelMandatoryName, readModel)
  } else if (readModelQueryExecutors[readModel.name]) {
    raiseError(message.duplicateName, readModel)
  }

  const facade = createReadModel({
    projection: readModel.projection,
    resolvers: readModel.resolvers,
    ...(readModel.hasOwnProperty('adapter')
      ? {
          adapter: readModel.adapter.module(readModel.adapter.options)
        }
      : {}),
    eventStore
  })

  readModelQueryExecutors[readModel.name] = {
    read: facade.read,
    makeSubscriber: facade.makeReactiveReader,
    resolverNames: Object.keys(readModel.resolvers),
    getLastError: facade.getLastError
  }
github reimagined / resolve / packages / core / resolve-scripts / src / runtime / read_model_query_executors.js View on Github external
readModels.forEach(readModel => {
  if (!readModel.name && readModels.length === 1) {
    readModel.name = 'default'
  } else if (!readModel.name) {
    raiseError(message.readModelMandatoryName, readModel)
  } else if (readModelQueryExecutors[readModel.name]) {
    raiseError(message.duplicateName, readModel)
  }

  const facade = createReadModel({
    projection: readModel.projection,
    resolvers: readModel.resolvers,
    adapter: readModel.hasOwnProperty('adapter')
      ? readModel.adapter.module(readModel.adapter.options)
      : createDefaultAdapter(),
    eventStore
  })

  readModelQueryExecutors[readModel.name] = {
    read: facade.read,
    resolverNames: Object.keys(readModel.resolvers),
    getLastError: facade.getLastError
  }
})

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