Skip to content

Commit

Permalink
Merge branch 'main' into shared-ux-markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula authored Feb 9, 2024
2 parents 9caba9f + 2c0fd46 commit c8d4856
Show file tree
Hide file tree
Showing 151 changed files with 4,051 additions and 800 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipelines/on_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ steps:
agents:
queue: n2-8-spot
key: storybooks
timeout_in_minutes: 60
timeout_in_minutes: 80
retry:
automatic:
- exit_status: '-1'
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipelines/pull_request/storybooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ steps:
agents:
queue: n2-8-spot
key: storybooks
timeout_in_minutes: 60
timeout_in_minutes: 80
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ xpack.actions.preconfigured:
actionTypeId: .bedrock
config:
apiUrl: https://bedrock-runtime.us-east-1.amazonaws.com <1>
defaultModel: anthropic.claude-v2 <2>
defaultModel: anthropic.claude-v2:1 <2>
secrets:
accessKey: key-value <3>
secret: secret-value <4>
Expand Down
2 changes: 1 addition & 1 deletion docs/settings/alert-action-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ For a <<cases-webhook-action-type,{webhook-cm} connector>>, specifies a string f
The default model to use for requests, which varies by connector:
+
--
* For an <<bedrock-action-type,{bedrock} connector>>, current support is for the Anthropic Claude models. Defaults to `anthropic.claude-v2`.
* For an <<bedrock-action-type,{bedrock} connector>>, current support is for the Anthropic Claude models. Defaults to `anthropic.claude-v2:1`.
* For a <<openai-action-type,OpenAI connector>>, it is optional and applicable only when `xpack.actions.preconfigured.<connector-id>.config.apiProvider` is `OpenAI`.
--

Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,8 @@
"@reduxjs/toolkit": "1.9.7",
"@slack/webhook": "^7.0.1",
"@smithy/eventstream-codec": "^2.0.12",
"@smithy/eventstream-serde-node": "^2.1.1",
"@smithy/types": "^2.9.1",
"@smithy/util-utf8": "^2.0.0",
"@tanstack/react-query": "^4.29.12",
"@tanstack/react-query-devtools": "^4.29.12",
Expand Down Expand Up @@ -946,6 +948,7 @@
"diff": "^5.1.0",
"elastic-apm-node": "^4.4.0",
"email-addresses": "^5.0.0",
"eventsource-parser": "^1.1.1",
"execa": "^5.1.1",
"expiry-js": "0.1.7",
"exponential-backoff": "^3.1.1",
Expand All @@ -954,6 +957,7 @@
"fast-glob": "^3.3.2",
"fflate": "^0.6.9",
"file-saver": "^1.3.8",
"flat": "5",
"fnv-plus": "^1.3.1",
"font-awesome": "4.7.0",
"formik": "^2.4.5",
Expand Down Expand Up @@ -1380,11 +1384,13 @@
"@types/ejs": "^3.0.6",
"@types/enzyme": "^3.10.12",
"@types/eslint": "^8.44.2",
"@types/event-stream": "^4.0.5",
"@types/express": "^4.17.13",
"@types/extract-zip": "^1.6.2",
"@types/faker": "^5.1.5",
"@types/fetch-mock": "^7.3.1",
"@types/file-saver": "^2.0.0",
"@types/flat": "^5.0.5",
"@types/flot": "^0.0.31",
"@types/fnv-plus": "^1.3.0",
"@types/geojson": "^7946.0.10",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-search-connectors/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ export * from './update_connector_configuration';
export * from './update_connector_index_name';
export * from './update_connector_name_and_description';
export * from './update_connector_scheduling';
export * from './update_connector_secret';
export * from './update_connector_service_type';
export * from './update_connector_status';
42 changes: 42 additions & 0 deletions packages/kbn-search-connectors/lib/update_connector_secret.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { ElasticsearchClient } from '@kbn/core-elasticsearch-server';

import { updateConnectorSecret } from './update_connector_secret';

describe('updateConnectorSecret lib function', () => {
const mockClient = {
transport: {
request: jest.fn(),
},
};

beforeEach(() => {
jest.clearAllMocks();
jest.useFakeTimers();
});

it('should update a connector secret', async () => {
mockClient.transport.request.mockImplementation(() => ({
result: 'created',
}));

await expect(
updateConnectorSecret(mockClient as unknown as ElasticsearchClient, 'my-secret', 'secret-id')
).resolves.toEqual({ result: 'created' });
expect(mockClient.transport.request).toHaveBeenCalledWith({
method: 'PUT',
path: '/_connector/_secret/secret-id',
body: {
value: 'my-secret',
},
});
jest.useRealTimers();
});
});
24 changes: 24 additions & 0 deletions packages/kbn-search-connectors/lib/update_connector_secret.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import { ConnectorsAPIUpdateResponse } from '../types/connectors_api';

export const updateConnectorSecret = async (
client: ElasticsearchClient,
value: string,
secretId: string
) => {
return await client.transport.request<ConnectorsAPIUpdateResponse>({
method: 'PUT',
path: `/_connector/_secret/${secretId}`,
body: {
value,
},
});
};
2 changes: 1 addition & 1 deletion packages/kbn-test/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module.exports = {
transformIgnorePatterns: [
// ignore all node_modules except monaco-editor, monaco-yaml and react-monaco-editor which requires babel transforms to handle dynamic import()
// since ESM modules are not natively supported in Jest yet (https://github.com/facebook/jest/issues/4842)
'[/\\\\]node_modules(?![\\/\\\\](byte-size|monaco-editor|monaco-yaml|monaco-languageserver-types|monaco-marker-data-provider|monaco-worker-manager|vscode-languageserver-types|react-monaco-editor|d3-interpolate|d3-color|langchain|langsmith|@cfworker|gpt-tokenizer))[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](byte-size|monaco-editor|monaco-yaml|monaco-languageserver-types|monaco-marker-data-provider|monaco-worker-manager|vscode-languageserver-types|react-monaco-editor|d3-interpolate|d3-color|langchain|langsmith|@cfworker|gpt-tokenizer|flat))[/\\\\].+\\.js$',
'packages/kbn-pm/dist/index.js',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith))/dist/[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith))/dist/util/[/\\\\].+\\.js$',
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/jest_integration_node/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
// An array of regexp pattern strings that are matched against, matched files will skip transformation:
transformIgnorePatterns: [
// since ESM modules are not natively supported in Jest yet (https://github.com/facebook/jest/issues/4842)
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith|gpt-tokenizer))[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith|gpt-tokenizer|flat))[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith))/dist/[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith))/dist/util/[/\\\\].+\\.js$',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
RuleCreationValidConsumer,
STACK_ALERTS_FEATURE_ID,
} from '@kbn/rule-data-utils';
import { RuleTypeMetaData } from '@kbn/alerting-plugin/common';
import { DiscoverStateContainer } from '../../services/discover_state';
import { DiscoverServices } from '../../../../build_services';

Expand All @@ -42,7 +43,7 @@ interface AlertsPopoverProps {
isPlainRecord?: boolean;
}

interface EsQueryAlertMetaData {
interface EsQueryAlertMetaData extends RuleTypeMetaData {
isManagementPage?: boolean;
adHocDataViewList: DataView[];
}
Expand Down Expand Up @@ -110,11 +111,11 @@ export function AlertsPopover({
metadata: discoverMetadata,
consumer: 'alerts',
onClose: (_, metadata) => {
onFinishFlyoutInteraction(metadata as EsQueryAlertMetaData);
onFinishFlyoutInteraction(metadata!);
onClose();
},
onSave: async (metadata) => {
onFinishFlyoutInteraction(metadata as EsQueryAlertMetaData);
onFinishFlyoutInteraction(metadata!);
},
canChangeTrigger: false,
ruleTypeId: ES_QUERY_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function FilterBadge({
`}
>
<EuiTextBlockTruncate lines={10}>
{!hideAlias && filter.meta.alias !== null ? (
{filter.meta.alias && !hideAlias ? (
<>
<span className={marginLeftLabelCss(euiTheme)}>
{prefix}
Expand Down
8 changes: 5 additions & 3 deletions test/functional/page_objects/common_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,16 @@ export class CommonPageObject extends FtrService {
}

currentUrl = (await this.browser.getCurrentUrl()).replace(/\/\/\w+:\w+@/, '//');
const decodedAppUrl = decodeURIComponent(appUrl);
const decodedCurrentUrl = decodeURIComponent(currentUrl);

const navSuccessful = currentUrl
const navSuccessful = decodedCurrentUrl
.replace(':80/', '/')
.replace(':443/', '/')
.startsWith(appUrl.replace(':80/', '/').replace(':443/', '/'));
.startsWith(decodedAppUrl.replace(':80/', '/').replace(':443/', '/'));

if (!navSuccessful) {
const msg = `App failed to load: ${appName} in ${this.defaultFindTimeout}ms appUrl=${appUrl} currentUrl=${currentUrl}`;
const msg = `App failed to load: ${appName} in ${this.defaultFindTimeout}ms appUrl=${decodedAppUrl} currentUrl=${decodedCurrentUrl}`;
this.log.debug(msg);
throw new Error(msg);
}
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/actions/docs/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -2240,7 +2240,7 @@
"defaultModel": {
"type": "string",
"description": "The generative artificial intelligence model for Amazon Bedrock to use. Current support is for the Anthropic Claude models.\n",
"default": "anthropic.claude-v2"
"default": "anthropic.claude-v2:1"
}
}
},
Expand Down Expand Up @@ -6841,4 +6841,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion x-pack/plugins/actions/docs/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ components:
type: string
description: |
The generative artificial intelligence model for Amazon Bedrock to use. Current support is for the Anthropic Claude models.
default: anthropic.claude-v2
default: anthropic.claude-v2:1
secrets_properties_bedrock:
title: Connector secrets properties for an Amazon Bedrock connector
description: Defines secrets for connectors when type is `.bedrock`.
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/actions/docs/openapi/bundled_serverless.json
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@
"defaultModel": {
"type": "string",
"description": "The generative artificial intelligence model for Amazon Bedrock to use. Current support is for the Anthropic Claude models.\n",
"default": "anthropic.claude-v2"
"default": "anthropic.claude-v2:1"
}
}
},
Expand Down Expand Up @@ -4377,4 +4377,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ components:
type: string
description: |
The generative artificial intelligence model for Amazon Bedrock to use. Current support is for the Anthropic Claude models.
default: anthropic.claude-v2
default: anthropic.claude-v2:1
secrets_properties_bedrock:
title: Connector secrets properties for an Amazon Bedrock connector
description: Defines secrets for connectors when type is `.bedrock`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ properties:
description: >
The generative artificial intelligence model for Amazon Bedrock to use.
Current support is for the Anthropic Claude models.
default: anthropic.claude-v2
default: anthropic.claude-v2:1
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/common/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type { ActionVariable } from '@kbn/alerting-types';

export type RuleTypeState = Record<string, unknown>;
export type RuleTypeParams = Record<string, unknown>;
export type RuleTypeMetaData = Record<string, unknown>;

// rule type defined alert fields to persist in alerts index
export type RuleAlertData = Record<string, unknown>;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c8d4856

Please sign in to comment.