chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:34:48 +08:00
commit 77bb5bf71f
3762 changed files with 353249 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
import * as sdk from '@botpress/sdk'
import { changeMessageLabels } from './actions/change-message-labels'
import { createDraft } from './actions/create-draft'
import { createLabel } from './actions/create-label'
import { deleteDraft } from './actions/delete-draft'
import { deleteLabel } from './actions/delete-label'
import { deleteMessage } from './actions/delete-message'
import { getDraft } from './actions/get-draft'
import { getLabel } from './actions/get-label'
import { getMessageAttachment } from './actions/get-message-attachment'
import { getMessageAttachmentFromMail } from './actions/get-message-attachment-from-mail'
import { getThread } from './actions/get-thread'
import { listDrafts } from './actions/list-drafts'
import { listLabels } from './actions/list-labels'
import { listThreads } from './actions/list-threads'
import { sendDraft } from './actions/send-draft'
import { trashMessage } from './actions/trash-message'
import { trashThread } from './actions/trash-thread'
import { untrashMessage } from './actions/untrash-message'
import { untrashThread } from './actions/untrash-thread'
import { updateDraft } from './actions/update-draft'
import { updateLabel } from './actions/update-label'
export const actions = {
deleteMessage,
trashMessage,
untrashMessage,
changeMessageLabels,
getMessageAttachment,
getMessageAttachmentFromMail,
listThreads,
getThread,
trashThread,
untrashThread,
listLabels,
getLabel,
createLabel,
deleteLabel,
updateLabel,
listDrafts,
getDraft,
createDraft,
deleteDraft,
updateDraft,
sendDraft,
} as const satisfies sdk.IntegrationDefinitionProps['actions']
@@ -0,0 +1,25 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const changeMessageLabels = {
title: 'Change Message Labels',
description: 'Modifies the labels on the specified message by adding or removing label IDs.',
input: {
schema: z.object({
id: z.string().title('Message ID').describe('The ID of the message to modify.'),
addLabelIds: z
.array(z.string())
.optional()
.title('Add Label IDs')
.describe('A list of IDs of labels to add to this message.'),
removeLabelIds: z
.array(z.string())
.optional()
.title('Remove Label IDs')
.describe('A list of IDs of labels to remove from this message.'),
}),
},
output: {
schema: z.object({}).title('Empty').describe('Empty output'),
},
} as const satisfies ActionDef
@@ -0,0 +1,27 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const createDraft = {
title: 'Create Draft',
description: 'Creates a new draft with the specified email content.',
input: {
schema: z.object({
to: z.string().title('To').describe('The recipient email address.'),
subject: z.string().title('Subject').describe('The subject of the email.'),
body: z.string().title('Body').describe('The body content of the email.'),
}),
},
output: {
schema: z.object({
id: z.string().optional().title('Draft ID').describe('The immutable ID of the created draft.'),
message: z
.object({
id: z.string().optional().describe('The ID of the message.'),
threadId: z.string().optional().describe('The ID of the thread.'),
})
.optional()
.title('Message')
.describe('The message content of the draft.'),
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,19 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const createLabel = {
title: 'Create Label',
description: "Creates a new label in the user's mailbox.",
input: {
schema: z.object({
name: z.string().title('Name').describe('The display name of the label to create.'),
}),
},
output: {
schema: z.object({
id: z.string().optional().title('Label ID').describe('The immutable ID of the created label.'),
name: z.string().optional().title('Name').describe('The display name of the label.'),
type: z.string().optional().title('Type').describe('The owner type for the label (system or user).'),
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,15 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const deleteDraft = {
title: 'Delete Draft',
description: 'Immediately and permanently deletes the specified draft. This operation cannot be undone.',
input: {
schema: z.object({
id: z.string().title('Draft ID').describe('The ID of the draft to delete.'),
}),
},
output: {
schema: z.object({}).title('Empty').describe('Empty output'),
},
} as const satisfies ActionDef
@@ -0,0 +1,16 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const deleteLabel = {
title: 'Delete Label',
description:
'Immediately and permanently deletes the specified label. Messages and threads are not deleted, they simply lose this label.',
input: {
schema: z.object({
id: z.string().title('Label ID').describe('The ID of the label to delete.'),
}),
},
output: {
schema: z.object({}).title('Empty').describe('Empty output'),
},
} as const satisfies ActionDef
@@ -0,0 +1,16 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const deleteMessage = {
title: 'Delete Message',
description:
'Immediately and permanently deletes the specified message using its ID. This operation cannot be undone. Prefer messages.trash instead',
input: {
schema: z.object({
id: z.string().title('Message ID').describe('The ID of the message to delete.'),
}),
},
output: {
schema: z.object({}).title('Empty').describe('Empty output'),
},
} as const satisfies ActionDef
@@ -0,0 +1,27 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const getDraft = {
title: 'Get Draft',
description: 'Gets the specified draft by its ID.',
input: {
schema: z.object({
id: z.string().title('Draft ID').describe('The ID of the draft to retrieve.'),
}),
},
output: {
schema: z.object({
id: z.string().optional().title('Draft ID').describe('The immutable ID of the draft.'),
message: z
.object({
id: z.string().optional().describe('The ID of the message.'),
threadId: z.string().optional().describe('The ID of the thread.'),
labelIds: z.array(z.string()).optional().describe('List of label IDs applied to the draft message.'),
snippet: z.string().optional().describe('A short part of the message text.'),
})
.optional()
.title('Message')
.describe('The message content of the draft.'),
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,57 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const getLabel = {
title: 'Get Label',
description: 'Gets the specified label by its ID.',
input: {
schema: z.object({
id: z.string().title('Label ID').describe('The ID of the label to retrieve.'),
}),
},
output: {
schema: z.object({
id: z.string().optional().title('Label ID').describe('The immutable ID of the label.'),
name: z.string().optional().title('Name').describe('The display name of the label.'),
type: z.string().optional().title('Type').describe('The owner type for the label (system or user).'),
messageListVisibility: z
.string()
.optional()
.title('Message List Visibility')
.describe('The visibility of messages with this label in the message list.'),
labelListVisibility: z
.string()
.optional()
.title('Label List Visibility')
.describe('The visibility of the label in the label list.'),
messagesTotal: z
.number()
.optional()
.title('Messages Total')
.describe('The total number of messages with the label.'),
messagesUnread: z
.number()
.optional()
.title('Messages Unread')
.describe('The number of unread messages with the label.'),
threadsTotal: z
.number()
.optional()
.title('Threads Total')
.describe('The total number of threads with the label.'),
threadsUnread: z
.number()
.optional()
.title('Threads Unread')
.describe('The number of unread threads with the label.'),
color: z
.object({
backgroundColor: z.string().optional().describe('The background color.'),
textColor: z.string().optional().describe('The text color.'),
})
.optional()
.title('Color')
.describe('The color to assign to the label.'),
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,18 @@
import { z } from '@botpress/sdk'
import { attachmentSchema } from './get-message-attachment'
import { ActionDef } from './types'
export const getMessageAttachmentFromMail = {
title: 'Get Message Attachment From Mail',
description: 'Gets the first attachment from a message by automatically finding the attachment ID from the message.',
input: {
schema: z.object({
messageId: z.string().title('Message ID').describe('The ID of the message containing the attachment.'),
}),
},
output: {
schema: z.object({
attachment: attachmentSchema,
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,37 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const attachmentSchema = z
.object({
size: z.number().nullable().optional().title('Size').describe('The size of the attachment in bytes.'),
data: z
.string()
.nullable()
.optional()
.title('Data')
.describe('The body data of a MIME message part as a base64url encoded string.'),
attachmentId: z
.string()
.nullable()
.optional()
.title('Attachment ID')
.describe('The immutable ID of the attachment.'),
})
.title('Attachment')
.describe('The attachment retrieved from the message.')
export const getMessageAttachment = {
title: 'Get Message Attachment',
description: 'Gets the specified message attachment by its ID.',
input: {
schema: z.object({
messageId: z.string().title('Message ID').describe('The ID of the message containing the attachment.'),
attachmentId: z.string().title('Attachment ID').describe('The ID of the attachment to retrieve.'),
}),
},
output: {
schema: z.object({
attachment: attachmentSchema,
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,31 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const getThread = {
title: 'Get Thread',
description: 'Gets the specified thread by its ID, including all messages in the thread.',
input: {
schema: z.object({
id: z.string().title('Thread ID').describe('The ID of the thread to retrieve.'),
}),
},
output: {
schema: z.object({
id: z.string().optional().title('Thread ID').describe('The unique ID of the thread.'),
snippet: z.string().optional().title('Snippet').describe('A short part of the message text.'),
historyId: z.string().optional().title('History ID').describe('The history ID of the thread.'),
messages: z
.array(
z.object({
id: z.string().optional().describe('The ID of the message.'),
threadId: z.string().optional().describe('The ID of the thread the message belongs to.'),
labelIds: z.array(z.string()).optional().describe('List of label IDs applied to this message.'),
snippet: z.string().optional().describe('A short part of the message text.'),
})
)
.optional()
.title('Messages')
.describe('The list of messages in the thread.'),
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,35 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const listDrafts = {
title: 'List Drafts',
description: "Lists all drafts in the user's mailbox.",
input: {
schema: z.object({}),
},
output: {
schema: z.object({
drafts: z
.array(
z.object({
id: z.string().optional().describe('The immutable ID of the draft.'),
message: z
.object({
id: z.string().optional().describe('The ID of the message contained in the draft.'),
threadId: z.string().optional().describe('The ID of the thread the draft belongs to.'),
})
.optional()
.describe('The message content of the draft.'),
})
)
.optional()
.title('Drafts')
.describe('List of drafts.'),
resultSizeEstimate: z
.number()
.optional()
.title('Result Size Estimate')
.describe('Estimated total number of results.'),
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,25 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const listLabels = {
title: 'List Labels',
description: "Lists all labels in the user's mailbox, including system labels and user-created labels.",
input: {
schema: z.object({}),
},
output: {
schema: z.object({
labels: z
.array(
z.object({
id: z.string().optional().describe('The immutable ID of the label.'),
name: z.string().optional().describe('The display name of the label.'),
type: z.string().optional().describe('The owner type for the label (system or user).'),
})
)
.optional()
.title('Labels')
.describe('List of labels.'),
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,30 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const listThreads = {
title: 'List Threads',
description: "Lists all email threads in the user's mailbox.",
input: {
schema: z.object({}),
},
output: {
schema: z.object({
threads: z
.array(
z.object({
id: z.string().optional().describe('The unique ID of the thread.'),
snippet: z.string().optional().describe('A short part of the message text.'),
historyId: z.string().optional().describe('The history ID of the thread.'),
})
)
.optional()
.title('Threads')
.describe('List of threads in the mailbox.'),
resultSizeEstimate: z
.number()
.optional()
.title('Result Size Estimate')
.describe('Estimated total number of results.'),
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,23 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const sendDraft = {
title: 'Send Draft',
description: 'Sends the specified draft. The draft will be deleted after being sent.',
input: {
schema: z.object({
id: z.string().title('Draft ID').describe('The ID of the draft to send.'),
}),
},
output: {
schema: z.object({
id: z.string().optional().title('Message ID').describe('The ID of the sent message.'),
threadId: z.string().optional().title('Thread ID').describe('The ID of the thread the message belongs to.'),
labelIds: z
.array(z.string())
.optional()
.title('Label IDs')
.describe('List of label IDs applied to the sent message.'),
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,16 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const trashMessage = {
title: 'Trash Message',
description:
'Moves the specified message to the trash. The message can be restored from the trash using untrashMessage.',
input: {
schema: z.object({
id: z.string().title('Message ID').describe('The ID of the message to trash.'),
}),
},
output: {
schema: z.object({}).title('Empty').describe('Empty output'),
},
} as const satisfies ActionDef
@@ -0,0 +1,16 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const trashThread = {
title: 'Trash Thread',
description:
'Moves the specified thread to the trash. All messages in the thread will be moved to trash. The thread can be restored using untrashThread.',
input: {
schema: z.object({
id: z.string().title('Thread ID').describe('The ID of the thread to trash.'),
}),
},
output: {
schema: z.object({}).title('Empty').describe('Empty output'),
},
} as const satisfies ActionDef
@@ -0,0 +1,4 @@
import * as sdk from '@botpress/sdk'
export type ActionDefinitions = NonNullable<sdk.IntegrationDefinitionProps['actions']>
export type ActionDef = ActionDefinitions[string]
@@ -0,0 +1,15 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const untrashMessage = {
title: 'Untrash Message',
description: 'Removes the specified message from the trash and restores it to the inbox.',
input: {
schema: z.object({
id: z.string().title('Message ID').describe('The ID of the message to untrash.'),
}),
},
output: {
schema: z.object({}).title('Empty').describe('Empty output'),
},
} as const satisfies ActionDef
@@ -0,0 +1,15 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const untrashThread = {
title: 'Untrash Thread',
description: 'Removes the specified thread from the trash. All messages in the thread will be restored.',
input: {
schema: z.object({
id: z.string().title('Thread ID').describe('The ID of the thread to restore from trash.'),
}),
},
output: {
schema: z.object({}).title('Empty').describe('Empty output'),
},
} as const satisfies ActionDef
@@ -0,0 +1,28 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const updateDraft = {
title: 'Update Draft',
description: "Replaces a draft's content with the new email content provided.",
input: {
schema: z.object({
id: z.string().title('Draft ID').describe('The ID of the draft to update.'),
to: z.string().title('To').describe('The recipient email address.'),
subject: z.string().title('Subject').describe('The subject of the email.'),
body: z.string().title('Body').describe('The body content of the email.'),
}),
},
output: {
schema: z.object({
id: z.string().optional().title('Draft ID').describe('The immutable ID of the updated draft.'),
message: z
.object({
id: z.string().optional().describe('The ID of the message.'),
threadId: z.string().optional().describe('The ID of the thread.'),
})
.optional()
.title('Message')
.describe('The message content of the draft.'),
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,34 @@
import { z } from '@botpress/sdk'
import { ActionDef } from './types'
export const updateLabel = {
title: 'Update Label',
description: 'Updates the specified label with new properties like name or color.',
input: {
schema: z.object({
id: z.string().title('Label ID').describe('The ID of the label to update.'),
name: z.string().optional().title('Name').describe('The new display name for the label.'),
backgroundColor: z
.string()
.optional()
.title('Background Color')
.describe('The background color as hex string (e.g., #ffffff).'),
textColor: z.string().optional().title('Text Color').describe('The text color as hex string (e.g., #000000).'),
}),
},
output: {
schema: z.object({
id: z.string().optional().title('Label ID').describe('The immutable ID of the label.'),
name: z.string().optional().title('Name').describe('The display name of the label.'),
type: z.string().optional().title('Type').describe('The owner type for the label (system or user).'),
color: z
.object({
backgroundColor: z.string().optional().describe('The background color.'),
textColor: z.string().optional().describe('The text color.'),
})
.optional()
.title('Color')
.describe('The color assigned to the label.'),
}),
},
} as const satisfies ActionDef
@@ -0,0 +1,49 @@
import * as sdk from '@botpress/sdk'
export const channels = {
channel: {
title: 'Email thread',
description: 'Messages in an email thread',
messages: {
...sdk.messages.defaults,
markdown: sdk.messages.markdown,
image: {
schema: sdk.messages.defaults.image.schema.extend({
title: sdk.z.string().optional().title('Alt text').describe('Alt text for the image'),
}),
},
audio: {
schema: sdk.messages.defaults.audio.schema.extend({
title: sdk.z.string().optional().title('Title').describe('Title for the audio file'),
}),
},
video: {
schema: sdk.messages.defaults.video.schema.extend({
title: sdk.z.string().optional().title('Title').describe('Title for the video file'),
}),
},
file: {
schema: sdk.messages.defaults.file.schema.extend({
title: sdk.z.string().optional().title('Title').describe('Title for the file'),
}),
},
bloc: {
schema: sdk.messages.markdownBloc.schema,
},
},
message: {
tags: {
id: { title: 'Gmail ID', description: 'The unique identifier of the message on Gmail' },
},
},
conversation: {
tags: {
id: { title: 'Gmail ID', description: 'The unique identifier of the email thread on Gmail' },
email: { title: 'Sender email', description: 'The email address of the sender' },
subject: { title: 'Subject', description: 'The subject of the email' },
references: { title: 'References', description: 'The contents of the References header field' },
cc: { title: 'CC', description: 'Co-recipients' },
},
},
},
} as const satisfies sdk.IntegrationDefinitionProps['channels']
@@ -0,0 +1,57 @@
import * as sdk from '@botpress/sdk'
const { z } = sdk
export const configuration = {
identifier: {
linkTemplateScript: 'linkTemplate.vrl',
},
schema: z.object({}),
} as const satisfies sdk.IntegrationDefinitionProps['configuration']
export const configurations = {
customApp: {
title: 'Manual configuration',
description: 'Configure manually with your own GCP App',
schema: z.object({
oauthClientId: z
.string()
.min(1)
.endsWith('.apps.googleusercontent.com')
.title('OAuth Client ID')
.describe('Can be found in GCC under API & Services > Credentials'),
oauthClientSecret: z
.string()
.min(1)
.title('OAuth Client Secret')
.describe('Can be found in GCC under API & Services > Credentials'),
oauthAuthorizationCode: z
.string()
.min(1)
.title('OAuth Authorization Code')
.describe('Obtained by running the OAuth flow in your browser'),
pubsubTopicName: z
.string()
.min(1)
.startsWith('projects/')
.includes('/topics/')
.title('Pub/Sub Topic Name')
.describe('Can be found in GCC under Pub/Sub > Topics'),
pubsubWebhookSharedSecret: z
.string()
.min(1)
.title('Pub/Sub Webhook Shared Secret')
.describe(
'Must be set in GCC under Pub/Sub > Subscriptions > Details > Push endpoint (in the URL is the shared secret)'
),
pubsubWebhookServiceAccount: z
.string()
.min(1)
.title('Pub/Sub Webhook Service Account')
.describe('Must be set in GCC under Pub/Sub > Subscriptions > Details > Service account'),
}),
},
} as const satisfies sdk.IntegrationDefinitionProps['configurations']
export const identifier = {
extractScript: 'extract.vrl',
} as const satisfies sdk.IntegrationDefinitionProps['identifier']
+3
View File
@@ -0,0 +1,3 @@
import * as sdk from '@botpress/sdk'
export const events = {} as const satisfies sdk.IntegrationDefinitionProps['events']
+7
View File
@@ -0,0 +1,7 @@
export * from './configuration'
export * from './channels'
export * from './user-tags'
export * from './actions'
export * from './events'
export * from './states'
export * from './secrets'
+11
View File
@@ -0,0 +1,11 @@
import { posthogHelper } from '@botpress/common'
import * as sdk from '@botpress/sdk'
export const secrets = {
...posthogHelper.COMMON_SECRET_NAMES,
CLIENT_ID: { description: 'Gmail Client ID' },
CLIENT_SECRET: { description: 'Gmail Client Secret' },
TOPIC_NAME: { description: 'Google Cloud Pub/Sub topic name for Gmail messages' },
WEBHOOK_SHARED_SECRET: { description: 'Pub/Sub webhook shared secret' },
WEBHOOK_SERVICE_ACCOUNT: { description: 'Pub/Sub JWT service account' },
} as const satisfies sdk.IntegrationDefinitionProps['secrets']
+38
View File
@@ -0,0 +1,38 @@
import * as sdk from '@botpress/sdk'
const { z } = sdk
export const states = {
thread: {
type: 'conversation',
schema: z.object({
inReplyTo: z
.string()
.title('In reply to')
.optional()
.describe('The ID of the message this message is a reply to'),
}),
},
configuration: {
type: 'integration',
schema: z.object({
refreshToken: z
.string()
.title('Refresh token')
.describe('The refresh token to use to authenticate with Gmail. It gets exchanged for a bearer token'),
lastHistoryId: z
.string()
.optional()
.title('History cursor')
.describe('The last history ID processed by the integration'),
}),
},
googlePublicCertCache: {
type: 'integration',
schema: z.object({
certificates: z
.string()
.title('Certificates JSON')
.describe('The certs used by Google for federated sign-on, stringified as JSON'),
}),
},
} as const satisfies sdk.IntegrationDefinitionProps['states']
@@ -0,0 +1,7 @@
import * as sdk from '@botpress/sdk'
export const user = {
tags: {
id: { title: 'Email address', description: 'The email address of the user' },
},
} as const satisfies sdk.IntegrationDefinitionProps['user']