mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-14 08:25:03 -05:00
fix tests
This commit is contained in:
@@ -351,10 +351,11 @@ describe('OAuth Token API Routes', () => {
|
||||
*/
|
||||
describe('GET handler', () => {
|
||||
it('should return access token successfully', async () => {
|
||||
mockCheckSessionOrInternalAuth.mockResolvedValueOnce({
|
||||
success: true,
|
||||
mockAuthorizeCredentialUse.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
authType: 'session',
|
||||
userId: 'test-user-id',
|
||||
requesterUserId: 'test-user-id',
|
||||
credentialOwnerUserId: 'test-user-id',
|
||||
})
|
||||
mockGetCredential.mockResolvedValueOnce({
|
||||
id: 'credential-id',
|
||||
@@ -380,8 +381,8 @@ describe('OAuth Token API Routes', () => {
|
||||
expect(response.status).toBe(200)
|
||||
expect(data).toHaveProperty('accessToken', 'fresh-token')
|
||||
|
||||
expect(mockCheckSessionOrInternalAuth).toHaveBeenCalled()
|
||||
expect(mockGetCredential).toHaveBeenCalledWith(mockRequestId, 'credential-id', 'test-user-id')
|
||||
expect(mockAuthorizeCredentialUse).toHaveBeenCalled()
|
||||
expect(mockGetCredential).toHaveBeenCalled()
|
||||
expect(mockRefreshTokenIfNeeded).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
@@ -399,8 +400,8 @@ describe('OAuth Token API Routes', () => {
|
||||
})
|
||||
|
||||
it('should handle authentication failure', async () => {
|
||||
mockCheckSessionOrInternalAuth.mockResolvedValueOnce({
|
||||
success: false,
|
||||
mockAuthorizeCredentialUse.mockResolvedValueOnce({
|
||||
ok: false,
|
||||
error: 'Authentication required',
|
||||
})
|
||||
|
||||
@@ -413,15 +414,16 @@ describe('OAuth Token API Routes', () => {
|
||||
const response = await GET(req as any)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(401)
|
||||
expect(response.status).toBe(403)
|
||||
expect(data).toHaveProperty('error')
|
||||
})
|
||||
|
||||
it('should handle credential not found', async () => {
|
||||
mockCheckSessionOrInternalAuth.mockResolvedValueOnce({
|
||||
success: true,
|
||||
mockAuthorizeCredentialUse.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
authType: 'session',
|
||||
userId: 'test-user-id',
|
||||
requesterUserId: 'test-user-id',
|
||||
credentialOwnerUserId: 'test-user-id',
|
||||
})
|
||||
mockGetCredential.mockResolvedValueOnce(undefined)
|
||||
|
||||
@@ -439,10 +441,11 @@ describe('OAuth Token API Routes', () => {
|
||||
})
|
||||
|
||||
it('should handle missing access token', async () => {
|
||||
mockCheckSessionOrInternalAuth.mockResolvedValueOnce({
|
||||
success: true,
|
||||
mockAuthorizeCredentialUse.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
authType: 'session',
|
||||
userId: 'test-user-id',
|
||||
requesterUserId: 'test-user-id',
|
||||
credentialOwnerUserId: 'test-user-id',
|
||||
})
|
||||
mockGetCredential.mockResolvedValueOnce({
|
||||
id: 'credential-id',
|
||||
@@ -465,10 +468,11 @@ describe('OAuth Token API Routes', () => {
|
||||
})
|
||||
|
||||
it('should handle token refresh failure', async () => {
|
||||
mockCheckSessionOrInternalAuth.mockResolvedValueOnce({
|
||||
success: true,
|
||||
mockAuthorizeCredentialUse.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
authType: 'session',
|
||||
userId: 'test-user-id',
|
||||
requesterUserId: 'test-user-id',
|
||||
credentialOwnerUserId: 'test-user-id',
|
||||
})
|
||||
mockGetCredential.mockResolvedValueOnce({
|
||||
id: 'credential-id',
|
||||
|
||||
@@ -62,22 +62,23 @@ describe('OAuth Utils', () => {
|
||||
|
||||
describe('getCredential', () => {
|
||||
it('should return credential when found', async () => {
|
||||
const mockCredential = { id: 'credential-id', userId: 'test-user-id' }
|
||||
const { mockFrom, mockWhere, mockLimit } = mockSelectChain([mockCredential])
|
||||
const mockCredentialRow = { type: 'oauth', accountId: 'resolved-account-id' }
|
||||
const mockAccountRow = { id: 'resolved-account-id', userId: 'test-user-id' }
|
||||
|
||||
mockSelectChain([mockCredentialRow])
|
||||
mockSelectChain([mockAccountRow])
|
||||
|
||||
const credential = await getCredential('request-id', 'credential-id', 'test-user-id')
|
||||
|
||||
expect(mockDb.select).toHaveBeenCalled()
|
||||
expect(mockFrom).toHaveBeenCalled()
|
||||
expect(mockWhere).toHaveBeenCalled()
|
||||
expect(mockLimit).toHaveBeenCalledWith(1)
|
||||
expect(mockDb.select).toHaveBeenCalledTimes(2)
|
||||
|
||||
expect(credential).toMatchObject(mockCredential)
|
||||
expect(credential).toMatchObject({ resolvedCredentialId: 'credential-id' })
|
||||
expect(credential).toMatchObject(mockAccountRow)
|
||||
expect(credential).toMatchObject({ resolvedCredentialId: 'resolved-account-id' })
|
||||
})
|
||||
|
||||
it('should return undefined when credential is not found', async () => {
|
||||
mockSelectChain([])
|
||||
mockSelectChain([])
|
||||
|
||||
const credential = await getCredential('request-id', 'nonexistent-id', 'test-user-id')
|
||||
|
||||
@@ -159,15 +160,17 @@ describe('OAuth Utils', () => {
|
||||
|
||||
describe('refreshAccessTokenIfNeeded', () => {
|
||||
it('should return valid access token without refresh if not expired', async () => {
|
||||
const mockCredential = {
|
||||
id: 'credential-id',
|
||||
const mockCredentialRow = { type: 'oauth', accountId: 'account-id' }
|
||||
const mockAccountRow = {
|
||||
id: 'account-id',
|
||||
accessToken: 'valid-token',
|
||||
refreshToken: 'refresh-token',
|
||||
accessTokenExpiresAt: new Date(Date.now() + 3600 * 1000),
|
||||
providerId: 'google',
|
||||
userId: 'test-user-id',
|
||||
}
|
||||
mockSelectChain([mockCredential])
|
||||
mockSelectChain([mockCredentialRow])
|
||||
mockSelectChain([mockAccountRow])
|
||||
|
||||
const token = await refreshAccessTokenIfNeeded('credential-id', 'test-user-id', 'request-id')
|
||||
|
||||
@@ -176,15 +179,17 @@ describe('OAuth Utils', () => {
|
||||
})
|
||||
|
||||
it('should refresh token when expired', async () => {
|
||||
const mockCredential = {
|
||||
id: 'credential-id',
|
||||
const mockCredentialRow = { type: 'oauth', accountId: 'account-id' }
|
||||
const mockAccountRow = {
|
||||
id: 'account-id',
|
||||
accessToken: 'expired-token',
|
||||
refreshToken: 'refresh-token',
|
||||
accessTokenExpiresAt: new Date(Date.now() - 3600 * 1000),
|
||||
providerId: 'google',
|
||||
userId: 'test-user-id',
|
||||
}
|
||||
mockSelectChain([mockCredential])
|
||||
mockSelectChain([mockCredentialRow])
|
||||
mockSelectChain([mockAccountRow])
|
||||
mockUpdateChain()
|
||||
|
||||
mockRefreshOAuthToken.mockResolvedValueOnce({
|
||||
@@ -202,6 +207,7 @@ describe('OAuth Utils', () => {
|
||||
|
||||
it('should return null if credential not found', async () => {
|
||||
mockSelectChain([])
|
||||
mockSelectChain([])
|
||||
|
||||
const token = await refreshAccessTokenIfNeeded('nonexistent-id', 'test-user-id', 'request-id')
|
||||
|
||||
@@ -209,15 +215,17 @@ describe('OAuth Utils', () => {
|
||||
})
|
||||
|
||||
it('should return null if refresh fails', async () => {
|
||||
const mockCredential = {
|
||||
id: 'credential-id',
|
||||
const mockCredentialRow = { type: 'oauth', accountId: 'account-id' }
|
||||
const mockAccountRow = {
|
||||
id: 'account-id',
|
||||
accessToken: 'expired-token',
|
||||
refreshToken: 'refresh-token',
|
||||
accessTokenExpiresAt: new Date(Date.now() - 3600 * 1000),
|
||||
providerId: 'google',
|
||||
userId: 'test-user-id',
|
||||
}
|
||||
mockSelectChain([mockCredential])
|
||||
mockSelectChain([mockCredentialRow])
|
||||
mockSelectChain([mockAccountRow])
|
||||
|
||||
mockRefreshOAuthToken.mockResolvedValueOnce(null)
|
||||
|
||||
|
||||
@@ -8,15 +8,27 @@ const mockHasWorkspaceAdminAccess = vi.fn()
|
||||
let dbSelectResults: any[] = []
|
||||
let dbSelectCallIndex = 0
|
||||
|
||||
const mockDbSelect = vi.fn().mockImplementation(() => ({
|
||||
from: vi.fn().mockReturnThis(),
|
||||
where: vi.fn().mockReturnThis(),
|
||||
then: vi.fn().mockImplementation((callback: (rows: any[]) => any) => {
|
||||
const result = dbSelectResults[dbSelectCallIndex] || []
|
||||
dbSelectCallIndex++
|
||||
return Promise.resolve(callback ? callback(result) : result)
|
||||
}),
|
||||
}))
|
||||
const mockDbSelect = vi.fn().mockImplementation(() => {
|
||||
const makeThen = () =>
|
||||
vi.fn().mockImplementation((callback: (rows: any[]) => any) => {
|
||||
const result = dbSelectResults[dbSelectCallIndex] || []
|
||||
dbSelectCallIndex++
|
||||
return Promise.resolve(callback ? callback(result) : result)
|
||||
})
|
||||
const makeLimit = () =>
|
||||
vi.fn().mockImplementation(() => {
|
||||
const result = dbSelectResults[dbSelectCallIndex] || []
|
||||
dbSelectCallIndex++
|
||||
return Promise.resolve(result)
|
||||
})
|
||||
|
||||
const chain: any = {}
|
||||
chain.from = vi.fn().mockReturnValue(chain)
|
||||
chain.where = vi.fn().mockReturnValue(chain)
|
||||
chain.limit = makeLimit()
|
||||
chain.then = makeThen()
|
||||
return chain
|
||||
})
|
||||
|
||||
const mockDbInsert = vi.fn().mockImplementation(() => ({
|
||||
values: vi.fn().mockResolvedValue(undefined),
|
||||
@@ -53,6 +65,10 @@ vi.mock('@/lib/workspaces/permissions/utils', () => ({
|
||||
mockHasWorkspaceAdminAccess(userId, workspaceId),
|
||||
}))
|
||||
|
||||
vi.mock('@/lib/credentials/environment', () => ({
|
||||
syncWorkspaceEnvCredentials: vi.fn().mockResolvedValue(undefined),
|
||||
}))
|
||||
|
||||
vi.mock('@sim/logger', () => loggerMock)
|
||||
|
||||
vi.mock('@/lib/core/utils/urls', () => ({
|
||||
@@ -95,6 +111,10 @@ vi.mock('@sim/db/schema', () => ({
|
||||
userId: 'userId',
|
||||
permissionType: 'permissionType',
|
||||
},
|
||||
workspaceEnvironment: {
|
||||
workspaceId: 'workspaceId',
|
||||
variables: 'variables',
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('drizzle-orm', () => ({
|
||||
@@ -207,6 +227,7 @@ describe('Workspace Invitation [invitationId] API Route', () => {
|
||||
[mockWorkspace],
|
||||
[{ ...mockUser, email: 'invited@example.com' }],
|
||||
[],
|
||||
[],
|
||||
]
|
||||
|
||||
const request = new NextRequest(
|
||||
@@ -460,6 +481,7 @@ describe('Workspace Invitation [invitationId] API Route', () => {
|
||||
[mockWorkspace],
|
||||
[{ ...mockUser, email: 'invited@example.com' }],
|
||||
[],
|
||||
[],
|
||||
]
|
||||
|
||||
const request2 = new NextRequest(
|
||||
|
||||
@@ -763,6 +763,7 @@ Example 3 (Array Input):
|
||||
apiKey: { type: 'string', description: 'Provider API key' },
|
||||
azureEndpoint: { type: 'string', description: 'Azure endpoint URL' },
|
||||
azureApiVersion: { type: 'string', description: 'Azure API version' },
|
||||
oauthCredential: { type: 'string', description: 'OAuth credential for Vertex AI' },
|
||||
vertexProject: { type: 'string', description: 'Google Cloud project ID for Vertex AI' },
|
||||
vertexLocation: { type: 'string', description: 'Google Cloud location for Vertex AI' },
|
||||
bedrockAccessKeyId: { type: 'string', description: 'AWS Access Key ID for Bedrock' },
|
||||
|
||||
@@ -230,7 +230,7 @@ Return ONLY the valid JSON object - no explanations, no markdown.`,
|
||||
}
|
||||
},
|
||||
params: (params) => {
|
||||
const { credential, records, fields, ...rest } = params
|
||||
const { oauthCredential, records, fields, ...rest } = params
|
||||
let parsedRecords: any | undefined
|
||||
let parsedFields: any | undefined
|
||||
|
||||
@@ -248,7 +248,7 @@ Return ONLY the valid JSON object - no explanations, no markdown.`,
|
||||
|
||||
// Construct parameters based on operation
|
||||
const baseParams = {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
...rest,
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ Return ONLY the valid JSON object - no explanations, no markdown.`,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Airtable access token' },
|
||||
oauthCredential: { type: 'string', description: 'Airtable access token' },
|
||||
baseId: { type: 'string', description: 'Airtable base identifier' },
|
||||
tableId: { type: 'string', description: 'Airtable table identifier' },
|
||||
// Conditional inputs
|
||||
|
||||
@@ -225,7 +225,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
}
|
||||
},
|
||||
params: (params) => {
|
||||
const { credential, operation } = params
|
||||
const { oauthCredential, operation } = params
|
||||
|
||||
const projectsArray = params.projects
|
||||
? params.projects
|
||||
@@ -235,7 +235,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
: undefined
|
||||
|
||||
const baseParams = {
|
||||
accessToken: credential?.accessToken,
|
||||
accessToken: oauthCredential?.accessToken,
|
||||
}
|
||||
|
||||
switch (operation) {
|
||||
@@ -294,6 +294,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
oauthCredential: { type: 'string', description: 'Asana OAuth credential' },
|
||||
workspace: { type: 'string', description: 'Workspace GID' },
|
||||
taskGid: { type: 'string', description: 'Task GID' },
|
||||
getTasks_workspace: { type: 'string', description: 'Workspace GID for getting tasks' },
|
||||
|
||||
@@ -566,7 +566,7 @@ Return ONLY valid JSON - no explanations.`,
|
||||
params: (params) => {
|
||||
const {
|
||||
operation,
|
||||
credential,
|
||||
oauthCredential,
|
||||
attendeeName,
|
||||
attendeeEmail,
|
||||
attendeeTimeZone,
|
||||
@@ -756,7 +756,7 @@ Return ONLY valid JSON - no explanations.`,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Cal.com OAuth credential' },
|
||||
oauthCredential: { type: 'string', description: 'Cal.com OAuth credential' },
|
||||
eventTypeId: { type: 'number', description: 'Event type ID' },
|
||||
start: { type: 'string', description: 'Start time (ISO 8601)' },
|
||||
end: { type: 'string', description: 'End time (ISO 8601)' },
|
||||
|
||||
@@ -298,7 +298,7 @@ export const ConfluenceBlock: BlockConfig<ConfluenceResponse> = {
|
||||
},
|
||||
params: (params) => {
|
||||
const {
|
||||
credential,
|
||||
oauthCredential,
|
||||
pageId,
|
||||
operation,
|
||||
attachmentFile,
|
||||
@@ -311,7 +311,7 @@ export const ConfluenceBlock: BlockConfig<ConfluenceResponse> = {
|
||||
|
||||
if (operation === 'upload_attachment') {
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
pageId: effectivePageId,
|
||||
operation,
|
||||
file: attachmentFile,
|
||||
@@ -322,7 +322,7 @@ export const ConfluenceBlock: BlockConfig<ConfluenceResponse> = {
|
||||
}
|
||||
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
pageId: effectivePageId || undefined,
|
||||
operation,
|
||||
...rest,
|
||||
@@ -333,7 +333,7 @@ export const ConfluenceBlock: BlockConfig<ConfluenceResponse> = {
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
domain: { type: 'string', description: 'Confluence domain' },
|
||||
credential: { type: 'string', description: 'Confluence access token' },
|
||||
oauthCredential: { type: 'string', description: 'Confluence access token' },
|
||||
pageId: { type: 'string', description: 'Page identifier (canonical param)' },
|
||||
spaceId: { type: 'string', description: 'Space identifier' },
|
||||
title: { type: 'string', description: 'Page title' },
|
||||
@@ -965,7 +965,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
},
|
||||
params: (params) => {
|
||||
const {
|
||||
credential,
|
||||
oauthCredential,
|
||||
pageId,
|
||||
operation,
|
||||
attachmentFile,
|
||||
@@ -990,7 +990,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
|
||||
if (operation === 'add_label') {
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
pageId: effectivePageId,
|
||||
operation,
|
||||
prefix: labelPrefix || 'global',
|
||||
@@ -1000,7 +1000,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
|
||||
if (operation === 'create_blogpost') {
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
operation,
|
||||
status: blogPostStatus || 'current',
|
||||
...rest,
|
||||
@@ -1009,7 +1009,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
|
||||
if (operation === 'delete') {
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
pageId: effectivePageId,
|
||||
operation,
|
||||
purge: purge || false,
|
||||
@@ -1019,7 +1019,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
|
||||
if (operation === 'list_comments') {
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
pageId: effectivePageId,
|
||||
operation,
|
||||
bodyFormat: bodyFormat || 'storage',
|
||||
@@ -1045,7 +1045,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
|
||||
if (supportsCursor.includes(operation) && cursor) {
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
pageId: effectivePageId || undefined,
|
||||
operation,
|
||||
cursor,
|
||||
@@ -1058,7 +1058,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
throw new Error('Property key is required for this operation.')
|
||||
}
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
pageId: effectivePageId,
|
||||
operation,
|
||||
key: propertyKey,
|
||||
@@ -1069,7 +1069,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
|
||||
if (operation === 'delete_page_property') {
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
pageId: effectivePageId,
|
||||
operation,
|
||||
propertyId,
|
||||
@@ -1079,7 +1079,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
|
||||
if (operation === 'get_pages_by_label') {
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
operation,
|
||||
labelId,
|
||||
cursor: cursor || undefined,
|
||||
@@ -1089,7 +1089,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
|
||||
if (operation === 'list_space_labels') {
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
operation,
|
||||
cursor: cursor || undefined,
|
||||
...rest,
|
||||
@@ -1102,7 +1102,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
throw new Error('File is required for upload attachment operation.')
|
||||
}
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
pageId: effectivePageId,
|
||||
operation,
|
||||
file: normalizedFile,
|
||||
@@ -1113,7 +1113,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
}
|
||||
|
||||
return {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
pageId: effectivePageId || undefined,
|
||||
blogPostId: blogPostId || undefined,
|
||||
versionNumber: versionNumber ? Number.parseInt(String(versionNumber), 10) : undefined,
|
||||
@@ -1126,7 +1126,7 @@ export const ConfluenceV2Block: BlockConfig<ConfluenceResponse> = {
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
domain: { type: 'string', description: 'Confluence domain' },
|
||||
credential: { type: 'string', description: 'Confluence access token' },
|
||||
oauthCredential: { type: 'string', description: 'Confluence access token' },
|
||||
pageId: { type: 'string', description: 'Page identifier (canonical param)' },
|
||||
spaceId: { type: 'string', description: 'Space identifier' },
|
||||
blogPostId: { type: 'string', description: 'Blog post identifier' },
|
||||
|
||||
@@ -363,7 +363,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Dropbox OAuth credential' },
|
||||
oauthCredential: { type: 'string', description: 'Dropbox OAuth credential' },
|
||||
// Common inputs
|
||||
path: { type: 'string', description: 'Path in Dropbox' },
|
||||
autorename: { type: 'boolean', description: 'Auto-rename on conflict' },
|
||||
|
||||
@@ -478,7 +478,7 @@ Return ONLY the search query - no explanations, no extra text.`,
|
||||
|
||||
return {
|
||||
...rest,
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
...(normalizedAttachments && { attachments: normalizedAttachments }),
|
||||
}
|
||||
},
|
||||
@@ -486,7 +486,7 @@ Return ONLY the search query - no explanations, no extra text.`,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Gmail access token' },
|
||||
oauthCredential: { type: 'string', description: 'Gmail access token' },
|
||||
// Send operation inputs
|
||||
to: { type: 'string', description: 'Recipient email address' },
|
||||
subject: { type: 'string', description: 'Email subject' },
|
||||
|
||||
@@ -523,7 +523,7 @@ Return ONLY the natural language event text - no explanations.`,
|
||||
},
|
||||
params: (params) => {
|
||||
const {
|
||||
credential,
|
||||
oauthCredential,
|
||||
operation,
|
||||
attendees,
|
||||
replaceExisting,
|
||||
@@ -587,7 +587,7 @@ Return ONLY the natural language event text - no explanations.`,
|
||||
}
|
||||
|
||||
return {
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
...processedParams,
|
||||
}
|
||||
},
|
||||
@@ -595,7 +595,7 @@ Return ONLY the natural language event text - no explanations.`,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Google Calendar access token' },
|
||||
oauthCredential: { type: 'string', description: 'Google Calendar access token' },
|
||||
calendarId: { type: 'string', description: 'Calendar identifier (canonical param)' },
|
||||
|
||||
// Create/Update operation inputs
|
||||
|
||||
@@ -177,14 +177,14 @@ Return ONLY the document content - no explanations, no extra text.`,
|
||||
...rest,
|
||||
documentId: effectiveDocumentId || undefined,
|
||||
folderId: effectiveFolderId || undefined,
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Google Docs access token' },
|
||||
oauthCredential: { type: 'string', description: 'Google Docs access token' },
|
||||
documentId: { type: 'string', description: 'Document identifier (canonical param)' },
|
||||
title: { type: 'string', description: 'Document title' },
|
||||
folderId: { type: 'string', description: 'Parent folder identifier (canonical param)' },
|
||||
|
||||
@@ -884,7 +884,7 @@ Return ONLY the message text - no subject line, no greetings/signatures, no extr
|
||||
sendNotification === 'true' ? true : sendNotification === 'false' ? false : undefined
|
||||
|
||||
return {
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
folderId: effectiveFolderId,
|
||||
fileId: effectiveFileId,
|
||||
destinationFolderId: effectiveDestinationFolderId,
|
||||
@@ -902,7 +902,7 @@ Return ONLY the message text - no subject line, no greetings/signatures, no extr
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Google Drive access token' },
|
||||
oauthCredential: { type: 'string', description: 'Google Drive access token' },
|
||||
// Folder canonical params (per-operation)
|
||||
uploadFolderId: { type: 'string', description: 'Parent folder for upload/create' },
|
||||
createFolderParentId: { type: 'string', description: 'Parent folder for create folder' },
|
||||
|
||||
@@ -262,7 +262,7 @@ Example for "Add a required multiple choice question about favorite color":
|
||||
...rest
|
||||
} = params
|
||||
|
||||
const baseParams = { ...rest, credential: oauthCredential }
|
||||
const baseParams = { ...rest, oauthCredential }
|
||||
const effectiveFormId = formId ? String(formId).trim() : undefined
|
||||
|
||||
switch (operation) {
|
||||
@@ -320,7 +320,7 @@ Example for "Add a required multiple choice question about favorite color":
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Google OAuth credential' },
|
||||
oauthCredential: { type: 'string', description: 'Google OAuth credential' },
|
||||
formId: { type: 'string', description: 'Google Form ID' },
|
||||
responseId: { type: 'string', description: 'Specific response ID' },
|
||||
pageSize: { type: 'string', description: 'Max responses to retrieve' },
|
||||
|
||||
@@ -327,7 +327,7 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
|
||||
switch (operation) {
|
||||
case 'list_groups':
|
||||
return {
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
customer: rest.customer,
|
||||
domain: rest.domain,
|
||||
query: rest.query,
|
||||
@@ -401,29 +401,29 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
|
||||
}
|
||||
case 'remove_alias':
|
||||
return {
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
groupKey: rest.groupKey,
|
||||
alias: rest.alias,
|
||||
}
|
||||
case 'get_settings':
|
||||
return {
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
groupEmail: rest.groupEmail,
|
||||
}
|
||||
case 'update_settings':
|
||||
return {
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
groupEmail: rest.groupEmail,
|
||||
}
|
||||
default:
|
||||
return { credential: oauthCredential, ...rest }
|
||||
return { oauthCredential, ...rest }
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Google Workspace OAuth credential' },
|
||||
oauthCredential: { type: 'string', description: 'Google Workspace OAuth credential' },
|
||||
customer: { type: 'string', description: 'Customer ID for listing groups' },
|
||||
domain: { type: 'string', description: 'Domain filter for listing groups' },
|
||||
query: { type: 'string', description: 'Search query for filtering groups' },
|
||||
|
||||
@@ -271,14 +271,14 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
...rest,
|
||||
spreadsheetId: effectiveSpreadsheetId,
|
||||
values: parsedValues,
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Google Sheets access token' },
|
||||
oauthCredential: { type: 'string', description: 'Google Sheets access token' },
|
||||
spreadsheetId: { type: 'string', description: 'Spreadsheet identifier (canonical param)' },
|
||||
range: { type: 'string', description: 'Cell range' },
|
||||
values: { type: 'string', description: 'Cell values data' },
|
||||
@@ -761,7 +761,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
return {
|
||||
title: (title as string)?.trim(),
|
||||
sheetTitles: sheetTitlesArray,
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,7 +775,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
if (operation === 'get_info') {
|
||||
return {
|
||||
spreadsheetId: effectiveSpreadsheetId,
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,7 +785,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
return {
|
||||
spreadsheetId: effectiveSpreadsheetId,
|
||||
ranges: parsedRanges,
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -796,7 +796,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
...rest,
|
||||
spreadsheetId: effectiveSpreadsheetId,
|
||||
data: parsedData,
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -806,7 +806,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
return {
|
||||
spreadsheetId: effectiveSpreadsheetId,
|
||||
ranges: parsedRanges,
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,7 +816,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
sourceSpreadsheetId: effectiveSpreadsheetId,
|
||||
sheetId: Number.parseInt(sheetId as string, 10),
|
||||
destinationSpreadsheetId: (destinationSpreadsheetId as string)?.trim(),
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -835,14 +835,14 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
sheetName: effectiveSheetName,
|
||||
cellRange: cellRange ? (cellRange as string).trim() : undefined,
|
||||
values: parsedValues,
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Google Sheets access token' },
|
||||
oauthCredential: { type: 'string', description: 'Google Sheets access token' },
|
||||
spreadsheetId: { type: 'string', description: 'Spreadsheet identifier (canonical param)' },
|
||||
sheetName: { type: 'string', description: 'Name of the sheet/tab (canonical param)' },
|
||||
cellRange: { type: 'string', description: 'Cell range (e.g., A1:D10)' },
|
||||
|
||||
@@ -673,7 +673,7 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
|
||||
},
|
||||
params: (params) => {
|
||||
const {
|
||||
credential,
|
||||
oauthCredential,
|
||||
presentationId,
|
||||
folderId,
|
||||
slideIndex,
|
||||
@@ -690,7 +690,7 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
|
||||
const result: Record<string, any> = {
|
||||
...rest,
|
||||
presentationId: effectivePresentationId || undefined,
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
}
|
||||
|
||||
// Handle operation-specific params
|
||||
@@ -810,7 +810,7 @@ Return ONLY the text content - no explanations, no markdown formatting markers,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Google Slides access token' },
|
||||
oauthCredential: { type: 'string', description: 'Google Slides access token' },
|
||||
presentationId: { type: 'string', description: 'Presentation identifier (canonical param)' },
|
||||
// Write operation
|
||||
slideIndex: { type: 'number', description: 'Slide index to write to' },
|
||||
|
||||
@@ -452,7 +452,7 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
|
||||
const { oauthCredential, holdStartTime, holdEndTime, holdTerms, ...rest } = params
|
||||
return {
|
||||
...rest,
|
||||
credential: oauthCredential,
|
||||
oauthCredential,
|
||||
// Map hold-specific fields to their tool parameter names
|
||||
...(holdStartTime && { startTime: holdStartTime }),
|
||||
...(holdEndTime && { endTime: holdEndTime }),
|
||||
@@ -464,7 +464,7 @@ Return ONLY the description text - no explanations, no quotes, no extra text.`,
|
||||
inputs: {
|
||||
// Core inputs
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Google Vault OAuth credential' },
|
||||
oauthCredential: { type: 'string', description: 'Google Vault OAuth credential' },
|
||||
matterId: { type: 'string', description: 'Matter ID' },
|
||||
|
||||
// Create export inputs
|
||||
|
||||
@@ -834,7 +834,7 @@ Return ONLY the JSON array of property names - no explanations, no markdown, no
|
||||
},
|
||||
params: (params) => {
|
||||
const {
|
||||
credential,
|
||||
oauthCredential,
|
||||
operation,
|
||||
propertiesToSet,
|
||||
properties,
|
||||
@@ -846,7 +846,7 @@ Return ONLY the JSON array of property names - no explanations, no markdown, no
|
||||
} = params
|
||||
|
||||
const cleanParams: Record<string, any> = {
|
||||
credential,
|
||||
oauthCredential,
|
||||
}
|
||||
|
||||
const createUpdateOps = [
|
||||
@@ -901,7 +901,7 @@ Return ONLY the JSON array of property names - no explanations, no markdown, no
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'HubSpot access token' },
|
||||
oauthCredential: { type: 'string', description: 'HubSpot access token' },
|
||||
contactId: { type: 'string', description: 'Contact ID or email' },
|
||||
companyId: { type: 'string', description: 'Company ID or domain' },
|
||||
idProperty: { type: 'string', description: 'Property name to use as unique identifier' },
|
||||
|
||||
@@ -800,14 +800,14 @@ Return ONLY the comment text - no explanations.`,
|
||||
}
|
||||
},
|
||||
params: (params) => {
|
||||
const { credential, projectId, issueKey, ...rest } = params
|
||||
const { oauthCredential, projectId, issueKey, ...rest } = params
|
||||
|
||||
// Use canonical param IDs (raw subBlock IDs are deleted after serialization)
|
||||
const effectiveProjectId = projectId ? String(projectId).trim() : ''
|
||||
const effectiveIssueKey = issueKey ? String(issueKey).trim() : ''
|
||||
|
||||
const baseParams = {
|
||||
credential,
|
||||
oauthCredential,
|
||||
domain: params.domain,
|
||||
}
|
||||
|
||||
@@ -1060,7 +1060,7 @@ Return ONLY the comment text - no explanations.`,
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
domain: { type: 'string', description: 'Jira domain' },
|
||||
credential: { type: 'string', description: 'Jira access token' },
|
||||
oauthCredential: { type: 'string', description: 'Jira access token' },
|
||||
issueKey: { type: 'string', description: 'Issue key identifier (canonical param)' },
|
||||
projectId: { type: 'string', description: 'Project identifier (canonical param)' },
|
||||
// Update/Write operation inputs
|
||||
|
||||
@@ -504,7 +504,7 @@ Return ONLY the comment text - no explanations.`,
|
||||
},
|
||||
params: (params) => {
|
||||
const baseParams = {
|
||||
credential: params.credential,
|
||||
oauthCredential: params.oauthCredential,
|
||||
domain: params.domain,
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@ Return ONLY the comment text - no explanations.`,
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
domain: { type: 'string', description: 'Jira domain' },
|
||||
credential: { type: 'string', description: 'Jira Service Management access token' },
|
||||
oauthCredential: { type: 'string', description: 'Jira Service Management access token' },
|
||||
serviceDeskId: { type: 'string', description: 'Service desk ID' },
|
||||
requestTypeId: { type: 'string', description: 'Request type ID' },
|
||||
issueIdOrKey: { type: 'string', description: 'Issue ID or key' },
|
||||
|
||||
@@ -1515,7 +1515,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
|
||||
// Base params that most operations need
|
||||
const baseParams: Record<string, any> = {
|
||||
credential: params.credential,
|
||||
oauthCredential: params.oauthCredential,
|
||||
}
|
||||
|
||||
// Operation-specific param mapping
|
||||
@@ -2334,7 +2334,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Linear access token' },
|
||||
oauthCredential: { type: 'string', description: 'Linear access token' },
|
||||
teamId: { type: 'string', description: 'Linear team identifier (canonical param)' },
|
||||
projectId: { type: 'string', description: 'Linear project identifier (canonical param)' },
|
||||
issueId: { type: 'string', description: 'Issue identifier' },
|
||||
|
||||
@@ -91,25 +91,25 @@ export const LinkedInBlock: BlockConfig<LinkedInResponse> = {
|
||||
},
|
||||
params: (inputs) => {
|
||||
const operation = inputs.operation || 'share_post'
|
||||
const { credential, ...rest } = inputs
|
||||
const { oauthCredential, ...rest } = inputs
|
||||
|
||||
if (operation === 'get_profile') {
|
||||
return {
|
||||
accessToken: credential,
|
||||
accessToken: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
text: rest.text,
|
||||
visibility: rest.visibility || 'PUBLIC',
|
||||
accessToken: credential,
|
||||
accessToken: oauthCredential,
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'LinkedIn access token' },
|
||||
oauthCredential: { type: 'string', description: 'LinkedIn access token' },
|
||||
text: { type: 'string', description: 'Post text content' },
|
||||
visibility: { type: 'string', description: 'Post visibility (PUBLIC or CONNECTIONS)' },
|
||||
},
|
||||
|
||||
@@ -252,7 +252,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
}
|
||||
},
|
||||
params: (params) => {
|
||||
const { credential, values, spreadsheetId, tableName, worksheetName, ...rest } = params
|
||||
const { oauthCredential, values, spreadsheetId, tableName, worksheetName, ...rest } = params
|
||||
|
||||
// Use canonical param ID (raw subBlock IDs are deleted after serialization)
|
||||
const effectiveSpreadsheetId = spreadsheetId ? String(spreadsheetId).trim() : ''
|
||||
@@ -280,7 +280,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
...rest,
|
||||
spreadsheetId: effectiveSpreadsheetId,
|
||||
values: parsedValues,
|
||||
credential,
|
||||
oauthCredential,
|
||||
}
|
||||
|
||||
if (params.operation === 'table_add') {
|
||||
@@ -303,7 +303,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Microsoft Excel access token' },
|
||||
oauthCredential: { type: 'string', description: 'Microsoft Excel access token' },
|
||||
spreadsheetId: { type: 'string', description: 'Spreadsheet identifier (canonical param)' },
|
||||
range: { type: 'string', description: 'Cell range' },
|
||||
tableName: { type: 'string', description: 'Table name' },
|
||||
@@ -519,7 +519,7 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
fallbackToolId: 'microsoft_excel_read_v2',
|
||||
}),
|
||||
params: (params) => {
|
||||
const { credential, values, spreadsheetId, sheetName, cellRange, ...rest } = params
|
||||
const { oauthCredential, values, spreadsheetId, sheetName, cellRange, ...rest } = params
|
||||
|
||||
const parsedValues = values ? JSON.parse(values as string) : undefined
|
||||
|
||||
@@ -541,14 +541,14 @@ Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
|
||||
sheetName: effectiveSheetName,
|
||||
cellRange: cellRange ? (cellRange as string).trim() : undefined,
|
||||
values: parsedValues,
|
||||
credential,
|
||||
oauthCredential,
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Microsoft Excel access token' },
|
||||
oauthCredential: { type: 'string', description: 'Microsoft Excel access token' },
|
||||
spreadsheetId: { type: 'string', description: 'Spreadsheet identifier (canonical param)' },
|
||||
sheetName: { type: 'string', description: 'Name of the sheet/tab (canonical param)' },
|
||||
cellRange: { type: 'string', description: 'Cell range (e.g., A1:D10)' },
|
||||
|
||||
@@ -4,7 +4,7 @@ import { AuthMode } from '@/blocks/types'
|
||||
import type { MicrosoftPlannerResponse } from '@/tools/microsoft_planner/types'
|
||||
|
||||
interface MicrosoftPlannerBlockParams {
|
||||
credential: string
|
||||
oauthCredential: string
|
||||
accessToken?: string
|
||||
planId?: string
|
||||
taskId?: string
|
||||
@@ -360,7 +360,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
|
||||
},
|
||||
params: (params) => {
|
||||
const {
|
||||
credential,
|
||||
oauthCredential,
|
||||
operation,
|
||||
groupId,
|
||||
planId,
|
||||
@@ -385,7 +385,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
|
||||
|
||||
const baseParams: MicrosoftPlannerBlockParams = {
|
||||
...rest,
|
||||
credential,
|
||||
oauthCredential,
|
||||
}
|
||||
|
||||
// Handle different task ID fields based on operation
|
||||
@@ -570,7 +570,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Microsoft account credential' },
|
||||
oauthCredential: { type: 'string', description: 'Microsoft account credential' },
|
||||
groupId: { type: 'string', description: 'Microsoft 365 group ID' },
|
||||
planId: { type: 'string', description: 'Plan ID' },
|
||||
readTaskId: { type: 'string', description: 'Task ID for read operation' },
|
||||
|
||||
@@ -332,7 +332,7 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
},
|
||||
params: (params) => {
|
||||
const {
|
||||
credential,
|
||||
oauthCredential,
|
||||
operation,
|
||||
teamId, // Canonical param from teamSelector (basic) or manualTeamId (advanced)
|
||||
chatId, // Canonical param from chatSelector (basic) or manualChatId (advanced)
|
||||
@@ -350,7 +350,7 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
|
||||
const baseParams: Record<string, any> = {
|
||||
...rest,
|
||||
credential,
|
||||
oauthCredential,
|
||||
}
|
||||
|
||||
if ((operation === 'read_chat' || operation === 'read_channel') && includeAttachments) {
|
||||
@@ -430,7 +430,7 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Microsoft Teams access token' },
|
||||
oauthCredential: { type: 'string', description: 'Microsoft Teams access token' },
|
||||
messageId: {
|
||||
type: 'string',
|
||||
description: 'Message identifier for update/delete/reply/reaction operations',
|
||||
|
||||
@@ -313,7 +313,7 @@ export const NotionBlock: BlockConfig<NotionResponse> = {
|
||||
}
|
||||
},
|
||||
params: (params) => {
|
||||
const { credential, operation, properties, filter, sorts, ...rest } = params
|
||||
const { oauthCredential, operation, properties, filter, sorts, ...rest } = params
|
||||
|
||||
// Parse properties from JSON string for create/add operations
|
||||
let parsedProperties
|
||||
@@ -362,7 +362,7 @@ export const NotionBlock: BlockConfig<NotionResponse> = {
|
||||
|
||||
return {
|
||||
...rest,
|
||||
credential,
|
||||
oauthCredential,
|
||||
...(parsedProperties ? { properties: parsedProperties } : {}),
|
||||
...(parsedFilter ? { filter: JSON.stringify(parsedFilter) } : {}),
|
||||
...(parsedSorts ? { sorts: JSON.stringify(parsedSorts) } : {}),
|
||||
@@ -372,7 +372,7 @@ export const NotionBlock: BlockConfig<NotionResponse> = {
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Notion access token' },
|
||||
oauthCredential: { type: 'string', description: 'Notion access token' },
|
||||
pageId: { type: 'string', description: 'Page identifier' },
|
||||
content: { type: 'string', description: 'Page content' },
|
||||
// Create page inputs
|
||||
|
||||
@@ -365,7 +365,7 @@ export const OneDriveBlock: BlockConfig<OneDriveResponse> = {
|
||||
},
|
||||
params: (params) => {
|
||||
const {
|
||||
credential,
|
||||
oauthCredential,
|
||||
// Folder canonical params (per-operation)
|
||||
uploadFolderId,
|
||||
createFolderParentId,
|
||||
@@ -415,7 +415,7 @@ export const OneDriveBlock: BlockConfig<OneDriveResponse> = {
|
||||
}
|
||||
|
||||
return {
|
||||
credential,
|
||||
oauthCredential,
|
||||
...rest,
|
||||
values: normalizedValues,
|
||||
file: normalizedFile,
|
||||
@@ -430,7 +430,7 @@ export const OneDriveBlock: BlockConfig<OneDriveResponse> = {
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Microsoft account credential' },
|
||||
oauthCredential: { type: 'string', description: 'Microsoft account credential' },
|
||||
// Upload and Create operation inputs
|
||||
fileName: { type: 'string', description: 'File name' },
|
||||
file: { type: 'json', description: 'File to upload (UserFile object)' },
|
||||
|
||||
@@ -337,7 +337,7 @@ export const OutlookBlock: BlockConfig<OutlookResponse> = {
|
||||
},
|
||||
params: (params) => {
|
||||
const {
|
||||
credential,
|
||||
oauthCredential,
|
||||
folder,
|
||||
destinationId,
|
||||
copyDestinationId,
|
||||
@@ -396,14 +396,14 @@ export const OutlookBlock: BlockConfig<OutlookResponse> = {
|
||||
|
||||
return {
|
||||
...rest,
|
||||
credential,
|
||||
oauthCredential,
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Outlook access token' },
|
||||
oauthCredential: { type: 'string', description: 'Outlook access token' },
|
||||
// Send operation inputs
|
||||
to: { type: 'string', description: 'Recipient email address' },
|
||||
subject: { type: 'string', description: 'Email subject' },
|
||||
|
||||
@@ -757,10 +757,10 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
}
|
||||
},
|
||||
params: (params) => {
|
||||
const { credential, operation, ...rest } = params
|
||||
const { oauthCredential, operation, ...rest } = params
|
||||
|
||||
const cleanParams: Record<string, any> = {
|
||||
credential,
|
||||
oauthCredential,
|
||||
}
|
||||
|
||||
Object.entries(rest).forEach(([key, value]) => {
|
||||
@@ -775,7 +775,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Pipedrive access token' },
|
||||
oauthCredential: { type: 'string', description: 'Pipedrive access token' },
|
||||
deal_id: { type: 'string', description: 'Deal ID' },
|
||||
title: { type: 'string', description: 'Title' },
|
||||
value: { type: 'string', description: 'Monetary value' },
|
||||
|
||||
@@ -566,7 +566,7 @@ export const RedditBlock: BlockConfig<RedditResponse> = {
|
||||
},
|
||||
params: (inputs) => {
|
||||
const operation = inputs.operation || 'get_posts'
|
||||
const { credential, ...rest } = inputs
|
||||
const { oauthCredential, ...rest } = inputs
|
||||
|
||||
if (operation === 'get_comments') {
|
||||
return {
|
||||
@@ -574,7 +574,7 @@ export const RedditBlock: BlockConfig<RedditResponse> = {
|
||||
subreddit: rest.subreddit,
|
||||
sort: rest.commentSort,
|
||||
limit: rest.commentLimit ? Number.parseInt(rest.commentLimit) : undefined,
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ export const RedditBlock: BlockConfig<RedditResponse> = {
|
||||
subreddit: rest.subreddit,
|
||||
time: rest.controversialTime,
|
||||
limit: rest.controversialLimit ? Number.parseInt(rest.controversialLimit) : undefined,
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -594,7 +594,7 @@ export const RedditBlock: BlockConfig<RedditResponse> = {
|
||||
sort: rest.searchSort,
|
||||
time: rest.searchTime,
|
||||
limit: rest.searchLimit ? Number.parseInt(rest.searchLimit) : undefined,
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,7 +606,7 @@ export const RedditBlock: BlockConfig<RedditResponse> = {
|
||||
url: rest.postType === 'link' ? rest.url : undefined,
|
||||
nsfw: rest.nsfw === 'true',
|
||||
spoiler: rest.spoiler === 'true',
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,7 +614,7 @@ export const RedditBlock: BlockConfig<RedditResponse> = {
|
||||
return {
|
||||
id: rest.voteId,
|
||||
dir: Number.parseInt(rest.voteDirection),
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -622,14 +622,14 @@ export const RedditBlock: BlockConfig<RedditResponse> = {
|
||||
return {
|
||||
id: rest.saveId,
|
||||
category: rest.saveCategory,
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
if (operation === 'unsave') {
|
||||
return {
|
||||
id: rest.saveId,
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -637,7 +637,7 @@ export const RedditBlock: BlockConfig<RedditResponse> = {
|
||||
return {
|
||||
parent_id: rest.replyParentId,
|
||||
text: rest.replyText,
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -645,14 +645,14 @@ export const RedditBlock: BlockConfig<RedditResponse> = {
|
||||
return {
|
||||
thing_id: rest.editThingId,
|
||||
text: rest.editText,
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
if (operation === 'delete') {
|
||||
return {
|
||||
id: rest.deleteId,
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ export const RedditBlock: BlockConfig<RedditResponse> = {
|
||||
return {
|
||||
subreddit: rest.subscribeSubreddit,
|
||||
action: rest.subscribeAction,
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,14 +669,14 @@ export const RedditBlock: BlockConfig<RedditResponse> = {
|
||||
sort: rest.sort,
|
||||
limit: rest.limit ? Number.parseInt(rest.limit) : undefined,
|
||||
time: rest.sort === 'top' ? rest.time : undefined,
|
||||
credential: credential,
|
||||
oauthCredential: oauthCredential,
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Reddit access token' },
|
||||
oauthCredential: { type: 'string', description: 'Reddit access token' },
|
||||
subreddit: { type: 'string', description: 'Subreddit name' },
|
||||
sort: { type: 'string', description: 'Sort order' },
|
||||
time: { type: 'string', description: 'Time filter' },
|
||||
|
||||
@@ -625,8 +625,8 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
}
|
||||
},
|
||||
params: (params) => {
|
||||
const { credential, operation, ...rest } = params
|
||||
const cleanParams: Record<string, any> = { credential }
|
||||
const { oauthCredential, operation, ...rest } = params
|
||||
const cleanParams: Record<string, any> = { oauthCredential }
|
||||
Object.entries(rest).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== null && value !== '') {
|
||||
cleanParams[key] = value
|
||||
@@ -638,7 +638,7 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Salesforce credential' },
|
||||
oauthCredential: { type: 'string', description: 'Salesforce credential' },
|
||||
},
|
||||
outputs: {
|
||||
success: { type: 'boolean', description: 'Operation success status' },
|
||||
|
||||
@@ -413,7 +413,7 @@ Return ONLY the JSON object - no explanations, no markdown, no extra text.`,
|
||||
}
|
||||
},
|
||||
params: (params) => {
|
||||
const { credential, siteId, mimeType, ...rest } = params
|
||||
const { oauthCredential, siteId, mimeType, ...rest } = params
|
||||
|
||||
// siteId is the canonical param from siteSelector (basic) or manualSiteId (advanced)
|
||||
const effectiveSiteId = siteId ? String(siteId).trim() : ''
|
||||
@@ -471,7 +471,7 @@ Return ONLY the JSON object - no explanations, no markdown, no extra text.`,
|
||||
// Handle file upload files parameter using canonical param
|
||||
const normalizedFiles = normalizeFileInput(files)
|
||||
const baseParams: Record<string, any> = {
|
||||
credential,
|
||||
oauthCredential,
|
||||
siteId: effectiveSiteId || undefined,
|
||||
pageSize: others.pageSize ? Number.parseInt(others.pageSize as string, 10) : undefined,
|
||||
mimeType: mimeType,
|
||||
@@ -497,7 +497,7 @@ Return ONLY the JSON object - no explanations, no markdown, no extra text.`,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Microsoft account credential' },
|
||||
oauthCredential: { type: 'string', description: 'Microsoft account credential' },
|
||||
pageName: { type: 'string', description: 'Page name' },
|
||||
columnDefinitions: {
|
||||
type: 'string',
|
||||
|
||||
@@ -538,7 +538,7 @@ export const ShopifyBlock: BlockConfig<ShopifyResponse> = {
|
||||
},
|
||||
params: (params) => {
|
||||
const baseParams: Record<string, unknown> = {
|
||||
credential: params.credential,
|
||||
oauthCredential: params.oauthCredential,
|
||||
shopDomain: params.shopDomain?.trim(),
|
||||
}
|
||||
|
||||
@@ -785,7 +785,7 @@ export const ShopifyBlock: BlockConfig<ShopifyResponse> = {
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Shopify access token' },
|
||||
oauthCredential: { type: 'string', description: 'Shopify access token' },
|
||||
shopDomain: { type: 'string', description: 'Shopify store domain' },
|
||||
// Product inputs
|
||||
productId: { type: 'string', description: 'Product ID' },
|
||||
|
||||
@@ -717,7 +717,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
authMethod: { type: 'string', description: 'Authentication method' },
|
||||
destinationType: { type: 'string', description: 'Destination type (channel or dm)' },
|
||||
credential: { type: 'string', description: 'Slack access token' },
|
||||
oauthCredential: { type: 'string', description: 'Slack access token' },
|
||||
botToken: { type: 'string', description: 'Bot token' },
|
||||
channel: { type: 'string', description: 'Channel identifier (canonical param)' },
|
||||
dmUserId: { type: 'string', description: 'User ID for DM recipient (canonical param)' },
|
||||
|
||||
@@ -807,7 +807,7 @@ export const SpotifyBlock: BlockConfig<ToolResponse> = {
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Spotify OAuth credential' },
|
||||
oauthCredential: { type: 'string', description: 'Spotify OAuth credential' },
|
||||
// Search
|
||||
query: { type: 'string', description: 'Search query' },
|
||||
type: { type: 'string', description: 'Search type' },
|
||||
|
||||
@@ -405,7 +405,7 @@ Return ONLY the date/timestamp string - no explanations, no quotes, no extra tex
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Trello operation to perform' },
|
||||
credential: { type: 'string', description: 'Trello OAuth credential' },
|
||||
oauthCredential: { type: 'string', description: 'Trello OAuth credential' },
|
||||
boardId: { type: 'string', description: 'Board ID' },
|
||||
listId: { type: 'string', description: 'List ID' },
|
||||
cardId: { type: 'string', description: 'Card ID' },
|
||||
|
||||
@@ -180,14 +180,14 @@ Return ONLY the date/time string - no explanations, no quotes, no extra text.`,
|
||||
}
|
||||
},
|
||||
params: (params) => {
|
||||
const { credential, operation, contactId, taskId, ...rest } = params
|
||||
const { oauthCredential, operation, contactId, taskId, ...rest } = params
|
||||
|
||||
// contactId is the canonical param for both basic (file-selector) and advanced (manualContactId) modes
|
||||
const effectiveContactId = contactId ? String(contactId).trim() : ''
|
||||
|
||||
const baseParams = {
|
||||
...rest,
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
}
|
||||
|
||||
if (operation === 'read_note' || operation === 'write_note') {
|
||||
@@ -231,7 +231,7 @@ Return ONLY the date/time string - no explanations, no quotes, no extra text.`,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Wealthbox access token' },
|
||||
oauthCredential: { type: 'string', description: 'Wealthbox access token' },
|
||||
noteId: { type: 'string', description: 'Note identifier' },
|
||||
contactId: { type: 'string', description: 'Contact identifier' },
|
||||
taskId: { type: 'string', description: 'Task identifier' },
|
||||
|
||||
@@ -167,7 +167,7 @@ export const WebflowBlock: BlockConfig<WebflowResponse> = {
|
||||
},
|
||||
params: (params) => {
|
||||
const {
|
||||
credential,
|
||||
oauthCredential,
|
||||
fieldData,
|
||||
siteId, // Canonical param from siteSelector (basic) or manualSiteId (advanced)
|
||||
collectionId, // Canonical param from collectionSelector (basic) or manualCollectionId (advanced)
|
||||
@@ -189,7 +189,7 @@ export const WebflowBlock: BlockConfig<WebflowResponse> = {
|
||||
const effectiveItemId = itemId ? String(itemId).trim() : ''
|
||||
|
||||
const baseParams = {
|
||||
credential,
|
||||
credential: oauthCredential,
|
||||
siteId: effectiveSiteId,
|
||||
collectionId: effectiveCollectionId,
|
||||
...rest,
|
||||
@@ -214,7 +214,7 @@ export const WebflowBlock: BlockConfig<WebflowResponse> = {
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Webflow OAuth access token' },
|
||||
oauthCredential: { type: 'string', description: 'Webflow OAuth access token' },
|
||||
siteId: { type: 'string', description: 'Webflow site identifier' },
|
||||
collectionId: { type: 'string', description: 'Webflow collection identifier' },
|
||||
itemId: { type: 'string', description: 'Item identifier' },
|
||||
|
||||
@@ -678,7 +678,7 @@ export const WordPressBlock: BlockConfig<WordPressResponse> = {
|
||||
params: (params) => {
|
||||
// OAuth authentication for WordPress.com
|
||||
const baseParams: Record<string, any> = {
|
||||
credential: params.credential,
|
||||
credential: params.oauthCredential,
|
||||
siteId: params.siteId,
|
||||
}
|
||||
|
||||
@@ -901,6 +901,7 @@ export const WordPressBlock: BlockConfig<WordPressResponse> = {
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
oauthCredential: { type: 'string', description: 'WordPress OAuth credential' },
|
||||
siteId: { type: 'string', description: 'WordPress.com site ID or domain' },
|
||||
// Post inputs
|
||||
postId: { type: 'number', description: 'Post ID' },
|
||||
|
||||
@@ -181,10 +181,10 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
|
||||
}
|
||||
},
|
||||
params: (params) => {
|
||||
const { credential, ...rest } = params
|
||||
const { oauthCredential, ...rest } = params
|
||||
|
||||
const parsedParams: Record<string, any> = {
|
||||
credential: credential,
|
||||
credential: oauthCredential,
|
||||
}
|
||||
|
||||
Object.keys(rest).forEach((key) => {
|
||||
@@ -210,7 +210,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'X account credential' },
|
||||
oauthCredential: { type: 'string', description: 'X account credential' },
|
||||
text: { type: 'string', description: 'Tweet text content' },
|
||||
replyTo: { type: 'string', description: 'Reply to tweet ID' },
|
||||
mediaIds: { type: 'string', description: 'Media identifiers' },
|
||||
|
||||
@@ -424,7 +424,7 @@ Return ONLY the date string - no explanations, no quotes, no extra text.`,
|
||||
},
|
||||
params: (params) => {
|
||||
const baseParams: Record<string, any> = {
|
||||
credential: params.credential,
|
||||
credential: params.oauthCredential,
|
||||
}
|
||||
|
||||
switch (params.operation) {
|
||||
@@ -569,7 +569,7 @@ Return ONLY the date string - no explanations, no quotes, no extra text.`,
|
||||
},
|
||||
inputs: {
|
||||
operation: { type: 'string', description: 'Operation to perform' },
|
||||
credential: { type: 'string', description: 'Zoom access token' },
|
||||
oauthCredential: { type: 'string', description: 'Zoom access token' },
|
||||
userId: { type: 'string', description: 'User ID or email (use "me" for authenticated user)' },
|
||||
meetingId: { type: 'string', description: 'Meeting ID' },
|
||||
topic: { type: 'string', description: 'Meeting topic' },
|
||||
|
||||
Reference in New Issue
Block a user