Skip to content

Add the primary key type to typescript's TableRuntimeTypeInfo #2671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 28, 2025

Conversation

jsdt
Copy link
Contributor

@jsdt jsdt commented Apr 25, 2025

Description of Changes

The TableRuntimeTypeInfo that we have in the typescript SDK currently has the name of the primary key (if it exists), and the type of the rows. That is technically enough to figure out the AlgebraicType of the primary key with something like rowType.product.elements.find( (element: ProductTypeElement) => {element.name === primaryKey})?.algebraicType, but it's more convenient to have it generated for us.

This adds a field that looks like:

      primaryKeyInfo: {
        colName: "id",
        colType: Person.getTypeScriptAlgebraicType().product.elements[0].algebraicType,
      },

We are still generating primaryKey field, so we don't need to release a new TS SDK version and CLI version at the same time, but eventually we can get rid of it.

API and ABI breaking changes

This is just adding a field in generated typescript code, which shouldn't break anything.

Expected complexity level and risk

Testing

I've tested the current TS sdk with the newly generated code to ensure it doesn't break, and I'm working on a TS PR that will use the new field. I have enough of the new code working that I have tested the newly generated fields.

@bfops bfops added the release-any To be landed in any release window label Apr 28, 2025
@bfops
Copy link
Collaborator

bfops commented Apr 28, 2025

(I'm removing the codeowner reviewers since they're no longer codeowners for any changed files)

Copy link
Contributor

@cloutiertyler cloutiertyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. It's quite straightforward

@jsdt jsdt added this pull request to the merge queue Apr 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 28, 2025
@jsdt jsdt added this pull request to the merge queue Apr 28, 2025
Merged via the queue into master with commit 228ec0c Apr 28, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-any To be landed in any release window
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants