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

microsoft / botbuilder-js / 7587095843

19 Jan 2024 05:24PM CUT coverage: 84.477%. Remained the same
7587095843

push

github

web-flow
feat: Add isVisible property to AceData (#4606)

* Add isVisible property to AceData

* extra comment

* updated md

---------

Co-authored-by: aterentiev <aterentiev@microsoft.com_odspmdb>

9984 of 13103 branches covered (0.0%)

Branch coverage included in aggregate %.

20411 of 22877 relevant lines covered (89.22%)

7205.42 hits per line

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

13.04
/libraries/botbuilder-azure-queues/src/azureQueueStorage.ts
1
// Copyright (c) Microsoft Corporation.
2
// Licensed under the MIT License.
3

4
import { QueueClient } from '@azure/storage-queue';
2✔
5
import { Activity, QueueStorage } from 'botbuilder-core';
2✔
6

7
/**
8
 * Service used to add messages to an Azure Storage Queues.
9
 */
10
export class AzureQueueStorage extends QueueStorage {
2✔
11
    private _initializePromise: Promise<unknown>;
12
    private readonly _queueClient: QueueClient;
13

14
    /**
15
     * Initializes a new instance of the AzureQueueStorage class.
16
     *
17
     * @param {string} queuesStorageConnectionString Azure storage connection string.
18
     * @param {string} queueName Name of the storage queue where entities will be queued.
19
     */
20
    constructor(queuesStorageConnectionString: string, queueName: string) {
21
        super();
×
22
        if (!queuesStorageConnectionString) {
×
23
            throw new Error('queuesStorageConnectionString cannot be empty');
×
24
        }
25

26
        if (!queueName) {
×
27
            throw new Error('queueName cannot be empty');
×
28
        }
29

30
        this._queueClient = new QueueClient(queuesStorageConnectionString, queueName);
×
31
    }
32

33
    /**
34
     * Queue an Activity to an Azure storage queues. The visibility timeout specifies how long the message should be visible
35
     * to Dequeue and Peek operations. The message content must be a UTF-8 encoded string that is up to 64KB in size.
36
     *
37
     * @param {Partial<Activity>} activity The [Activity](xref:botframework-core.Activity) to be queued for later processing.
38
     * @param {number} visibilityTimeout Default value of 0. Cannot be larger than 7 days.
39
     * @param {number} messageTimeToLive Specifies the time-to-live interval for the message.
40
     * @returns {Promise<string>} [QueueSendMessageResponse](xref:@azure/storage-queue.QueueSendMessageResponse) as a JSON string.
41
     */
42
    async queueActivity(
43
        activity: Partial<Activity>,
44
        visibilityTimeout?: number,
45
        messageTimeToLive?: number
46
    ): Promise<string> {
47
        await this._initialize();
×
48

49
        // Convert activity to base64 string
50
        const activityString = JSON.stringify(activity);
×
51
        const message = Buffer.from(activityString).toString('base64');
×
52
        const receipt = await this._queueClient.sendMessage(message, {
×
53
            visibilityTimeout,
54
            messageTimeToLive,
55
        });
56

57
        return JSON.stringify(receipt);
×
58
    }
59

60
    private _initialize(): Promise<unknown> {
61
        if (!this._initializePromise) {
×
62
            this._initializePromise = this._queueClient.createIfNotExists();
×
63
        }
64
        return this._initializePromise;
×
65
    }
66
}
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