mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 08:51:24 +00:00
Update prettier to latest. Remove tslint (#1641)
* Rev up prettier * Reformat * Remove deprecated tslint * Remove call to tslint and update package-lock.json
This commit is contained in:
@@ -6,10 +6,10 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
|
||||
export const bulkCreateDocument = async (
|
||||
collection: CollectionBase,
|
||||
documents: JSONObject[]
|
||||
documents: JSONObject[],
|
||||
): Promise<OperationResponse[]> => {
|
||||
const clearMessage = logConsoleProgress(
|
||||
`Executing ${documents.length} bulk operations for container ${collection.id()}`
|
||||
`Executing ${documents.length} bulk operations for container ${collection.id()}`,
|
||||
);
|
||||
|
||||
try {
|
||||
@@ -18,7 +18,7 @@ export const bulkCreateDocument = async (
|
||||
.container(collection.id())
|
||||
.items.bulk(
|
||||
documents.map((doc) => ({ operationType: "Create", resourceBody: doc })),
|
||||
{ continueOnError: true }
|
||||
{ continueOnError: true },
|
||||
);
|
||||
|
||||
const successCount = response.filter((r) => r.statusCode === 201).length;
|
||||
@@ -27,7 +27,7 @@ export const bulkCreateDocument = async (
|
||||
logConsoleInfo(
|
||||
`${
|
||||
documents.length
|
||||
} operations completed for container ${collection.id()}. ${successCount} operations succeeded. ${throttledCount} operations throttled`
|
||||
} operations completed for container ${collection.id()}. ${successCount} operations succeeded. ${throttledCount} operations throttled`,
|
||||
);
|
||||
return response;
|
||||
} catch (error) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import { createDatabase } from "./createDatabase";
|
||||
|
||||
export const createCollection = async (params: DataModels.CreateCollectionParams): Promise<DataModels.Collection> => {
|
||||
const clearMessage = logConsoleProgress(
|
||||
`Creating a new container ${params.collectionId} for database ${params.databaseId}`
|
||||
`Creating a new container ${params.collectionId} for database ${params.databaseId}`,
|
||||
);
|
||||
try {
|
||||
let collection: DataModels.Collection;
|
||||
@@ -57,7 +57,7 @@ const createCollectionWithARM = async (params: DataModels.CreateCollectionParams
|
||||
if (!isValid) {
|
||||
const collectionName = getCollectionName().toLocaleLowerCase();
|
||||
throw new Error(
|
||||
`Create ${collectionName} failed: ${collectionName} with id ${params.collectionId} already exists`
|
||||
`Create ${collectionName} failed: ${collectionName} with id ${params.collectionId} already exists`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ const createSqlContainer = async (params: DataModels.CreateCollectionParams): Pr
|
||||
userContext.databaseAccount.name,
|
||||
params.databaseId,
|
||||
params.collectionId,
|
||||
rpPayload
|
||||
rpPayload,
|
||||
);
|
||||
return createResponse && (createResponse.properties.resource as DataModels.Collection);
|
||||
};
|
||||
@@ -145,7 +145,7 @@ const createMongoCollection = async (params: DataModels.CreateCollectionParams):
|
||||
userContext.databaseAccount.name,
|
||||
params.databaseId,
|
||||
params.collectionId,
|
||||
rpPayload
|
||||
rpPayload,
|
||||
);
|
||||
|
||||
if (params.createMongoWildcardIndex) {
|
||||
@@ -179,7 +179,7 @@ const createCassandraTable = async (params: DataModels.CreateCollectionParams):
|
||||
userContext.databaseAccount.name,
|
||||
params.databaseId,
|
||||
params.collectionId,
|
||||
rpPayload
|
||||
rpPayload,
|
||||
);
|
||||
return createResponse && (createResponse.properties.resource as DataModels.Collection);
|
||||
};
|
||||
@@ -213,7 +213,7 @@ const createGraph = async (params: DataModels.CreateCollectionParams): Promise<D
|
||||
userContext.databaseAccount.name,
|
||||
params.databaseId,
|
||||
params.collectionId,
|
||||
rpPayload
|
||||
rpPayload,
|
||||
);
|
||||
return createResponse && (createResponse.properties.resource as DataModels.Collection);
|
||||
};
|
||||
@@ -236,7 +236,7 @@ const createTable = async (params: DataModels.CreateCollectionParams): Promise<D
|
||||
userContext.resourceGroup,
|
||||
userContext.databaseAccount.name,
|
||||
params.collectionId,
|
||||
rpPayload
|
||||
rpPayload,
|
||||
);
|
||||
return createResponse && (createResponse.properties.resource as DataModels.Collection);
|
||||
};
|
||||
@@ -287,7 +287,7 @@ const createCollectionWithSDK = async (params: DataModels.CreateCollectionParams
|
||||
const databaseResponse: DatabaseResponse = await client().databases.createIfNotExists(createDatabaseBody);
|
||||
const collectionResponse: ContainerResponse = await databaseResponse?.database.containers.create(
|
||||
createCollectionBody,
|
||||
collectionOptions
|
||||
collectionOptions,
|
||||
);
|
||||
return collectionResponse?.resource as DataModels.Collection;
|
||||
};
|
||||
|
||||
@@ -77,7 +77,7 @@ async function createSqlDatabase(params: DataModels.CreateDatabaseParams): Promi
|
||||
userContext.resourceGroup,
|
||||
userContext.databaseAccount.name,
|
||||
params.databaseId,
|
||||
rpPayload
|
||||
rpPayload,
|
||||
);
|
||||
return createResponse && (createResponse.properties.resource as DataModels.Database);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ async function createMongoDatabase(params: DataModels.CreateDatabaseParams): Pro
|
||||
userContext.resourceGroup,
|
||||
userContext.databaseAccount.name,
|
||||
params.databaseId,
|
||||
rpPayload
|
||||
rpPayload,
|
||||
);
|
||||
return createResponse && (createResponse.properties.resource as DataModels.Database);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ async function createCassandraKeyspace(params: DataModels.CreateDatabaseParams):
|
||||
userContext.resourceGroup,
|
||||
userContext.databaseAccount.name,
|
||||
params.databaseId,
|
||||
rpPayload
|
||||
rpPayload,
|
||||
);
|
||||
return createResponse && (createResponse.properties.resource as DataModels.Database);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ async function createGremlineDatabase(params: DataModels.CreateDatabaseParams):
|
||||
userContext.resourceGroup,
|
||||
userContext.databaseAccount.name,
|
||||
params.databaseId,
|
||||
rpPayload
|
||||
rpPayload,
|
||||
);
|
||||
return createResponse && (createResponse.properties.resource as DataModels.Database);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
export async function createStoredProcedure(
|
||||
databaseId: string,
|
||||
collectionId: string,
|
||||
storedProcedure: StoredProcedureDefinition
|
||||
storedProcedure: StoredProcedureDefinition,
|
||||
): Promise<StoredProcedureDefinition & Resource> {
|
||||
const clearMessage = logConsoleProgress(`Creating stored procedure ${storedProcedure.id}`);
|
||||
try {
|
||||
@@ -32,11 +32,11 @@ export async function createStoredProcedure(
|
||||
userContext.databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId,
|
||||
storedProcedure.id
|
||||
storedProcedure.id,
|
||||
);
|
||||
if (getResponse?.properties?.resource) {
|
||||
throw new Error(
|
||||
`Create stored procedure failed: stored procedure with id ${storedProcedure.id} already exists`
|
||||
`Create stored procedure failed: stored procedure with id ${storedProcedure.id} already exists`,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -58,7 +58,7 @@ export async function createStoredProcedure(
|
||||
databaseId,
|
||||
collectionId,
|
||||
storedProcedure.id,
|
||||
createSprocParams
|
||||
createSprocParams,
|
||||
);
|
||||
return rpResponse && (rpResponse.properties?.resource as StoredProcedureDefinition & Resource);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
export async function createTrigger(
|
||||
databaseId: string,
|
||||
collectionId: string,
|
||||
trigger: SqlTriggerResource
|
||||
trigger: SqlTriggerResource,
|
||||
): Promise<TriggerDefinition | SqlTriggerResource> {
|
||||
const clearMessage = logConsoleProgress(`Creating trigger ${trigger.id}`);
|
||||
try {
|
||||
@@ -26,7 +26,7 @@ export async function createTrigger(
|
||||
userContext.databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId,
|
||||
trigger.id
|
||||
trigger.id,
|
||||
);
|
||||
if (getResponse?.properties?.resource) {
|
||||
throw new Error(`Create trigger failed: ${trigger.id} already exists`);
|
||||
@@ -50,7 +50,7 @@ export async function createTrigger(
|
||||
databaseId,
|
||||
collectionId,
|
||||
trigger.id,
|
||||
createTriggerParams
|
||||
createTriggerParams,
|
||||
);
|
||||
return rpResponse && rpResponse.properties?.resource;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ export async function createTrigger(
|
||||
const response = await client()
|
||||
.database(databaseId)
|
||||
.container(collectionId)
|
||||
.scripts.triggers.create((trigger as unknown) as TriggerDefinition); // TODO: TypeScript does not like the SQL SDK trigger type
|
||||
.scripts.triggers.create(trigger as unknown as TriggerDefinition); // TODO: TypeScript does not like the SQL SDK trigger type
|
||||
return response.resource;
|
||||
} catch (error) {
|
||||
handleError(error, "CreateTrigger", `Error while creating trigger ${trigger.id}`);
|
||||
|
||||
@@ -16,7 +16,7 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
export async function createUserDefinedFunction(
|
||||
databaseId: string,
|
||||
collectionId: string,
|
||||
userDefinedFunction: UserDefinedFunctionDefinition
|
||||
userDefinedFunction: UserDefinedFunctionDefinition,
|
||||
): Promise<UserDefinedFunctionDefinition & Resource> {
|
||||
const clearMessage = logConsoleProgress(`Creating user defined function ${userDefinedFunction.id}`);
|
||||
try {
|
||||
@@ -32,11 +32,11 @@ export async function createUserDefinedFunction(
|
||||
userContext.databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId,
|
||||
userDefinedFunction.id
|
||||
userDefinedFunction.id,
|
||||
);
|
||||
if (getResponse?.properties?.resource) {
|
||||
throw new Error(
|
||||
`Create user defined function failed: user defined function with id ${userDefinedFunction.id} already exists`
|
||||
`Create user defined function failed: user defined function with id ${userDefinedFunction.id} already exists`,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -58,7 +58,7 @@ export async function createUserDefinedFunction(
|
||||
databaseId,
|
||||
collectionId,
|
||||
userDefinedFunction.id,
|
||||
createUDFParams
|
||||
createUDFParams,
|
||||
);
|
||||
return rpResponse && (rpResponse.properties?.resource as UserDefinedFunctionDefinition & Resource);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ export async function createUserDefinedFunction(
|
||||
handleError(
|
||||
error,
|
||||
"CreateUserupdateUserDefinedFunction",
|
||||
`Error while creating user defined function ${userDefinedFunction.id}`
|
||||
`Error while creating user defined function ${userDefinedFunction.id}`,
|
||||
);
|
||||
throw error;
|
||||
} finally {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
export async function deleteStoredProcedure(
|
||||
databaseId: string,
|
||||
collectionId: string,
|
||||
storedProcedureId: string
|
||||
storedProcedureId: string,
|
||||
): Promise<void> {
|
||||
const clearMessage = logConsoleProgress(`Deleting stored procedure ${storedProcedureId}`);
|
||||
try {
|
||||
@@ -23,7 +23,7 @@ export async function deleteStoredProcedure(
|
||||
userContext.databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId,
|
||||
storedProcedureId
|
||||
storedProcedureId,
|
||||
);
|
||||
} else {
|
||||
await client().database(databaseId).container(collectionId).scripts.storedProcedure(storedProcedureId).delete();
|
||||
|
||||
@@ -19,7 +19,7 @@ export async function deleteTrigger(databaseId: string, collectionId: string, tr
|
||||
userContext.databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId,
|
||||
triggerId
|
||||
triggerId,
|
||||
);
|
||||
} else {
|
||||
await client().database(databaseId).container(collectionId).scripts.trigger(triggerId).delete();
|
||||
|
||||
@@ -19,7 +19,7 @@ export async function deleteUserDefinedFunction(databaseId: string, collectionId
|
||||
userContext.databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId,
|
||||
id
|
||||
id,
|
||||
);
|
||||
} else {
|
||||
await client().database(databaseId).container(collectionId).scripts.userDefinedFunction(id).delete();
|
||||
|
||||
@@ -14,7 +14,7 @@ export const executeStoredProcedure = async (
|
||||
collection: Collection,
|
||||
storedProcedure: StoredProcedure,
|
||||
partitionKeyValue: string,
|
||||
params: string[]
|
||||
params: string[],
|
||||
): Promise<ExecuteSprocResult> => {
|
||||
const clearMessage = logConsoleProgress(`Executing stored procedure ${storedProcedure.id()}`);
|
||||
const timeout = setTimeout(() => {
|
||||
@@ -29,7 +29,7 @@ export const executeStoredProcedure = async (
|
||||
.execute(partitionKeyValue, params, { enableScriptLogging: true });
|
||||
clearTimeout(timeout);
|
||||
logConsoleInfo(
|
||||
`Finished executing stored procedure ${storedProcedure.id()} for container ${storedProcedure.collection.id()}`
|
||||
`Finished executing stored procedure ${storedProcedure.id()} for container ${storedProcedure.collection.id()}`,
|
||||
);
|
||||
return {
|
||||
result: response.resource,
|
||||
@@ -39,7 +39,7 @@ export const executeStoredProcedure = async (
|
||||
handleError(
|
||||
error,
|
||||
"ExecuteStoredProcedure",
|
||||
`Failed to execute stored procedure ${storedProcedure.id()} for container ${storedProcedure.collection.id()}`
|
||||
`Failed to execute stored procedure ${storedProcedure.id()} for container ${storedProcedure.collection.id()}`,
|
||||
);
|
||||
throw error;
|
||||
} finally {
|
||||
|
||||
@@ -15,7 +15,7 @@ export async function getIndexTransformationProgress(databaseId: string, collect
|
||||
const response = await client().database(databaseId).container(collectionId).read({ populateQuotaInfo: true });
|
||||
|
||||
indexTransformationPercentage = parseInt(
|
||||
response.headers[Constants.HttpHeaders.collectionIndexTransformationProgress] as string
|
||||
response.headers[Constants.HttpHeaders.collectionIndexTransformationProgress] as string,
|
||||
);
|
||||
} catch (error) {
|
||||
handleError(error, "ReadMongoDBCollection", `Error while reading container ${collectionId}`);
|
||||
|
||||
@@ -5,7 +5,7 @@ export const queryConflicts = (
|
||||
databaseId: string,
|
||||
containerId: string,
|
||||
query: string,
|
||||
options: FeedOptions
|
||||
options: FeedOptions,
|
||||
): QueryIterator<ConflictDefinition & Resource> => {
|
||||
return client().database(databaseId).container(containerId).conflicts.query(query, options);
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ export const queryDocuments = (
|
||||
databaseId: string,
|
||||
containerId: string,
|
||||
query: string,
|
||||
options: FeedOptions
|
||||
options: FeedOptions,
|
||||
): QueryIterator<ItemDefinition & Resource> => {
|
||||
options = getCommonQueryOptions(options);
|
||||
return client().database(databaseId).container(containerId).items.query(query, options);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { MinimalQueryIterator, nextPage } from "../IteratorUtilities";
|
||||
export const queryDocumentsPage = async (
|
||||
resourceName: string,
|
||||
documentsIterator: MinimalQueryIterator,
|
||||
firstItemIndex: number
|
||||
firstItemIndex: number,
|
||||
): Promise<QueryResults> => {
|
||||
const entityName = getEntityName();
|
||||
const clearMessage = logConsoleProgress(`Querying ${entityName} for container ${resourceName}`);
|
||||
|
||||
@@ -28,7 +28,7 @@ export async function readSampleCollection(): Promise<DataModels.Collection> {
|
||||
export async function readCollectionInternal(
|
||||
cosmosClient: CosmosClient,
|
||||
databaseId: string,
|
||||
collectionId: string
|
||||
collectionId: string,
|
||||
): Promise<DataModels.Collection> {
|
||||
let collection: DataModels.Collection;
|
||||
const clearMessage = logConsoleProgress(`Querying container ${collectionId}`);
|
||||
|
||||
@@ -44,7 +44,7 @@ const readCollectionOfferWithARM = async (databaseId: string, collectionId: stri
|
||||
resourceGroup,
|
||||
accountName,
|
||||
databaseId,
|
||||
collectionId
|
||||
collectionId,
|
||||
);
|
||||
break;
|
||||
case "Mongo":
|
||||
@@ -53,7 +53,7 @@ const readCollectionOfferWithARM = async (databaseId: string, collectionId: stri
|
||||
resourceGroup,
|
||||
accountName,
|
||||
databaseId,
|
||||
collectionId
|
||||
collectionId,
|
||||
);
|
||||
break;
|
||||
case "Cassandra":
|
||||
@@ -62,7 +62,7 @@ const readCollectionOfferWithARM = async (databaseId: string, collectionId: stri
|
||||
resourceGroup,
|
||||
accountName,
|
||||
databaseId,
|
||||
collectionId
|
||||
collectionId,
|
||||
);
|
||||
break;
|
||||
case "Gremlin":
|
||||
@@ -71,7 +71,7 @@ const readCollectionOfferWithARM = async (databaseId: string, collectionId: stri
|
||||
resourceGroup,
|
||||
accountName,
|
||||
databaseId,
|
||||
collectionId
|
||||
collectionId,
|
||||
);
|
||||
break;
|
||||
case "Tables":
|
||||
|
||||
@@ -34,7 +34,7 @@ export async function readCollections(databaseId: string): Promise<DataModels.Co
|
||||
|
||||
export async function readCollectionsWithPagination(
|
||||
databaseId: string,
|
||||
continuationToken?: string
|
||||
continuationToken?: string,
|
||||
): Promise<DataModels.CollectionsWithPagination> {
|
||||
const clearMessage = logConsoleProgress(`Querying containers for database ${databaseId}`);
|
||||
try {
|
||||
@@ -45,7 +45,7 @@ export async function readCollectionsWithPagination(
|
||||
{
|
||||
continuationToken,
|
||||
maxItemCount: Queries.containersPerPage,
|
||||
}
|
||||
},
|
||||
)
|
||||
.fetchNext();
|
||||
const collectionsWithPagination: DataModels.CollectionsWithPagination = {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
|
||||
export async function readMongoDBCollectionThroughRP(
|
||||
databaseId: string,
|
||||
collectionId: string
|
||||
collectionId: string,
|
||||
): Promise<MongoDBCollectionResource> {
|
||||
if (userContext.authType !== AuthType.AAD) {
|
||||
return undefined;
|
||||
|
||||
@@ -9,7 +9,7 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
|
||||
export async function readStoredProcedures(
|
||||
databaseId: string,
|
||||
collectionId: string
|
||||
collectionId: string,
|
||||
): Promise<(StoredProcedureDefinition & Resource)[]> {
|
||||
const clearMessage = logConsoleProgress(`Querying stored procedures for container ${collectionId}`);
|
||||
try {
|
||||
@@ -23,7 +23,7 @@ export async function readStoredProcedures(
|
||||
userContext.resourceGroup,
|
||||
userContext.databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId
|
||||
collectionId,
|
||||
);
|
||||
const listResult = rpResponse as SqlStoredProcedureListResult;
|
||||
if (listResult) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
|
||||
export async function readTriggers(
|
||||
databaseId: string,
|
||||
collectionId: string
|
||||
collectionId: string,
|
||||
): Promise<SqlTriggerResource[] | TriggerDefinition[]> {
|
||||
const clearMessage = logConsoleProgress(`Querying triggers for container ${collectionId}`);
|
||||
try {
|
||||
@@ -23,7 +23,7 @@ export async function readTriggers(
|
||||
userContext.resourceGroup,
|
||||
userContext.databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId
|
||||
collectionId,
|
||||
);
|
||||
return rpResponse?.value?.map((trigger) => trigger.properties?.resource);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
|
||||
export async function readUserDefinedFunctions(
|
||||
databaseId: string,
|
||||
collectionId: string
|
||||
collectionId: string,
|
||||
): Promise<(UserDefinedFunctionDefinition & Resource)[]> {
|
||||
const clearMessage = logConsoleProgress(`Querying user defined functions for container ${collectionId}`);
|
||||
const { authType, apiType, subscriptionId, resourceGroup, databaseAccount } = userContext;
|
||||
@@ -19,7 +19,7 @@ export async function readUserDefinedFunctions(
|
||||
resourceGroup,
|
||||
databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId
|
||||
collectionId,
|
||||
);
|
||||
return rpResponse?.value?.map((udf) => udf.properties?.resource as UserDefinedFunctionDefinition & Resource);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ export async function readUserDefinedFunctions(
|
||||
handleError(
|
||||
error,
|
||||
"ReadUserDefinedFunctions",
|
||||
`Failed to query user defined functions for container ${collectionId}`
|
||||
`Failed to query user defined functions for container ${collectionId}`,
|
||||
);
|
||||
throw error;
|
||||
} finally {
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function updateCollection(
|
||||
databaseId: string,
|
||||
collectionId: string,
|
||||
newCollection: Partial<Collection>,
|
||||
options: RequestOptions = {}
|
||||
options: RequestOptions = {},
|
||||
): Promise<Collection> {
|
||||
let collection: Collection;
|
||||
const clearMessage = logConsoleProgress(`Updating container ${collectionId}`);
|
||||
@@ -61,7 +61,7 @@ export async function updateCollection(
|
||||
async function updateCollectionWithARM(
|
||||
databaseId: string,
|
||||
collectionId: string,
|
||||
newCollection: Partial<Collection>
|
||||
newCollection: Partial<Collection>,
|
||||
): Promise<Collection> {
|
||||
const { subscriptionId, resourceGroup, apiType, databaseAccount } = userContext;
|
||||
const accountName = databaseAccount.name;
|
||||
@@ -82,7 +82,7 @@ async function updateCollectionWithARM(
|
||||
subscriptionId,
|
||||
resourceGroup,
|
||||
accountName,
|
||||
newCollection
|
||||
newCollection,
|
||||
);
|
||||
default:
|
||||
throw new Error(`Unsupported default experience type: ${apiType}`);
|
||||
@@ -95,7 +95,7 @@ async function updateSqlContainer(
|
||||
subscriptionId: string,
|
||||
resourceGroup: string,
|
||||
accountName: string,
|
||||
newCollection: Partial<Collection>
|
||||
newCollection: Partial<Collection>,
|
||||
): Promise<Collection> {
|
||||
const getResponse = await getSqlContainer(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
||||
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
||||
@@ -106,7 +106,7 @@ async function updateSqlContainer(
|
||||
accountName,
|
||||
databaseId,
|
||||
collectionId,
|
||||
getResponse as SqlContainerCreateUpdateParameters
|
||||
getResponse as SqlContainerCreateUpdateParameters,
|
||||
);
|
||||
return updateResponse && (updateResponse.properties.resource as Collection);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ export async function updateMongoDBCollection(
|
||||
subscriptionId: string,
|
||||
resourceGroup: string,
|
||||
accountName: string,
|
||||
newCollection: Partial<Collection>
|
||||
newCollection: Partial<Collection>,
|
||||
): Promise<Collection> {
|
||||
const getResponse = await getMongoDBCollection(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
||||
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
||||
@@ -131,13 +131,13 @@ export async function updateMongoDBCollection(
|
||||
accountName,
|
||||
databaseId,
|
||||
collectionId,
|
||||
getResponse as MongoDBCollectionCreateUpdateParameters
|
||||
getResponse as MongoDBCollectionCreateUpdateParameters,
|
||||
);
|
||||
return updateResponse && (updateResponse.properties.resource as Collection);
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`MongoDB collection to update does not exist. Database id: ${databaseId} Collection id: ${collectionId}`
|
||||
`MongoDB collection to update does not exist. Database id: ${databaseId} Collection id: ${collectionId}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ async function updateCassandraTable(
|
||||
subscriptionId: string,
|
||||
resourceGroup: string,
|
||||
accountName: string,
|
||||
newCollection: Partial<Collection>
|
||||
newCollection: Partial<Collection>,
|
||||
): Promise<Collection> {
|
||||
const getResponse = await getCassandraTable(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
||||
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
||||
@@ -158,13 +158,13 @@ async function updateCassandraTable(
|
||||
accountName,
|
||||
databaseId,
|
||||
collectionId,
|
||||
getResponse as SqlContainerCreateUpdateParameters
|
||||
getResponse as SqlContainerCreateUpdateParameters,
|
||||
);
|
||||
return updateResponse && (updateResponse.properties.resource as Collection);
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Cassandra table to update does not exist. Database id: ${databaseId} Collection id: ${collectionId}`
|
||||
`Cassandra table to update does not exist. Database id: ${databaseId} Collection id: ${collectionId}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ async function updateGremlinGraph(
|
||||
subscriptionId: string,
|
||||
resourceGroup: string,
|
||||
accountName: string,
|
||||
newCollection: Partial<Collection>
|
||||
newCollection: Partial<Collection>,
|
||||
): Promise<Collection> {
|
||||
const getResponse = await getGremlinGraph(subscriptionId, resourceGroup, accountName, databaseId, collectionId);
|
||||
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
||||
@@ -185,7 +185,7 @@ async function updateGremlinGraph(
|
||||
accountName,
|
||||
databaseId,
|
||||
collectionId,
|
||||
getResponse as SqlContainerCreateUpdateParameters
|
||||
getResponse as SqlContainerCreateUpdateParameters,
|
||||
);
|
||||
return updateResponse && (updateResponse.properties.resource as Collection);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ async function updateTable(
|
||||
subscriptionId: string,
|
||||
resourceGroup: string,
|
||||
accountName: string,
|
||||
newCollection: Partial<Collection>
|
||||
newCollection: Partial<Collection>,
|
||||
): Promise<Collection> {
|
||||
const getResponse = await getTable(subscriptionId, resourceGroup, accountName, collectionId);
|
||||
if (getResponse && getResponse.properties && getResponse.properties.resource) {
|
||||
@@ -208,7 +208,7 @@ async function updateTable(
|
||||
resourceGroup,
|
||||
accountName,
|
||||
collectionId,
|
||||
getResponse as SqlContainerCreateUpdateParameters
|
||||
getResponse as SqlContainerCreateUpdateParameters,
|
||||
);
|
||||
return updateResponse && (updateResponse.properties.resource as Collection);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import { getPartitionKeyValue } from "./getPartitionKeyValue";
|
||||
export const updateDocument = async (
|
||||
collection: CollectionBase,
|
||||
documentId: DocumentId,
|
||||
newDocument: Item
|
||||
newDocument: Item,
|
||||
): Promise<Item> => {
|
||||
const entityName = getEntityName();
|
||||
const clearMessage = logConsoleProgress(`Updating ${entityName} ${documentId.id()}`);
|
||||
|
||||
@@ -152,7 +152,7 @@ const updateSqlContainerOffer = async (params: UpdateOfferParams): Promise<void>
|
||||
resourceGroup,
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId
|
||||
params.collectionId,
|
||||
);
|
||||
} else if (params.migrateToManual) {
|
||||
await migrateSqlContainerToManualThroughput(
|
||||
@@ -160,7 +160,7 @@ const updateSqlContainerOffer = async (params: UpdateOfferParams): Promise<void>
|
||||
resourceGroup,
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId
|
||||
params.collectionId,
|
||||
);
|
||||
} else {
|
||||
const body: ThroughputSettingsUpdateParameters = createUpdateOfferBody(params);
|
||||
@@ -170,7 +170,7 @@ const updateSqlContainerOffer = async (params: UpdateOfferParams): Promise<void>
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId,
|
||||
body
|
||||
body,
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -185,7 +185,7 @@ const updateMongoCollectionOffer = async (params: UpdateOfferParams): Promise<vo
|
||||
resourceGroup,
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId
|
||||
params.collectionId,
|
||||
);
|
||||
} else if (params.migrateToManual) {
|
||||
await migrateMongoDBCollectionToManualThroughput(
|
||||
@@ -193,7 +193,7 @@ const updateMongoCollectionOffer = async (params: UpdateOfferParams): Promise<vo
|
||||
resourceGroup,
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId
|
||||
params.collectionId,
|
||||
);
|
||||
} else {
|
||||
const body: ThroughputSettingsUpdateParameters = createUpdateOfferBody(params);
|
||||
@@ -203,7 +203,7 @@ const updateMongoCollectionOffer = async (params: UpdateOfferParams): Promise<vo
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId,
|
||||
body
|
||||
body,
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -218,7 +218,7 @@ const updateCassandraTableOffer = async (params: UpdateOfferParams): Promise<voi
|
||||
resourceGroup,
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId
|
||||
params.collectionId,
|
||||
);
|
||||
} else if (params.migrateToManual) {
|
||||
await migrateCassandraTableToManualThroughput(
|
||||
@@ -226,7 +226,7 @@ const updateCassandraTableOffer = async (params: UpdateOfferParams): Promise<voi
|
||||
resourceGroup,
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId
|
||||
params.collectionId,
|
||||
);
|
||||
} else {
|
||||
const body: ThroughputSettingsUpdateParameters = createUpdateOfferBody(params);
|
||||
@@ -236,7 +236,7 @@ const updateCassandraTableOffer = async (params: UpdateOfferParams): Promise<voi
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId,
|
||||
body
|
||||
body,
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -251,7 +251,7 @@ const updateGremlinGraphOffer = async (params: UpdateOfferParams): Promise<void>
|
||||
resourceGroup,
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId
|
||||
params.collectionId,
|
||||
);
|
||||
} else if (params.migrateToManual) {
|
||||
await migrateGremlinGraphToManualThroughput(
|
||||
@@ -259,7 +259,7 @@ const updateGremlinGraphOffer = async (params: UpdateOfferParams): Promise<void>
|
||||
resourceGroup,
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId
|
||||
params.collectionId,
|
||||
);
|
||||
} else {
|
||||
const body: ThroughputSettingsUpdateParameters = createUpdateOfferBody(params);
|
||||
@@ -269,7 +269,7 @@ const updateGremlinGraphOffer = async (params: UpdateOfferParams): Promise<void>
|
||||
accountName,
|
||||
params.databaseId,
|
||||
params.collectionId,
|
||||
body
|
||||
body,
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -404,7 +404,7 @@ const updateOfferWithSDK = async (params: UpdateOfferParams): Promise<Offer> =>
|
||||
const sdkResponse = await client()
|
||||
.offer(params.currentOffer.id)
|
||||
// TODO Remove casting when SDK types are fixed (https://github.com/Azure/azure-sdk-for-js/issues/10660)
|
||||
.replace((newOffer as unknown) as OfferDefinition, options);
|
||||
.replace(newOffer as unknown as OfferDefinition, options);
|
||||
|
||||
return parseSDKOfferResponse(sdkResponse);
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
export async function updateStoredProcedure(
|
||||
databaseId: string,
|
||||
collectionId: string,
|
||||
storedProcedure: StoredProcedureDefinition
|
||||
storedProcedure: StoredProcedureDefinition,
|
||||
): Promise<StoredProcedureDefinition & Resource> {
|
||||
const clearMessage = logConsoleProgress(`Updating stored procedure ${storedProcedure.id}`);
|
||||
try {
|
||||
@@ -29,7 +29,7 @@ export async function updateStoredProcedure(
|
||||
databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId,
|
||||
storedProcedure.id
|
||||
storedProcedure.id,
|
||||
);
|
||||
|
||||
if (getResponse?.properties?.resource) {
|
||||
@@ -46,7 +46,7 @@ export async function updateStoredProcedure(
|
||||
databaseId,
|
||||
collectionId,
|
||||
storedProcedure.id,
|
||||
createSprocParams
|
||||
createSprocParams,
|
||||
);
|
||||
return rpResponse && (rpResponse.properties?.resource as StoredProcedureDefinition & Resource);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
export async function updateTrigger(
|
||||
databaseId: string,
|
||||
collectionId: string,
|
||||
trigger: SqlTriggerResource
|
||||
trigger: SqlTriggerResource,
|
||||
): Promise<SqlTriggerResource | TriggerDefinition> {
|
||||
const clearMessage = logConsoleProgress(`Updating trigger ${trigger.id}`);
|
||||
const { authType, apiType, subscriptionId, resourceGroup, databaseAccount } = userContext;
|
||||
@@ -22,7 +22,7 @@ export async function updateTrigger(
|
||||
databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId,
|
||||
trigger.id
|
||||
trigger.id,
|
||||
);
|
||||
|
||||
if (getResponse?.properties?.resource) {
|
||||
@@ -39,7 +39,7 @@ export async function updateTrigger(
|
||||
databaseId,
|
||||
collectionId,
|
||||
trigger.id,
|
||||
createTriggerParams
|
||||
createTriggerParams,
|
||||
);
|
||||
return rpResponse && rpResponse.properties?.resource;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export async function updateTrigger(
|
||||
.database(databaseId)
|
||||
.container(collectionId)
|
||||
.scripts.trigger(trigger.id)
|
||||
.replace((trigger as unknown) as TriggerDefinition); // TODO: TypeScript does not like the SQL SDK trigger type
|
||||
.replace(trigger as unknown as TriggerDefinition); // TODO: TypeScript does not like the SQL SDK trigger type
|
||||
return response?.resource;
|
||||
} catch (error) {
|
||||
handleError(error, "UpdateTrigger", `Error while updating trigger ${trigger.id}`);
|
||||
|
||||
@@ -16,7 +16,7 @@ import { handleError } from "../ErrorHandlingUtils";
|
||||
export async function updateUserDefinedFunction(
|
||||
databaseId: string,
|
||||
collectionId: string,
|
||||
userDefinedFunction: UserDefinedFunctionDefinition
|
||||
userDefinedFunction: UserDefinedFunctionDefinition,
|
||||
): Promise<UserDefinedFunctionDefinition & Resource> {
|
||||
const clearMessage = logConsoleProgress(`Updating user defined function ${userDefinedFunction.id}`);
|
||||
const { authType, apiType, subscriptionId, resourceGroup, databaseAccount } = userContext;
|
||||
@@ -28,7 +28,7 @@ export async function updateUserDefinedFunction(
|
||||
databaseAccount.name,
|
||||
databaseId,
|
||||
collectionId,
|
||||
userDefinedFunction.id
|
||||
userDefinedFunction.id,
|
||||
);
|
||||
|
||||
if (getResponse?.properties?.resource) {
|
||||
@@ -45,7 +45,7 @@ export async function updateUserDefinedFunction(
|
||||
databaseId,
|
||||
collectionId,
|
||||
userDefinedFunction.id,
|
||||
createUDFParams
|
||||
createUDFParams,
|
||||
);
|
||||
return rpResponse && (rpResponse.properties?.resource as UserDefinedFunctionDefinition & Resource);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ export async function updateUserDefinedFunction(
|
||||
handleError(
|
||||
error,
|
||||
"UpdateUserupdateUserDefinedFunction",
|
||||
`Error while updating user defined function ${userDefinedFunction.id}`
|
||||
`Error while updating user defined function ${userDefinedFunction.id}`,
|
||||
);
|
||||
throw error;
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user