kibana/typings
Spencer 2e314db2ce
Wrap rison-node to improve types (#146649)
@maximpn brought up the issues caused by the types required by the
rison-node package, which attempted to communicate that "encoded values
must be primitive values, or recursive arrays/object of primitive
values". This isn't actually expressible in TypeScript, which lead to
many instances of `rison.encode(value as unknown as RisonValue)` which
is useless. Additionally, the rison-node library actually supports any
value and will either produce valid rison or `undefined` for that value.

To address this I'm adding a wrapper function which accepts `any` and
returns a `string`. If rison-node is totally unable to produce any rison
for the value (because the value is `undefined` or some other type like
Symbol or BigInt) the `encode()` function will throw. If you're
accepting arbitrary input you can use the `encodeUnknown()` function,
which will return a string or undefined, if the value you provided has
zero rison representation.

Like JSON.stringify() any non-circular primitive, object, or array can
be encoded with either function. If the values within those objects are
not encodable (functions, RegExps, etc) then they will be skipped. Any
object/array with the `toJSON()` method will be converted to JSON first,
and if the prototype of the object has the `encode_rison()` method it
will be used to convert he value into rison.

The changes in this PR are mostly updating usage of rison-node to use
`@kbn/rison` (which is also enforced by eslint). There are also several
changes which remove unnecessary casting.
2022-12-01 08:33:56 -07:00
..
@appland/sql_parser [Osquery] Replace js-sql-parser (#128714) 2022-05-18 12:58:07 +02:00
@elastic/eui remove unnecessary global typings (#117408) 2021-11-04 16:59:14 +01:00
@emotion Enable CSS-in-JS styling with emotion (#98157) 2021-07-09 13:42:50 -05:00
resize-observer-polyfill Upgrade Typescript to 4.3.5 (#104470) 2021-12-02 16:27:41 -08:00
cytoscape_dagre.d.ts Merge tsconfig and x-pack/tsconfig files (#94519) 2021-03-16 15:13:49 +01:00
index.d.ts [typescript] Create Ambient Types package (#129368) 2022-04-06 19:21:24 -05:00