test(api): close assistant split regression gaps
This commit is contained in:
@@ -3,11 +3,12 @@ import {
|
||||
CreateHolidayCalendarEntrySchema,
|
||||
CreateHolidayCalendarSchema,
|
||||
PreviewResolvedHolidaysSchema,
|
||||
SystemRole,
|
||||
UpdateHolidayCalendarEntrySchema,
|
||||
UpdateHolidayCalendarSchema,
|
||||
} from "@capakraken/shared";
|
||||
import { z } from "zod";
|
||||
import type { ToolContext, ToolDef, ToolExecutor } from "./shared.js";
|
||||
import { withToolAccess, type ToolContext, type ToolDef, type ToolExecutor } from "./shared.js";
|
||||
|
||||
type AssistantToolErrorResult = { error: string };
|
||||
|
||||
@@ -146,7 +147,7 @@ type VacationHolidayDeps = {
|
||||
) => AssistantToolErrorResult | null;
|
||||
};
|
||||
|
||||
export const vacationHolidayReadToolDefinitions: ToolDef[] = [
|
||||
export const vacationHolidayReadToolDefinitions: ToolDef[] = withToolAccess([
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
@@ -262,9 +263,16 @@ export const vacationHolidayReadToolDefinitions: ToolDef[] = [
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
], {
|
||||
list_holiday_calendars: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN],
|
||||
},
|
||||
get_holiday_calendar: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN],
|
||||
},
|
||||
});
|
||||
|
||||
export const vacationHolidayMutationToolDefinitions: ToolDef[] = [
|
||||
export const vacationHolidayMutationToolDefinitions: ToolDef[] = withToolAccess([
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
@@ -378,7 +386,26 @@ export const vacationHolidayMutationToolDefinitions: ToolDef[] = [
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
], {
|
||||
create_holiday_calendar: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN],
|
||||
},
|
||||
update_holiday_calendar: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN],
|
||||
},
|
||||
delete_holiday_calendar: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN],
|
||||
},
|
||||
create_holiday_calendar_entry: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN],
|
||||
},
|
||||
update_holiday_calendar_entry: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN],
|
||||
},
|
||||
delete_holiday_calendar_entry: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN],
|
||||
},
|
||||
});
|
||||
|
||||
export function createVacationHolidayExecutors(
|
||||
deps: VacationHolidayDeps,
|
||||
@@ -530,7 +557,10 @@ export function createVacationHolidayExecutors(
|
||||
}, ctx: ToolContext) {
|
||||
const input = PreviewResolvedHolidaysSchema.parse(params);
|
||||
const caller = deps.createHolidayCalendarCaller(deps.createScopedCallerContext(ctx));
|
||||
return caller.previewResolvedHolidaysDetail(input);
|
||||
return deps.resolveEntityOrAssistantError(
|
||||
() => caller.previewResolvedHolidaysDetail(input),
|
||||
"Country not found with the given criteria.",
|
||||
);
|
||||
},
|
||||
|
||||
async create_holiday_calendar(params: {
|
||||
|
||||
Reference in New Issue
Block a user