Skip to content

Commit

Permalink
Dependency updates and other cleanup (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
keturiosakys authored Dec 9, 2024
1 parent 286b4e4 commit 2c1d0ac
Show file tree
Hide file tree
Showing 57 changed files with 4,923 additions and 5,276 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_frontends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ name: Build node packages
on:
pull_request:
branches: ["*"]
paths:
paths:
- "api/**"
- "packages/client-library-otel/**"
- "studio/**"
push:
branches: ["main", "release-*"]
paths:
paths:
- "api/**"
- "packages/client-library-otel/**"
- "studio/**"
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: 1.8.3
version: 1.9.4

- name: Install dependencies
run: pnpm install
Expand Down
2 changes: 1 addition & 1 deletion api/biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"$schema": "../node_modules/@biomejs/biome/configuration_schema.json",
"extends": ["../biome.jsonc"],
"files": {
"ignore": ["dist", "node_modules"]
Expand Down
53 changes: 26 additions & 27 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"dev": "pnpm run db:migrate && tsx watch src/index.node.ts",
"db:generate": "drizzle-kit generate",
"db:migrate": "tsx migrate.ts",
"db:migrate": "drizzle-kit migrate",
"db:drop": "drizzle-kit drop",
"db:seed": "tsx scripts/seed.ts",
"db:studio": "drizzle-kit studio",
Expand All @@ -39,43 +39,42 @@
"fpx": "bin/cli.js"
},
"dependencies": {
"@ai-sdk/anthropic": "^0.0.51",
"@ai-sdk/mistral": "^0.0.42",
"@ai-sdk/openai": "^0.0.66",
"@anthropic-ai/sdk": "^0.24.3",
"@ai-sdk/anthropic": "^1.0.2",
"@ai-sdk/mistral": "^1.0.3",
"@ai-sdk/openai": "^1.0.5",
"@fiberplane/fpx-types": "workspace:*",
"@fiberplane/source-analysis": "workspace:*",
"@hono/node-server": "^1.11.1",
"@hono/zod-validator": "^0.2.2",
"@hono/node-server": "^1.13.7",
"@hono/zod-validator": "^0.4.1",
"@iarna/toml": "^2.2.5",
"@langchain/core": "^0.2.15",
"@libsql/client": "^0.6.2",
"ai": "^3.4.10",
"@langchain/core": "^0.3.19",
"@libsql/client": "^0.14.0",
"ai": "^4.0.7",
"chalk": "^5.3.0",
"consola": "^3.2.3",
"dotenv": "^16.4.5",
"drizzle-kit": "^0.24.2",
"drizzle-orm": "^0.33.0",
"drizzle-kit": "^0.28.1",
"drizzle-orm": "^0.36.4",
"drizzle-zod": "^0.5.1",
"figlet": "^1.7.0",
"hono": "^4.6.5",
"figlet": "^1.8.0",
"hono": "^4.6.12",
"minimatch": "^10.0.1",
"ollama-ai-provider": "^0.15.2",
"openai": "^4.47.1",
"pretty-ms": "^9.1.0",
"ollama-ai-provider": "^1.0.0",
"openai": "^4.73.1",
"pretty-ms": "^9.2.0",
"source-map": "^0.7.4",
"typescript": "^5.5.4",
"ws": "^8.17.1",
"typescript": "^5.7.2",
"ws": "^8.18.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240403.0",
"@opentelemetry/otlp-transformer": "^0.52.1",
"@types/figlet": "^1.5.8",
"@types/node": "^20.11.17",
"@types/ws": "^8.5.10",
"ts-to-zod": "^3.8.5",
"tsx": "^4.10.5",
"vitest": "^1.6.0"
"@cloudflare/workers-types": "^4.20241112.0",
"@opentelemetry/otlp-transformer": "^0.55.0",
"@types/figlet": "^1.7.0",
"@types/node": "^22.10.0",
"@types/ws": "^8.5.13",
"ts-to-zod": "^3.14.1",
"tsx": "^4.19.2",
"vitest": "^2.1.6"
}
}
12 changes: 10 additions & 2 deletions api/src/lib/ai/fp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export async function generateRequestWithFp({
middleware,
middlewareContext,
prompt,
}: GenerateRequestOptions) {
}: GenerateRequestOptions): Promise<{
// biome-ignore lint/suspicious/noExplicitAny: TODO: replace the temporary type cast with a proper return type
data: any;
error?: { message: string } | null;
}> {
logger.debug(
"Generating request data with FP",
`persona: ${persona}`,
Expand Down Expand Up @@ -62,5 +66,9 @@ export async function generateRequestWithFp({
},
});

return response.json();
return response.json() as Promise<{
// biome-ignore lint/suspicious/noExplicitAny: TODO: replace the temporary type cast with a proper return type
data: any;
error?: { message: string } | null;
}>;
}
3 changes: 2 additions & 1 deletion api/src/lib/ai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export async function generateRequestWithAiProvider({
}[];
middlewareContext?: string;
prompt?: string;
}) {
// biome-ignore lint/suspicious/noExplicitAny: TODO: replace the temporary type cast with a proper return type
}): Promise<{ data: any; error?: { message: string } | null }> {
const { aiProviderConfigurations, aiProvider } = inferenceConfig;
const aiEnabled = hasValidAiConfig(inferenceConfig);
if (!aiEnabled) {
Expand Down
10 changes: 8 additions & 2 deletions api/src/lib/fp-services/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export async function getUser(token: string) {
}

if (response.status === 401) {
const errorData = await response.json();
const errorData = (await response.json()) as {
errorType: string;
message: string;
};
switch (errorData?.errorType) {
case ERROR_TYPE_UNAUTHORIZED:
throw new UnauthorizedError();
Expand Down Expand Up @@ -77,7 +80,10 @@ export async function verifyToken(token: string): Promise<unknown> {
});

if (response.status === 401) {
const errorData = await response.json();
const errorData = (await response.json()) as {
errorType: string;
message: string;
};
switch (errorData?.errorType) {
case ERROR_TYPE_UNAUTHORIZED:
throw new UnauthorizedError();
Expand Down
2 changes: 1 addition & 1 deletion api/src/lib/fp-services/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function makeFpAuthRequest({

logger.debug("Making FP Auth request", `method: ${method}`, `path: ${path}`);

const headers: HeadersInit = {
const headers: Required<RequestInit>["headers"] = {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
};
Expand Down
2 changes: 1 addition & 1 deletion api/src/lib/openapi/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function cachedSpecFetch(

// Update cache
specResponseCache.set(url, {
data,
data: data as OpenApiSpec,
timestamp: Date.now(),
});

Expand Down
2 changes: 1 addition & 1 deletion api/src/lib/proxy-request/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function createProxyRequestFromNewAppRequest(
requestHeaders = {};
}

let validBody: BodyInit | null = null;
let validBody: Required<RequestInit>["body"] | null = null;
if (requestBody != null) {
if (
requestBody instanceof Blob ||
Expand Down
5 changes: 1 addition & 4 deletions api/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ export async function serializeRequestBodyForFpxDb(ctx: Context) {
} else if (contentType?.includes("application/x-www-form-urlencoded")) {
const formData = await ctx.req.formData();
requestBody = {};
// @ts-expect-error - MDN says formData does indeed have an entries method :thinking_face:
for (const [key, value] of formData.entries()) {
requestBody[key] = value;
}
Expand Down Expand Up @@ -253,9 +252,7 @@ function serializeFile(file: File): SerializedFile {
};
}

function serializeFormDataValue(
value: FormDataEntryValue,
): string | SerializedFile {
function serializeFormDataValue(value: string | File): string | SerializedFile {
if (value instanceof File) {
return serializeFile(value);
}
Expand Down
6 changes: 3 additions & 3 deletions api/src/routes/traces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ app.get("/v1/traces", async (ctx) => {
if (fpxWorker?.enabled && fpxWorker.baseUrl) {
const response = await fetch(`${fpxWorker.baseUrl}/v1/traces`);
const json = await response.json();
return ctx.json(json);
return ctx.json(json as JSON);
}

const spans = await db.query.otelSpans.findMany({
Expand Down Expand Up @@ -80,7 +80,7 @@ app.get("/v1/traces/:traceId/spans", async (ctx) => {
`${fpxWorker.baseUrl}/v1/traces/${traceId}/spans`,
);
const json = await response.json();
return ctx.json(json);
return ctx.json(json as JSON);
}

const traces = await db
Expand Down Expand Up @@ -123,7 +123,7 @@ app.post("/v1/traces", async (ctx) => {
body: JSON.stringify(body),
});
const json = await response.json();
return ctx.json(json);
return ctx.json(json as JSON);
}

try {
Expand Down
7 changes: 1 addition & 6 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"$schema": "node_modules/@biomejs/biome/configuration_schema.json",
"css": {
"linter": {
"enabled": true
Expand Down Expand Up @@ -94,22 +94,17 @@
"ignore": [
// API related
"meta/*.json",

// Honc code gen playground outputs
"honc-code-gen/outputs/**/*",
"honc-code-gen/storage/**/*",

// Client library and website related
"dist",
"www/",
".astro",

// ignore all tsconfig.json files
"tsconfig.json",

// ignore any test data files
"test-data/*.js"

// Rust code related
// This caused biome to ignore the entire fpx folder
// commenting out for now as we still want to find a way to
Expand Down
8 changes: 4 additions & 4 deletions examples/ai-request-generation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
},
"dependencies": {
"@fiberplane/hono-otel": "workspace:*",
"@langchain/core": "^0.2.18",
"hono": "^4.6.5"
"@langchain/core": "^0.2.36",
"hono": "^4.6.12"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241022.0",
"wrangler": "^3.83.0"
"@cloudflare/workers-types": "^4.20241112.0",
"wrangler": "^3.91.0"
}
}
10 changes: 5 additions & 5 deletions examples/goose-quotes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
},
"dependencies": {
"@fiberplane/hono-otel": "workspace:*",
"@neondatabase/serverless": "^0.10.1",
"@neondatabase/serverless": "^0.10.4",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.35.3",
"hono": "^4.6.5",
"openai": "^4.53.0"
"hono": "^4.6.12",
"openai": "^4.73.1"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241022.0",
"@cloudflare/workers-types": "^4.20241112.0",
"drizzle-kit": "^0.26.2",
"wrangler": "^3.83.0"
"wrangler": "^3.91.0"
},
"homepage": "https://github.com/fiberplane/fpx/examples/goose-quotes#readme"
}
6 changes: 3 additions & 3 deletions examples/goosify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"@fiberplane/hono-otel": "workspace:*",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.35.3",
"hono": "^4.6.5"
"hono": "^4.6.12"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241022.0",
"@cloudflare/workers-types": "^4.20241112.0",
"drizzle-kit": "^0.26.2",
"wrangler": "^3.83.0"
"wrangler": "^3.91.0"
}
}
6 changes: 3 additions & 3 deletions examples/node-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
},
"dependencies": {
"@fiberplane/hono-otel": "workspace:*",
"@hono/node-server": "^1.13.3",
"hono": "^4.6.5"
"@hono/node-server": "^1.13.7",
"hono": "^4.6.12"
},
"devDependencies": {
"@types/node": "^20.11.17",
"@types/node": "^20.17.8",
"tsx": "^4.19.2"
}
}
6 changes: 3 additions & 3 deletions examples/server-side-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"dependencies": {
"@fiberplane/hono-otel": "workspace:*",
"dotenv": "^16.4.5",
"hono": "^4.6.5"
"hono": "^4.6.12"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240821.1",
"wrangler": "^3.83.0"
"@cloudflare/workers-types": "^4.20241112.0",
"wrangler": "^3.91.0"
},
"homepage": "https://github.com/fiberplane/fpx/examples/server-side-events#readme"
}
6 changes: 3 additions & 3 deletions examples/test-static-analysis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"dependencies": {
"@fiberplane/hono-otel": "workspace:*",
"drizzle-orm": "^0.35.3",
"hono": "^4.6.5"
"hono": "^4.6.12"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241022.0",
"@cloudflare/workers-types": "^4.20241112.0",
"drizzle-kit": "^0.26.2",
"wrangler": "^3.83.0"
"wrangler": "^3.91.0"
}
}
Loading

0 comments on commit 2c1d0ac

Please sign in to comment.