Skip to content

Commit d743a2f

Browse files
committed
chore: merge main into release for new releases
2 parents 947c7dd + d91bcaa commit d743a2f

126 files changed

Lines changed: 7368 additions & 1540 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/api/Dockerfile.multistage

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ COPY packages/utils/package.json ./packages/utils/
1414
COPY packages/integration-platform/package.json ./packages/integration-platform/
1515
COPY packages/tsconfig/package.json ./packages/tsconfig/
1616
COPY packages/email/package.json ./packages/email/
17+
COPY packages/company/package.json ./packages/company/
1718

1819
# Copy API package.json
1920
COPY apps/api/package.json ./apps/api/
@@ -34,6 +35,7 @@ COPY packages/utils ./packages/utils
3435
COPY packages/integration-platform ./packages/integration-platform
3536
COPY packages/tsconfig ./packages/tsconfig
3637
COPY packages/email ./packages/email
38+
COPY packages/company ./packages/company
3739

3840
# Copy API source
3941
COPY apps/api ./apps/api
@@ -45,6 +47,7 @@ COPY --from=deps /app/node_modules ./node_modules
4547
RUN cd packages/db && bun run build && cd ../..
4648
RUN cd packages/integration-platform && bun run build && cd ../..
4749
RUN cd packages/email && bun run build && cd ../..
50+
RUN cd packages/company && bun run build && cd ../..
4851

4952
# Generate Prisma client for API (copy schema and generate)
5053
RUN cd packages/db && node scripts/combine-schemas.js && cd ../..
@@ -79,6 +82,7 @@ COPY --from=builder /app/packages/utils ./packages/utils
7982
COPY --from=builder /app/packages/integration-platform ./packages/integration-platform
8083
COPY --from=builder /app/packages/tsconfig ./packages/tsconfig
8184
COPY --from=builder /app/packages/email ./packages/email
85+
COPY --from=builder /app/packages/company ./packages/company
8286

8387
# Copy production node_modules (includes symlinks to workspace packages above)
8488
COPY --from=builder /app/node_modules ./node_modules

apps/api/package.json

