Skip to content

Commit

Permalink
Update prettier dev-dependency to v2.5.1 in Cosmos DB (Azure#19506)
Browse files Browse the repository at this point in the history
* Upgrade prettier version

* Format files

* rebuild cosmos, updating cosmos.api.md
  • Loading branch information
JonathanCrd authored Jan 5, 2022
1 parent 4faf748 commit c26f9c2
Show file tree
Hide file tree
Showing 136 changed files with 1,550 additions and 1,629 deletions.
4 changes: 2 additions & 2 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/bundle-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const config = NodeCoreLib.JsonFile.loadAndValidate(

// This interface provides additional runtime state that is NOT part of the config file
const options = {
localBuild: process.argv.indexOf("--ship") < 0
localBuild: process.argv.indexOf("--ship") < 0,
};
const extractor = new ApiExtractor.Extractor(config, options);
extractor.processProject();
2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"execa": "^5.0.0",
"mocha": "^7.1.1",
"mocha-junit-reporter": "^2.0.0",
"prettier": "^1.16.4",
"prettier": "^2.5.1",
"requirejs": "^2.3.5",
"rimraf": "^3.0.0",
"rollup": "^1.16.3",
Expand Down
20 changes: 10 additions & 10 deletions sdk/cosmosdb/cosmos/review/cosmos.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ export class ChangeFeedResponse<T> {
export class ClientContext {
constructor(cosmosClientOptions: CosmosClientOptions, globalEndpointManager: GlobalEndpointManager);
// (undocumented)
batch<T>({ body, path, partitionKey, resourceId, options }: {
batch<T>({ body, path, partitionKey, resourceId, options, }: {
body: T;
path: string;
partitionKey: string;
resourceId: string;
options?: RequestOptions;
}): Promise<Response_2<any>>;
// (undocumented)
bulk<T>({ body, path, partitionKeyRangeId, resourceId, bulkOptions, options }: {
bulk<T>({ body, path, partitionKeyRangeId, resourceId, bulkOptions, options, }: {
body: T;
path: string;
partitionKeyRangeId: string;
Expand All @@ -102,7 +102,7 @@ export class ClientContext {
// (undocumented)
clearSessionToken(path: string): void;
// (undocumented)
create<T, U = T>({ body, path, resourceType, resourceId, options, partitionKey }: {
create<T, U = T>({ body, path, resourceType, resourceId, options, partitionKey, }: {
body: T;
path: string;
resourceType: ResourceType;
Expand All @@ -111,15 +111,15 @@ export class ClientContext {
partitionKey?: PartitionKey;
}): Promise<Response_2<T & U & Resource>>;
// (undocumented)
delete<T>({ path, resourceType, resourceId, options, partitionKey }: {
delete<T>({ path, resourceType, resourceId, options, partitionKey, }: {
path: string;
resourceType: ResourceType;
resourceId: string;
options?: RequestOptions;
partitionKey?: PartitionKey;
}): Promise<Response_2<T & Resource>>;
// (undocumented)
execute<T>({ sprocLink, params, options, partitionKey }: {
execute<T>({ sprocLink, params, options, partitionKey, }: {
sprocLink: string;
params?: any[];
options?: RequestOptions;
Expand All @@ -141,7 +141,7 @@ export class ClientContext {
[containerUrl: string]: any;
};
// (undocumented)
patch<T>({ body, path, resourceType, resourceId, options, partitionKey }: {
patch<T>({ body, path, resourceType, resourceId, options, partitionKey, }: {
body: any;
path: string;
resourceType: ResourceType;
Expand All @@ -150,7 +150,7 @@ export class ClientContext {
partitionKey?: PartitionKey;
}): Promise<Response_2<T & Resource>>;
// (undocumented)
queryFeed<T>({ path, resourceType, resourceId, resultFn, query, options, partitionKeyRangeId, partitionKey }: {
queryFeed<T>({ path, resourceType, resourceId, resultFn, query, options, partitionKeyRangeId, partitionKey, }: {
path: string;
resourceType: ResourceType;
resourceId: string;
Expand All @@ -165,15 +165,15 @@ export class ClientContext {
// (undocumented)
queryPartitionKeyRanges(collectionLink: string, query?: string | SqlQuerySpec, options?: FeedOptions): QueryIterator<PartitionKeyRange>;
// (undocumented)
read<T>({ path, resourceType, resourceId, options, partitionKey }: {
read<T>({ path, resourceType, resourceId, options, partitionKey, }: {
path: string;
resourceType: ResourceType;
resourceId: string;
options?: RequestOptions;
partitionKey?: PartitionKey;
}): Promise<Response_2<T & Resource>>;
// (undocumented)
replace<T>({ body, path, resourceType, resourceId, options, partitionKey }: {
replace<T>({ body, path, resourceType, resourceId, options, partitionKey, }: {
body: any;
path: string;
resourceType: ResourceType;
Expand All @@ -182,7 +182,7 @@ export class ClientContext {
partitionKey?: PartitionKey;
}): Promise<Response_2<T & Resource>>;
// (undocumented)
upsert<T, U = T>({ body, path, resourceType, resourceId, options, partitionKey }: {
upsert<T, U = T>({ body, path, resourceType, resourceId, options, partitionKey, }: {
body: T;
path: string;
resourceType: ResourceType;
Expand Down
14 changes: 4 additions & 10 deletions sdk/cosmosdb/cosmos/samples-dev/AADAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ async function run() {
logStep("Pass credentials to client object with key aadCredentials");
const aadClient = new CosmosClient({
endpoint,
aadCredentials: credentials
aadCredentials: credentials,
});

const genericClient = new CosmosClient({
endpoint,
key: key
key: key,
});

logStep(
Expand All @@ -47,15 +47,9 @@ async function run() {
await genericClient.databases.readAll({}).fetchAll();

// succeeds
await aadClient
.database("example")
.container(existingContainerId)
.items.readAll();
await aadClient.database("example").container(existingContainerId).items.readAll();
// succeeds
await genericClient
.database("example")
.container(existingContainerId)
.items.readAll();
await genericClient.database("example").container(existingContainerId).items.readAll();

await finish();
}
Expand Down
11 changes: 4 additions & 7 deletions sdk/cosmosdb/cosmos/samples-dev/AlterQueryThroughput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
Resource,
ContainerDefinition,
DatabaseDefinition,
FeedResponse
FeedResponse,
} from "@azure/cosmos";
const key = process.env.COSMOS_KEY || "<cosmos key>";
const endpoint = process.env.COSMOS_ENDPOINT || "<cosmos endpoint>";
Expand Down Expand Up @@ -75,9 +75,9 @@ async function updateOfferForCollection(
content: {
offerThroughput: newRups,
offerIsRUPerMinuteThroughputEnabled:
oldOfferDefinition.content.offerIsRUPerMinuteThroughputEnabled
oldOfferDefinition.content.offerIsRUPerMinuteThroughputEnabled,
},
offerVersion: "V2"
offerVersion: "V2",
};

logStep("Read all databases");
Expand All @@ -88,10 +88,7 @@ async function updateOfferForCollection(
databases
.filter((database: DatabaseDefinition & Resource) => database.id === dbName)
.map((database: DatabaseDefinition & Resource) => {
return client
.database(database.id)
.containers.readAll()
.fetchAll();
return client.database(database.id).containers.readAll().fetchAll();
})
);

Expand Down
32 changes: 16 additions & 16 deletions sdk/cosmosdb/cosmos/samples-dev/Bulk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
CosmosClient,
OperationInput,
PatchOperation,
PatchOperationType
PatchOperationType,
} from "@azure/cosmos";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand All @@ -32,17 +32,17 @@ async function run() {
const containerId = "bulkContainerV2";
const client = new CosmosClient({
key: key,
endpoint: endpoint
endpoint: endpoint,
});
const { database } = await client.databases.create({ id: addEntropy("bulk db") });
logStep(`Create multi-partition container '${containerId}' with partition key /key`);
const { container: v2Container } = await database.containers.create({
id: containerId,
partitionKey: {
paths: ["/key"],
version: 2
version: 2,
},
throughput: 25100
throughput: 25100,
});

const readItemId = addEntropy("item1");
Expand All @@ -55,62 +55,62 @@ async function run() {
await v2Container.items.create({
id: readItemId,
key: true,
class: "2010"
class: "2010",
});

await v2Container.items.create({
id: deleteItemId,
key: {},
class: "2011"
class: "2011",
});

await v2Container.items.create({
id: replaceItemId,
key: 5,
class: "2012"
class: "2012",
});

await v2Container.items.create({
id: patchItemId,
key: 5,
class: "2019"
class: "2019",
});

const operations: OperationInput[] = [
{
operationType: BulkOperationType.Create,
partitionKey: "A",
resourceBody: { id: addEntropy("doc1"), name: "sample", key: "A" }
resourceBody: { id: addEntropy("doc1"), name: "sample", key: "A" },
},
{
operationType: BulkOperationType.Upsert,
partitionKey: "U",
resourceBody: { name: "other", key: "U" }
resourceBody: { name: "other", key: "U" },
},
{
operationType: BulkOperationType.Read,
id: readItemId,
partitionKey: true
partitionKey: true,
},
{
operationType: BulkOperationType.Delete,
id: deleteItemId,
partitionKey: {}
partitionKey: {},
},
{
operationType: BulkOperationType.Replace,
partitionKey: 5,
id: replaceItemId,
resourceBody: { id: replaceItemId, name: "nice", key: 5 }
resourceBody: { id: replaceItemId, name: "nice", key: 5 },
},
{
operationType: BulkOperationType.Patch,
partitionKey: 5,
id: patchItemId,
resourceBody: {
operations: [{ op: PatchOperationType.add, path: "/great", value: "goodValue" }]
}
}
operations: [{ op: PatchOperationType.add, path: "/great", value: "goodValue" }],
},
},
];
logStep(
`Execute a simple bulk request with 5 operations: Create, Upsert, Read, Delete, Replace , Patch`
Expand Down
6 changes: 3 additions & 3 deletions sdk/cosmosdb/cosmos/samples-dev/BulkUpdateWithSproc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function body(continuation: string): void {
collection.getSelfLink(),
"SELECT * FROM root r",
{ pageSize: 2, continuation }, // Setting this low to show how continuation tokens work
function(err: any, feed: any, options: any) {
function (err: any, feed: any, options: any) {
if (err) throw err;
// Set continuation token on response if we get one
responseBody.continuation = options.continuation;
Expand All @@ -51,7 +51,7 @@ function body(continuation: string): void {
// Grab the next document to update
const document = documents.pop();
document.state = "open";
collection.replaceDocument(document._self, document, {}, function(err: any) {
collection.replaceDocument(document._self, document, {}, function (err: any) {
if (err) throw err;
// If we have successfully updated the document, include it in the returned document ids
responseBodyParam.updatedDocumentIds.push(document.id);
Expand Down Expand Up @@ -81,7 +81,7 @@ async function run(): Promise<void> {
logStep("Created stored procedure");
const { storedProcedure } = await container.scripts.storedProcedures.create({
id: "queryAndBulkUpdate",
body
body,
});

logStep("Execute stored procedure and follow continuation tokens");
Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/samples-dev/ChangeFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function run(): Promise<void> {
const { database } = await client.databases.createIfNotExists({ id: databaseId });
const { container } = await database.containers.createIfNotExists({
id: containerId,
partitionKey: { paths: ["/pk"] }
partitionKey: { paths: ["/pk"] },
});

try {
Expand Down Expand Up @@ -82,7 +82,7 @@ async function run(): Promise<void> {
console.log(` 👉 Inserted id=3`);

const specificContinuationIterator = container.items.changeFeed(pk, {
continuation: lsn.toString()
continuation: lsn.toString(),
});
const specificPointInTimeIterator = container.items.changeFeed(pk, { startTime: now });
const fromBeginningIterator = container.items.changeFeed(pk, { startFromBeginning: true });
Expand Down
Loading

0 comments on commit c26f9c2

Please sign in to comment.