npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

graphql-transform-transformer

v1.1.0

Published

A GraphQL transform that provide transformations of fields

Downloads

7

Readme

graphql-transform-transformer

A custom transformer of the amplify-cli. It can transform fields.

directive @transform(expression: String!, foreach: Boolean = false) on FIELD_DEFINITION

Usage

1. Install package

npm install graphql-transform-transformer -D

or

yarn add graphql-transform-transformer -D

2. Setup custom transformer

Edit amplify/backend/api/<YOUR_API>/transform.conf.json and append "./graphql-transform-transformer" to transformers field.

    "transformers": [
      "graphql-transform-transformer"
    ]

3. Use @transform directive

Append @transform to target fields.

type Post @model {
  id: ID!
  title: String! @transform(expression: ".toLowerCase().trim()")
  text: String
  tags: [String!] @transform(expression: ".trim()", foreach: true)
}

You can refer the field itself by .. This transformer doesn't check type soundness, writing correct expressions are up to you.

3.1 How it works

AppSync uses Apache Velocity for resolver mapping. It supports basic operators like logical operators. Besides, It supports Java methods. Thus, you can do whatever you want. But I'm not sure which Java version is used inside AppSync, you may find missing methods.

| GraphQL Type | Java Class | | ------------ | ----------------------------------------------------------------------------------------- | | ID | java.lang.String | | String | java.lang.String | | Int | java.lang.Integer | | Float | java.lang.Double | | Boolean | java.lang.Boolean | | Array | java.util.ArrayList | | Enum | java.lang.String |

4. Export NODE_PATH

This step isn't necessary once https://github.com/aws-amplify/amplify-cli/pull/3236 merged.

export NODE_PATH=./node_modules

License

Fork of https://github.com/amazon-archives/aws-reinvent-2019-mobile-workshops/tree/master/MOB405/01%20-%20Finished

ISC

Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. Copyright 2020 Hiroshi Ioka. All Rights Reserved.