Code Generation & Menu
This section covers two topics: generating TypeScript call snippets from datasets or saved SQL, and aligning local pages with the platform's menu and CDN resources. Neither replaces writing business logic, but both reduce the time spent looking up documentation and writing boilerplate.
Generate SDK-style code from a dataset operation: codegen sdk
Assuming you've already run api pull and know which operation to call:
rabetbase codegen sdk --alias order --operation filter
You can also use the dataset code instead of an alias:
rabetbase codegen sdk --code <32-digit-code> --operation getOne
Output is printed to the terminal by default. To write it to a file, use shell redirection:
rabetbase codegen sdk --alias order --operation filter > ./src/api/order-filter.ts
To skip the import statements at the top of the file:
rabetbase codegen sdk --alias order --operation filter --skip-imports
If the dataset operations output doesn't give you enough clarity on parameters, go back to API & Datasets to configure --operation first.
Generate call code from a saved SQL: codegen sql
rabetbase codegen sql --sqlcode xxxxxxxx-xxxxxxxx
The generation target can be either SDK call or BFF internal call (see --help for the exact options):
rabetbase codegen sql --sqlcode xxxxxxxx-xxxxxxxx --target sdk
rabetbase codegen sql --sqlcode xxxxxxxx-xxxxxxxx --target bff
You can also redirect output to a file. Use this together with Custom SQL: first sql save, then codegen sql.
Menu: Sync local pages to the platform with menu sync
When you've added new pages or changed routes locally and want the console menu to reflect those changes:
rabetbase menu sync
This is typically interactive (checkboxes, confirmations). In CI or non-interactive environments, pass --yes or --params as required by your project (see rabetbase menu sync --help).
Menu: Update online CDN resources with menu update
Batch-update CDN resource URLs referenced in the online menu (e.g., after changing static asset addresses):
rabetbase menu update
This solves a different problem than sync: sync is about page structure alignment, while update is about bulk resource URL replacement. The exact behavior depends on your team's conventions.
Summary
codegen sdk: Dataset operation to TypeScript snippet.codegen sql: Saved SQL to TypeScript snippet.menu sync/menu update: Menu and resource maintenance.
For CLI self-checks and upgrades, see Maintenance & Troubleshooting.