cosmos-db-writer-ssl-fixed-aad
Advanced tools
Comparing version
@@ -5,3 +5,4 @@ /** | ||
const {CosmosClient} = require("@azure/cosmos"); | ||
const cosmos = require("@azure/cosmos"); | ||
const CosmosClient = cosmos.CosmosClient; | ||
const config = require('../config/config'); | ||
@@ -11,14 +12,13 @@ const { DefaultAzureCredential } = require("@azure/identity"); | ||
var client = null; | ||
createClient = function () { | ||
createClient = function () { | ||
const endpoint = config.cosmosdb.endpoint; | ||
const key = config.cosmosdb.primaryKey; | ||
const aadCredentials = config.cosmosdb.aadCredentials | ||
const tokenProvider = config.cosmosdb.tokenProvider | ||
if (config.environment === 'local') { | ||
//const connectionPolicy = new cosmos.ConnectionPolicy(); | ||
//connectionPolicy.DisableSSLVerification = true; | ||
return new CosmosClient({endpoint,aadCredentials: new DefaultAzureCredential()}); | ||
return new CosmosClient({endpoint,aadCredentials: new DefaultAzureCredential()}); | ||
} | ||
else { | ||
return new CosmosClient({endpoint,aadCredentials: new DefaultAzureCredential()}) | ||
return new CosmosClient({endpoint,aadCredentials: new DefaultAzureCredential()}); | ||
} | ||
@@ -51,4 +51,4 @@ }; | ||
} | ||
const { result: items } = await client.database(config.cosmosdb.dbName).container(containerId).items.query(options.querySpec, { enableCrossPartitionQuery: true }).toArray(); | ||
return items; | ||
const response = await client.database(config.cosmosdb.dbName).container(containerId).items.query(options.querySpec, { enableCrossPartitionQuery: true }).fetchAll(); | ||
return Promise.resolve(response.resources); | ||
}; | ||
@@ -55,0 +55,0 @@ |
{ | ||
"bundleDependencies": false, | ||
"dependencies": { | ||
"@azure/identity": "^3.1.4", | ||
"@azure/cosmos": "3.17.3", | ||
"@azure/identity": "^3.1.4", | ||
"request-context": "2.0.0", | ||
"underscore": "1.13.6" | ||
}, | ||
"deprecated": false, | ||
"description": "This module is for performing CRUD operations into azure cosmos DB.", | ||
@@ -15,3 +17,3 @@ "devDependencies": {}, | ||
}, | ||
"version": "1.1.7" | ||
"version": "1.1.8" | ||
} |
20336
0.22%