mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-15 04:35:14 +00:00
* Add Sample Data to Resource Tree * Format * Fix strict build * Fix lint * Fixed implementation to show Sample data container * Udated logic based on TokenCollection * Re-configure copilot flag --------- Co-authored-by: Predrag Klepic <v-prklepic@microsoft.com>
27 lines
812 B
TypeScript
27 lines
812 B
TypeScript
import * as Cosmos from "@azure/cosmos";
|
|
import { userContext } from "UserContext";
|
|
|
|
let _sampleDataclient: Cosmos.CosmosClient;
|
|
|
|
export function sampleDataClient(): Cosmos.CosmosClient {
|
|
if (_sampleDataclient) {
|
|
return _sampleDataclient;
|
|
}
|
|
|
|
const sampleDataConnectionInfo = userContext.sampleDataConnectionInfo;
|
|
const options: Cosmos.CosmosClientOptions = {
|
|
endpoint: sampleDataConnectionInfo.accountEndpoint,
|
|
tokenProvider: async () => {
|
|
const sampleDataConnectionInfo = userContext.sampleDataConnectionInfo;
|
|
return Promise.resolve(sampleDataConnectionInfo.resourceToken);
|
|
},
|
|
connectionPolicy: {
|
|
enableEndpointDiscovery: false,
|
|
},
|
|
userAgentSuffix: "Azure Portal",
|
|
};
|
|
|
|
_sampleDataclient = new Cosmos.CosmosClient(options);
|
|
return _sampleDataclient;
|
|
}
|