• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

microsoft / botbuilder-js / 13264809812

11 Feb 2025 02:09PM CUT coverage: 84.524%. Remained the same
13264809812

Pull #4856

github

web-flow
Merge 4e615f951 into 7534989ce
Pull Request #4856: fix: [#4786] Clarify createBotFrameworkAuthenticationFromConfiguration usage in yo templates

8205 of 10860 branches covered (75.55%)

Branch coverage included in aggregate %.

20555 of 23166 relevant lines covered (88.73%)

4123.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

5.13
/libraries/botbuilder/src/sharepoint/sharePointActivityHandler.ts
1
/**
2
 * @module botbuilder
3
 */
4
/**
5
 * Copyright (c) Microsoft Corporation. All rights reserved.
6
 * Licensed under the MIT License.
7
 */
8

9
import {
1✔
10
    ActivityHandler,
11
    InvokeResponse,
12
    AceRequest,
13
    TurnContext,
14
    CardViewResponse,
15
    QuickViewResponse,
16
    GetPropertyPaneConfigurationResponse,
17
    SetPropertyPaneConfigurationResponse,
18
    HandleActionResponse,
19
} from 'botbuilder-core';
20

21
/**
22
 * The SharePointActivityHandler is derived from ActivityHandler. It adds support for
23
 * the SharePoint specific events and interactions
24
 */
25
export class SharePointActivityHandler extends ActivityHandler {
1✔
26
    /**
27
     * Invoked when an invoke activity is received from the connector.
28
     * Invoke activities can be used to communicate many different things.
29
     * Invoke activities communicate programmatic commands from a client or channel to a bot.
30
     *
31
     * @param context A strongly-typed context object for this turn
32
     * @returns A task that represents the work queued to execute
33
     */
34
    protected async onInvokeActivity(context: TurnContext): Promise<InvokeResponse> {
35
        try {
×
36
            if (!context.activity.name && context.activity.channelId === 'sharepoint') {
×
37
                throw new Error('NotImplemented');
×
38
            } else {
39
                switch (context.activity.name) {
×
40
                    case 'cardExtension/getCardView':
×
41
                        return ActivityHandler.createInvokeResponse(
×
42
                            await this.onSharePointTaskGetCardViewAsync(context, context.activity.value as AceRequest),
43
                        );
44

45
                    case 'cardExtension/getQuickView':
46
                        return ActivityHandler.createInvokeResponse(
×
47
                            await this.onSharePointTaskGetQuickViewAsync(context, context.activity.value as AceRequest),
48
                        );
49

50
                    case 'cardExtension/getPropertyPaneConfiguration':
51
                        return ActivityHandler.createInvokeResponse(
×
52
                            await this.onSharePointTaskGetPropertyPaneConfigurationAsync(
53
                                context,
54
                                context.activity.value as AceRequest,
55
                            ),
56
                        );
57

58
                    case 'cardExtension/setPropertyPaneConfiguration':
59
                        return ActivityHandler.createInvokeResponse(
×
60
                            await this.onSharePointTaskSetPropertyPaneConfigurationAsync(
61
                                context,
62
                                context.activity.value as AceRequest,
63
                            ),
64
                        );
65
                    case 'cardExtension/handleAction':
66
                        return ActivityHandler.createInvokeResponse(
×
67
                            await this.onSharePointTaskHandleActionAsync(context, context.activity.value as AceRequest),
68
                        );
69
                    case 'cardExtension/token':
70
                        await this.onSignInInvoke(context);
×
71
                        return ActivityHandler.createInvokeResponse();
×
72
                    default:
73
                        return super.onInvokeActivity(context);
×
74
                }
75
            }
76
        } catch (err) {
77
            if (err.message === 'NotImplemented') {
×
78
                return { status: 501 };
×
79
            } else if (err.message === 'BadRequest') {
×
80
                return { status: 400 };
×
81
            }
82
            throw err;
×
83
        }
84
    }
85

86
    /**
87
     * Override this in a derived class to provide logic for when a card view is fetched
88
     *
89
     * @param _context - A strongly-typed context object for this turn
90
     * @param _aceRequest - The Ace invoke request value payload
91
     * @returns A Card View Response for the request
92
     */
93
    protected async onSharePointTaskGetCardViewAsync(
94
        _context: TurnContext,
95
        _aceRequest: AceRequest,
96
    ): Promise<CardViewResponse> {
97
        throw new Error('NotImplemented');
×
98
    }
99

100
    /**
101
     * Override this in a derived class to provide logic for when a quick view is fetched
102
     *
103
     * @param _context - A strongly-typed context object for this turn
104
     * @param _aceRequest - The Ace invoke request value payload
105
     * @returns A Quick View Response for the request
106
     */
107
    protected async onSharePointTaskGetQuickViewAsync(
108
        _context: TurnContext,
109
        _aceRequest: AceRequest,
110
    ): Promise<QuickViewResponse> {
111
        throw new Error('NotImplemented');
×
112
    }
113

114
    /**
115
     * Override this in a derived class to provide logic for getting configuration pane properties.
116
     *
117
     * @param _context - A strongly-typed context object for this turn
118
     * @param _aceRequest - The Ace invoke request value payload
119
     * @returns A Property Pane Configuration Response for the request
120
     */
121
    protected async onSharePointTaskGetPropertyPaneConfigurationAsync(
122
        _context: TurnContext,
123
        _aceRequest: AceRequest,
124
    ): Promise<GetPropertyPaneConfigurationResponse> {
125
        throw new Error('NotImplemented');
×
126
    }
127

128
    /**
129
     * Override this in a derived class to provide logic for setting configuration pane properties.
130
     *
131
     * @param _context - A strongly-typed context object for this turn
132
     * @param _aceRequest - The Ace invoke request value payload
133
     * @returns A Card view or no-op action response
134
     */
135
    protected async onSharePointTaskSetPropertyPaneConfigurationAsync(
136
        _context: TurnContext,
137
        _aceRequest: AceRequest,
138
    ): Promise<SetPropertyPaneConfigurationResponse> {
139
        throw new Error('NotImplemented');
×
140
    }
141

142
    /**
143
     * Override this in a derived class to provide logic for handling ACE action.
144
     *
145
     * @param _context - A strongly-typed context object for this turn
146
     * @param _aceRequest - The Ace invoke request value payload
147
     * @returns A handle action response
148
     */
149
    protected async onSharePointTaskHandleActionAsync(
150
        _context: TurnContext,
151
        _aceRequest: AceRequest,
152
    ): Promise<HandleActionResponse> {
153
        throw new Error('NotImplemented');
×
154
    }
155

156
    /**
157
     * Override this method to support channel-specific behavior across multiple channels.
158
     *
159
     * @param _context - A strongly-typed context object for this turn
160
     */
161
    protected async onSignInInvoke(_context: TurnContext): Promise<void> {
162
        throw new Error('NotImplemented');
×
163
    }
164
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc