d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
171 lines
4.9 KiB
TypeScript
171 lines
4.9 KiB
TypeScript
import { GoogleDriveIcon } from '@/components/icons'
|
|
import type { TriggerConfig } from '@/triggers/types'
|
|
|
|
const MIME_TYPE_OPTIONS = [
|
|
{ id: '', label: 'All Files' },
|
|
{ id: 'application/vnd.google-apps.document', label: 'Google Docs' },
|
|
{ id: 'application/vnd.google-apps.spreadsheet', label: 'Google Sheets' },
|
|
{ id: 'application/vnd.google-apps.presentation', label: 'Google Slides' },
|
|
{ id: 'application/pdf', label: 'PDFs' },
|
|
{ id: 'image/', label: 'Images' },
|
|
{ id: 'application/vnd.google-apps.folder', label: 'Folders' },
|
|
] as const
|
|
|
|
export const googleDrivePollingTrigger: TriggerConfig = {
|
|
id: 'google_drive_poller',
|
|
name: 'Google Drive File Trigger',
|
|
provider: 'google-drive',
|
|
description: 'Triggers when files are created, modified, or deleted in Google Drive',
|
|
version: '1.0.0',
|
|
icon: GoogleDriveIcon,
|
|
polling: true,
|
|
|
|
subBlocks: [
|
|
{
|
|
id: 'triggerCredentials',
|
|
title: 'Credentials',
|
|
type: 'oauth-input',
|
|
description: 'Connect your Google account to access Google Drive.',
|
|
serviceId: 'google-drive',
|
|
requiredScopes: [],
|
|
required: true,
|
|
mode: 'trigger',
|
|
canonicalParamId: 'oauthCredential',
|
|
},
|
|
{
|
|
id: 'folderId',
|
|
title: 'Folder',
|
|
type: 'file-selector',
|
|
description: 'Optional: The folder to monitor. Leave empty to monitor all files in Drive.',
|
|
required: false,
|
|
mode: 'trigger',
|
|
canonicalParamId: 'folderId',
|
|
serviceId: 'google-drive',
|
|
selectorKey: 'google.drive',
|
|
mimeType: 'application/vnd.google-apps.folder',
|
|
dependsOn: ['triggerCredentials'],
|
|
},
|
|
{
|
|
id: 'manualFolderId',
|
|
title: 'Folder ID',
|
|
type: 'short-input',
|
|
placeholder: 'Leave empty to monitor entire Drive',
|
|
description:
|
|
'Optional: The folder ID from the Google Drive URL to monitor. Leave empty to monitor all files.',
|
|
required: false,
|
|
mode: 'trigger-advanced',
|
|
canonicalParamId: 'folderId',
|
|
},
|
|
{
|
|
id: 'mimeTypeFilter',
|
|
title: 'File Type Filter',
|
|
type: 'dropdown',
|
|
options: [...MIME_TYPE_OPTIONS],
|
|
defaultValue: '',
|
|
description: 'Optional: Only trigger for specific file types.',
|
|
required: false,
|
|
mode: 'trigger',
|
|
},
|
|
{
|
|
id: 'eventTypeFilter',
|
|
title: 'Event Type',
|
|
type: 'dropdown',
|
|
options: [
|
|
{ id: '', label: 'All Changes' },
|
|
{ id: 'created', label: 'File Created' },
|
|
{ id: 'modified', label: 'File Modified' },
|
|
{ id: 'deleted', label: 'File Deleted' },
|
|
{ id: 'created_or_modified', label: 'Created or Modified' },
|
|
],
|
|
defaultValue: '',
|
|
description: 'Only trigger for specific change types. Defaults to all changes.',
|
|
required: false,
|
|
mode: 'trigger',
|
|
},
|
|
{
|
|
id: 'includeSharedDrives',
|
|
title: 'Include Shared Drives',
|
|
type: 'switch',
|
|
defaultValue: false,
|
|
description: 'Include files from shared (team) drives.',
|
|
required: false,
|
|
mode: 'trigger',
|
|
},
|
|
{
|
|
id: 'triggerInstructions',
|
|
title: 'Setup Instructions',
|
|
hideFromPreview: true,
|
|
type: 'text',
|
|
defaultValue: [
|
|
'Connect your Google account using OAuth credentials',
|
|
'Optionally specify a folder ID to monitor a specific folder',
|
|
'Optionally filter by file type',
|
|
'The system will automatically detect new, modified, and deleted files',
|
|
]
|
|
.map(
|
|
(instruction, index) =>
|
|
`<div class="mb-3"><strong>${index + 1}.</strong> ${instruction}</div>`
|
|
)
|
|
.join(''),
|
|
mode: 'trigger',
|
|
},
|
|
],
|
|
|
|
outputs: {
|
|
file: {
|
|
id: {
|
|
type: 'string',
|
|
description: 'Google Drive file ID',
|
|
},
|
|
name: {
|
|
type: 'string',
|
|
description: 'File name',
|
|
},
|
|
mimeType: {
|
|
type: 'string',
|
|
description: 'File MIME type',
|
|
},
|
|
modifiedTime: {
|
|
type: 'string',
|
|
description: 'Last modified time (ISO)',
|
|
},
|
|
createdTime: {
|
|
type: 'string',
|
|
description: 'File creation time (ISO)',
|
|
},
|
|
size: {
|
|
type: 'string',
|
|
description: 'File size in bytes',
|
|
},
|
|
webViewLink: {
|
|
type: 'string',
|
|
description: 'URL to view file in browser',
|
|
},
|
|
parents: {
|
|
type: 'json',
|
|
description: 'Parent folder IDs',
|
|
},
|
|
lastModifyingUser: {
|
|
type: 'json',
|
|
description: 'User who last modified the file',
|
|
},
|
|
shared: {
|
|
type: 'boolean',
|
|
description: 'Whether file is shared',
|
|
},
|
|
starred: {
|
|
type: 'boolean',
|
|
description: 'Whether file is starred',
|
|
},
|
|
},
|
|
eventType: {
|
|
type: 'string',
|
|
description: 'Change type: "created", "modified", or "deleted"',
|
|
},
|
|
timestamp: {
|
|
type: 'string',
|
|
description: 'Event timestamp in ISO format',
|
|
},
|
|
},
|
|
}
|