Skip to content

Commit a991801

Browse files
committed
removed unused route
1 parent e60e515 commit a991801

File tree

5 files changed

+134
-144
lines changed

5 files changed

+134
-144
lines changed

apps/sim/app/api/tools/jira/issue/route.ts

Lines changed: 0 additions & 111 deletions
This file was deleted.

apps/sim/app/api/tools/onepassword/create-item/route.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { randomUUID } from 'crypto'
2+
import type { ItemCreateParams } from '@1password/sdk'
23
import { createLogger } from '@sim/logger'
34
import { type NextRequest, NextResponse } from 'next/server'
45
import { z } from 'zod'
@@ -62,15 +63,13 @@ export async function POST(request: NextRequest) {
6263
}))
6364
: undefined
6465

65-
// Cast to any because toSdkCategory/toSdkFieldType return string literals
66-
// that match SDK enum values but TypeScript can't verify this at compile time
6766
const item = await client.items.create({
6867
vaultId: params.vaultId,
69-
category: toSdkCategory(params.category) as any,
68+
category: toSdkCategory(params.category),
7069
title: params.title || '',
7170
tags: parsedTags,
72-
fields: parsedFields as any,
73-
})
71+
fields: parsedFields,
72+
} as ItemCreateParams)
7473

7574
return NextResponse.json(normalizeSdkItem(item))
7675
}

apps/sim/app/api/tools/onepassword/replace-item/route.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { randomUUID } from 'crypto'
2+
import type { Item } from '@1password/sdk'
23
import { createLogger } from '@sim/logger'
34
import { type NextRequest, NextResponse } from 'next/server'
45
import { z } from 'zod'
@@ -79,9 +80,9 @@ export async function POST(request: NextRequest) {
7980
autofillBehavior: 'AnywhereOnWebsite' as const,
8081
}))
8182
: existing.websites,
82-
}
83+
} as Item
8384

84-
const result = await client.items.put(sdkItem as any)
85+
const result = await client.items.put(sdkItem)
8586
return NextResponse.json(normalizeSdkItem(result))
8687
}
8788

apps/sim/app/api/tools/onepassword/update-item/route.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ export async function POST(request: NextRequest) {
3535
const body = await request.json()
3636
const params = UpdateItemSchema.parse(body)
3737
const creds = resolveCredentials(params)
38-
const ops = JSON.parse(params.operations) as Array<{
39-
op: string
40-
path: string
41-
value?: unknown
42-
}>
38+
const ops = JSON.parse(params.operations) as JsonPatchOperation[]
4339

4440
logger.info(
4541
`[${requestId}] Updating item ${params.itemId} in vault ${params.vaultId} (${creds.mode} mode)`
@@ -48,7 +44,6 @@ export async function POST(request: NextRequest) {
4844
if (creds.mode === 'service_account') {
4945
const client = await createOnePasswordClient(creds.serviceAccountToken!)
5046

51-
// SDK doesn't support PATCH — fetch, apply patches, then put
5247
const item = await client.items.get(params.vaultId, params.itemId)
5348

5449
for (const op of ops) {
@@ -89,8 +84,15 @@ export async function POST(request: NextRequest) {
8984
}
9085
}
9186

92-
/** Apply a single RFC6902 JSON Patch operation to a mutable SDK Item. */
93-
function applyPatch(item: Record<string, any>, op: { op: string; path: string; value?: unknown }) {
87+
interface JsonPatchOperation {
88+
op: 'add' | 'remove' | 'replace'
89+
path: string
90+
value?: unknown
91+
}
92+
93+
/** Apply a single RFC6902 JSON Patch operation to a mutable object. */
94+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
95+
function applyPatch(item: Record<string, any>, op: JsonPatchOperation) {
9496
const segments = op.path.split('/').filter(Boolean)
9597

9698
if (segments.length === 1) {
@@ -103,7 +105,6 @@ function applyPatch(item: Record<string, any>, op: { op: string; path: string; v
103105
return
104106
}
105107

106-
// Navigate to parent of target
107108
let target = item
108109
for (let i = 0; i < segments.length - 1; i++) {
109110
const seg = segments[i]

0 commit comments

Comments
 (0)