GV14982 / async-airtable

A lightweight npm package to handle working with the Airtable API.
https://www.npmjs.com/package/asyncairtable
MIT License
53 stars 5 forks source link

✨ Added array methods and the two text methods #54

Closed GV14982 closed 3 years ago

GV14982 commented 3 years ago

🏷 Adjusted types to handle new features. 🎨 Changed how the package is exported to align with current best practices ✅ Added tests for new methods TODO: Still needs a queryBuilder test for the new methods to be sure they work correctly.

MoralCode commented 3 years ago

It seems like both my machine and the unit testing is getting Error: Error: Invalid query, even with very simple queries that worked before (i'm testing with page not defined, so that may help narrow it down to the big else block above the throws error on line185 of asyncAirtable.js)

Also, in my time spent messing with this, i think it might be nice to clarify that for the new string fields, when the docs say that the syntax is {$textFind: ["test", "This is some test text"]} that its also possible to substitute the second string (or is it either/both?) with a { $fieldName: 'field' } object (assuming this is allowed, sinc my interperetation of the docs may not be correct).

GV14982 commented 3 years ago

@MoralCode Hey there, thanks for taking a look at this.

I am actually currently working on a pretty big change to how the query builder works to make it easier to use these functions going forward. I unfortunately haven't had as much time as I would like to work on this lately, but I hope to push another commit to this PR at some point over the next couple days.

GV14982 commented 3 years ago

53

anthonygualandri commented 2 years ago

I'm having trouble here too as above with there not being documented examples of the different methods. I've looked at the code base and thought this is what it should be, but I'm getting 'Wrong Type' error:

{
      where: { 
        $and: [
          {
            $textFind: [
              "string",
              { fieldName: "field" }
            ]
          },
        ] 
      },
      sort: [
        {
          field: "field",
          direction: "asc"
        },
        {
          field: "field",
          direction: "desc"
        }
      ]
    }

It's not clear to me whether you can do what I'm trying to do above with the query builder. Also, when error output, they don't give any info about what part of the asyncAirtable call failed, so it's hard to tell what is a wrong type here, for example. Is there a way to get more verbose error tracing for the package or is that just something you haven't had time to build in?