APEX-54 Stricter type checking for unsafe_transform functions (#222973)

Address https://github.com/elastic/kibana/issues/216061

Adds an indirection layer in the definition of the `transformFn:`, which
forces devs to explicitly define the types of the documents being
transformed.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Gerard Soldevila 2025-06-13 12:29:13 +02:00 committed by GitHub
parent 6aafb4f7f4
commit 852f416a01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 471 additions and 181 deletions

View file

@ -104,9 +104,10 @@ export class EsoModelVersionExample
changes: [
{
type: 'unsafe_transform',
transformFn: (document) => {
return { document };
},
transformFn: (typeSafeGuard) =>
typeSafeGuard((document) => {
return { document };
}),
},
],
schemas: {