Skip to content

Use void instead of undefined in instance API - #1417

Merged
tslil-topos merged 1 commit into
tslil/instance_typesfrom
kb/instance_types
Aug 24, 2026
Merged

Use void instead of undefined in instance API#1417
tslil-topos merged 1 commit into
tslil/instance_typesfrom
kb/instance_types

Conversation

@kasbah

@kasbah kasbah commented Aug 21, 2026

Copy link
Copy Markdown
Member

No description provided.

@tslil-topos
tslil-topos merged commit 1edee5a into tslil/instance_types Aug 24, 2026
17 checks passed
@tslil-topos
tslil-topos deleted the kb/instance_types branch August 24, 2026 11:01
@tslil-topos

Copy link
Copy Markdown
Collaborator

thanks!

tslil-topos added a commit that referenced this pull request Aug 24, 2026
* OBEE-36: add instance types and validation

Define instance, table, and error types as well as add runtime support for instance-capable shapes. Add temporary implementations of atomic column typing and instance validation until we decide how we want this to work mathematically. We do not add capability to actually generate anything of these types in this change.

Adjust the pnpm config to build generated document types before checking (we now depend on catlog-wasm) and increase the validation test timeout for loading catlog-wasm.

This change includes the revised interface for instances and usage pattern that Kaspar and i had discussed. See `src/instance/instance.ts` for details.

In order to obtain `tables` for example, the expected pattern is
```typescript
// subscribe to validation
const unsubscribe = instance.onValidate(async (validation) => {
  // ignore invalid schemas or instances
  if (validation.tag !== "Ok") return;
  // both were valid at the callback time, try to read the table content
  const result = await instance.tables();
  // something invalidated either the schema or instance
  if (result.tag !== "Ok") return;
  // use tables...
  const tables = result.content;
});

// finally
unsubscribe();
```

* ENH: Use void instead of undefined in instance API (#1417)

---------

Co-authored-by: tslil-topos <tslil@topos.institute>
Co-authored-by: Kaspar <git@kaspar.systems>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants