fix: apply biome formatting

This commit is contained in:
Ajax Davis 2026-01-14 04:59:53 +10:00
parent e0aa8f9619
commit 002a537764
18 changed files with 115 additions and 57 deletions

View file

@ -533,7 +533,10 @@ export default function CollectionDetailPage(): React.ReactElement {
<h3 className="font-semibold text-amber-900">Set your username to enable MCP</h3>
<p className="text-sm text-amber-700 mt-1">
You need to set a username before you can share this collection as an MCP server.
Your MCP endpoint URL will be: <code className="bg-amber-100 px-1 rounded">tpmjs.com/api/mcp/your-username/{collection.slug}/http</code>
Your MCP endpoint URL will be:{' '}
<code className="bg-amber-100 px-1 rounded">
tpmjs.com/api/mcp/your-username/{collection.slug}/http
</code>
</p>
<Link href="/dashboard/settings/profile" className="inline-block mt-3">
<Button size="sm" variant="secondary">

View file

@ -197,7 +197,8 @@ function ProfileSettingsContent({ isSetupMode }: { isSetupMode: boolean }): Reac
<div>
<p className="font-medium">Complete your account setup</p>
<p className="text-amber-700 mt-1">
Please set your username to complete your account setup. This is required to use MCP endpoints and public profiles.
Please set your username to complete your account setup. This is required to use
MCP endpoints and public profiles.
</p>
</div>
</div>
@ -260,7 +261,11 @@ function ProfileSettingsContent({ isSetupMode }: { isSetupMode: boolean }): Reac
{/* Status indicator */}
<div className="absolute inset-y-0 right-0 pr-3 flex items-center">
{checkingUsername && (
<Icon icon="loader" size="sm" className="animate-spin text-foreground-secondary" />
<Icon
icon="loader"
size="sm"
className="animate-spin text-foreground-secondary"
/>
)}
{!checkingUsername && usernameCheck?.available && (
<Icon icon="check" size="sm" className="text-green-500" />
@ -297,9 +302,7 @@ function ProfileSettingsContent({ isSetupMode }: { isSetupMode: boolean }): Reac
disabled
className="w-full px-3 py-2 border border-border rounded-lg bg-surface-secondary text-foreground-secondary cursor-not-allowed"
/>
<p className="mt-1 text-xs text-foreground-tertiary">
Email cannot be changed
</p>
<p className="mt-1 text-xs text-foreground-tertiary">Email cannot be changed</p>
</div>
{/* MCP URL Preview */}

View file

@ -36,15 +36,11 @@ async function main() {
try {
// Count existing test data
const testAgentCount = await prisma.agent.count({
where: userId
? { userId, uid: { startsWith: 'test-' } }
: { uid: { startsWith: 'test-' } },
where: userId ? { userId, uid: { startsWith: 'test-' } } : { uid: { startsWith: 'test-' } },
});
const testCollectionCount = await prisma.collection.count({
where: userId
? { userId, slug: { startsWith: 'test-' } }
: { slug: { startsWith: 'test-' } },
where: userId ? { userId, slug: { startsWith: 'test-' } } : { slug: { startsWith: 'test-' } },
});
console.log(`Found ${testAgentCount} test agent(s)`);
@ -58,9 +54,7 @@ async function main() {
// Clean up test conversations (depend on agents)
const convDeleteResult = await prisma.conversation.deleteMany({
where: {
agent: userId
? { userId, uid: { startsWith: 'test-' } }
: { uid: { startsWith: 'test-' } },
agent: userId ? { userId, uid: { startsWith: 'test-' } } : { uid: { startsWith: 'test-' } },
},
});
console.log(`Deleted ${convDeleteResult.count} conversation(s)`);
@ -68,9 +62,7 @@ async function main() {
// Clean up agent-tool associations
const agentToolResult = await prisma.agentTool.deleteMany({
where: {
agent: userId
? { userId, uid: { startsWith: 'test-' } }
: { uid: { startsWith: 'test-' } },
agent: userId ? { userId, uid: { startsWith: 'test-' } } : { uid: { startsWith: 'test-' } },
},
});
console.log(`Deleted ${agentToolResult.count} agent-tool association(s)`);
@ -78,18 +70,14 @@ async function main() {
// Clean up agent-collection associations
const agentCollResult = await prisma.agentCollection.deleteMany({
where: {
agent: userId
? { userId, uid: { startsWith: 'test-' } }
: { uid: { startsWith: 'test-' } },
agent: userId ? { userId, uid: { startsWith: 'test-' } } : { uid: { startsWith: 'test-' } },
},
});
console.log(`Deleted ${agentCollResult.count} agent-collection association(s)`);
// Clean up test agents
const agentResult = await prisma.agent.deleteMany({
where: userId
? { userId, uid: { startsWith: 'test-' } }
: { uid: { startsWith: 'test-' } },
where: userId ? { userId, uid: { startsWith: 'test-' } } : { uid: { startsWith: 'test-' } },
});
console.log(`Deleted ${agentResult.count} agent(s)`);
@ -105,9 +93,7 @@ async function main() {
// Clean up test collections
const collResult = await prisma.collection.deleteMany({
where: userId
? { userId, slug: { startsWith: 'test-' } }
: { slug: { startsWith: 'test-' } },
where: userId ? { userId, slug: { startsWith: 'test-' } } : { slug: { startsWith: 'test-' } },
});
console.log(`Deleted ${collResult.count} collection(s)`);

View file

@ -93,7 +93,10 @@ export function createAgentFactory(api: ApiClient, tracker: TestDataTracker) {
/**
* Create multiple test agents
*/
async createMany(count: number, options: CreateAgentOptions = {}): Promise<AgentFactoryResult[]> {
async createMany(
count: number,
options: CreateAgentOptions = {}
): Promise<AgentFactoryResult[]> {
const agents: AgentFactoryResult[] = [];
for (let i = 0; i < count; i++) {
const agent = await this.create({
@ -110,7 +113,9 @@ export function createAgentFactory(api: ApiClient, tracker: TestDataTracker) {
* Get an agent by ID
*/
async get(id: string): Promise<AgentFactoryResult | null> {
const result = await api.get<{ success: boolean; data: AgentFactoryResult }>(`/api/agents/${id}`);
const result = await api.get<{ success: boolean; data: AgentFactoryResult }>(
`/api/agents/${id}`
);
if (!result.ok) {
return null;
}
@ -120,10 +125,7 @@ export function createAgentFactory(api: ApiClient, tracker: TestDataTracker) {
/**
* Update an agent
*/
async update(
id: string,
updates: Partial<CreateAgentOptions>
): Promise<AgentFactoryResult> {
async update(id: string, updates: Partial<CreateAgentOptions>): Promise<AgentFactoryResult> {
const result = await api.patch<{ success: boolean; data: AgentFactoryResult }>(
`/api/agents/${id}`,
updates

View file

@ -14,7 +14,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
import { extractTextFromChunks, findSSEEvent, filterSSEEvents } from '../_helpers/sse-parser';
describe('Agent Conversations Endpoints', () => {

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
interface AgentResponse {
id: string;
@ -66,12 +70,15 @@ describe('Agents CRUD Endpoints', () => {
expect(firstAgent.uid).toBe(uid);
// Create second with same uid - should succeed with modified uid
const result = await ctx.apiKeyClient.post<{ success: boolean; data: { uid: string } }>('/api/agents', {
uid,
name: `Duplicate UID Agent ${Date.now()}`,
provider: 'OPENAI',
modelId: 'gpt-4o-mini',
});
const result = await ctx.apiKeyClient.post<{ success: boolean; data: { uid: string } }>(
'/api/agents',
{
uid,
name: `Duplicate UID Agent ${Date.now()}`,
provider: 'OPENAI',
modelId: 'gpt-4o-mini',
}
);
expect(result.ok).toBe(true);
if (result.ok) {

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
interface CollectionResponse {
id: string;
@ -59,9 +63,12 @@ describe('Collections CRUD Endpoints', () => {
await ctx.factories.collection.create({ name: uniqueName });
// Try to create second with same name
const result = await ctx.apiKeyClient.post<{ success: boolean; error?: { code: string } }>('/api/collections', {
name: uniqueName,
});
const result = await ctx.apiKeyClient.post<{ success: boolean; error?: { code: string } }>(
'/api/collections',
{
name: uniqueName,
}
);
expect(result.ok).toBe(false);
expect(result.status).toBe(409);

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
describe('Health Endpoint', () => {
let ctx: IntegrationTestContext;

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
interface JsonRpcResponse {
jsonrpc: string;

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
interface PublicAgent {
id: string;
@ -126,7 +130,9 @@ describe('Public Agents Endpoints', () => {
});
it('should return 404 for non-existent agent', async () => {
const result = await ctx.publicClient.get('/api/public/agents/nonexistent-user/nonexistent-agent');
const result = await ctx.publicClient.get(
'/api/public/agents/nonexistent-user/nonexistent-agent'
);
expect(result.ok).toBe(false);
expect(result.status).toBe(404);

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
interface PublicCollection {
id: string;

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
describe('Stats Endpoints', () => {
let ctx: IntegrationTestContext;

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
// Skip if CRON_SECRET is not configured
const CRON_SECRET_CONFIGURED = !!process.env.CRON_SECRET;

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
interface ToolResponse {
id: string;

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
interface ToolSearchResult {
id: string;

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
interface UserProfile {
id: string;

View file

@ -9,7 +9,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
interface TpmjsApiKey {
id: string;

View file

@ -5,7 +5,11 @@
*/
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { cleanupTestContext, getTestContext, type IntegrationTestContext } from '../_helpers/test-context';
import {
cleanupTestContext,
getTestContext,
type IntegrationTestContext,
} from '../_helpers/test-context';
interface UsageSummary {
periodType: string;