-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Move Expression typings from Canvas to OSS Interpreter #36960
Conversation
💚 Build Succeeded |
Pinging @elastic/kibana-app-arch |
Pinging @elastic/kibana-canvas |
I'll mark as ready to review for now, and we can discuss whether (once this is approved) we should include all of the updates in Canvas in this PR, or a subsequent one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM w/ possible tweaks. There are a few places where 'any' or 'object' is used, and 'unknown' might be more appropriate. Other than that, this looks great.
|
||
interface Column { | ||
id: string; | ||
name: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the column not contain any type information? That'd be pretty handy to have in a number of situations. (e.g. type: 'string'
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so -- kibana_datatable is just the tabified data format, e.g.
{
columns: [{ id: 'foo', name: 'Foo Col' }],
rows: [{ foo: 'bar' }, { foo: 'baz' }],
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chris, yes it'd be handy, it's not present at the moment, but typed table attribs had come up in discussion. For example, in the context of TS, it could warn that one wants to multiply a numeric column with an alpha column, or filter a time attribute represented as milliseconds since epoch with a range that represents time as days since epoch (ie. the physical type matches but the attribute domains have mismatched semantics).
Also, semantic types would be great for something like.... helping determine Kibana Lens options :-) For example, if an editor knew that those numbers represent time in milliseconds, then appropriate time filters etc. can be added (example is made up, only to illustrate that physical, easy to infer types such as numbers don't help a downstream, uncoupled consumer very much). On the demo day prez for shareable dataviz I touched on using attribute types as a goal, and super early steps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisdavies ^ I should've used the handle
src/legacy/core_plugins/interpreter/common/types/kibana_datatable.ts
Outdated
Show resolved
Hide resolved
/** | ||
* Utility type: extracts returned type from a Promise. | ||
*/ | ||
export type UnwrapPromise<T> = T extends Promise<infer P> ? P : T; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My brain hurts!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clint was already using this in a generic somewhere, so I just extracted it as a utility. Unfortunately I can't take credit for authorship xD
Use case is when you have a type that may or may not be returned from a Promise -- you can use this and then you don't need to worry about whether the promise is there or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I understood it. It just took a bit of staring. I was just reminded of my experience learning Haskell a few years back. Hence, the aching brain. :)
💔 Build Failed |
I think this is an unrelated issue that was fixed on master. Will rebase & push. |
9e3756f
to
248d0ed
Compare
💚 Build Succeeded |
* fix code query string key conflict * fix code go to definition url
* remove import from server folder * the other way around too
…c#36563) * Allow to send showLabel parameter with false value * Add unit test
i tried moving tagcloud fn over to TS, everthing seems to work, i am only missing types for Render type. |
…ar intervals (elastic#36081) * auto interval * [TSVB] Rollup Search - 'auto' interval is not working for Rollup Jobs which were created in Calendar intervals * [TSVB] Rollup Search - 'auto' interval is not working for Rollup Jobs which were created in Calendar intervals * fix issue * fix broken tests * fix pr comments * fix pr comments
…#37281) * fix dataprovider query when the filed is a timestamp * review II * review III
* [feat] create additional http servers allow for additional http servers to be created, tracked and returned * respond to pr feedback * tweak test * update documentation * destructure port, remove unnecessary imports * [fix] export correct type * [feat] expose createNewServer to plugins * [fix] respond to pr feedback * todo: add schema validation & integration test * use reach * [fix] use validateKey to validate partial * [fix] change config shadowing * check kibana port & prevent shadowing * centralize start/stop for servers, add integration test * remove unnecessary property * never forget your await * remove option to pass config into start * fix pr feedback * fix documentation * fix test failures
* Add renovate.json * Update and rename renovate.json to renovate.json5 * Update renovate.json5 * Update renovate.json5 * extend the base config * remove enabled:false * skip the part limiting managers, we point to specific package.json files instead * try to disable updating all but eslint packages * nest npm specific config * fix syntax error * bad copy job * tweak labels * disable update requests for `@kbn/` packages * stop overriding rangeStategy * extend package.json selectors * add a couple more package.json files
typeof null === 'object', so add an explicit check for null
* Fix formatdate not allowing strings * Addressing Feedback
ugh. sorry for the ping everyone 👋 you can safely ignore this |
To spare y'all from further updates, I'm going to go ahead and close this one in favor of #37438. |
💚 Build Succeeded |
Summary
This is a first pass at moving the Canvas Expression Function types that @clintandrewhall worked on over to OSS so they can be exported from the interpreter for use by other plugins.
Reviewers: It's probably easiest to follow this by looking at each of the commits in order.
Usage / Testing
Notes / Thoughts
type
string value in their interface (which this generic relies on).ContextFunction
andNullContextFunction
) because this all seemed to work with one unified generic... but I may be missing edge cases so @clintandrewhall let me know if I'm missing anything!data
plugin now (where this will live long term), instead of interpreter