generateDataTypes()
Description
Generate Typescript Interfaces for your database and save them in a specified path in your local directory.
Use Cases
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 Deskree Admin Token: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, you can always refresh your to
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.
Request
Parameters
Field | Required | Data Type | Description |
---|---|---|---|
options | Object | Options Object describing filtering, sorting, and other options |
Options Object Parameters
Field | Required | Data Type | Description |
---|---|---|---|
database |
| 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 |
| Relative path where typescript interfaces should be saved. Should always end with Default: will save the file in the same directory where the method is executed. | |
fileName | `string` | File name of the interfaces.
Default: |
Example
Response
Creates Typescript Interface file in the specified path.
Example
Last updated