mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Security AI Assistant] Marked assistant APIs as internal (#183965)
Temporary moved Security AI Assistant APIs to internal.
This commit is contained in:
parent
5a939b0770
commit
bae84d4569
38 changed files with 89 additions and 86 deletions
|
@ -10,18 +10,18 @@ export const ELASTIC_AI_ASSISTANT_INTERNAL_API_VERSION = '1';
|
|||
export const ELASTIC_AI_ASSISTANT_URL = '/api/elastic_assistant';
|
||||
export const ELASTIC_AI_ASSISTANT_INTERNAL_URL = '/internal/elastic_assistant';
|
||||
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL = `${ELASTIC_AI_ASSISTANT_URL}/current_user/conversations`;
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL = `${ELASTIC_AI_ASSISTANT_INTERNAL_URL}/current_user/conversations`;
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/{id}`;
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID_MESSAGES = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID}/messages`;
|
||||
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BULK_ACTION = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/_bulk_action`;
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/_find`;
|
||||
|
||||
export const ELASTIC_AI_ASSISTANT_PROMPTS_URL = `${ELASTIC_AI_ASSISTANT_URL}/prompts`;
|
||||
export const ELASTIC_AI_ASSISTANT_PROMPTS_URL = `${ELASTIC_AI_ASSISTANT_INTERNAL_URL}/prompts`;
|
||||
export const ELASTIC_AI_ASSISTANT_PROMPTS_URL_BULK_ACTION = `${ELASTIC_AI_ASSISTANT_PROMPTS_URL}/_bulk_action`;
|
||||
export const ELASTIC_AI_ASSISTANT_PROMPTS_URL_FIND = `${ELASTIC_AI_ASSISTANT_PROMPTS_URL}/_find`;
|
||||
|
||||
export const ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL = `${ELASTIC_AI_ASSISTANT_URL}/anonymization_fields`;
|
||||
export const ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL = `${ELASTIC_AI_ASSISTANT_INTERNAL_URL}/anonymization_fields`;
|
||||
export const ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION = `${ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL}/_bulk_action`;
|
||||
export const ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_FIND = `${ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL}/_find`;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import { z } from 'zod';
|
|||
*
|
||||
* info:
|
||||
* title: Bulk Actions API endpoint
|
||||
* version: 2023-10-31
|
||||
* version: 1
|
||||
*/
|
||||
|
||||
import { NonEmptyString } from '../common_attributes.gen';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
openapi: 3.0.0
|
||||
info:
|
||||
title: Bulk Actions API endpoint
|
||||
version: '2023-10-31'
|
||||
version: '1'
|
||||
paths:
|
||||
/api/elastic_assistant/anonymization_fields/_bulk_action:
|
||||
/internal/elastic_assistant/anonymization_fields/_bulk_action:
|
||||
post:
|
||||
operationId: PerformBulkAction
|
||||
x-codegen-enabled: true
|
||||
|
|
|
@ -14,7 +14,7 @@ import { ArrayFromString } from '@kbn/zod-helpers';
|
|||
*
|
||||
* info:
|
||||
* title: Find AnonymizationFields API endpoint
|
||||
* version: 2023-10-31
|
||||
* version: 1
|
||||
*/
|
||||
|
||||
import { AnonymizationFieldResponse } from './bulk_crud_anonymization_fields_route.gen';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
openapi: 3.0.0
|
||||
info:
|
||||
title: Find AnonymizationFields API endpoint
|
||||
version: '2023-10-31'
|
||||
version: '1'
|
||||
paths:
|
||||
/api/elastic_assistant/anonymization_fields/_find:
|
||||
/internal/elastic_assistant/anonymization_fields/_find:
|
||||
get:
|
||||
operationId: FindAnonymizationFields
|
||||
x-codegen-enabled: true
|
||||
|
|
|
@ -13,7 +13,7 @@ import { z } from 'zod';
|
|||
*
|
||||
* info:
|
||||
* title: Bulk Actions API endpoint
|
||||
* version: 2023-10-31
|
||||
* version: 1
|
||||
*/
|
||||
|
||||
import {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
openapi: 3.0.0
|
||||
info:
|
||||
title: Bulk Actions API endpoint
|
||||
version: '2023-10-31'
|
||||
version: '1'
|
||||
paths:
|
||||
/api/elastic_assistant/conversations/_bulk_action:
|
||||
/internal/elastic_assistant/conversations/_bulk_action:
|
||||
post:
|
||||
operationId: PerformBulkAction
|
||||
x-codegen-enabled: true
|
||||
|
|
|
@ -13,7 +13,7 @@ import { z } from 'zod';
|
|||
*
|
||||
* info:
|
||||
* title: Create Conversation API endpoint
|
||||
* version: 2023-10-31
|
||||
* version: 1
|
||||
*/
|
||||
|
||||
import {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
openapi: 3.0.0
|
||||
info:
|
||||
title: Create Conversation API endpoint
|
||||
version: '2023-10-31'
|
||||
version: '1'
|
||||
paths:
|
||||
/api/elastic_assistant/conversations:
|
||||
/internal/elastic_assistant/conversations:
|
||||
post:
|
||||
operationId: CreateConversation
|
||||
x-codegen-enabled: true
|
||||
|
@ -38,7 +38,7 @@ paths:
|
|||
message:
|
||||
type: string
|
||||
|
||||
/api/elastic_assistant/conversations/{id}:
|
||||
/internal/elastic_assistant/conversations/{id}:
|
||||
get:
|
||||
operationId: ReadConversation
|
||||
x-codegen-enabled: true
|
||||
|
@ -148,7 +148,7 @@ paths:
|
|||
message:
|
||||
type: string
|
||||
|
||||
/api/elastic_assistant/conversations/{id}/messages:
|
||||
/internal/elastic_assistant/conversations/{id}/messages:
|
||||
post:
|
||||
operationId: AppendConversationMessage
|
||||
x-codegen-enabled: true
|
||||
|
|
|
@ -14,7 +14,7 @@ import { ArrayFromString } from '@kbn/zod-helpers';
|
|||
*
|
||||
* info:
|
||||
* title: Find Conversations API endpoint
|
||||
* version: 2023-10-31
|
||||
* version: 1
|
||||
*/
|
||||
|
||||
import { ConversationResponse } from './common_attributes.gen';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
openapi: 3.0.0
|
||||
info:
|
||||
title: Find Conversations API endpoint
|
||||
version: '2023-10-31'
|
||||
version: '1'
|
||||
paths:
|
||||
/api/elastic_assistant/conversations/_find:
|
||||
/internal/elastic_assistant/conversations/_find:
|
||||
get:
|
||||
operationId: FindConversations
|
||||
x-codegen-enabled: true
|
||||
|
@ -91,7 +91,7 @@ paths:
|
|||
message:
|
||||
type: string
|
||||
|
||||
/api/elastic_assistant/conversations/current_user/_find:
|
||||
/internal/elastic_assistant/conversations/current_user/_find:
|
||||
get:
|
||||
operationId: FindCurrentUserConversations
|
||||
x-codegen-enabled: true
|
||||
|
|
|
@ -13,7 +13,7 @@ import { z } from 'zod';
|
|||
*
|
||||
* info:
|
||||
* title: Bulk Actions API endpoint
|
||||
* version: 2023-10-31
|
||||
* version: 1
|
||||
*/
|
||||
|
||||
import { NonEmptyString, User } from '../common_attributes.gen';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
openapi: 3.0.0
|
||||
info:
|
||||
title: Bulk Actions API endpoint
|
||||
version: '2023-10-31'
|
||||
version: '1'
|
||||
paths:
|
||||
/api/elastic_assistant/prompts/_bulk_action:
|
||||
/internal/elastic_assistant/prompts/_bulk_action:
|
||||
post:
|
||||
operationId: PerformBulkAction
|
||||
x-codegen-enabled: true
|
||||
|
|
|
@ -14,7 +14,7 @@ import { ArrayFromString } from '@kbn/zod-helpers';
|
|||
*
|
||||
* info:
|
||||
* title: Find Prompts API endpoint
|
||||
* version: 2023-10-31
|
||||
* version: 1
|
||||
*/
|
||||
|
||||
import { PromptResponse } from './bulk_crud_prompts_route.gen';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
openapi: 3.0.0
|
||||
info:
|
||||
title: Find Prompts API endpoint
|
||||
version: '2023-10-31'
|
||||
version: '1'
|
||||
paths:
|
||||
/api/elastic_assistant/prompts/_find:
|
||||
/internal/elastic_assistant/prompts/_find:
|
||||
get:
|
||||
operationId: FindPrompts
|
||||
x-codegen-enabled: true
|
||||
|
|
|
@ -48,7 +48,7 @@ describe('bulkUpdateAnonymizationFields', () => {
|
|||
ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
body: JSON.stringify({
|
||||
create: [],
|
||||
update: [],
|
||||
|
@ -71,7 +71,7 @@ describe('bulkUpdateAnonymizationFields', () => {
|
|||
ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
body: JSON.stringify({
|
||||
create: [anonymizationField1, anonymizationField2],
|
||||
update: [],
|
||||
|
@ -93,7 +93,7 @@ describe('bulkUpdateAnonymizationFields', () => {
|
|||
ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
body: JSON.stringify({
|
||||
update: [anonymizationField1, anonymizationField2],
|
||||
delete: { ids: [] },
|
||||
|
|
|
@ -26,7 +26,7 @@ export const bulkUpdateAnonymizationFields = async (
|
|||
ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
body: JSON.stringify(anonymizationFieldsActions),
|
||||
}
|
||||
);
|
||||
|
|
|
@ -13,7 +13,7 @@ import React from 'react';
|
|||
import { useFetchAnonymizationFields } from './use_fetch_anonymization_fields';
|
||||
import { HttpSetup } from '@kbn/core-http-browser';
|
||||
import { useAssistantContext } from '../../../assistant_context';
|
||||
import { defaultAssistantFeatures } from '@kbn/elastic-assistant-common';
|
||||
import { API_VERSIONS, defaultAssistantFeatures } from '@kbn/elastic-assistant-common';
|
||||
|
||||
const http = {
|
||||
fetch: jest.fn().mockResolvedValue(defaultAssistantFeatures),
|
||||
|
@ -44,15 +44,18 @@ describe('useFetchAnonymizationFields', () => {
|
|||
await act(async () => {
|
||||
const { waitForNextUpdate } = renderHook(() => useFetchAnonymizationFields());
|
||||
await waitForNextUpdate();
|
||||
expect(http.fetch).toHaveBeenCalledWith('/api/elastic_assistant/anonymization_fields/_find', {
|
||||
method: 'GET',
|
||||
query: {
|
||||
page: 1,
|
||||
per_page: 1000,
|
||||
},
|
||||
version: '2023-10-31',
|
||||
signal: undefined,
|
||||
});
|
||||
expect(http.fetch).toHaveBeenCalledWith(
|
||||
'/internal/elastic_assistant/anonymization_fields/_find',
|
||||
{
|
||||
method: 'GET',
|
||||
query: {
|
||||
page: 1,
|
||||
per_page: 1000,
|
||||
},
|
||||
version: API_VERSIONS.internal.v1,
|
||||
signal: undefined,
|
||||
}
|
||||
);
|
||||
|
||||
expect(http.fetch).toHaveBeenCalled();
|
||||
});
|
||||
|
|
|
@ -36,7 +36,7 @@ export const CACHING_KEYS = [
|
|||
ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_FIND,
|
||||
QUERY.page,
|
||||
QUERY.per_page,
|
||||
API_VERSIONS.public.v1,
|
||||
API_VERSIONS.internal.v1,
|
||||
];
|
||||
|
||||
export const useFetchAnonymizationFields = (payload?: UseFetchAnonymizationFieldsParams) => {
|
||||
|
@ -50,7 +50,7 @@ export const useFetchAnonymizationFields = (payload?: UseFetchAnonymizationField
|
|||
async () =>
|
||||
http.fetch(ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_FIND, {
|
||||
method: 'GET',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
query: QUERY,
|
||||
signal: payload?.signal,
|
||||
}),
|
||||
|
|
|
@ -63,7 +63,7 @@ describe('bulkUpdateConversations', () => {
|
|||
ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
body: JSON.stringify({
|
||||
update: [],
|
||||
create: [],
|
||||
|
@ -89,7 +89,7 @@ describe('bulkUpdateConversations', () => {
|
|||
ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
body: JSON.stringify({
|
||||
update: [],
|
||||
create: [conversation1, conversation2],
|
||||
|
@ -114,7 +114,7 @@ describe('bulkUpdateConversations', () => {
|
|||
ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
body: JSON.stringify({
|
||||
update: [conversation1, conversation2],
|
||||
delete: { ids: [] },
|
||||
|
|
|
@ -114,7 +114,7 @@ export const bulkUpdateConversations = async (
|
|||
ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
body: JSON.stringify({
|
||||
update: conversationsToUpdate,
|
||||
create: conversationsToCreate,
|
||||
|
|
|
@ -36,11 +36,11 @@ describe('conversations api', () => {
|
|||
await waitForNextUpdate();
|
||||
|
||||
expect(deleteProps.http.fetch).toHaveBeenCalledWith(
|
||||
'/api/elastic_assistant/current_user/conversations/test',
|
||||
'/internal/elastic_assistant/current_user/conversations/test',
|
||||
{
|
||||
method: 'DELETE',
|
||||
signal: undefined,
|
||||
version: '2023-10-31',
|
||||
version: '1',
|
||||
}
|
||||
);
|
||||
expect(toasts.addError).not.toHaveBeenCalled();
|
||||
|
@ -62,11 +62,11 @@ describe('conversations api', () => {
|
|||
await waitForNextUpdate();
|
||||
|
||||
expect(getProps.http.fetch).toHaveBeenCalledWith(
|
||||
'/api/elastic_assistant/current_user/conversations/test',
|
||||
'/internal/elastic_assistant/current_user/conversations/test',
|
||||
{
|
||||
method: 'GET',
|
||||
signal: undefined,
|
||||
version: '2023-10-31',
|
||||
version: '1',
|
||||
}
|
||||
);
|
||||
expect(toasts.addError).not.toHaveBeenCalled();
|
||||
|
|
|
@ -44,7 +44,7 @@ export const getConversationById = async ({
|
|||
try {
|
||||
const response = await http.fetch(`${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/${id}`, {
|
||||
method: 'GET',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
signal,
|
||||
});
|
||||
|
||||
|
@ -84,7 +84,7 @@ export const getUserConversations = async ({
|
|||
ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND,
|
||||
{
|
||||
method: 'GET',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
signal,
|
||||
}
|
||||
);
|
||||
|
@ -125,7 +125,7 @@ export const createConversation = async ({
|
|||
try {
|
||||
const response = await http.post(ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL, {
|
||||
body: JSON.stringify(conversation),
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
signal,
|
||||
});
|
||||
|
||||
|
@ -168,7 +168,7 @@ export const deleteConversation = async ({
|
|||
try {
|
||||
const response = await http.fetch(`${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/${id}`, {
|
||||
method: 'DELETE',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
signal,
|
||||
});
|
||||
|
||||
|
@ -237,7 +237,7 @@ export const updateConversation = async ({
|
|||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
signal,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -47,14 +47,14 @@ describe('useFetchCurrentUserConversations', () => {
|
|||
);
|
||||
await waitForNextUpdate();
|
||||
expect(defaultProps.http.fetch).toHaveBeenCalledWith(
|
||||
'/api/elastic_assistant/current_user/conversations/_find',
|
||||
'/internal/elastic_assistant/current_user/conversations/_find',
|
||||
{
|
||||
method: 'GET',
|
||||
query: {
|
||||
page: 1,
|
||||
perPage: 100,
|
||||
},
|
||||
version: '2023-10-31',
|
||||
version: '1',
|
||||
signal: undefined,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -47,7 +47,7 @@ export const CONVERSATIONS_QUERY_KEYS = [
|
|||
ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND,
|
||||
query.page,
|
||||
query.perPage,
|
||||
API_VERSIONS.public.v1,
|
||||
API_VERSIONS.internal.v1,
|
||||
];
|
||||
|
||||
export const useFetchCurrentUserConversations = ({
|
||||
|
@ -62,7 +62,7 @@ export const useFetchCurrentUserConversations = ({
|
|||
async () =>
|
||||
http.fetch<FetchConversationsResponse>(ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND, {
|
||||
method: 'GET',
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
query,
|
||||
signal,
|
||||
}),
|
||||
|
|
|
@ -171,10 +171,10 @@ describe('useSettingsUpdater', () => {
|
|||
await result.current.saveSettings();
|
||||
|
||||
expect(mockHttp.fetch).toHaveBeenCalledWith(
|
||||
'/api/elastic_assistant/current_user/conversations/_bulk_action',
|
||||
'/internal/elastic_assistant/current_user/conversations/_bulk_action',
|
||||
{
|
||||
method: 'POST',
|
||||
version: '2023-10-31',
|
||||
version: '1',
|
||||
body: '{"delete":{"ids":["1"]}}',
|
||||
}
|
||||
);
|
||||
|
|
|
@ -118,7 +118,7 @@ export const bulkActionAnonymizationFieldsRoute = (
|
|||
) => {
|
||||
router.versioned
|
||||
.post({
|
||||
access: 'public',
|
||||
access: 'internal',
|
||||
path: ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION,
|
||||
options: {
|
||||
tags: ['access:securitySolution-updateAIAssistantAnonymization'],
|
||||
|
@ -129,7 +129,7 @@ export const bulkActionAnonymizationFieldsRoute = (
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
validate: {
|
||||
request: {
|
||||
body: buildRouteValidationWithZod(PerformBulkActionRequestBody),
|
||||
|
|
|
@ -30,7 +30,7 @@ export const findAnonymizationFieldsRoute = (
|
|||
) => {
|
||||
router.versioned
|
||||
.get({
|
||||
access: 'public',
|
||||
access: 'internal',
|
||||
path: ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_FIND,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -38,7 +38,7 @@ export const findAnonymizationFieldsRoute = (
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
validate: {
|
||||
request: {
|
||||
query: buildRouteValidationWithZod(FindAnonymizationFieldsRequestQuery),
|
||||
|
|
|
@ -112,7 +112,7 @@ const buildBulkResponse = (
|
|||
export const bulkPromptsRoute = (router: ElasticAssistantPluginRouter, logger: Logger) => {
|
||||
router.versioned
|
||||
.post({
|
||||
access: 'public',
|
||||
access: 'internal',
|
||||
path: ELASTIC_AI_ASSISTANT_PROMPTS_URL_BULK_ACTION,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -123,7 +123,7 @@ export const bulkPromptsRoute = (router: ElasticAssistantPluginRouter, logger: L
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
validate: {
|
||||
request: {
|
||||
body: buildRouteValidationWithZod(PerformBulkActionRequestBody),
|
||||
|
|
|
@ -23,7 +23,7 @@ import { UPGRADE_LICENSE_MESSAGE, hasAIAssistantLicense } from '../helpers';
|
|||
export const findPromptsRoute = (router: ElasticAssistantPluginRouter, logger: Logger) => {
|
||||
router.versioned
|
||||
.get({
|
||||
access: 'public',
|
||||
access: 'internal',
|
||||
path: ELASTIC_AI_ASSISTANT_PROMPTS_URL_FIND,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -31,7 +31,7 @@ export const findPromptsRoute = (router: ElasticAssistantPluginRouter, logger: L
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
validate: {
|
||||
request: {
|
||||
query: buildRouteValidationWithZod(FindPromptsRequestQuery),
|
||||
|
|
|
@ -22,7 +22,7 @@ import { UPGRADE_LICENSE_MESSAGE, hasAIAssistantLicense } from '../helpers';
|
|||
export const appendConversationMessageRoute = (router: ElasticAssistantPluginRouter) => {
|
||||
router.versioned
|
||||
.post({
|
||||
access: 'public',
|
||||
access: 'internal',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID_MESSAGES,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -30,7 +30,7 @@ export const appendConversationMessageRoute = (router: ElasticAssistantPluginRou
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
validate: {
|
||||
request: {
|
||||
body: buildRouteValidationWithZod(AppendConversationMessageRequestBody),
|
||||
|
|
|
@ -116,7 +116,7 @@ export const bulkActionConversationsRoute = (
|
|||
) => {
|
||||
router.versioned
|
||||
.post({
|
||||
access: 'public',
|
||||
access: 'internal',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BULK_ACTION,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -127,7 +127,7 @@ export const bulkActionConversationsRoute = (
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
validate: {
|
||||
request: {
|
||||
body: buildRouteValidationWithZod(PerformBulkActionRequestBody),
|
||||
|
|
|
@ -21,7 +21,7 @@ import { UPGRADE_LICENSE_MESSAGE, hasAIAssistantLicense } from '../helpers';
|
|||
export const createConversationRoute = (router: ElasticAssistantPluginRouter): void => {
|
||||
router.versioned
|
||||
.post({
|
||||
access: 'public',
|
||||
access: 'internal',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL,
|
||||
|
||||
options: {
|
||||
|
@ -30,7 +30,7 @@ export const createConversationRoute = (router: ElasticAssistantPluginRouter): v
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
validate: {
|
||||
request: {
|
||||
body: buildRouteValidationWithZod(ConversationCreateProps),
|
||||
|
|
|
@ -19,7 +19,7 @@ import { UPGRADE_LICENSE_MESSAGE, hasAIAssistantLicense } from '../helpers';
|
|||
export const deleteConversationRoute = (router: ElasticAssistantPluginRouter) => {
|
||||
router.versioned
|
||||
.delete({
|
||||
access: 'public',
|
||||
access: 'internal',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -27,7 +27,7 @@ export const deleteConversationRoute = (router: ElasticAssistantPluginRouter) =>
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
validate: {
|
||||
request: {
|
||||
params: buildRouteValidationWithZod(DeleteConversationRequestParams),
|
||||
|
|
|
@ -26,7 +26,7 @@ import { UPGRADE_LICENSE_MESSAGE, hasAIAssistantLicense } from '../helpers';
|
|||
export const findUserConversationsRoute = (router: ElasticAssistantPluginRouter) => {
|
||||
router.versioned
|
||||
.get({
|
||||
access: 'public',
|
||||
access: 'internal',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -34,7 +34,7 @@ export const findUserConversationsRoute = (router: ElasticAssistantPluginRouter)
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
validate: {
|
||||
request: {
|
||||
query: buildRouteValidationWithZod(FindConversationsRequestQuery),
|
||||
|
|
|
@ -21,7 +21,7 @@ import { UPGRADE_LICENSE_MESSAGE, hasAIAssistantLicense } from '../helpers';
|
|||
export const readConversationRoute = (router: ElasticAssistantPluginRouter) => {
|
||||
router.versioned
|
||||
.get({
|
||||
access: 'public',
|
||||
access: 'internal',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -29,7 +29,7 @@ export const readConversationRoute = (router: ElasticAssistantPluginRouter) => {
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
validate: {
|
||||
request: {
|
||||
params: buildRouteValidationWithZod(ReadConversationRequestParams),
|
||||
|
|
|
@ -24,7 +24,7 @@ import { UPGRADE_LICENSE_MESSAGE, hasAIAssistantLicense } from '../helpers';
|
|||
export const updateConversationRoute = (router: ElasticAssistantPluginRouter) => {
|
||||
router.versioned
|
||||
.put({
|
||||
access: 'public',
|
||||
access: 'internal',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -32,7 +32,7 @@ export const updateConversationRoute = (router: ElasticAssistantPluginRouter) =>
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.public.v1,
|
||||
version: API_VERSIONS.internal.v1,
|
||||
validate: {
|
||||
request: {
|
||||
body: buildRouteValidationWithZod(ConversationUpdateProps),
|
||||
|
|
|
@ -165,7 +165,7 @@ describe('createConversations', () => {
|
|||
);
|
||||
await waitForNextUpdate();
|
||||
expect(http.fetch.mock.calls[0][0]).toBe(
|
||||
'/api/elastic_assistant/current_user/conversations/_bulk_action'
|
||||
'/internal/elastic_assistant/current_user/conversations/_bulk_action'
|
||||
);
|
||||
expect(
|
||||
http.fetch.mock.calls[0].length > 1
|
||||
|
@ -187,7 +187,7 @@ describe('createConversations', () => {
|
|||
);
|
||||
await waitForNextUpdate();
|
||||
expect(http.fetch.mock.calls[0][0]).toBe(
|
||||
'/api/elastic_assistant/current_user/conversations/_bulk_action'
|
||||
'/internal/elastic_assistant/current_user/conversations/_bulk_action'
|
||||
);
|
||||
const createdConversations =
|
||||
http.fetch.mock.calls[0].length > 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue