Feature Request: Make Record Constructor available as a static method
Opened this issue · 0 comments
Hi team,
We are building an internal library that standardises some functions that use the airtable sdk. eg getAllRelatedRecords
We are also following DDD and are using Zod to model our data structures and endpoints.
We have already successfully written a beta version of the Airtable.js field types as Zod schemas.
However with the shift of Airtable.js to TypeScript we have realised that we have some type divergence. ie our type and the Airtable.js Type defined in DefinitelyTyped.
As such we started looking through the Airtable.js codebase and found Record has a constructor method. We realised that if we had access to this we could use this to new up instances of Record that will have the functions encapsulated within and type goodness for the IDE.
Obviously the ideal would be if the Record class could also infer the field types based on what you have passed it (rawJson?)
My guess is this is how you have the js scripting block working in the browser as the monaco?
editor has access to them.
We tried looking to import the class directly from the src
, but it's not included in the npm
bundle - it could be no? it wouldn't end up in your app bundle anyway.
We then thought - well we could just fork it into our org and update the build command and deploy our own github package with the src file included, but then we would need to keep updating it! And what a round about hack over just raising an issue here to discuss the use case 👍
Does all that make sense?