Generating Client Code
Using the CLI, stately schema generate
will run your schema TypeScript files and then create client code in one of our supported SDK languages that contains typed objects corresponding to the types in your schema. For this to run, you need to have NodeJS installed, and have installed the dependencies for your schema package with npm install
or another package manager.
Generating the SDK can be done in one of two modes: preview or release. Preview mode generates the SDK based on your local schema code, which is useful for rapidly iterating on and integrating with the generated code before you’ve published a new schema version with schema put
. The client will throw an error if you try to actually use it, since the Store doesn’t know about your new schema changes yet. To generate a preview of the SDK, you supply the --preview <path to your schema's index file>
argument. (you can have schema in as many TypeScript files as you want as long as there’s a single file that exports everything). The positional argument is the output directory where the language-specific code will go:
Release mode generates client code based on a published schema version, and that client can actually talk to your Store. To generate a release of the SDK, you supply the --schema-id
and --version
arguments, and the positional argument is the output directory where the language-specific code will go. You can omit --version
to generate from the latest published version of your schema.
Each language produces different code that’s tailored to the conventions and capabilities of that language. See Client SDKs in the sidebar for more info.