Skip to content

Commit 191e103

Browse files
Update dependency @azure/cosmos to v4 (#1971)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@azure/cosmos](https://redirect.github.com/Azure/azure-sdk-for-js/tree/main/sdk/cosmosdb/cosmos/README.md) ([source](https://redirect.github.com/Azure/azure-sdk-for-js)) | dependencies | major | [`^3.1.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/@azure%2fcosmos/3.17.3/4.2.0) | | [@azure/cosmos](https://redirect.github.com/Azure/azure-sdk-for-js/tree/main/sdk/cosmosdb/cosmos/README.md) ([source](https://redirect.github.com/Azure/azure-sdk-for-js)) | dependencies | major | [`^3.1.1` -> `^4.0.0`](https://renovatebot.com/diffs/npm/@azure%2fcosmos/3.17.3/4.2.0) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>Azure/azure-sdk-for-js (@&#8203;azure/cosmos)</summary> ### [`v4.2.0`](https://redirect.github.com/Azure/azure-sdk-for-js/releases/tag/%40azure/cosmos_4.2.0) [Compare Source](https://redirect.github.com/Azure/azure-sdk-for-js/compare/@azure/cosmos_4.1.1...@azure/cosmos_4.2.0) ##### 4.2.0 (2024-11-19) ##### Features Added - Full Text Support: This feature adds support for full text search policy and indexing policy. It also enables performing full text search queries. [docs](https://learn.microsoft.com/azure/cosmos-db/gen-ai/full-text-search) - Hybrid Search Support: This feature adds support for performing hybrid search queries. [docs](https://learn.microsoft.com/azure/cosmos-db/gen-ai/hybrid-search) - Added support for three optional properties to support `quantizedFlat` and `diskANN` vector indexing policies. The properties are: `quantizationByteSize`, `vectorIndexShardKey` and `indexingSearchListSize`. ### [`v4.1.1`](https://redirect.github.com/Azure/azure-sdk-for-js/releases/tag/%40azure/cosmos_4.1.1) [Compare Source](https://redirect.github.com/Azure/azure-sdk-for-js/compare/@azure/cosmos_4.1.0...@azure/cosmos_4.1.1) ##### 4.1.1 (2024-08-30) ##### Bugs Fixed - Fixed a issue caused by accessing `process` without checking its existence in the global scope, it was leading to crashes in non-Node environments. - The default value of `continueOnError` of BulkRequestOptions is now set to true. Pass `{ continueOnError: false }` in `bulkOptions` to stop executing operations when one fails. ### [`v4.1.0`](https://redirect.github.com/Azure/azure-sdk-for-js/releases/tag/%40azure/cosmos_4.1.0) [Compare Source](https://redirect.github.com/Azure/azure-sdk-for-js/compare/@azure/cosmos_4.0.0...@azure/cosmos_4.1.0) ##### 4.1.0 (2024-08-07) ##### Features Added - Vector Search: This feature introduces vector indexes, vector embedding policy and vector queries to enable vector similarity search in JS SDK. [docs](https://learn.microsoft.com/azure/cosmos-db/nosql/vector-search) - All versions and deletes mode in change feed: The All versions and deletes mode is added in change feed mode which captures every version and every change (create, update, and delete) made to items. [docs](https://learn.microsoft.com/azure/cosmos-db/nosql/change-feed-modes?tabs=all-versions-and-deletes#all-versions-and-deletes-change-feed-mode-preview) - Bypassing integrated cache: The option to bypass integrated cache is now available in `RequestOptions`. [docs](https://learn.microsoft.com/azure/cosmos-db/integrated-cache#bypass-the-integrated-cache-preview) - Computed Properties: Support for adding Computed Properties in items is added. [docs](https://learn.microsoft.com/azure/cosmos-db/nosql/query/computed-properties?tabs=dotnet#creating-computed-properties) - Composite Indexing: The JS SDK now supports including composite indexes in the indexing policy, improving query performance on multiple fields. [docs](https://learn.microsoft.com/azure/cosmos-db/index-overview#composite-indexes) - Correlated Activity Id: Correlated Activity Id is added in header of every query request on Items. This helps in troubleshooting by linking all requests for a query that involves multiple server interactions and partitions. Correlated Activity Id can be accessed through query response headers or `response.correlatedActivityId`. - Split proof Bulk API: Earlier, whenever Bulk API encountered a partition split during processing, it would return an error message. Now, JS SDK ensures that the Bulk API is resistant to partition split. [#&#8203;18682](https://redirect.github.com/Azure/azure-sdk-for-js/issues/18682) - Improved samples: The samples have been updated in this release, now organized into two folders: `v3` for features up to the v3 release, and `v4` for features up to the v4 release. - Added support for MakeList and MakeSet query aggregators ##### Vector Search - The following sample shows how to create a container with vector embedding and indexing policies. ```js // define vector indexing policy const vectorEmbeddingPolicy = { vectorEmbeddings: [ { path: "/vector1", dataType: VectorEmbeddingDataType.UInt8, dimensions: 1000, distanceFunction: VectorEmbeddingDistanceFunction.Euclidean, }, { path: "/vector2", dataType: VectorEmbeddingDataType.Int8, dimensions: 200, distanceFunction: VectorEmbeddingDistanceFunction.DotProduct, }, { path: "/vector3", dataType: VectorEmbeddingDataType.UInt8, dimensions: 400, distanceFunction: VectorEmbeddingDistanceFunction.Cosine, }, ], }; // add vector indexes in Indexing Policy const indexingPolicy = { automatic: true, indexingMode: "consistent", vectorIndexes: [ { path: "/vector1", type: VectorIndexType.Flat }, { path: "/vector2", type: VectorIndexType.QuantizedFlat }, { path: "/vector3", type: VectorIndexType.DiskANN }, ], }; // define and create container with vector Embedding Policy const containerDefinition = { id: containerId, partitionKey: { paths: ["/id"] }, indexingPolicy: indexingPolicy, vectorEmbeddingPolicy: vectorEmbeddingPolicy, }; await database.containers.createIfNotExists(containerDefinition); ``` - Vector Search queries without TOP or LIMIT+OFFSET are blocked by default, with an option to disable this check using `allowUnboundedNonStreamingQueries` in query FeedOptions. Also added an internal buffer size check to prevent excessive memory consumption, throwing errors if the buffer size exceeds the default. The max buffer size can be increased using the `vectorSearchBufferSize` option from query FeedOptions. ##### Change Feed - All versions and deletes mode - The AllVersionsAndDeletes mode is only supported with `ChangeFeedStartFrom.Now` and `ChangeFeedStartFrom.Continuation`. - To read from the change feed in all versions and deletes mode, include `changeFeedMode` in changeFeedIteratorOptions: ```js const changeFeedIteratorOptions: ChangeFeedIteratorOptions = { maxItemCount: 5, changeFeedStartFrom: ChangeFeedStartFrom.Now(), changeFeedMode: ChangeFeedMode.AllVersionsAndDeletes, }; const iterator = container.items.getChangeFeedIterator(changeFeedIteratorOptions); ``` ##### Bypassing Integrated Cache - Here is a sample showing how to enable `bypassIntegratedCache` in RequestOptions. ```js const options: RequestOptions = {bypassIntegratedCache: true}; const response = await container.item("1").read(options); ``` ##### Computed Properties - The following snippet configures computed properties for a container: ```js const computedProperties: ComputedProperty[] = [{ name: "lowerLastName", query: "SELECT VALUE LOWER(IS_DEFINED(c.lastName) ? c.lastName : c.parents[0].familyName) FROM c", },]; const { resource: containerdef } = await database.containers.createIfNotExists({ id: containerName, computedProperties: computedProperties, indexingPolicy: indexingPolicy, }); const container: Container = database.container(containerdef.id); ``` ##### Composite Indexing - Here's a sample of adding composite indexes for a container: ```js const containerDefinition: ContainerDefinition = { id: "containerWithCompositeIndexingPolicy", indexingPolicy: { automatic: true, indexingMode: IndexingMode.consistent, includedPaths: [ { path: "/*", }, ], excludedPaths: [], compositeIndexes: [ [ { path: "/key", order: "ascending" }, { path: "/field", order: "ascending" }, ], ], }, }; await database.containers.create(containerDefinition); ``` - Added support for passing a custom `HttpClient` when constructing a `CosmosClient`. ##### Breaking Changes ##### Dropped Support for TypeScript 4.1 - We have opted to discontinue support for TypeScript version 4.1. Consequently, the minimum supported TypeScript version has been elevated to 4.2. Kindly ensure that your environment is promptly updated to align with these changes. ##### Bugs Fixed - Fix Bulk operations(Read, Delete, and Patch) failing due to wrong format of partition key in non-partitioned container. ### [`v4.0.0`](https://redirect.github.com/Azure/azure-sdk-for-js/releases/tag/%40azure/cosmos_4.0.0) [Compare Source](https://redirect.github.com/Azure/azure-sdk-for-js/compare/@azure/cosmos_3.17.3...@azure/cosmos_4.0.0) ##### 4.0.0 (2023-09-12) ##### Features Added - Added Changefeed support for partition keys, feed ranges, and entire container. [#&#8203;18062](https://redirect.github.com/Azure/azure-sdk-for-js/issues/18062) - Added Diagnostics to all response objects, i.e. ResourceResponse (parent class for ItemRespone, ContainerResponse etc.), FeedResponse, ChangeFeedIteratorResponse, ErrorResponse, BulkOperationResponse. [#&#8203;21177](https://redirect.github.com/Azure/azure-sdk-for-js/issues/21177) - Added support for hierarchical partitions. [#&#8203;23416](https://redirect.github.com/Azure/azure-sdk-for-js/issues/23416) - Added support of index metrics. [#&#8203;20194](https://redirect.github.com/Azure/azure-sdk-for-js/issues/20194) - Improved the retry utility to align with other language SDKs. Now, it automatically retries requests on the next available region when encountering HTTP 503 errors (Service Unavailable) and handles HTTP timeouts more effectively, enhancing the SDK's reliability. [#&#8203;23475](https://redirect.github.com/Azure/azure-sdk-for-js/issues/23475) - Added priority based throttling. [docs](https://devblogs.microsoft.com/cosmosdb/introducing-priority-based-execution-in-azure-cosmos-db-preview/) [#&#8203;26393](https://redirect.github.com/Azure/azure-sdk-for-js/pull/26393/files) ##### Bugs Fixed - Updated response codes for the getDatabase() method. [#&#8203;25932](https://redirect.github.com/Azure/azure-sdk-for-js/issues/25932) - Fix Upsert operation failing when partition key of container is `/id` and `/id` is missing in the document. [#&#8203;21383](https://redirect.github.com/Azure/azure-sdk-for-js/issues/21383) ##### Breaking Changes - The definition of PartitionKey is changed, PartitionKeyDefinition is now a independent type. [#&#8203;23416](https://redirect.github.com/Azure/azure-sdk-for-js/issues/23416) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - "every weekday" (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://redirect.github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuMTkuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJpbXBhY3Qvbm8tY2hhbmdlbG9nLXJlcXVpcmVkIl19--> Co-authored-by: pulumi-renovate[bot] <189166143+pulumi-renovate[bot]@users.noreply.github.com>
1 parent 2b1505b commit 191e103

File tree

2 files changed

+2
-2
lines changed
  • classic-azure-ts-cosmosapp-component/container/app
  • classic-azure-ts-serverless-url-shortener-global

2 files changed

+2
-2
lines changed

classic-azure-ts-cosmosapp-component/container/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "",
55
"main": "index.js",
66
"dependencies": {
7-
"@azure/cosmos": "^3.1.1",
7+
"@azure/cosmos": "^4.0.0",
88
"express": "^4.14.0",
99
"morgan": "^1.8.2"
1010
},

classic-azure-ts-serverless-url-shortener-global/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"@types/node": "8.10.66"
66
},
77
"dependencies": {
8-
"@azure/cosmos": "^3.1.0",
8+
"@azure/cosmos": "^4.0.0",
99
"@pulumi/azure": "6.19.0",
1010
"@pulumi/pulumi": "3.150.0"
1111
}

0 commit comments

Comments
 (0)