Skip to content

Commit 8140a5a

Browse files
committed
remove unused types, cleaned up a lot, fixed docs
1 parent 4ee7252 commit 8140a5a

20 files changed

Lines changed: 258 additions & 250 deletions

File tree

apps/docs/content/docs/tools/microsoft_planner.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ Read tasks from Microsoft Planner - get all user tasks or all tasks from a speci
144144

145145
| Parameter | Type | Description |
146146
| --------- | ---- | ----------- |
147-
| `task` | json | task output from the block |
148-
| `metadata` | json | metadata output from the block |
147+
| `task` | json | The Microsoft Planner task object, including details such as id, title, description, status, due date, and assignees. |
148+
| `metadata` | json | Additional metadata about the operation, such as timestamps, request status, or other relevant information. |
149149

150150
### `microsoft_planner_create_task`
151151

@@ -167,8 +167,8 @@ Create a new task in Microsoft Planner
167167

168168
| Parameter | Type | Description |
169169
| --------- | ---- | ----------- |
170-
| `task` | json | task output from the block |
171-
| `metadata` | json | metadata output from the block |
170+
| `task` | json | The Microsoft Planner task object, including details such as id, title, description, status, due date, and assignees. |
171+
| `metadata` | json | Additional metadata about the operation, such as timestamps, request status, or other relevant information. |
172172

173173

174174

apps/docs/content/docs/tools/onedrive.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ Integrate OneDrive functionality to manage files and folders. Upload new files,
6868

6969
| Parameter | Type | Description |
7070
| --------- | ---- | ----------- |
71-
| `file` | json | file output from the block |
72-
| `files` | json | files output from the block |
71+
| `file` | json | The OneDrive file object, including details such as id, name, size, and more. |
72+
| `files` | json | An array of OneDrive file objects, each containing details such as id, name, size, and more. |
7373

7474
### `onedrive_create_folder`
7575

@@ -88,8 +88,8 @@ Create a new folder in OneDrive
8888

8989
| Parameter | Type | Description |
9090
| --------- | ---- | ----------- |
91-
| `file` | json | file output from the block |
92-
| `files` | json | files output from the block |
91+
| `file` | json | The OneDrive file object, including details such as id, name, size, and more. |
92+
| `files` | json | An array of OneDrive file objects, each containing details such as id, name, size, and more. |
9393

9494
### `onedrive_list`
9595

@@ -109,8 +109,8 @@ List files and folders in OneDrive
109109

110110
| Parameter | Type | Description |
111111
| --------- | ---- | ----------- |
112-
| `file` | json | file output from the block |
113-
| `files` | json | files output from the block |
112+
| `file` | json | The OneDrive file object, including details such as id, name, size, and more. |
113+
| `files` | json | An array of OneDrive file objects, each containing details such as id, name, size, and more. |
114114

115115

116116

apps/docs/content/docs/tools/sharepoint.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Create a new page in a SharePoint site
8686

8787
| Parameter | Type | Description |
8888
| --------- | ---- | ----------- |
89-
| `sites` | json | sites output from the block |
89+
| `sites` | json | An array of SharePoint site objects, each containing details such as id, name, and more. |
9090

9191
### `sharepoint_read_page`
9292

@@ -107,20 +107,25 @@ Read a specific page from a SharePoint site
107107

108108
| Parameter | Type | Description |
109109
| --------- | ---- | ----------- |
110-
| `sites` | json | sites output from the block |
110+
| `sites` | json | An array of SharePoint site objects, each containing details such as id, name, and more. |
111111

112112
### `sharepoint_list_sites`
113113

114+
List details of all SharePoint sites
115+
114116
#### Input
115117

116118
| Parameter | Type | Required | Description |
117119
| --------- | ---- | -------- | ----------- |
120+
| `accessToken` | string | Yes | The access token for the SharePoint API |
121+
| `siteSelector` | string | No | Select the SharePoint site |
122+
| `groupId` | string | No | The group ID for accessing a group team site |
118123

119124
#### Output
120125

121126
| Parameter | Type | Description |
122127
| --------- | ---- | ----------- |
123-
| `sites` | json | sites output from the block |
128+
| `sites` | json | An array of SharePoint site objects, each containing details such as id, name, and more. |
124129

