Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
{
"name": "@databuddy/api",
"private": true,
"version": "1.0.1",
"module": "index.ts",
"type": "module",
"private": true,
"scripts": {
"dev": "NODE_ENV=development dotenv -- bun --hot src/index.ts --port 3001",
"test": "TZ=UTC bunx --bun vitest run",
"test:watch": "TZ=UTC bunx --bun vitest"
},
"devDependencies": {
"@databuddy/test": "workspace:*",
"@types/bun": "^1.3.6",
"mitata": "^1.0.34",
"vitest": "^4.1.5"
},
"peerDependencies": {
"typescript": "^5.9.3"
},
"dependencies": {
"@ai-sdk/provider": "^3.0.5",
"@contextcompany/otel": "^1.0.13",
Expand Down Expand Up @@ -57,5 +47,14 @@
"svix": "^1.84.1",
"tokenlens": "catalog:",
"zod": "catalog:"
},
"devDependencies": {
"@databuddy/test": "workspace:*",
"@types/bun": "^1.3.6",
"mitata": "^1.0.34",
"vitest": "^4.1.5"
},
"peerDependencies": {
"typescript": "^5.9.3"
}
}
31 changes: 9 additions & 22 deletions apps/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
{
"extends": "../../tsconfig/default.json",
"compilerOptions": {
"lib": ["ESNext"],
"target": "ESNext",
"module": "esnext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
"noUncheckedIndexedAccess": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"],
"references": [
{ "path": "../../packages/db" },
{ "path": "../../packages/redis" },
{ "path": "../../packages/sdk" },
{ "path": "../../packages/shared" }
"exclude": [
"node_modules",
"dist",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts",
"**/*.spec.tsx"
]
}
8 changes: 5 additions & 3 deletions apps/basket/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "@databuddy/basket",
"private": true,
"version": "1.0.50",
"packageManager": "bun@1.3.0",
"type": "module",
"scripts": {
"dev": "NODE_ENV=development bun --watch run src/index.ts",
"start": "bun run src/index.ts",
"test": "vitest run",
"test:watch": "vitest"
"test:watch": "vitest",
"check-types": "tsc --noEmit"
},
"dependencies": {
"@clickhouse/client": "^1.14.0",
Expand All @@ -31,5 +33,5 @@
"bun-types": "^1.3.4",
"vitest": "^4.1.4"
},
"module": "src/index.js"
"packageManager": "bun@1.3.0"
}
2 changes: 1 addition & 1 deletion apps/basket/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const app = new Elysia()
.use(stripeWebhook)
.use(paddleWebhook)
.get("/health/status", async function basketHealthStatus() {
const { clickHouseOG } = await import("@databuddy/db");
const { clickHouseOG } = await import("@databuddy/db/clickhouse");
const { Kafka } = await import("kafkajs");

async function ping(probe: () => Promise<void>) {
Expand Down
2 changes: 1 addition & 1 deletion apps/basket/src/lib/producer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ const runtime = ManagedRuntime.make(ProducerLive);
const withFx = <A, E>(
fn: (f: NonNullable<typeof fx>) => Effect.Effect<A, E>
): Effect.Effect<A | undefined, E> =>
Effect.suspend(() => (fx ? fn(fx) : Effect.void));
Effect.suspend(() => (fx ? fn(fx) : Effect.succeed(undefined)));

export const send = (topic: string, event: unknown, key?: string) =>
withFx((f) => f.sendOne(topic, event, key));
Expand Down
4 changes: 3 additions & 1 deletion apps/basket/src/utils/ip-geo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import { createError, EvlogError, log } from "evlog";
import { useLogger } from "evlog/elysia";

if (!process.env.IP_HASH_SALT && process.env.NODE_ENV === "production") {
log.warn("IP_HASH_SALT is not set — IP hashes will use an insecure default");
log.warn({
message: "IP_HASH_SALT is not set — IP hashes will use an insecure default",
});
}

interface GeoIPReader extends Reader {
Expand Down
25 changes: 9 additions & 16 deletions apps/basket/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
{
"extends": "../../tsconfig/default.json",
"compilerOptions": {
"target": "ES2021",
"module": "ES2022",
"moduleResolution": "bundler",
"baseUrl": "src",
"paths": {
"@lib/*": ["./lib/*"],
"@utils/*": ["./utils/*"],
"@hooks/*": ["./hooks/*"],
"@routes/*": ["./routes/*"],
"@types/*": ["./types/*"]
},
"types": ["bun-types", "autumn-js"],
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"noEmit": true
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"],
"references": [
{ "path": "../../packages/db" },
{ "path": "../../packages/redis" },
{ "path": "../../packages/shared" },
{ "path": "../../packages/validation" }
"exclude": [
"node_modules",
"dist",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts",
"**/*.spec.tsx"
]
}
35 changes: 6 additions & 29 deletions apps/dashboard/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
{
"extends": "../../tsconfig/next.json",
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"],
"@lib/*": ["./lib/*"],
Expand All @@ -41,16 +24,10 @@
"dist",
".turbo",
".turbo",
"**/node_modules"
],
"skipLibCheck": true,
"noImplicitAny": false,
"incremental": true,
"references": [
{ "path": "../../packages/db" },
{ "path": "../../packages/redis" },
{ "path": "../../packages/sdk" },
{ "path": "../../packages/shared" },
{ "path": "../../packages/validation" }
"**/node_modules",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts",
"**/*.spec.tsx"
]
}
3 changes: 2 additions & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"dev": "next dev --turbo -p 3005",
"start": "next start -p 3005",
"postinstall": "fumadocs-mdx",
"lint:links": "bun ./scripts/validate-links.ts"
"lint:links": "bun ./scripts/validate-links.ts",
"check-types": "tsc --noEmit"
},
"dependencies": {
"@databuddy/sdk": "workspace:*",
Expand Down
32 changes: 8 additions & 24 deletions apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
{
"extends": "../../tsconfig/next.json",
"compilerOptions": {
"baseUrl": ".",
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"paths": {
"fumadocs-mdx:collections/*": [".source/*"],
"@/*": ["./*"]
},
"plugins": [
{
"name": "next"
}
]
}
},
"include": [
"next-env.d.ts",
Expand All @@ -32,9 +14,11 @@
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": ["node_modules"],
"references": [
{ "path": "../../packages/sdk" },
{ "path": "../../packages/shared" }
"exclude": [
"node_modules",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts",
"**/*.spec.tsx"
]
}
3 changes: 2 additions & 1 deletion apps/links/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"dev": "bun --watch run src/index.ts",
"build": "bun build src/index.ts --compile --target bun --outfile dist/server --minify-syntax --minify-whitespace",
"start": "./dist/server"
"start": "./dist/server",
"check-types": "tsc --noEmit"
},
"dependencies": {
"@databuddy/db": "workspace:*",
Expand Down
21 changes: 9 additions & 12 deletions apps/links/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"compilerOptions": {
"target": "ES2021",
"module": "ES2022",
"moduleResolution": "bundler",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"noEmit": true
},
"extends": "../../tsconfig/default.json",
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"],
"references": [{ "path": "../../packages/db" }]
"exclude": [
"node_modules",
"dist",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts",
"**/*.spec.tsx"
]
}
1 change: 1 addition & 0 deletions apps/slack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@databuddy/encryption": "workspace:*",
"@databuddy/env": "workspace:*",
"@databuddy/redis": "workspace:*",
"@databuddy/rpc": "workspace:*",
"@slack/bolt": "^4.7.2",
"@slack/web-api": "^7.15.1",
"evlog": "catalog:"
Expand Down
46 changes: 27 additions & 19 deletions apps/slack/src/agent/agent-client.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import { describe, expect, it, mock } from "bun:test";
import type { SlackAgentRun, SlackRunContext } from "./agent-client";
import { describe, expect, it } from "bun:test";
import type { SlackAgentRun, SlackRunContext } from "@/agent/agent-client";

let capturedSharedAgentOptions: Record<string, unknown> | null = null;

mock.module("@databuddy/ai/agent", () => ({
classifySlackThreadReplyRelevance: async () => null,
streamDatabuddyAgent: async function* (options: Record<string, unknown>) {
capturedSharedAgentOptions = options;
yield "Done";
},
}));

const {
import {
createSlackConversationId,
createSlackMemoryUserId,
DatabuddyAgentClient,
formatSlackAgentInput,
} = await import("./agent-client");
} from "./agent-client";

function expectCapturedSharedAgentOptions(): Record<string, unknown> {
if (!capturedSharedAgentOptions) {
Expand Down Expand Up @@ -56,13 +48,29 @@ describe("Databuddy Slack agent client", () => {

it("passes Slack user-scoped memory identity to the shared agent", async () => {
capturedSharedAgentOptions = null;
const client = new DatabuddyAgentClient({
resolve: async () => ({
agentApiKeySecret: "dbdy_secret",
organizationId: "org_123",
teamId: "T123",
}),
});
const client = new DatabuddyAgentClient(
{
resolve: async () => ({
agentApiKeySecret: "dbdy_secret",
organizationId: "org_123",
teamId: "T123",
}),
},
{
async *stream(_run, _context, options) {
capturedSharedAgentOptions = {
...options,
actor: {
type: "api_key_secret",
userId: null,
},
input: formatSlackAgentInput(_run),
memoryUserId: createSlackMemoryUserId(_run),
};
yield "Done";
},
}
);

const chunks: string[] = [];
for await (const chunk of client.stream({
Expand Down
Loading
Loading