@chili-publish/studio-sdk

SDK Documentation

Welcome to the SDK documentation, if you want to be absolutely 100% sure that you have the latest and greatest SDK documentation at your hand, we could redirect you to the Github Pages deployment of our SDK documentation, but this one is great as well.

So on these pages you'll find some very technical but super handy descriptions of all the functions available in the controllers, as well as the exported enums and other configuration params.

We have made an effort to type the document that is used by the editor-engine as ChiliDocument. You can find the entire definition on this page.

If you want to check out some types, interfaces and general methods, you can find them all bundled under the modules page.

Because of the nature of an async stream, be aware that you may react on an item that has an old state.
Eventual consistency means that you will eventually get the correct state from the stream.

See: https://en.wikipedia.org/wiki/Eventual_consistency

You can observe outbound SDK controller calls through:

  • Per-method listeners: sdk.variable.create.addEventListener(...)
  • Global SDK events: sdk.sdkEvents.onMethodInvoked and sdk.sdkEvents.onMethodCompleted

These are SDK-level events (SDK -> consumer), not engine subscriber events (config.events).

const sdk = new StudioSDK({ editorId: 'chili-editor-example' });

sdk.variable.create.addEventListener((event) => {
console.log(event.phase, event.path, event.args, event.result, event.error);
});

sdk.sdkEvents.onMethodInvoked.registerCallback((event) => {
console.log('Invoked:', event.path, event.args);
});

sdk.sdkEvents.onMethodCompleted.registerCallback((event) => {
console.log('Completed:', event.path, event.success);
});