Skip to content

Expand Connectors Extensions: AzureBlob, OneDrive, and additional Office 365 / Teams triggers - #132

Open
Swapnil Nagar (swapnil-nagar) wants to merge 3 commits into
mainfrom
swapnil/extensionChanges
Open

Expand Connectors Extensions: AzureBlob, OneDrive, and additional Office 365 / Teams triggers#132
Swapnil Nagar (swapnil-nagar) wants to merge 3 commits into
mainfrom
swapnil/extensionChanges

Conversation

@swapnil-nagar

@swapnil-nagar Swapnil Nagar (swapnil-nagar) commented May 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates @azure/functions-extensions-connectors to 0.0.2-preview, aligning the first-class trigger surface with the new connectors and trigger methods shipped in @azure/connectors@0.2.0-preview. This release adds two brand-new connector namespaces (azureblob, onedrive) and six additional trigger registrations across the existing office365 and teams namespaces, plus 13 new sample functions demonstrating each new trigger.

Motivation

@azure/connectors@0.2.0-preview added:

  • A new Azureblob extension with an onUpdatedFilesAsync trigger.
  • A new Onedriveforbusiness extension with onNewFile/onUpdatedFile (single + batch) triggers.
  • Additional triggers in Office365 (onFlaggedEmail, onNewMentionMeEmail, onUpcomingEvents) and Teams (onNewChannelMessageMentioningMe, onGroupMembershipAdd, onGroupMembershipRemoval).

Without this PR, customers would have to fall back to the raw app.connectorTrigger() API and manually cast payloads for any of these scenarios. This PR brings them up to the same strongly-typed, named-alias developer experience the existing first-class triggers already provide.

Customer Experience

import { connectors } from '@azure/functions-extensions-connectors';

// NEW: Azure Blob updated-file trigger
connectors.azureblob.onUpdatedFile('OnAzureBlobUpdatedFile', {
    handler: async (context, invocationContext) => {
        for (const file of context.files) {
            invocationContext.log(`Updated blob: '${file.Path}' (${file.Size} bytes).`);
        }
    },
});

// NEW: OneDrive new-file trigger
connectors.onedrive.onNewFile('OnOneDriveNewFile', {
    handler: async (context, invocationContext) => {
        for (const file of context.files) {
            invocationContext.log(`New OneDrive file: '${file.Name}'.`);
        }
    },
});

// NEW: Teams group membership trigger
connectors.teams.onGroupMembershipAdd('OnGroupMembershipAdd', {
    handler: async (context, invocationContext) => {
        for (const member of context.members) {
            invocationContext.log(`Member added: '${JSON.stringify(member)}'.`);
        }
    },
});

Full Supported Trigger Matrix (post-PR)

Registration Context Type Named Property Item Type Status
connectors.azureblob.onUpdatedFile() AzureBlobFileTriggerContext files AzureBlobMetadata[] NEW
connectors.onedrive.onNewFile() OneDriveFileTriggerContext files OneDriveBlobMetadata[] NEW
connectors.onedrive.onUpdatedFile() OneDriveFileTriggerContext files OneDriveBlobMetadata[] NEW
connectors.office365.onNewEmail() EmailTriggerContext emails GraphClientReceiveMessage[] existing
connectors.office365.onFlaggedEmail() EmailTriggerContext emails GraphClientReceiveMessage[] NEW
connectors.office365.onNewMentionMeEmail() EmailTriggerContext emails GraphClientReceiveMessage[] NEW
connectors.office365.onNewCalendarEvent() CalendarEventTriggerContext calendarEvents GraphCalendarEventClientReceive[] existing
connectors.office365.onUpcomingEvent() CalendarEventTriggerContext calendarEvents GraphCalendarEventClientReceive[] NEW
connectors.sharepoint.onNewFile() FileTriggerContext files BlobMetadata[] existing
connectors.sharepoint.onUpdatedFile() FileTriggerContext files BlobMetadata[] existing
connectors.teams.onNewChannelMessage() ChannelMessageTriggerContext messages ChatMessage[] existing
connectors.teams.onNewChannelMessageMentioningMe() ChannelMessageTriggerContext messages ChatMessage[] NEW
connectors.teams.onGroupMembershipAdd() GroupMembershipTriggerContext members Record<string, unknown>[] NEW
connectors.teams.onGroupMembershipRemoval() GroupMembershipTriggerContext members Record<string, unknown>[] NEW
connectors.kusto.onQueryResult() QueryResultTriggerContext rows KustoRow[] existing

Connectors Not Included (Action-Only)

A scan of @azure/connectors@0.2.0-preview confirmed the following six connectors have no trigger methods (no on*Async SDK methods, no /triggers/ endpoints). They are action-only and therefore intentionally not exposed as first-class triggers in this package — customers consume them by instantiating their clients directly from @azure/connectors:

  • arm — resource management actions
  • azuremonitorlogs — query actions
  • mq — queue actions (read/receive/send/delete; no push triggers)
  • msgraphgroupsanduser — directory lookup actions
  • office365users — user profile actions
  • smtpsendEmail action

Package Structure Changes

