Sending ColumnType enum values in mutations in typescript

Hey folks - I’m currently working on updating an integration to work with the new 2023-10 API (from the 2023-07 version). Everything seems reasonably straightforward, but I’m getting caught specifically on the create_column mutation, and on the ColumnType change in particular.

Formerly, I was able to send a string with the column type, but now I can’t, of course, because the type is changed. However, I can’t figure out a way to actually send a ColumnType in a way that the API likes (i.e., not in a string format). I’ve specified that the type in my mutation is ColumnType!, but how do I actually gain access to the members of that enum, preferably without using the SDK (which I’m currently not using)? Right now, I can’t seem to find examples in typescript of people doing this mutation dynamically, without hardcoded values.

Has anyone run into this problem?

Oddly, the enums are text but CANNOT be in quotes in your query string.

If you are using GraphQL variables instead, just make sure you define the variable as ColumnType! and in the variables send the enum as a string. Yeah, counter-intuitive.

If you need a bit of assistance on the typescript enum, I took care of that in this thread: ERRATA: remote options columnType uses old string not modern enum still - #5 by codyfrisch

Also included a function that converts the old strings to the new enum strings.

2 Likes