125130

126131

apps/sim/app/api/knowledge/[id]/documents/[documentId]/chunks/[chunkId]/route.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import crypto from 'node:crypto'
1+
import { createHash, randomUUID } from 'crypto'
22
import { eq, sql } from 'drizzle-orm'
33
import { type NextRequest, NextResponse } from 'next/server'
44
import { z } from 'zod'
@@ -22,7 +22,7 @@ export async function GET(
2222
req: NextRequest,
2323
{ params }: { params: Promise<{ id: string; documentId: string; chunkId: string }> }
2424
) {
25-
const requestId = crypto.randomUUID().slice(0, 8)
25+
const requestId = randomUUID().slice(0, 8)
2626
const { id: knowledgeBaseId, documentId, chunkId } = await params
2727

2828
try {
@@ -70,7 +70,7 @@ export async function PUT(
7070
req: NextRequest,
7171
{ params }: { params: Promise<{ id: string; documentId: string; chunkId: string }> }
7272
) {
73-
const requestId = crypto.randomUUID().slice(0, 8)
73+
const requestId = randomUUID().slice(0, 8)
7474
const { id: knowledgeBaseId, documentId, chunkId } = await params
7575

7676
try {
@@ -119,10 +119,7 @@ export async function PUT(
119119
updateData.contentLength = validatedData.content.length
120120
// Update token count estimation (rough approximation: 4 chars per token)
121121
updateData.tokenCount = Math.ceil(validatedData.content.length / 4)
122-
updateData.chunkHash = crypto
123-
.createHash('sha256')
124-
.update(validatedData.content)
125-
.digest('hex')
122+
updateData.chunkHash = createHash('sha256').update(validatedData.content).digest('hex')
126123
}
127124

128125
if (validatedData.enabled !== undefined) updateData.enabled = validatedData.enabled
@@ -166,7 +163,7 @@ export async function DELETE(
166163
req: NextRequest,
167164
{ params }: { params: Promise<{ id: string; documentId: string; chunkId: string }> }
168165
) {
169-
const requestId = crypto.randomUUID().slice(0, 8)
166+
const requestId = randomUUID().slice(0, 8)
170167
const { id: knowledgeBaseId, documentId, chunkId } = await params
171168

172169
try {

apps/sim/app/api/knowledge/[id]/documents/route.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import crypto from 'node:crypto'
1+
import { randomUUID } from 'crypto'
22
import { and, desc, eq, inArray, isNull, sql } from 'drizzle-orm'
33
import { type NextRequest, NextResponse } from 'next/server'
44
import { z } from 'zod'
@@ -114,7 +114,7 @@ async function processDocumentTags(
114114
// Create new tag definition if we have a slot
115115
if (targetSlot) {
116116
const newDefinition = {
117-
id: crypto.randomUUID(),
117+
id: randomUUID(),
118118
knowledgeBaseId,
119119
tagSlot: targetSlot as any,
120120
displayName: tagName,
@@ -312,7 +312,7 @@ const BulkUpdateDocumentsSchema = z.object({
312312
})
313313

314314
export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
315-
const requestId = crypto.randomUUID().slice(0, 8)
315+
const requestId = randomUUID().slice(0, 8)
316316
const { id: knowledgeBaseId } = await params
317317

318318
try {
@@ -423,7 +423,7 @@ export async function GET(req: NextRequest, { params }: { params: Promise<{ id:
423423
}
424424

425425
export async function POST(req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
426-
const requestId = crypto.randomUUID().slice(0, 8)
426+
const requestId = randomUUID().slice(0, 8)
427427
const { id: knowledgeBaseId } = await params
428428

429429
try {
@@ -470,7 +470,7 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id:
470470

471471
const createdDocuments = await db.transaction(async (tx) => {
472472
const documentPromises = validatedData.documents.map(async (docData) => {
473-
const documentId = crypto.randomUUID()
473+
const documentId = randomUUID()
474474
const now = new Date()
475475

476476
// Process documentTagsData if provided (for knowledge base block)
@@ -578,7 +578,7 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id:
578578
try {
579579
const validatedData = CreateDocumentSchema.parse(body)
580580

581-
const documentId = crypto.randomUUID()
581+
const documentId = randomUUID()
582582
const now = new Date()
583583

584584
// Process structured tag data if provided

apps/sim/app/api/tools/onedrive/folder/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import crypto from 'node:crypto'
1+
import { randomUUID } from 'crypto'
22
import { eq } from 'drizzle-orm'
33
import { type NextRequest, NextResponse } from 'next/server'
44
import { getSession } from '@/lib/auth'
@@ -15,7 +15,7 @@ const logger = createLogger('OneDriveFolderAPI')
1515
* Get a single folder from Microsoft OneDrive
1616
*/
1717
export async function GET(request: NextRequest) {
18-
const requestId = crypto.randomUUID().slice(0, 8)
18+
const requestId = randomUUID().slice(0, 8)
1919

2020
try {
2121
const session = await getSession()

apps/sim/app/api/tools/onedrive/folders/route.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import crypto from 'node:crypto'
1+
import { randomUUID } from 'crypto'
22
import { eq } from 'drizzle-orm'
33
import { type NextRequest, NextResponse } from 'next/server'
44
import { getSession } from '@/lib/auth'
@@ -11,26 +11,13 @@ export const dynamic = 'force-dynamic'
1111

1212
const logger = createLogger('OneDriveFoldersAPI')
1313

14-
interface MicrosoftGraphDriveItem {
15-
id: string
16-
name: string
17-
folder?: {
18-
childCount: number
19-
}
20-
file?: {
21-
mimeType: string
22-
}
23-
webUrl: string
24-
createdDateTime: string
25-
lastModifiedDateTime: string
26-
size?: number
27-
}
14+
import type { MicrosoftGraphDriveItem } from '@/tools/onedrive/types'
2815

2916
/**
3017
* Get folders from Microsoft OneDrive
3118
*/
3219
export async function GET(request: NextRequest) {
33-
const requestId = crypto.randomUUID().slice(0, 8)
20+
const requestId = randomUUID().slice(0, 8)
3421

3522
try {
3623
const session = await getSession()

apps/sim/app/api/tools/sharepoint/site/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import crypto from 'node:crypto'
1+
import { randomUUID } from 'crypto'
22
import { eq } from 'drizzle-orm'
33
import { type NextRequest, NextResponse } from 'next/server'
44
import { getSession } from '@/lib/auth'
@@ -15,7 +15,7 @@ const logger = createLogger('SharePointSiteAPI')
1515
* Get a single SharePoint site from Microsoft Graph API
1616
*/
1717
export async function GET(request: NextRequest) {
18-
const requestId = crypto.randomUUID().slice(0, 8)
18+
const requestId = randomUUID().slice(0, 8)
1919

2020
try {
2121
const session = await getSession()

apps/sim/app/api/tools/sharepoint/sites/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import crypto from 'node:crypto'
1+
import { randomUUID } from 'crypto'
22
import { eq } from 'drizzle-orm'
33
import { type NextRequest, NextResponse } from 'next/server'
44
import { getSession } from '@/lib/auth'
@@ -16,7 +16,7 @@ const logger = createLogger('SharePointSitesAPI')
1616
* Get SharePoint sites from Microsoft Graph API
1717
*/
1818
export async function GET(request: NextRequest) {
19-
const requestId = crypto.randomUUID().slice(0, 8)
19+
const requestId = randomUUID().slice(0, 8)
2020

2121
try {
2222
const session = await getSession()

apps/sim/blocks/blocks/microsoft_planner.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,15 @@ export const MicrosoftPlannerBlock: BlockConfig<MicrosoftPlannerResponse> = {
224224
bucketId: { type: 'string', description: 'Bucket ID' },
225225
},
226226
outputs: {
227-
task: 'json',
228-
metadata: 'json',
227+
task: {
228+
type: 'json',
229+
description:
230+
'The Microsoft Planner task object, including details such as id, title, description, status, due date, and assignees.',
231+
},
232+
metadata: {
233+
type: 'json',
234+
description:
235+
'Additional metadata about the operation, such as timestamps, request status, or other relevant information.',
236+
},
229237
},
230238
}

0 commit comments

Comments
 (0)