Skip to content

Commit 304cafe

Browse files
improvement(linear): cleanup linear checks (#2075)
1 parent 472aff5 commit 304cafe

31 files changed

+112
-255
lines changed

apps/sim/tools/linear/archive_project.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ export const linearArchiveProjectTool: ToolConfig<
3939
body: (params) => ({
4040
query: `
4141
mutation ArchiveProject($id: String!) {
42-
projectArchive(id: $id) {
42+
projectDelete(id: $id) {
4343
success
44+
entity {
45+
id
46+
}
4447
}
4548
}
4649
`,
@@ -61,7 +64,7 @@ export const linearArchiveProjectTool: ToolConfig<
6164
}
6265
}
6366

64-
const result = data.data.projectArchive
67+
const result = data.data.projectDelete
6568
if (!result.success) {
6669
return {
6770
success: false,

apps/sim/tools/linear/create_attachment.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ export const linearCreateAttachmentTool: ToolConfig<
6464
title: params.title,
6565
}
6666

67-
if (params.subtitle !== undefined && params.subtitle !== null && params.subtitle !== '')
68-
input.subtitle = params.subtitle
67+
if (params.subtitle != null && params.subtitle !== '') input.subtitle = params.subtitle
6968

7069
return {
7170
query: `

apps/sim/tools/linear/create_customer.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,38 +90,32 @@ export const linearCreateCustomerTool: ToolConfig<
9090
}
9191

9292
// Optional fields with proper validation
93-
if (
94-
params.domains !== undefined &&
95-
params.domains !== null &&
96-
Array.isArray(params.domains) &&
97-
params.domains.length > 0
98-
) {
93+
if (params.domains != null && Array.isArray(params.domains) && params.domains.length > 0) {
9994
input.domains = params.domains
10095
}
10196
if (
102-
params.externalIds !== undefined &&
103-
params.externalIds !== null &&
97+
params.externalIds != null &&
10498
Array.isArray(params.externalIds) &&
10599
params.externalIds.length > 0
106100
) {
107101
input.externalIds = params.externalIds
108102
}
109-
if (params.logoUrl !== undefined && params.logoUrl !== null && params.logoUrl !== '') {
103+
if (params.logoUrl != null && params.logoUrl !== '') {
110104
input.logoUrl = params.logoUrl
111105
}
112-
if (params.ownerId !== undefined && params.ownerId !== null && params.ownerId !== '') {
106+
if (params.ownerId != null && params.ownerId !== '') {
113107
input.ownerId = params.ownerId
114108
}
115-
if (params.revenue !== undefined && params.revenue !== null) {
109+
if (params.revenue != null) {
116110
input.revenue = params.revenue
117111
}
118-
if (params.size !== undefined && params.size !== null) {
112+
if (params.size != null) {
119113
input.size = params.size
120114
}
121-
if (params.statusId !== undefined && params.statusId !== null && params.statusId !== '') {
115+
if (params.statusId != null && params.statusId !== '') {
122116
input.statusId = params.statusId
123117
}
124-
if (params.tierId !== undefined && params.tierId !== null && params.tierId !== '') {
118+
if (params.tierId != null && params.tierId !== '') {
125119
input.tierId = params.tierId
126120
}
127121

apps/sim/tools/linear/create_customer_request.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ export const linearCreateCustomerRequestTool: ToolConfig<
6767
body: (params) => {
6868
const input: Record<string, any> = {
6969
customerId: params.customerId,
70-
priority: params.priority !== undefined && params.priority !== null ? params.priority : 0,
70+
priority: params.priority != null ? params.priority : 0,
7171
}
7272

7373
// Optional fields with proper validation
74-
if (params.body !== undefined && params.body !== null && params.body !== '') {
74+
if (params.body != null && params.body !== '') {
7575
input.body = params.body
7676
}
77-
if (params.issueId !== undefined && params.issueId !== null && params.issueId !== '') {
77+
if (params.issueId != null && params.issueId !== '') {
7878
input.issueId = params.issueId
7979
}
80-
if (params.projectId !== undefined && params.projectId !== null && params.projectId !== '') {
80+
if (params.projectId != null && params.projectId !== '') {
8181
input.projectId = params.projectId
8282
}
8383

apps/sim/tools/linear/create_customer_status.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,13 @@ export const linearCreateCustomerStatusTool: ToolConfig<
6969
color: params.color,
7070
}
7171

72-
if (
73-
params.displayName !== undefined &&
74-
params.displayName !== null &&
75-
params.displayName !== ''
76-
) {
72+
if (params.displayName != null && params.displayName !== '') {
7773
input.displayName = params.displayName
7874
}
79-
if (
80-
params.description !== undefined &&
81-
params.description !== null &&
82-
params.description !== ''
83-
) {
75+
if (params.description != null && params.description !== '') {
8476
input.description = params.description
8577
}
86-
if (params.position !== undefined && params.position !== null) {
78+
if (params.position != null) {
8779
input.position = params.position
8880
}
8981

apps/sim/tools/linear/create_customer_tier.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,13 @@ export const linearCreateCustomerTierTool: ToolConfig<
6969
color: params.color,
7070
}
7171

72-
if (
73-
params.displayName !== undefined &&
74-
params.displayName !== null &&
75-
params.displayName !== ''
76-
) {
72+
if (params.displayName != null && params.displayName !== '') {
7773
input.displayName = params.displayName
7874
}
79-
if (
80-
params.description !== undefined &&
81-
params.description !== null &&
82-
params.description !== ''
83-
) {
75+
if (params.description != null && params.description !== '') {
8476
input.description = params.description
8577
}
86-
if (params.position !== undefined && params.position !== null) {
78+
if (params.position != null) {
8779
input.position = params.position
8880
}
8981

apps/sim/tools/linear/create_cycle.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ export const linearCreateCycleTool: ToolConfig<LinearCreateCycleParams, LinearCr
5959
endsAt: params.endsAt,
6060
}
6161

62-
if (params.name !== undefined && params.name !== null && params.name !== '')
63-
input.name = params.name
62+
if (params.name != null && params.name !== '') input.name = params.name
6463

6564
return {
6665
query: `

apps/sim/tools/linear/create_favorite.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,10 @@ export const linearCreateFavoriteTool: ToolConfig<
5757
body: (params) => {
5858
const input: Record<string, any> = {}
5959

60-
if (params.issueId !== undefined && params.issueId !== null && params.issueId !== '')
61-
input.issueId = params.issueId
62-
if (params.projectId !== undefined && params.projectId !== null && params.projectId !== '')
63-
input.projectId = params.projectId
64-
if (params.cycleId !== undefined && params.cycleId !== null && params.cycleId !== '')
65-
input.cycleId = params.cycleId
66-
if (params.labelId !== undefined && params.labelId !== null && params.labelId !== '')
67-
input.labelId = params.labelId
60+
if (params.issueId != null && params.issueId !== '') input.issueId = params.issueId
61+
if (params.projectId != null && params.projectId !== '') input.projectId = params.projectId
62+
if (params.cycleId != null && params.cycleId !== '') input.cycleId = params.cycleId
63+
if (params.labelId != null && params.labelId !== '') input.labelId = params.labelId
6864

6965
if (Object.keys(input).length === 0) {
7066
throw new Error('At least one ID (issue, project, cycle, or label) must be provided')

apps/sim/tools/linear/create_issue.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,10 @@ export const linearCreateIssueTool: ToolConfig<LinearCreateIssueParams, LinearCr
6262
title: params.title,
6363
}
6464

65-
if (
66-
params.projectId !== undefined &&
67-
params.projectId !== null &&
68-
params.projectId !== ''
69-
) {
65+
if (params.projectId != null && params.projectId !== '') {
7066
input.projectId = params.projectId
7167
}
72-
if (
73-
params.description !== undefined &&
74-
params.description !== null &&
75-
params.description !== ''
76-
) {
68+
if (params.description != null && params.description !== '') {
7769
input.description = params.description
7870
}
7971

apps/sim/tools/linear/create_label.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,10 @@ export const linearCreateLabelTool: ToolConfig<LinearCreateLabelParams, LinearCr
5757
name: params.name,
5858
}
5959

60-
if (params.color !== undefined && params.color !== null && params.color !== '')
61-
input.color = params.color
62-
if (
63-
params.description !== undefined &&
64-
params.description !== null &&
65-
params.description !== ''
66-
)
60+
if (params.color != null && params.color !== '') input.color = params.color
61+
if (params.description != null && params.description !== '')
6762
input.description = params.description
68-
if (params.teamId !== undefined && params.teamId !== null && params.teamId !== '')
69-
input.teamId = params.teamId
63+
if (params.teamId != null && params.teamId !== '') input.teamId = params.teamId
7064

7165
return {
7266
query: `

0 commit comments

Comments
 (0)