Skip to content

Commit 1d3ca79

Browse files
authored
chore(deps): audit and clean up dependencies (#4531)
* chore(deps): audit and clean up dependencies - Remove unused: chalk, chart.js, dotenv, encoding, entities, thread-stream, uuid, @opentelemetry/exporter-jaeger, critters, marked, redis, soap - Replace soap with hand-rolled Workday SOAP client - Migrate marked to unified pipeline for inbox responses - Bump zustand v5, @react-email/* - Align all @aws-sdk/* to 3.1032.0 - Move type-only deps to devDependencies - Remove duplicate drizzle-orm/postgres overrides * fix(workday): coerce SOAP scalar strings to typed booleans/numbers - XML parser returns leaf text as strings; `!"false"` evaluated to `false`, causing all organizations to report `isActive: false` - Add parseSoapBoolean and parseSoapNumber helpers and apply at consumer sites (Inactive, Total_Results) - Drop unused service/soapAction fields from WD_OPERATIONS map * fix(workday): coerce compensation amounts and guard Date marshaling - get-compensation returned Amount/Per_Unit_Amount/Individual_Target_Amount as strings (XML leaf text), violating the tool's number contract - Coerce via parseSoapNumber and widen plan type to number | string - Add defensive Date branch in marshal() so Date inputs serialize as ISO 8601 instead of String(date)
1 parent cb3a876 commit 1d3ca79

9 files changed

Lines changed: 726 additions & 695 deletions

File tree

apps/sim/app/api/tools/workday/get-compensation/route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
createWorkdaySoapClient,
1010
extractRefId,
1111
normalizeSoapArray,
12+
parseSoapNumber,
1213
type WorkdayCompensationDataSoap,
1314
type WorkdayCompensationPlanSoap,
1415
type WorkdayWorkerSoap,
@@ -60,7 +61,11 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
6061
const mapPlan = (p: WorkdayCompensationPlanSoap) => ({
6162
id: extractRefId(p.Compensation_Plan_Reference) ?? null,
6263
planName: p.Compensation_Plan_Reference?.attributes?.Descriptor ?? null,
63-
amount: p.Amount ?? p.Per_Unit_Amount ?? p.Individual_Target_Amount ?? null,
64+
amount:
65+
parseSoapNumber(p.Amount) ??
66+
parseSoapNumber(p.Per_Unit_Amount) ??
67+
parseSoapNumber(p.Individual_Target_Amount) ??
68+
null,
6469
currency: extractRefId(p.Currency_Reference) ?? null,
6570
frequency: extractRefId(p.Frequency_Reference) ?? null,
6671
})

apps/sim/app/api/tools/workday/get-organizations/route.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
createWorkdaySoapClient,
1010
extractRefId,
1111
normalizeSoapArray,
12+
parseSoapBoolean,
13+
parseSoapNumber,
1214
type WorkdayOrganizationSoap,
1315
} from '@/tools/workday/soap'
1416

@@ -63,15 +65,18 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
6365
| undefined
6466
)
6567

66-
const organizations = orgsArray.map((o) => ({
67-
id: extractRefId(o.Organization_Reference) ?? null,
68-
descriptor: o.Organization_Descriptor ?? null,
69-
type: extractRefId(o.Organization_Data?.Organization_Type_Reference) ?? null,
70-
subtype: extractRefId(o.Organization_Data?.Organization_Subtype_Reference) ?? null,
71-
isActive: o.Organization_Data?.Inactive != null ? !o.Organization_Data.Inactive : null,
72-
}))
68+
const organizations = orgsArray.map((o) => {
69+
const inactive = parseSoapBoolean(o.Organization_Data?.Inactive)
70+
return {
71+
id: extractRefId(o.Organization_Reference) ?? null,
72+
descriptor: o.Organization_Descriptor ?? null,
73+
type: extractRefId(o.Organization_Data?.Organization_Type_Reference) ?? null,
74+
subtype: extractRefId(o.Organization_Data?.Organization_Subtype_Reference) ?? null,
75+
isActive: inactive == null ? null : !inactive,
76+
}
77+
})
7378

74-
const total = result?.Response_Results?.Total_Results ?? organizations.length
79+
const total = parseSoapNumber(result?.Response_Results?.Total_Results) ?? organizations.length
7580

7681
return NextResponse.json({
7782
success: true,

apps/sim/app/api/tools/workday/list-workers/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
createWorkdaySoapClient,
1010
extractRefId,
1111
normalizeSoapArray,
12+
parseSoapNumber,
1213
type WorkdayWorkerSoap,
1314
} from '@/tools/workday/soap'
1415

@@ -61,7 +62,7 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
6162
employmentData: w.Worker_Data?.Employment_Data ?? null,
6263
}))
6364

64-
const total = result?.Response_Results?.Total_Results ?? workers.length
65+
const total = parseSoapNumber(result?.Response_Results?.Total_Results) ?? workers.length
6566

6667
return NextResponse.json({
6768
success: true,

apps/sim/lib/mothership/inbox/response.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { createLogger } from '@sim/logger'
2-
import { marked } from 'marked'
2+
import { toHtml } from 'hast-util-to-html'
3+
import remarkBreaks from 'remark-breaks'
4+
import remarkGfm from 'remark-gfm'
5+
import remarkParse from 'remark-parse'
6+
import remarkRehype from 'remark-rehype'
7+
import { unified } from 'unified'
38
import { getBaseUrl } from '@/lib/core/utils/urls'
49
import * as agentmail from '@/lib/mothership/inbox/agentmail-client'
510
import { replaceUntilStable } from '@/lib/mothership/inbox/format'
@@ -37,7 +42,7 @@ export async function sendInboxResponse(
3742
: `I wasn't able to complete this task.\n\nError: ${result.error || 'Unknown error'}\n\n[View details](${chatUrl})\n\nBest,\nMothership`
3843

3944
const html = result.success
40-
? renderEmailHtml(result.content, chatUrl)
45+
? await renderEmailHtml(result.content, chatUrl)
4146
: renderErrorHtml(result.error || 'Unknown error', chatUrl)
4247

4348
try {
@@ -93,8 +98,20 @@ function stripUnsafeUrls(html: string): string {
9398
return html.replace(/href\s*=\s*"(javascript|vbscript|data):[^"]*"/gi, 'href="#"')
9499
}
95100

96-
function renderEmailHtml(markdown: string, chatUrl: string): string {
97-
const bodyHtml = stripUnsafeUrls(marked.parse(stripRawHtml(markdown), { async: false }) as string)
101+
const markdownProcessor = unified()
102+
.use(remarkParse)
103+
.use(remarkGfm)
104+
.use(remarkBreaks)
105+
.use(remarkRehype)
106+
107+
async function markdownToHtml(markdown: string): Promise<string> {
108+
const mdast = markdownProcessor.parse(markdown)
109+
const hast = await markdownProcessor.run(mdast)
110+
return toHtml(hast)
111+
}
112+
113+
async function renderEmailHtml(markdown: string, chatUrl: string): Promise<string> {
114+
const bodyHtml = stripUnsafeUrls(await markdownToHtml(stripRawHtml(markdown)))
98115

99116
return `<!DOCTYPE html><html><head><meta charset="utf-8"><style>${EMAIL_STYLES}</style></head>
100117
<body>

apps/sim/next.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ const nextConfig: NextConfig = {
8181
'unpdf',
8282
'ffmpeg-static',
8383
'fluent-ffmpeg',
84-
'pino',
85-
'pino-pretty',
86-
'thread-stream',
8784
'ws',
8885
'isolated-vm',
8986
],

apps/sim/package.json

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,24 @@
3333
"@1password/sdk": "0.3.1",
3434
"@a2a-js/sdk": "0.3.7",
3535
"@anthropic-ai/sdk": "0.71.2",
36-
"@aws-sdk/client-athena": "3.1024.0",
37-
"@aws-sdk/client-bedrock-runtime": "3.940.0",
38-
"@aws-sdk/client-cloudformation": "3.1019.0",
39-
"@aws-sdk/client-cloudwatch": "3.940.0",
40-
"@aws-sdk/client-cloudwatch-logs": "3.940.0",
41-
"@aws-sdk/client-dynamodb": "3.940.0",
42-
"@aws-sdk/client-iam": "3.1029.0",
36+
"@aws-sdk/client-athena": "3.1032.0",
37+
"@aws-sdk/client-bedrock-runtime": "3.1032.0",
38+
"@aws-sdk/client-cloudformation": "3.1032.0",
39+
"@aws-sdk/client-cloudwatch": "3.1032.0",
40+
"@aws-sdk/client-cloudwatch-logs": "3.1032.0",
41+
"@aws-sdk/client-dynamodb": "3.1032.0",
42+
"@aws-sdk/client-iam": "3.1032.0",
4343
"@aws-sdk/client-identitystore": "3.1032.0",
4444
"@aws-sdk/client-organizations": "3.1032.0",
45-
"@aws-sdk/client-rds-data": "3.940.0",
46-
"@aws-sdk/client-s3": "^3.779.0",
47-
"@aws-sdk/client-secrets-manager": "3.940.0",
48-
"@aws-sdk/client-sesv2": "3.940.0",
49-
"@aws-sdk/client-sqs": "3.947.0",
45+
"@aws-sdk/client-rds-data": "3.1032.0",
46+
"@aws-sdk/client-s3": "3.1032.0",
47+
"@aws-sdk/client-secrets-manager": "3.1032.0",
48+
"@aws-sdk/client-sesv2": "3.1032.0",
49+
"@aws-sdk/client-sqs": "3.1032.0",
5050
"@aws-sdk/client-sso-admin": "3.1032.0",
51-
"@aws-sdk/client-sts": "3.1029.0",
52-
"@aws-sdk/lib-dynamodb": "3.940.0",
53-
"@aws-sdk/s3-request-presigner": "^3.779.0",
51+
"@aws-sdk/client-sts": "3.1032.0",
52+
"@aws-sdk/lib-dynamodb": "3.1032.0",
53+
"@aws-sdk/s3-request-presigner": "3.1032.0",
5454
"@azure/communication-email": "1.0.0",
5555
"@azure/storage-blob": "12.27.0",
5656
"@better-auth/sso": "1.3.12",
@@ -65,7 +65,6 @@
6565
"@modelcontextprotocol/sdk": "1.29.0",
6666
"@monaco-editor/react": "4.7.0",
6767
"@opentelemetry/api": "^1.9.0",
68-
"@opentelemetry/exporter-jaeger": "2.1.0",
6968
"@opentelemetry/exporter-trace-otlp-http": "^0.200.0",
7069
"@opentelemetry/resources": "^2.0.0",
7170
"@opentelemetry/sdk-node": "^0.200.0",
@@ -92,8 +91,8 @@
9291
"@radix-ui/react-toggle": "^1.1.2",
9392
"@radix-ui/react-tooltip": "1.2.8",
9493
"@radix-ui/react-visually-hidden": "1.2.4",
95-
"@react-email/components": "^0.0.34",
96-
"@react-email/render": "2.0.0",
94+
"@react-email/components": "0.5.7",
95+
"@react-email/render": "2.0.8",
9796
"@sim/audit": "workspace:*",
9897
"@sim/logger": "workspace:*",
9998
"@sim/realtime-protocol": "workspace:*",
@@ -106,15 +105,11 @@
106105
"@tanstack/react-query": "5.90.8",
107106
"@tanstack/react-query-devtools": "5.90.2",
108107
"@trigger.dev/sdk": "4.4.3",
109-
"@types/react-window": "2.0.0",
110-
"@types/three": "0.177.0",
111108
"ajv": "8.18.0",
112109
"better-auth": "1.3.12",
113110
"better-auth-harmony": "1.3.1",
114111
"binary-extensions": "^2.0.0",
115112
"browser-image-compression": "^2.0.2",
116-
"chalk": "5.6.2",
117-
"chart.js": "4.5.1",
118113
"cheerio": "1.1.2",
119114
"class-variance-authority": "^0.7.1",
120115
"clsx": "^2.1.1",
@@ -127,8 +122,6 @@
127122
"docx": "^9.6.1",
128123
"docx-preview": "^0.3.7",
129124
"drizzle-orm": "^0.45.2",
130-
"encoding": "0.1.13",
131-
"entities": "6.0.1",
132125
"es-toolkit": "1.45.1",
133126
"ffmpeg-static": "5.3.0",
134127
"fluent-ffmpeg": "2.1.3",
@@ -137,6 +130,7 @@
137130
"google-auth-library": "10.5.0",
138131
"gray-matter": "^4.0.3",
139132
"groq-sdk": "^0.15.0",
133+
"hast-util-to-html": "9.0.5",
140134
"html-to-image": "1.11.13",
141135
"html-to-text": "^9.0.5",
142136
"idb-keyval": "6.2.2",
@@ -153,7 +147,6 @@
153147
"jwt-decode": "^4.0.0",
154148
"lucide-react": "^0.479.0",
155149
"mammoth": "^1.9.0",
156-
"marked": "17.0.4",
157150
"mermaid": "11.14.0",
158151
"micromatch": "4.0.8",
159152
"monaco-editor": "0.55.1",
@@ -184,31 +177,30 @@
184177
"react-simple-code-editor": "^0.14.1",
185178
"react-window": "2.2.3",
186179
"reactflow": "^11.11.4",
187-
"redis": "5.10.0",
188180
"rehype-autolink-headings": "^7.1.0",
189181
"rehype-slug": "^6.0.0",
190182
"remark-breaks": "^4.0.0",
191183
"remark-gfm": "4.0.1",
184+
"remark-parse": "11.0.0",
185+
"remark-rehype": "11.1.2",
192186
"resend": "^4.1.2",
193187
"rss-parser": "3.13.0",
194188
"safe-regex2": "5.1.0",
195189
"sharp": "0.34.3",
196-
"soap": "1.8.0",
197190
"socket.io-client": "4.8.1",
198191
"ssh2": "^1.17.0",
199192
"streamdown": "2.5.0",
200193
"stripe": "18.5.0",
201194
"svix": "1.88.0",
202195
"tailwind-merge": "^2.6.0",
203196
"tailwindcss-animate": "^1.0.7",
204-
"thread-stream": "4.0.0",
205197
"three": "0.177.0",
206198
"twilio": "5.9.0",
199+
"unified": "11.0.5",
207200
"unpdf": "1.4.0",
208-
"uuid": "^11.1.0",
209201
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
210202
"zod": "4.3.6",
211-
"zustand": "^4.5.7"
203+
"zustand": "^5.0.13"
212204
},
213205
"devDependencies": {
214206
"@sim/testing": "workspace:*",
@@ -227,16 +219,15 @@
227219
"@types/prismjs": "^1.26.5",
228220
"@types/react": "^19",
229221
"@types/react-dom": "^19",
222+
"@types/react-window": "2.0.0",
230223
"@types/ssh2": "^1.15.5",
224+
"@types/three": "0.177.0",
231225
"@vitejs/plugin-react": "^4.3.4",
232226
"@vitest/coverage-v8": "^3.0.8",
233227
"autoprefixer": "10.4.21",
234-
"concurrently": "^9.1.0",
235-
"critters": "0.0.25",
236-
"dotenv": "^16.4.7",
237228
"jsdom": "^26.0.0",
238229
"postcss": "^8",
239-
"react-email": "^4.0.13",
230+
"react-email": "4.3.2",
240231
"tailwindcss": "^3.4.1",
241232
"typescript": "^5.7.3",
242233
"vite-tsconfig-paths": "^5.1.4",
@@ -252,8 +243,6 @@
252243
"overrides": {
253244
"next": "16.2.4",
254245
"@next/env": "16.2.4",
255-
"drizzle-orm": "^0.45.2",
256-
"postgres": "^3.4.5",
257246
"react-floater": {
258247
"react": "$react",
259248
"react-dom": "$react-dom"

apps/sim/tools/workday/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { listWorkersTool } from '@/tools/workday/list_workers'
99
import { terminateWorkerTool } from '@/tools/workday/terminate_worker'
1010
import { updateWorkerTool } from '@/tools/workday/update_worker'
1111

12+
export * from './types'
1213
export {
1314
assignOnboardingTool as workdayAssignOnboardingTool,
1415
changeJobTool as workdayChangeJobTool,
@@ -21,5 +22,3 @@ export {
2122
terminateWorkerTool as workdayTerminateWorkerTool,
2223
updateWorkerTool as workdayUpdateWorkerTool,
2324
}
24-
25-
export * from './types'

0 commit comments

Comments
 (0)