How to use graphql-elasticsearch-transformer - 2 common examples

To help you get started, we’ve selected a few graphql-elasticsearch-transformer 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 trek10inc / appsync-cloudformation-transformer-cli / src / index.js View on Github external
new ModelConnectionTransformer(),
    new VersionedModelTransformer(),
    new DefaultValueTransformer()
]

// Only insert certain plugins if needed, otherwise they pollute the cloudformation
// for no good reason.
// We determine if needed with a simple string search for the directive string
function conditionalInsertDirectivePlugin(plugin, searchString){
    if (schema.indexOf(searchString) >= 0) {
        transformers.push(plugin)
    }
}

conditionalInsertDirectivePlugin(new ModelAuthTransformer(), '@auth');
conditionalInsertDirectivePlugin(new SearchableModelTransformer(), '@searchable');

// console.log(process.argv)
const transformer = new GraphQLTransform({
    transformers: transformers
})

const cfdoc = transformer.transform(schema);
console.log(JSON.stringify(cfdoc, null, 2))
github aws-amplify / amplify-cli / packages / amplify-provider-awscloudformation / lib / transform-graphql-schema.js View on Github external
return async (addSearchableTransformer, storageConfig) => {
    const transformerList = [
      // TODO: Removing until further discussion. `getTransformerOptions(project, '@model')`
      new DynamoDBModelTransformer(),
      new VersionedModelTransformer(),
      new FunctionTransformer(),
      new HttpTransformer(),
      new KeyTransformer(),
      new ModelConnectionTransformer(),
      new PredictionsTransformer(storageConfig),
    ];

    if (addSearchableTransformer) {
      transformerList.push(new SearchableModelTransformer());
    }

    const customTransformersConfig = await readTransformerConfiguration(resourceDir);
    const customTransformers = (customTransformersConfig && customTransformersConfig.transformers
      ? customTransformersConfig.transformers
      : []
    )
      .map(transformer => {
        const fileUrlMatch = /^file:\/\/(.*)\s*$/m.exec(transformer);
        const modulePath = fileUrlMatch ? fileUrlMatch[1] : transformer;

        if (!modulePath) {
          throw new Error(`Invalid value specified for transformer: '${transformer}'`);
        }

        // The loading of transformer can happen multiple ways in the following order:

graphql-elasticsearch-transformer

An AppSync model transform that creates an ElasticSearch index with the queries to match.

Apache-2.0
Latest version published 12 days ago

Package Health Score

93 / 100
Full package analysis

Popular graphql-elasticsearch-transformer functions