From c38da4d8b9c359b91db76a57545aa4768552f997 Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Thu, 22 Jan 2026 11:48:25 +0000 Subject: [PATCH 1/7] create schema package --- package.json | 1 + tsconfig.base.json | 2 + .../kbn-alerting-rule-schemas/README.md | 3 + .../kbn-alerting-rule-schemas}/index.ts | 3 +- .../kbn-alerting-rule-schemas/jest.config.js} | 11 ++- .../kbn-alerting-rule-schemas/kibana.jsonc | 7 ++ .../kbn-alerting-rule-schemas/package.json | 8 +++ .../kbn-alerting-rule-schemas/src/index.ts | 8 +++ .../src/rule_data_schema.ts | 67 +++++++++++++++++++ .../kbn-alerting-rule-schemas/tsconfig.json | 16 +++++ .../server/lib/rules_client/index.ts | 2 +- .../server/lib/rules_client/rules_client.ts | 21 +++--- .../schemas/create_rule_data_schema.ts | 26 ------- .../schemas/update_rule_data_schema.ts | 28 -------- .../server/lib/rules_client/types.ts | 7 +- .../server/routes/create_rule_route.ts | 3 +- .../server/routes/update_rule_route.ts | 3 +- .../plugins/shared/alerting_v2/tsconfig.json | 2 + 18 files changed, 138 insertions(+), 80 deletions(-) create mode 100644 x-pack/platform/packages/shared/kbn-alerting-rule-schemas/README.md rename x-pack/platform/{plugins/shared/alerting_v2/server/lib/rules_client/schemas => packages/shared/kbn-alerting-rule-schemas}/index.ts (65%) rename x-pack/platform/{plugins/shared/alerting_v2/server/lib/rules_client/validators.ts => packages/shared/kbn-alerting-rule-schemas/jest.config.js} (51%) create mode 100644 x-pack/platform/packages/shared/kbn-alerting-rule-schemas/kibana.jsonc create mode 100644 x-pack/platform/packages/shared/kbn-alerting-rule-schemas/package.json create mode 100644 x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/index.ts create mode 100644 x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/rule_data_schema.ts create mode 100644 x-pack/platform/packages/shared/kbn-alerting-rule-schemas/tsconfig.json delete mode 100644 x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/schemas/create_rule_data_schema.ts delete mode 100644 x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/schemas/update_rule_data_schema.ts diff --git a/package.json b/package.json index 4063c7bf2d2b5..8d10882c783e5 100644 --- a/package.json +++ b/package.json @@ -200,6 +200,7 @@ "@kbn/alerting-example-plugin": "link:x-pack/examples/alerting_example", "@kbn/alerting-fixture-plugin": "link:x-pack/platform/test/functional_with_es_ssl/plugins/alerts", "@kbn/alerting-plugin": "link:x-pack/platform/plugins/shared/alerting", + "@kbn/alerting-rule-schemas": "link:x-pack/platform/packages/shared/kbn-alerting-rule-schemas", "@kbn/alerting-rule-utils": "link:x-pack/platform/packages/shared/alerting-rule-utils", "@kbn/alerting-state-types": "link:x-pack/platform/packages/private/kbn-alerting-state-types", "@kbn/alerting-types": "link:src/platform/packages/shared/kbn-alerting-types", diff --git a/tsconfig.base.json b/tsconfig.base.json index b44143df9fcb5..4f70053cf671e 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -78,6 +78,8 @@ "@kbn/alerting-fixture-plugin/*": ["x-pack/platform/test/functional_with_es_ssl/plugins/alerts/*"], "@kbn/alerting-plugin": ["x-pack/platform/plugins/shared/alerting"], "@kbn/alerting-plugin/*": ["x-pack/platform/plugins/shared/alerting/*"], + "@kbn/alerting-rule-schemas": ["x-pack/platform/packages/shared/kbn-alerting-rule-schemas"], + "@kbn/alerting-rule-schemas/*": ["x-pack/platform/packages/shared/kbn-alerting-rule-schemas/*"], "@kbn/alerting-rule-utils": ["x-pack/platform/packages/shared/alerting-rule-utils"], "@kbn/alerting-rule-utils/*": ["x-pack/platform/packages/shared/alerting-rule-utils/*"], "@kbn/alerting-state-types": ["x-pack/platform/packages/private/kbn-alerting-state-types"], diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/README.md b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/README.md new file mode 100644 index 0000000000000..978f01de41272 --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/README.md @@ -0,0 +1,3 @@ +# @kbn/alerting-rule-schemas + +Zod schemas and shared types for alerting rule data requests. diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/schemas/index.ts b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/index.ts similarity index 65% rename from x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/schemas/index.ts rename to x-pack/platform/packages/shared/kbn-alerting-rule-schemas/index.ts index 61ec1effe0673..3b2a320ae181f 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/schemas/index.ts +++ b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/index.ts @@ -5,5 +5,4 @@ * 2.0. */ -export { createRuleDataSchema } from './create_rule_data_schema'; -export { updateRuleDataSchema } from './update_rule_data_schema'; +export * from './src'; diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/validators.ts b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/jest.config.js similarity index 51% rename from x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/validators.ts rename to x-pack/platform/packages/shared/kbn-alerting-rule-schemas/jest.config.js index 0225bcd2f0c52..af4abfd9ddd64 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/validators.ts +++ b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/jest.config.js @@ -5,11 +5,8 @@ * 2.0. */ -import { Parser } from '@kbn/esql-language'; - -export const validateEsqlQuery = (query: string): string | void => { - const errors = Parser.parseErrors(query); - if (errors.length > 0) { - return `Invalid ES|QL query: ${errors[0].message}`; - } +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../../..', + roots: ['/x-pack/platform/packages/shared/kbn-alerting-rule-schemas'], }; diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/kibana.jsonc b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/kibana.jsonc new file mode 100644 index 0000000000000..21c3632f41a00 --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/kibana.jsonc @@ -0,0 +1,7 @@ +{ + "type": "shared-common", + "id": "@kbn/alerting-rule-schemas", + "owner": "@elastic/response-ops", + "group": "platform", + "visibility": "shared" +} diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/package.json b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/package.json new file mode 100644 index 0000000000000..c1255b94e1544 --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/alerting-rule-schemas", + "description": "Alerting rule request Zod schemas and shared types.", + "private": true, + "version": "1.0.0", + "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0", + "sideEffects": false +} \ No newline at end of file diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/index.ts b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/index.ts new file mode 100644 index 0000000000000..089a0c2f484b0 --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export * from './rule_data_schema'; diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/rule_data_schema.ts b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/rule_data_schema.ts new file mode 100644 index 0000000000000..970bba4105163 --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/rule_data_schema.ts @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Parser } from '@kbn/esql-language'; +import { z } from '@kbn/zod'; + +const DURATION_RE = /^(\d+)(ms|s|m|h|d|w)$/; + +const durationSchema = z.string().superRefine((value, ctx) => { + if (!DURATION_RE.test(value)) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: `Invalid duration "${value}". Expected format like "5m", "1h", "30s", "250ms"`, + }); + } +}); + +const withEsqlValidation = (schema: z.ZodString) => + schema.superRefine((query, ctx) => { + const errors = Parser.parseErrors(query); + if (errors.length > 0) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: `Invalid ES|QL query: ${errors[0].message}`, + }); + } + }); + +const scheduleSchema = z + .object({ + custom: durationSchema, + }) + .strict(); + +export const createRuleDataSchema = z + .object({ + name: z.string().min(1).max(64), + tags: z.array(z.string().max(64)).max(100).default([]), + schedule: scheduleSchema, + enabled: z.boolean().default(true), + query: withEsqlValidation(z.string().min(1).max(10000)), + timeField: z.string().min(1).max(128).default('@timestamp'), + lookbackWindow: durationSchema, + groupingKey: z.array(z.string()).max(16).default([]), + }) + .strip(); + +export type CreateRuleData = z.infer; + +export const updateRuleDataSchema = z + .object({ + name: z.string().min(1).optional(), + tags: z.array(z.string()).optional(), + schedule: scheduleSchema.optional(), + enabled: z.boolean().optional(), + query: withEsqlValidation(z.string().min(1)).optional(), + timeField: z.string().min(1).optional(), + lookbackWindow: durationSchema.optional(), + groupingKey: z.array(z.string()).optional(), + }) + .strip(); + +export type UpdateRuleData = z.infer; diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/tsconfig.json b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/tsconfig.json new file mode 100644 index 0000000000000..e2f2cdf7d2820 --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "@kbn/tsconfig-base/tsconfig.json", + "compilerOptions": { + "outDir": "target/types", + }, + "include": [ + "**/*.ts", + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + "@kbn/esql-language", + "@kbn/zod" + ] +} diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/index.ts b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/index.ts index 7eda9e2dbbb77..ee396d9c332b3 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/index.ts +++ b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/index.ts @@ -5,8 +5,8 @@ * 2.0. */ +export { createRuleDataSchema, updateRuleDataSchema } from '@kbn/alerting-rule-schemas'; export { RulesClient } from './rules_client'; -export { createRuleDataSchema, updateRuleDataSchema } from './schemas'; export type { CreateRuleData, CreateRuleParams, diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/rules_client.ts b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/rules_client.ts index 71bbd5ab1cd8d..b69939703058c 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/rules_client.ts +++ b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/rules_client.ts @@ -15,12 +15,13 @@ import type { SecurityPluginStart } from '@kbn/security-plugin/server'; import { inject, injectable } from 'inversify'; import { PluginStart } from '@kbn/core-di'; import { CoreStart, Request } from '@kbn/core-di-server'; +import { stringifyZodError } from '@kbn/zod-helpers'; +import { createRuleDataSchema, updateRuleDataSchema } from '@kbn/alerting-rule-schemas'; import { type RuleSavedObjectAttributes } from '../../saved_objects'; import { ensureRuleExecutorTaskScheduled, getRuleExecutorTaskId } from '../rule_executor/schedule'; import type { RulesSavedObjectServiceContract } from '../services/rules_saved_object_service/rules_saved_object_service'; import { RulesSavedObjectService } from '../services/rules_saved_object_service/rules_saved_object_service'; -import { createRuleDataSchema, updateRuleDataSchema } from './schemas'; import type { CreateRuleParams, FindRulesParams, @@ -54,10 +55,11 @@ export class RulesClient { public async createRule(params: CreateRuleParams): Promise { const { spaceId } = this.getSpaceContext(); - try { - createRuleDataSchema.validate(params.data); - } catch (error) { - throw Boom.badRequest(`Error validating create rule data - ${(error as Error).message}`); + const createValidationResult = createRuleDataSchema.safeParse(params.data); + if (!createValidationResult.success) { + throw Boom.badRequest( + `Error validating create rule data - ${stringifyZodError(createValidationResult.error)}` + ); } const username = await this.getUserName(); @@ -122,10 +124,11 @@ export class RulesClient { }): Promise { const { spaceId } = this.getSpaceContext(); - try { - updateRuleDataSchema.validate(data); - } catch (error) { - throw Boom.badRequest(`Error validating update rule data - ${(error as Error).message}`); + const updateValidationResult = updateRuleDataSchema.safeParse(data); + if (!updateValidationResult.success) { + throw Boom.badRequest( + `Error validating update rule data - ${stringifyZodError(updateValidationResult.error)}` + ); } const username = await this.getUserName(); diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/schemas/create_rule_data_schema.ts b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/schemas/create_rule_data_schema.ts deleted file mode 100644 index 6e7e5673855f5..0000000000000 --- a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/schemas/create_rule_data_schema.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { schema } from '@kbn/config-schema'; -import { validateDuration } from '../../duration'; -import { validateEsqlQuery } from '../validators'; - -export const createRuleDataSchema = schema.object( - { - name: schema.string({ minLength: 1, maxLength: 64 }), - tags: schema.arrayOf(schema.string({ maxLength: 64 }), { defaultValue: [], maxSize: 100 }), - schedule: schema.object({ - custom: schema.string({ validate: validateDuration }), - }), - enabled: schema.boolean({ defaultValue: true }), - query: schema.string({ minLength: 1, maxLength: 10000, validate: validateEsqlQuery }), - timeField: schema.string({ minLength: 1, maxLength: 128, defaultValue: '@timestamp' }), - lookbackWindow: schema.string({ validate: validateDuration }), - groupingKey: schema.arrayOf(schema.string(), { defaultValue: [], maxSize: 16 }), - }, - { unknowns: 'ignore' } -); diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/schemas/update_rule_data_schema.ts b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/schemas/update_rule_data_schema.ts deleted file mode 100644 index d842b3015afcb..0000000000000 --- a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/schemas/update_rule_data_schema.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { schema } from '@kbn/config-schema'; -import { validateDuration } from '../../duration'; -import { validateEsqlQuery } from '../validators'; - -export const updateRuleDataSchema = schema.object( - { - name: schema.maybe(schema.string({ minLength: 1 })), - tags: schema.maybe(schema.arrayOf(schema.string(), { defaultValue: [] })), - schedule: schema.maybe( - schema.object({ - custom: schema.string({ validate: validateDuration }), - }) - ), - enabled: schema.maybe(schema.boolean()), - query: schema.maybe(schema.string({ minLength: 1, validate: validateEsqlQuery })), - timeField: schema.maybe(schema.string({ minLength: 1 })), - lookbackWindow: schema.maybe(schema.string({ validate: validateDuration })), - groupingKey: schema.maybe(schema.arrayOf(schema.string(), { defaultValue: [] })), - }, - { unknowns: 'ignore' } -); diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/types.ts b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/types.ts index 91b155b1ecb69..2e9f53e298bed 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/types.ts +++ b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/types.ts @@ -5,10 +5,7 @@ * 2.0. */ -import type { TypeOf } from '@kbn/config-schema'; -import type { createRuleDataSchema, updateRuleDataSchema } from './schemas'; - -export type CreateRuleData = TypeOf; +import type { CreateRuleData, UpdateRuleData } from '@kbn/alerting-rule-schemas'; export interface CreateRuleParams { data: CreateRuleData; @@ -23,7 +20,7 @@ export interface RuleResponse extends CreateRuleData { updatedAt: string; } -export type UpdateRuleData = TypeOf; +export type { CreateRuleData, UpdateRuleData }; export interface FindRulesParams { page?: number; diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/routes/create_rule_route.ts b/x-pack/platform/plugins/shared/alerting_v2/server/routes/create_rule_route.ts index 93bdc71b2f5ae..2f7cc25fa9cde 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/server/routes/create_rule_route.ts +++ b/x-pack/platform/plugins/shared/alerting_v2/server/routes/create_rule_route.ts @@ -15,6 +15,7 @@ import type { RouteHandler } from '@kbn/core-di-server'; import { Request, Response } from '@kbn/core-di-server'; import type { TypeOf } from '@kbn/config-schema'; import type { RouteSecurity } from '@kbn/core-http-server'; +import { buildRouteValidationWithZod } from '@kbn/zod-helpers'; import { createRuleDataSchema, type CreateRuleData } from '../lib/rules_client'; import { RulesClient } from '../lib/rules_client'; import { ALERTING_V2_API_PRIVILEGES } from '../lib/security/privileges'; @@ -36,7 +37,7 @@ export class CreateRuleRoute implements RouteHandler { static options = { access: 'internal' } as const; static validate = { request: { - body: createRuleDataSchema, + body: buildRouteValidationWithZod(createRuleDataSchema), params: createRuleParamsSchema, }, } as const; diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/routes/update_rule_route.ts b/x-pack/platform/plugins/shared/alerting_v2/server/routes/update_rule_route.ts index 4d470c7e28c0a..79d69eec300d2 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/server/routes/update_rule_route.ts +++ b/x-pack/platform/plugins/shared/alerting_v2/server/routes/update_rule_route.ts @@ -12,6 +12,7 @@ import { inject, injectable } from 'inversify'; import { Request, Response } from '@kbn/core-di-server'; import type { TypeOf } from '@kbn/config-schema'; import type { RouteSecurity } from '@kbn/core-http-server'; +import { buildRouteValidationWithZod } from '@kbn/zod-helpers'; import { updateRuleDataSchema, type UpdateRuleData } from '../lib/rules_client'; import { RulesClient } from '../lib/rules_client/rules_client'; @@ -34,7 +35,7 @@ export class UpdateRuleRoute { static options = { access: 'internal' } as const; static validate = { request: { - body: updateRuleDataSchema, + body: buildRouteValidationWithZod(updateRuleDataSchema), params: updateRuleParamsSchema, }, } as const; diff --git a/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json b/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json index 2c7c4cca891ef..8d67efe3a4b2c 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json +++ b/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json @@ -35,7 +35,9 @@ "@kbn/logging-mocks", "@kbn/core-elasticsearch-client-server-mocks", "@kbn/es-errors", + "@kbn/alerting-rule-schemas", "@kbn/zod", + "@kbn/zod-helpers", "@kbn/core-di-internal" ], "exclude": [ From b4d6602ccfe3abaad528f91554d99dd0d4a8f8ac Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 22 Jan 2026 12:02:50 +0000 Subject: [PATCH 2/7] Changes from yarn openapi:bundle --- yarn.lock | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yarn.lock b/yarn.lock index 9cb184e04bcfe..908fb1bf45e69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4674,6 +4674,10 @@ version "0.0.0" uid "" +"@kbn/alerting-rule-schemas@link:x-pack/platform/packages/shared/kbn-alerting-rule-schemas": + version "0.0.0" + uid "" + "@kbn/alerting-rule-utils@link:x-pack/platform/packages/shared/alerting-rule-utils": version "0.0.0" uid "" From c0261d3a19d75522e98ddab0b512c9ea46077dcb Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Thu, 22 Jan 2026 12:08:25 +0000 Subject: [PATCH 3/7] rename package --- package.json | 2 +- tsconfig.base.json | 4 +- .../kbn-alerting-rule-schemas/README.md | 3 -- .../shared/kbn-alerting-v2-schemas/README.md | 3 ++ .../index.ts | 0 .../jest.config.js | 2 +- .../kibana.jsonc | 2 +- .../package.json | 4 +- .../src/index.ts | 0 .../src/rule_data_schema.ts | 0 .../tsconfig.json | 0 .../server/lib/rules_client/index.ts | 2 +- .../server/lib/rules_client/rules_client.ts | 2 +- .../server/lib/rules_client/types.ts | 2 +- .../plugins/shared/alerting_v2/tsconfig.json | 2 +- yarn.lock | 49 ++++--------------- 16 files changed, 23 insertions(+), 54 deletions(-) delete mode 100644 x-pack/platform/packages/shared/kbn-alerting-rule-schemas/README.md create mode 100644 x-pack/platform/packages/shared/kbn-alerting-v2-schemas/README.md rename x-pack/platform/packages/shared/{kbn-alerting-rule-schemas => kbn-alerting-v2-schemas}/index.ts (100%) rename x-pack/platform/packages/shared/{kbn-alerting-rule-schemas => kbn-alerting-v2-schemas}/jest.config.js (95%) rename x-pack/platform/packages/shared/{kbn-alerting-rule-schemas => kbn-alerting-v2-schemas}/kibana.jsonc (75%) rename x-pack/platform/packages/shared/{kbn-alerting-rule-schemas => kbn-alerting-v2-schemas}/package.json (54%) rename x-pack/platform/packages/shared/{kbn-alerting-rule-schemas => kbn-alerting-v2-schemas}/src/index.ts (100%) rename x-pack/platform/packages/shared/{kbn-alerting-rule-schemas => kbn-alerting-v2-schemas}/src/rule_data_schema.ts (100%) rename x-pack/platform/packages/shared/{kbn-alerting-rule-schemas => kbn-alerting-v2-schemas}/tsconfig.json (100%) diff --git a/package.json b/package.json index 8d10882c783e5..9a5c4343e776d 100644 --- a/package.json +++ b/package.json @@ -200,11 +200,11 @@ "@kbn/alerting-example-plugin": "link:x-pack/examples/alerting_example", "@kbn/alerting-fixture-plugin": "link:x-pack/platform/test/functional_with_es_ssl/plugins/alerts", "@kbn/alerting-plugin": "link:x-pack/platform/plugins/shared/alerting", - "@kbn/alerting-rule-schemas": "link:x-pack/platform/packages/shared/kbn-alerting-rule-schemas", "@kbn/alerting-rule-utils": "link:x-pack/platform/packages/shared/alerting-rule-utils", "@kbn/alerting-state-types": "link:x-pack/platform/packages/private/kbn-alerting-state-types", "@kbn/alerting-types": "link:src/platform/packages/shared/kbn-alerting-types", "@kbn/alerting-v2-plugin": "link:x-pack/platform/plugins/shared/alerting_v2", + "@kbn/alerting-v2-schemas": "link:x-pack/platform/packages/shared/kbn-alerting-v2-schemas", "@kbn/alerts-as-data-utils": "link:src/platform/packages/shared/kbn-alerts-as-data-utils", "@kbn/alerts-grouping": "link:x-pack/solutions/observability/packages/kbn-alerts-grouping", "@kbn/alerts-restricted-fixtures-plugin": "link:x-pack/platform/test/alerting_api_integration/common/plugins/alerts_restricted", diff --git a/tsconfig.base.json b/tsconfig.base.json index 4f70053cf671e..de684baca2f46 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -78,8 +78,6 @@ "@kbn/alerting-fixture-plugin/*": ["x-pack/platform/test/functional_with_es_ssl/plugins/alerts/*"], "@kbn/alerting-plugin": ["x-pack/platform/plugins/shared/alerting"], "@kbn/alerting-plugin/*": ["x-pack/platform/plugins/shared/alerting/*"], - "@kbn/alerting-rule-schemas": ["x-pack/platform/packages/shared/kbn-alerting-rule-schemas"], - "@kbn/alerting-rule-schemas/*": ["x-pack/platform/packages/shared/kbn-alerting-rule-schemas/*"], "@kbn/alerting-rule-utils": ["x-pack/platform/packages/shared/alerting-rule-utils"], "@kbn/alerting-rule-utils/*": ["x-pack/platform/packages/shared/alerting-rule-utils/*"], "@kbn/alerting-state-types": ["x-pack/platform/packages/private/kbn-alerting-state-types"], @@ -88,6 +86,8 @@ "@kbn/alerting-types/*": ["src/platform/packages/shared/kbn-alerting-types/*"], "@kbn/alerting-v2-plugin": ["x-pack/platform/plugins/shared/alerting_v2"], "@kbn/alerting-v2-plugin/*": ["x-pack/platform/plugins/shared/alerting_v2/*"], + "@kbn/alerting-v2-schemas": ["x-pack/platform/packages/shared/kbn-alerting-v2-schemas"], + "@kbn/alerting-v2-schemas/*": ["x-pack/platform/packages/shared/kbn-alerting-v2-schemas/*"], "@kbn/alerts-as-data-utils": ["src/platform/packages/shared/kbn-alerts-as-data-utils"], "@kbn/alerts-as-data-utils/*": ["src/platform/packages/shared/kbn-alerts-as-data-utils/*"], "@kbn/alerts-grouping": ["x-pack/solutions/observability/packages/kbn-alerts-grouping"], diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/README.md b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/README.md deleted file mode 100644 index 978f01de41272..0000000000000 --- a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @kbn/alerting-rule-schemas - -Zod schemas and shared types for alerting rule data requests. diff --git a/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/README.md b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/README.md new file mode 100644 index 0000000000000..742e59dc84b54 --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/README.md @@ -0,0 +1,3 @@ +# @kbn/alerting-v2-schemas + +Zod schemas and shared types for alerting v2 requests. diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/index.ts b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/index.ts similarity index 100% rename from x-pack/platform/packages/shared/kbn-alerting-rule-schemas/index.ts rename to x-pack/platform/packages/shared/kbn-alerting-v2-schemas/index.ts diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/jest.config.js b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/jest.config.js similarity index 95% rename from x-pack/platform/packages/shared/kbn-alerting-rule-schemas/jest.config.js rename to x-pack/platform/packages/shared/kbn-alerting-v2-schemas/jest.config.js index af4abfd9ddd64..2f798c6c421e7 100644 --- a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/jest.config.js +++ b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/jest.config.js @@ -8,5 +8,5 @@ module.exports = { preset: '@kbn/test/jest_node', rootDir: '../../../../..', - roots: ['/x-pack/platform/packages/shared/kbn-alerting-rule-schemas'], + roots: ['/x-pack/platform/packages/shared/kbn-alerting-v2-schemas'], }; diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/kibana.jsonc b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/kibana.jsonc similarity index 75% rename from x-pack/platform/packages/shared/kbn-alerting-rule-schemas/kibana.jsonc rename to x-pack/platform/packages/shared/kbn-alerting-v2-schemas/kibana.jsonc index 21c3632f41a00..e9789663fd64b 100644 --- a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/kibana.jsonc +++ b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/kibana.jsonc @@ -1,6 +1,6 @@ { "type": "shared-common", - "id": "@kbn/alerting-rule-schemas", + "id": "@kbn/alerting-v2-schemas", "owner": "@elastic/response-ops", "group": "platform", "visibility": "shared" diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/package.json b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/package.json similarity index 54% rename from x-pack/platform/packages/shared/kbn-alerting-rule-schemas/package.json rename to x-pack/platform/packages/shared/kbn-alerting-v2-schemas/package.json index c1255b94e1544..d9588950f4dfc 100644 --- a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/package.json +++ b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/package.json @@ -1,6 +1,6 @@ { - "name": "@kbn/alerting-rule-schemas", - "description": "Alerting rule request Zod schemas and shared types.", + "name": "@kbn/alerting-v2-schemas", + "description": "Alerting v2 request Zod schemas and shared types.", "private": true, "version": "1.0.0", "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0", diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/index.ts b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/src/index.ts similarity index 100% rename from x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/index.ts rename to x-pack/platform/packages/shared/kbn-alerting-v2-schemas/src/index.ts diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/rule_data_schema.ts b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/src/rule_data_schema.ts similarity index 100% rename from x-pack/platform/packages/shared/kbn-alerting-rule-schemas/src/rule_data_schema.ts rename to x-pack/platform/packages/shared/kbn-alerting-v2-schemas/src/rule_data_schema.ts diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/tsconfig.json b/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/tsconfig.json similarity index 100% rename from x-pack/platform/packages/shared/kbn-alerting-rule-schemas/tsconfig.json rename to x-pack/platform/packages/shared/kbn-alerting-v2-schemas/tsconfig.json diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/index.ts b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/index.ts index ee396d9c332b3..0ce64e943ec33 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/index.ts +++ b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -export { createRuleDataSchema, updateRuleDataSchema } from '@kbn/alerting-rule-schemas'; +export { createRuleDataSchema, updateRuleDataSchema } from '@kbn/alerting-v2-schemas'; export { RulesClient } from './rules_client'; export type { CreateRuleData, diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/rules_client.ts b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/rules_client.ts index b69939703058c..b4aedca9c58ab 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/rules_client.ts +++ b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/rules_client.ts @@ -16,7 +16,7 @@ import { inject, injectable } from 'inversify'; import { PluginStart } from '@kbn/core-di'; import { CoreStart, Request } from '@kbn/core-di-server'; import { stringifyZodError } from '@kbn/zod-helpers'; -import { createRuleDataSchema, updateRuleDataSchema } from '@kbn/alerting-rule-schemas'; +import { createRuleDataSchema, updateRuleDataSchema } from '@kbn/alerting-v2-schemas'; import { type RuleSavedObjectAttributes } from '../../saved_objects'; import { ensureRuleExecutorTaskScheduled, getRuleExecutorTaskId } from '../rule_executor/schedule'; diff --git a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/types.ts b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/types.ts index 2e9f53e298bed..a363ddf3474a8 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/types.ts +++ b/x-pack/platform/plugins/shared/alerting_v2/server/lib/rules_client/types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { CreateRuleData, UpdateRuleData } from '@kbn/alerting-rule-schemas'; +import type { CreateRuleData, UpdateRuleData } from '@kbn/alerting-v2-schemas'; export interface CreateRuleParams { data: CreateRuleData; diff --git a/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json b/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json index 8d67efe3a4b2c..174c7d3930d9b 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json +++ b/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json @@ -35,7 +35,7 @@ "@kbn/logging-mocks", "@kbn/core-elasticsearch-client-server-mocks", "@kbn/es-errors", - "@kbn/alerting-rule-schemas", + "@kbn/alerting-v2-schemas", "@kbn/zod", "@kbn/zod-helpers", "@kbn/core-di-internal" diff --git a/yarn.lock b/yarn.lock index 9cb184e04bcfe..b050460927a75 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2688,7 +2688,7 @@ resolved "https://registry.yarnpkg.com/@elastic/filesaver/-/filesaver-1.1.2.tgz#1998ffb3cd89c9da4ec12a7793bfcae10e30c77a" integrity sha512-YZbSufYFBhAj+S2cJgiKALoxIJevqXN2MSr6Yqr42rJdaPuM31cj6pUDwflkql1oDjupqD9la+MfxPFjXI1JFQ== -"@elastic/kibana-d3-color@npm:@elastic/kibana-d3-color@2.0.1": +"@elastic/kibana-d3-color@npm:@elastic/kibana-d3-color@2.0.1", "d3-color@1 - 2", "d3-color@npm:@elastic/kibana-d3-color@2.0.1": version "2.0.1" resolved "https://registry.yarnpkg.com/@elastic/kibana-d3-color/-/kibana-d3-color-2.0.1.tgz#f83b9c2fea09273a918659de04d5e8098c82f65c" integrity sha512-YZ8hV2bWNyYi833Yj3UWczmTxdHzmo/Xc2IVkNXr/ZqtkrTDlTLysCyJm7SfAt9iBy6EVRGWTn8cPz8QOY6Ixw== @@ -4674,6 +4674,10 @@ version "0.0.0" uid "" +"@kbn/alerting-v2-schemas@link:x-pack/platform/packages/shared/kbn-alerting-v2-schemas": + version "0.0.0" + uid "" + "@kbn/alerting-rule-utils@link:x-pack/platform/packages/shared/alerting-rule-utils": version "0.0.0" uid "" @@ -18754,11 +18758,6 @@ d3-collection@^1.0.7: resolved "https://registry.yarnpkg.com/d3-collection/-/d3-collection-1.0.7.tgz#349bd2aa9977db071091c13144d5e4f16b5b310e" integrity sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A== -"d3-color@1 - 2", "d3-color@npm:@elastic/kibana-d3-color@2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@elastic/kibana-d3-color/-/kibana-d3-color-2.0.1.tgz#f83b9c2fea09273a918659de04d5e8098c82f65c" - integrity sha512-YZ8hV2bWNyYi833Yj3UWczmTxdHzmo/Xc2IVkNXr/ZqtkrTDlTLysCyJm7SfAt9iBy6EVRGWTn8cPz8QOY6Ixw== - "d3-color@1 - 3", d3-color@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-3.1.0.tgz#395b2833dfac71507f12ac2f7af23bf819de24e2" @@ -32072,7 +32071,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0": +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -32090,15 +32089,6 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -32191,14 +32181,7 @@ stringify-object@^3.2.1: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -35015,7 +34998,7 @@ workerpool@^6.5.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544" integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -35041,15 +35024,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" @@ -35180,7 +35154,7 @@ xpath@^0.0.33: resolved "https://registry.yarnpkg.com/xpath/-/xpath-0.0.33.tgz#5136b6094227c5df92002e7c3a13516a5074eb07" integrity sha512-NNXnzrkDrAzalLhIUc01jO2mOzXGXh1JwPgkihcLLzw98c0WgYDmmjSh1Kl3wzaxSVWMuA+fe0WTWOBDWCBmNA== -"xstate5@npm:xstate@^5.19.2": +"xstate5@npm:xstate@^5.19.2", xstate@5.19.2: version "5.19.2" resolved "https://registry.yarnpkg.com/xstate/-/xstate-5.19.2.tgz#db3f1ee614bbb6a49ad3f0c96ddbf98562d456ba" integrity sha512-B8fL2aP0ogn5aviAXFzI5oZseAMqN00fg/TeDa3ZtatyDcViYLIfuQl4y8qmHCiKZgGEzmnTyNtNQL9oeJE2gw== @@ -35190,11 +35164,6 @@ xstate@4.38.3: resolved "https://registry.yarnpkg.com/xstate/-/xstate-4.38.3.tgz#4e15e7ad3aa0ca1eea2010548a5379966d8f1075" integrity sha512-SH7nAaaPQx57dx6qvfcIgqKRXIh4L0A1iYEqim4s1u7c9VoCgzZc+63FY90AKU4ZzOC2cfJzTnpO4zK7fCUzzw== -xstate@5.19.2: - version "5.19.2" - resolved "https://registry.yarnpkg.com/xstate/-/xstate-5.19.2.tgz#db3f1ee614bbb6a49ad3f0c96ddbf98562d456ba" - integrity sha512-B8fL2aP0ogn5aviAXFzI5oZseAMqN00fg/TeDa3ZtatyDcViYLIfuQl4y8qmHCiKZgGEzmnTyNtNQL9oeJE2gw== - "xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" From 99a8d1d35eb63d4c4e642c055563de1f74501dda Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 22 Jan 2026 12:14:18 +0000 Subject: [PATCH 4/7] Changes from node scripts/lint_ts_projects --fix --- x-pack/platform/plugins/shared/alerting_v2/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json b/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json index 8d67efe3a4b2c..5869454098a81 100644 --- a/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json +++ b/x-pack/platform/plugins/shared/alerting_v2/tsconfig.json @@ -28,7 +28,6 @@ "@kbn/core-di-server", "@kbn/esql-utils", "@kbn/response-ops-retry-service", - "@kbn/esql-language", "@kbn/core-http-server-mocks", "@kbn/core-security-common", "@kbn/core-elasticsearch-server-mocks", From 5ea4309a7874142c8c9b236d116f842cc4fb3d91 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 22 Jan 2026 12:14:27 +0000 Subject: [PATCH 5/7] Changes from node scripts/lint_packages --fix --- .../packages/shared/kbn-alerting-rule-schemas/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/package.json b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/package.json index c1255b94e1544..e224279a0491f 100644 --- a/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/package.json +++ b/x-pack/platform/packages/shared/kbn-alerting-rule-schemas/package.json @@ -3,6 +3,6 @@ "description": "Alerting rule request Zod schemas and shared types.", "private": true, "version": "1.0.0", - "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0", + "license": "Elastic License 2.0", "sideEffects": false } \ No newline at end of file From c67f6a387f726803d42fa82b3e8cd9a231be9f81 Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Thu, 22 Jan 2026 13:07:26 +0000 Subject: [PATCH 6/7] move package to response-ops --- package.json | 2 +- tsconfig.base.json | 4 ++-- .../{ => response-ops}/kbn-alerting-v2-schemas/README.md | 0 .../{ => response-ops}/kbn-alerting-v2-schemas/index.ts | 0 .../{ => response-ops}/kbn-alerting-v2-schemas/jest.config.js | 2 +- .../{ => response-ops}/kbn-alerting-v2-schemas/kibana.jsonc | 0 .../{ => response-ops}/kbn-alerting-v2-schemas/package.json | 0 .../{ => response-ops}/kbn-alerting-v2-schemas/src/index.ts | 0 .../kbn-alerting-v2-schemas/src/rule_data_schema.ts | 0 .../{ => response-ops}/kbn-alerting-v2-schemas/tsconfig.json | 0 yarn.lock | 2 +- 11 files changed, 5 insertions(+), 5 deletions(-) rename x-pack/platform/packages/shared/{ => response-ops}/kbn-alerting-v2-schemas/README.md (100%) rename x-pack/platform/packages/shared/{ => response-ops}/kbn-alerting-v2-schemas/index.ts (100%) rename x-pack/platform/packages/shared/{ => response-ops}/kbn-alerting-v2-schemas/jest.config.js (78%) rename x-pack/platform/packages/shared/{ => response-ops}/kbn-alerting-v2-schemas/kibana.jsonc (100%) rename x-pack/platform/packages/shared/{ => response-ops}/kbn-alerting-v2-schemas/package.json (100%) rename x-pack/platform/packages/shared/{ => response-ops}/kbn-alerting-v2-schemas/src/index.ts (100%) rename x-pack/platform/packages/shared/{ => response-ops}/kbn-alerting-v2-schemas/src/rule_data_schema.ts (100%) rename x-pack/platform/packages/shared/{ => response-ops}/kbn-alerting-v2-schemas/tsconfig.json (100%) diff --git a/package.json b/package.json index 9a5c4343e776d..54abb10eafd7b 100644 --- a/package.json +++ b/package.json @@ -204,7 +204,7 @@ "@kbn/alerting-state-types": "link:x-pack/platform/packages/private/kbn-alerting-state-types", "@kbn/alerting-types": "link:src/platform/packages/shared/kbn-alerting-types", "@kbn/alerting-v2-plugin": "link:x-pack/platform/plugins/shared/alerting_v2", - "@kbn/alerting-v2-schemas": "link:x-pack/platform/packages/shared/kbn-alerting-v2-schemas", + "@kbn/alerting-v2-schemas": "link:x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas", "@kbn/alerts-as-data-utils": "link:src/platform/packages/shared/kbn-alerts-as-data-utils", "@kbn/alerts-grouping": "link:x-pack/solutions/observability/packages/kbn-alerts-grouping", "@kbn/alerts-restricted-fixtures-plugin": "link:x-pack/platform/test/alerting_api_integration/common/plugins/alerts_restricted", diff --git a/tsconfig.base.json b/tsconfig.base.json index de684baca2f46..1f63851854cc8 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -86,8 +86,8 @@ "@kbn/alerting-types/*": ["src/platform/packages/shared/kbn-alerting-types/*"], "@kbn/alerting-v2-plugin": ["x-pack/platform/plugins/shared/alerting_v2"], "@kbn/alerting-v2-plugin/*": ["x-pack/platform/plugins/shared/alerting_v2/*"], - "@kbn/alerting-v2-schemas": ["x-pack/platform/packages/shared/kbn-alerting-v2-schemas"], - "@kbn/alerting-v2-schemas/*": ["x-pack/platform/packages/shared/kbn-alerting-v2-schemas/*"], + "@kbn/alerting-v2-schemas": ["x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas"], + "@kbn/alerting-v2-schemas/*": ["x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/*"], "@kbn/alerts-as-data-utils": ["src/platform/packages/shared/kbn-alerts-as-data-utils"], "@kbn/alerts-as-data-utils/*": ["src/platform/packages/shared/kbn-alerts-as-data-utils/*"], "@kbn/alerts-grouping": ["x-pack/solutions/observability/packages/kbn-alerts-grouping"], diff --git a/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/README.md b/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/README.md similarity index 100% rename from x-pack/platform/packages/shared/kbn-alerting-v2-schemas/README.md rename to x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/README.md diff --git a/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/index.ts b/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/index.ts similarity index 100% rename from x-pack/platform/packages/shared/kbn-alerting-v2-schemas/index.ts rename to x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/index.ts diff --git a/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/jest.config.js b/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/jest.config.js similarity index 78% rename from x-pack/platform/packages/shared/kbn-alerting-v2-schemas/jest.config.js rename to x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/jest.config.js index 2f798c6c421e7..50d930dfb94a3 100644 --- a/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/jest.config.js +++ b/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/jest.config.js @@ -8,5 +8,5 @@ module.exports = { preset: '@kbn/test/jest_node', rootDir: '../../../../..', - roots: ['/x-pack/platform/packages/shared/kbn-alerting-v2-schemas'], + roots: ['/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas'], }; diff --git a/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/kibana.jsonc b/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/kibana.jsonc similarity index 100% rename from x-pack/platform/packages/shared/kbn-alerting-v2-schemas/kibana.jsonc rename to x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/kibana.jsonc diff --git a/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/package.json b/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/package.json similarity index 100% rename from x-pack/platform/packages/shared/kbn-alerting-v2-schemas/package.json rename to x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/package.json diff --git a/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/src/index.ts b/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/src/index.ts similarity index 100% rename from x-pack/platform/packages/shared/kbn-alerting-v2-schemas/src/index.ts rename to x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/src/index.ts diff --git a/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/src/rule_data_schema.ts b/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/src/rule_data_schema.ts similarity index 100% rename from x-pack/platform/packages/shared/kbn-alerting-v2-schemas/src/rule_data_schema.ts rename to x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/src/rule_data_schema.ts diff --git a/x-pack/platform/packages/shared/kbn-alerting-v2-schemas/tsconfig.json b/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/tsconfig.json similarity index 100% rename from x-pack/platform/packages/shared/kbn-alerting-v2-schemas/tsconfig.json rename to x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/tsconfig.json diff --git a/yarn.lock b/yarn.lock index 35f6debbc35f4..a5811e2cf3fb0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4674,7 +4674,7 @@ version "0.0.0" uid "" -"@kbn/alerting-rule-schemas@link:x-pack/platform/packages/shared/kbn-alerting-rule-schemas": +"@kbn/alerting-v2-schemas@link:x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas": version "0.0.0" uid "" From e019c97e80e14d835edef9f2b9f77b315a5c2d48 Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Thu, 22 Jan 2026 13:16:52 +0000 Subject: [PATCH 7/7] remove kbn- prefix --- package.json | 2 +- tsconfig.base.json | 4 ++-- .../README.md | 0 .../{kbn-alerting-v2-schemas => alerting-v2-schemas}/index.ts | 0 .../jest.config.js | 2 +- .../kibana.jsonc | 0 .../package.json | 0 .../src/index.ts | 0 .../src/rule_data_schema.ts | 0 .../tsconfig.json | 0 yarn.lock | 2 +- 11 files changed, 5 insertions(+), 5 deletions(-) rename x-pack/platform/packages/shared/response-ops/{kbn-alerting-v2-schemas => alerting-v2-schemas}/README.md (100%) rename x-pack/platform/packages/shared/response-ops/{kbn-alerting-v2-schemas => alerting-v2-schemas}/index.ts (100%) rename x-pack/platform/packages/shared/response-ops/{kbn-alerting-v2-schemas => alerting-v2-schemas}/jest.config.js (93%) rename x-pack/platform/packages/shared/response-ops/{kbn-alerting-v2-schemas => alerting-v2-schemas}/kibana.jsonc (100%) rename x-pack/platform/packages/shared/response-ops/{kbn-alerting-v2-schemas => alerting-v2-schemas}/package.json (100%) rename x-pack/platform/packages/shared/response-ops/{kbn-alerting-v2-schemas => alerting-v2-schemas}/src/index.ts (100%) rename x-pack/platform/packages/shared/response-ops/{kbn-alerting-v2-schemas => alerting-v2-schemas}/src/rule_data_schema.ts (100%) rename x-pack/platform/packages/shared/response-ops/{kbn-alerting-v2-schemas => alerting-v2-schemas}/tsconfig.json (100%) diff --git a/package.json b/package.json index 54abb10eafd7b..d3bd47839f5e1 100644 --- a/package.json +++ b/package.json @@ -204,7 +204,7 @@ "@kbn/alerting-state-types": "link:x-pack/platform/packages/private/kbn-alerting-state-types", "@kbn/alerting-types": "link:src/platform/packages/shared/kbn-alerting-types", "@kbn/alerting-v2-plugin": "link:x-pack/platform/plugins/shared/alerting_v2", - "@kbn/alerting-v2-schemas": "link:x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas", + "@kbn/alerting-v2-schemas": "link:x-pack/platform/packages/shared/response-ops/alerting-v2-schemas", "@kbn/alerts-as-data-utils": "link:src/platform/packages/shared/kbn-alerts-as-data-utils", "@kbn/alerts-grouping": "link:x-pack/solutions/observability/packages/kbn-alerts-grouping", "@kbn/alerts-restricted-fixtures-plugin": "link:x-pack/platform/test/alerting_api_integration/common/plugins/alerts_restricted", diff --git a/tsconfig.base.json b/tsconfig.base.json index 1f63851854cc8..8c3c3dcb88831 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -86,8 +86,8 @@ "@kbn/alerting-types/*": ["src/platform/packages/shared/kbn-alerting-types/*"], "@kbn/alerting-v2-plugin": ["x-pack/platform/plugins/shared/alerting_v2"], "@kbn/alerting-v2-plugin/*": ["x-pack/platform/plugins/shared/alerting_v2/*"], - "@kbn/alerting-v2-schemas": ["x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas"], - "@kbn/alerting-v2-schemas/*": ["x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/*"], + "@kbn/alerting-v2-schemas": ["x-pack/platform/packages/shared/response-ops/alerting-v2-schemas"], + "@kbn/alerting-v2-schemas/*": ["x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/*"], "@kbn/alerts-as-data-utils": ["src/platform/packages/shared/kbn-alerts-as-data-utils"], "@kbn/alerts-as-data-utils/*": ["src/platform/packages/shared/kbn-alerts-as-data-utils/*"], "@kbn/alerts-grouping": ["x-pack/solutions/observability/packages/kbn-alerts-grouping"], diff --git a/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/README.md b/x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/README.md similarity index 100% rename from x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/README.md rename to x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/README.md diff --git a/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/index.ts b/x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/index.ts similarity index 100% rename from x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/index.ts rename to x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/index.ts diff --git a/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/jest.config.js b/x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/jest.config.js similarity index 93% rename from x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/jest.config.js rename to x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/jest.config.js index 50d930dfb94a3..9d87e3df2606e 100644 --- a/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/jest.config.js +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/jest.config.js @@ -8,5 +8,5 @@ module.exports = { preset: '@kbn/test/jest_node', rootDir: '../../../../..', - roots: ['/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas'], + roots: ['/x-pack/platform/packages/shared/response-ops/alerting-v2-schemas'], }; diff --git a/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/kibana.jsonc b/x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/kibana.jsonc similarity index 100% rename from x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/kibana.jsonc rename to x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/kibana.jsonc diff --git a/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/package.json b/x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/package.json similarity index 100% rename from x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/package.json rename to x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/package.json diff --git a/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/src/index.ts b/x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/src/index.ts similarity index 100% rename from x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/src/index.ts rename to x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/src/index.ts diff --git a/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/src/rule_data_schema.ts b/x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/src/rule_data_schema.ts similarity index 100% rename from x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/src/rule_data_schema.ts rename to x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/src/rule_data_schema.ts diff --git a/x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/tsconfig.json b/x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/tsconfig.json similarity index 100% rename from x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas/tsconfig.json rename to x-pack/platform/packages/shared/response-ops/alerting-v2-schemas/tsconfig.json diff --git a/yarn.lock b/yarn.lock index a5811e2cf3fb0..2f7c2f57fa503 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4674,7 +4674,7 @@ version "0.0.0" uid "" -"@kbn/alerting-v2-schemas@link:x-pack/platform/packages/shared/response-ops/kbn-alerting-v2-schemas": +"@kbn/alerting-v2-schemas@link:x-pack/platform/packages/shared/response-ops/alerting-v2-schemas": version "0.0.0" uid ""