Skip to content

Commit 29efba3

Browse files
waleedlatif1claude
andcommitted
refactor: remove re-exports from jsm/utils and import directly from source
Remove re-exports of getJiraCloudId, parseAtlassianErrorMessage, and parseJsmErrorMessage from jsm/utils.ts. Update all 21 JSM routes to import directly from @/tools/jira/utils per CLAUDE.md import rules. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bdf3ce3 commit 29efba3

22 files changed

Lines changed: 68 additions & 162 deletions

File tree

apps/sim/app/api/tools/jsm/approvals/route.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ import {
77
validateJiraCloudId,
88
validateJiraIssueKey,
99
} from '@/lib/core/security/input-validation'
10-
import {
11-
getJiraCloudId,
12-
getJsmApiBaseUrl,
13-
getJsmHeaders,
14-
parseJsmErrorMessage,
15-
} from '@/tools/jsm/utils'
10+
import { getJiraCloudId, parseAtlassianErrorMessage } from '@/tools/jira/utils'
11+
import { getJsmApiBaseUrl, getJsmHeaders } from '@/tools/jsm/utils'
1612

1713
export const dynamic = 'force-dynamic'
1814

@@ -104,7 +100,7 @@ export async function POST(request: NextRequest) {
104100

105101
return NextResponse.json(
106102
{
107-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
103+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
108104
details: errorText,
109105
},
110106
{ status: response.status }
@@ -160,7 +156,7 @@ export async function POST(request: NextRequest) {
160156

161157
return NextResponse.json(
162158
{
163-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
159+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
164160
details: errorText,
165161
},
166162
{ status: response.status }

apps/sim/app/api/tools/jsm/comment/route.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ import { createLogger } from '@sim/logger'
22
import { type NextRequest, NextResponse } from 'next/server'
33
import { checkInternalAuth } from '@/lib/auth/hybrid'
44
import { validateJiraCloudId, validateJiraIssueKey } from '@/lib/core/security/input-validation'
5-
import {
6-
getJiraCloudId,
7-
getJsmApiBaseUrl,
8-
getJsmHeaders,
9-
parseJsmErrorMessage,
10-
} from '@/tools/jsm/utils'
5+
import { getJiraCloudId, parseAtlassianErrorMessage } from '@/tools/jira/utils'
6+
import { getJsmApiBaseUrl, getJsmHeaders } from '@/tools/jsm/utils'
117

128
export const dynamic = 'force-dynamic'
139

@@ -86,7 +82,7 @@ export async function POST(request: NextRequest) {
8682

8783
return NextResponse.json(
8884
{
89-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
85+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
9086
details: errorText,
9187
},
9288
{ status: response.status }

apps/sim/app/api/tools/jsm/comments/route.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ import { createLogger } from '@sim/logger'
22
import { type NextRequest, NextResponse } from 'next/server'
33
import { checkInternalAuth } from '@/lib/auth/hybrid'
44
import { validateJiraCloudId, validateJiraIssueKey } from '@/lib/core/security/input-validation'
5-
import {
6-
getJiraCloudId,
7-
getJsmApiBaseUrl,
8-
getJsmHeaders,
9-
parseJsmErrorMessage,
10-
} from '@/tools/jsm/utils'
5+
import { getJiraCloudId, parseAtlassianErrorMessage } from '@/tools/jira/utils'
6+
import { getJsmApiBaseUrl, getJsmHeaders } from '@/tools/jsm/utils'
117

128
export const dynamic = 'force-dynamic'
139

@@ -88,7 +84,7 @@ export async function POST(request: NextRequest) {
8884

8985
return NextResponse.json(
9086
{
91-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
87+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
9288
details: errorText,
9389
},
9490
{ status: response.status }

apps/sim/app/api/tools/jsm/customers/route.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ import { createLogger } from '@sim/logger'
22
import { type NextRequest, NextResponse } from 'next/server'
33
import { checkInternalAuth } from '@/lib/auth/hybrid'
44
import { validateAlphanumericId, validateJiraCloudId } from '@/lib/core/security/input-validation'
5-
import {
6-
getJiraCloudId,
7-
getJsmApiBaseUrl,
8-
getJsmHeaders,
9-
parseJsmErrorMessage,
10-
} from '@/tools/jsm/utils'
5+
import { getJiraCloudId, parseAtlassianErrorMessage } from '@/tools/jira/utils'
6+
import { getJsmApiBaseUrl, getJsmHeaders } from '@/tools/jsm/utils'
117

128
export const dynamic = 'force-dynamic'
139

@@ -101,7 +97,7 @@ export async function POST(request: NextRequest) {
10197

10298
return NextResponse.json(
10399
{
104-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
100+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
105101
details: errorText,
106102
},
107103
{ status: response.status }
@@ -141,7 +137,7 @@ export async function POST(request: NextRequest) {
141137

142138
return NextResponse.json(
143139
{
144-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
140+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
145141
details: errorText,
146142
},
147143
{ status: response.status }

apps/sim/app/api/tools/jsm/forms/issue/route.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ import { createLogger } from '@sim/logger'
22
import { type NextRequest, NextResponse } from 'next/server'
33
import { checkInternalAuth } from '@/lib/auth/hybrid'
44
import { validateJiraCloudId, validateJiraIssueKey } from '@/lib/core/security/input-validation'
5-
import {
6-
getJiraCloudId,
7-
getJsmFormsApiBaseUrl,
8-
getJsmHeaders,
9-
parseJsmErrorMessage,
10-
} from '@/tools/jsm/utils'
5+
import { getJiraCloudId, parseAtlassianErrorMessage } from '@/tools/jira/utils'
6+
import { getJsmFormsApiBaseUrl, getJsmHeaders } from '@/tools/jsm/utils'
117

128
export const dynamic = 'force-dynamic'
139

@@ -70,7 +66,7 @@ export async function POST(request: NextRequest) {
7066

7167
return NextResponse.json(
7268
{
73-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
69+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
7470
details: errorText,
7571
},
7672
{ status: response.status }

apps/sim/app/api/tools/jsm/forms/structure/route.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ import { createLogger } from '@sim/logger'
22
import { type NextRequest, NextResponse } from 'next/server'
33
import { checkInternalAuth } from '@/lib/auth/hybrid'
44
import { validateJiraCloudId, validateJiraIssueKey } from '@/lib/core/security/input-validation'
5-
import {
6-
getJiraCloudId,
7-
getJsmFormsApiBaseUrl,
8-
getJsmHeaders,
9-
parseJsmErrorMessage,
10-
} from '@/tools/jsm/utils'
5+
import { getJiraCloudId, parseAtlassianErrorMessage } from '@/tools/jira/utils'
6+
import { getJsmFormsApiBaseUrl, getJsmHeaders } from '@/tools/jsm/utils'
117

128
export const dynamic = 'force-dynamic'
139

@@ -80,7 +76,7 @@ export async function POST(request: NextRequest) {
8076

8177
return NextResponse.json(
8278
{
83-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
79+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
8480
details: errorText,
8581
},
8682
{ status: response.status }

apps/sim/app/api/tools/jsm/forms/templates/route.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ import { createLogger } from '@sim/logger'
22
import { type NextRequest, NextResponse } from 'next/server'
33
import { checkInternalAuth } from '@/lib/auth/hybrid'
44
import { validateJiraCloudId, validateJiraIssueKey } from '@/lib/core/security/input-validation'
5-
import {
6-
getJiraCloudId,
7-
getJsmFormsApiBaseUrl,
8-
getJsmHeaders,
9-
parseJsmErrorMessage,
10-
} from '@/tools/jsm/utils'
5+
import { getJiraCloudId, parseAtlassianErrorMessage } from '@/tools/jira/utils'
6+
import { getJsmFormsApiBaseUrl, getJsmHeaders } from '@/tools/jsm/utils'
117

128
export const dynamic = 'force-dynamic'
139

@@ -70,7 +66,7 @@ export async function POST(request: NextRequest) {
7066

7167
return NextResponse.json(
7268
{
73-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
69+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
7470
details: errorText,
7571
},
7672
{ status: response.status }

apps/sim/app/api/tools/jsm/organization/route.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ import {
66
validateEnum,
77
validateJiraCloudId,
88
} from '@/lib/core/security/input-validation'
9-
import {
10-
getJiraCloudId,
11-
getJsmApiBaseUrl,
12-
getJsmHeaders,
13-
parseJsmErrorMessage,
14-
} from '@/tools/jsm/utils'
9+
import { getJiraCloudId, parseAtlassianErrorMessage } from '@/tools/jira/utils'
10+
import { getJsmApiBaseUrl, getJsmHeaders } from '@/tools/jsm/utils'
1511

1612
export const dynamic = 'force-dynamic'
1713

@@ -92,7 +88,7 @@ export async function POST(request: NextRequest) {
9288

9389
return NextResponse.json(
9490
{
95-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
91+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
9692
details: errorText,
9793
},
9894
{ status: response.status }
@@ -163,7 +159,7 @@ export async function POST(request: NextRequest) {
163159

164160
return NextResponse.json(
165161
{
166-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
162+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
167163
details: errorText,
168164
},
169165
{ status: response.status }

apps/sim/app/api/tools/jsm/organizations/route.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ import { createLogger } from '@sim/logger'
22
import { type NextRequest, NextResponse } from 'next/server'
33
import { checkInternalAuth } from '@/lib/auth/hybrid'
44
import { validateAlphanumericId, validateJiraCloudId } from '@/lib/core/security/input-validation'
5-
import {
6-
getJiraCloudId,
7-
getJsmApiBaseUrl,
8-
getJsmHeaders,
9-
parseJsmErrorMessage,
10-
} from '@/tools/jsm/utils'
5+
import { getJiraCloudId, parseAtlassianErrorMessage } from '@/tools/jira/utils'
6+
import { getJsmApiBaseUrl, getJsmHeaders } from '@/tools/jsm/utils'
117

128
export const dynamic = 'force-dynamic'
139

@@ -75,7 +71,7 @@ export async function POST(request: NextRequest) {
7571

7672
return NextResponse.json(
7773
{
78-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
74+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
7975
details: errorText,
8076
},
8177
{ status: response.status }

apps/sim/app/api/tools/jsm/participants/route.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ import {
66
validateJiraCloudId,
77
validateJiraIssueKey,
88
} from '@/lib/core/security/input-validation'
9-
import {
10-
getJiraCloudId,
11-
getJsmApiBaseUrl,
12-
getJsmHeaders,
13-
parseJsmErrorMessage,
14-
} from '@/tools/jsm/utils'
9+
import { getJiraCloudId, parseAtlassianErrorMessage } from '@/tools/jira/utils'
10+
import { getJsmApiBaseUrl, getJsmHeaders } from '@/tools/jsm/utils'
1511

1612
export const dynamic = 'force-dynamic'
1713

@@ -101,7 +97,7 @@ export async function POST(request: NextRequest) {
10197

10298
return NextResponse.json(
10399
{
104-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
100+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
105101
details: errorText,
106102
},
107103
{ status: response.status }
@@ -155,7 +151,7 @@ export async function POST(request: NextRequest) {
155151

156152
return NextResponse.json(
157153
{
158-
error: parseJsmErrorMessage(response.status, response.statusText, errorText),
154+
error: parseAtlassianErrorMessage(response.status, response.statusText, errorText),
159155
details: errorText,
160156
},
161157
{ status: response.status }

0 commit comments

Comments
 (0)