diff --git a/apps/sim/app/(landing)/integrations/data/integrations.json b/apps/sim/app/(landing)/integrations/data/integrations.json index 9a89658f1f..1aedf79474 100644 --- a/apps/sim/app/(landing)/integrations/data/integrations.json +++ b/apps/sim/app/(landing)/integrations/data/integrations.json @@ -4015,8 +4015,14 @@ } ], "operationCount": 12, - "triggers": [], - "triggerCount": 0, + "triggers": [ + { + "id": "gmail_poller", + "name": "Gmail Email Trigger", + "description": "Triggers when new emails are received in Gmail (requires Gmail credentials)" + } + ], + "triggerCount": 1, "authType": "oauth", "category": "tools", "integrationType": "email", @@ -7256,7 +7262,7 @@ { "id": "linear_webhook_v2", "name": "Linear Webhook", - "description": "Trigger workflow from Linear data-change events included in this webhook subscription (Issues, Comments, Projects, etc.—not every Linear model)." + "description": "Trigger workflow from Linear events you select when creating the webhook in Linear (not guaranteed to be every model or event type)." } ], "triggerCount": 15, @@ -8580,8 +8586,14 @@ } ], "operationCount": 9, - "triggers": [], - "triggerCount": 0, + "triggers": [ + { + "id": "outlook_poller", + "name": "Outlook Email Trigger", + "description": "Triggers when new emails are received in Outlook (requires Microsoft credentials)" + } + ], + "triggerCount": 1, "authType": "oauth", "category": "tools", "integrationType": "email", diff --git a/apps/sim/lib/core/idempotency/service.ts b/apps/sim/lib/core/idempotency/service.ts index 9c4961bd27..f5b59d3c8f 100644 --- a/apps/sim/lib/core/idempotency/service.ts +++ b/apps/sim/lib/core/idempotency/service.ts @@ -422,7 +422,9 @@ export class IdempotencyService { normalizedHeaders?.['x-teams-notification-id'] || normalizedHeaders?.['svix-id'] || normalizedHeaders?.['linear-delivery'] || - normalizedHeaders?.['greenhouse-event-id'] + normalizedHeaders?.['greenhouse-event-id'] || + normalizedHeaders?.['x-zm-request-id'] || + normalizedHeaders?.['idempotency-key'] if (webhookIdHeader) { return `${webhookId}:${webhookIdHeader}` diff --git a/apps/sim/lib/webhooks/providers/ashby.ts b/apps/sim/lib/webhooks/providers/ashby.ts index b89d516c5c..d7903af812 100644 --- a/apps/sim/lib/webhooks/providers/ashby.ts +++ b/apps/sim/lib/webhooks/providers/ashby.ts @@ -33,6 +33,15 @@ function validateAshbySignature(secretToken: string, signature: string, body: st } export const ashbyHandler: WebhookProviderHandler = { + extractIdempotencyId(body: unknown): string | null { + const obj = body as Record + const webhookActionId = obj.webhookActionId + if (typeof webhookActionId === 'string' && webhookActionId) { + return `ashby:${webhookActionId}` + } + return null + }, + async formatInput({ body }: FormatInputContext): Promise { const b = body as Record return { diff --git a/apps/sim/lib/webhooks/providers/gong.ts b/apps/sim/lib/webhooks/providers/gong.ts index 428747cc3e..6a45d60ff3 100644 --- a/apps/sim/lib/webhooks/providers/gong.ts +++ b/apps/sim/lib/webhooks/providers/gong.ts @@ -123,6 +123,20 @@ export async function verifyGongJwtAuth(ctx: AuthContext): Promise + const callData = obj.callData as Record | undefined + const metaData = callData?.metaData as Record | undefined + const id = metaData?.id + if (typeof id === 'string' && id) { + return `gong:${id}` + } + if (typeof id === 'number') { + return `gong:${id}` + } + return null + }, + async formatInput({ body }: FormatInputContext): Promise { const b = body as Record const callData = b.callData as Record | undefined diff --git a/apps/sim/lib/webhooks/providers/telegram.ts b/apps/sim/lib/webhooks/providers/telegram.ts index 0bb2fd427f..77bb623be1 100644 --- a/apps/sim/lib/webhooks/providers/telegram.ts +++ b/apps/sim/lib/webhooks/providers/telegram.ts @@ -23,6 +23,15 @@ export const telegramHandler: WebhookProviderHandler = { return null }, + extractIdempotencyId(body: unknown): string | null { + const obj = body as Record + const updateId = obj.update_id + if (typeof updateId === 'number') { + return `telegram:${updateId}` + } + return null + }, + async formatInput({ body }: FormatInputContext): Promise { const b = body as Record const rawMessage = (b?.message || diff --git a/apps/sim/lib/webhooks/providers/zoom.test.ts b/apps/sim/lib/webhooks/providers/zoom.test.ts index 57ff95e8e3..57751e49cb 100644 --- a/apps/sim/lib/webhooks/providers/zoom.test.ts +++ b/apps/sim/lib/webhooks/providers/zoom.test.ts @@ -27,29 +27,8 @@ describe('Zoom webhook provider', () => { expect(validateZoomSignature(secret, hashA, timestamp, rawB)).toBe(false) }) - it('extractIdempotencyId prefers meeting uuid', () => { - const zid = zoomHandler.extractIdempotencyId!({ - event: 'meeting.started', - event_ts: 123, - payload: { object: { uuid: 'u1', id: 55 } }, - }) - expect(zid).toBe('zoom:meeting.started:123:u1') - }) - - it('extractIdempotencyId uses participant identity when available', () => { - const zid = zoomHandler.extractIdempotencyId!({ - event: 'meeting.participant_joined', - event_ts: 123, - payload: { - object: { - uuid: 'meeting-uuid', - participant: { - user_id: 'participant-1', - }, - }, - }, - }) - expect(zid).toBe('zoom:meeting.participant_joined:123:participant-1') + it('does not implement extractIdempotencyId (x-zm-request-id handled at service level)', () => { + expect(zoomHandler.extractIdempotencyId).toBeUndefined() }) it('formatInput passes through the Zoom webhook envelope', async () => { diff --git a/apps/sim/lib/webhooks/providers/zoom.ts b/apps/sim/lib/webhooks/providers/zoom.ts index c78cf0c938..ac687f14cb 100644 --- a/apps/sim/lib/webhooks/providers/zoom.ts +++ b/apps/sim/lib/webhooks/providers/zoom.ts @@ -128,36 +128,6 @@ export const zoomHandler: WebhookProviderHandler = { return null }, - extractIdempotencyId(body: unknown): string | null { - const obj = body as Record - const event = obj.event - const ts = obj.event_ts - if (typeof event !== 'string' || ts === undefined || ts === null) { - return null - } - const payload = obj.payload as Record | undefined - const inner = payload?.object as Record | undefined - const participant = - inner?.participant && - typeof inner.participant === 'object' && - !Array.isArray(inner.participant) - ? (inner.participant as Record) - : null - const participantStable = - (typeof participant?.user_id === 'string' && participant.user_id) || - (typeof participant?.id === 'string' && participant.id) || - (typeof participant?.email === 'string' && participant.email) || - (typeof participant?.join_time === 'string' && participant.join_time) || - (typeof participant?.leave_time === 'string' && participant.leave_time) || - '' - const stable = - participantStable || - (typeof inner?.uuid === 'string' && inner.uuid) || - (inner?.id !== undefined && inner.id !== null ? String(inner.id) : '') || - '' - return `zoom:${event}:${String(ts)}:${stable}` - }, - async matchEvent({ webhook: wh, workflow, body, requestId, providerConfig }: EventMatchContext) { const triggerId = providerConfig.triggerId as string | undefined const obj = body as Record diff --git a/apps/sim/triggers/linear/comment_created.ts b/apps/sim/triggers/linear/comment_created.ts index 893061cc5e..f4d9e77901 100644 --- a/apps/sim/triggers/linear/comment_created.ts +++ b/apps/sim/triggers/linear/comment_created.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildCommentOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildCommentOutputs, + buildLinearV2SubBlocks, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearCommentCreatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearCommentCreatedTrigger: TriggerConfig = { }, }, } + +export const linearCommentCreatedV2Trigger: TriggerConfig = { + id: 'linear_comment_created_v2', + name: 'Linear Comment Created', + provider: 'linear', + description: 'Trigger workflow when a new comment is created in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_comment_created_v2', + eventType: 'Comment (create)', + }), + outputs: buildCommentOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'Comment', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/comment_created_v2.ts b/apps/sim/triggers/linear/comment_created_v2.ts deleted file mode 100644 index 4db96a236f..0000000000 --- a/apps/sim/triggers/linear/comment_created_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildCommentOutputs, buildLinearV2SubBlocks } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearCommentCreatedV2Trigger: TriggerConfig = { - id: 'linear_comment_created_v2', - name: 'Linear Comment Created', - provider: 'linear', - description: 'Trigger workflow when a new comment is created in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_comment_created_v2', - eventType: 'Comment (create)', - }), - - outputs: buildCommentOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'Comment', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/comment_updated.ts b/apps/sim/triggers/linear/comment_updated.ts index d837d71494..6bd1761beb 100644 --- a/apps/sim/triggers/linear/comment_updated.ts +++ b/apps/sim/triggers/linear/comment_updated.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildCommentOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildCommentOutputs, + buildLinearV2SubBlocks, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearCommentUpdatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearCommentUpdatedTrigger: TriggerConfig = { }, }, } + +export const linearCommentUpdatedV2Trigger: TriggerConfig = { + id: 'linear_comment_updated_v2', + name: 'Linear Comment Updated', + provider: 'linear', + description: 'Trigger workflow when a comment is updated in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_comment_updated_v2', + eventType: 'Comment (update)', + }), + outputs: buildCommentOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'Comment', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/comment_updated_v2.ts b/apps/sim/triggers/linear/comment_updated_v2.ts deleted file mode 100644 index 6496534933..0000000000 --- a/apps/sim/triggers/linear/comment_updated_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildCommentOutputs, buildLinearV2SubBlocks } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearCommentUpdatedV2Trigger: TriggerConfig = { - id: 'linear_comment_updated_v2', - name: 'Linear Comment Updated', - provider: 'linear', - description: 'Trigger workflow when a comment is updated in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_comment_updated_v2', - eventType: 'Comment (update)', - }), - - outputs: buildCommentOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'Comment', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/customer_request_created.ts b/apps/sim/triggers/linear/customer_request_created.ts index b08b16985d..b8c17da527 100644 --- a/apps/sim/triggers/linear/customer_request_created.ts +++ b/apps/sim/triggers/linear/customer_request_created.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildCustomerRequestOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildCustomerRequestOutputs, + buildLinearV2SubBlocks, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearCustomerRequestCreatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearCustomerRequestCreatedTrigger: TriggerConfig = { }, }, } + +export const linearCustomerRequestCreatedV2Trigger: TriggerConfig = { + id: 'linear_customer_request_created_v2', + name: 'Linear Customer Request Created', + provider: 'linear', + description: 'Trigger workflow when a new customer request is created in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_customer_request_created_v2', + eventType: 'Customer Requests', + }), + outputs: buildCustomerRequestOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'CustomerNeed', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/customer_request_created_v2.ts b/apps/sim/triggers/linear/customer_request_created_v2.ts deleted file mode 100644 index dd5d91663b..0000000000 --- a/apps/sim/triggers/linear/customer_request_created_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildCustomerRequestOutputs, buildLinearV2SubBlocks } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearCustomerRequestCreatedV2Trigger: TriggerConfig = { - id: 'linear_customer_request_created_v2', - name: 'Linear Customer Request Created', - provider: 'linear', - description: 'Trigger workflow when a new customer request is created in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_customer_request_created_v2', - eventType: 'Customer Requests', - }), - - outputs: buildCustomerRequestOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'CustomerNeed', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/customer_request_updated.ts b/apps/sim/triggers/linear/customer_request_updated.ts index e4f91cfa8f..a76b8c22ca 100644 --- a/apps/sim/triggers/linear/customer_request_updated.ts +++ b/apps/sim/triggers/linear/customer_request_updated.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildCustomerRequestOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildCustomerRequestOutputs, + buildLinearV2SubBlocks, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearCustomerRequestUpdatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearCustomerRequestUpdatedTrigger: TriggerConfig = { }, }, } + +export const linearCustomerRequestUpdatedV2Trigger: TriggerConfig = { + id: 'linear_customer_request_updated_v2', + name: 'Linear Customer Request Updated', + provider: 'linear', + description: 'Trigger workflow when a customer request is updated in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_customer_request_updated_v2', + eventType: 'CustomerNeed (update)', + }), + outputs: buildCustomerRequestOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'CustomerNeed', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/customer_request_updated_v2.ts b/apps/sim/triggers/linear/customer_request_updated_v2.ts deleted file mode 100644 index b06696b580..0000000000 --- a/apps/sim/triggers/linear/customer_request_updated_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildCustomerRequestOutputs, buildLinearV2SubBlocks } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearCustomerRequestUpdatedV2Trigger: TriggerConfig = { - id: 'linear_customer_request_updated_v2', - name: 'Linear Customer Request Updated', - provider: 'linear', - description: 'Trigger workflow when a customer request is updated in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_customer_request_updated_v2', - eventType: 'CustomerNeed (update)', - }), - - outputs: buildCustomerRequestOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'CustomerNeed', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/cycle_created.ts b/apps/sim/triggers/linear/cycle_created.ts index dc80861ab0..3238dce74f 100644 --- a/apps/sim/triggers/linear/cycle_created.ts +++ b/apps/sim/triggers/linear/cycle_created.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildCycleOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildCycleOutputs, + buildLinearV2SubBlocks, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearCycleCreatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearCycleCreatedTrigger: TriggerConfig = { }, }, } + +export const linearCycleCreatedV2Trigger: TriggerConfig = { + id: 'linear_cycle_created_v2', + name: 'Linear Cycle Created', + provider: 'linear', + description: 'Trigger workflow when a new cycle is created in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_cycle_created_v2', + eventType: 'Cycle (create)', + }), + outputs: buildCycleOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'Cycle', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/cycle_created_v2.ts b/apps/sim/triggers/linear/cycle_created_v2.ts deleted file mode 100644 index 8204331c22..0000000000 --- a/apps/sim/triggers/linear/cycle_created_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildCycleOutputs, buildLinearV2SubBlocks } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearCycleCreatedV2Trigger: TriggerConfig = { - id: 'linear_cycle_created_v2', - name: 'Linear Cycle Created', - provider: 'linear', - description: 'Trigger workflow when a new cycle is created in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_cycle_created_v2', - eventType: 'Cycle (create)', - }), - - outputs: buildCycleOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'Cycle', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/cycle_updated.ts b/apps/sim/triggers/linear/cycle_updated.ts index 7922adafcd..fc996c3a8e 100644 --- a/apps/sim/triggers/linear/cycle_updated.ts +++ b/apps/sim/triggers/linear/cycle_updated.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildCycleOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildCycleOutputs, + buildLinearV2SubBlocks, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearCycleUpdatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearCycleUpdatedTrigger: TriggerConfig = { }, }, } + +export const linearCycleUpdatedV2Trigger: TriggerConfig = { + id: 'linear_cycle_updated_v2', + name: 'Linear Cycle Updated', + provider: 'linear', + description: 'Trigger workflow when a cycle is updated in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_cycle_updated_v2', + eventType: 'Cycle (update)', + }), + outputs: buildCycleOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'Cycle', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/cycle_updated_v2.ts b/apps/sim/triggers/linear/cycle_updated_v2.ts deleted file mode 100644 index 341f126123..0000000000 --- a/apps/sim/triggers/linear/cycle_updated_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildCycleOutputs, buildLinearV2SubBlocks } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearCycleUpdatedV2Trigger: TriggerConfig = { - id: 'linear_cycle_updated_v2', - name: 'Linear Cycle Updated', - provider: 'linear', - description: 'Trigger workflow when a cycle is updated in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_cycle_updated_v2', - eventType: 'Cycle (update)', - }), - - outputs: buildCycleOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'Cycle', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/index.ts b/apps/sim/triggers/linear/index.ts index 1a6e9ebe2a..05b35bd39d 100644 --- a/apps/sim/triggers/linear/index.ts +++ b/apps/sim/triggers/linear/index.ts @@ -1,30 +1,24 @@ -export { linearCommentCreatedTrigger } from './comment_created' -export { linearCommentCreatedV2Trigger } from './comment_created_v2' -export { linearCommentUpdatedTrigger } from './comment_updated' -export { linearCommentUpdatedV2Trigger } from './comment_updated_v2' -export { linearCustomerRequestCreatedTrigger } from './customer_request_created' -export { linearCustomerRequestCreatedV2Trigger } from './customer_request_created_v2' -export { linearCustomerRequestUpdatedTrigger } from './customer_request_updated' -export { linearCustomerRequestUpdatedV2Trigger } from './customer_request_updated_v2' -export { linearCycleCreatedTrigger } from './cycle_created' -export { linearCycleCreatedV2Trigger } from './cycle_created_v2' -export { linearCycleUpdatedTrigger } from './cycle_updated' -export { linearCycleUpdatedV2Trigger } from './cycle_updated_v2' -export { linearIssueCreatedTrigger } from './issue_created' -export { linearIssueCreatedV2Trigger } from './issue_created_v2' -export { linearIssueRemovedTrigger } from './issue_removed' -export { linearIssueRemovedV2Trigger } from './issue_removed_v2' -export { linearIssueUpdatedTrigger } from './issue_updated' -export { linearIssueUpdatedV2Trigger } from './issue_updated_v2' -export { linearLabelCreatedTrigger } from './label_created' -export { linearLabelCreatedV2Trigger } from './label_created_v2' -export { linearLabelUpdatedTrigger } from './label_updated' -export { linearLabelUpdatedV2Trigger } from './label_updated_v2' -export { linearProjectCreatedTrigger } from './project_created' -export { linearProjectCreatedV2Trigger } from './project_created_v2' -export { linearProjectUpdateCreatedTrigger } from './project_update_created' -export { linearProjectUpdateCreatedV2Trigger } from './project_update_created_v2' -export { linearProjectUpdatedTrigger } from './project_updated' -export { linearProjectUpdatedV2Trigger } from './project_updated_v2' -export { linearWebhookTrigger } from './webhook' -export { linearWebhookV2Trigger } from './webhook_v2' +export { linearCommentCreatedTrigger, linearCommentCreatedV2Trigger } from './comment_created' +export { linearCommentUpdatedTrigger, linearCommentUpdatedV2Trigger } from './comment_updated' +export { + linearCustomerRequestCreatedTrigger, + linearCustomerRequestCreatedV2Trigger, +} from './customer_request_created' +export { + linearCustomerRequestUpdatedTrigger, + linearCustomerRequestUpdatedV2Trigger, +} from './customer_request_updated' +export { linearCycleCreatedTrigger, linearCycleCreatedV2Trigger } from './cycle_created' +export { linearCycleUpdatedTrigger, linearCycleUpdatedV2Trigger } from './cycle_updated' +export { linearIssueCreatedTrigger, linearIssueCreatedV2Trigger } from './issue_created' +export { linearIssueRemovedTrigger, linearIssueRemovedV2Trigger } from './issue_removed' +export { linearIssueUpdatedTrigger, linearIssueUpdatedV2Trigger } from './issue_updated' +export { linearLabelCreatedTrigger, linearLabelCreatedV2Trigger } from './label_created' +export { linearLabelUpdatedTrigger, linearLabelUpdatedV2Trigger } from './label_updated' +export { linearProjectCreatedTrigger, linearProjectCreatedV2Trigger } from './project_created' +export { + linearProjectUpdateCreatedTrigger, + linearProjectUpdateCreatedV2Trigger, +} from './project_update_created' +export { linearProjectUpdatedTrigger, linearProjectUpdatedV2Trigger } from './project_updated' +export { linearWebhookTrigger, linearWebhookV2Trigger } from './webhook' diff --git a/apps/sim/triggers/linear/issue_created.ts b/apps/sim/triggers/linear/issue_created.ts index e10b00663f..4a95974a1e 100644 --- a/apps/sim/triggers/linear/issue_created.ts +++ b/apps/sim/triggers/linear/issue_created.ts @@ -1,6 +1,7 @@ import { LinearIcon } from '@/components/icons' import { buildIssueOutputs, + buildLinearV2SubBlocks, linearSetupInstructions, linearTriggerOptions, } from '@/triggers/linear/utils' @@ -91,3 +92,28 @@ export const linearIssueCreatedTrigger: TriggerConfig = { }, }, } + +export const linearIssueCreatedV2Trigger: TriggerConfig = { + id: 'linear_issue_created_v2', + name: 'Linear Issue Created', + provider: 'linear', + description: 'Trigger workflow when a new issue is created in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_issue_created_v2', + eventType: 'Issue (create)', + includeDropdown: true, + }), + outputs: buildIssueOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'Issue', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/issue_created_v2.ts b/apps/sim/triggers/linear/issue_created_v2.ts deleted file mode 100644 index b6eb9cc594..0000000000 --- a/apps/sim/triggers/linear/issue_created_v2.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildIssueOutputs, buildLinearV2SubBlocks } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -/** - * Linear Issue Created Trigger (v2) - * - * Primary trigger - includes the dropdown for selecting trigger type. - * Uses automatic webhook registration via the Linear GraphQL API. - */ -export const linearIssueCreatedV2Trigger: TriggerConfig = { - id: 'linear_issue_created_v2', - name: 'Linear Issue Created', - provider: 'linear', - description: 'Trigger workflow when a new issue is created in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_issue_created_v2', - eventType: 'Issue (create)', - includeDropdown: true, - }), - - outputs: buildIssueOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'Issue', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/issue_removed.ts b/apps/sim/triggers/linear/issue_removed.ts index 8f1361acbf..ca1431ecae 100644 --- a/apps/sim/triggers/linear/issue_removed.ts +++ b/apps/sim/triggers/linear/issue_removed.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildIssueOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildIssueOutputs, + buildLinearV2SubBlocks, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearIssueRemovedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearIssueRemovedTrigger: TriggerConfig = { }, }, } + +export const linearIssueRemovedV2Trigger: TriggerConfig = { + id: 'linear_issue_removed_v2', + name: 'Linear Issue Removed', + provider: 'linear', + description: 'Trigger workflow when an issue is removed/deleted in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_issue_removed_v2', + eventType: 'Issue (remove)', + }), + outputs: buildIssueOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'Issue', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/issue_removed_v2.ts b/apps/sim/triggers/linear/issue_removed_v2.ts deleted file mode 100644 index 152e1d5504..0000000000 --- a/apps/sim/triggers/linear/issue_removed_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildIssueOutputs, buildLinearV2SubBlocks } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearIssueRemovedV2Trigger: TriggerConfig = { - id: 'linear_issue_removed_v2', - name: 'Linear Issue Removed', - provider: 'linear', - description: 'Trigger workflow when an issue is removed/deleted in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_issue_removed_v2', - eventType: 'Issue (remove)', - }), - - outputs: buildIssueOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'Issue', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/issue_updated.ts b/apps/sim/triggers/linear/issue_updated.ts index 7546026829..2893331a18 100644 --- a/apps/sim/triggers/linear/issue_updated.ts +++ b/apps/sim/triggers/linear/issue_updated.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildIssueOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildIssueOutputs, + buildLinearV2SubBlocks, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearIssueUpdatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearIssueUpdatedTrigger: TriggerConfig = { }, }, } + +export const linearIssueUpdatedV2Trigger: TriggerConfig = { + id: 'linear_issue_updated_v2', + name: 'Linear Issue Updated', + provider: 'linear', + description: 'Trigger workflow when an issue is updated in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_issue_updated_v2', + eventType: 'Issue (update)', + }), + outputs: buildIssueOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'Issue', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/issue_updated_v2.ts b/apps/sim/triggers/linear/issue_updated_v2.ts deleted file mode 100644 index 6fc6b04e2b..0000000000 --- a/apps/sim/triggers/linear/issue_updated_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildIssueOutputs, buildLinearV2SubBlocks } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearIssueUpdatedV2Trigger: TriggerConfig = { - id: 'linear_issue_updated_v2', - name: 'Linear Issue Updated', - provider: 'linear', - description: 'Trigger workflow when an issue is updated in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_issue_updated_v2', - eventType: 'Issue (update)', - }), - - outputs: buildIssueOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'Issue', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/label_created.ts b/apps/sim/triggers/linear/label_created.ts index f3e9638aeb..369825c83a 100644 --- a/apps/sim/triggers/linear/label_created.ts +++ b/apps/sim/triggers/linear/label_created.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildLabelOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildLabelOutputs, + buildLinearV2SubBlocks, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearLabelCreatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearLabelCreatedTrigger: TriggerConfig = { }, }, } + +export const linearLabelCreatedV2Trigger: TriggerConfig = { + id: 'linear_label_created_v2', + name: 'Linear Label Created', + provider: 'linear', + description: 'Trigger workflow when a new label is created in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_label_created_v2', + eventType: 'IssueLabel (create)', + }), + outputs: buildLabelOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'IssueLabel', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/label_created_v2.ts b/apps/sim/triggers/linear/label_created_v2.ts deleted file mode 100644 index d32c1593e9..0000000000 --- a/apps/sim/triggers/linear/label_created_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildLabelOutputs, buildLinearV2SubBlocks } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearLabelCreatedV2Trigger: TriggerConfig = { - id: 'linear_label_created_v2', - name: 'Linear Label Created', - provider: 'linear', - description: 'Trigger workflow when a new label is created in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_label_created_v2', - eventType: 'IssueLabel (create)', - }), - - outputs: buildLabelOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'IssueLabel', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/label_updated.ts b/apps/sim/triggers/linear/label_updated.ts index 2f0941f72e..9009165bf5 100644 --- a/apps/sim/triggers/linear/label_updated.ts +++ b/apps/sim/triggers/linear/label_updated.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildLabelOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildLabelOutputs, + buildLinearV2SubBlocks, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearLabelUpdatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearLabelUpdatedTrigger: TriggerConfig = { }, }, } + +export const linearLabelUpdatedV2Trigger: TriggerConfig = { + id: 'linear_label_updated_v2', + name: 'Linear Label Updated', + provider: 'linear', + description: 'Trigger workflow when a label is updated in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_label_updated_v2', + eventType: 'IssueLabel (update)', + }), + outputs: buildLabelOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'IssueLabel', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/label_updated_v2.ts b/apps/sim/triggers/linear/label_updated_v2.ts deleted file mode 100644 index f55f61f1ef..0000000000 --- a/apps/sim/triggers/linear/label_updated_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildLabelOutputs, buildLinearV2SubBlocks } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearLabelUpdatedV2Trigger: TriggerConfig = { - id: 'linear_label_updated_v2', - name: 'Linear Label Updated', - provider: 'linear', - description: 'Trigger workflow when a label is updated in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_label_updated_v2', - eventType: 'IssueLabel (update)', - }), - - outputs: buildLabelOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'IssueLabel', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/project_created.ts b/apps/sim/triggers/linear/project_created.ts index 4175b78170..6758466c70 100644 --- a/apps/sim/triggers/linear/project_created.ts +++ b/apps/sim/triggers/linear/project_created.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildProjectOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildLinearV2SubBlocks, + buildProjectOutputs, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearProjectCreatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearProjectCreatedTrigger: TriggerConfig = { }, }, } + +export const linearProjectCreatedV2Trigger: TriggerConfig = { + id: 'linear_project_created_v2', + name: 'Linear Project Created', + provider: 'linear', + description: 'Trigger workflow when a new project is created in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_project_created_v2', + eventType: 'Project (create)', + }), + outputs: buildProjectOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'Project', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/project_created_v2.ts b/apps/sim/triggers/linear/project_created_v2.ts deleted file mode 100644 index 392cc57d89..0000000000 --- a/apps/sim/triggers/linear/project_created_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildLinearV2SubBlocks, buildProjectOutputs } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearProjectCreatedV2Trigger: TriggerConfig = { - id: 'linear_project_created_v2', - name: 'Linear Project Created', - provider: 'linear', - description: 'Trigger workflow when a new project is created in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_project_created_v2', - eventType: 'Project (create)', - }), - - outputs: buildProjectOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'Project', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/project_update_created.ts b/apps/sim/triggers/linear/project_update_created.ts index 9d84548025..83321dbf80 100644 --- a/apps/sim/triggers/linear/project_update_created.ts +++ b/apps/sim/triggers/linear/project_update_created.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildProjectUpdateOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildLinearV2SubBlocks, + buildProjectUpdateOutputs, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearProjectUpdateCreatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearProjectUpdateCreatedTrigger: TriggerConfig = { }, }, } + +export const linearProjectUpdateCreatedV2Trigger: TriggerConfig = { + id: 'linear_project_update_created_v2', + name: 'Linear Project Update Created', + provider: 'linear', + description: 'Trigger workflow when a new project update is posted in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_project_update_created_v2', + eventType: 'ProjectUpdate (create)', + }), + outputs: buildProjectUpdateOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'ProjectUpdate', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/project_update_created_v2.ts b/apps/sim/triggers/linear/project_update_created_v2.ts deleted file mode 100644 index cf872edd76..0000000000 --- a/apps/sim/triggers/linear/project_update_created_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildLinearV2SubBlocks, buildProjectUpdateOutputs } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearProjectUpdateCreatedV2Trigger: TriggerConfig = { - id: 'linear_project_update_created_v2', - name: 'Linear Project Update Created', - provider: 'linear', - description: 'Trigger workflow when a new project update is posted in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_project_update_created_v2', - eventType: 'ProjectUpdate (create)', - }), - - outputs: buildProjectUpdateOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'ProjectUpdate', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/project_updated.ts b/apps/sim/triggers/linear/project_updated.ts index 1e569e6cbf..e79eb4cd58 100644 --- a/apps/sim/triggers/linear/project_updated.ts +++ b/apps/sim/triggers/linear/project_updated.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { buildProjectOutputs, linearSetupInstructions } from '@/triggers/linear/utils' +import { + buildLinearV2SubBlocks, + buildProjectOutputs, + linearSetupInstructions, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearProjectUpdatedTrigger: TriggerConfig = { @@ -78,3 +82,27 @@ export const linearProjectUpdatedTrigger: TriggerConfig = { }, }, } + +export const linearProjectUpdatedV2Trigger: TriggerConfig = { + id: 'linear_project_updated_v2', + name: 'Linear Project Updated', + provider: 'linear', + description: 'Trigger workflow when a project is updated in Linear', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_project_updated_v2', + eventType: 'Project (update)', + }), + outputs: buildProjectOutputs(), + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'Project', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/project_updated_v2.ts b/apps/sim/triggers/linear/project_updated_v2.ts deleted file mode 100644 index 71a8321188..0000000000 --- a/apps/sim/triggers/linear/project_updated_v2.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildLinearV2SubBlocks, buildProjectOutputs } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearProjectUpdatedV2Trigger: TriggerConfig = { - id: 'linear_project_updated_v2', - name: 'Linear Project Updated', - provider: 'linear', - description: 'Trigger workflow when a project is updated in Linear', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_project_updated_v2', - eventType: 'Project (update)', - }), - - outputs: buildProjectOutputs(), - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'Project', - 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - 'Linear-Signature': 'sha256...', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/apps/sim/triggers/linear/webhook.ts b/apps/sim/triggers/linear/webhook.ts index cf6eef2d09..83ad6d6a25 100644 --- a/apps/sim/triggers/linear/webhook.ts +++ b/apps/sim/triggers/linear/webhook.ts @@ -1,5 +1,9 @@ import { LinearIcon } from '@/components/icons' -import { linearSetupInstructions, userOutputs } from '@/triggers/linear/utils' +import { + buildLinearV2SubBlocks, + linearSetupInstructions, + userOutputs, +} from '@/triggers/linear/utils' import type { TriggerConfig } from '@/triggers/types' export const linearWebhookTrigger: TriggerConfig = { @@ -120,3 +124,68 @@ export const linearWebhookTrigger: TriggerConfig = { }, }, } + +export const linearWebhookV2Trigger: TriggerConfig = { + id: 'linear_webhook_v2', + name: 'Linear Webhook', + provider: 'linear', + description: + 'Trigger workflow from Linear events you select when creating the webhook in Linear (not guaranteed to be every model or event type).', + version: '2.0.0', + icon: LinearIcon, + subBlocks: buildLinearV2SubBlocks({ + triggerId: 'linear_webhook_v2', + eventType: 'All Events', + additionalNotes: + 'This webhook will receive all Linear events. Use the type and action fields in the payload to filter and handle different event types.', + }), + outputs: { + action: { + type: 'string', + description: 'Action performed (create, update, remove)', + }, + type: { + type: 'string', + description: 'Entity type (Issue, Comment, Project, Cycle, IssueLabel, ProjectUpdate, etc.)', + }, + webhookId: { + type: 'string', + description: 'Webhook ID', + }, + webhookTimestamp: { + type: 'number', + description: 'Webhook timestamp (milliseconds)', + }, + organizationId: { + type: 'string', + description: 'Organization ID', + }, + createdAt: { + type: 'string', + description: 'Event creation timestamp', + }, + url: { + type: 'string', + description: 'URL of the subject entity in Linear (top-level webhook payload)', + }, + actor: userOutputs, + data: { + type: 'object', + description: 'Complete entity data object', + }, + updatedFrom: { + type: 'object', + description: 'Previous values for changed fields (only present on update)', + }, + }, + webhook: { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Linear-Event': 'Issue', + 'Linear-Delivery': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + 'Linear-Signature': 'sha256...', + 'User-Agent': 'Linear-Webhook', + }, + }, +} diff --git a/apps/sim/triggers/linear/webhook_v2.ts b/apps/sim/triggers/linear/webhook_v2.ts deleted file mode 100644 index 567c47213b..0000000000 --- a/apps/sim/triggers/linear/webhook_v2.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { LinearIcon } from '@/components/icons' -import { buildLinearV2SubBlocks, userOutputs } from '@/triggers/linear/utils' -import type { TriggerConfig } from '@/triggers/types' - -export const linearWebhookV2Trigger: TriggerConfig = { - id: 'linear_webhook_v2', - name: 'Linear Webhook', - provider: 'linear', - description: - 'Trigger workflow from Linear data-change events included in this webhook subscription (Issues, Comments, Projects, etc.—not every Linear model).', - version: '2.0.0', - icon: LinearIcon, - - subBlocks: buildLinearV2SubBlocks({ - triggerId: 'linear_webhook_v2', - eventType: 'All Events', - additionalNotes: - 'Sim registers this webhook for Issues, Comments, Projects, Cycles, Issue labels, Project updates, and Customer requests—matching what the Linear API allows in one subscription. It does not include every model Linear documents separately (e.g. Documents, Reactions). Use type and action in the payload to filter.', - }), - - outputs: { - action: { - type: 'string', - description: 'Action performed (create, update, remove)', - }, - type: { - type: 'string', - description: 'Entity type (Issue, Comment, Project, Cycle, IssueLabel, ProjectUpdate, etc.)', - }, - webhookId: { - type: 'string', - description: 'Webhook ID', - }, - webhookTimestamp: { - type: 'number', - description: 'Webhook timestamp (milliseconds)', - }, - organizationId: { - type: 'string', - description: 'Organization ID', - }, - createdAt: { - type: 'string', - description: 'Event creation timestamp', - }, - url: { - type: 'string', - description: 'URL of the subject entity in Linear (top-level webhook payload)', - }, - actor: userOutputs, - data: { - type: 'object', - description: 'Complete entity data object', - }, - updatedFrom: { - type: 'object', - description: 'Previous values for changed fields (only present on update)', - }, - }, - - webhook: { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Linear-Event': 'Issue', - 'Linear-Delivery': '234d1a4e-b617-4388-90fe-adc3633d6b72', - 'Linear-Signature': '766e1d90a96e2f5ecec342a99c5552999dd95d49250171b902d703fd674f5086', - 'User-Agent': 'Linear-Webhook', - }, - }, -} diff --git a/scripts/generate-docs.ts b/scripts/generate-docs.ts index 13a1c509df..49f2dcf8f1 100755 --- a/scripts/generate-docs.ts +++ b/scripts/generate-docs.ts @@ -491,17 +491,35 @@ async function buildTriggerRegistry(): Promise> { try { const content = fs.readFileSync(file, 'utf-8') - // Each trigger file exports a single TriggerConfig with id, name, description - const idMatch = /\bid\s*:\s*['"]([^'"]+)['"]/.exec(content) - const nameMatch = /\bname\s*:\s*['"]([^'"]+)['"]/.exec(content) - const descMatch = /\bdescription\s*:\s*['"]([^'"]+)['"]/.exec(content) + // A file may export multiple TriggerConfig objects (e.g. v1 + v2 in + // the same file). Extract all exported configs by splitting on the + // export boundaries and parsing each one independently. + const exportRegex = /export\s+const\s+\w+\s*:\s*TriggerConfig\s*=\s*\{/g + let exportMatch + const exportStarts: number[] = [] - if (idMatch && nameMatch) { - registry.set(idMatch[1], { - id: idMatch[1], - name: nameMatch[1], - description: descMatch?.[1] ?? '', - }) + while ((exportMatch = exportRegex.exec(content)) !== null) { + exportStarts.push(exportMatch.index) + } + + // If no typed exports found, fall back to simple regex on whole file + const segments = + exportStarts.length > 0 + ? exportStarts.map((start, i) => content.substring(start, exportStarts[i + 1])) + : [content] + + for (const segment of segments) { + const idMatch = /\bid\s*:\s*['"]([^'"]+)['"]/.exec(segment) + const nameMatch = /\bname\s*:\s*['"]([^'"]+)['"]/.exec(segment) + const descMatch = /\bdescription\s*:\s*['"]([^'"]+)['"]/.exec(segment) + + if (idMatch && nameMatch) { + registry.set(idMatch[1], { + id: idMatch[1], + name: nameMatch[1], + description: descMatch?.[1] ?? '', + }) + } } } catch { // skip unreadable files silently