mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-08 22:22:17 +02:00
Merge remote-tracking branch 'upstream/ci_mvp' into feat/ci-ui-changes
This commit is contained in:
commit
fd8d1273cd
188 changed files with 2163 additions and 3644 deletions
|
|
@ -118,7 +118,7 @@ export type Trigger = z.infer<typeof trigger>;
|
|||
// =============================================================================
|
||||
|
||||
export const automationCreateRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
name: z.string().min(1).max(200),
|
||||
description: z.string().nullable().optional(),
|
||||
definition: automationDefinition,
|
||||
|
|
@ -136,7 +136,7 @@ export type AutomationUpdateRequest = z.infer<typeof automationUpdateRequest>;
|
|||
|
||||
export const automationSummary = z.object({
|
||||
id: z.number(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
name: z.string(),
|
||||
description: z.string().nullable().optional(),
|
||||
status: automationStatus,
|
||||
|
|
@ -159,7 +159,7 @@ export const automationListResponse = z.object({
|
|||
export type AutomationListResponse = z.infer<typeof automationListResponse>;
|
||||
|
||||
export const automationListParams = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
limit: z.number().int().min(1).max(200).default(50),
|
||||
offset: z.number().int().min(0).default(0),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ export const mentionContext = z.object({
|
|||
thread_id: z.number(),
|
||||
thread_title: z.string(),
|
||||
message_id: z.number(),
|
||||
search_space_id: z.number(),
|
||||
search_space_name: z.string(),
|
||||
workspace_id: z.number(),
|
||||
workspace_name: z.string(),
|
||||
});
|
||||
|
||||
export const mentionComment = z.object({
|
||||
|
|
@ -144,7 +144,7 @@ export const deleteCommentResponse = z.object({
|
|||
* Get mentions
|
||||
*/
|
||||
export const getMentionsRequest = z.object({
|
||||
search_space_id: z.number().optional(),
|
||||
workspace_id: z.number().optional(),
|
||||
});
|
||||
|
||||
export const getMentionsResponse = z.object({
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export const publicChatSnapshotDetail = z.object({
|
|||
* List public chat snapshots for search space
|
||||
*/
|
||||
export const publicChatSnapshotsBySpaceRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
});
|
||||
|
||||
export const publicChatSnapshotsBySpaceResponse = z.object({
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export const searchSourceConnector = z.object({
|
|||
periodic_indexing_enabled: z.boolean(),
|
||||
indexing_frequency_minutes: z.number().nullable(),
|
||||
next_scheduled_at: z.string().nullable(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
user_id: z.string(),
|
||||
created_at: z.string(),
|
||||
});
|
||||
|
|
@ -72,7 +72,7 @@ export const getConnectorsRequest = z.object({
|
|||
queryParams: paginationQueryParams
|
||||
.pick({ skip: true, limit: true })
|
||||
.extend({
|
||||
search_space_id: z.number().or(z.string()).nullish(),
|
||||
workspace_id: z.number().or(z.string()).nullish(),
|
||||
})
|
||||
.nullish(),
|
||||
});
|
||||
|
|
@ -103,7 +103,7 @@ export const createConnectorRequest = z.object({
|
|||
next_scheduled_at: true,
|
||||
}),
|
||||
queryParams: z.object({
|
||||
search_space_id: z.number().or(z.string()),
|
||||
workspace_id: z.number().or(z.string()),
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ export const googleDriveIndexBody = z.object({
|
|||
export const indexConnectorRequest = z.object({
|
||||
connector_id: z.number(),
|
||||
queryParams: z.object({
|
||||
search_space_id: z.number().or(z.string()),
|
||||
workspace_id: z.number().or(z.string()),
|
||||
start_date: z.string().optional(),
|
||||
end_date: z.string().optional(),
|
||||
}),
|
||||
|
|
@ -185,7 +185,7 @@ export const indexConnectorRequest = z.object({
|
|||
export const indexConnectorResponse = z.object({
|
||||
message: z.string(),
|
||||
connector_id: z.number(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
indexing_from: z.string(),
|
||||
indexing_to: z.string(),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ export const document = z.object({
|
|||
unique_identifier_hash: z.string().nullable(),
|
||||
created_at: z.string(),
|
||||
updated_at: z.string().nullable(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
created_by_id: z.string().nullable().optional(),
|
||||
created_by_name: z.string().nullable().optional(),
|
||||
created_by_email: z.string().nullable().optional(),
|
||||
|
|
@ -85,7 +85,7 @@ export const sortOrderEnum = z.enum(["asc", "desc"]);
|
|||
export const getDocumentsRequest = z.object({
|
||||
queryParams: paginationQueryParams
|
||||
.extend({
|
||||
search_space_id: z.number().or(z.string()).optional(),
|
||||
workspace_id: z.number().or(z.string()).optional(),
|
||||
document_types: z.array(documentTypeEnum).optional(),
|
||||
sort_by: documentSortByEnum.optional(),
|
||||
sort_order: sortOrderEnum.optional(),
|
||||
|
|
@ -112,7 +112,7 @@ export const getDocumentResponse = document;
|
|||
* Create documents
|
||||
*/
|
||||
export const createDocumentRequest = document
|
||||
.pick({ document_type: true, search_space_id: true })
|
||||
.pick({ document_type: true, workspace_id: true })
|
||||
.extend({
|
||||
content: z.string().or(z.array(z.string())).or(z.array(extensionDocumentContent)),
|
||||
});
|
||||
|
|
@ -129,7 +129,7 @@ export const processingModeEnum = z.enum(["basic", "premium"]);
|
|||
|
||||
export const uploadDocumentRequest = z.object({
|
||||
files: z.array(z.instanceof(File)),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
use_vision_llm: z.boolean().default(false),
|
||||
processing_mode: processingModeEnum.default("basic"),
|
||||
});
|
||||
|
|
@ -148,7 +148,7 @@ export const uploadDocumentResponse = z.object({
|
|||
*/
|
||||
export const getDocumentsStatusRequest = z.object({
|
||||
queryParams: z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
document_ids: z.array(z.number()).min(1),
|
||||
}),
|
||||
});
|
||||
|
|
@ -175,7 +175,7 @@ export const getDocumentsStatusResponse = z.object({
|
|||
export const searchDocumentsRequest = z.object({
|
||||
queryParams: paginationQueryParams
|
||||
.extend({
|
||||
search_space_id: z.number().or(z.string()).optional(),
|
||||
workspace_id: z.number().or(z.string()).optional(),
|
||||
document_types: z.array(documentTypeEnum).optional(),
|
||||
title: z.string().optional(),
|
||||
})
|
||||
|
|
@ -200,18 +200,12 @@ export const documentTitleRead = z.object({
|
|||
});
|
||||
|
||||
export const searchDocumentTitlesRequest = z.object({
|
||||
queryParams: z
|
||||
.object({
|
||||
search_space_id: z.number().optional(),
|
||||
workspace_id: z.number().optional(),
|
||||
title: z.string().optional(),
|
||||
page: z.number().optional(),
|
||||
page_size: z.number().optional(),
|
||||
})
|
||||
.refine((params) => params.search_space_id !== undefined || params.workspace_id !== undefined, {
|
||||
message: "workspace_id is required",
|
||||
path: ["search_space_id"],
|
||||
}),
|
||||
queryParams: z.object({
|
||||
workspace_id: z.number(),
|
||||
title: z.string().optional(),
|
||||
page: z.number().optional(),
|
||||
page_size: z.number().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const searchDocumentTitlesResponse = z.object({
|
||||
|
|
@ -225,7 +219,7 @@ export const searchDocumentTitlesResponse = z.object({
|
|||
export const getDocumentTypeCountsRequest = z.object({
|
||||
queryParams: z
|
||||
.object({
|
||||
search_space_id: z.number().or(z.string()).optional(),
|
||||
workspace_id: z.number().or(z.string()).optional(),
|
||||
})
|
||||
.nullish(),
|
||||
});
|
||||
|
|
@ -272,7 +266,7 @@ export const getDocumentChunksResponse = z.object({
|
|||
*/
|
||||
export const updateDocumentRequest = z.object({
|
||||
id: z.number(),
|
||||
data: document.pick({ search_space_id: true, document_type: true, content: true }),
|
||||
data: document.pick({ workspace_id: true, document_type: true, content: true }),
|
||||
});
|
||||
|
||||
export const updateDocumentResponse = document;
|
||||
|
|
|
|||
|
|
@ -5,27 +5,19 @@ const folderBase = z.object({
|
|||
name: z.string(),
|
||||
position: z.string(),
|
||||
parent_id: z.number().nullable(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
created_by_id: z.string().nullable().optional(),
|
||||
created_at: z.string(),
|
||||
updated_at: z.string(),
|
||||
metadata: z.record(z.string(), z.any()).nullable().optional(),
|
||||
});
|
||||
|
||||
export const folder = z.preprocess((value) => {
|
||||
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
||||
const record = value as Record<string, unknown>;
|
||||
if (record.search_space_id === undefined && record.workspace_id !== undefined) {
|
||||
return { ...record, search_space_id: record.workspace_id };
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}, folderBase);
|
||||
export const folder = folderBase;
|
||||
|
||||
export const folderCreateRequest = z.object({
|
||||
name: z.string().min(1).max(255),
|
||||
parent_id: z.number().nullable().optional(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
});
|
||||
|
||||
export const folderUpdateRequest = z.object({
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { z } from "zod";
|
|||
export const imageGenerationListItem = z.object({
|
||||
id: z.number(),
|
||||
prompt: z.string(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
created_at: z.string(),
|
||||
is_success: z.boolean(),
|
||||
image_count: z.number().nullish(),
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ export const inboxItemMetadata = z.union([
|
|||
export const inboxItem = z.object({
|
||||
id: z.number(),
|
||||
user_id: z.string(),
|
||||
search_space_id: z.number().nullable(),
|
||||
workspace_id: z.number().nullable(),
|
||||
type: inboxItemTypeEnum,
|
||||
title: z.string(),
|
||||
message: z.string(),
|
||||
|
|
@ -210,7 +210,7 @@ export type NotificationCategory = z.infer<typeof notificationCategory>;
|
|||
*/
|
||||
export const getNotificationsRequest = z.object({
|
||||
queryParams: z.object({
|
||||
search_space_id: z.number().optional(),
|
||||
workspace_id: z.number().optional(),
|
||||
type: inboxItemTypeEnum.optional(),
|
||||
category: notificationCategory.optional(),
|
||||
source_type: z.string().optional(),
|
||||
|
|
@ -260,7 +260,7 @@ export const markAllNotificationsReadResponse = z.object({
|
|||
* Request schema for getting unread count
|
||||
*/
|
||||
export const getUnreadCountRequest = z.object({
|
||||
search_space_id: z.number().optional(),
|
||||
workspace_id: z.number().optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export const invite = z.object({
|
|||
id: z.number(),
|
||||
name: z.string().max(100).nullable().optional(),
|
||||
invite_code: z.string(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
created_by_id: z.string().nullable(),
|
||||
role_id: z.number().nullable(),
|
||||
expires_at: z.string().nullable(),
|
||||
|
|
@ -20,7 +20,7 @@ export const invite = z.object({
|
|||
* Create invite
|
||||
*/
|
||||
export const createInviteRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
data: z.object({
|
||||
name: z.string().max(100).optional(),
|
||||
role_id: z.number().nullable().optional(),
|
||||
|
|
@ -35,7 +35,7 @@ export const createInviteResponse = invite;
|
|||
* Get invites
|
||||
*/
|
||||
export const getInvitesRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
});
|
||||
|
||||
export const getInvitesResponse = z.array(invite);
|
||||
|
|
@ -44,7 +44,7 @@ export const getInvitesResponse = z.array(invite);
|
|||
* Update invite
|
||||
*/
|
||||
export const updateInviteRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
invite_id: z.number(),
|
||||
data: z.object({
|
||||
name: z.string().max(100).optional(),
|
||||
|
|
@ -61,7 +61,7 @@ export const updateInviteResponse = invite;
|
|||
* Delete invite
|
||||
*/
|
||||
export const deleteInviteRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
invite_id: z.number(),
|
||||
});
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ export const getInviteInfoRequest = z.object({
|
|||
});
|
||||
|
||||
export const getInviteInfoResponse = z.object({
|
||||
search_space_name: z.string(),
|
||||
workspace_name: z.string(),
|
||||
role_name: z.string().nullable(),
|
||||
is_valid: z.boolean(),
|
||||
message: z.string().nullable(),
|
||||
|
|
@ -92,8 +92,8 @@ export const acceptInviteRequest = z.object({
|
|||
|
||||
export const acceptInviteResponse = z.object({
|
||||
message: z.string(),
|
||||
search_space_id: z.number(),
|
||||
search_space_name: z.string(),
|
||||
workspace_id: z.number(),
|
||||
workspace_name: z.string(),
|
||||
role_name: z.string().nullable(),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export const log = z.object({
|
|||
source: z.string().nullable().optional(),
|
||||
log_metadata: z.record(z.string(), z.any()).nullable().optional(),
|
||||
created_at: z.string(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
});
|
||||
|
||||
export const logBase = log.omit({ id: true, created_at: true });
|
||||
|
|
@ -27,7 +27,7 @@ export const logBase = log.omit({ id: true, created_at: true });
|
|||
/**
|
||||
* Create log
|
||||
*/
|
||||
export const createLogRequest = logBase.extend({ search_space_id: z.number() });
|
||||
export const createLogRequest = logBase.extend({ workspace_id: z.number() });
|
||||
export const createLogResponse = log;
|
||||
|
||||
/**
|
||||
|
|
@ -48,7 +48,7 @@ export const deleteLogResponse = z.object({
|
|||
* Get logs (list)
|
||||
*/
|
||||
export const logFilters = z.object({
|
||||
search_space_id: z.number().optional(),
|
||||
workspace_id: z.number().optional(),
|
||||
level: logLevelEnum.optional(),
|
||||
status: logStatusEnum.optional(),
|
||||
source: z.string().optional(),
|
||||
|
|
@ -59,7 +59,7 @@ export const logFilters = z.object({
|
|||
export const getLogsRequest = z.object({
|
||||
queryParams: paginationQueryParams
|
||||
.extend({
|
||||
search_space_id: z.number().optional(),
|
||||
workspace_id: z.number().optional(),
|
||||
level: logLevelEnum.optional(),
|
||||
status: logStatusEnum.optional(),
|
||||
source: z.string().optional(),
|
||||
|
|
@ -106,7 +106,7 @@ export const logSummary = z.object({
|
|||
recent_failures: z.array(logFailure),
|
||||
});
|
||||
export const getLogSummaryRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
hours: z.number().optional(),
|
||||
});
|
||||
export const getLogSummaryResponse = logSummary;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export const mcpConnectorRead = z.object({
|
|||
name: z.string(),
|
||||
connector_type: z.literal("MCP_CONNECTOR"),
|
||||
server_config: mcpServerConfig,
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
user_id: z.string(),
|
||||
created_at: z.string(),
|
||||
updated_at: z.string(),
|
||||
|
|
@ -49,7 +49,7 @@ export const mcpConnectorRead = z.object({
|
|||
export const createMCPConnectorRequest = z.object({
|
||||
data: mcpConnectorCreate,
|
||||
queryParams: z.object({
|
||||
search_space_id: z.number().or(z.string()),
|
||||
workspace_id: z.number().or(z.string()),
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ export const updateMCPConnectorRequest = z.object({
|
|||
|
||||
export const getMCPConnectorsRequest = z.object({
|
||||
queryParams: z.object({
|
||||
search_space_id: z.number().or(z.string()),
|
||||
workspace_id: z.number().or(z.string()),
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,38 +1,27 @@
|
|||
import { z } from "zod";
|
||||
import { role } from "./roles.types";
|
||||
|
||||
export const membership = z.preprocess(
|
||||
(value) => {
|
||||
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
||||
const record = value as Record<string, unknown>;
|
||||
if (record.search_space_id === undefined && record.workspace_id !== undefined) {
|
||||
return { ...record, search_space_id: record.workspace_id };
|
||||
}
|
||||
}
|
||||
return value;
|
||||
},
|
||||
z.object({
|
||||
id: z.number(),
|
||||
user_id: z.string(),
|
||||
search_space_id: z.number(),
|
||||
role_id: z.number().nullable(),
|
||||
is_owner: z.boolean(),
|
||||
joined_at: z.string(),
|
||||
created_at: z.string(),
|
||||
role: role.nullable().optional(),
|
||||
user_email: z.string().nullable().optional(),
|
||||
user_display_name: z.string().nullable().optional(),
|
||||
user_avatar_url: z.string().nullable().optional(),
|
||||
user_last_login: z.string().nullable().optional(),
|
||||
user_is_active: z.boolean().nullable().optional(),
|
||||
})
|
||||
);
|
||||
export const membership = z.object({
|
||||
id: z.number(),
|
||||
user_id: z.string(),
|
||||
workspace_id: z.number(),
|
||||
role_id: z.number().nullable(),
|
||||
is_owner: z.boolean(),
|
||||
joined_at: z.string(),
|
||||
created_at: z.string(),
|
||||
role: role.nullable().optional(),
|
||||
user_email: z.string().nullable().optional(),
|
||||
user_display_name: z.string().nullable().optional(),
|
||||
user_avatar_url: z.string().nullable().optional(),
|
||||
user_last_login: z.string().nullable().optional(),
|
||||
user_is_active: z.boolean().nullable().optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Get members
|
||||
*/
|
||||
export const getMembersRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
});
|
||||
|
||||
export const getMembersResponse = z.array(membership);
|
||||
|
|
@ -41,7 +30,7 @@ export const getMembersResponse = z.array(membership);
|
|||
* Update membership
|
||||
*/
|
||||
export const updateMembershipRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
membership_id: z.number(),
|
||||
data: z.object({
|
||||
role_id: z.number().nullable(),
|
||||
|
|
@ -54,7 +43,7 @@ export const updateMembershipResponse = membership;
|
|||
* Delete membership
|
||||
*/
|
||||
export const deleteMembershipRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
membership_id: z.number(),
|
||||
});
|
||||
|
||||
|
|
@ -63,10 +52,10 @@ export const deleteMembershipResponse = z.object({
|
|||
});
|
||||
|
||||
/**
|
||||
* Leave search space
|
||||
* Leave workspace
|
||||
*/
|
||||
export const leaveSearchSpaceRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
});
|
||||
|
||||
export const leaveSearchSpaceResponse = z.object({
|
||||
|
|
@ -77,22 +66,16 @@ export const leaveSearchSpaceResponse = z.object({
|
|||
* Get my access
|
||||
*/
|
||||
export const getMyAccessRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
});
|
||||
|
||||
export const getMyAccessResponse = z
|
||||
.object({
|
||||
workspace_name: z.string(),
|
||||
workspace_id: z.number(),
|
||||
is_owner: z.boolean(),
|
||||
permissions: z.array(z.string()),
|
||||
role_name: z.string().nullable(),
|
||||
})
|
||||
.transform(({ workspace_id, workspace_name, ...rest }) => ({
|
||||
...rest,
|
||||
search_space_id: workspace_id,
|
||||
search_space_name: workspace_name,
|
||||
}));
|
||||
export const getMyAccessResponse = z.object({
|
||||
workspace_name: z.string(),
|
||||
workspace_id: z.number(),
|
||||
is_owner: z.boolean(),
|
||||
permissions: z.array(z.string()),
|
||||
role_name: z.string().nullable(),
|
||||
});
|
||||
|
||||
export type Membership = z.infer<typeof membership>;
|
||||
export type GetMembersRequest = z.infer<typeof getMembersRequest>;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export const connectionRead = z.object({
|
|||
api_key: z.string().nullable().optional(),
|
||||
extra: z.record(z.string(), z.any()).default({}),
|
||||
scope: z.union([connectionScopeEnum, z.string()]),
|
||||
search_space_id: z.number().nullable().optional(),
|
||||
workspace_id: z.number().nullable().optional(),
|
||||
user_id: z.string().nullable().optional(),
|
||||
enabled: z.boolean(),
|
||||
has_api_key: z.boolean(),
|
||||
|
|
@ -57,7 +57,7 @@ export const connectionCreateRequest = z.object({
|
|||
api_key: z.string().nullable().optional(),
|
||||
extra: z.record(z.string(), z.any()).default({}),
|
||||
scope: connectionScopeEnum.default("SEARCH_SPACE"),
|
||||
search_space_id: z.number().nullable().optional(),
|
||||
workspace_id: z.number().nullable().optional(),
|
||||
enabled: z.boolean().default(true),
|
||||
models: z.array(modelSelection).default([]),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ export const podcastDetail = z.object({
|
|||
duration_seconds: z.number().nullable(),
|
||||
error: z.string().nullable(),
|
||||
created_at: z.string(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
thread_id: z.number().nullable(),
|
||||
});
|
||||
export type PodcastDetail = z.infer<typeof podcastDetail>;
|
||||
|
|
@ -162,7 +162,7 @@ export const podcastSummary = z.object({
|
|||
title: z.string(),
|
||||
status: podcastStatus,
|
||||
created_at: z.string(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
thread_id: z.number().nullish(),
|
||||
});
|
||||
export type PodcastSummary = z.infer<typeof podcastSummary>;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export const promptRead = z.object({
|
|||
name: z.string(),
|
||||
prompt: z.string(),
|
||||
mode: z.enum(["transform", "explore"]),
|
||||
search_space_id: z.number().nullable(),
|
||||
workspace_id: z.number().nullable(),
|
||||
is_public: z.boolean(),
|
||||
version: z.number(),
|
||||
created_at: z.string(),
|
||||
|
|
@ -29,7 +29,7 @@ export const promptCreateRequest = z.object({
|
|||
name: z.string().min(1).max(200),
|
||||
prompt: z.string().min(1),
|
||||
mode: z.enum(["transform", "explore"]),
|
||||
search_space_id: z.number().nullable().optional(),
|
||||
workspace_id: z.number().nullable().optional(),
|
||||
is_public: z.boolean().optional(),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export const clonePublicChatRequest = z.object({
|
|||
|
||||
export const clonePublicChatResponse = z.object({
|
||||
thread_id: z.number(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
});
|
||||
|
||||
// Type exports
|
||||
|
|
|
|||
|
|
@ -7,25 +7,17 @@ const roleBase = z.object({
|
|||
permissions: z.array(z.string()),
|
||||
is_default: z.boolean(),
|
||||
is_system_role: z.boolean(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
created_at: z.string(),
|
||||
});
|
||||
|
||||
export const role = z.preprocess((value) => {
|
||||
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
||||
const record = value as Record<string, unknown>;
|
||||
if (record.search_space_id === undefined && record.workspace_id !== undefined) {
|
||||
return { ...record, search_space_id: record.workspace_id };
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}, roleBase);
|
||||
export const role = roleBase;
|
||||
|
||||
/**
|
||||
* Create role
|
||||
*/
|
||||
export const createRoleRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
data: roleBase.pick({
|
||||
name: true,
|
||||
description: true,
|
||||
|
|
@ -40,7 +32,7 @@ export const createRoleResponse = role;
|
|||
* Get roles
|
||||
*/
|
||||
export const getRolesRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
});
|
||||
|
||||
export const getRolesResponse = z.array(role);
|
||||
|
|
@ -49,7 +41,7 @@ export const getRolesResponse = z.array(role);
|
|||
* Get role by ID
|
||||
*/
|
||||
export const getRoleByIdRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
role_id: z.number(),
|
||||
});
|
||||
|
||||
|
|
@ -59,7 +51,7 @@ export const getRoleByIdResponse = role;
|
|||
* Update role
|
||||
*/
|
||||
export const updateRoleRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
role_id: z.number(),
|
||||
data: roleBase
|
||||
.pick({
|
||||
|
|
@ -77,7 +69,7 @@ export const updateRoleResponse = role;
|
|||
* Delete role
|
||||
*/
|
||||
export const deleteRoleRequest = z.object({
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
role_id: z.number(),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export const purchaseStatusEnum = z.enum(["pending", "completed", "failed"]);
|
|||
|
||||
export const createCreditCheckoutSessionRequest = z.object({
|
||||
quantity: z.number().int().min(1).max(10_000),
|
||||
search_space_id: z.number().int().min(1),
|
||||
workspace_id: z.number().int().min(1),
|
||||
});
|
||||
|
||||
export const createCreditCheckoutSessionResponse = z.object({
|
||||
|
|
@ -90,7 +90,7 @@ export const updateAutoReloadSettingsRequest = z.object({
|
|||
});
|
||||
|
||||
export const createAutoReloadSetupSessionRequest = z.object({
|
||||
search_space_id: z.number().int().min(1),
|
||||
workspace_id: z.number().int().min(1),
|
||||
});
|
||||
|
||||
export const createAutoReloadSetupSessionResponse = z.object({
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export const videoPresentationListItem = z.object({
|
|||
title: z.string(),
|
||||
status: videoPresentationStatus.default("ready"),
|
||||
created_at: z.string(),
|
||||
search_space_id: z.number(),
|
||||
workspace_id: z.number(),
|
||||
thread_id: z.number().nullish(),
|
||||
});
|
||||
export type VideoPresentationListItem = z.infer<typeof videoPresentationListItem>;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ export const deleteSearchSpaceResponse = z.object({
|
|||
* Leave search space (for non-owners)
|
||||
*/
|
||||
export const leaveSearchSpaceResponse = z.object({
|
||||
message: z.literal("Successfully left the search space"),
|
||||
message: z.literal("Successfully left the workspace"),
|
||||
});
|
||||
|
||||
// Inferred types
|
||||
Loading…
Add table
Add a link
Reference in a new issue