Files
zeekay 40d120dbf7 refactor(api): say /v1/ in the Python callers
Every first-party Python caller and test now names the mount the API actually
answers on. Mechanical: URL literals only, and only where the /api/ was ours --
a preceding word character means it was a module path like insights/api/ or a
third-party host like slack.com/api/, and those are untouched.

Left saying /api/, each for a reason rather than for safety:
- products/warehouse_sources/.../sources/** is a catalogue of vendor endpoints
- services/llm-gateway deploys separately and is under a code freeze, so moving
  its two calls would break it during the skew
- the mcp_store and Slack/Teams redirect_uris are registered with third parties
  and must byte-match what was registered
- the Wizard and Raycast client-metadata paths are OAuth client_ids
- /api/surveys and /api/feature_flag/local_evaluation are SDK aliases the
  ingress routes to the Rust fleets, held by released SDK versions

Test URLconfs moved with the requests that call them, and the Datastore
user-selection fixtures now carry the leading slash that request.path has.
2026-08-08 18:38:44 -07:00

68 lines
2.5 KiB
Plaintext

// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`generateToolCode with input_schema > applies enrich_url with input_schema 1`] = `
"
const ThingsCreateSchema = ThingCreateSchema
const thingsCreate = (): ToolBase<typeof ThingsCreateSchema, unknown> => ({
name: 'things-create',
schema: ThingsCreateSchema,
handler: async (context: Context, params: z.infer<typeof ThingsCreateSchema>) => {
const projectId = await context.stateManager.getProjectId()
const parsedParams = ThingsCreateSchema.parse(params)
const result = await context.api.request<unknown>({
method: 'POST',
path: \`/v1/projects/\${encodeURIComponent(String(projectId))}/things/\`,
body: parsedParams,
})
return await withInsightsUrl(context, result, \`/things/\${result.id}\`)
},
})
"
`;
exports[`generateToolCode with input_schema > applies list enrichment with input_schema 1`] = `
"
const ThingsListSchema = ThingListSchema
const thingsList = (): ToolBase<typeof ThingsListSchema, unknown> => ({
name: 'things-list',
schema: ThingsListSchema,
handler: async (context: Context, params: z.infer<typeof ThingsListSchema>) => {
const projectId = await context.stateManager.getProjectId()
const parsedParams = ThingsListSchema.parse(params)
const result = await context.api.request<unknown>({
method: 'GET',
path: \`/v1/projects/\${encodeURIComponent(String(projectId))}/things/\`,
query: parsedParams,
})
return await withInsightsUrl(context, {
...result,
results: await Promise.all((result.results ?? []).map((item) => withInsightsUrl(context, item, \`/things/\${item.id}\`))),
}, '/things')
},
})
"
`;
exports[`generateToolCode with input_schema > uses custom schema import when input_schema is set 1`] = `
"
const ThingsCreateSchema = ThingCreateSchema
const thingsCreate = (): ToolBase<typeof ThingsCreateSchema, unknown> => ({
name: 'things-create',
schema: ThingsCreateSchema,
handler: async (context: Context, params: z.infer<typeof ThingsCreateSchema>) => {
const projectId = await context.stateManager.getProjectId()
const parsedParams = ThingsCreateSchema.parse(params)
const result = await context.api.request<unknown>({
method: 'POST',
path: \`/v1/projects/\${encodeURIComponent(String(projectId))}/things/\`,
body: parsedParams,
})
return result
},
})
"
`;