diff --git a/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_change_point.ts b/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_change_point.ts index edae8a1b91b3..962a8ab644b1 100644 --- a/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_change_point.ts +++ b/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_change_point.ts @@ -36,7 +36,7 @@ function read_series_from_file(path: string): Array { return result; } -async function main() { +export async function main() { // create client const client = new AnomalyDetectorClient(endpoint, new AzureKeyCredential(apiKey)); diff --git a/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_entire_series_anomaly.ts b/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_entire_series_anomaly.ts index bce20d741093..e64a214b55a1 100644 --- a/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_entire_series_anomaly.ts +++ b/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_entire_series_anomaly.ts @@ -36,7 +36,7 @@ function read_series_from_file(path: string): Array { return result; } -async function main() { +export async function main() { // create client const client = new AnomalyDetectorClient(endpoint, new AzureKeyCredential(apiKey)); diff --git a/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_last_point_anomaly.ts b/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_last_point_anomaly.ts index 6a4d4a7cb60e..9dfe394860f6 100644 --- a/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_last_point_anomaly.ts +++ b/sdk/anomalydetector/ai-anomaly-detector/samples/typescript/src/sample_detect_last_point_anomaly.ts @@ -36,7 +36,7 @@ function read_series_from_file(path: string): Array { return result; } -async function main() { +export async function main() { // create client const client = new AnomalyDetectorClient(endpoint, new AzureKeyCredential(apiKey)); diff --git a/sdk/core/core-lro/samples/typescript/samplesClient.ts b/sdk/core/core-lro/samples/typescript/samplesClient.ts index d142568e9f22..c41d44eef31b 100644 --- a/sdk/core/core-lro/samples/typescript/samplesClient.ts +++ b/sdk/core/core-lro/samples/typescript/samplesClient.ts @@ -215,7 +215,7 @@ class Client { // Now let's see how the client is used. -async function main(): Promise { +export async function main(): Promise { const client = new Client(); let poller = await client.beginLongOperation(); console.log(poller.getResult()); // Should show: { value: 1 } diff --git a/sdk/eventgrid/eventgrid/samples/typescript/src/sendCloudEvent.ts b/sdk/eventgrid/eventgrid/samples/typescript/src/sendCloudEvent.ts index 0bdf5a48e637..37b027a50d76 100644 --- a/sdk/eventgrid/eventgrid/samples/typescript/src/sendCloudEvent.ts +++ b/sdk/eventgrid/eventgrid/samples/typescript/src/sendCloudEvent.ts @@ -14,7 +14,7 @@ const endpoint = process.env["EVENT_GRID_ENDPOINT"] || ""; // Navigate to Settings > Access keys in your Event Grid topic's menu blade to see both access keys (you may use either). const accessKey = process.env["EVENT_GRID_ACCESS_KEY"] || ""; -async function main(): Promise { +export async function main(): Promise { // Create the client used to publish events to the Event Grid Service const client = new EventGridPublisherClient(endpoint, new AzureKeyCredential(accessKey)); diff --git a/sdk/eventgrid/eventgrid/samples/typescript/src/sendEventGridEvent.ts b/sdk/eventgrid/eventgrid/samples/typescript/src/sendEventGridEvent.ts index ef02a6b7105d..309ca26b2916 100644 --- a/sdk/eventgrid/eventgrid/samples/typescript/src/sendEventGridEvent.ts +++ b/sdk/eventgrid/eventgrid/samples/typescript/src/sendEventGridEvent.ts @@ -7,14 +7,14 @@ import * as dotenv from "dotenv"; // Load the .env file if it exists dotenv.config(); -// The URL of the endpoint of the Event Grid topic. +// The URL of the endpoint of the Event Grid topic. const endpoint = process.env["EVENT_GRID_ENDPOINT"] || ""; // You can find the access keys in the Azure portal. // Navigate to Settings > Access keys in your Event Grid topic's menu blade to see both access keys (you may use either). const accessKey = process.env["EVENT_GRID_ACCESS_KEY"] || ""; -async function main(): Promise { +export async function main(): Promise { // Create the client used to publish events to the Event Grid Service const client = new EventGridPublisherClient(endpoint, new AzureKeyCredential(accessKey)); @@ -26,7 +26,7 @@ async function main(): Promise { subject: "azure/sdk/eventgrid/samples/sendEventSample", dataVersion: "1.0", data: { - message: "this is a sample event", + message: "this is a sample event" } } ]); diff --git a/sdk/eventhub/event-processor-host/samples/iothubEph.ts b/sdk/eventhub/event-processor-host/samples/iothubEph.ts index 5e0e1246c00f..09c18c85bf3b 100644 --- a/sdk/eventhub/event-processor-host/samples/iothubEph.ts +++ b/sdk/eventhub/event-processor-host/samples/iothubEph.ts @@ -24,7 +24,7 @@ const storageConnectionString = ""; const storageContainerName = EventProcessorHost.createHostName("iothub-container"); const ephName = "my-iothub-eph"; -async function main(): Promise { +export async function main(): Promise { // Start eph. const eph = await startEph(ephName); // Sleeeping for 90 seconds. This will give time for eph to receive messages. diff --git a/sdk/eventhub/event-processor-host/samples/multiEph.ts b/sdk/eventhub/event-processor-host/samples/multiEph.ts index 404bef9060c3..876a84faf9a1 100644 --- a/sdk/eventhub/event-processor-host/samples/multiEph.ts +++ b/sdk/eventhub/event-processor-host/samples/multiEph.ts @@ -32,7 +32,7 @@ const ephName2 = "eph-2"; // Use `createHostName` to create a unique name based on given prefix to use different storage containers on each run if needed. const storageContainerName = EventProcessorHost.createHostName("test-container"); -async function main(): Promise { +export async function main(): Promise { // Start eph-1. const eph1 = await startEph(ephName1); await delay(20000); diff --git a/sdk/eventhub/event-processor-host/samples/sendBatch.ts b/sdk/eventhub/event-processor-host/samples/sendBatch.ts index c5868efcc7e2..19a99ff37319 100644 --- a/sdk/eventhub/event-processor-host/samples/sendBatch.ts +++ b/sdk/eventhub/event-processor-host/samples/sendBatch.ts @@ -12,7 +12,7 @@ import { EventHubClient, EventData } from "@azure/event-hubs"; const connectionString = ""; const eventHubName = ""; -async function main(): Promise { +export async function main(): Promise { const client = EventHubClient.createFromConnectionString(connectionString, eventHubName); const partitionIds = await client.getPartitionIds(); const messageCount = 300; diff --git a/sdk/eventhub/event-processor-host/samples/singleEph.ts b/sdk/eventhub/event-processor-host/samples/singleEph.ts index 5a493934d481..ff96751354df 100644 --- a/sdk/eventhub/event-processor-host/samples/singleEph.ts +++ b/sdk/eventhub/event-processor-host/samples/singleEph.ts @@ -33,7 +33,7 @@ const storageConnectionString = ""; const storageContainerName = EventProcessorHost.createHostName("test-container"); const ephName = "my-eph"; -async function main(): Promise { +export async function main(): Promise { // Start eph. const eph = await startEph(ephName); // Sleeeping for 90 seconds. This will give time for eph to receive messages. diff --git a/sdk/eventhub/event-processor-host/samples/websockets.ts b/sdk/eventhub/event-processor-host/samples/websockets.ts index 83c9372c1f91..ac3c0f78ae76 100644 --- a/sdk/eventhub/event-processor-host/samples/websockets.ts +++ b/sdk/eventhub/event-processor-host/samples/websockets.ts @@ -33,7 +33,7 @@ const urlParts = url.parse("http://localhost:3128"); urlParts.auth = "username:password"; // Skip this if proxy server does not need authentication. const proxyAgent = new httpsProxyAgent(urlParts); -async function main(): Promise { +export async function main(): Promise { const eph = EventProcessorHost.createFromConnectionString( EventProcessorHost.createHostName(ephName), storageConnectionString, diff --git a/sdk/eventhub/eventhubs-checkpointstore-blob/samples/typescript/src/receiveEventsUsingCheckpointStore.ts b/sdk/eventhub/eventhubs-checkpointstore-blob/samples/typescript/src/receiveEventsUsingCheckpointStore.ts index d5fc5ac9fcf2..d89b93237f62 100644 --- a/sdk/eventhub/eventhubs-checkpointstore-blob/samples/typescript/src/receiveEventsUsingCheckpointStore.ts +++ b/sdk/eventhub/eventhubs-checkpointstore-blob/samples/typescript/src/receiveEventsUsingCheckpointStore.ts @@ -27,7 +27,7 @@ const storageConnectionString = ""; const containerName = ""; const consumerGroup = ""; -async function main() { +export async function main() { // this client will be used by our eventhubs-checkpointstore-blob, which // persists any checkpoints from this session in Azure Storage const containerClient = new ContainerClient(storageConnectionString, containerName); diff --git a/sdk/eventhub/eventhubs-checkpointstore-blob/samples/typescript/src/receiveEventsWithApiSpecificStorage.ts b/sdk/eventhub/eventhubs-checkpointstore-blob/samples/typescript/src/receiveEventsWithApiSpecificStorage.ts index ae81b5f8e607..47d9d659aee9 100644 --- a/sdk/eventhub/eventhubs-checkpointstore-blob/samples/typescript/src/receiveEventsWithApiSpecificStorage.ts +++ b/sdk/eventhub/eventhubs-checkpointstore-blob/samples/typescript/src/receiveEventsWithApiSpecificStorage.ts @@ -35,7 +35,7 @@ const storageContainerUrl = const storageAccountName = process.env["STORAGE_ACCOUNT_NAME"] || ""; const storageAccountKey = process.env["STORAGE_ACCOUNT_KEY"] || ""; -async function main() { +export async function main() { // The `containerClient` will be used by our eventhubs-checkpointstore-blob, which // persists any checkpoints from this session in Azure Storage. const storageCredential = new StorageSharedKeyCredential(storageAccountName, storageAccountKey); diff --git a/sdk/tables/data-tables/samples/typescript/src/authenticationMethods.ts b/sdk/tables/data-tables/samples/typescript/src/authenticationMethods.ts index 438dbc3f55a6..b4162f832b18 100644 --- a/sdk/tables/data-tables/samples/typescript/src/authenticationMethods.ts +++ b/sdk/tables/data-tables/samples/typescript/src/authenticationMethods.ts @@ -1,10 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { - TableServiceClient, - TablesSharedKeyCredential, -} from "@azure/data-tables"; +import { TableServiceClient, TablesSharedKeyCredential } from "@azure/data-tables"; // Load the .env file if it exists import * as dotenv from "dotenv"; @@ -47,9 +44,7 @@ async function tableServiceClientWithSasToken() { * and it is not available for browsers */ async function tableServiceClientWithAccountConnectionString() { - const client = TableServiceClient.fromConnectionString( - accountConnectionString - ); + const client = TableServiceClient.fromConnectionString(accountConnectionString); countTablesWithClient(client); } @@ -74,7 +69,7 @@ async function countTablesWithClient(client: TableServiceClient) { console.log(`Listed ${count} tables`); } -async function main() { +export async function main() { console.log("== Client Authentication Methods Sample =="); await tableServiceClientWithSasConnectionString(); diff --git a/sdk/tables/data-tables/samples/typescript/src/createAndDeleteEntities.ts b/sdk/tables/data-tables/samples/typescript/src/createAndDeleteEntities.ts index 15838e0671e2..41f71415121f 100644 --- a/sdk/tables/data-tables/samples/typescript/src/createAndDeleteEntities.ts +++ b/sdk/tables/data-tables/samples/typescript/src/createAndDeleteEntities.ts @@ -44,7 +44,7 @@ interface Entity { quantity: number; } -async function main() { +export async function main() { await createAndDeleteEntities(); } diff --git a/sdk/tables/data-tables/samples/typescript/src/createAndDeleteTable.ts b/sdk/tables/data-tables/samples/typescript/src/createAndDeleteTable.ts index 530e53c58360..2c5eff8a403a 100644 --- a/sdk/tables/data-tables/samples/typescript/src/createAndDeleteTable.ts +++ b/sdk/tables/data-tables/samples/typescript/src/createAndDeleteTable.ts @@ -13,9 +13,7 @@ async function createAndDeleteTable() { console.log("== Delete and create table Sample =="); // See authenticationMethods sample for other options of creating a new client - const serviceClient = TableServiceClient.fromConnectionString( - sasConnectionString - ); + const serviceClient = TableServiceClient.fromConnectionString(sasConnectionString); // Create a new table const tableName = "SampleCreateAndDeleteTable"; @@ -32,10 +30,7 @@ async function createAndDeleteTableWithTableClient() { const tableName = "SampleCreateAndDeleteTable2"; // Creating a new table client doesn't do a network call - const client = TableClient.fromConnectionString( - sasConnectionString, - tableName - ); + const client = TableClient.fromConnectionString(sasConnectionString, tableName); // Will attempt to create a table with the tableName specified above await client.create(); @@ -44,7 +39,7 @@ async function createAndDeleteTableWithTableClient() { await client.delete(); } -async function main() { +export async function main() { await createAndDeleteTable(); await createAndDeleteTableWithTableClient(); } diff --git a/sdk/tables/data-tables/samples/typescript/src/queryEntities.ts b/sdk/tables/data-tables/samples/typescript/src/queryEntities.ts index 96a82f189927..16ecc2536590 100644 --- a/sdk/tables/data-tables/samples/typescript/src/queryEntities.ts +++ b/sdk/tables/data-tables/samples/typescript/src/queryEntities.ts @@ -68,7 +68,7 @@ interface Entity { quantity: number; } -async function main() { +export async function main() { await createAndDeleteEntities(); } diff --git a/sdk/tables/data-tables/samples/typescript/src/queryTables.ts b/sdk/tables/data-tables/samples/typescript/src/queryTables.ts index 9766b93769d9..30eae6e7ea35 100644 --- a/sdk/tables/data-tables/samples/typescript/src/queryTables.ts +++ b/sdk/tables/data-tables/samples/typescript/src/queryTables.ts @@ -13,9 +13,7 @@ async function queryTables() { console.log("== Query tables Sample =="); // See authenticationMethods sample for other options of creating a new client - const serviceClient = TableServiceClient.fromConnectionString( - accountConnectionString - ); + const serviceClient = TableServiceClient.fromConnectionString(accountConnectionString); // Create a new table const tableName = "OfficeSupplies3p1"; @@ -25,7 +23,7 @@ async function queryTables() { // odata is a helper function that takes care of encoding the query // filter, in this sample it will add quotes around tableName const queryTableResults = serviceClient.listTables({ - queryOptions: { filter: odata`TableName eq ${tableName}` }, + queryOptions: { filter: odata`TableName eq ${tableName}` } }); // Iterate the results @@ -37,7 +35,7 @@ async function queryTables() { await serviceClient.deleteTable(tableName); } -async function main() { +export async function main() { await queryTables(); } diff --git a/sdk/tables/data-tables/samples/typescript/src/updateAndUpsertEntities.ts b/sdk/tables/data-tables/samples/typescript/src/updateAndUpsertEntities.ts index 570a8a076b4d..d0995978eca6 100644 --- a/sdk/tables/data-tables/samples/typescript/src/updateAndUpsertEntities.ts +++ b/sdk/tables/data-tables/samples/typescript/src/updateAndUpsertEntities.ts @@ -57,7 +57,7 @@ interface Entity { brand?: string; } -async function main() { +export async function main() { await createAndDeleteEntities(); }