azure-functions-nodejs-extensions-connectors/
├── src/connectors/
│   ├── connectorTriggers.ts            # +azureblob, +onedrive groupings
│   ├── azureblobTriggers.ts            # NEW
│   ├── onedriveTriggers.ts             # NEW
│   ├── office365Triggers.ts            # +onFlaggedEmail, +onNewMentionMeEmail, +onUpcomingEvent
│   ├── teamsTriggers.ts                # +onNewChannelMessageMentioningMe, +onGroupMembershipAdd, +onGroupMembershipRemoval
│   ├── sharepointTriggers.ts           # (unchanged)
│   ├── kustoTriggers.ts                # (unchanged)
│   └── connectorTrigger.ts             # (unchanged)
├── types/index.d.ts                    # +AzureBlobFileTriggerContext, +OneDriveFileTriggerContext, +GroupMembershipTriggerContext, +AzureBlobTriggers, +OneDriveTriggers
├── src/index.ts                        # +AzureBlobMetadata, +OneDriveBlobMetadata re-exports
└── samples/connectorTriggerSample/src/functions/
    ├── onAzureBlobUpdatedFile.ts       # NEW
    ├── onOneDriveNewFile.ts            # NEW
    ├── onOneDriveUpdatedFile.ts        # NEW
    ├── onFlaggedEmail.ts               # NEW
    ├── onNewMentionMeEmail.ts          # NEW
    ├── onNewCalendarEvent.ts           # NEW
    ├── onUpcomingEvent.ts              # NEW
    ├── onNewChannelMessage.ts          # NEW
    ├── onNewChannelMessageMentioningMe.ts  # NEW
    ├── onGroupMembershipAdd.ts         # NEW
    ├── onGroupMembershipRemoval.ts     # NEW
    ├── onKustoQueryResult.ts           # NEW
    ├── onSharepointNewFile.ts          # NEW
    ├── onNewEmail.ts                   # existing
    └── onNewEmailDirect.ts             # existing (raw API comparison)

Dependencies

Package Version Change
@azure/functions 4.15.1-preview unchanged (peer)
@azure/connectors ^0.2.0-preview bumped from ^0.1.1-preview

Test Results

  • 44 tests passing, 0 failing (was 33).
  • New test/connectorSpecificTriggers.test.ts cases cover registration, bindings, and named-alias projection for every new trigger.
  • test/connectorsNamespace.test.ts updated to assert the namespace exposes exactly ['azureblob', 'kusto', 'office365', 'onedrive', 'sharepoint', 'teams'].
  • Webpack build: 0 errors (npm run build).
  • Sample build: 0 errors (npm run build inside samples/connectorTriggerSample).

How to Test Locally

cd azure-functions-nodejs-extensions-connectors
npm install
npm run build    # webpack — 0 errors expected
npm test         # mocha — 44 passing expected

# Optional: build the sample app
cd samples/connectorTriggerSample
npm install --legacy-peer-deps
npm run build    # tsc — 0 errors expected

Key Design Decisions

  1. Reuse the existing wrapper pattern. Every new trigger is a thin connectorTrigger<TItem>() wrapper that adds a named alias (files, emails, calendarEvents, messages, members) over context.items. No new core helpers were introduced.
  2. Per-connector item typing. AzureBlobMetadata and OneDriveBlobMetadata are re-exported from their respective SDK extension modules to give each connector its own precise files element type, instead of collapsing both onto the SharePoint BlobMetadata.
  3. members typed as Record<string, unknown>. The SDK currently exposes GroupMembershipChange as an open record; we surface that as-is rather than guessing a shape.
  4. Action-only connectors deliberately omitted. Adding namespaces that contain zero trigger registrations would be misleading; the CHANGELOG and PR description document the omission explicitly so customers know to import those clients directly from @azure/connectors.

@swapnil-nagar
Swapnil Nagar (swapnil-nagar) marked this pull request as ready for review May 22, 2026 10:02
@swapnil-nagar Swapnil Nagar (swapnil-nagar) changed the title Swapnil/extension changes Expand Connectors Extensions: AzureBlob, OneDrive, and additional Office 365 / Teams triggers May 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the expanded connector surface. The package build/lint/tests pass locally for me, but the sample app does not install/build from a clean checkout.

azure-functions-nodejs-extensions-connectors/samples/connectorTriggerSample/package-lock.json now resolves @azure/functions-extensions-connectors@0.0.2-preview to file:../../azure-functions-extensions-connectors-0.0.2-preview.tgz, but that tarball is not committed/generated by the documented sample steps. Running from the sample directory:

npm ci
npm run build

fails with:

ENOENT: no such file or directory, open '.../azure-functions-extensions-connectors-0.0.2-preview.tgz'
TS2307: Cannot find module '@azure/functions-extensions-connectors'

Please regenerate the sample lockfile so it is reproducible from the repo, for example by keeping the existing local package link pattern or by resolving to a published package once 0.0.2-preview is available. As-is, the sample app and the PR's local test instructions fail on a clean checkout.

One smaller follow-up: the package README's Supported Connectors / Exported Types sections still list only the old trigger surface, even though README is included in the npm package. It would be good to update that table for the new Azure Blob, OneDrive, Office 365, and Teams registrations before publishing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants