mirror of https://github.com/buster-so/buster.git
scope down more types
This commit is contained in:
parent
4c8875b7c6
commit
6bcd9e7b9e
|
@ -1,9 +1,10 @@
|
||||||
|
import type { AssetType } from '@buster/server-shared/assets';
|
||||||
import type { BusterSearchResult } from '@/api/asset_interfaces/search';
|
import type { BusterSearchResult } from '@/api/asset_interfaces/search';
|
||||||
import { mainApi } from '../instances';
|
import { mainApi } from '../instances';
|
||||||
|
|
||||||
export const search = async (params: {
|
export const search = async (params: {
|
||||||
query: string;
|
query: string;
|
||||||
asset_types: ('dashboard_file' | 'metric_file' | 'collection')[];
|
asset_types: Extract<AssetType, 'dashboard_file' | 'metric_file' | 'collection'>[];
|
||||||
num_results?: number;
|
num_results?: number;
|
||||||
}) => {
|
}) => {
|
||||||
return mainApi.post<BusterSearchResult[]>('/search', params).then((res) => res.data);
|
return mainApi.post<BusterSearchResult[]>('/search', params).then((res) => res.data);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AssetType } from '@buster/database';
|
import type { AssetType } from '@buster/database/schema-types';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
// Internal types for asset permissions
|
// Internal types for asset permissions
|
||||||
|
@ -7,12 +7,7 @@ export const IdentityTypeSchema = z.enum(['user', 'team', 'organization']);
|
||||||
export type IdentityType = z.infer<typeof IdentityTypeSchema>;
|
export type IdentityType = z.infer<typeof IdentityTypeSchema>;
|
||||||
|
|
||||||
// Types that support cascading permissions
|
// Types that support cascading permissions
|
||||||
export type CascadingAssetType =
|
export type CascadingAssetType = AssetType;
|
||||||
| 'chat'
|
|
||||||
| 'metric_file'
|
|
||||||
| 'dashboard_file'
|
|
||||||
| 'report_file'
|
|
||||||
| 'collection';
|
|
||||||
|
|
||||||
// Permission roles - matching database AssetPermissionRole enum
|
// Permission roles - matching database AssetPermissionRole enum
|
||||||
export const AssetPermissionRoleSchema = z.enum([
|
export const AssetPermissionRoleSchema = z.enum([
|
||||||
|
|
|
@ -94,10 +94,7 @@ export function createDoneToolStart(context: DoneToolContext, doneToolState: Don
|
||||||
try {
|
try {
|
||||||
await updateChat(context.chatId, {
|
await updateChat(context.chatId, {
|
||||||
mostRecentFileId: mostRecentFile.id,
|
mostRecentFileId: mostRecentFile.id,
|
||||||
mostRecentFileType: mostRecentFile.fileType as
|
mostRecentFileType: mostRecentFile.fileType,
|
||||||
| 'metric_file'
|
|
||||||
| 'dashboard_file'
|
|
||||||
| 'report_file',
|
|
||||||
mostRecentVersionNumber: mostRecentFile.versionNumber || 1,
|
mostRecentVersionNumber: mostRecentFile.versionNumber || 1,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue