Skip to content

Commit 531897c

Browse files
committed
fix optional tools + types
1 parent 843b2cd commit 531897c

File tree

108 files changed

+1041
-553
lines changed

Some content is hidden

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

108 files changed

+1041
-553
lines changed

apps/sim/tools/apollo/account_create.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ export const apolloAccountCreateTool: ToolConfig<
7171
return {
7272
success: true,
7373
output: {
74-
account: data.account || {},
74+
account: data.account ?? null,
7575
created: !!data.account,
7676
},
7777
}
7878
},
7979

8080
outputs: {
81-
account: { type: 'json', description: 'Created account data from Apollo' },
81+
account: { type: 'json', description: 'Created account data from Apollo', optional: true },
8282
created: { type: 'boolean', description: 'Whether the account was successfully created' },
8383
},
8484
}

apps/sim/tools/apollo/account_search.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,18 @@ export const apolloAccountSearchTool: ToolConfig<
8383
return {
8484
success: true,
8585
output: {
86-
accounts: data.accounts || [],
87-
page: data.pagination?.page || 1,
88-
per_page: data.pagination?.per_page || 25,
89-
total_entries: data.pagination?.total_entries || 0,
86+
accounts: data.accounts ?? null,
87+
pagination: data.pagination ?? null,
9088
},
9189
}
9290
},
9391

9492
outputs: {
95-
accounts: { type: 'json', description: 'Array of accounts matching the search criteria' },
96-
page: { type: 'number', description: 'Current page number' },
97-
per_page: { type: 'number', description: 'Results per page' },
98-
total_entries: { type: 'number', description: 'Total matching entries' },
93+
accounts: {
94+
type: 'json',
95+
description: 'Array of accounts matching the search criteria',
96+
optional: true,
97+
},
98+
pagination: { type: 'json', description: 'Pagination information', optional: true },
9999
},
100100
}

apps/sim/tools/apollo/account_update.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ export const apolloAccountUpdateTool: ToolConfig<
7979
return {
8080
success: true,
8181
output: {
82-
account: data.account || {},
82+
account: data.account ?? null,
8383
updated: !!data.account,
8484
},
8585
}
8686
},
8787

8888
outputs: {
89-
account: { type: 'json', description: 'Updated account data from Apollo' },
89+
account: { type: 'json', description: 'Updated account data from Apollo', optional: true },
9090
updated: { type: 'boolean', description: 'Whether the account was successfully updated' },
9191
},
9292
}

apps/sim/tools/apollo/contact_create.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ export const apolloContactCreateTool: ToolConfig<
8787
return {
8888
success: true,
8989
output: {
90-
contact: data.contact || {},
90+
contact: data.contact ?? null,
9191
created: !!data.contact,
9292
},
9393
}
9494
},
9595

9696
outputs: {
97-
contact: { type: 'json', description: 'Created contact data from Apollo' },
97+
contact: { type: 'json', description: 'Created contact data from Apollo', optional: true },
9898
created: { type: 'boolean', description: 'Whether the contact was successfully created' },
9999
},
100100
}

apps/sim/tools/apollo/contact_search.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,18 @@ export const apolloContactSearchTool: ToolConfig<
7575
return {
7676
success: true,
7777
output: {
78-
contacts: data.contacts || [],
79-
page: data.pagination?.page || 1,
80-
per_page: data.pagination?.per_page || 25,
81-
total_entries: data.pagination?.total_entries || 0,
78+
contacts: data.contacts ?? null,
79+
pagination: data.pagination ?? null,
8280
},
8381
}
8482
},
8583

8684
outputs: {
87-
contacts: { type: 'json', description: 'Array of contacts matching the search criteria' },
88-
page: { type: 'number', description: 'Current page number' },
89-
per_page: { type: 'number', description: 'Results per page' },
90-
total_entries: { type: 'number', description: 'Total matching entries' },
85+
contacts: {
86+
type: 'json',
87+
description: 'Array of contacts matching the search criteria',
88+
optional: true,
89+
},
90+
pagination: { type: 'json', description: 'Pagination information', optional: true },
9191
},
9292
}

apps/sim/tools/apollo/contact_update.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ export const apolloContactUpdateTool: ToolConfig<
9393
return {
9494
success: true,
9595
output: {
96-
contact: data.contact || {},
96+
contact: data.contact ?? null,
9797
updated: !!data.contact,
9898
},
9999
}
100100
},
101101

102102
outputs: {
103-
contact: { type: 'json', description: 'Updated contact data from Apollo' },
103+
contact: { type: 'json', description: 'Updated contact data from Apollo', optional: true },
104104
updated: { type: 'boolean', description: 'Whether the contact was successfully updated' },
105105
},
106106
}

apps/sim/tools/apollo/opportunity_create.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,18 @@ export const apolloOpportunityCreateTool: ToolConfig<
9797
return {
9898
success: true,
9999
output: {
100-
opportunity: data.opportunity || {},
100+
opportunity: data.opportunity ?? null,
101101
created: !!data.opportunity,
102102
},
103103
}
104104
},
105105

106106
outputs: {
107-
opportunity: { type: 'json', description: 'Created opportunity data from Apollo' },
107+
opportunity: {
108+
type: 'json',
109+
description: 'Created opportunity data from Apollo',
110+
optional: true,
111+
},
108112
created: { type: 'boolean', description: 'Whether the opportunity was successfully created' },
109113
},
110114
}

apps/sim/tools/apollo/opportunity_update.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,18 @@ export const apolloOpportunityUpdateTool: ToolConfig<
9696
return {
9797
success: true,
9898
output: {
99-
opportunity: data.opportunity || {},
99+
opportunity: data.opportunity ?? null,
100100
updated: !!data.opportunity,
101101
},
102102
}
103103
},
104104

105105
outputs: {
106-
opportunity: { type: 'json', description: 'Updated opportunity data from Apollo' },
106+
opportunity: {
107+
type: 'json',
108+
description: 'Updated opportunity data from Apollo',
109+
optional: true,
110+
},
107111
updated: { type: 'boolean', description: 'Whether the opportunity was successfully updated' },
108112
},
109113
}

apps/sim/tools/apollo/task_create.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,14 @@ export const apolloTaskCreateTool: ToolConfig<ApolloTaskCreateParams, ApolloTask
8484
return {
8585
success: true,
8686
output: {
87-
task: data.task || {
88-
note: '',
89-
created: true,
90-
message: 'Task created successfully. Apollo API does not return task details.',
91-
},
87+
task: data.task ?? null,
9288
created: data === true || !!data.task,
9389
},
9490
}
9591
},
9692

9793
outputs: {
98-
task: { type: 'json', description: 'Created task data from Apollo' },
94+
task: { type: 'json', description: 'Created task data from Apollo', optional: true },
9995
created: { type: 'boolean', description: 'Whether the task was successfully created' },
10096
},
10197
}

apps/sim/tools/apollo/task_search.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,18 @@ export const apolloTaskSearchTool: ToolConfig<ApolloTaskSearchParams, ApolloTask
7777
return {
7878
success: true,
7979
output: {
80-
tasks: data.tasks || [],
81-
page: data.pagination?.page || 1,
82-
per_page: data.pagination?.per_page || 25,
83-
total_entries: data.pagination?.total_entries || 0,
80+
tasks: data.tasks ?? null,
81+
pagination: data.pagination ?? null,
8482
},
8583
}
8684
},
8785

8886
outputs: {
89-
tasks: { type: 'json', description: 'Array of tasks matching the search criteria' },
90-
page: { type: 'number', description: 'Current page number' },
91-
per_page: { type: 'number', description: 'Results per page' },
92-
total_entries: { type: 'number', description: 'Total matching entries' },
87+
tasks: {
88+
type: 'json',
89+
description: 'Array of tasks matching the search criteria',
90+
optional: true,
91+
},
92+
pagination: { type: 'json', description: 'Pagination information', optional: true },
9393
},
9494
}

0 commit comments

Comments
 (0)