Lines changed: 128 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,131 @@
11
{
2-
"name": "@comp/api",
3-
"description": "",
4-
"version": "0.0.1",
5-
"author": "",
6-
"dependencies": {
7-
"@ai-sdk/anthropic": "^2.0.53",
8-
"@ai-sdk/groq": "^2.0.32",
9-
"@ai-sdk/openai": "^2.0.65",
10-
"@aws-sdk/client-s3": "^3.859.0",
11-
"@aws-sdk/client-securityhub": "^3.948.0",
12-
"@aws-sdk/client-sts": "^3.948.0",
13-
"@aws-sdk/s3-request-presigner": "^3.859.0",
14-
"@browserbasehq/sdk": "^2.6.0",
15-
"@browserbasehq/stagehand": "^3.0.5",
16-
"@comp/integration-platform": "workspace:*",
17-
"@mendable/firecrawl-js": "^4.9.3",
18-
"@nestjs/common": "^11.0.1",
19-
"@nestjs/config": "^4.0.2",
20-
"@nestjs/core": "^11.0.1",
21-
"@nestjs/platform-express": "^11.1.5",
22-
"@nestjs/swagger": "^11.2.0",
23-
"@nestjs/throttler": "^6.5.0",
24-
"@prisma/client": "6.18.0",
25-
"@prisma/instrumentation": "^6.13.0",
26-
"@react-email/components": "^0.0.41",
27-
"@trigger.dev/build": "4.0.6",
28-
"@trigger.dev/sdk": "4.0.6",
29-
"@trycompai/db": "1.3.22",
30-
"@trycompai/utils": "1.0.0",
31-
"@trycompai/email": "workspace:*",
32-
"@upstash/redis": "^1.34.2",
33-
"@upstash/vector": "^1.2.2",
34-
"adm-zip": "^0.5.16",
35-
"ai": "^5.0.60",
36-
"archiver": "^7.0.1",
37-
"axios": "^1.12.2",
38-
"better-auth": "^1.3.27",
39-
"class-transformer": "^0.5.1",
40-
"class-validator": "^0.14.2",
41-
"dotenv": "^17.2.3",
42-
"esbuild": "^0.27.1",
43-
"exceljs": "^4.4.0",
44-
"express": "^4.21.2",
45-
"helmet": "^8.1.0",
46-
"jose": "^6.0.12",
47-
"jspdf": "^3.0.3",
48-
"mammoth": "^1.8.0",
49-
"nanoid": "^5.1.6",
50-
"pdf-lib": "^1.17.1",
51-
"playwright-core": "^1.57.0",
52-
"prisma": "6.18.0",
53-
"react": "^19.1.1",
54-
"react-dom": "^19.1.0",
55-
"reflect-metadata": "^0.2.2",
56-
"resend": "^6.4.2",
57-
"rxjs": "^7.8.1",
58-
"safe-stable-stringify": "^2.5.0",
59-
"swagger-ui-express": "^5.0.1",
60-
"xlsx": "^0.18.5",
61-
"zod": "^4.0.14"
62-
},
63-
"devDependencies": {
64-
"@eslint/eslintrc": "^3.2.0",
65-
"@eslint/js": "^9.18.0",
66-
"@nestjs/cli": "^11.0.0",
67-
"@nestjs/schematics": "^11.0.0",
68-
"@nestjs/testing": "^11.0.1",
69-
"@types/adm-zip": "^0.5.7",
70-
"@types/archiver": "^6.0.3",
71-
"@types/express": "^5.0.0",
72-
"@types/jest": "^30.0.0",
73-
"@types/multer": "^1.4.12",
74-
"@types/node": "^24.0.3",
75-
"@types/supertest": "^6.0.2",
76-
"@types/swagger-ui-express": "^4.1.8",
77-
"eslint": "^9.18.0",
78-
"eslint-config-prettier": "^10.0.1",
79-
"eslint-plugin-prettier": "^5.2.2",
80-
"globals": "^16.0.0",
81-
"jest": "^30.0.0",
82-
"prettier": "^3.5.3",
83-
"source-map-support": "^0.5.21",
84-
"supertest": "^7.0.0",
85-
"ts-jest": "^29.2.5",
86-
"ts-loader": "^9.5.2",
87-
"ts-node": "^10.9.2",
88-
"tsconfig-paths": "^4.2.0",
89-
"typescript": "^5.8.3",
90-
"typescript-eslint": "^8.20.0"
91-
},
92-
"jest": {
93-
"moduleFileExtensions": [
94-
"js",
95-
"json",
96-
"ts"
97-
],
98-
"rootDir": "src",
99-
"testRegex": ".*\\.spec\\.ts$",
100-
"transform": {
101-
"^.+\\.(t|j)s$": "ts-jest"
2+
"name": "@comp/api",
3+
"description": "",
4+
"version": "0.0.1",
5+
"author": "",
6+
"dependencies": {
7+
"@ai-sdk/anthropic": "^2.0.53",
8+
"@ai-sdk/groq": "^2.0.32",
9+
"@ai-sdk/openai": "^2.0.65",
10+
"@aws-sdk/client-s3": "^3.859.0",
11+
"@aws-sdk/client-securityhub": "^3.948.0",
12+
"@aws-sdk/client-sts": "^3.948.0",
13+
"@aws-sdk/s3-request-presigner": "^3.859.0",
14+
"@browserbasehq/sdk": "^2.6.0",
15+
"@browserbasehq/stagehand": "^3.0.5",
16+
"@comp/company": "workspace:*",
17+
"@comp/integration-platform": "workspace:*",
18+
"@mendable/firecrawl-js": "^4.9.3",
19+
"@nestjs/common": "^11.0.1",
20+
"@nestjs/config": "^4.0.2",
21+
"@nestjs/core": "^11.0.1",
22+
"@nestjs/platform-express": "^11.1.5",
23+
"@nestjs/swagger": "^11.2.0",
24+
"@nestjs/throttler": "^6.5.0",
25+
"@prisma/client": "6.18.0",
26+
"@prisma/instrumentation": "^6.13.0",
27+
"@react-email/components": "^0.0.41",
28+
"@trigger.dev/build": "4.0.6",
29+
"@trigger.dev/sdk": "4.0.6",
30+
"@trycompai/db": "1.3.22",
31+
"@trycompai/email": "workspace:*",
32+
"@upstash/redis": "^1.34.2",
33+
"@upstash/vector": "^1.2.2",
34+
"adm-zip": "^0.5.16",
35+
"ai": "^5.0.60",
36+
"archiver": "^7.0.1",
37+
"axios": "^1.12.2",
38+
"better-auth": "^1.3.27",
39+
"class-transformer": "^0.5.1",
40+
"class-validator": "^0.14.2",
41+
"dotenv": "^17.2.3",
42+
"esbuild": "^0.27.1",
43+
"exceljs": "^4.4.0",
44+
"express": "^4.21.2",
45+
"helmet": "^8.1.0",
46+
"jose": "^6.0.12",
47+
"jspdf": "^3.0.3",
48+
"mammoth": "^1.8.0",
49+
"nanoid": "^5.1.6",
50+
"pdf-lib": "^1.17.1",
51+
"playwright-core": "^1.57.0",
52+
"prisma": "6.18.0",
53+
"react": "^19.1.1",
54+
"react-dom": "^19.1.0",
55+
"reflect-metadata": "^0.2.2",
56+
"resend": "^6.4.2",
57+
"rxjs": "^7.8.1",
58+
"safe-stable-stringify": "^2.5.0",
59+
"swagger-ui-express": "^5.0.1",
60+
"xlsx": "^0.18.5",
61+
"zod": "^4.0.14"
10262
},
103-
"collectCoverageFrom": [
104-
"**/*.(t|j)s"
105-
],
106-
"coverageDirectory": "../coverage",
107-
"testEnvironment": "node"
108-
},
109-
"license": "UNLICENSED",
110-
"private": true,
111-
"scripts": {
112-
"build": "nest build",
113-
"build:docker": "bunx prisma generate && nest build",
114-
"db:generate": "bun run db:getschema && bunx prisma generate",
115-
"db:getschema": "node ../../packages/db/scripts/combine-schemas.js && cp ../../packages/db/dist/schema.prisma prisma/schema.prisma",
116-
"db:migrate": "cd ../../packages/db && bunx prisma migrate dev && cd ../../apps/api",
117-
"deploy:trigger-prod": "npx trigger.dev@4.0.6 deploy",
118-
"dev": "bunx concurrently --kill-others --names \"nest,trigger\" --prefix-colors \"green,blue\" \"nest start --watch\" \"bunx trigger.dev@4.0.6 dev\"",
119-
"dev:nest": "nest start --watch",
120-
"dev:trigger": "bunx trigger.dev@4.0.6 dev",
121-
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
122-
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
123-
"prebuild": "bun run db:generate",
124-
"start": "nest start",
125-
"start:debug": "nest start --debug --watch",
126-
"start:dev": "nest start --watch",
127-
"start:prod": "node dist/main",
128-
"test": "jest",
129-
"test:cov": "jest --coverage",
130-
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
131-
"test:e2e": "jest --config ./test/jest-e2e.json",
132-
"test:watch": "jest --watch",
133-
"typecheck": "tsc --noEmit"
134-
}
63+
"devDependencies": {
64+
"@eslint/eslintrc": "^3.2.0",
65+
"@eslint/js": "^9.18.0",
66+
"@nestjs/cli": "^11.0.0",
67+
"@nestjs/schematics": "^11.0.0",
68+
"@nestjs/testing": "^11.0.1",
69+
"@types/adm-zip": "^0.5.7",
70+
"@types/archiver": "^6.0.3",
71+
"@types/express": "^5.0.0",
72+
"@types/jest": "^30.0.0",
73+
"@types/multer": "^1.4.12",
74+
"@types/node": "^24.0.3",
75+
"@types/supertest": "^6.0.2",
76+
"@types/swagger-ui-express": "^4.1.8",
77+
"eslint": "^9.18.0",
78+
"eslint-config-prettier": "^10.0.1",
79+
"eslint-plugin-prettier": "^5.2.2",
80+
"globals": "^16.0.0",
81+
"jest": "^30.0.0",
82+
"prettier": "^3.5.3",
83+
"source-map-support": "^0.5.21",
84+
"supertest": "^7.0.0",
85+
"ts-jest": "^29.2.5",
86+
"ts-loader": "^9.5.2",
87+
"ts-node": "^10.9.2",
88+
"tsconfig-paths": "^4.2.0",
89+
"typescript": "^5.8.3",
90+
"typescript-eslint": "^8.20.0"
91+
},
92+
"jest": {
93+
"moduleFileExtensions": [
94+
"js", "json", "ts"
95+
],
96+
"rootDir": "src",
97+
"testRegex": ".*\\.spec\\.ts$",
98+
"transform": {
99+
"^.+\\.(t|j)s$": "ts-jest"
100+
},
101+
"collectCoverageFrom": ["**/*.(t|j)s"],
102+
"coverageDirectory": "../coverage",
103+
"testEnvironment": "node"
104+
},
105+
"license": "UNLICENSED",
106+
"private": true,
107+
"scripts": {
108+
"build": "nest build",
109+
"build:docker": "bunx prisma generate && nest build",
110+
"db:generate": "bun run db:getschema && bunx prisma generate",
111+
"db:getschema": "node ../../packages/db/scripts/combine-schemas.js && cp ../../packages/db/dist/schema.prisma prisma/schema.prisma",
112+
"db:migrate": "cd ../../packages/db && bunx prisma migrate dev && cd ../../apps/api",
113+
"deploy:trigger-prod": "npx trigger.dev@4.0.6 deploy",
114+
"dev": "bunx concurrently --kill-others --names \"nest,trigger\" --prefix-colors \"green,blue\" \"nest start --watch\" \"bunx trigger.dev@4.0.6 dev\"",
115+
"dev:nest": "nest start --watch",
116+
"dev:trigger": "bunx trigger.dev@4.0.6 dev",
117+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
118+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
119+
"prebuild": "bun run db:generate",
120+
"start": "nest start",
121+
"start:debug": "nest start --debug --watch",
122+
"start:dev": "nest start --watch",
123+
"start:prod": "node dist/main",
124+
"test": "jest",
125+
"test:cov": "jest --coverage",
126+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
127+
"test:e2e": "jest --config ./test/jest-e2e.json",
128+
"test:watch": "jest --watch",
129+
"typecheck": "tsc --noEmit"
130+
}
135131
}

apps/api/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { TaskManagementModule } from './task-management/task-management.module';
3535
import { AssistantChatModule } from './assistant-chat/assistant-chat.module';
3636
import { OrgChartModule } from './org-chart/org-chart.module';
3737
import { TrainingModule } from './training/training.module';
38+
import { EvidenceFormsModule } from './evidence-forms/evidence-forms.module';
3839

3940
@Module({
4041
imports: [
@@ -82,6 +83,7 @@ import { TrainingModule } from './training/training.module';
8283
AssistantChatModule,
8384
TrainingModule,
8485
OrgChartModule,
86+
EvidenceFormsModule,
8587
],
8688
controllers: [AppController],
8789
providers: [

apps/api/src/devices/devices.service.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,42 @@
11
import { Injectable, NotFoundException, Logger } from '@nestjs/common';
22
import { db } from '@trycompai/db';
3-
import { mergeDeviceLists } from '@trycompai/utils/devices';
43
import { FleetService } from '../lib/fleet.service';
54
import { DeviceResponseDto } from './dto/device-responses.dto';
65
import type { MemberResponseDto } from './dto/member-responses.dto';
76

7+
/**
8+
* Merges two device lists, deduplicating by serial number and hostname.
9+
* Priority devices (first argument) take precedence over secondary devices.
10+
*/
11+
function mergeDeviceLists<T>(
12+
priorityDevices: T[],
13+
secondaryDevices: T[],
14+
accessors: {
15+
getSerialNumber: (device: T) => string | null | undefined;
16+
getHostname: (device: T) => string | null | undefined;
17+
},
18+
): T[] {
19+
const knownSerials = new Set<string>();
20+
const knownHostnames = new Set<string>();
21+
22+
for (const device of priorityDevices) {
23+
const serial = accessors.getSerialNumber(device);
24+
const hostname = accessors.getHostname(device);
25+
if (serial) knownSerials.add(serial.toLowerCase());
26+
if (hostname) knownHostnames.add(hostname.toLowerCase());
27+
}
28+
29+
const uniqueSecondaryDevices = secondaryDevices.filter((device) => {
30+
const serial = accessors.getSerialNumber(device);
31+
const hostname = accessors.getHostname(device);
32+
if (serial && knownSerials.has(serial.toLowerCase())) return false;
33+
if (hostname && knownHostnames.has(hostname.toLowerCase())) return false;
34+
return true;
35+
});
36+
37+
return [...priorityDevices, ...uniqueSecondaryDevices];
38+
}
39+
840
/**
941
* Hybrid device service that fetches from both FleetDM and the Device Agent database.
1042
* FleetDM is the legacy system; Device Agent is the new system.

0 commit comments

Comments
 (0)