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
1 change: 1 addition & 0 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"tailwind-merge": "^3.0.2"
},
"devDependencies": {
"@sim/tsconfig": "workspace:*",
"@tailwindcss/postcss": "^4.0.12",
"@types/mdx": "^2.0.13",
"@types/node": "^22.14.1",
Expand Down
22 changes: 2 additions & 20 deletions apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
{
"extends": "@sim/tsconfig/nextjs.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": "react-jsx",
"incremental": true,
"paths": {
"@/.source/*": ["./.source/*"],
"@/*": ["./*"]
},
"plugins": [
{
"name": "next"
}
]
}
},
"include": [
"next-env.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/app/api/stars/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function GET() {
headers: {
Accept: 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28',
'User-Agent': 'SimStudio/1.0',
'User-Agent': 'Sim/1.0',
...(token ? { Authorization: `Bearer ${token}` } : {}),
},
next: { revalidate: 3600 },
Expand Down
20 changes: 16 additions & 4 deletions apps/sim/lib/oauth/oauth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ describe('OAuth Token Refresh', () => {
})
)

const [, requestOptions] = mockFetch.mock.calls[0]
const [, requestOptions] = mockFetch.mock.calls[0] as [
string,
{ headers: Record<string, string>; body: string },
]

const authHeader = requestOptions.headers.Authorization
expect(authHeader).toMatch(/^Basic /)
Expand Down Expand Up @@ -251,7 +254,10 @@ describe('OAuth Token Refresh', () => {
})
)

const [, requestOptions] = mockFetch.mock.calls[0]
const [, requestOptions] = mockFetch.mock.calls[0] as [
string,
{ headers: Record<string, string>; body: string },
]

expect(requestOptions.headers.Authorization).toBeUndefined()

Expand Down Expand Up @@ -279,7 +285,10 @@ describe('OAuth Token Refresh', () => {

await withMockFetch(mockFetch, () => refreshOAuthToken('github', refreshToken))

const [, requestOptions] = mockFetch.mock.calls[0]
const [, requestOptions] = mockFetch.mock.calls[0] as [
string,
{ headers: Record<string, string>; body: string },
]
expect(requestOptions.headers.Accept).toBe('application/json')
})

Expand All @@ -289,7 +298,10 @@ describe('OAuth Token Refresh', () => {

await withMockFetch(mockFetch, () => refreshOAuthToken('reddit', refreshToken))

const [, requestOptions] = mockFetch.mock.calls[0]
const [, requestOptions] = mockFetch.mock.calls[0] as [
string,
{ headers: Record<string, string>; body: string },
]
expect(requestOptions.headers['User-Agent']).toBe(
'sim-studio/1.0 (https://github.com/simstudioai/sim)'
)
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/lib/webhooks/gmail-polling-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ async function processEmails(
headers: {
'Content-Type': 'application/json',
'X-Webhook-Secret': webhookData.secret || '',
'User-Agent': 'SimStudio/1.0',
'User-Agent': 'Sim/1.0',
},
body: JSON.stringify(payload),
})
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/lib/webhooks/outlook-polling-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ async function processOutlookEmails(
headers: {
'Content-Type': 'application/json',
'X-Webhook-Secret': webhookData.secret || '',
'User-Agent': 'SimStudio/1.0',
'User-Agent': 'Sim/1.0',
},
body: JSON.stringify(payload),
})
Expand Down
6 changes: 3 additions & 3 deletions apps/sim/lib/webhooks/rss-polling-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export interface RssWebhookPayload {
const parser = new Parser({
timeout: 30000,
headers: {
'User-Agent': 'SimStudio/1.0 RSS Poller',
'User-Agent': 'Sim/1.0 RSS Poller',
},
})

Expand Down Expand Up @@ -255,7 +255,7 @@ async function fetchNewRssItems(
const response = await fetch(pinnedUrl, {
headers: {
Host: urlValidation.originalHostname!,
'User-Agent': 'SimStudio/1.0 RSS Poller',
'User-Agent': 'Sim/1.0 RSS Poller',
Accept: 'application/rss+xml, application/xml, text/xml, */*',
},
signal: AbortSignal.timeout(30000),
Expand Down Expand Up @@ -362,7 +362,7 @@ async function processRssItems(
headers: {
'Content-Type': 'application/json',
'X-Webhook-Secret': webhookData.secret || '',
'User-Agent': 'SimStudio/1.0',
'User-Agent': 'Sim/1.0',
},
body: JSON.stringify(payload),
})
Expand Down
65 changes: 32 additions & 33 deletions apps/sim/lib/workflows/persistence/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ function asAppBlocks<T>(blocks: T): Record<string, AppBlockState> {
* These tests intentionally use old SubBlockTypes (textarea, select, messages-input, input)
* to verify the migration logic converts them to new types.
*/
function legacySubBlocks<T>(
subBlocks: T
): Record<string, { id: string; type: string; value: any }> {
return subBlocks as Record<string, { id: string; type: string; value: any }>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function legacySubBlocks(subBlocks: Record<string, any>): any {
return subBlocks
}

const { mockDb, mockWorkflowBlocks, mockWorkflowEdges, mockWorkflowSubflows } = vi.hoisted(() => {
Expand Down Expand Up @@ -1022,7 +1021,7 @@ describe('Database Helpers', () => {
position: { x: 100, y: 100 },
height: 150,
advancedMode: false,
subBlocks: { model: { id: 'model', type: 'select', value: 'gpt-4o' } },
subBlocks: legacySubBlocks({ model: { id: 'model', type: 'select', value: 'gpt-4o' } }),
}),
mockWorkflowId
)
Expand All @@ -1034,11 +1033,11 @@ describe('Database Helpers', () => {
position: { x: 200, y: 100 },
height: 200,
advancedMode: true,
subBlocks: {
subBlocks: legacySubBlocks({
systemPrompt: { id: 'systemPrompt', type: 'textarea', value: 'System prompt' },
userPrompt: { id: 'userPrompt', type: 'textarea', value: 'User prompt' },
model: { id: 'model', type: 'select', value: 'gpt-4o' },
},
}),
}),
mockWorkflowId
)
Expand Down Expand Up @@ -1153,7 +1152,7 @@ describe('Database Helpers', () => {
'agent-1': createAgentBlock({
id: 'agent-1',
name: 'Test Agent',
subBlocks: {
subBlocks: legacySubBlocks({
systemPrompt: {
id: 'systemPrompt',
type: 'textarea',
Expand All @@ -1164,7 +1163,7 @@ describe('Database Helpers', () => {
type: 'textarea',
value: 'Hello world',
},
},
}),
}),
}

Expand All @@ -1183,13 +1182,13 @@ describe('Database Helpers', () => {
const blocks = {
'agent-1': createAgentBlock({
id: 'agent-1',
subBlocks: {
subBlocks: legacySubBlocks({
systemPrompt: {
id: 'systemPrompt',
type: 'textarea',
value: 'You are helpful',
},
},
}),
}),
}

Expand All @@ -1204,13 +1203,13 @@ describe('Database Helpers', () => {
const blocks = {
'agent-1': createAgentBlock({
id: 'agent-1',
subBlocks: {
subBlocks: legacySubBlocks({
userPrompt: {
id: 'userPrompt',
type: 'textarea',
value: 'Hello',
},
},
}),
}),
}

Expand All @@ -1225,13 +1224,13 @@ describe('Database Helpers', () => {
const blocks = {
'agent-1': createAgentBlock({
id: 'agent-1',
subBlocks: {
subBlocks: legacySubBlocks({
userPrompt: {
id: 'userPrompt',
type: 'textarea',
value: { input: 'Hello from object' },
},
},
}),
}),
}

Expand All @@ -1246,13 +1245,13 @@ describe('Database Helpers', () => {
const blocks = {
'agent-1': createAgentBlock({
id: 'agent-1',
subBlocks: {
subBlocks: legacySubBlocks({
userPrompt: {
id: 'userPrompt',
type: 'textarea',
value: { foo: 'bar', baz: 123 },
},
},
}),
}),
}

Expand All @@ -1268,7 +1267,7 @@ describe('Database Helpers', () => {
const blocks = {
'agent-1': createAgentBlock({
id: 'agent-1',
subBlocks: {
subBlocks: legacySubBlocks({
systemPrompt: {
id: 'systemPrompt',
type: 'textarea',
Expand All @@ -1284,7 +1283,7 @@ describe('Database Helpers', () => {
type: 'messages-input',
value: existingMessages,
},
},
}),
}),
}

Expand All @@ -1297,13 +1296,13 @@ describe('Database Helpers', () => {
const blocks = {
'agent-1': createAgentBlock({
id: 'agent-1',
subBlocks: {
subBlocks: legacySubBlocks({
model: {
id: 'model',
type: 'select',
value: 'gpt-4o',
},
},
}),
}),
}

Expand All @@ -1316,13 +1315,13 @@ describe('Database Helpers', () => {
const blocks = {
'api-1': createApiBlock({
id: 'api-1',
subBlocks: {
subBlocks: legacySubBlocks({
url: {
id: 'url',
type: 'input',
value: 'https://example.com',
},
},
}),
}),
}

Expand All @@ -1336,18 +1335,18 @@ describe('Database Helpers', () => {
const blocks = {
'agent-1': createAgentBlock({
id: 'agent-1',
subBlocks: {
subBlocks: legacySubBlocks({
systemPrompt: { id: 'systemPrompt', type: 'textarea', value: 'System 1' },
},
}),
}),
'api-1': createApiBlock({
id: 'api-1',
}),
'agent-2': createAgentBlock({
id: 'agent-2',
subBlocks: {
subBlocks: legacySubBlocks({
userPrompt: { id: 'userPrompt', type: 'textarea', value: 'User 2' },
},
}),
}),
}

Expand All @@ -1368,10 +1367,10 @@ describe('Database Helpers', () => {
const blocks = {
'agent-1': createAgentBlock({
id: 'agent-1',
subBlocks: {
subBlocks: legacySubBlocks({
systemPrompt: { id: 'systemPrompt', type: 'textarea', value: '' },
userPrompt: { id: 'userPrompt', type: 'textarea', value: '' },
},
}),
}),
}

Expand All @@ -1384,9 +1383,9 @@ describe('Database Helpers', () => {
const blocks = {
'agent-1': createAgentBlock({
id: 'agent-1',
subBlocks: {
subBlocks: legacySubBlocks({
systemPrompt: { id: 'systemPrompt', type: 'textarea', value: 123 },
},
}),
}),
}

Expand All @@ -1401,9 +1400,9 @@ describe('Database Helpers', () => {
const blocks = {
'agent-1': createAgentBlock({
id: 'agent-1',
subBlocks: {
subBlocks: legacySubBlocks({
systemPrompt: { id: 'systemPrompt', type: 'textarea', value: 'System' },
},
}),
}),
}

Expand Down
Loading