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

microsoft / botbuilder-js / 7641848477

24 Jan 2024 02:43PM CUT coverage: 84.48% (+0.003%) from 84.477%
7641848477

push

github

web-flow
fix: [#4582] UserAssignedIdentity(WorkloadIdentity) auth fails with 'scope https://api.botframework.com is not valid' (#4607)

* Add scope post-fix in managedIdentityAuthenticator.

* Fix unit test

9986 of 13105 branches covered (0.0%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 1 file covered. (100.0%)

20414 of 22880 relevant lines covered (89.22%)

7192.27 hits per line

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

5.56
/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 {
2✔
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 {
2✔
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
                    default:
70
                        return super.onInvokeActivity(context);
×
71
                }
72
            }
73
        } catch (err) {
74
            if (err.message === 'NotImplemented') {
×
75
                return { status: 501 };
×
76
            } else if (err.message === 'BadRequest') {
×
77
                return { status: 400 };
×
78
            }
79
            throw err;
×
80
        }
81
    }
82

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

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

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

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

139
    /**
140
     * Override this in a derived class to provide logic for setting configuration pane properties.
141
     *
142
     * @param _context - A strongly-typed context object for this turn
143
     * @param _aceRequest - The Ace invoke request value payload
144
     * @returns A handle action response
145
     */
146
    protected async onSharePointTaskHandleActionAsync(
147
        _context: TurnContext,
148
        _aceRequest: AceRequest
149
    ): Promise<HandleActionResponse> {
150
        throw new Error('NotImplemented');
×
151
    }
152
}
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