kibana/api_docs/kbn_zod_helpers.devdocs.json

602 lines
No EOL
20 KiB
JSON

{
"id": "@kbn/zod-helpers",
"client": {
"classes": [],
"functions": [],
"interfaces": [],
"enums": [],
"misc": [],
"objects": []
},
"server": {
"classes": [],
"functions": [],
"interfaces": [],
"enums": [],
"misc": [],
"objects": []
},
"common": {
"classes": [],
"functions": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.ArrayFromString",
"type": "Function",
"tags": [],
"label": "ArrayFromString",
"description": [
"\nThis is a helper schema to convert comma separated strings to arrays. Useful\nfor processing query params.\n"
],
"signature": [
"(schema: T) => Zod.ZodEffects<Zod.ZodArray<T, \"many\">, T[\"_output\"][], unknown>"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/array_from_string.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.ArrayFromString.$1",
"type": "Uncategorized",
"tags": [],
"label": "schema",
"description": [
"Array items schema"
],
"signature": [
"T"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/array_from_string.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [
"Array schema that accepts a comma-separated string as input"
],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.assertAllParsableSchemas",
"type": "Function",
"tags": [],
"label": "assertAllParsableSchemas",
"description": [
"\nAsserts that the schema is recursively parsable (ie, it is\ncomposed entirely of parsable schemas)"
],
"signature": [
"(outerSchema: Zod.ZodType<any, Zod.ZodTypeDef, any>) => Set<{ key: string; schema: DangerousParsableSchema; }>"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/deep_strict.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.assertAllParsableSchemas.$1",
"type": "Object",
"tags": [],
"label": "outerSchema",
"description": [],
"signature": [
"Zod.ZodType<any, Zod.ZodTypeDef, any>"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/deep_strict.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.buildRouteValidationWithZod",
"type": "Function",
"tags": [],
"label": "buildRouteValidationWithZod",
"description": [
"\nZod validation factory for Kibana route's request validation.\nIt allows to pass a Zod schema for parameters, query and/or body validation.\n\nExample:\n\n```ts\nrouter.versioned\n .post({\n access: 'public',\n path: MY_URL,\n })\n .addVersion(\n {\n version: 'my-version',\n validate: {\n request: {\n params: buildRouteValidationWithZod(MyRequestParamsZodSchema),\n query: buildRouteValidationWithZod(MyRequestQueryZodSchema),\n body: buildRouteValidationWithZod(MyRequestBodyZodSchema),\n },\n },\n },\n```"
],
"signature": [
"(schema: ZodSchema) => ",
"RouteValidationFunction",
"<Type>"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/build_route_validation_with_zod.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.buildRouteValidationWithZod.$1",
"type": "Uncategorized",
"tags": [],
"label": "schema",
"description": [],
"signature": [
"ZodSchema"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/build_route_validation_with_zod.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.DeepStrict",
"type": "Function",
"tags": [],
"label": "DeepStrict",
"description": [],
"signature": [
"(schema: TSchema) => Zod.ZodEffects<TSchema, TSchema[\"_output\"], unknown>"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/deep_strict.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.DeepStrict.$1",
"type": "Uncategorized",
"tags": [],
"label": "schema",
"description": [],
"signature": [
"TSchema"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/deep_strict.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.expectParseError",
"type": "Function",
"tags": [],
"label": "expectParseError",
"description": [],
"signature": [
"(result: Zod.SafeParseReturnType<Input, Output>) => void"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/expect_parse_error.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.expectParseError.$1",
"type": "CompoundType",
"tags": [],
"label": "result",
"description": [],
"signature": [
"Zod.SafeParseReturnType<Input, Output>"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/expect_parse_error.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.expectParseSuccess",
"type": "Function",
"tags": [],
"label": "expectParseSuccess",
"description": [],
"signature": [
"(result: Zod.SafeParseReturnType<Input, Output>) => void"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/expect_parse_success.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.expectParseSuccess.$1",
"type": "CompoundType",
"tags": [],
"label": "result",
"description": [],
"signature": [
"Zod.SafeParseReturnType<Input, Output>"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/expect_parse_success.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.isBooleanFromString",
"type": "Function",
"tags": [],
"label": "isBooleanFromString",
"description": [],
"signature": [
"(val: unknown) => val is KbnZodBooleanFromString"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/kbn_zod_types/boolean_from_string.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.isBooleanFromString.$1",
"type": "Unknown",
"tags": [],
"label": "val",
"description": [],
"signature": [
"unknown"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/kbn_zod_types/boolean_from_string.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.isNonEmptyString",
"type": "Function",
"tags": [],
"label": "isNonEmptyString",
"description": [],
"signature": [
"(input: string, ctx: Zod.RefinementCtx) => void"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/non_empty_string.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.isNonEmptyString.$1",
"type": "string",
"tags": [],
"label": "input",
"description": [],
"signature": [
"string"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/non_empty_string.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.isNonEmptyString.$2",
"type": "Object",
"tags": [],
"label": "ctx",
"description": [],
"signature": [
"Zod.RefinementCtx"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/non_empty_string.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.isPassThroughAny",
"type": "Function",
"tags": [],
"label": "isPassThroughAny",
"description": [],
"signature": [
"(val: unknown) => val is KbnPassThroughAny"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/kbn_zod_types/pass_through_any.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.isPassThroughAny.$1",
"type": "Unknown",
"tags": [],
"label": "val",
"description": [],
"signature": [
"unknown"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/kbn_zod_types/pass_through_any.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.isValidDateMath",
"type": "Function",
"tags": [],
"label": "isValidDateMath",
"description": [],
"signature": [
"(input: string, ctx: Zod.RefinementCtx) => void"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/is_valid_date_math.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.isValidDateMath.$1",
"type": "string",
"tags": [],
"label": "input",
"description": [],
"signature": [
"string"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/is_valid_date_math.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.isValidDateMath.$2",
"type": "Object",
"tags": [],
"label": "ctx",
"description": [],
"signature": [
"Zod.RefinementCtx"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/is_valid_date_math.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.requiredOptional",
"type": "Function",
"tags": [],
"label": "requiredOptional",
"description": [
"\nThis helper designed to be used with `z.transform` to make all optional fields required.\n"
],
"signature": [
"<T>(schema: T) => ",
{
"pluginId": "@kbn/zod-helpers",
"scope": "common",
"docId": "kibKbnZodHelpersPluginApi",
"section": "def-common.RequiredOptional",
"text": "RequiredOptional"
},
"<T>"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/required_optional.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.requiredOptional.$1",
"type": "Uncategorized",
"tags": [],
"label": "schema",
"description": [
"Zod schema"
],
"signature": [
"T"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/required_optional.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [
"The same schema but with all optional fields required."
],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.safeParseResult",
"type": "Function",
"tags": [],
"label": "safeParseResult",
"description": [
"\nSafely parse a payload against a schema, returning the output or undefined.\nThis method does not throw validation errors and is useful for validating\noptional objects when we don't care about errors.\n"
],
"signature": [
"(payload: unknown, schema: T) => T[\"_output\"] | undefined"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/safe_parse_result.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.safeParseResult.$1",
"type": "Unknown",
"tags": [],
"label": "payload",
"description": [
"Schema payload"
],
"signature": [
"unknown"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/safe_parse_result.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.safeParseResult.$2",
"type": "Uncategorized",
"tags": [],
"label": "schema",
"description": [
"Validation schema"
],
"signature": [
"T"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/safe_parse_result.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [
"Schema output or undefined"
],
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.stringifyZodError",
"type": "Function",
"tags": [],
"label": "stringifyZodError",
"description": [],
"signature": [
"(err: Zod.ZodError<any>) => string"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/stringify_zod_error.ts",
"deprecated": false,
"trackAdoption": false,
"children": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.stringifyZodError.$1",
"type": "Object",
"tags": [],
"label": "err",
"description": [],
"signature": [
"Zod.ZodError<any>"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/stringify_zod_error.ts",
"deprecated": false,
"trackAdoption": false,
"isRequired": true
}
],
"returnComment": [],
"initialIsOpen": false
}
],
"interfaces": [],
"enums": [],
"misc": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.RequiredOptional",
"type": "Type",
"tags": [
"note"
],
"label": "RequiredOptional",
"description": [
"\nMake any optional fields required, but add `| undefined` to their type.\n\nThis bit of logic is to force all fields to be accounted for in conversions\nfrom the internal rule schema to the response schema. Rather than use\npartial, which makes each field optional, we make each field required but\npossibly undefined. The result is that if a field is forgotten in the\nconversion from internal schema to response schema TS will report an error.\nIf we just used partial instead, then optional fields can be accidentally\nomitted from the conversion - and any actual values in those fields\ninternally will be stripped in the response.\n"
],
"signature": [
"{ [K in keyof T]-?: [T[K]]; } extends infer U ? U extends Record<keyof U, [unknown]> ? { [K in keyof U]: U[K][0]; } : never : never"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/required_optional.ts",
"deprecated": false,
"trackAdoption": false,
"initialIsOpen": false
}
],
"objects": [
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.BooleanFromString",
"type": "Object",
"tags": [],
"label": "BooleanFromString",
"description": [],
"signature": [
"KbnZodBooleanFromString"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/kbn_zod_types/boolean_from_string.ts",
"deprecated": false,
"trackAdoption": false,
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.NonEmptyString",
"type": "Object",
"tags": [],
"label": "NonEmptyString",
"description": [],
"signature": [
"Zod.ZodEffects<Zod.ZodString, string, string>"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/non_empty_string.ts",
"deprecated": false,
"trackAdoption": false,
"initialIsOpen": false
},
{
"parentPluginId": "@kbn/zod-helpers",
"id": "def-common.PassThroughAny",
"type": "Object",
"tags": [],
"label": "PassThroughAny",
"description": [],
"signature": [
"KbnPassThroughAny"
],
"path": "src/platform/packages/shared/kbn-zod-helpers/src/kbn_zod_types/pass_through_any.ts",
"deprecated": false,
"trackAdoption": false,
"initialIsOpen": false
}
]
}
}