mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
Simplify subblocks for google service account
This commit is contained in:
@@ -152,19 +152,6 @@ Return ONLY the JSON array.`,
|
||||
value: providers.vertex.models,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
{
|
||||
id: 'reasoningEffort',
|
||||
title: 'Reasoning Effort',
|
||||
|
||||
@@ -2,7 +2,7 @@ import { GmailIcon } from '@/components/icons'
|
||||
import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { AuthMode, IntegrationType } from '@/blocks/types'
|
||||
import { createVersionedToolSelector, normalizeFileInput } from '@/blocks/utils'
|
||||
import { createVersionedToolSelector, normalizeFileInput, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
import type { GmailToolResponse } from '@/tools/gmail/types'
|
||||
import { getTrigger } from '@/triggers'
|
||||
|
||||
@@ -95,19 +95,7 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
// Send Email Fields
|
||||
{
|
||||
id: 'to',
|
||||
|
||||
@@ -2,7 +2,7 @@ import { GoogleCalendarIcon } from '@/components/icons'
|
||||
import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { AuthMode, IntegrationType } from '@/blocks/types'
|
||||
import { createVersionedToolSelector } from '@/blocks/utils'
|
||||
import { createVersionedToolSelector, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
import type { GoogleCalendarResponse } from '@/tools/google_calendar/types'
|
||||
|
||||
export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
|
||||
@@ -58,19 +58,7 @@ export const GoogleCalendarBlock: BlockConfig<GoogleCalendarResponse> = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
// Calendar selector (basic mode) - not needed for list_calendars
|
||||
{
|
||||
id: 'calendarId',
|
||||
|
||||
@@ -2,6 +2,7 @@ import { GoogleContactsIcon } from '@/components/icons'
|
||||
import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { AuthMode, IntegrationType } from '@/blocks/types'
|
||||
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
import type { GoogleContactsResponse } from '@/tools/google_contacts/types'
|
||||
|
||||
export const GoogleContactsBlock: BlockConfig<GoogleContactsResponse> = {
|
||||
@@ -52,19 +53,7 @@ export const GoogleContactsBlock: BlockConfig<GoogleContactsResponse> = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
|
||||
// Create Contact Fields
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ import { GoogleDocsIcon } from '@/components/icons'
|
||||
import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { AuthMode, IntegrationType } from '@/blocks/types'
|
||||
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
import type { GoogleDocsResponse } from '@/tools/google_docs/types'
|
||||
|
||||
export const GoogleDocsBlock: BlockConfig<GoogleDocsResponse> = {
|
||||
@@ -51,19 +52,7 @@ export const GoogleDocsBlock: BlockConfig<GoogleDocsResponse> = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
// Document selector (basic mode)
|
||||
{
|
||||
id: 'documentId',
|
||||
|
||||
@@ -2,7 +2,7 @@ import { GoogleDriveIcon } from '@/components/icons'
|
||||
import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { AuthMode, IntegrationType } from '@/blocks/types'
|
||||
import { normalizeFileInput } from '@/blocks/utils'
|
||||
import { normalizeFileInput, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
import type { GoogleDriveResponse } from '@/tools/google_drive/types'
|
||||
|
||||
export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
|
||||
@@ -63,19 +63,7 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
// Create/Upload File Fields
|
||||
{
|
||||
id: 'fileName',
|
||||
|
||||
@@ -2,6 +2,7 @@ import { GoogleFormsIcon } from '@/components/icons'
|
||||
import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { IntegrationType } from '@/blocks/types'
|
||||
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
import { getTrigger } from '@/triggers'
|
||||
|
||||
export const GoogleFormsBlock: BlockConfig = {
|
||||
@@ -54,19 +55,7 @@ export const GoogleFormsBlock: BlockConfig = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
// Form selector (basic mode)
|
||||
{
|
||||
id: 'formSelector',
|
||||
|
||||
@@ -2,6 +2,7 @@ import { GoogleGroupsIcon } from '@/components/icons'
|
||||
import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { AuthMode, IntegrationType } from '@/blocks/types'
|
||||
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
|
||||
export const GoogleGroupsBlock: BlockConfig = {
|
||||
type: 'google_groups',
|
||||
@@ -61,19 +62,7 @@ export const GoogleGroupsBlock: BlockConfig = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
|
||||
{
|
||||
id: 'customer',
|
||||
|
||||
@@ -2,6 +2,7 @@ import { GoogleMeetIcon } from '@/components/icons'
|
||||
import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { AuthMode, IntegrationType } from '@/blocks/types'
|
||||
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
import type { GoogleMeetResponse } from '@/tools/google_meet/types'
|
||||
|
||||
export const GoogleMeetBlock: BlockConfig<GoogleMeetResponse> = {
|
||||
@@ -52,19 +53,7 @@ export const GoogleMeetBlock: BlockConfig<GoogleMeetResponse> = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
|
||||
// Create Space Fields
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ import { GoogleSheetsIcon } from '@/components/icons'
|
||||
import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { AuthMode, IntegrationType } from '@/blocks/types'
|
||||
import { createVersionedToolSelector } from '@/blocks/utils'
|
||||
import { createVersionedToolSelector, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
import type { GoogleSheetsResponse, GoogleSheetsV2Response } from '@/tools/google_sheets/types'
|
||||
|
||||
// Legacy block - hidden from toolbar
|
||||
@@ -55,19 +55,7 @@ export const GoogleSheetsBlock: BlockConfig<GoogleSheetsResponse> = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
// Spreadsheet Selector
|
||||
{
|
||||
id: 'spreadsheetId',
|
||||
@@ -363,19 +351,7 @@ export const GoogleSheetsV2Block: BlockConfig<GoogleSheetsV2Response> = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
// Spreadsheet Selector (basic mode) - not for create operation
|
||||
{
|
||||
id: 'spreadsheetId',
|
||||
|
||||
@@ -3,7 +3,7 @@ import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import { resolveHttpsUrlFromFileInput } from '@/lib/uploads/utils/file-utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { AuthMode, IntegrationType } from '@/blocks/types'
|
||||
import { normalizeFileInput } from '@/blocks/utils'
|
||||
import { normalizeFileInput, SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
import type { GoogleSlidesResponse } from '@/tools/google_slides/types'
|
||||
|
||||
export const GoogleSlidesBlock: BlockConfig<GoogleSlidesResponse> = {
|
||||
@@ -65,19 +65,7 @@ export const GoogleSlidesBlock: BlockConfig<GoogleSlidesResponse> = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
// Presentation selector (basic mode) - for operations that need an existing presentation
|
||||
{
|
||||
id: 'presentationId',
|
||||
|
||||
@@ -2,6 +2,7 @@ import { GoogleTasksIcon } from '@/components/icons'
|
||||
import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { AuthMode, IntegrationType } from '@/blocks/types'
|
||||
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
import type { GoogleTasksResponse } from '@/tools/google_tasks/types'
|
||||
|
||||
export const GoogleTasksBlock: BlockConfig<GoogleTasksResponse> = {
|
||||
@@ -53,19 +54,7 @@ export const GoogleTasksBlock: BlockConfig<GoogleTasksResponse> = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
|
||||
// Task List - shown for all task operations (not list_task_lists)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ import { GoogleVaultIcon } from '@/components/icons'
|
||||
import { getScopesForService } from '@/lib/oauth/utils'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
import { AuthMode, IntegrationType } from '@/blocks/types'
|
||||
import { SERVICE_ACCOUNT_SUBBLOCKS } from '@/blocks/utils'
|
||||
|
||||
export const GoogleVaultBlock: BlockConfig = {
|
||||
type: 'google_vault',
|
||||
@@ -53,19 +54,7 @@ export const GoogleVaultBlock: BlockConfig = {
|
||||
placeholder: 'Enter credential ID',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
...SERVICE_ACCOUNT_SUBBLOCKS,
|
||||
// Create Hold inputs
|
||||
{
|
||||
id: 'matterId',
|
||||
|
||||
@@ -8,6 +8,28 @@ import {
|
||||
} from '@/providers/utils'
|
||||
import { useProvidersStore } from '@/stores/providers/store'
|
||||
|
||||
/**
|
||||
* Standard subblocks for Google service account impersonation.
|
||||
* The credential-selector writes `isServiceAccount` to the store when a service account
|
||||
* credential is selected. The `impersonateUserEmail` field conditionally appears for
|
||||
* domain-wide delegation to Google Workspace APIs.
|
||||
*/
|
||||
export const SERVICE_ACCOUNT_SUBBLOCKS: SubBlockConfig[] = [
|
||||
{
|
||||
id: 'isServiceAccount',
|
||||
title: 'Is Service Account',
|
||||
type: 'short-input',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
id: 'impersonateUserEmail',
|
||||
title: 'Impersonated Account',
|
||||
type: 'short-input',
|
||||
placeholder: 'Email to impersonate (for service accounts)',
|
||||
condition: { field: 'isServiceAccount', value: 'true' },
|
||||
},
|
||||
]
|
||||
|
||||
/**
|
||||
* Returns model options for combobox subblocks, combining all provider sources.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user