dependabot part 1

This commit is contained in:
Asier Isayas
2026-01-28 12:14:33 -08:00
parent a255dd502b
commit e8f869522e
8 changed files with 2165 additions and 5235 deletions

View File

@@ -1,9 +1,7 @@
import crypto from "crypto";
import { CosmosDBManagementClient } from "@azure/arm-cosmosdb";
import { BulkOperationType, Container, CosmosClient, CosmosClientOptions, Database, JSONObject } from "@azure/cosmos";
import { AzureIdentityCredentialAdapter } from "@azure/ms-rest-js";
import { Buffer } from "node:buffer";
import { webcrypto } from "node:crypto";
import {
generateUniqueName,
getAccountName,
@@ -12,6 +10,7 @@ import {
subscriptionId,
TestAccount,
} from "./fx";
globalThis.crypto = webcrypto as Crypto;
export interface TestItem {
id: string;
@@ -60,8 +59,9 @@ function createTestItems(): TestItem[] {
// Document IDs cannot contain '/', '\', or '#'
function createSafeRandomString(byteLength: number): string {
return crypto
.randomBytes(byteLength)
const bytes = new Uint8Array(byteLength);
crypto.getRandomValues(bytes);
return Buffer.from(bytes)
.toString("base64")
.replace(/[/\\#]/g, "_");
}
@@ -104,8 +104,7 @@ async function createCosmosClientForSQLAccount(
accountType: TestAccount.SQL | TestAccount.SQLContainerCopyOnly = TestAccount.SQL,
): Promise<{ armClient: CosmosDBManagementClient; client: CosmosClient }> {
const credentials = getAzureCLICredentials();
const adaptedCredentials = new AzureIdentityCredentialAdapter(credentials);
const armClient = new CosmosDBManagementClient(adaptedCredentials, subscriptionId);
const armClient = new CosmosDBManagementClient(credentials, subscriptionId);
const accountName = getAccountName(accountType);
const account = await armClient.databaseAccounts.get(resourceGroupName, accountName);
@@ -232,7 +231,7 @@ export async function createTestSQLContainer({
}
export const setPartitionKeys = (partitionKeys: PartitionKey[]) => {
const result = {};
const result: Record<string, unknown> = {};
partitionKeys.forEach((partitionKey) => {
const { key: keyPath, value: keyValue } = partitionKey;
@@ -245,7 +244,7 @@ export const setPartitionKeys = (partitionKeys: PartitionKey[]) => {
current[key] = keyValue;
} else {
current[key] = current[key] || {};
current = current[key];
current = current[key] as Record<string, unknown>;
}
});
});