Git Product home page Git Product logo

amplifycountdirective's People

Contributors

multimeric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

tedsterh

amplifycountdirective's Issues

Unable to add the directive to more than one model

I get this error after adding the directive to more than one model, I am able to push successfully when it is just the one.
An error occurred during the push operation: There is already a Construct with name '[object Object]CountResolver' in TransformerNestedStack [countResolverStack]

I am not doing anything other than running amplify push

"ExpressionAttributeNames must not be empty"

A query like this:

{
  countFoo(filter: {})
}

Will result in:

{
  "data": {
    "countFoo": null
  },
  "errors": [
    {
      "path": [
        "countFoo"
      ],
      "data": null,
      "errorType": "Lambda:Unhandled",
      "errorInfo": null,
      "locations": [
        {
          "line": 2,
          "column": 3,
          "sourceName": null
        }
      ],
      "message": "ExpressionAttributeNames must not be empty"
    }
  ]
}

Add an efficient count for the entire unfiltered table

We can obtain a rough item count using the describeTable API call on Dynamo. This can be used to very quickly return the number of items in the table when no filters are needed. This could possibly be made even faster by doing this using VTL and not using Lambda at all.

Support Query calls to Dynamo

This would speed up the count function for users who have GSIs.

Implementers should look into how Amplify performs the conditional logic using VTL: https://github.com/aws-amplify/amplify-cli/blob/fcf9100c778e98e16f0ed695112f2a7251aca06a/packages/amplify-graphql-model-transformer/src/resolvers/query.ts#L141-L155.

#if( !$util.isNull($ctx.stash.modelQueryExpression) && !$util.isNullOrEmpty($ctx.stash.modelQueryExpression.expression) )
  $util.qr($ListRequest.put("operation", "Query"))
  $util.qr($ListRequest.put("query", $ctx.stash.modelQueryExpression))
  #if( !$util.isNull($args.sortDirection) && $args.sortDirection == "DESC" )
    #set( $ListRequest.scanIndexForward = false )
  #else
    #set( $ListRequest.scanIndexForward = true )
  #end
#else
  $util.qr($ListRequest.put("operation", "Scan"))
#end

Unable to use count inside a lambda function

Hi, sorry its me again,

So I am able to call searchTraits and listTraits from inside the function but I cannot call countTraits, I am also unable to use the an apiKey to call the count even though my model has the correct auth on it.

I have tried to remove permissions and add them again, but no luck.

Support an auth filter

This would then allow countFoo to work like listFoo with the auth filter. This basically just involves applying this logic:

#if( !$util.isNullOrEmpty($ctx.stash.authFilter) )
  #set( $filter = $ctx.stash.authFilter )
  #if( !$util.isNullOrEmpty($args.filter) )
    #set( $filter = {
  "and":   [$filter, $args.filter]
} )
  #end

Unable to filter the count using attributeExists on its own

Hi,

I am trying to filter based on wether an attribute exists or not, if I use an and statement alongside the attributeExists I am able to get a count but on its own it throws and error

"errors": [
    {
      "path": [
        "fuseable"
      ],
      "data": null,
      "errorType": "Lambda:Unhandled",
      "errorInfo": null,
      "locations": [
        {
          "line": 2,
          "column": 3,
          "sourceName": null
        }
      ],
      "message": "ExpressionAttributeValues must not be empty"
    }
  ]

I got error message "Request failed with status code 401"

How can I controll iam auth for @count? I want to get count over IAM. It is not working.

My schema:

@count
@model
@auth(rules: [
    {allow: public, provider: iam},
    {allow: groups, groups: ["admin"], operations: [create,delete,read,update]}
])
{
    id: ID!
    caption: String
    video: Video! @hasOne
    userId: Ticket! @hasOne
    LikeSuggestions: [LikeSuggestion] @hasMany(indexName: "bySignSuggestion", fields: ["id"])
    approvalStatus: ApprovalStatusEnum!
    reasonForRejection: String,
    updatedAt: AWSDateTime!
}```

Unable to import custom transformer module(amplify-count-directive). ๐Ÿ›‘ You may fix this error by editing transformers at amplify-count-directive/transform.conf.json

Hi,
I updated my Amplify CLI from 7.6.4 to v. 9.2.1 and got this:

Unable to import custom transformer module(amplify-count-directive).
๐Ÿ›‘ You may fix this error by editing transformers at amplify-count-directive/transform.conf.json

here my transform.conf.json

{
    "Version": 5,
    "ElasticsearchWarning": true,
    "transformers": [
       "amplify-count-directive"
    ]
}

With previous version I had no problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.