generateDataTypes()
Last updated
Last updated
Generate Typescript Interfaces for your database and save them in a specified path in your local directory.
You can use this feature to make your development easier by generating database tables interfaces for your Typescript projects. Most likely, you won't need to use this during the runtime, but as a one-time script in your package.json
. To implement it:
Create a file deskree-interfaces.ts
that will instantiate Deskree Client together with a :
DANGER: Always keep your Deskree Admin token secure as it is a very powerful token that may allow unwanted access to your data if compromised. If you believe that is the case.
Run the newly created script in your console:
npm run deskree-interfaces
The interfaces file should appear in the specified directory for you to use throughout your project.
Creates Typescript Interface file in the specified path.
Field | Required | Data Type | Description |
---|---|---|---|
Field | Required | Data Type | Description |
---|---|---|---|
options
Object
Options Object describing filtering, sorting, and other options
database
default
Currently accepts only "default" value, but with multiple databases per project feature coming soon, it will be accepting the name of the database to extract the configs from. Default: "default"
path
string
Relative path where typescript interfaces should be saved. Should always end with /
Example: ./src/interfaces/
Default: will save the file in the same directory where the method is executed.
fileName
`string`
File name of the interfaces.
Default: deskree-types.interface.ts