@azure/cosmos 4.5.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1401) hide show
  1. package/README.md +32 -0
  2. package/dist/browser/ChangeFeedIterator.js +17 -11
  3. package/dist/browser/ChangeFeedIterator.js.map +1 -1
  4. package/dist/browser/ChangeFeedResponse.js +8 -0
  5. package/dist/browser/ChangeFeedResponse.js.map +1 -1
  6. package/dist/browser/ClientContext.d.ts.map +1 -1
  7. package/dist/browser/ClientContext.js +232 -48
  8. package/dist/browser/ClientContext.js.map +1 -1
  9. package/dist/browser/CosmosClient.d.ts +13 -0
  10. package/dist/browser/CosmosClient.d.ts.map +1 -1
  11. package/dist/browser/CosmosClient.js +53 -6
  12. package/dist/browser/CosmosClient.js.map +1 -1
  13. package/dist/browser/CosmosClientOptions.d.ts.map +1 -1
  14. package/dist/browser/CosmosClientOptions.js.map +1 -1
  15. package/dist/browser/CosmosDiagnostics.d.ts +4 -0
  16. package/dist/browser/CosmosDiagnostics.d.ts.map +1 -1
  17. package/dist/browser/CosmosDiagnostics.js +3 -0
  18. package/dist/browser/CosmosDiagnostics.js.map +1 -1
  19. package/dist/browser/GlobalEndpointManagerOptions.d.ts +2 -0
  20. package/dist/browser/GlobalEndpointManagerOptions.d.ts.map +1 -0
  21. package/dist/browser/GlobalEndpointManagerOptions.js +2 -0
  22. package/dist/browser/GlobalEndpointManagerOptions.js.map +1 -0
  23. package/dist/browser/PartitionKeyRangeFailoverInfo.js +8 -5
  24. package/dist/browser/PartitionKeyRangeFailoverInfo.js.map +1 -1
  25. package/dist/browser/bulk/Batcher.js +13 -3
  26. package/dist/browser/bulk/Batcher.js.map +1 -1
  27. package/dist/browser/bulk/BulkHelper.js +26 -11
  28. package/dist/browser/bulk/BulkHelper.js.map +1 -1
  29. package/dist/browser/bulk/BulkResponse.js +22 -20
  30. package/dist/browser/bulk/BulkResponse.js.map +1 -1
  31. package/dist/browser/bulk/CongestionAlgorithm.js +11 -4
  32. package/dist/browser/bulk/CongestionAlgorithm.js.map +1 -1
  33. package/dist/browser/bulk/HelperPerPartition.js +14 -1
  34. package/dist/browser/bulk/HelperPerPartition.js.map +1 -1
  35. package/dist/browser/bulk/ItemOperationContext.js +4 -0
  36. package/dist/browser/bulk/ItemOperationContext.js.map +1 -1
  37. package/dist/browser/bulk/Limiter.js +27 -18
  38. package/dist/browser/bulk/Limiter.js.map +1 -1
  39. package/dist/browser/bulk/PartitionMetric.js +4 -0
  40. package/dist/browser/bulk/PartitionMetric.js.map +1 -1
  41. package/dist/browser/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
  42. package/dist/browser/client/ChangeFeed/ChangeFeedForEpkRange.js +29 -15
  43. package/dist/browser/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
  44. package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
  45. package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.js +19 -8
  46. package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
  47. package/dist/browser/client/ChangeFeed/ChangeFeedIteratorBuilder.js +12 -9
  48. package/dist/browser/client/ChangeFeed/ChangeFeedIteratorBuilder.js.map +1 -1
  49. package/dist/browser/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +5 -0
  50. package/dist/browser/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
  51. package/dist/browser/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
  52. package/dist/browser/client/ChangeFeed/ChangeFeedIteratorResponse.js +9 -0
  53. package/dist/browser/client/ChangeFeed/ChangeFeedIteratorResponse.js.map +1 -1
  54. package/dist/browser/client/ChangeFeed/ChangeFeedPolicy.js +1 -0
  55. package/dist/browser/client/ChangeFeed/ChangeFeedPolicy.js.map +1 -1
  56. package/dist/browser/client/ChangeFeed/ChangeFeedRange.js +20 -0
  57. package/dist/browser/client/ChangeFeed/ChangeFeedRange.js.map +1 -1
  58. package/dist/browser/client/ChangeFeed/ChangeFeedRetentionTimeSpan.js +1 -0
  59. package/dist/browser/client/ChangeFeed/ChangeFeedRetentionTimeSpan.js.map +1 -1
  60. package/dist/browser/client/ChangeFeed/ChangeFeedStartFromBeginning.js +1 -0
  61. package/dist/browser/client/ChangeFeed/ChangeFeedStartFromBeginning.js.map +1 -1
  62. package/dist/browser/client/ChangeFeed/ChangeFeedStartFromContinuation.js +1 -0
  63. package/dist/browser/client/ChangeFeed/ChangeFeedStartFromContinuation.js.map +1 -1
  64. package/dist/browser/client/ChangeFeed/ChangeFeedStartFromNow.js +1 -0
  65. package/dist/browser/client/ChangeFeed/ChangeFeedStartFromNow.js.map +1 -1
  66. package/dist/browser/client/ChangeFeed/ChangeFeedStartFromTime.js +2 -0
  67. package/dist/browser/client/ChangeFeed/ChangeFeedStartFromTime.js.map +1 -1
  68. package/dist/browser/client/ChangeFeed/CompositeContinuationToken.js +8 -0
  69. package/dist/browser/client/ChangeFeed/CompositeContinuationToken.js.map +1 -1
  70. package/dist/browser/client/ChangeFeed/ContinuationTokenForPartitionKey.js +12 -0
  71. package/dist/browser/client/ChangeFeed/ContinuationTokenForPartitionKey.js.map +1 -1
  72. package/dist/browser/client/ChangeFeed/FeedRange.js +8 -0
  73. package/dist/browser/client/ChangeFeed/FeedRange.js.map +1 -1
  74. package/dist/browser/client/ChangeFeed/FeedRangeQueue.js +1 -0
  75. package/dist/browser/client/ChangeFeed/FeedRangeQueue.js.map +1 -1
  76. package/dist/browser/client/ChangeFeed/InternalChangeFeedOptions.d.ts +1 -0
  77. package/dist/browser/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
  78. package/dist/browser/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
  79. package/dist/browser/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
  80. package/dist/browser/client/ChangeFeed/changeFeedUtils.js +6 -5
  81. package/dist/browser/client/ChangeFeed/changeFeedUtils.js.map +1 -1
  82. package/dist/browser/client/ClientUtils.js +1 -1
  83. package/dist/browser/client/ClientUtils.js.map +1 -1
  84. package/dist/browser/client/Conflict/Conflict.js +4 -0
  85. package/dist/browser/client/Conflict/Conflict.js.map +1 -1
  86. package/dist/browser/client/Conflict/ConflictResponse.js +2 -0
  87. package/dist/browser/client/Conflict/ConflictResponse.js.map +1 -1
  88. package/dist/browser/client/Conflict/Conflicts.js +2 -0
  89. package/dist/browser/client/Conflict/Conflicts.js.map +1 -1
  90. package/dist/browser/client/Container/Container.js +18 -3
  91. package/dist/browser/client/Container/Container.js.map +1 -1
  92. package/dist/browser/client/Container/ContainerResponse.js +2 -0
  93. package/dist/browser/client/Container/ContainerResponse.js.map +1 -1
  94. package/dist/browser/client/Container/Containers.js +4 -2
  95. package/dist/browser/client/Container/Containers.js.map +1 -1
  96. package/dist/browser/client/Database/Database.js +33 -0
  97. package/dist/browser/client/Database/Database.js.map +1 -1
  98. package/dist/browser/client/Database/DatabaseResponse.js +2 -0
  99. package/dist/browser/client/Database/DatabaseResponse.js.map +1 -1
  100. package/dist/browser/client/Database/Databases.js +3 -0
  101. package/dist/browser/client/Database/Databases.js.map +1 -1
  102. package/dist/browser/client/Item/Item.js +4 -0
  103. package/dist/browser/client/Item/Item.js.map +1 -1
  104. package/dist/browser/client/Item/ItemResponse.js +2 -0
  105. package/dist/browser/client/Item/ItemResponse.js.map +1 -1
  106. package/dist/browser/client/Item/Items.d.ts.map +1 -1
  107. package/dist/browser/client/Item/Items.js +8 -0
  108. package/dist/browser/client/Item/Items.js.map +1 -1
  109. package/dist/browser/client/Offer/Offer.js +3 -0
  110. package/dist/browser/client/Offer/Offer.js.map +1 -1
  111. package/dist/browser/client/Offer/OfferResponse.js +2 -0
  112. package/dist/browser/client/Offer/OfferResponse.js.map +1 -1
  113. package/dist/browser/client/Offer/Offers.js +2 -0
  114. package/dist/browser/client/Offer/Offers.js.map +1 -1
  115. package/dist/browser/client/Permission/Permission.js +3 -0
  116. package/dist/browser/client/Permission/Permission.js.map +1 -1
  117. package/dist/browser/client/Permission/PermissionResponse.js +2 -0
  118. package/dist/browser/client/Permission/PermissionResponse.js.map +1 -1
  119. package/dist/browser/client/Permission/Permissions.js +2 -0
  120. package/dist/browser/client/Permission/Permissions.js.map +1 -1
  121. package/dist/browser/client/SasToken/SasTokenProperties.js +17 -0
  122. package/dist/browser/client/SasToken/SasTokenProperties.js.map +1 -1
  123. package/dist/browser/client/Script/Scripts.js +5 -0
  124. package/dist/browser/client/Script/Scripts.js.map +1 -1
  125. package/dist/browser/client/StoredProcedure/StoredProcedure.js +3 -0
  126. package/dist/browser/client/StoredProcedure/StoredProcedure.js.map +1 -1
  127. package/dist/browser/client/StoredProcedure/StoredProcedureResponse.js +4 -0
  128. package/dist/browser/client/StoredProcedure/StoredProcedureResponse.js.map +1 -1
  129. package/dist/browser/client/StoredProcedure/StoredProcedures.js +2 -0
  130. package/dist/browser/client/StoredProcedure/StoredProcedures.js.map +1 -1
  131. package/dist/browser/client/Trigger/Trigger.js +3 -0
  132. package/dist/browser/client/Trigger/Trigger.js.map +1 -1
  133. package/dist/browser/client/Trigger/TriggerResponse.js +2 -0
  134. package/dist/browser/client/Trigger/TriggerResponse.js.map +1 -1
  135. package/dist/browser/client/Trigger/Triggers.js +2 -0
  136. package/dist/browser/client/Trigger/Triggers.js.map +1 -1
  137. package/dist/browser/client/User/User.js +9 -0
  138. package/dist/browser/client/User/User.js.map +1 -1
  139. package/dist/browser/client/User/UserResponse.js +2 -0
  140. package/dist/browser/client/User/UserResponse.js.map +1 -1
  141. package/dist/browser/client/User/Users.js +2 -0
  142. package/dist/browser/client/User/Users.js.map +1 -1
  143. package/dist/browser/client/UserDefinedFunction/UserDefinedFunction.js +3 -0
  144. package/dist/browser/client/UserDefinedFunction/UserDefinedFunction.js.map +1 -1
  145. package/dist/browser/client/UserDefinedFunction/UserDefinedFunctionResponse.js +2 -0
  146. package/dist/browser/client/UserDefinedFunction/UserDefinedFunctionResponse.js.map +1 -1
  147. package/dist/browser/client/UserDefinedFunction/UserDefinedFunctions.js +2 -0
  148. package/dist/browser/client/UserDefinedFunction/UserDefinedFunctions.js.map +1 -1
  149. package/dist/browser/common/constants.d.ts +4 -0
  150. package/dist/browser/common/constants.d.ts.map +1 -1
  151. package/dist/browser/common/constants.js +5 -1
  152. package/dist/browser/common/constants.js.map +1 -1
  153. package/dist/browser/common/helper.d.ts +6 -0
  154. package/dist/browser/common/helper.d.ts.map +1 -1
  155. package/dist/browser/common/helper.js +9 -1
  156. package/dist/browser/common/helper.js.map +1 -1
  157. package/dist/browser/common/platform.d.ts +1 -0
  158. package/dist/browser/common/platform.d.ts.map +1 -1
  159. package/dist/browser/common/platform.js +1 -3
  160. package/dist/browser/common/platform.js.map +1 -1
  161. package/dist/browser/diagnostics/CosmosDiagnosticsContext.js +8 -7
  162. package/dist/browser/diagnostics/CosmosDiagnosticsContext.js.map +1 -1
  163. package/dist/browser/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
  164. package/dist/browser/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
  165. package/dist/browser/diagnostics/DiagnosticNodeInternal.js +26 -7
  166. package/dist/browser/diagnostics/DiagnosticNodeInternal.js.map +1 -1
  167. package/dist/browser/diagnostics/DiagnosticWriter.js +1 -3
  168. package/dist/browser/diagnostics/DiagnosticWriter.js.map +1 -1
  169. package/dist/browser/diagnostics/index.js +2 -2
  170. package/dist/browser/diagnostics/index.js.map +1 -1
  171. package/dist/browser/documents/ConnectionPolicy.d.ts +10 -4
  172. package/dist/browser/documents/ConnectionPolicy.d.ts.map +1 -1
  173. package/dist/browser/documents/ConnectionPolicy.js +2 -2
  174. package/dist/browser/documents/ConnectionPolicy.js.map +1 -1
  175. package/dist/browser/documents/DatabaseAccount.d.ts +4 -0
  176. package/dist/browser/documents/DatabaseAccount.d.ts.map +1 -1
  177. package/dist/browser/documents/DatabaseAccount.js +29 -4
  178. package/dist/browser/documents/DatabaseAccount.js.map +1 -1
  179. package/dist/browser/documents/PartitionKey.js +1 -3
  180. package/dist/browser/documents/PartitionKey.js.map +1 -1
  181. package/dist/browser/encryption/Cache/ClientEncryptionKeyPropertiesCache.js +2 -0
  182. package/dist/browser/encryption/Cache/ClientEncryptionKeyPropertiesCache.js.map +1 -1
  183. package/dist/browser/encryption/Cache/EncryptionSettingsCache.js +2 -0
  184. package/dist/browser/encryption/Cache/EncryptionSettingsCache.js.map +1 -1
  185. package/dist/browser/encryption/Cache/KeyEncryptionKeyCache.js +2 -0
  186. package/dist/browser/encryption/Cache/KeyEncryptionKeyCache.js.map +1 -1
  187. package/dist/browser/encryption/ClientEncryptionKey/ClientEncryptionKeyResponse.js +2 -0
  188. package/dist/browser/encryption/ClientEncryptionKey/ClientEncryptionKeyResponse.js.map +1 -1
  189. package/dist/browser/encryption/EncryptionItemQueryIterator.js +24 -27
  190. package/dist/browser/encryption/EncryptionItemQueryIterator.js.map +1 -1
  191. package/dist/browser/encryption/EncryptionKey/ProtectedDataEncryptionKey.d.ts +0 -1
  192. package/dist/browser/encryption/EncryptionKey/ProtectedDataEncryptionKey.d.ts.map +1 -1
  193. package/dist/browser/encryption/EncryptionKey/ProtectedDataEncryptionKey.js +2 -0
  194. package/dist/browser/encryption/EncryptionKey/ProtectedDataEncryptionKey.js.map +1 -1
  195. package/dist/browser/encryption/EncryptionKeyResolver/AzureKeyVaultEncryptionKeyResolver.js +6 -5
  196. package/dist/browser/encryption/EncryptionKeyResolver/AzureKeyVaultEncryptionKeyResolver.js.map +1 -1
  197. package/dist/browser/encryption/EncryptionKeyStoreProvider.js +8 -1
  198. package/dist/browser/encryption/EncryptionKeyStoreProvider.js.map +1 -1
  199. package/dist/browser/encryption/EncryptionManager.js +6 -0
  200. package/dist/browser/encryption/EncryptionManager.js.map +1 -1
  201. package/dist/browser/encryption/EncryptionProcessor.js +5 -0
  202. package/dist/browser/encryption/EncryptionProcessor.js.map +1 -1
  203. package/dist/browser/encryption/EncryptionQueryBuilder.js +2 -0
  204. package/dist/browser/encryption/EncryptionQueryBuilder.js.map +1 -1
  205. package/dist/browser/encryption/EncryptionSettingForProperty.js +6 -0
  206. package/dist/browser/encryption/EncryptionSettingForProperty.js.map +1 -1
  207. package/dist/browser/encryption/EncryptionSettings.js +6 -3
  208. package/dist/browser/encryption/EncryptionSettings.js.map +1 -1
  209. package/dist/browser/encryption/KeyEncryptionKey.js +4 -0
  210. package/dist/browser/encryption/KeyEncryptionKey.js.map +1 -1
  211. package/dist/browser/encryption/Serializers/StringSerializer.js +1 -1
  212. package/dist/browser/encryption/Serializers/StringSerializer.js.map +1 -1
  213. package/dist/browser/extractPartitionKey.js +2 -2
  214. package/dist/browser/extractPartitionKey.js.map +1 -1
  215. package/dist/browser/globalEndpointManager.d.ts +8 -0
  216. package/dist/browser/globalEndpointManager.d.ts.map +1 -1
  217. package/dist/browser/globalEndpointManager.js +104 -29
  218. package/dist/browser/globalEndpointManager.js.map +1 -1
  219. package/dist/browser/globalPartitionEndpointManager.d.ts +0 -2
  220. package/dist/browser/globalPartitionEndpointManager.d.ts.map +1 -1
  221. package/dist/browser/globalPartitionEndpointManager.js +19 -7
  222. package/dist/browser/globalPartitionEndpointManager.js.map +1 -1
  223. package/dist/browser/queryExecutionContext/Aggregators/AverageAggregator.js +2 -0
  224. package/dist/browser/queryExecutionContext/Aggregators/AverageAggregator.js.map +1 -1
  225. package/dist/browser/queryExecutionContext/Aggregators/CountAggregator.js +1 -0
  226. package/dist/browser/queryExecutionContext/Aggregators/CountAggregator.js.map +1 -1
  227. package/dist/browser/queryExecutionContext/Aggregators/GlobalStatisticsAggregator.js +1 -0
  228. package/dist/browser/queryExecutionContext/Aggregators/GlobalStatisticsAggregator.js.map +1 -1
  229. package/dist/browser/queryExecutionContext/Aggregators/MakeListAggregator.js +1 -0
  230. package/dist/browser/queryExecutionContext/Aggregators/MakeListAggregator.js.map +1 -1
  231. package/dist/browser/queryExecutionContext/Aggregators/MakeSetAggregator.js +1 -0
  232. package/dist/browser/queryExecutionContext/Aggregators/MakeSetAggregator.js.map +1 -1
  233. package/dist/browser/queryExecutionContext/Aggregators/MaxAggregator.js +2 -0
  234. package/dist/browser/queryExecutionContext/Aggregators/MaxAggregator.js.map +1 -1
  235. package/dist/browser/queryExecutionContext/Aggregators/MinAggregator.js +2 -0
  236. package/dist/browser/queryExecutionContext/Aggregators/MinAggregator.js.map +1 -1
  237. package/dist/browser/queryExecutionContext/Aggregators/StaticValueAggregator.js +1 -0
  238. package/dist/browser/queryExecutionContext/Aggregators/StaticValueAggregator.js.map +1 -1
  239. package/dist/browser/queryExecutionContext/Aggregators/SumAggregator.js +1 -0
  240. package/dist/browser/queryExecutionContext/Aggregators/SumAggregator.js.map +1 -1
  241. package/dist/browser/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js +5 -3
  242. package/dist/browser/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js.map +1 -1
  243. package/dist/browser/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js +6 -3
  244. package/dist/browser/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js.map +1 -1
  245. package/dist/browser/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js +23 -7
  246. package/dist/browser/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js.map +1 -1
  247. package/dist/browser/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js +14 -6
  248. package/dist/browser/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js.map +1 -1
  249. package/dist/browser/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js +3 -0
  250. package/dist/browser/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js.map +1 -1
  251. package/dist/browser/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js +2 -0
  252. package/dist/browser/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js.map +1 -1
  253. package/dist/browser/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js +2 -0
  254. package/dist/browser/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js.map +1 -1
  255. package/dist/browser/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js +2 -0
  256. package/dist/browser/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js.map +1 -1
  257. package/dist/browser/queryExecutionContext/FetchResult.js +4 -0
  258. package/dist/browser/queryExecutionContext/FetchResult.js.map +1 -1
  259. package/dist/browser/queryExecutionContext/defaultQueryExecutionContext.js +14 -2
  260. package/dist/browser/queryExecutionContext/defaultQueryExecutionContext.js.map +1 -1
  261. package/dist/browser/queryExecutionContext/documentProducer.js +34 -21
  262. package/dist/browser/queryExecutionContext/documentProducer.js.map +1 -1
  263. package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.js +41 -27
  264. package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
  265. package/dist/browser/queryExecutionContext/orderByComparator.js +1 -0
  266. package/dist/browser/queryExecutionContext/orderByComparator.js.map +1 -1
  267. package/dist/browser/queryExecutionContext/orderByDocumentProducerComparator.js +1 -0
  268. package/dist/browser/queryExecutionContext/orderByDocumentProducerComparator.js.map +1 -1
  269. package/dist/browser/queryExecutionContext/orderByQueryExecutionContext.js +1 -0
  270. package/dist/browser/queryExecutionContext/orderByQueryExecutionContext.js.map +1 -1
  271. package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.js +20 -2
  272. package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
  273. package/dist/browser/queryExecutionContext/pipelinedQueryExecutionContext.js +14 -4
  274. package/dist/browser/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
  275. package/dist/browser/queryIterator.js +41 -33
  276. package/dist/browser/queryIterator.js.map +1 -1
  277. package/dist/browser/queryMetrics/clientSideMetrics.js +2 -1
  278. package/dist/browser/queryMetrics/clientSideMetrics.js.map +1 -1
  279. package/dist/browser/queryMetrics/queryMetrics.js +14 -1
  280. package/dist/browser/queryMetrics/queryMetrics.js.map +1 -1
  281. package/dist/browser/queryMetrics/queryPreparationTime.js +5 -1
  282. package/dist/browser/queryMetrics/queryPreparationTime.js.map +1 -1
  283. package/dist/browser/queryMetrics/runtimeExecutionTimes.js +4 -1
  284. package/dist/browser/queryMetrics/runtimeExecutionTimes.js.map +1 -1
  285. package/dist/browser/queryMetrics/timeSpan.js +4 -3
  286. package/dist/browser/queryMetrics/timeSpan.js.map +1 -1
  287. package/dist/browser/request/ErrorResponse.js +19 -0
  288. package/dist/browser/request/ErrorResponse.js.map +1 -1
  289. package/dist/browser/request/FeedResponse.js +4 -0
  290. package/dist/browser/request/FeedResponse.js.map +1 -1
  291. package/dist/browser/request/RequestHandler.js +3 -4
  292. package/dist/browser/request/RequestHandler.js.map +1 -1
  293. package/dist/browser/request/ResourceResponse.js +5 -0
  294. package/dist/browser/request/ResourceResponse.js.map +1 -1
  295. package/dist/browser/request/SharedOptions.d.ts +5 -0
  296. package/dist/browser/request/SharedOptions.d.ts.map +1 -1
  297. package/dist/browser/request/SharedOptions.js.map +1 -1
  298. package/dist/browser/request/TimeoutError.js +1 -1
  299. package/dist/browser/request/TimeoutError.js.map +1 -1
  300. package/dist/browser/request/hybridSearchQueryResult.js +5 -0
  301. package/dist/browser/request/hybridSearchQueryResult.js.map +1 -1
  302. package/dist/browser/request/request.js +5 -1
  303. package/dist/browser/request/request.js.map +1 -1
  304. package/dist/browser/retry/bulkExecutionRetryPolicy.js +5 -2
  305. package/dist/browser/retry/bulkExecutionRetryPolicy.js.map +1 -1
  306. package/dist/browser/retry/defaultRetryPolicy.d.ts.map +1 -1
  307. package/dist/browser/retry/defaultRetryPolicy.js +7 -7
  308. package/dist/browser/retry/defaultRetryPolicy.js.map +1 -1
  309. package/dist/browser/retry/endpointDiscoveryRetryPolicy.d.ts +3 -2
  310. package/dist/browser/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
  311. package/dist/browser/retry/endpointDiscoveryRetryPolicy.js +24 -7
  312. package/dist/browser/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
  313. package/dist/browser/retry/resourceThrottleRetryPolicy.js +20 -10
  314. package/dist/browser/retry/resourceThrottleRetryPolicy.js.map +1 -1
  315. package/dist/browser/retry/retryUtility.d.ts.map +1 -1
  316. package/dist/browser/retry/retryUtility.js +22 -8
  317. package/dist/browser/retry/retryUtility.js.map +1 -1
  318. package/dist/browser/retry/sessionRetryPolicy.js +8 -4
  319. package/dist/browser/retry/sessionRetryPolicy.js.map +1 -1
  320. package/dist/browser/retry/timeoutFailoverRetryPolicy.d.ts +1 -2
  321. package/dist/browser/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
  322. package/dist/browser/retry/timeoutFailoverRetryPolicy.js +17 -7
  323. package/dist/browser/retry/timeoutFailoverRetryPolicy.js.map +1 -1
  324. package/dist/browser/routing/QueryRange.js +4 -0
  325. package/dist/browser/routing/QueryRange.js.map +1 -1
  326. package/dist/browser/routing/inMemoryCollectionRoutingMap.js +4 -0
  327. package/dist/browser/routing/inMemoryCollectionRoutingMap.js.map +1 -1
  328. package/dist/browser/routing/partitionKeyRangeCache.js +2 -0
  329. package/dist/browser/routing/partitionKeyRangeCache.js.map +1 -1
  330. package/dist/browser/routing/smartRoutingMapProvider.js +1 -0
  331. package/dist/browser/routing/smartRoutingMapProvider.js.map +1 -1
  332. package/dist/browser/session/VectorSessionToken.js +6 -2
  333. package/dist/browser/session/VectorSessionToken.js.map +1 -1
  334. package/dist/browser/session/sessionContainer.js +5 -3
  335. package/dist/browser/session/sessionContainer.js.map +1 -1
  336. package/dist/browser/utils/batch.js +15 -4
  337. package/dist/browser/utils/batch.js.map +1 -1
  338. package/dist/browser/utils/encode.d.ts +1 -1
  339. package/dist/browser/utils/encode.d.ts.map +1 -1
  340. package/dist/browser/utils/encode.js.map +1 -1
  341. package/dist/browser/utils/fixedSizePriorityQueue.js +4 -0
  342. package/dist/browser/utils/fixedSizePriorityQueue.js.map +1 -1
  343. package/dist/browser/utils/hashing/hash.js +1 -1
  344. package/dist/browser/utils/hashing/hash.js.map +1 -1
  345. package/dist/browser/utils/nonStreamingOrderByMap.js +2 -0
  346. package/dist/browser/utils/nonStreamingOrderByMap.js.map +1 -1
  347. package/dist/commonjs/ChangeFeedIterator.js +17 -11
  348. package/dist/commonjs/ChangeFeedIterator.js.map +1 -1
  349. package/dist/commonjs/ChangeFeedResponse.js +8 -0
  350. package/dist/commonjs/ChangeFeedResponse.js.map +1 -1
  351. package/dist/commonjs/ClientContext.d.ts.map +1 -1
  352. package/dist/commonjs/ClientContext.js +232 -48
  353. package/dist/commonjs/ClientContext.js.map +1 -1
  354. package/dist/commonjs/CosmosClient.d.ts +13 -0
  355. package/dist/commonjs/CosmosClient.d.ts.map +1 -1
  356. package/dist/commonjs/CosmosClient.js +53 -6
  357. package/dist/commonjs/CosmosClient.js.map +1 -1
  358. package/dist/commonjs/CosmosClientOptions.d.ts.map +1 -1
  359. package/dist/commonjs/CosmosClientOptions.js.map +1 -1
  360. package/dist/commonjs/CosmosDiagnostics.d.ts +4 -0
  361. package/dist/commonjs/CosmosDiagnostics.d.ts.map +1 -1
  362. package/dist/commonjs/CosmosDiagnostics.js +3 -0
  363. package/dist/commonjs/CosmosDiagnostics.js.map +1 -1
  364. package/dist/commonjs/GlobalEndpointManagerOptions.d.ts +2 -0
  365. package/dist/commonjs/GlobalEndpointManagerOptions.d.ts.map +1 -0
  366. package/dist/commonjs/GlobalEndpointManagerOptions.js +3 -0
  367. package/dist/commonjs/GlobalEndpointManagerOptions.js.map +1 -0
  368. package/dist/commonjs/PartitionKeyRangeFailoverInfo.js +8 -5
  369. package/dist/commonjs/PartitionKeyRangeFailoverInfo.js.map +1 -1
  370. package/dist/commonjs/bulk/Batcher.js +13 -3
  371. package/dist/commonjs/bulk/Batcher.js.map +1 -1
  372. package/dist/commonjs/bulk/BulkHelper.js +26 -11
  373. package/dist/commonjs/bulk/BulkHelper.js.map +1 -1
  374. package/dist/commonjs/bulk/BulkResponse.js +22 -20
  375. package/dist/commonjs/bulk/BulkResponse.js.map +1 -1
  376. package/dist/commonjs/bulk/CongestionAlgorithm.js +11 -4
  377. package/dist/commonjs/bulk/CongestionAlgorithm.js.map +1 -1
  378. package/dist/commonjs/bulk/HelperPerPartition.js +14 -1
  379. package/dist/commonjs/bulk/HelperPerPartition.js.map +1 -1
  380. package/dist/commonjs/bulk/ItemOperationContext.js +4 -0
  381. package/dist/commonjs/bulk/ItemOperationContext.js.map +1 -1
  382. package/dist/commonjs/bulk/Limiter.js +27 -18
  383. package/dist/commonjs/bulk/Limiter.js.map +1 -1
  384. package/dist/commonjs/bulk/PartitionMetric.js +4 -0
  385. package/dist/commonjs/bulk/PartitionMetric.js.map +1 -1
  386. package/dist/commonjs/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
  387. package/dist/commonjs/client/ChangeFeed/ChangeFeedForEpkRange.js +29 -15
  388. package/dist/commonjs/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
  389. package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
  390. package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.js +19 -8
  391. package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
  392. package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorBuilder.js +12 -9
  393. package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorBuilder.js.map +1 -1
  394. package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +5 -0
  395. package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
  396. package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
  397. package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorResponse.js +9 -0
  398. package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorResponse.js.map +1 -1
  399. package/dist/commonjs/client/ChangeFeed/ChangeFeedPolicy.js +1 -0
  400. package/dist/commonjs/client/ChangeFeed/ChangeFeedPolicy.js.map +1 -1
  401. package/dist/commonjs/client/ChangeFeed/ChangeFeedRange.js +20 -0
  402. package/dist/commonjs/client/ChangeFeed/ChangeFeedRange.js.map +1 -1
  403. package/dist/commonjs/client/ChangeFeed/ChangeFeedRetentionTimeSpan.js +1 -0
  404. package/dist/commonjs/client/ChangeFeed/ChangeFeedRetentionTimeSpan.js.map +1 -1
  405. package/dist/commonjs/client/ChangeFeed/ChangeFeedStartFromBeginning.js +1 -0
  406. package/dist/commonjs/client/ChangeFeed/ChangeFeedStartFromBeginning.js.map +1 -1
  407. package/dist/commonjs/client/ChangeFeed/ChangeFeedStartFromContinuation.js +1 -0
  408. package/dist/commonjs/client/ChangeFeed/ChangeFeedStartFromContinuation.js.map +1 -1
  409. package/dist/commonjs/client/ChangeFeed/ChangeFeedStartFromNow.js +1 -0
  410. package/dist/commonjs/client/ChangeFeed/ChangeFeedStartFromNow.js.map +1 -1
  411. package/dist/commonjs/client/ChangeFeed/ChangeFeedStartFromTime.js +2 -0
  412. package/dist/commonjs/client/ChangeFeed/ChangeFeedStartFromTime.js.map +1 -1
  413. package/dist/commonjs/client/ChangeFeed/CompositeContinuationToken.js +8 -0
  414. package/dist/commonjs/client/ChangeFeed/CompositeContinuationToken.js.map +1 -1
  415. package/dist/commonjs/client/ChangeFeed/ContinuationTokenForPartitionKey.js +12 -0
  416. package/dist/commonjs/client/ChangeFeed/ContinuationTokenForPartitionKey.js.map +1 -1
  417. package/dist/commonjs/client/ChangeFeed/FeedRange.js +8 -0
  418. package/dist/commonjs/client/ChangeFeed/FeedRange.js.map +1 -1
  419. package/dist/commonjs/client/ChangeFeed/FeedRangeQueue.js +1 -0
  420. package/dist/commonjs/client/ChangeFeed/FeedRangeQueue.js.map +1 -1
  421. package/dist/commonjs/client/ChangeFeed/InternalChangeFeedOptions.d.ts +1 -0
  422. package/dist/commonjs/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
  423. package/dist/commonjs/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
  424. package/dist/commonjs/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
  425. package/dist/commonjs/client/ChangeFeed/changeFeedUtils.js +6 -5
  426. package/dist/commonjs/client/ChangeFeed/changeFeedUtils.js.map +1 -1
  427. package/dist/commonjs/client/ClientUtils.js +1 -1
  428. package/dist/commonjs/client/ClientUtils.js.map +1 -1
  429. package/dist/commonjs/client/Conflict/Conflict.js +4 -0
  430. package/dist/commonjs/client/Conflict/Conflict.js.map +1 -1
  431. package/dist/commonjs/client/Conflict/ConflictResponse.js +2 -0
  432. package/dist/commonjs/client/Conflict/ConflictResponse.js.map +1 -1
  433. package/dist/commonjs/client/Conflict/Conflicts.js +2 -0
  434. package/dist/commonjs/client/Conflict/Conflicts.js.map +1 -1
  435. package/dist/commonjs/client/Container/Container.js +18 -3
  436. package/dist/commonjs/client/Container/Container.js.map +1 -1
  437. package/dist/commonjs/client/Container/ContainerResponse.js +2 -0
  438. package/dist/commonjs/client/Container/ContainerResponse.js.map +1 -1
  439. package/dist/commonjs/client/Container/Containers.js +4 -2
  440. package/dist/commonjs/client/Container/Containers.js.map +1 -1
  441. package/dist/commonjs/client/Database/Database.js +33 -0
  442. package/dist/commonjs/client/Database/Database.js.map +1 -1
  443. package/dist/commonjs/client/Database/DatabaseResponse.js +2 -0
  444. package/dist/commonjs/client/Database/DatabaseResponse.js.map +1 -1
  445. package/dist/commonjs/client/Database/Databases.js +3 -0
  446. package/dist/commonjs/client/Database/Databases.js.map +1 -1
  447. package/dist/commonjs/client/Item/Item.js +4 -0
  448. package/dist/commonjs/client/Item/Item.js.map +1 -1
  449. package/dist/commonjs/client/Item/ItemResponse.js +2 -0
  450. package/dist/commonjs/client/Item/ItemResponse.js.map +1 -1
  451. package/dist/commonjs/client/Item/Items.d.ts.map +1 -1
  452. package/dist/commonjs/client/Item/Items.js +8 -0
  453. package/dist/commonjs/client/Item/Items.js.map +1 -1
  454. package/dist/commonjs/client/Offer/Offer.js +3 -0
  455. package/dist/commonjs/client/Offer/Offer.js.map +1 -1
  456. package/dist/commonjs/client/Offer/OfferResponse.js +2 -0
  457. package/dist/commonjs/client/Offer/OfferResponse.js.map +1 -1
  458. package/dist/commonjs/client/Offer/Offers.js +2 -0
  459. package/dist/commonjs/client/Offer/Offers.js.map +1 -1
  460. package/dist/commonjs/client/Permission/Permission.js +3 -0
  461. package/dist/commonjs/client/Permission/Permission.js.map +1 -1
  462. package/dist/commonjs/client/Permission/PermissionResponse.js +2 -0
  463. package/dist/commonjs/client/Permission/PermissionResponse.js.map +1 -1
  464. package/dist/commonjs/client/Permission/Permissions.js +2 -0
  465. package/dist/commonjs/client/Permission/Permissions.js.map +1 -1
  466. package/dist/commonjs/client/SasToken/SasTokenProperties.js +17 -0
  467. package/dist/commonjs/client/SasToken/SasTokenProperties.js.map +1 -1
  468. package/dist/commonjs/client/Script/Scripts.js +5 -0
  469. package/dist/commonjs/client/Script/Scripts.js.map +1 -1
  470. package/dist/commonjs/client/StoredProcedure/StoredProcedure.js +3 -0
  471. package/dist/commonjs/client/StoredProcedure/StoredProcedure.js.map +1 -1
  472. package/dist/commonjs/client/StoredProcedure/StoredProcedureResponse.js +4 -0
  473. package/dist/commonjs/client/StoredProcedure/StoredProcedureResponse.js.map +1 -1
  474. package/dist/commonjs/client/StoredProcedure/StoredProcedures.js +2 -0
  475. package/dist/commonjs/client/StoredProcedure/StoredProcedures.js.map +1 -1
  476. package/dist/commonjs/client/Trigger/Trigger.js +3 -0
  477. package/dist/commonjs/client/Trigger/Trigger.js.map +1 -1
  478. package/dist/commonjs/client/Trigger/TriggerResponse.js +2 -0
  479. package/dist/commonjs/client/Trigger/TriggerResponse.js.map +1 -1
  480. package/dist/commonjs/client/Trigger/Triggers.js +2 -0
  481. package/dist/commonjs/client/Trigger/Triggers.js.map +1 -1
  482. package/dist/commonjs/client/User/User.js +9 -0
  483. package/dist/commonjs/client/User/User.js.map +1 -1
  484. package/dist/commonjs/client/User/UserResponse.js +2 -0
  485. package/dist/commonjs/client/User/UserResponse.js.map +1 -1
  486. package/dist/commonjs/client/User/Users.js +2 -0
  487. package/dist/commonjs/client/User/Users.js.map +1 -1
  488. package/dist/commonjs/client/UserDefinedFunction/UserDefinedFunction.js +3 -0
  489. package/dist/commonjs/client/UserDefinedFunction/UserDefinedFunction.js.map +1 -1
  490. package/dist/commonjs/client/UserDefinedFunction/UserDefinedFunctionResponse.js +2 -0
  491. package/dist/commonjs/client/UserDefinedFunction/UserDefinedFunctionResponse.js.map +1 -1
  492. package/dist/commonjs/client/UserDefinedFunction/UserDefinedFunctions.js +2 -0
  493. package/dist/commonjs/client/UserDefinedFunction/UserDefinedFunctions.js.map +1 -1
  494. package/dist/commonjs/common/constants.d.ts +4 -0
  495. package/dist/commonjs/common/constants.d.ts.map +1 -1
  496. package/dist/commonjs/common/constants.js +6 -2
  497. package/dist/commonjs/common/constants.js.map +1 -1
  498. package/dist/commonjs/common/helper.d.ts +6 -0
  499. package/dist/commonjs/common/helper.d.ts.map +1 -1
  500. package/dist/commonjs/common/helper.js +9 -0
  501. package/dist/commonjs/common/helper.js.map +1 -1
  502. package/dist/commonjs/common/platform.d.ts +1 -0
  503. package/dist/commonjs/common/platform.d.ts.map +1 -1
  504. package/dist/commonjs/common/platform.js +1 -3
  505. package/dist/commonjs/common/platform.js.map +1 -1
  506. package/dist/commonjs/diagnostics/CosmosDiagnosticsContext.js +8 -7
  507. package/dist/commonjs/diagnostics/CosmosDiagnosticsContext.js.map +1 -1
  508. package/dist/commonjs/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
  509. package/dist/commonjs/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
  510. package/dist/commonjs/diagnostics/DiagnosticNodeInternal.js +26 -7
  511. package/dist/commonjs/diagnostics/DiagnosticNodeInternal.js.map +1 -1
  512. package/dist/commonjs/diagnostics/DiagnosticWriter.js +1 -3
  513. package/dist/commonjs/diagnostics/DiagnosticWriter.js.map +1 -1
  514. package/dist/commonjs/diagnostics/index.js +2 -2
  515. package/dist/commonjs/diagnostics/index.js.map +1 -1
  516. package/dist/commonjs/documents/ConnectionPolicy.d.ts +10 -4
  517. package/dist/commonjs/documents/ConnectionPolicy.d.ts.map +1 -1
  518. package/dist/commonjs/documents/ConnectionPolicy.js +2 -2
  519. package/dist/commonjs/documents/ConnectionPolicy.js.map +1 -1
  520. package/dist/commonjs/documents/DatabaseAccount.d.ts +4 -0
  521. package/dist/commonjs/documents/DatabaseAccount.d.ts.map +1 -1
  522. package/dist/commonjs/documents/DatabaseAccount.js +29 -4
  523. package/dist/commonjs/documents/DatabaseAccount.js.map +1 -1
  524. package/dist/commonjs/documents/PartitionKey.js +1 -3
  525. package/dist/commonjs/documents/PartitionKey.js.map +1 -1
  526. package/dist/commonjs/encryption/AeadAes256CbcHmacSha256Algorithm/AeadAes256CbcHmacSha256Algorithm.js +8 -2
  527. package/dist/commonjs/encryption/AeadAes256CbcHmacSha256Algorithm/AeadAes256CbcHmacSha256Algorithm.js.map +1 -1
  528. package/dist/commonjs/encryption/Cache/ClientEncryptionKeyPropertiesCache.js +2 -0
  529. package/dist/commonjs/encryption/Cache/ClientEncryptionKeyPropertiesCache.js.map +1 -1
  530. package/dist/commonjs/encryption/Cache/EncryptionSettingsCache.js +2 -0
  531. package/dist/commonjs/encryption/Cache/EncryptionSettingsCache.js.map +1 -1
  532. package/dist/commonjs/encryption/Cache/KeyEncryptionKeyCache.js +2 -0
  533. package/dist/commonjs/encryption/Cache/KeyEncryptionKeyCache.js.map +1 -1
  534. package/dist/commonjs/encryption/Cache/ProtectedDataEncryptionKeyCache.js +5 -0
  535. package/dist/commonjs/encryption/Cache/ProtectedDataEncryptionKeyCache.js.map +1 -1
  536. package/dist/commonjs/encryption/ClientEncryptionKey/ClientEncryptionKeyResponse.js +2 -0
  537. package/dist/commonjs/encryption/ClientEncryptionKey/ClientEncryptionKeyResponse.js.map +1 -1
  538. package/dist/commonjs/encryption/EncryptionItemQueryIterator.js +24 -27
  539. package/dist/commonjs/encryption/EncryptionItemQueryIterator.js.map +1 -1
  540. package/dist/commonjs/encryption/EncryptionKey/DataEncryptionKey.js +7 -2
  541. package/dist/commonjs/encryption/EncryptionKey/DataEncryptionKey.js.map +1 -1
  542. package/dist/commonjs/encryption/EncryptionKey/ProtectedDataEncryptionKey.d.ts +0 -1
  543. package/dist/commonjs/encryption/EncryptionKey/ProtectedDataEncryptionKey.d.ts.map +1 -1
  544. package/dist/commonjs/encryption/EncryptionKey/ProtectedDataEncryptionKey.js +2 -0
  545. package/dist/commonjs/encryption/EncryptionKey/ProtectedDataEncryptionKey.js.map +1 -1
  546. package/dist/commonjs/encryption/EncryptionKeyResolver/AzureKeyVaultEncryptionKeyResolver.js +6 -5
  547. package/dist/commonjs/encryption/EncryptionKeyResolver/AzureKeyVaultEncryptionKeyResolver.js.map +1 -1
  548. package/dist/commonjs/encryption/EncryptionKeyStoreProvider.js +8 -1
  549. package/dist/commonjs/encryption/EncryptionKeyStoreProvider.js.map +1 -1
  550. package/dist/commonjs/encryption/EncryptionManager.js +6 -0
  551. package/dist/commonjs/encryption/EncryptionManager.js.map +1 -1
  552. package/dist/commonjs/encryption/EncryptionProcessor.js +5 -0
  553. package/dist/commonjs/encryption/EncryptionProcessor.js.map +1 -1
  554. package/dist/commonjs/encryption/EncryptionQueryBuilder.js +2 -0
  555. package/dist/commonjs/encryption/EncryptionQueryBuilder.js.map +1 -1
  556. package/dist/commonjs/encryption/EncryptionSettingForProperty.js +6 -0
  557. package/dist/commonjs/encryption/EncryptionSettingForProperty.js.map +1 -1
  558. package/dist/commonjs/encryption/EncryptionSettings.js +6 -3
  559. package/dist/commonjs/encryption/EncryptionSettings.js.map +1 -1
  560. package/dist/commonjs/encryption/KeyEncryptionKey.js +4 -0
  561. package/dist/commonjs/encryption/KeyEncryptionKey.js.map +1 -1
  562. package/dist/commonjs/encryption/Serializers/StringSerializer.js +1 -1
  563. package/dist/commonjs/encryption/Serializers/StringSerializer.js.map +1 -1
  564. package/dist/commonjs/extractPartitionKey.js +2 -2
  565. package/dist/commonjs/extractPartitionKey.js.map +1 -1
  566. package/dist/commonjs/globalEndpointManager.d.ts +8 -0
  567. package/dist/commonjs/globalEndpointManager.d.ts.map +1 -1
  568. package/dist/commonjs/globalEndpointManager.js +104 -29
  569. package/dist/commonjs/globalEndpointManager.js.map +1 -1
  570. package/dist/commonjs/globalPartitionEndpointManager.d.ts +0 -2
  571. package/dist/commonjs/globalPartitionEndpointManager.d.ts.map +1 -1
  572. package/dist/commonjs/globalPartitionEndpointManager.js +19 -7
  573. package/dist/commonjs/globalPartitionEndpointManager.js.map +1 -1
  574. package/dist/commonjs/queryExecutionContext/Aggregators/AverageAggregator.js +2 -0
  575. package/dist/commonjs/queryExecutionContext/Aggregators/AverageAggregator.js.map +1 -1
  576. package/dist/commonjs/queryExecutionContext/Aggregators/CountAggregator.js +1 -0
  577. package/dist/commonjs/queryExecutionContext/Aggregators/CountAggregator.js.map +1 -1
  578. package/dist/commonjs/queryExecutionContext/Aggregators/GlobalStatisticsAggregator.js +1 -0
  579. package/dist/commonjs/queryExecutionContext/Aggregators/GlobalStatisticsAggregator.js.map +1 -1
  580. package/dist/commonjs/queryExecutionContext/Aggregators/MakeListAggregator.js +1 -0
  581. package/dist/commonjs/queryExecutionContext/Aggregators/MakeListAggregator.js.map +1 -1
  582. package/dist/commonjs/queryExecutionContext/Aggregators/MakeSetAggregator.js +1 -0
  583. package/dist/commonjs/queryExecutionContext/Aggregators/MakeSetAggregator.js.map +1 -1
  584. package/dist/commonjs/queryExecutionContext/Aggregators/MaxAggregator.js +2 -0
  585. package/dist/commonjs/queryExecutionContext/Aggregators/MaxAggregator.js.map +1 -1
  586. package/dist/commonjs/queryExecutionContext/Aggregators/MinAggregator.js +2 -0
  587. package/dist/commonjs/queryExecutionContext/Aggregators/MinAggregator.js.map +1 -1
  588. package/dist/commonjs/queryExecutionContext/Aggregators/StaticValueAggregator.js +1 -0
  589. package/dist/commonjs/queryExecutionContext/Aggregators/StaticValueAggregator.js.map +1 -1
  590. package/dist/commonjs/queryExecutionContext/Aggregators/SumAggregator.js +1 -0
  591. package/dist/commonjs/queryExecutionContext/Aggregators/SumAggregator.js.map +1 -1
  592. package/dist/commonjs/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js +5 -3
  593. package/dist/commonjs/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js.map +1 -1
  594. package/dist/commonjs/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js +6 -3
  595. package/dist/commonjs/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js.map +1 -1
  596. package/dist/commonjs/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js +23 -7
  597. package/dist/commonjs/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js.map +1 -1
  598. package/dist/commonjs/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js +14 -6
  599. package/dist/commonjs/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js.map +1 -1
  600. package/dist/commonjs/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js +3 -0
  601. package/dist/commonjs/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js.map +1 -1
  602. package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js +2 -0
  603. package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js.map +1 -1
  604. package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js +2 -0
  605. package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js.map +1 -1
  606. package/dist/commonjs/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js +2 -0
  607. package/dist/commonjs/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js.map +1 -1
  608. package/dist/commonjs/queryExecutionContext/FetchResult.js +4 -0
  609. package/dist/commonjs/queryExecutionContext/FetchResult.js.map +1 -1
  610. package/dist/commonjs/queryExecutionContext/defaultQueryExecutionContext.js +14 -2
  611. package/dist/commonjs/queryExecutionContext/defaultQueryExecutionContext.js.map +1 -1
  612. package/dist/commonjs/queryExecutionContext/documentProducer.js +34 -21
  613. package/dist/commonjs/queryExecutionContext/documentProducer.js.map +1 -1
  614. package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.js +41 -27
  615. package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
  616. package/dist/commonjs/queryExecutionContext/orderByComparator.js +1 -0
  617. package/dist/commonjs/queryExecutionContext/orderByComparator.js.map +1 -1
  618. package/dist/commonjs/queryExecutionContext/orderByDocumentProducerComparator.js +1 -0
  619. package/dist/commonjs/queryExecutionContext/orderByDocumentProducerComparator.js.map +1 -1
  620. package/dist/commonjs/queryExecutionContext/orderByQueryExecutionContext.js +1 -0
  621. package/dist/commonjs/queryExecutionContext/orderByQueryExecutionContext.js.map +1 -1
  622. package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.js +20 -2
  623. package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
  624. package/dist/commonjs/queryExecutionContext/pipelinedQueryExecutionContext.js +14 -4
  625. package/dist/commonjs/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
  626. package/dist/commonjs/queryIterator.js +41 -33
  627. package/dist/commonjs/queryIterator.js.map +1 -1
  628. package/dist/commonjs/queryMetrics/clientSideMetrics.js +2 -1
  629. package/dist/commonjs/queryMetrics/clientSideMetrics.js.map +1 -1
  630. package/dist/commonjs/queryMetrics/queryMetrics.js +14 -1
  631. package/dist/commonjs/queryMetrics/queryMetrics.js.map +1 -1
  632. package/dist/commonjs/queryMetrics/queryPreparationTime.js +5 -1
  633. package/dist/commonjs/queryMetrics/queryPreparationTime.js.map +1 -1
  634. package/dist/commonjs/queryMetrics/runtimeExecutionTimes.js +4 -1
  635. package/dist/commonjs/queryMetrics/runtimeExecutionTimes.js.map +1 -1
  636. package/dist/commonjs/queryMetrics/timeSpan.js +4 -3
  637. package/dist/commonjs/queryMetrics/timeSpan.js.map +1 -1
  638. package/dist/commonjs/request/ErrorResponse.js +19 -0
  639. package/dist/commonjs/request/ErrorResponse.js.map +1 -1
  640. package/dist/commonjs/request/FeedResponse.js +4 -0
  641. package/dist/commonjs/request/FeedResponse.js.map +1 -1
  642. package/dist/commonjs/request/RequestHandler.js +3 -4
  643. package/dist/commonjs/request/RequestHandler.js.map +1 -1
  644. package/dist/commonjs/request/ResourceResponse.js +5 -0
  645. package/dist/commonjs/request/ResourceResponse.js.map +1 -1
  646. package/dist/commonjs/request/SharedOptions.d.ts +5 -0
  647. package/dist/commonjs/request/SharedOptions.d.ts.map +1 -1
  648. package/dist/commonjs/request/SharedOptions.js.map +1 -1
  649. package/dist/commonjs/request/TimeoutError.js +1 -1
  650. package/dist/commonjs/request/TimeoutError.js.map +1 -1
  651. package/dist/commonjs/request/hybridSearchQueryResult.js +5 -0
  652. package/dist/commonjs/request/hybridSearchQueryResult.js.map +1 -1
  653. package/dist/commonjs/request/request.js +5 -1
  654. package/dist/commonjs/request/request.js.map +1 -1
  655. package/dist/commonjs/retry/bulkExecutionRetryPolicy.js +5 -2
  656. package/dist/commonjs/retry/bulkExecutionRetryPolicy.js.map +1 -1
  657. package/dist/commonjs/retry/defaultRetryPolicy.d.ts.map +1 -1
  658. package/dist/commonjs/retry/defaultRetryPolicy.js +6 -6
  659. package/dist/commonjs/retry/defaultRetryPolicy.js.map +1 -1
  660. package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.d.ts +3 -2
  661. package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
  662. package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.js +24 -7
  663. package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
  664. package/dist/commonjs/retry/resourceThrottleRetryPolicy.js +20 -10
  665. package/dist/commonjs/retry/resourceThrottleRetryPolicy.js.map +1 -1
  666. package/dist/commonjs/retry/retryUtility.d.ts.map +1 -1
  667. package/dist/commonjs/retry/retryUtility.js +22 -8
  668. package/dist/commonjs/retry/retryUtility.js.map +1 -1
  669. package/dist/commonjs/retry/sessionRetryPolicy.js +8 -4
  670. package/dist/commonjs/retry/sessionRetryPolicy.js.map +1 -1
  671. package/dist/commonjs/retry/timeoutFailoverRetryPolicy.d.ts +1 -2
  672. package/dist/commonjs/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
  673. package/dist/commonjs/retry/timeoutFailoverRetryPolicy.js +17 -7
  674. package/dist/commonjs/retry/timeoutFailoverRetryPolicy.js.map +1 -1
  675. package/dist/commonjs/routing/QueryRange.js +4 -0
  676. package/dist/commonjs/routing/QueryRange.js.map +1 -1
  677. package/dist/commonjs/routing/inMemoryCollectionRoutingMap.js +4 -0
  678. package/dist/commonjs/routing/inMemoryCollectionRoutingMap.js.map +1 -1
  679. package/dist/commonjs/routing/partitionKeyRangeCache.js +2 -0
  680. package/dist/commonjs/routing/partitionKeyRangeCache.js.map +1 -1
  681. package/dist/commonjs/routing/smartRoutingMapProvider.js +1 -0
  682. package/dist/commonjs/routing/smartRoutingMapProvider.js.map +1 -1
  683. package/dist/commonjs/session/VectorSessionToken.js +6 -2
  684. package/dist/commonjs/session/VectorSessionToken.js.map +1 -1
  685. package/dist/commonjs/session/sessionContainer.js +5 -3
  686. package/dist/commonjs/session/sessionContainer.js.map +1 -1
  687. package/dist/commonjs/tsdoc-metadata.json +1 -1
  688. package/dist/commonjs/utils/batch.js +15 -4
  689. package/dist/commonjs/utils/batch.js.map +1 -1
  690. package/dist/commonjs/utils/encode.d.ts +1 -1
  691. package/dist/commonjs/utils/encode.d.ts.map +1 -1
  692. package/dist/commonjs/utils/encode.js.map +1 -1
  693. package/dist/commonjs/utils/fixedSizePriorityQueue.js +4 -0
  694. package/dist/commonjs/utils/fixedSizePriorityQueue.js.map +1 -1
  695. package/dist/commonjs/utils/hashing/hash.js +1 -1
  696. package/dist/commonjs/utils/hashing/hash.js.map +1 -1
  697. package/dist/commonjs/utils/nonStreamingOrderByMap.js +2 -0
  698. package/dist/commonjs/utils/nonStreamingOrderByMap.js.map +1 -1
  699. package/dist/esm/ChangeFeedIterator.js +17 -11
  700. package/dist/esm/ChangeFeedIterator.js.map +1 -1
  701. package/dist/esm/ChangeFeedResponse.js +8 -0
  702. package/dist/esm/ChangeFeedResponse.js.map +1 -1
  703. package/dist/esm/ClientContext.d.ts.map +1 -1
  704. package/dist/esm/ClientContext.js +232 -48
  705. package/dist/esm/ClientContext.js.map +1 -1
  706. package/dist/esm/CosmosClient.d.ts +13 -0
  707. package/dist/esm/CosmosClient.d.ts.map +1 -1
  708. package/dist/esm/CosmosClient.js +53 -6
  709. package/dist/esm/CosmosClient.js.map +1 -1
  710. package/dist/esm/CosmosClientOptions.d.ts.map +1 -1
  711. package/dist/esm/CosmosClientOptions.js.map +1 -1
  712. package/dist/esm/CosmosDiagnostics.d.ts +4 -0
  713. package/dist/esm/CosmosDiagnostics.d.ts.map +1 -1
  714. package/dist/esm/CosmosDiagnostics.js +3 -0
  715. package/dist/esm/CosmosDiagnostics.js.map +1 -1
  716. package/dist/esm/GlobalEndpointManagerOptions.d.ts +2 -0
  717. package/dist/esm/GlobalEndpointManagerOptions.d.ts.map +1 -0
  718. package/dist/esm/GlobalEndpointManagerOptions.js +2 -0
  719. package/dist/esm/GlobalEndpointManagerOptions.js.map +1 -0
  720. package/dist/esm/PartitionKeyRangeFailoverInfo.js +8 -5
  721. package/dist/esm/PartitionKeyRangeFailoverInfo.js.map +1 -1
  722. package/dist/esm/bulk/Batcher.js +13 -3
  723. package/dist/esm/bulk/Batcher.js.map +1 -1
  724. package/dist/esm/bulk/BulkHelper.js +26 -11
  725. package/dist/esm/bulk/BulkHelper.js.map +1 -1
  726. package/dist/esm/bulk/BulkResponse.js +22 -20
  727. package/dist/esm/bulk/BulkResponse.js.map +1 -1
  728. package/dist/esm/bulk/CongestionAlgorithm.js +11 -4
  729. package/dist/esm/bulk/CongestionAlgorithm.js.map +1 -1
  730. package/dist/esm/bulk/HelperPerPartition.js +14 -1
  731. package/dist/esm/bulk/HelperPerPartition.js.map +1 -1
  732. package/dist/esm/bulk/ItemOperationContext.js +4 -0
  733. package/dist/esm/bulk/ItemOperationContext.js.map +1 -1
  734. package/dist/esm/bulk/Limiter.js +27 -18
  735. package/dist/esm/bulk/Limiter.js.map +1 -1
  736. package/dist/esm/bulk/PartitionMetric.js +4 -0
  737. package/dist/esm/bulk/PartitionMetric.js.map +1 -1
  738. package/dist/esm/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
  739. package/dist/esm/client/ChangeFeed/ChangeFeedForEpkRange.js +29 -15
  740. package/dist/esm/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
  741. package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
  742. package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.js +19 -8
  743. package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
  744. package/dist/esm/client/ChangeFeed/ChangeFeedIteratorBuilder.js +12 -9
  745. package/dist/esm/client/ChangeFeed/ChangeFeedIteratorBuilder.js.map +1 -1
  746. package/dist/esm/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +5 -0
  747. package/dist/esm/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
  748. package/dist/esm/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
  749. package/dist/esm/client/ChangeFeed/ChangeFeedIteratorResponse.js +9 -0
  750. package/dist/esm/client/ChangeFeed/ChangeFeedIteratorResponse.js.map +1 -1
  751. package/dist/esm/client/ChangeFeed/ChangeFeedPolicy.js +1 -0
  752. package/dist/esm/client/ChangeFeed/ChangeFeedPolicy.js.map +1 -1
  753. package/dist/esm/client/ChangeFeed/ChangeFeedRange.js +20 -0
  754. package/dist/esm/client/ChangeFeed/ChangeFeedRange.js.map +1 -1
  755. package/dist/esm/client/ChangeFeed/ChangeFeedRetentionTimeSpan.js +1 -0
  756. package/dist/esm/client/ChangeFeed/ChangeFeedRetentionTimeSpan.js.map +1 -1
  757. package/dist/esm/client/ChangeFeed/ChangeFeedStartFromBeginning.js +1 -0
  758. package/dist/esm/client/ChangeFeed/ChangeFeedStartFromBeginning.js.map +1 -1
  759. package/dist/esm/client/ChangeFeed/ChangeFeedStartFromContinuation.js +1 -0
  760. package/dist/esm/client/ChangeFeed/ChangeFeedStartFromContinuation.js.map +1 -1
  761. package/dist/esm/client/ChangeFeed/ChangeFeedStartFromNow.js +1 -0
  762. package/dist/esm/client/ChangeFeed/ChangeFeedStartFromNow.js.map +1 -1
  763. package/dist/esm/client/ChangeFeed/ChangeFeedStartFromTime.js +2 -0
  764. package/dist/esm/client/ChangeFeed/ChangeFeedStartFromTime.js.map +1 -1
  765. package/dist/esm/client/ChangeFeed/CompositeContinuationToken.js +8 -0
  766. package/dist/esm/client/ChangeFeed/CompositeContinuationToken.js.map +1 -1
  767. package/dist/esm/client/ChangeFeed/ContinuationTokenForPartitionKey.js +12 -0
  768. package/dist/esm/client/ChangeFeed/ContinuationTokenForPartitionKey.js.map +1 -1
  769. package/dist/esm/client/ChangeFeed/FeedRange.js +8 -0
  770. package/dist/esm/client/ChangeFeed/FeedRange.js.map +1 -1
  771. package/dist/esm/client/ChangeFeed/FeedRangeQueue.js +1 -0
  772. package/dist/esm/client/ChangeFeed/FeedRangeQueue.js.map +1 -1
  773. package/dist/esm/client/ChangeFeed/InternalChangeFeedOptions.d.ts +1 -0
  774. package/dist/esm/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
  775. package/dist/esm/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
  776. package/dist/esm/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
  777. package/dist/esm/client/ChangeFeed/changeFeedUtils.js +6 -5
  778. package/dist/esm/client/ChangeFeed/changeFeedUtils.js.map +1 -1
  779. package/dist/esm/client/ClientUtils.js +1 -1
  780. package/dist/esm/client/ClientUtils.js.map +1 -1
  781. package/dist/esm/client/Conflict/Conflict.js +4 -0
  782. package/dist/esm/client/Conflict/Conflict.js.map +1 -1
  783. package/dist/esm/client/Conflict/ConflictResponse.js +2 -0
  784. package/dist/esm/client/Conflict/ConflictResponse.js.map +1 -1
  785. package/dist/esm/client/Conflict/Conflicts.js +2 -0
  786. package/dist/esm/client/Conflict/Conflicts.js.map +1 -1
  787. package/dist/esm/client/Container/Container.js +18 -3
  788. package/dist/esm/client/Container/Container.js.map +1 -1
  789. package/dist/esm/client/Container/ContainerResponse.js +2 -0
  790. package/dist/esm/client/Container/ContainerResponse.js.map +1 -1
  791. package/dist/esm/client/Container/Containers.js +4 -2
  792. package/dist/esm/client/Container/Containers.js.map +1 -1
  793. package/dist/esm/client/Database/Database.js +33 -0
  794. package/dist/esm/client/Database/Database.js.map +1 -1
  795. package/dist/esm/client/Database/DatabaseResponse.js +2 -0
  796. package/dist/esm/client/Database/DatabaseResponse.js.map +1 -1
  797. package/dist/esm/client/Database/Databases.js +3 -0
  798. package/dist/esm/client/Database/Databases.js.map +1 -1
  799. package/dist/esm/client/Item/Item.js +4 -0
  800. package/dist/esm/client/Item/Item.js.map +1 -1
  801. package/dist/esm/client/Item/ItemResponse.js +2 -0
  802. package/dist/esm/client/Item/ItemResponse.js.map +1 -1
  803. package/dist/esm/client/Item/Items.d.ts.map +1 -1
  804. package/dist/esm/client/Item/Items.js +8 -0
  805. package/dist/esm/client/Item/Items.js.map +1 -1
  806. package/dist/esm/client/Offer/Offer.js +3 -0
  807. package/dist/esm/client/Offer/Offer.js.map +1 -1
  808. package/dist/esm/client/Offer/OfferResponse.js +2 -0
  809. package/dist/esm/client/Offer/OfferResponse.js.map +1 -1
  810. package/dist/esm/client/Offer/Offers.js +2 -0
  811. package/dist/esm/client/Offer/Offers.js.map +1 -1
  812. package/dist/esm/client/Permission/Permission.js +3 -0
  813. package/dist/esm/client/Permission/Permission.js.map +1 -1
  814. package/dist/esm/client/Permission/PermissionResponse.js +2 -0
  815. package/dist/esm/client/Permission/PermissionResponse.js.map +1 -1
  816. package/dist/esm/client/Permission/Permissions.js +2 -0
  817. package/dist/esm/client/Permission/Permissions.js.map +1 -1
  818. package/dist/esm/client/SasToken/SasTokenProperties.js +17 -0
  819. package/dist/esm/client/SasToken/SasTokenProperties.js.map +1 -1
  820. package/dist/esm/client/Script/Scripts.js +5 -0
  821. package/dist/esm/client/Script/Scripts.js.map +1 -1
  822. package/dist/esm/client/StoredProcedure/StoredProcedure.js +3 -0
  823. package/dist/esm/client/StoredProcedure/StoredProcedure.js.map +1 -1
  824. package/dist/esm/client/StoredProcedure/StoredProcedureResponse.js +4 -0
  825. package/dist/esm/client/StoredProcedure/StoredProcedureResponse.js.map +1 -1
  826. package/dist/esm/client/StoredProcedure/StoredProcedures.js +2 -0
  827. package/dist/esm/client/StoredProcedure/StoredProcedures.js.map +1 -1
  828. package/dist/esm/client/Trigger/Trigger.js +3 -0
  829. package/dist/esm/client/Trigger/Trigger.js.map +1 -1
  830. package/dist/esm/client/Trigger/TriggerResponse.js +2 -0
  831. package/dist/esm/client/Trigger/TriggerResponse.js.map +1 -1
  832. package/dist/esm/client/Trigger/Triggers.js +2 -0
  833. package/dist/esm/client/Trigger/Triggers.js.map +1 -1
  834. package/dist/esm/client/User/User.js +9 -0
  835. package/dist/esm/client/User/User.js.map +1 -1
  836. package/dist/esm/client/User/UserResponse.js +2 -0
  837. package/dist/esm/client/User/UserResponse.js.map +1 -1
  838. package/dist/esm/client/User/Users.js +2 -0
  839. package/dist/esm/client/User/Users.js.map +1 -1
  840. package/dist/esm/client/UserDefinedFunction/UserDefinedFunction.js +3 -0
  841. package/dist/esm/client/UserDefinedFunction/UserDefinedFunction.js.map +1 -1
  842. package/dist/esm/client/UserDefinedFunction/UserDefinedFunctionResponse.js +2 -0
  843. package/dist/esm/client/UserDefinedFunction/UserDefinedFunctionResponse.js.map +1 -1
  844. package/dist/esm/client/UserDefinedFunction/UserDefinedFunctions.js +2 -0
  845. package/dist/esm/client/UserDefinedFunction/UserDefinedFunctions.js.map +1 -1
  846. package/dist/esm/common/constants.d.ts +4 -0
  847. package/dist/esm/common/constants.d.ts.map +1 -1
  848. package/dist/esm/common/constants.js +5 -1
  849. package/dist/esm/common/constants.js.map +1 -1
  850. package/dist/esm/common/helper.d.ts +6 -0
  851. package/dist/esm/common/helper.d.ts.map +1 -1
  852. package/dist/esm/common/helper.js +9 -1
  853. package/dist/esm/common/helper.js.map +1 -1
  854. package/dist/esm/common/platform.d.ts +1 -0
  855. package/dist/esm/common/platform.d.ts.map +1 -1
  856. package/dist/esm/common/platform.js +1 -3
  857. package/dist/esm/common/platform.js.map +1 -1
  858. package/dist/esm/diagnostics/CosmosDiagnosticsContext.js +8 -7
  859. package/dist/esm/diagnostics/CosmosDiagnosticsContext.js.map +1 -1
  860. package/dist/esm/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
  861. package/dist/esm/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
  862. package/dist/esm/diagnostics/DiagnosticNodeInternal.js +26 -7
  863. package/dist/esm/diagnostics/DiagnosticNodeInternal.js.map +1 -1
  864. package/dist/esm/diagnostics/DiagnosticWriter.js +1 -3
  865. package/dist/esm/diagnostics/DiagnosticWriter.js.map +1 -1
  866. package/dist/esm/diagnostics/index.js +2 -2
  867. package/dist/esm/diagnostics/index.js.map +1 -1
  868. package/dist/esm/documents/ConnectionPolicy.d.ts +10 -4
  869. package/dist/esm/documents/ConnectionPolicy.d.ts.map +1 -1
  870. package/dist/esm/documents/ConnectionPolicy.js +2 -2
  871. package/dist/esm/documents/ConnectionPolicy.js.map +1 -1
  872. package/dist/esm/documents/DatabaseAccount.d.ts +4 -0
  873. package/dist/esm/documents/DatabaseAccount.d.ts.map +1 -1
  874. package/dist/esm/documents/DatabaseAccount.js +29 -4
  875. package/dist/esm/documents/DatabaseAccount.js.map +1 -1
  876. package/dist/esm/documents/PartitionKey.js +1 -3
  877. package/dist/esm/documents/PartitionKey.js.map +1 -1
  878. package/dist/esm/encryption/AeadAes256CbcHmacSha256Algorithm/AeadAes256CbcHmacSha256Algorithm.js +8 -2
  879. package/dist/esm/encryption/AeadAes256CbcHmacSha256Algorithm/AeadAes256CbcHmacSha256Algorithm.js.map +1 -1
  880. package/dist/esm/encryption/Cache/ClientEncryptionKeyPropertiesCache.js +2 -0
  881. package/dist/esm/encryption/Cache/ClientEncryptionKeyPropertiesCache.js.map +1 -1
  882. package/dist/esm/encryption/Cache/EncryptionSettingsCache.js +2 -0
  883. package/dist/esm/encryption/Cache/EncryptionSettingsCache.js.map +1 -1
  884. package/dist/esm/encryption/Cache/KeyEncryptionKeyCache.js +2 -0
  885. package/dist/esm/encryption/Cache/KeyEncryptionKeyCache.js.map +1 -1
  886. package/dist/esm/encryption/Cache/ProtectedDataEncryptionKeyCache.js +5 -0
  887. package/dist/esm/encryption/Cache/ProtectedDataEncryptionKeyCache.js.map +1 -1
  888. package/dist/esm/encryption/ClientEncryptionKey/ClientEncryptionKeyResponse.js +2 -0
  889. package/dist/esm/encryption/ClientEncryptionKey/ClientEncryptionKeyResponse.js.map +1 -1
  890. package/dist/esm/encryption/EncryptionItemQueryIterator.js +24 -27
  891. package/dist/esm/encryption/EncryptionItemQueryIterator.js.map +1 -1
  892. package/dist/esm/encryption/EncryptionKey/DataEncryptionKey.js +7 -2
  893. package/dist/esm/encryption/EncryptionKey/DataEncryptionKey.js.map +1 -1
  894. package/dist/esm/encryption/EncryptionKey/ProtectedDataEncryptionKey.d.ts +0 -1
  895. package/dist/esm/encryption/EncryptionKey/ProtectedDataEncryptionKey.d.ts.map +1 -1
  896. package/dist/esm/encryption/EncryptionKey/ProtectedDataEncryptionKey.js +2 -0
  897. package/dist/esm/encryption/EncryptionKey/ProtectedDataEncryptionKey.js.map +1 -1
  898. package/dist/esm/encryption/EncryptionKeyResolver/AzureKeyVaultEncryptionKeyResolver.js +6 -5
  899. package/dist/esm/encryption/EncryptionKeyResolver/AzureKeyVaultEncryptionKeyResolver.js.map +1 -1
  900. package/dist/esm/encryption/EncryptionKeyStoreProvider.js +8 -1
  901. package/dist/esm/encryption/EncryptionKeyStoreProvider.js.map +1 -1
  902. package/dist/esm/encryption/EncryptionManager.js +6 -0
  903. package/dist/esm/encryption/EncryptionManager.js.map +1 -1
  904. package/dist/esm/encryption/EncryptionProcessor.js +5 -0
  905. package/dist/esm/encryption/EncryptionProcessor.js.map +1 -1
  906. package/dist/esm/encryption/EncryptionQueryBuilder.js +2 -0
  907. package/dist/esm/encryption/EncryptionQueryBuilder.js.map +1 -1
  908. package/dist/esm/encryption/EncryptionSettingForProperty.js +6 -0
  909. package/dist/esm/encryption/EncryptionSettingForProperty.js.map +1 -1
  910. package/dist/esm/encryption/EncryptionSettings.js +6 -3
  911. package/dist/esm/encryption/EncryptionSettings.js.map +1 -1
  912. package/dist/esm/encryption/KeyEncryptionKey.js +4 -0
  913. package/dist/esm/encryption/KeyEncryptionKey.js.map +1 -1
  914. package/dist/esm/encryption/Serializers/StringSerializer.js +1 -1
  915. package/dist/esm/encryption/Serializers/StringSerializer.js.map +1 -1
  916. package/dist/esm/extractPartitionKey.js +2 -2
  917. package/dist/esm/extractPartitionKey.js.map +1 -1
  918. package/dist/esm/globalEndpointManager.d.ts +8 -0
  919. package/dist/esm/globalEndpointManager.d.ts.map +1 -1
  920. package/dist/esm/globalEndpointManager.js +104 -29
  921. package/dist/esm/globalEndpointManager.js.map +1 -1
  922. package/dist/esm/globalPartitionEndpointManager.d.ts +0 -2
  923. package/dist/esm/globalPartitionEndpointManager.d.ts.map +1 -1
  924. package/dist/esm/globalPartitionEndpointManager.js +19 -7
  925. package/dist/esm/globalPartitionEndpointManager.js.map +1 -1
  926. package/dist/esm/queryExecutionContext/Aggregators/AverageAggregator.js +2 -0
  927. package/dist/esm/queryExecutionContext/Aggregators/AverageAggregator.js.map +1 -1
  928. package/dist/esm/queryExecutionContext/Aggregators/CountAggregator.js +1 -0
  929. package/dist/esm/queryExecutionContext/Aggregators/CountAggregator.js.map +1 -1
  930. package/dist/esm/queryExecutionContext/Aggregators/GlobalStatisticsAggregator.js +1 -0
  931. package/dist/esm/queryExecutionContext/Aggregators/GlobalStatisticsAggregator.js.map +1 -1
  932. package/dist/esm/queryExecutionContext/Aggregators/MakeListAggregator.js +1 -0
  933. package/dist/esm/queryExecutionContext/Aggregators/MakeListAggregator.js.map +1 -1
  934. package/dist/esm/queryExecutionContext/Aggregators/MakeSetAggregator.js +1 -0
  935. package/dist/esm/queryExecutionContext/Aggregators/MakeSetAggregator.js.map +1 -1
  936. package/dist/esm/queryExecutionContext/Aggregators/MaxAggregator.js +2 -0
  937. package/dist/esm/queryExecutionContext/Aggregators/MaxAggregator.js.map +1 -1
  938. package/dist/esm/queryExecutionContext/Aggregators/MinAggregator.js +2 -0
  939. package/dist/esm/queryExecutionContext/Aggregators/MinAggregator.js.map +1 -1
  940. package/dist/esm/queryExecutionContext/Aggregators/StaticValueAggregator.js +1 -0
  941. package/dist/esm/queryExecutionContext/Aggregators/StaticValueAggregator.js.map +1 -1
  942. package/dist/esm/queryExecutionContext/Aggregators/SumAggregator.js +1 -0
  943. package/dist/esm/queryExecutionContext/Aggregators/SumAggregator.js.map +1 -1
  944. package/dist/esm/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js +5 -3
  945. package/dist/esm/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js.map +1 -1
  946. package/dist/esm/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js +6 -3
  947. package/dist/esm/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js.map +1 -1
  948. package/dist/esm/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js +23 -7
  949. package/dist/esm/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js.map +1 -1
  950. package/dist/esm/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js +14 -6
  951. package/dist/esm/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js.map +1 -1
  952. package/dist/esm/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js +3 -0
  953. package/dist/esm/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js.map +1 -1
  954. package/dist/esm/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js +2 -0
  955. package/dist/esm/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js.map +1 -1
  956. package/dist/esm/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js +2 -0
  957. package/dist/esm/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js.map +1 -1
  958. package/dist/esm/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js +2 -0
  959. package/dist/esm/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js.map +1 -1
  960. package/dist/esm/queryExecutionContext/FetchResult.js +4 -0
  961. package/dist/esm/queryExecutionContext/FetchResult.js.map +1 -1
  962. package/dist/esm/queryExecutionContext/defaultQueryExecutionContext.js +14 -2
  963. package/dist/esm/queryExecutionContext/defaultQueryExecutionContext.js.map +1 -1
  964. package/dist/esm/queryExecutionContext/documentProducer.js +34 -21
  965. package/dist/esm/queryExecutionContext/documentProducer.js.map +1 -1
  966. package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.js +41 -27
  967. package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
  968. package/dist/esm/queryExecutionContext/orderByComparator.js +1 -0
  969. package/dist/esm/queryExecutionContext/orderByComparator.js.map +1 -1
  970. package/dist/esm/queryExecutionContext/orderByDocumentProducerComparator.js +1 -0
  971. package/dist/esm/queryExecutionContext/orderByDocumentProducerComparator.js.map +1 -1
  972. package/dist/esm/queryExecutionContext/orderByQueryExecutionContext.js +1 -0
  973. package/dist/esm/queryExecutionContext/orderByQueryExecutionContext.js.map +1 -1
  974. package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.js +20 -2
  975. package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
  976. package/dist/esm/queryExecutionContext/pipelinedQueryExecutionContext.js +14 -4
  977. package/dist/esm/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
  978. package/dist/esm/queryIterator.js +41 -33
  979. package/dist/esm/queryIterator.js.map +1 -1
  980. package/dist/esm/queryMetrics/clientSideMetrics.js +2 -1
  981. package/dist/esm/queryMetrics/clientSideMetrics.js.map +1 -1
  982. package/dist/esm/queryMetrics/queryMetrics.js +14 -1
  983. package/dist/esm/queryMetrics/queryMetrics.js.map +1 -1
  984. package/dist/esm/queryMetrics/queryPreparationTime.js +5 -1
  985. package/dist/esm/queryMetrics/queryPreparationTime.js.map +1 -1
  986. package/dist/esm/queryMetrics/runtimeExecutionTimes.js +4 -1
  987. package/dist/esm/queryMetrics/runtimeExecutionTimes.js.map +1 -1
  988. package/dist/esm/queryMetrics/timeSpan.js +4 -3
  989. package/dist/esm/queryMetrics/timeSpan.js.map +1 -1
  990. package/dist/esm/request/ErrorResponse.js +19 -0
  991. package/dist/esm/request/ErrorResponse.js.map +1 -1
  992. package/dist/esm/request/FeedResponse.js +4 -0
  993. package/dist/esm/request/FeedResponse.js.map +1 -1
  994. package/dist/esm/request/RequestHandler.js +3 -4
  995. package/dist/esm/request/RequestHandler.js.map +1 -1
  996. package/dist/esm/request/ResourceResponse.js +5 -0
  997. package/dist/esm/request/ResourceResponse.js.map +1 -1
  998. package/dist/esm/request/SharedOptions.d.ts +5 -0
  999. package/dist/esm/request/SharedOptions.d.ts.map +1 -1
  1000. package/dist/esm/request/SharedOptions.js.map +1 -1
  1001. package/dist/esm/request/TimeoutError.js +1 -1
  1002. package/dist/esm/request/TimeoutError.js.map +1 -1
  1003. package/dist/esm/request/hybridSearchQueryResult.js +5 -0
  1004. package/dist/esm/request/hybridSearchQueryResult.js.map +1 -1
  1005. package/dist/esm/request/request.js +5 -1
  1006. package/dist/esm/request/request.js.map +1 -1
  1007. package/dist/esm/retry/bulkExecutionRetryPolicy.js +5 -2
  1008. package/dist/esm/retry/bulkExecutionRetryPolicy.js.map +1 -1
  1009. package/dist/esm/retry/defaultRetryPolicy.d.ts.map +1 -1
  1010. package/dist/esm/retry/defaultRetryPolicy.js +7 -7
  1011. package/dist/esm/retry/defaultRetryPolicy.js.map +1 -1
  1012. package/dist/esm/retry/endpointDiscoveryRetryPolicy.d.ts +3 -2
  1013. package/dist/esm/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
  1014. package/dist/esm/retry/endpointDiscoveryRetryPolicy.js +24 -7
  1015. package/dist/esm/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
  1016. package/dist/esm/retry/resourceThrottleRetryPolicy.js +20 -10
  1017. package/dist/esm/retry/resourceThrottleRetryPolicy.js.map +1 -1
  1018. package/dist/esm/retry/retryUtility.d.ts.map +1 -1
  1019. package/dist/esm/retry/retryUtility.js +22 -8
  1020. package/dist/esm/retry/retryUtility.js.map +1 -1
  1021. package/dist/esm/retry/sessionRetryPolicy.js +8 -4
  1022. package/dist/esm/retry/sessionRetryPolicy.js.map +1 -1
  1023. package/dist/esm/retry/timeoutFailoverRetryPolicy.d.ts +1 -2
  1024. package/dist/esm/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
  1025. package/dist/esm/retry/timeoutFailoverRetryPolicy.js +17 -7
  1026. package/dist/esm/retry/timeoutFailoverRetryPolicy.js.map +1 -1
  1027. package/dist/esm/routing/QueryRange.js +4 -0
  1028. package/dist/esm/routing/QueryRange.js.map +1 -1
  1029. package/dist/esm/routing/inMemoryCollectionRoutingMap.js +4 -0
  1030. package/dist/esm/routing/inMemoryCollectionRoutingMap.js.map +1 -1
  1031. package/dist/esm/routing/partitionKeyRangeCache.js +2 -0
  1032. package/dist/esm/routing/partitionKeyRangeCache.js.map +1 -1
  1033. package/dist/esm/routing/smartRoutingMapProvider.js +1 -0
  1034. package/dist/esm/routing/smartRoutingMapProvider.js.map +1 -1
  1035. package/dist/esm/session/VectorSessionToken.js +6 -2
  1036. package/dist/esm/session/VectorSessionToken.js.map +1 -1
  1037. package/dist/esm/session/sessionContainer.js +5 -3
  1038. package/dist/esm/session/sessionContainer.js.map +1 -1
  1039. package/dist/esm/utils/batch.js +15 -4
  1040. package/dist/esm/utils/batch.js.map +1 -1
  1041. package/dist/esm/utils/encode.d.ts +1 -1
  1042. package/dist/esm/utils/encode.d.ts.map +1 -1
  1043. package/dist/esm/utils/encode.js.map +1 -1
  1044. package/dist/esm/utils/fixedSizePriorityQueue.js +4 -0
  1045. package/dist/esm/utils/fixedSizePriorityQueue.js.map +1 -1
  1046. package/dist/esm/utils/hashing/hash.js +1 -1
  1047. package/dist/esm/utils/hashing/hash.js.map +1 -1
  1048. package/dist/esm/utils/nonStreamingOrderByMap.js +2 -0
  1049. package/dist/esm/utils/nonStreamingOrderByMap.js.map +1 -1
  1050. package/dist/react-native/ChangeFeedIterator.js +17 -11
  1051. package/dist/react-native/ChangeFeedIterator.js.map +1 -1
  1052. package/dist/react-native/ChangeFeedResponse.js +8 -0
  1053. package/dist/react-native/ChangeFeedResponse.js.map +1 -1
  1054. package/dist/react-native/ClientContext.d.ts.map +1 -1
  1055. package/dist/react-native/ClientContext.js +232 -48
  1056. package/dist/react-native/ClientContext.js.map +1 -1
  1057. package/dist/react-native/CosmosClient.d.ts +13 -0
  1058. package/dist/react-native/CosmosClient.d.ts.map +1 -1
  1059. package/dist/react-native/CosmosClient.js +53 -6
  1060. package/dist/react-native/CosmosClient.js.map +1 -1
  1061. package/dist/react-native/CosmosClientOptions.d.ts.map +1 -1
  1062. package/dist/react-native/CosmosClientOptions.js.map +1 -1
  1063. package/dist/react-native/CosmosDiagnostics.d.ts +4 -0
  1064. package/dist/react-native/CosmosDiagnostics.d.ts.map +1 -1
  1065. package/dist/react-native/CosmosDiagnostics.js +3 -0
  1066. package/dist/react-native/CosmosDiagnostics.js.map +1 -1
  1067. package/dist/react-native/GlobalEndpointManagerOptions.d.ts +2 -0
  1068. package/dist/react-native/GlobalEndpointManagerOptions.d.ts.map +1 -0
  1069. package/dist/react-native/GlobalEndpointManagerOptions.js +2 -0
  1070. package/dist/react-native/GlobalEndpointManagerOptions.js.map +1 -0
  1071. package/dist/react-native/PartitionKeyRangeFailoverInfo.js +8 -5
  1072. package/dist/react-native/PartitionKeyRangeFailoverInfo.js.map +1 -1
  1073. package/dist/react-native/bulk/Batcher.js +13 -3
  1074. package/dist/react-native/bulk/Batcher.js.map +1 -1
  1075. package/dist/react-native/bulk/BulkHelper.js +26 -11
  1076. package/dist/react-native/bulk/BulkHelper.js.map +1 -1
  1077. package/dist/react-native/bulk/BulkResponse.js +22 -20
  1078. package/dist/react-native/bulk/BulkResponse.js.map +1 -1
  1079. package/dist/react-native/bulk/CongestionAlgorithm.js +11 -4
  1080. package/dist/react-native/bulk/CongestionAlgorithm.js.map +1 -1
  1081. package/dist/react-native/bulk/HelperPerPartition.js +14 -1
  1082. package/dist/react-native/bulk/HelperPerPartition.js.map +1 -1
  1083. package/dist/react-native/bulk/ItemOperationContext.js +4 -0
  1084. package/dist/react-native/bulk/ItemOperationContext.js.map +1 -1
  1085. package/dist/react-native/bulk/Limiter.js +27 -18
  1086. package/dist/react-native/bulk/Limiter.js.map +1 -1
  1087. package/dist/react-native/bulk/PartitionMetric.js +4 -0
  1088. package/dist/react-native/bulk/PartitionMetric.js.map +1 -1
  1089. package/dist/react-native/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
  1090. package/dist/react-native/client/ChangeFeed/ChangeFeedForEpkRange.js +29 -15
  1091. package/dist/react-native/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
  1092. package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
  1093. package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.js +19 -8
  1094. package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
  1095. package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorBuilder.js +12 -9
  1096. package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorBuilder.js.map +1 -1
  1097. package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +5 -0
  1098. package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
  1099. package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
  1100. package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorResponse.js +9 -0
  1101. package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorResponse.js.map +1 -1
  1102. package/dist/react-native/client/ChangeFeed/ChangeFeedPolicy.js +1 -0
  1103. package/dist/react-native/client/ChangeFeed/ChangeFeedPolicy.js.map +1 -1
  1104. package/dist/react-native/client/ChangeFeed/ChangeFeedRange.js +20 -0
  1105. package/dist/react-native/client/ChangeFeed/ChangeFeedRange.js.map +1 -1
  1106. package/dist/react-native/client/ChangeFeed/ChangeFeedRetentionTimeSpan.js +1 -0
  1107. package/dist/react-native/client/ChangeFeed/ChangeFeedRetentionTimeSpan.js.map +1 -1
  1108. package/dist/react-native/client/ChangeFeed/ChangeFeedStartFromBeginning.js +1 -0
  1109. package/dist/react-native/client/ChangeFeed/ChangeFeedStartFromBeginning.js.map +1 -1
  1110. package/dist/react-native/client/ChangeFeed/ChangeFeedStartFromContinuation.js +1 -0
  1111. package/dist/react-native/client/ChangeFeed/ChangeFeedStartFromContinuation.js.map +1 -1
  1112. package/dist/react-native/client/ChangeFeed/ChangeFeedStartFromNow.js +1 -0
  1113. package/dist/react-native/client/ChangeFeed/ChangeFeedStartFromNow.js.map +1 -1
  1114. package/dist/react-native/client/ChangeFeed/ChangeFeedStartFromTime.js +2 -0
  1115. package/dist/react-native/client/ChangeFeed/ChangeFeedStartFromTime.js.map +1 -1
  1116. package/dist/react-native/client/ChangeFeed/CompositeContinuationToken.js +8 -0
  1117. package/dist/react-native/client/ChangeFeed/CompositeContinuationToken.js.map +1 -1
  1118. package/dist/react-native/client/ChangeFeed/ContinuationTokenForPartitionKey.js +12 -0
  1119. package/dist/react-native/client/ChangeFeed/ContinuationTokenForPartitionKey.js.map +1 -1
  1120. package/dist/react-native/client/ChangeFeed/FeedRange.js +8 -0
  1121. package/dist/react-native/client/ChangeFeed/FeedRange.js.map +1 -1
  1122. package/dist/react-native/client/ChangeFeed/FeedRangeQueue.js +1 -0
  1123. package/dist/react-native/client/ChangeFeed/FeedRangeQueue.js.map +1 -1
  1124. package/dist/react-native/client/ChangeFeed/InternalChangeFeedOptions.d.ts +1 -0
  1125. package/dist/react-native/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
  1126. package/dist/react-native/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
  1127. package/dist/react-native/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
  1128. package/dist/react-native/client/ChangeFeed/changeFeedUtils.js +6 -5
  1129. package/dist/react-native/client/ChangeFeed/changeFeedUtils.js.map +1 -1
  1130. package/dist/react-native/client/ClientUtils.js +1 -1
  1131. package/dist/react-native/client/ClientUtils.js.map +1 -1
  1132. package/dist/react-native/client/Conflict/Conflict.js +4 -0
  1133. package/dist/react-native/client/Conflict/Conflict.js.map +1 -1
  1134. package/dist/react-native/client/Conflict/ConflictResponse.js +2 -0
  1135. package/dist/react-native/client/Conflict/ConflictResponse.js.map +1 -1
  1136. package/dist/react-native/client/Conflict/Conflicts.js +2 -0
  1137. package/dist/react-native/client/Conflict/Conflicts.js.map +1 -1
  1138. package/dist/react-native/client/Container/Container.js +18 -3
  1139. package/dist/react-native/client/Container/Container.js.map +1 -1
  1140. package/dist/react-native/client/Container/ContainerResponse.js +2 -0
  1141. package/dist/react-native/client/Container/ContainerResponse.js.map +1 -1
  1142. package/dist/react-native/client/Container/Containers.js +4 -2
  1143. package/dist/react-native/client/Container/Containers.js.map +1 -1
  1144. package/dist/react-native/client/Database/Database.js +33 -0
  1145. package/dist/react-native/client/Database/Database.js.map +1 -1
  1146. package/dist/react-native/client/Database/DatabaseResponse.js +2 -0
  1147. package/dist/react-native/client/Database/DatabaseResponse.js.map +1 -1
  1148. package/dist/react-native/client/Database/Databases.js +3 -0
  1149. package/dist/react-native/client/Database/Databases.js.map +1 -1
  1150. package/dist/react-native/client/Item/Item.js +4 -0
  1151. package/dist/react-native/client/Item/Item.js.map +1 -1
  1152. package/dist/react-native/client/Item/ItemResponse.js +2 -0
  1153. package/dist/react-native/client/Item/ItemResponse.js.map +1 -1
  1154. package/dist/react-native/client/Item/Items.d.ts.map +1 -1
  1155. package/dist/react-native/client/Item/Items.js +8 -0
  1156. package/dist/react-native/client/Item/Items.js.map +1 -1
  1157. package/dist/react-native/client/Offer/Offer.js +3 -0
  1158. package/dist/react-native/client/Offer/Offer.js.map +1 -1
  1159. package/dist/react-native/client/Offer/OfferResponse.js +2 -0
  1160. package/dist/react-native/client/Offer/OfferResponse.js.map +1 -1
  1161. package/dist/react-native/client/Offer/Offers.js +2 -0
  1162. package/dist/react-native/client/Offer/Offers.js.map +1 -1
  1163. package/dist/react-native/client/Permission/Permission.js +3 -0
  1164. package/dist/react-native/client/Permission/Permission.js.map +1 -1
  1165. package/dist/react-native/client/Permission/PermissionResponse.js +2 -0
  1166. package/dist/react-native/client/Permission/PermissionResponse.js.map +1 -1
  1167. package/dist/react-native/client/Permission/Permissions.js +2 -0
  1168. package/dist/react-native/client/Permission/Permissions.js.map +1 -1
  1169. package/dist/react-native/client/SasToken/SasTokenProperties.js +17 -0
  1170. package/dist/react-native/client/SasToken/SasTokenProperties.js.map +1 -1
  1171. package/dist/react-native/client/Script/Scripts.js +5 -0
  1172. package/dist/react-native/client/Script/Scripts.js.map +1 -1
  1173. package/dist/react-native/client/StoredProcedure/StoredProcedure.js +3 -0
  1174. package/dist/react-native/client/StoredProcedure/StoredProcedure.js.map +1 -1
  1175. package/dist/react-native/client/StoredProcedure/StoredProcedureResponse.js +4 -0
  1176. package/dist/react-native/client/StoredProcedure/StoredProcedureResponse.js.map +1 -1
  1177. package/dist/react-native/client/StoredProcedure/StoredProcedures.js +2 -0
  1178. package/dist/react-native/client/StoredProcedure/StoredProcedures.js.map +1 -1
  1179. package/dist/react-native/client/Trigger/Trigger.js +3 -0
  1180. package/dist/react-native/client/Trigger/Trigger.js.map +1 -1
  1181. package/dist/react-native/client/Trigger/TriggerResponse.js +2 -0
  1182. package/dist/react-native/client/Trigger/TriggerResponse.js.map +1 -1
  1183. package/dist/react-native/client/Trigger/Triggers.js +2 -0
  1184. package/dist/react-native/client/Trigger/Triggers.js.map +1 -1
  1185. package/dist/react-native/client/User/User.js +9 -0
  1186. package/dist/react-native/client/User/User.js.map +1 -1
  1187. package/dist/react-native/client/User/UserResponse.js +2 -0
  1188. package/dist/react-native/client/User/UserResponse.js.map +1 -1
  1189. package/dist/react-native/client/User/Users.js +2 -0
  1190. package/dist/react-native/client/User/Users.js.map +1 -1
  1191. package/dist/react-native/client/UserDefinedFunction/UserDefinedFunction.js +3 -0
  1192. package/dist/react-native/client/UserDefinedFunction/UserDefinedFunction.js.map +1 -1
  1193. package/dist/react-native/client/UserDefinedFunction/UserDefinedFunctionResponse.js +2 -0
  1194. package/dist/react-native/client/UserDefinedFunction/UserDefinedFunctionResponse.js.map +1 -1
  1195. package/dist/react-native/client/UserDefinedFunction/UserDefinedFunctions.js +2 -0
  1196. package/dist/react-native/client/UserDefinedFunction/UserDefinedFunctions.js.map +1 -1
  1197. package/dist/react-native/common/constants.d.ts +4 -0
  1198. package/dist/react-native/common/constants.d.ts.map +1 -1
  1199. package/dist/react-native/common/constants.js +5 -1
  1200. package/dist/react-native/common/constants.js.map +1 -1
  1201. package/dist/react-native/common/helper.d.ts +6 -0
  1202. package/dist/react-native/common/helper.d.ts.map +1 -1
  1203. package/dist/react-native/common/helper.js +9 -1
  1204. package/dist/react-native/common/helper.js.map +1 -1
  1205. package/dist/react-native/common/platform.d.ts +1 -0
  1206. package/dist/react-native/common/platform.d.ts.map +1 -1
  1207. package/dist/react-native/common/platform.js +1 -3
  1208. package/dist/react-native/common/platform.js.map +1 -1
  1209. package/dist/react-native/diagnostics/CosmosDiagnosticsContext.js +8 -7
  1210. package/dist/react-native/diagnostics/CosmosDiagnosticsContext.js.map +1 -1
  1211. package/dist/react-native/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
  1212. package/dist/react-native/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
  1213. package/dist/react-native/diagnostics/DiagnosticNodeInternal.js +26 -7
  1214. package/dist/react-native/diagnostics/DiagnosticNodeInternal.js.map +1 -1
  1215. package/dist/react-native/diagnostics/DiagnosticWriter.js +1 -3
  1216. package/dist/react-native/diagnostics/DiagnosticWriter.js.map +1 -1
  1217. package/dist/react-native/diagnostics/index.js +2 -2
  1218. package/dist/react-native/diagnostics/index.js.map +1 -1
  1219. package/dist/react-native/documents/ConnectionPolicy.d.ts +10 -4
  1220. package/dist/react-native/documents/ConnectionPolicy.d.ts.map +1 -1
  1221. package/dist/react-native/documents/ConnectionPolicy.js +2 -2
  1222. package/dist/react-native/documents/ConnectionPolicy.js.map +1 -1
  1223. package/dist/react-native/documents/DatabaseAccount.d.ts +4 -0
  1224. package/dist/react-native/documents/DatabaseAccount.d.ts.map +1 -1
  1225. package/dist/react-native/documents/DatabaseAccount.js +29 -4
  1226. package/dist/react-native/documents/DatabaseAccount.js.map +1 -1
  1227. package/dist/react-native/documents/PartitionKey.js +1 -3
  1228. package/dist/react-native/documents/PartitionKey.js.map +1 -1
  1229. package/dist/react-native/encryption/AeadAes256CbcHmacSha256Algorithm/AeadAes256CbcHmacSha256Algorithm.js +8 -2
  1230. package/dist/react-native/encryption/AeadAes256CbcHmacSha256Algorithm/AeadAes256CbcHmacSha256Algorithm.js.map +1 -1
  1231. package/dist/react-native/encryption/Cache/ClientEncryptionKeyPropertiesCache.js +2 -0
  1232. package/dist/react-native/encryption/Cache/ClientEncryptionKeyPropertiesCache.js.map +1 -1
  1233. package/dist/react-native/encryption/Cache/EncryptionSettingsCache.js +2 -0
  1234. package/dist/react-native/encryption/Cache/EncryptionSettingsCache.js.map +1 -1
  1235. package/dist/react-native/encryption/Cache/KeyEncryptionKeyCache.js +2 -0
  1236. package/dist/react-native/encryption/Cache/KeyEncryptionKeyCache.js.map +1 -1
  1237. package/dist/react-native/encryption/Cache/ProtectedDataEncryptionKeyCache.js +5 -0
  1238. package/dist/react-native/encryption/Cache/ProtectedDataEncryptionKeyCache.js.map +1 -1
  1239. package/dist/react-native/encryption/ClientEncryptionKey/ClientEncryptionKeyResponse.js +2 -0
  1240. package/dist/react-native/encryption/ClientEncryptionKey/ClientEncryptionKeyResponse.js.map +1 -1
  1241. package/dist/react-native/encryption/EncryptionItemQueryIterator.js +24 -27
  1242. package/dist/react-native/encryption/EncryptionItemQueryIterator.js.map +1 -1
  1243. package/dist/react-native/encryption/EncryptionKey/DataEncryptionKey.js +7 -2
  1244. package/dist/react-native/encryption/EncryptionKey/DataEncryptionKey.js.map +1 -1
  1245. package/dist/react-native/encryption/EncryptionKey/ProtectedDataEncryptionKey.d.ts +0 -1
  1246. package/dist/react-native/encryption/EncryptionKey/ProtectedDataEncryptionKey.d.ts.map +1 -1
  1247. package/dist/react-native/encryption/EncryptionKey/ProtectedDataEncryptionKey.js +2 -0
  1248. package/dist/react-native/encryption/EncryptionKey/ProtectedDataEncryptionKey.js.map +1 -1
  1249. package/dist/react-native/encryption/EncryptionKeyResolver/AzureKeyVaultEncryptionKeyResolver.js +6 -5
  1250. package/dist/react-native/encryption/EncryptionKeyResolver/AzureKeyVaultEncryptionKeyResolver.js.map +1 -1
  1251. package/dist/react-native/encryption/EncryptionKeyStoreProvider.js +8 -1
  1252. package/dist/react-native/encryption/EncryptionKeyStoreProvider.js.map +1 -1
  1253. package/dist/react-native/encryption/EncryptionManager.js +6 -0
  1254. package/dist/react-native/encryption/EncryptionManager.js.map +1 -1
  1255. package/dist/react-native/encryption/EncryptionProcessor.js +5 -0
  1256. package/dist/react-native/encryption/EncryptionProcessor.js.map +1 -1
  1257. package/dist/react-native/encryption/EncryptionQueryBuilder.js +2 -0
  1258. package/dist/react-native/encryption/EncryptionQueryBuilder.js.map +1 -1
  1259. package/dist/react-native/encryption/EncryptionSettingForProperty.js +6 -0
  1260. package/dist/react-native/encryption/EncryptionSettingForProperty.js.map +1 -1
  1261. package/dist/react-native/encryption/EncryptionSettings.js +6 -3
  1262. package/dist/react-native/encryption/EncryptionSettings.js.map +1 -1
  1263. package/dist/react-native/encryption/KeyEncryptionKey.js +4 -0
  1264. package/dist/react-native/encryption/KeyEncryptionKey.js.map +1 -1
  1265. package/dist/react-native/encryption/Serializers/StringSerializer.js +1 -1
  1266. package/dist/react-native/encryption/Serializers/StringSerializer.js.map +1 -1
  1267. package/dist/react-native/extractPartitionKey.js +2 -2
  1268. package/dist/react-native/extractPartitionKey.js.map +1 -1
  1269. package/dist/react-native/globalEndpointManager.d.ts +8 -0
  1270. package/dist/react-native/globalEndpointManager.d.ts.map +1 -1
  1271. package/dist/react-native/globalEndpointManager.js +104 -29
  1272. package/dist/react-native/globalEndpointManager.js.map +1 -1
  1273. package/dist/react-native/globalPartitionEndpointManager.d.ts +0 -2
  1274. package/dist/react-native/globalPartitionEndpointManager.d.ts.map +1 -1
  1275. package/dist/react-native/globalPartitionEndpointManager.js +19 -7
  1276. package/dist/react-native/globalPartitionEndpointManager.js.map +1 -1
  1277. package/dist/react-native/queryExecutionContext/Aggregators/AverageAggregator.js +2 -0
  1278. package/dist/react-native/queryExecutionContext/Aggregators/AverageAggregator.js.map +1 -1
  1279. package/dist/react-native/queryExecutionContext/Aggregators/CountAggregator.js +1 -0
  1280. package/dist/react-native/queryExecutionContext/Aggregators/CountAggregator.js.map +1 -1
  1281. package/dist/react-native/queryExecutionContext/Aggregators/GlobalStatisticsAggregator.js +1 -0
  1282. package/dist/react-native/queryExecutionContext/Aggregators/GlobalStatisticsAggregator.js.map +1 -1
  1283. package/dist/react-native/queryExecutionContext/Aggregators/MakeListAggregator.js +1 -0
  1284. package/dist/react-native/queryExecutionContext/Aggregators/MakeListAggregator.js.map +1 -1
  1285. package/dist/react-native/queryExecutionContext/Aggregators/MakeSetAggregator.js +1 -0
  1286. package/dist/react-native/queryExecutionContext/Aggregators/MakeSetAggregator.js.map +1 -1
  1287. package/dist/react-native/queryExecutionContext/Aggregators/MaxAggregator.js +2 -0
  1288. package/dist/react-native/queryExecutionContext/Aggregators/MaxAggregator.js.map +1 -1
  1289. package/dist/react-native/queryExecutionContext/Aggregators/MinAggregator.js +2 -0
  1290. package/dist/react-native/queryExecutionContext/Aggregators/MinAggregator.js.map +1 -1
  1291. package/dist/react-native/queryExecutionContext/Aggregators/StaticValueAggregator.js +1 -0
  1292. package/dist/react-native/queryExecutionContext/Aggregators/StaticValueAggregator.js.map +1 -1
  1293. package/dist/react-native/queryExecutionContext/Aggregators/SumAggregator.js +1 -0
  1294. package/dist/react-native/queryExecutionContext/Aggregators/SumAggregator.js.map +1 -1
  1295. package/dist/react-native/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js +5 -3
  1296. package/dist/react-native/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js.map +1 -1
  1297. package/dist/react-native/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js +6 -3
  1298. package/dist/react-native/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js.map +1 -1
  1299. package/dist/react-native/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js +23 -7
  1300. package/dist/react-native/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js.map +1 -1
  1301. package/dist/react-native/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js +14 -6
  1302. package/dist/react-native/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js.map +1 -1
  1303. package/dist/react-native/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js +3 -0
  1304. package/dist/react-native/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js.map +1 -1
  1305. package/dist/react-native/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js +2 -0
  1306. package/dist/react-native/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js.map +1 -1
  1307. package/dist/react-native/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js +2 -0
  1308. package/dist/react-native/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js.map +1 -1
  1309. package/dist/react-native/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js +2 -0
  1310. package/dist/react-native/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js.map +1 -1
  1311. package/dist/react-native/queryExecutionContext/FetchResult.js +4 -0
  1312. package/dist/react-native/queryExecutionContext/FetchResult.js.map +1 -1
  1313. package/dist/react-native/queryExecutionContext/defaultQueryExecutionContext.js +14 -2
  1314. package/dist/react-native/queryExecutionContext/defaultQueryExecutionContext.js.map +1 -1
  1315. package/dist/react-native/queryExecutionContext/documentProducer.js +34 -21
  1316. package/dist/react-native/queryExecutionContext/documentProducer.js.map +1 -1
  1317. package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.js +41 -27
  1318. package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
  1319. package/dist/react-native/queryExecutionContext/orderByComparator.js +1 -0
  1320. package/dist/react-native/queryExecutionContext/orderByComparator.js.map +1 -1
  1321. package/dist/react-native/queryExecutionContext/orderByDocumentProducerComparator.js +1 -0
  1322. package/dist/react-native/queryExecutionContext/orderByDocumentProducerComparator.js.map +1 -1
  1323. package/dist/react-native/queryExecutionContext/orderByQueryExecutionContext.js +1 -0
  1324. package/dist/react-native/queryExecutionContext/orderByQueryExecutionContext.js.map +1 -1
  1325. package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.js +20 -2
  1326. package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
  1327. package/dist/react-native/queryExecutionContext/pipelinedQueryExecutionContext.js +14 -4
  1328. package/dist/react-native/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
  1329. package/dist/react-native/queryIterator.js +41 -33
  1330. package/dist/react-native/queryIterator.js.map +1 -1
  1331. package/dist/react-native/queryMetrics/clientSideMetrics.js +2 -1
  1332. package/dist/react-native/queryMetrics/clientSideMetrics.js.map +1 -1
  1333. package/dist/react-native/queryMetrics/queryMetrics.js +14 -1
  1334. package/dist/react-native/queryMetrics/queryMetrics.js.map +1 -1
  1335. package/dist/react-native/queryMetrics/queryPreparationTime.js +5 -1
  1336. package/dist/react-native/queryMetrics/queryPreparationTime.js.map +1 -1
  1337. package/dist/react-native/queryMetrics/runtimeExecutionTimes.js +4 -1
  1338. package/dist/react-native/queryMetrics/runtimeExecutionTimes.js.map +1 -1
  1339. package/dist/react-native/queryMetrics/timeSpan.js +4 -3
  1340. package/dist/react-native/queryMetrics/timeSpan.js.map +1 -1
  1341. package/dist/react-native/request/ErrorResponse.js +19 -0
  1342. package/dist/react-native/request/ErrorResponse.js.map +1 -1
  1343. package/dist/react-native/request/FeedResponse.js +4 -0
  1344. package/dist/react-native/request/FeedResponse.js.map +1 -1
  1345. package/dist/react-native/request/RequestHandler.js +3 -4
  1346. package/dist/react-native/request/RequestHandler.js.map +1 -1
  1347. package/dist/react-native/request/ResourceResponse.js +5 -0
  1348. package/dist/react-native/request/ResourceResponse.js.map +1 -1
  1349. package/dist/react-native/request/SharedOptions.d.ts +5 -0
  1350. package/dist/react-native/request/SharedOptions.d.ts.map +1 -1
  1351. package/dist/react-native/request/SharedOptions.js.map +1 -1
  1352. package/dist/react-native/request/TimeoutError.js +1 -1
  1353. package/dist/react-native/request/TimeoutError.js.map +1 -1
  1354. package/dist/react-native/request/hybridSearchQueryResult.js +5 -0
  1355. package/dist/react-native/request/hybridSearchQueryResult.js.map +1 -1
  1356. package/dist/react-native/request/request.js +5 -1
  1357. package/dist/react-native/request/request.js.map +1 -1
  1358. package/dist/react-native/retry/bulkExecutionRetryPolicy.js +5 -2
  1359. package/dist/react-native/retry/bulkExecutionRetryPolicy.js.map +1 -1
  1360. package/dist/react-native/retry/defaultRetryPolicy.d.ts.map +1 -1
  1361. package/dist/react-native/retry/defaultRetryPolicy.js +7 -7
  1362. package/dist/react-native/retry/defaultRetryPolicy.js.map +1 -1
  1363. package/dist/react-native/retry/endpointDiscoveryRetryPolicy.d.ts +3 -2
  1364. package/dist/react-native/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
  1365. package/dist/react-native/retry/endpointDiscoveryRetryPolicy.js +24 -7
  1366. package/dist/react-native/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
  1367. package/dist/react-native/retry/resourceThrottleRetryPolicy.js +20 -10
  1368. package/dist/react-native/retry/resourceThrottleRetryPolicy.js.map +1 -1
  1369. package/dist/react-native/retry/retryUtility.d.ts.map +1 -1
  1370. package/dist/react-native/retry/retryUtility.js +22 -8
  1371. package/dist/react-native/retry/retryUtility.js.map +1 -1
  1372. package/dist/react-native/retry/sessionRetryPolicy.js +8 -4
  1373. package/dist/react-native/retry/sessionRetryPolicy.js.map +1 -1
  1374. package/dist/react-native/retry/timeoutFailoverRetryPolicy.d.ts +1 -2
  1375. package/dist/react-native/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
  1376. package/dist/react-native/retry/timeoutFailoverRetryPolicy.js +17 -7
  1377. package/dist/react-native/retry/timeoutFailoverRetryPolicy.js.map +1 -1
  1378. package/dist/react-native/routing/QueryRange.js +4 -0
  1379. package/dist/react-native/routing/QueryRange.js.map +1 -1
  1380. package/dist/react-native/routing/inMemoryCollectionRoutingMap.js +4 -0
  1381. package/dist/react-native/routing/inMemoryCollectionRoutingMap.js.map +1 -1
  1382. package/dist/react-native/routing/partitionKeyRangeCache.js +2 -0
  1383. package/dist/react-native/routing/partitionKeyRangeCache.js.map +1 -1
  1384. package/dist/react-native/routing/smartRoutingMapProvider.js +1 -0
  1385. package/dist/react-native/routing/smartRoutingMapProvider.js.map +1 -1
  1386. package/dist/react-native/session/VectorSessionToken.js +6 -2
  1387. package/dist/react-native/session/VectorSessionToken.js.map +1 -1
  1388. package/dist/react-native/session/sessionContainer.js +5 -3
  1389. package/dist/react-native/session/sessionContainer.js.map +1 -1
  1390. package/dist/react-native/utils/batch.js +15 -4
  1391. package/dist/react-native/utils/batch.js.map +1 -1
  1392. package/dist/react-native/utils/encode.d.ts +1 -1
  1393. package/dist/react-native/utils/encode.d.ts.map +1 -1
  1394. package/dist/react-native/utils/encode.js.map +1 -1
  1395. package/dist/react-native/utils/fixedSizePriorityQueue.js +4 -0
  1396. package/dist/react-native/utils/fixedSizePriorityQueue.js.map +1 -1
  1397. package/dist/react-native/utils/hashing/hash.js +1 -1
  1398. package/dist/react-native/utils/hashing/hash.js.map +1 -1
  1399. package/dist/react-native/utils/nonStreamingOrderByMap.js +2 -0
  1400. package/dist/react-native/utils/nonStreamingOrderByMap.js.map +1 -1
  1401. package/package.json +33 -33
@@ -1 +1 @@
1
- {"version":3,"file":"Containers.js","sourceRoot":"","sources":["../../../../src/client/Container/Containers.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,eAAe,EACf,YAAY,EACZ,WAAW,EACX,8BAA8B,GAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGxF;;;;;;;;;GASG;AACH,MAAM,O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AAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { ClientContext } from \"../../ClientContext.js\";\nimport {\n Constants,\n getIdFromLink,\n getPathFromLink,\n isResourceValid,\n ResourceType,\n StatusCodes,\n validateClientEncryptionPolicy,\n} from \"../../common/index.js\";\nimport { DEFAULT_PARTITION_KEY_PATH } from \"../../common/partitionKeys.js\";\nimport type { SqlQuerySpec } from \"../../queryExecutionContext/index.js\";\nimport { mergeHeaders } from \"../../queryExecutionContext/index.js\";\nimport { QueryIterator } from \"../../queryIterator.js\";\nimport { type FeedOptions, type RequestOptions } from \"../../request/index.js\";\nimport type { Database } from \"../Database/index.js\";\nimport type { Resource } from \"../Resource.js\";\nimport { Container } from \"./Container.js\";\nimport type { ContainerDefinition } from \"./ContainerDefinition.js\";\nimport type { ContainerRequest } from \"./ContainerRequest.js\";\nimport { ContainerResponse } from \"./ContainerResponse.js\";\nimport { validateOffer } from \"../../utils/offers.js\";\nimport type { DiagnosticNodeInternal } from \"../../diagnostics/DiagnosticNodeInternal.js\";\nimport { getEmptyCosmosDiagnostics, withDiagnostics } from \"../../utils/diagnostics.js\";\nimport type { EncryptionManager } from \"../../encryption/EncryptionManager.js\";\n\n/**\n * Operations for creating new containers, and reading/querying all containers\n *\n * @see {@link Container} for reading, replacing, or deleting an existing container; use `.container(id)`.\n *\n * Note: all these operations make calls against a fixed budget.\n * You should design your system such that these calls scale sublinearly with your application.\n * For instance, do not call `containers.readAll()` before every single `item.read()` call, to ensure the container exists;\n * do this once on application start up.\n */\nexport class Containers {\n /**\n * @hidden\n * @param database - The parent {@link Database}.\n */\n constructor(\n public readonly database: Database,\n private readonly clientContext: ClientContext,\n private encryptionManager?: EncryptionManager,\n ) {}\n\n /**\n * Queries all containers.\n * @param query - Query configuration for the operation. See {@link SqlQuerySpec} for more info on how to configure a query.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return specific containers in an array or iterate over them one at a time.\n * @example Read all containers to array.\n * ```ts snippet:ContainersQueryAllContainers\n * import { CosmosClient, SqlQuerySpec } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const querySpec: SqlQuerySpec = {\n * query: `SELECT * FROM root r WHERE r.id = @container`,\n * parameters: [{ name: \"@container\", value: \"Todo\" }],\n * };\n * const { resources: containerList } = await client\n * .database(\"<db id>\")\n * .containers.query(querySpec)\n * .fetchAll();\n * ```\n */\n public query(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<any>;\n /**\n * Queries all containers.\n * @param query - Query configuration for the operation. See {@link SqlQuerySpec} for more info on how to configure a query.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return specific containers in an array or iterate over them one at a time.\n * @example Read all containers to array.\n * ```ts snippet:ContainersQueryAllContainers\n * import { CosmosClient, SqlQuerySpec } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const querySpec: SqlQuerySpec = {\n * query: `SELECT * FROM root r WHERE r.id = @container`,\n * parameters: [{ name: \"@container\", value: \"Todo\" }],\n * };\n * const { resources: containerList } = await client\n * .database(\"<db id>\")\n * .containers.query(querySpec)\n * .fetchAll();\n * ```\n */\n public query<T>(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<T>;\n public query<T>(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<T> {\n const path = getPathFromLink(this.database.url, ResourceType.container);\n const id = getIdFromLink(this.database.url);\n\n return new QueryIterator(\n this.clientContext,\n query,\n options,\n (diagNode: DiagnosticNodeInternal, innerOptions) => {\n return this.clientContext.queryFeed<ContainerDefinition>({\n path,\n resourceType: ResourceType.container,\n resourceId: id,\n resultFn: (result) => result.DocumentCollections,\n query,\n options: innerOptions,\n diagnosticNode: diagNode,\n });\n },\n );\n }\n\n /**\n * Creates a container.\n *\n * A container is a named logical container for items.\n *\n * A database may contain zero or more named containers and each container consists of\n * zero or more JSON items.\n *\n * Being schema-free, the items in a container do not need to share the same structure or fields.\n *\n *\n * Since containers are application resources, they can be authorized using either the\n * master key or resource keys.\n *\n * @param body - Represents the body of the container.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @example\n * ```ts snippet:CosmosClientDatabaseCreateContainer\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n * const container = client.database(\"<database id>\").containers.create({\n * id: \"<name here>\",\n * });\n * ```\n */\n public async create(\n body: ContainerRequest,\n options: RequestOptions = {},\n ): Promise<ContainerResponse> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n return this.createInternal(diagnosticNode, body, options);\n }, this.clientContext);\n }\n\n /**\n * @hidden\n */\n public async createInternal(\n diagnosticNode: DiagnosticNodeInternal,\n body: ContainerRequest,\n options: RequestOptions = {},\n ): Promise<ContainerResponse> {\n const err = {};\n if (!isResourceValid(body, err)) {\n throw err;\n }\n const path = getPathFromLink(this.database.url, ResourceType.container);\n const id = getIdFromLink(this.database.url);\n\n validateOffer(body);\n\n if (body.maxThroughput) {\n const autoscaleParams: {\n maxThroughput: number;\n autoUpgradePolicy?: {\n throughputPolicy: {\n incrementPercent: number;\n };\n };\n } = {\n maxThroughput: body.maxThroughput,\n };\n if (body.autoUpgradePolicy) {\n autoscaleParams.autoUpgradePolicy = body.autoUpgradePolicy;\n }\n const autoscaleHeader = JSON.stringify(autoscaleParams);\n options.initialHeaders = Object.assign({}, options.initialHeaders, {\n [Constants.HttpHeaders.AutoscaleSettings]: autoscaleHeader,\n });\n delete body.maxThroughput;\n delete body.autoUpgradePolicy;\n }\n\n if (body.throughput) {\n options.initialHeaders = Object.assign({}, options.initialHeaders, {\n [Constants.HttpHeaders.OfferThroughput]: body.throughput,\n });\n delete body.throughput;\n }\n\n if (typeof body.partitionKey === \"string\") {\n if (!body.partitionKey.startsWith(\"/\")) {\n throw new Error(\"Partition key must start with '/'\");\n }\n body.partitionKey = {\n paths: [body.partitionKey],\n };\n }\n\n // If they don't specify a partition key, use the default path\n if (!body.partitionKey || !body.partitionKey.paths) {\n body.partitionKey = {\n paths: [DEFAULT_PARTITION_KEY_PATH],\n };\n }\n\n if (this.clientContext.enableEncryption && body.clientEncryptionPolicy) {\n body.clientEncryptionPolicy.policyFormatVersion =\n body.clientEncryptionPolicy.policyFormatVersion ?? 1;\n validateClientEncryptionPolicy(body.clientEncryptionPolicy, body.partitionKey);\n }\n const response = await this.clientContext.create<ContainerRequest, ContainerDefinition>({\n body,\n path,\n resourceType: ResourceType.container,\n resourceId: id,\n diagnosticNode,\n options,\n });\n const ref = new Container(\n this.database,\n response.result.id,\n this.clientContext,\n this.encryptionManager,\n response.result._rid,\n );\n this.clientContext.partitionKeyDefinitionCache[ref.url] = response.result.partitionKey;\n return new ContainerResponse(\n response.result,\n response.headers,\n response.code,\n ref,\n getEmptyCosmosDiagnostics(),\n );\n }\n\n /**\n * Checks if a Container exists, and, if it doesn't, creates it.\n * This will make a read operation based on the id in the `body`, then if it is not found, a create operation.\n * You should confirm that the output matches the body you passed in for non-default properties (i.e. indexing policy/etc.)\n *\n * A container is a named logical container for items.\n *\n * A database may contain zero or more named containers and each container consists of\n * zero or more JSON items.\n *\n * Being schema-free, the items in a container do not need to share the same structure or fields.\n *\n *\n * Since containers are application resources, they can be authorized using either the\n * master key or resource keys.\n *\n * @param body - Represents the body of the container.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @example\n * ```ts snippet:ReadmeSampleCreateContainer\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n * ```\n */\n public async createIfNotExists(\n body: ContainerRequest,\n options?: RequestOptions,\n ): Promise<ContainerResponse> {\n if (!body || body.id === null || body.id === undefined) {\n throw new Error(\"body parameter must be an object with an id property\");\n }\n /*\n 1. Attempt to read the Container (based on an assumption that most containers will already exist, so its faster)\n 2. If it fails with NotFound error, attempt to create the container. Else, return the read results.\n */\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n try {\n const readResponse = await this.database\n .container(body.id)\n .readInternal(diagnosticNode, options);\n return readResponse;\n } catch (err: any) {\n if (err.code === StatusCodes.NotFound) {\n const createResponse = await this.createInternal(diagnosticNode, body, options);\n // Must merge the headers to capture RU costskaty\n mergeHeaders(createResponse.headers, err.headers);\n return createResponse;\n } else {\n throw err;\n }\n }\n }, this.clientContext);\n }\n\n /**\n * Read all containers.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return all containers in an array or iterate over them one at a time.\n * @example Read all containers to array.\n * ```ts snippet:ContainersReadAllContainers\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { resources: containerList } = await client\n * .database(\"<db id>\")\n * .containers.readAll()\n * .fetchAll();\n * ```\n */\n public readAll(options?: FeedOptions): QueryIterator<ContainerDefinition & Resource> {\n return this.query(undefined, options);\n }\n}\n"]}
1
+ {"version":3,"file":"Containers.js","sourceRoot":"","sources":["../../../../src/client/Container/Containers.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,eAAe,EACf,YAAY,EACZ,WAAW,EACX,8BAA8B,GAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,YAAY,EAAE,MAA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Y,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;oBAClD,OAAO,cAAc,CAAC;gBACxB,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAC;gBACZ,CAAC;YACH,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACI,OAAO,CAAC,OAAqB;QAClC,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { ClientContext } from \"../../ClientContext.js\";\nimport {\n Constants,\n getIdFromLink,\n getPathFromLink,\n isResourceValid,\n ResourceType,\n StatusCodes,\n validateClientEncryptionPolicy,\n} from \"../../common/index.js\";\nimport { DEFAULT_PARTITION_KEY_PATH } from \"../../common/partitionKeys.js\";\nimport type { SqlQuerySpec } from \"../../queryExecutionContext/index.js\";\nimport { mergeHeaders } from \"../../queryExecutionContext/index.js\";\nimport { QueryIterator } from \"../../queryIterator.js\";\nimport { type FeedOptions, type RequestOptions } from \"../../request/index.js\";\nimport type { Database } from \"../Database/index.js\";\nimport type { Resource } from \"../Resource.js\";\nimport { Container } from \"./Container.js\";\nimport type { ContainerDefinition } from \"./ContainerDefinition.js\";\nimport type { ContainerRequest } from \"./ContainerRequest.js\";\nimport { ContainerResponse } from \"./ContainerResponse.js\";\nimport { validateOffer } from \"../../utils/offers.js\";\nimport type { DiagnosticNodeInternal } from \"../../diagnostics/DiagnosticNodeInternal.js\";\nimport { getEmptyCosmosDiagnostics, withDiagnostics } from \"../../utils/diagnostics.js\";\nimport type { EncryptionManager } from \"../../encryption/EncryptionManager.js\";\n\n/**\n * Operations for creating new containers, and reading/querying all containers\n *\n * @see {@link Container} for reading, replacing, or deleting an existing container; use `.container(id)`.\n *\n * Note: all these operations make calls against a fixed budget.\n * You should design your system such that these calls scale sublinearly with your application.\n * For instance, do not call `containers.readAll()` before every single `item.read()` call, to ensure the container exists;\n * do this once on application start up.\n */\nexport class Containers {\n /**\n * @hidden\n * @param database - The parent {@link Database}.\n */\n constructor(\n public readonly database: Database,\n private readonly clientContext: ClientContext,\n private encryptionManager?: EncryptionManager,\n ) {}\n\n /**\n * Queries all containers.\n * @param query - Query configuration for the operation. See {@link SqlQuerySpec} for more info on how to configure a query.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return specific containers in an array or iterate over them one at a time.\n * @example Read all containers to array.\n * ```ts snippet:ContainersQueryAllContainers\n * import { CosmosClient, SqlQuerySpec } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const querySpec: SqlQuerySpec = {\n * query: `SELECT * FROM root r WHERE r.id = @container`,\n * parameters: [{ name: \"@container\", value: \"Todo\" }],\n * };\n * const { resources: containerList } = await client\n * .database(\"<db id>\")\n * .containers.query(querySpec)\n * .fetchAll();\n * ```\n */\n public query(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<any>;\n /**\n * Queries all containers.\n * @param query - Query configuration for the operation. See {@link SqlQuerySpec} for more info on how to configure a query.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return specific containers in an array or iterate over them one at a time.\n * @example Read all containers to array.\n * ```ts snippet:ContainersQueryAllContainers\n * import { CosmosClient, SqlQuerySpec } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const querySpec: SqlQuerySpec = {\n * query: `SELECT * FROM root r WHERE r.id = @container`,\n * parameters: [{ name: \"@container\", value: \"Todo\" }],\n * };\n * const { resources: containerList } = await client\n * .database(\"<db id>\")\n * .containers.query(querySpec)\n * .fetchAll();\n * ```\n */\n public query<T>(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<T>;\n public query<T>(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<T> {\n const path = getPathFromLink(this.database.url, ResourceType.container);\n const id = getIdFromLink(this.database.url);\n\n return new QueryIterator(\n this.clientContext,\n query,\n options,\n (diagNode: DiagnosticNodeInternal, innerOptions) => {\n return this.clientContext.queryFeed<ContainerDefinition>({\n path,\n resourceType: ResourceType.container,\n resourceId: id,\n resultFn: (result) => result.DocumentCollections,\n query,\n options: innerOptions,\n diagnosticNode: diagNode,\n });\n },\n );\n }\n\n /**\n * Creates a container.\n *\n * A container is a named logical container for items.\n *\n * A database may contain zero or more named containers and each container consists of\n * zero or more JSON items.\n *\n * Being schema-free, the items in a container do not need to share the same structure or fields.\n *\n *\n * Since containers are application resources, they can be authorized using either the\n * master key or resource keys.\n *\n * @param body - Represents the body of the container.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @example\n * ```ts snippet:CosmosClientDatabaseCreateContainer\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n * const container = client.database(\"<database id>\").containers.create({\n * id: \"<name here>\",\n * });\n * ```\n */\n public async create(\n body: ContainerRequest,\n options: RequestOptions = {},\n ): Promise<ContainerResponse> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n return this.createInternal(diagnosticNode, body, options);\n }, this.clientContext);\n }\n\n /**\n * @hidden\n */\n public async createInternal(\n diagnosticNode: DiagnosticNodeInternal,\n body: ContainerRequest,\n options: RequestOptions = {},\n ): Promise<ContainerResponse> {\n const err = {};\n if (!isResourceValid(body, err)) {\n throw err;\n }\n const path = getPathFromLink(this.database.url, ResourceType.container);\n const id = getIdFromLink(this.database.url);\n\n validateOffer(body);\n\n if (body.maxThroughput) {\n const autoscaleParams: {\n maxThroughput: number;\n autoUpgradePolicy?: {\n throughputPolicy: {\n incrementPercent: number;\n };\n };\n } = {\n maxThroughput: body.maxThroughput,\n };\n if (body.autoUpgradePolicy) {\n autoscaleParams.autoUpgradePolicy = body.autoUpgradePolicy;\n }\n const autoscaleHeader = JSON.stringify(autoscaleParams);\n options.initialHeaders = Object.assign({}, options.initialHeaders, {\n [Constants.HttpHeaders.AutoscaleSettings]: autoscaleHeader,\n });\n delete body.maxThroughput;\n delete body.autoUpgradePolicy;\n }\n\n if (body.throughput) {\n options.initialHeaders = Object.assign({}, options.initialHeaders, {\n [Constants.HttpHeaders.OfferThroughput]: body.throughput,\n });\n delete body.throughput;\n }\n\n if (typeof body.partitionKey === \"string\") {\n if (!body.partitionKey.startsWith(\"/\")) {\n throw new Error(\"Partition key must start with '/'\");\n }\n body.partitionKey = {\n paths: [body.partitionKey],\n };\n }\n\n // If they don't specify a partition key, use the default path\n if (!body.partitionKey || !body.partitionKey.paths) {\n body.partitionKey = {\n paths: [DEFAULT_PARTITION_KEY_PATH],\n };\n }\n\n if (this.clientContext.enableEncryption && body.clientEncryptionPolicy) {\n body.clientEncryptionPolicy.policyFormatVersion =\n body.clientEncryptionPolicy.policyFormatVersion ?? 1;\n validateClientEncryptionPolicy(body.clientEncryptionPolicy, body.partitionKey);\n }\n const response = await this.clientContext.create<ContainerRequest, ContainerDefinition>({\n body,\n path,\n resourceType: ResourceType.container,\n resourceId: id,\n diagnosticNode,\n options,\n });\n const ref = new Container(\n this.database,\n response.result.id,\n this.clientContext,\n this.encryptionManager,\n response.result._rid,\n );\n this.clientContext.partitionKeyDefinitionCache[ref.url] = response.result.partitionKey;\n return new ContainerResponse(\n response.result,\n response.headers,\n response.code,\n ref,\n getEmptyCosmosDiagnostics(),\n );\n }\n\n /**\n * Checks if a Container exists, and, if it doesn't, creates it.\n * This will make a read operation based on the id in the `body`, then if it is not found, a create operation.\n * You should confirm that the output matches the body you passed in for non-default properties (i.e. indexing policy/etc.)\n *\n * A container is a named logical container for items.\n *\n * A database may contain zero or more named containers and each container consists of\n * zero or more JSON items.\n *\n * Being schema-free, the items in a container do not need to share the same structure or fields.\n *\n *\n * Since containers are application resources, they can be authorized using either the\n * master key or resource keys.\n *\n * @param body - Represents the body of the container.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @example\n * ```ts snippet:ReadmeSampleCreateContainer\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n * ```\n */\n public async createIfNotExists(\n body: ContainerRequest,\n options?: RequestOptions,\n ): Promise<ContainerResponse> {\n if (!body || body.id === null || body.id === undefined) {\n throw new Error(\"body parameter must be an object with an id property\");\n }\n /*\n 1. Attempt to read the Container (based on an assumption that most containers will already exist, so its faster)\n 2. If it fails with NotFound error, attempt to create the container. Else, return the read results.\n */\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n try {\n const readResponse = await this.database\n .container(body.id)\n .readInternal(diagnosticNode, options);\n return readResponse;\n } catch (err: any) {\n if (err.code === StatusCodes.NotFound) {\n const createResponse = await this.createInternal(diagnosticNode, body, options);\n // Must merge the headers to capture RU costskaty\n mergeHeaders(createResponse.headers, err.headers);\n return createResponse;\n } else {\n throw err;\n }\n }\n }, this.clientContext);\n }\n\n /**\n * Read all containers.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return all containers in an array or iterate over them one at a time.\n * @example Read all containers to array.\n * ```ts snippet:ContainersReadAllContainers\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { resources: containerList } = await client\n * .database(\"<db id>\")\n * .containers.readAll()\n * .fetchAll();\n * ```\n */\n public readAll(options?: FeedOptions): QueryIterator<ContainerDefinition & Resource> {\n return this.query(undefined, options);\n }\n}\n"]}
@@ -18,6 +18,35 @@ import { ClientEncryptionKeyResponse, EncryptionAlgorithm, KeyEncryptionAlgorith
18
18
  * do this once on application start up.
19
19
  */
20
20
  export class Database {
21
+ client;
22
+ id;
23
+ clientContext;
24
+ encryptionManager;
25
+ /**
26
+ * Used for creating new containers, or querying/reading all containers.
27
+ *
28
+ * Use `.database(id)` to read, replace, or delete a specific, existing {@link Database} by id.
29
+ *
30
+ * @example Create a new container
31
+ * ```ts snippet:DatabaseCreateContainer
32
+ * import { CosmosClient } from "@azure/cosmos";
33
+ *
34
+ * const endpoint = "https://your-account.documents.azure.com";
35
+ * const key = "<database account masterkey>";
36
+ * const client = new CosmosClient({ endpoint, key });
37
+ *
38
+ * const { body: containerDefinition, container } = await client
39
+ * .database("<db id>")
40
+ * .containers.create({ id: "<container id>" });
41
+ * ```
42
+ */
43
+ containers;
44
+ /**
45
+ * Used for creating new users, or querying/reading all users.
46
+ *
47
+ * Use `.user(id)` to read, replace, or delete a specific, existing {@link User} by id.
48
+ */
49
+ users;
21
50
  /**
22
51
  * Returns a reference URL to the resource. Used for linking in Permissions.
23
52
  * @example
@@ -36,6 +65,10 @@ export class Database {
36
65
  get url() {
37
66
  return createDatabaseUri(this.id);
38
67
  }
68
+ /**
69
+ * @internal
70
+ */
71
+ _rid;
39
72
  /** Returns a new {@link Database} instance.
40
73
  *
41
74
  * Note: the intention is to get this object from {@link CosmosClient} via `client.database(id)`, not to instantiate it yourself.
@@ -1 +1 @@
1
- {"version":3,"file":"Database.js","sourceRoot":"","sources":["../../../../src/client/Database/Database.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,YAAY,GACb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAuB,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC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QAAQ,CAAC,MAAM,CAAC,eAAe;aAC3D,CAAC;YACF,OAAO,IAAI,2BAA2B,CACpC,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,OAAO,EAChB,QAAQ,CAAC,IAAI,EACb,GAAG,EACH,yBAAyB,EAAE,CAC5B,CAAC;QACJ,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { ClientContext } from \"../../ClientContext.js\";\nimport {\n createDatabaseUri,\n getIdFromLink,\n getPathFromLink,\n ResourceType,\n} from \"../../common/index.js\";\nimport type { CosmosClient } from \"../../CosmosClient.js\";\nimport { ErrorResponse, type RequestOptions } from \"../../request/index.js\";\nimport { Container, Containers } from \"../Container/index.js\";\nimport { User, Users } from \"../User/index.js\";\nimport type { DatabaseDefinition } from \"./DatabaseDefinition.js\";\nimport { DatabaseResponse } from \"./DatabaseResponse.js\";\nimport type { OfferDefinition } from \"../Offer/index.js\";\nimport { OfferResponse, Offer } from \"../Offer/index.js\";\nimport type { Resource } from \"../Resource.js\";\nimport type { DiagnosticNodeInternal } from \"../../diagnostics/DiagnosticNodeInternal.js\";\nimport {\n getEmptyCosmosDiagnostics,\n withDiagnostics,\n withMetadataDiagnostics,\n} from \"../../utils/diagnostics.js\";\nimport { MetadataLookUpType } from \"../../CosmosDiagnostics.js\";\nimport type {\n ClientEncryptionKeyRequest,\n KeyEncryptionKey,\n EncryptionKeyWrapMetadata,\n ClientEncryptionKeyProperties,\n} from \"../../encryption/index.js\";\nimport {\n ClientEncryptionKeyResponse,\n EncryptionAlgorithm,\n KeyEncryptionAlgorithm,\n} from \"../../encryption/index.js\";\nimport type { EncryptionManager } from \"../../encryption/EncryptionManager.js\";\n/**\n * Operations for reading or deleting an existing database.\n *\n * @see {@link Databases} for creating new databases, and reading/querying all databases; use `client.databases`.\n *\n * Note: all these operations make calls against a fixed budget.\n * You should design your system such that these calls scale sublinearly with your application.\n * For instance, do not call `database.read()` before every single `item.read()` call, to ensure the database exists;\n * do this once on application start up.\n */\nexport class Database {\n /**\n * Used for creating new containers, or querying/reading all containers.\n *\n * Use `.database(id)` to read, replace, or delete a specific, existing {@link Database} by id.\n *\n * @example Create a new container\n * ```ts snippet:DatabaseCreateContainer\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { body: containerDefinition, container } = await client\n * .database(\"<db id>\")\n * .containers.create({ id: \"<container id>\" });\n * ```\n */\n public readonly containers: Containers;\n /**\n * Used for creating new users, or querying/reading all users.\n *\n * Use `.user(id)` to read, replace, or delete a specific, existing {@link User} by id.\n */\n public readonly users: Users;\n\n /**\n * Returns a reference URL to the resource. Used for linking in Permissions.\n * @example\n * ```ts snippet:DatabaseGetUrl\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n *\n * const url = database.url;\n * ```\n */\n public get url(): string {\n return createDatabaseUri(this.id);\n }\n\n /**\n * @internal\n */\n public _rid: string;\n\n /** Returns a new {@link Database} instance.\n *\n * Note: the intention is to get this object from {@link CosmosClient} via `client.database(id)`, not to instantiate it yourself.\n * @hidden\n */\n constructor(\n public readonly client: CosmosClient,\n public readonly id: string,\n private clientContext: ClientContext,\n private encryptionManager?: EncryptionManager,\n _rid?: string,\n ) {\n this.containers = new Containers(this, this.clientContext, this.encryptionManager);\n this.users = new Users(this, this.clientContext);\n this._rid = _rid;\n }\n\n /**\n * Used to read, replace, or delete a specific, existing {@link Database} by id.\n *\n * Use `.containers` creating new containers, or querying/reading all containers.\n *\n * @example Delete a container\n * ```ts snippet:DatabaseDeleteContainer\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * await client.database(\"<db id>\").container(\"<container id>\").delete();\n * ```\n */\n public container(id: string): Container {\n return new Container(this, id, this.clientContext, this.encryptionManager);\n }\n\n /**\n * Used to read, replace, or delete a specific, existing {@link User} by id.\n *\n * Use `.users` for creating new users, or querying/reading all users.\n * @example Delete a user\n * ```ts snippet:DatabaseDeleteUser\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n * await client.database(\"<db id>\").user(\"<user id>\").delete();\n * ```\n */\n public user(id: string): User {\n return new User(this, id, this.clientContext);\n }\n\n /** Read the definition of the given Database.\n * @example\n * ```ts snippet:DatabaseRead\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { resource: database } = await client.database(\"<db id>\").read();\n * ```\n */\n public async read(options?: RequestOptions): Promise<DatabaseResponse> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n return this.readInternal(diagnosticNode, options);\n }, this.clientContext);\n }\n\n /**\n * @hidden\n */\n public async readInternal(\n diagnosticNode: DiagnosticNodeInternal,\n options?: RequestOptions,\n ): Promise<DatabaseResponse> {\n const path = getPathFromLink(this.url);\n const id = getIdFromLink(this.url);\n const response = await this.clientContext.read<DatabaseDefinition>({\n path,\n resourceType: ResourceType.database,\n resourceId: id,\n options,\n diagnosticNode,\n });\n return new DatabaseResponse(\n response.result,\n response.headers,\n response.code,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }\n\n /** Delete the given Database.\n * @example\n * ```ts snippet:CosmosClientDatabaseDelete\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n * await client.database(\"<id here>\").delete();\n * ```\n */\n public async delete(options?: RequestOptions): Promise<DatabaseResponse> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n const path = getPathFromLink(this.url);\n const id = getIdFromLink(this.url);\n\n const response = await this.clientContext.delete<DatabaseDefinition>({\n path,\n resourceType: ResourceType.database,\n resourceId: id,\n options,\n diagnosticNode,\n });\n return new DatabaseResponse(\n response.result,\n response.headers,\n response.code,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n\n /**\n * Gets offer on database. If none exists, returns an OfferResponse with undefined.\n * @example Read the offer on the database\n * ```ts snippet:DatabaseReadOffer\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { resource: offer } = await client.database(\"<db id>\").readOffer();\n * ```\n */\n public async readOffer(options: RequestOptions = {}): Promise<OfferResponse> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n const { resource: record } = await withMetadataDiagnostics(\n async (node: DiagnosticNodeInternal) => {\n return this.readInternal(node);\n },\n diagnosticNode,\n MetadataLookUpType.DatabaseLookUp,\n );\n\n const path = \"/offers\";\n const url = record._self;\n\n const response = await this.clientContext.queryFeed<OfferDefinition & Resource[]>({\n path,\n resourceId: \"\",\n resourceType: ResourceType.offer,\n query: `SELECT * from root where root.resource = \"${url}\"`,\n resultFn: (result) => result.Offers,\n options,\n diagnosticNode,\n });\n const offer = response.result[0]\n ? new Offer(this.client, response.result[0].id, this.clientContext)\n : undefined;\n return new OfferResponse(\n response.result[0],\n response.headers,\n response.code,\n getEmptyCosmosDiagnostics(),\n offer,\n );\n }, this.clientContext);\n }\n\n /**\n * Create Encryption key for database account\n * @example\n * ```ts snippet:DatabaseCreateClientEncryptionKey\n * import { ClientSecretCredential } from \"@azure/identity\";\n * import {\n * AzureKeyVaultEncryptionKeyResolver,\n * CosmosClient,\n * EncryptionKeyWrapMetadata,\n * EncryptionKeyResolverName,\n * KeyEncryptionAlgorithm,\n * EncryptionAlgorithm,\n * } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const credentials = new ClientSecretCredential(\"<tenant-id>\", \"<client-id>\", \"<app-secret>\");\n * const keyResolver = new AzureKeyVaultEncryptionKeyResolver(credentials);\n * const client = new CosmosClient({\n * endpoint,\n * key,\n * clientEncryptionOptions: {\n * keyEncryptionKeyResolver: keyResolver,\n * },\n * });\n * const { database } = await client.databases.createIfNotExists({ id: \"<db id>\" });\n * const metadata: EncryptionKeyWrapMetadata = {\n * type: EncryptionKeyResolverName.AzureKeyVault,\n * name: \"<key-name>\",\n * value: \"<key-vault-url>\",\n * algorithm: KeyEncryptionAlgorithm.RSA_OAEP,\n * };\n *\n * await database.createClientEncryptionKey(\n * \"<cek-id>\",\n * EncryptionAlgorithm.AEAD_AES_256_CBC_HMAC_SHA256,\n * metadata,\n * );\n * ```\n */\n public async createClientEncryptionKey(\n clientEncryptionKeyId: string,\n encryptionAlgorithm: EncryptionAlgorithm,\n keyWrapMetadata: EncryptionKeyWrapMetadata,\n ): Promise<ClientEncryptionKeyResponse> {\n if (clientEncryptionKeyId == null || !clientEncryptionKeyId.trim()) {\n throw new Error(\"encryption key id cannot be null or empty\");\n }\n if (encryptionAlgorithm !== EncryptionAlgorithm.AEAD_AES_256_CBC_HMAC_SHA256) {\n throw new Error(`Invalid encryption algorithm '${encryptionAlgorithm}' passed.`);\n }\n if (!keyWrapMetadata) {\n throw new Error(\"encryptionKeyWrapMetadata cannot be null.\");\n }\n if (keyWrapMetadata.algorithm !== KeyEncryptionAlgorithm.RSA_OAEP) {\n throw new Error(`Invalid key wrap algorithm '${keyWrapMetadata.algorithm}' passed.`);\n }\n if (!this.clientContext.enableEncryption) {\n throw new Error(\n \"Creating a client encryption key requires the use of an encryption-enabled client.\",\n );\n }\n\n const keyEncryptionKey: KeyEncryptionKey =\n this.encryptionManager.keyEncryptionKeyCache.getOrCreate(\n keyWrapMetadata.name,\n keyWrapMetadata.value,\n this.encryptionManager.encryptionKeyStoreProvider,\n );\n\n const protectedDataEncryptionKey =\n await this.encryptionManager.protectedDataEncryptionKeyCache.getOrCreate(\n clientEncryptionKeyId,\n keyEncryptionKey,\n );\n\n const wrappedDataEncryptionKey = protectedDataEncryptionKey.encryptedValue;\n\n const body: ClientEncryptionKeyRequest = {\n id: clientEncryptionKeyId,\n encryptionAlgorithm: encryptionAlgorithm,\n keyWrapMetadata: keyWrapMetadata,\n wrappedDataEncryptionKey: wrappedDataEncryptionKey.toString(\"base64\"),\n };\n\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n const path = getPathFromLink(this.url, ResourceType.clientencryptionkey);\n const databaseId = getIdFromLink(this.url);\n const response = await this.clientContext.create<ClientEncryptionKeyRequest>({\n body,\n path: path,\n resourceType: ResourceType.clientencryptionkey,\n resourceId: databaseId,\n diagnosticNode,\n });\n const ref: ClientEncryptionKeyProperties = {\n id: response.result.id,\n encryptionAlgorithm: response.result.encryptionAlgorithm,\n etag: response.result._etag,\n wrappedDataEncryptionKey: new Uint8Array(\n Buffer.from(response.result.wrappedDataEncryptionKey, \"base64\"),\n ),\n encryptionKeyWrapMetadata: response.result.keyWrapMetadata,\n };\n return new ClientEncryptionKeyResponse(\n response.result,\n response.headers,\n response.code,\n ref,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n\n /**\n * Read Encryption key for database account\n * @example\n * ```ts snippet:DatabaseReadClientEncryptionKey\n * import { ClientSecretCredential } from \"@azure/identity\";\n * import { AzureKeyVaultEncryptionKeyResolver, CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const credentials = new ClientSecretCredential(\"<tenant-id>\", \"<client-id>\", \"<app-secret>\");\n * const keyResolver = new AzureKeyVaultEncryptionKeyResolver(credentials);\n * const client = new CosmosClient({\n * endpoint,\n * key,\n * clientEncryptionOptions: {\n * keyEncryptionKeyResolver: keyResolver,\n * },\n * });\n * const { database } = await client.databases.createIfNotExists({ id: \"<db id>\" });\n *\n * const { resource: clientEncryptionKey } = await database.readClientEncryptionKey(\"<cek-id>\");\n * ```\n */\n public async readClientEncryptionKey(\n clientEncryptionKeyId: string,\n ): Promise<ClientEncryptionKeyResponse> {\n if (clientEncryptionKeyId == null || !clientEncryptionKeyId.trim()) {\n throw new ErrorResponse(\"encryption key id cannot be null or empty\");\n }\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n if (!this._rid) {\n const databaseResponse = await this.readInternal(diagnosticNode);\n if (!databaseResponse || !databaseResponse.resource) {\n throw new ErrorResponse(`Error reading database with id ${clientEncryptionKeyId}`);\n }\n this._rid = databaseResponse.resource._rid;\n }\n const path = getPathFromLink(this.url, ResourceType.clientencryptionkey);\n const resourceid = getIdFromLink(this.url);\n const response = await this.clientContext.read<ClientEncryptionKeyRequest>({\n path: path + `/${clientEncryptionKeyId}`,\n resourceType: ResourceType.clientencryptionkey,\n resourceId: resourceid + `/${ResourceType.clientencryptionkey}/${clientEncryptionKeyId}`,\n options: { databaseRid: this._rid },\n diagnosticNode,\n });\n if (!response || !response.result) {\n throw new ErrorResponse(\n `Error reading client encryption key with id ${clientEncryptionKeyId}`,\n );\n }\n const ref: ClientEncryptionKeyProperties = {\n id: response.result.id,\n encryptionAlgorithm: response.result.encryptionAlgorithm,\n etag: response.result._etag,\n wrappedDataEncryptionKey: new Uint8Array(\n Buffer.from(response.result.wrappedDataEncryptionKey, \"base64\"),\n ),\n encryptionKeyWrapMetadata: response.result.keyWrapMetadata,\n };\n return new ClientEncryptionKeyResponse(\n response.result,\n response.headers,\n response.code,\n ref,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n /**\n * rewraps a client encryption key with new key encryption key\n * @param id - client encryption key id\n * @param newKeyWrapMetadata - new encryption key wrap metadata\n * @returns rewrapped client encryption key with new customer managed key\n * @example\n * ```ts snippet:DatabaseRewrapClientEncryptionKey\n * import { ClientSecretCredential } from \"@azure/identity\";\n * import {\n * AzureKeyVaultEncryptionKeyResolver,\n * CosmosClient,\n * EncryptionKeyWrapMetadata,\n * EncryptionKeyResolverName,\n * KeyEncryptionAlgorithm,\n * } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const credentials = new ClientSecretCredential(\"<tenant-id>\", \"<client-id>\", \"<app-secret>\");\n * const keyResolver = new AzureKeyVaultEncryptionKeyResolver(credentials);\n * const client = new CosmosClient({\n * endpoint,\n * key,\n * clientEncryptionOptions: {\n * keyEncryptionKeyResolver: keyResolver,\n * },\n * });\n * const { database } = await client.databases.createIfNotExists({ id: \"<db id>\" });\n * const newMetadata: EncryptionKeyWrapMetadata = {\n * type: EncryptionKeyResolverName.AzureKeyVault,\n * name: \"<key-name>\",\n * value: \"<key-vault-url>\",\n * algorithm: KeyEncryptionAlgorithm.RSA_OAEP,\n * };\n *\n * await database.rewrapClientEncryptionKey(\"<new-cek-id>\", newMetadata);\n * ```\n */\n public async rewrapClientEncryptionKey(\n clientEncryptionKeyId: string,\n newKeyWrapMetadata: EncryptionKeyWrapMetadata,\n ): Promise<ClientEncryptionKeyResponse> {\n if (clientEncryptionKeyId == null || !clientEncryptionKeyId.trim()) {\n throw new ErrorResponse(\"encryption key id cannot be null or empty\");\n }\n if (!newKeyWrapMetadata) {\n throw new ErrorResponse(\"encryptionKeyWrapMetadata cannot be null.\");\n }\n if (newKeyWrapMetadata.algorithm !== KeyEncryptionAlgorithm.RSA_OAEP) {\n throw new ErrorResponse(\n `Invalid key wrap algorithm '${newKeyWrapMetadata.algorithm}' passed.`,\n );\n }\n if (!this.clientContext.enableEncryption) {\n throw new ErrorResponse(\n \"Rewrapping a client encryption key requires the use of an encryption-enabled client.\",\n );\n }\n\n const res = await this.readClientEncryptionKey(clientEncryptionKeyId);\n if (!res || !res.clientEncryptionKeyProperties) {\n throw new ErrorResponse(\n `Error reading client encryption key with id ${clientEncryptionKeyId}`,\n );\n }\n let clientEncryptionKeyProperties = res.clientEncryptionKeyProperties;\n\n let keyEncryptionKey = this.encryptionManager.keyEncryptionKeyCache.getOrCreate(\n clientEncryptionKeyProperties.encryptionKeyWrapMetadata.name,\n clientEncryptionKeyProperties.encryptionKeyWrapMetadata.value,\n this.encryptionManager.encryptionKeyStoreProvider,\n );\n const unwrappedKey = await keyEncryptionKey.unwrapEncryptionKey(\n Buffer.from(clientEncryptionKeyProperties.wrappedDataEncryptionKey),\n );\n\n keyEncryptionKey = this.encryptionManager.keyEncryptionKeyCache.getOrCreate(\n newKeyWrapMetadata.name,\n newKeyWrapMetadata.value,\n this.encryptionManager.encryptionKeyStoreProvider,\n );\n const rewrappedKey = await keyEncryptionKey.wrapEncryptionKey(unwrappedKey);\n clientEncryptionKeyProperties = {\n id: clientEncryptionKeyId,\n encryptionAlgorithm: clientEncryptionKeyProperties.encryptionAlgorithm,\n etag: clientEncryptionKeyProperties.etag,\n wrappedDataEncryptionKey: rewrappedKey,\n encryptionKeyWrapMetadata: newKeyWrapMetadata,\n };\n const body: ClientEncryptionKeyRequest = {\n id: clientEncryptionKeyId,\n encryptionAlgorithm: clientEncryptionKeyProperties.encryptionAlgorithm,\n keyWrapMetadata: newKeyWrapMetadata,\n wrappedDataEncryptionKey: rewrappedKey.toString(\"base64\"),\n };\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n const path = getPathFromLink(this.url, ResourceType.clientencryptionkey);\n const resourceid = getIdFromLink(this.url);\n const options = {\n accessCondition: { type: \"IfMatch\", condition: clientEncryptionKeyProperties.etag },\n };\n const response = await this.clientContext.replace<ClientEncryptionKeyRequest>({\n body,\n path: path + `/${clientEncryptionKeyId}`,\n resourceType: ResourceType.clientencryptionkey,\n resourceId: resourceid + `/${ResourceType.clientencryptionkey}/${clientEncryptionKeyId}`,\n options,\n diagnosticNode,\n });\n\n if (!response || !response.result) {\n throw new ErrorResponse(\n `Error rewrapping client encryption key with id ${clientEncryptionKeyId}`,\n );\n }\n\n const ref: ClientEncryptionKeyProperties = {\n id: response.result.id,\n encryptionAlgorithm: response.result.encryptionAlgorithm,\n etag: response.result._etag,\n wrappedDataEncryptionKey: new Uint8Array(\n Buffer.from(response.result.wrappedDataEncryptionKey, \"base64\"),\n ),\n encryptionKeyWrapMetadata: response.result.keyWrapMetadata,\n };\n return new ClientEncryptionKeyResponse(\n response.result,\n response.headers,\n response.code,\n ref,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n}\n"]}
1
+ {"version":3,"file":"Database.js","sourceRoot":"","sources":["../../../../src/client/Database/Database.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,YAAY,GACb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAuB,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAOhE,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;GASG;AACH,MAAM,OAAO,QAAQ;IAyDD;IACA;IACR;IACA;IA3DV;;;;;;;;;;;;;;;;;OAiBG;IACa,UAAU,CAAa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Ae,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,6BAA6B,CAAC,IAAI,EAAE;aACpF,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAA6B;gBAC5E,IAAI;gBACJ,IAAI,EAAE,IAAI,GAAG,IAAI,qBAAqB,EAAE;gBACxC,YAAY,EAAE,YAAY,CAAC,mBAAmB;gBAC9C,UAAU,EAAE,UAAU,GAAG,IAAI,YAAY,CAAC,mBAAmB,IAAI,qBAAqB,EAAE;gBACxF,OAAO;gBACP,cAAc;aACf,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAClC,MAAM,IAAI,aAAa,CACrB,kDAAkD,qBAAqB,EAAE,CAC1E,CAAC;YACJ,CAAC;YAED,MAAM,GAAG,GAAkC;gBACzC,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE;gBACtB,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,mBAAmB;gBACxD,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK;gBAC3B,wBAAwB,EAAE,IAAI,UAAU,CACtC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAChE;gBACD,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe;aAC3D,CAAC;YACF,OAAO,IAAI,2BAA2B,CACpC,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,OAAO,EAChB,QAAQ,CAAC,IAAI,EACb,GAAG,EACH,yBAAyB,EAAE,CAC5B,CAAC;QACJ,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { ClientContext } from \"../../ClientContext.js\";\nimport {\n createDatabaseUri,\n getIdFromLink,\n getPathFromLink,\n ResourceType,\n} from \"../../common/index.js\";\nimport type { CosmosClient } from \"../../CosmosClient.js\";\nimport { ErrorResponse, type RequestOptions } from \"../../request/index.js\";\nimport { Container, Containers } from \"../Container/index.js\";\nimport { User, Users } from \"../User/index.js\";\nimport type { DatabaseDefinition } from \"./DatabaseDefinition.js\";\nimport { DatabaseResponse } from \"./DatabaseResponse.js\";\nimport type { OfferDefinition } from \"../Offer/index.js\";\nimport { OfferResponse, Offer } from \"../Offer/index.js\";\nimport type { Resource } from \"../Resource.js\";\nimport type { DiagnosticNodeInternal } from \"../../diagnostics/DiagnosticNodeInternal.js\";\nimport {\n getEmptyCosmosDiagnostics,\n withDiagnostics,\n withMetadataDiagnostics,\n} from \"../../utils/diagnostics.js\";\nimport { MetadataLookUpType } from \"../../CosmosDiagnostics.js\";\nimport type {\n ClientEncryptionKeyRequest,\n KeyEncryptionKey,\n EncryptionKeyWrapMetadata,\n ClientEncryptionKeyProperties,\n} from \"../../encryption/index.js\";\nimport {\n ClientEncryptionKeyResponse,\n EncryptionAlgorithm,\n KeyEncryptionAlgorithm,\n} from \"../../encryption/index.js\";\nimport type { EncryptionManager } from \"../../encryption/EncryptionManager.js\";\n/**\n * Operations for reading or deleting an existing database.\n *\n * @see {@link Databases} for creating new databases, and reading/querying all databases; use `client.databases`.\n *\n * Note: all these operations make calls against a fixed budget.\n * You should design your system such that these calls scale sublinearly with your application.\n * For instance, do not call `database.read()` before every single `item.read()` call, to ensure the database exists;\n * do this once on application start up.\n */\nexport class Database {\n /**\n * Used for creating new containers, or querying/reading all containers.\n *\n * Use `.database(id)` to read, replace, or delete a specific, existing {@link Database} by id.\n *\n * @example Create a new container\n * ```ts snippet:DatabaseCreateContainer\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { body: containerDefinition, container } = await client\n * .database(\"<db id>\")\n * .containers.create({ id: \"<container id>\" });\n * ```\n */\n public readonly containers: Containers;\n /**\n * Used for creating new users, or querying/reading all users.\n *\n * Use `.user(id)` to read, replace, or delete a specific, existing {@link User} by id.\n */\n public readonly users: Users;\n\n /**\n * Returns a reference URL to the resource. Used for linking in Permissions.\n * @example\n * ```ts snippet:DatabaseGetUrl\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n *\n * const url = database.url;\n * ```\n */\n public get url(): string {\n return createDatabaseUri(this.id);\n }\n\n /**\n * @internal\n */\n public _rid: string;\n\n /** Returns a new {@link Database} instance.\n *\n * Note: the intention is to get this object from {@link CosmosClient} via `client.database(id)`, not to instantiate it yourself.\n * @hidden\n */\n constructor(\n public readonly client: CosmosClient,\n public readonly id: string,\n private clientContext: ClientContext,\n private encryptionManager?: EncryptionManager,\n _rid?: string,\n ) {\n this.containers = new Containers(this, this.clientContext, this.encryptionManager);\n this.users = new Users(this, this.clientContext);\n this._rid = _rid;\n }\n\n /**\n * Used to read, replace, or delete a specific, existing {@link Database} by id.\n *\n * Use `.containers` creating new containers, or querying/reading all containers.\n *\n * @example Delete a container\n * ```ts snippet:DatabaseDeleteContainer\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * await client.database(\"<db id>\").container(\"<container id>\").delete();\n * ```\n */\n public container(id: string): Container {\n return new Container(this, id, this.clientContext, this.encryptionManager);\n }\n\n /**\n * Used to read, replace, or delete a specific, existing {@link User} by id.\n *\n * Use `.users` for creating new users, or querying/reading all users.\n * @example Delete a user\n * ```ts snippet:DatabaseDeleteUser\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n * await client.database(\"<db id>\").user(\"<user id>\").delete();\n * ```\n */\n public user(id: string): User {\n return new User(this, id, this.clientContext);\n }\n\n /** Read the definition of the given Database.\n * @example\n * ```ts snippet:DatabaseRead\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { resource: database } = await client.database(\"<db id>\").read();\n * ```\n */\n public async read(options?: RequestOptions): Promise<DatabaseResponse> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n return this.readInternal(diagnosticNode, options);\n }, this.clientContext);\n }\n\n /**\n * @hidden\n */\n public async readInternal(\n diagnosticNode: DiagnosticNodeInternal,\n options?: RequestOptions,\n ): Promise<DatabaseResponse> {\n const path = getPathFromLink(this.url);\n const id = getIdFromLink(this.url);\n const response = await this.clientContext.read<DatabaseDefinition>({\n path,\n resourceType: ResourceType.database,\n resourceId: id,\n options,\n diagnosticNode,\n });\n return new DatabaseResponse(\n response.result,\n response.headers,\n response.code,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }\n\n /** Delete the given Database.\n * @example\n * ```ts snippet:CosmosClientDatabaseDelete\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n * await client.database(\"<id here>\").delete();\n * ```\n */\n public async delete(options?: RequestOptions): Promise<DatabaseResponse> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n const path = getPathFromLink(this.url);\n const id = getIdFromLink(this.url);\n\n const response = await this.clientContext.delete<DatabaseDefinition>({\n path,\n resourceType: ResourceType.database,\n resourceId: id,\n options,\n diagnosticNode,\n });\n return new DatabaseResponse(\n response.result,\n response.headers,\n response.code,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n\n /**\n * Gets offer on database. If none exists, returns an OfferResponse with undefined.\n * @example Read the offer on the database\n * ```ts snippet:DatabaseReadOffer\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { resource: offer } = await client.database(\"<db id>\").readOffer();\n * ```\n */\n public async readOffer(options: RequestOptions = {}): Promise<OfferResponse> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n const { resource: record } = await withMetadataDiagnostics(\n async (node: DiagnosticNodeInternal) => {\n return this.readInternal(node);\n },\n diagnosticNode,\n MetadataLookUpType.DatabaseLookUp,\n );\n\n const path = \"/offers\";\n const url = record._self;\n\n const response = await this.clientContext.queryFeed<OfferDefinition & Resource[]>({\n path,\n resourceId: \"\",\n resourceType: ResourceType.offer,\n query: `SELECT * from root where root.resource = \"${url}\"`,\n resultFn: (result) => result.Offers,\n options,\n diagnosticNode,\n });\n const offer = response.result[0]\n ? new Offer(this.client, response.result[0].id, this.clientContext)\n : undefined;\n return new OfferResponse(\n response.result[0],\n response.headers,\n response.code,\n getEmptyCosmosDiagnostics(),\n offer,\n );\n }, this.clientContext);\n }\n\n /**\n * Create Encryption key for database account\n * @example\n * ```ts snippet:DatabaseCreateClientEncryptionKey\n * import { ClientSecretCredential } from \"@azure/identity\";\n * import {\n * AzureKeyVaultEncryptionKeyResolver,\n * CosmosClient,\n * EncryptionKeyWrapMetadata,\n * EncryptionKeyResolverName,\n * KeyEncryptionAlgorithm,\n * EncryptionAlgorithm,\n * } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const credentials = new ClientSecretCredential(\"<tenant-id>\", \"<client-id>\", \"<app-secret>\");\n * const keyResolver = new AzureKeyVaultEncryptionKeyResolver(credentials);\n * const client = new CosmosClient({\n * endpoint,\n * key,\n * clientEncryptionOptions: {\n * keyEncryptionKeyResolver: keyResolver,\n * },\n * });\n * const { database } = await client.databases.createIfNotExists({ id: \"<db id>\" });\n * const metadata: EncryptionKeyWrapMetadata = {\n * type: EncryptionKeyResolverName.AzureKeyVault,\n * name: \"<key-name>\",\n * value: \"<key-vault-url>\",\n * algorithm: KeyEncryptionAlgorithm.RSA_OAEP,\n * };\n *\n * await database.createClientEncryptionKey(\n * \"<cek-id>\",\n * EncryptionAlgorithm.AEAD_AES_256_CBC_HMAC_SHA256,\n * metadata,\n * );\n * ```\n */\n public async createClientEncryptionKey(\n clientEncryptionKeyId: string,\n encryptionAlgorithm: EncryptionAlgorithm,\n keyWrapMetadata: EncryptionKeyWrapMetadata,\n ): Promise<ClientEncryptionKeyResponse> {\n if (clientEncryptionKeyId == null || !clientEncryptionKeyId.trim()) {\n throw new Error(\"encryption key id cannot be null or empty\");\n }\n if (encryptionAlgorithm !== EncryptionAlgorithm.AEAD_AES_256_CBC_HMAC_SHA256) {\n throw new Error(`Invalid encryption algorithm '${encryptionAlgorithm}' passed.`);\n }\n if (!keyWrapMetadata) {\n throw new Error(\"encryptionKeyWrapMetadata cannot be null.\");\n }\n if (keyWrapMetadata.algorithm !== KeyEncryptionAlgorithm.RSA_OAEP) {\n throw new Error(`Invalid key wrap algorithm '${keyWrapMetadata.algorithm}' passed.`);\n }\n if (!this.clientContext.enableEncryption) {\n throw new Error(\n \"Creating a client encryption key requires the use of an encryption-enabled client.\",\n );\n }\n\n const keyEncryptionKey: KeyEncryptionKey =\n this.encryptionManager.keyEncryptionKeyCache.getOrCreate(\n keyWrapMetadata.name,\n keyWrapMetadata.value,\n this.encryptionManager.encryptionKeyStoreProvider,\n );\n\n const protectedDataEncryptionKey =\n await this.encryptionManager.protectedDataEncryptionKeyCache.getOrCreate(\n clientEncryptionKeyId,\n keyEncryptionKey,\n );\n\n const wrappedDataEncryptionKey = protectedDataEncryptionKey.encryptedValue;\n\n const body: ClientEncryptionKeyRequest = {\n id: clientEncryptionKeyId,\n encryptionAlgorithm: encryptionAlgorithm,\n keyWrapMetadata: keyWrapMetadata,\n wrappedDataEncryptionKey: wrappedDataEncryptionKey.toString(\"base64\"),\n };\n\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n const path = getPathFromLink(this.url, ResourceType.clientencryptionkey);\n const databaseId = getIdFromLink(this.url);\n const response = await this.clientContext.create<ClientEncryptionKeyRequest>({\n body,\n path: path,\n resourceType: ResourceType.clientencryptionkey,\n resourceId: databaseId,\n diagnosticNode,\n });\n const ref: ClientEncryptionKeyProperties = {\n id: response.result.id,\n encryptionAlgorithm: response.result.encryptionAlgorithm,\n etag: response.result._etag,\n wrappedDataEncryptionKey: new Uint8Array(\n Buffer.from(response.result.wrappedDataEncryptionKey, \"base64\"),\n ),\n encryptionKeyWrapMetadata: response.result.keyWrapMetadata,\n };\n return new ClientEncryptionKeyResponse(\n response.result,\n response.headers,\n response.code,\n ref,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n\n /**\n * Read Encryption key for database account\n * @example\n * ```ts snippet:DatabaseReadClientEncryptionKey\n * import { ClientSecretCredential } from \"@azure/identity\";\n * import { AzureKeyVaultEncryptionKeyResolver, CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const credentials = new ClientSecretCredential(\"<tenant-id>\", \"<client-id>\", \"<app-secret>\");\n * const keyResolver = new AzureKeyVaultEncryptionKeyResolver(credentials);\n * const client = new CosmosClient({\n * endpoint,\n * key,\n * clientEncryptionOptions: {\n * keyEncryptionKeyResolver: keyResolver,\n * },\n * });\n * const { database } = await client.databases.createIfNotExists({ id: \"<db id>\" });\n *\n * const { resource: clientEncryptionKey } = await database.readClientEncryptionKey(\"<cek-id>\");\n * ```\n */\n public async readClientEncryptionKey(\n clientEncryptionKeyId: string,\n ): Promise<ClientEncryptionKeyResponse> {\n if (clientEncryptionKeyId == null || !clientEncryptionKeyId.trim()) {\n throw new ErrorResponse(\"encryption key id cannot be null or empty\");\n }\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n if (!this._rid) {\n const databaseResponse = await this.readInternal(diagnosticNode);\n if (!databaseResponse || !databaseResponse.resource) {\n throw new ErrorResponse(`Error reading database with id ${clientEncryptionKeyId}`);\n }\n this._rid = databaseResponse.resource._rid;\n }\n const path = getPathFromLink(this.url, ResourceType.clientencryptionkey);\n const resourceid = getIdFromLink(this.url);\n const response = await this.clientContext.read<ClientEncryptionKeyRequest>({\n path: path + `/${clientEncryptionKeyId}`,\n resourceType: ResourceType.clientencryptionkey,\n resourceId: resourceid + `/${ResourceType.clientencryptionkey}/${clientEncryptionKeyId}`,\n options: { databaseRid: this._rid },\n diagnosticNode,\n });\n if (!response || !response.result) {\n throw new ErrorResponse(\n `Error reading client encryption key with id ${clientEncryptionKeyId}`,\n );\n }\n const ref: ClientEncryptionKeyProperties = {\n id: response.result.id,\n encryptionAlgorithm: response.result.encryptionAlgorithm,\n etag: response.result._etag,\n wrappedDataEncryptionKey: new Uint8Array(\n Buffer.from(response.result.wrappedDataEncryptionKey, \"base64\"),\n ),\n encryptionKeyWrapMetadata: response.result.keyWrapMetadata,\n };\n return new ClientEncryptionKeyResponse(\n response.result,\n response.headers,\n response.code,\n ref,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n /**\n * rewraps a client encryption key with new key encryption key\n * @param id - client encryption key id\n * @param newKeyWrapMetadata - new encryption key wrap metadata\n * @returns rewrapped client encryption key with new customer managed key\n * @example\n * ```ts snippet:DatabaseRewrapClientEncryptionKey\n * import { ClientSecretCredential } from \"@azure/identity\";\n * import {\n * AzureKeyVaultEncryptionKeyResolver,\n * CosmosClient,\n * EncryptionKeyWrapMetadata,\n * EncryptionKeyResolverName,\n * KeyEncryptionAlgorithm,\n * } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const credentials = new ClientSecretCredential(\"<tenant-id>\", \"<client-id>\", \"<app-secret>\");\n * const keyResolver = new AzureKeyVaultEncryptionKeyResolver(credentials);\n * const client = new CosmosClient({\n * endpoint,\n * key,\n * clientEncryptionOptions: {\n * keyEncryptionKeyResolver: keyResolver,\n * },\n * });\n * const { database } = await client.databases.createIfNotExists({ id: \"<db id>\" });\n * const newMetadata: EncryptionKeyWrapMetadata = {\n * type: EncryptionKeyResolverName.AzureKeyVault,\n * name: \"<key-name>\",\n * value: \"<key-vault-url>\",\n * algorithm: KeyEncryptionAlgorithm.RSA_OAEP,\n * };\n *\n * await database.rewrapClientEncryptionKey(\"<new-cek-id>\", newMetadata);\n * ```\n */\n public async rewrapClientEncryptionKey(\n clientEncryptionKeyId: string,\n newKeyWrapMetadata: EncryptionKeyWrapMetadata,\n ): Promise<ClientEncryptionKeyResponse> {\n if (clientEncryptionKeyId == null || !clientEncryptionKeyId.trim()) {\n throw new ErrorResponse(\"encryption key id cannot be null or empty\");\n }\n if (!newKeyWrapMetadata) {\n throw new ErrorResponse(\"encryptionKeyWrapMetadata cannot be null.\");\n }\n if (newKeyWrapMetadata.algorithm !== KeyEncryptionAlgorithm.RSA_OAEP) {\n throw new ErrorResponse(\n `Invalid key wrap algorithm '${newKeyWrapMetadata.algorithm}' passed.`,\n );\n }\n if (!this.clientContext.enableEncryption) {\n throw new ErrorResponse(\n \"Rewrapping a client encryption key requires the use of an encryption-enabled client.\",\n );\n }\n\n const res = await this.readClientEncryptionKey(clientEncryptionKeyId);\n if (!res || !res.clientEncryptionKeyProperties) {\n throw new ErrorResponse(\n `Error reading client encryption key with id ${clientEncryptionKeyId}`,\n );\n }\n let clientEncryptionKeyProperties = res.clientEncryptionKeyProperties;\n\n let keyEncryptionKey = this.encryptionManager.keyEncryptionKeyCache.getOrCreate(\n clientEncryptionKeyProperties.encryptionKeyWrapMetadata.name,\n clientEncryptionKeyProperties.encryptionKeyWrapMetadata.value,\n this.encryptionManager.encryptionKeyStoreProvider,\n );\n const unwrappedKey = await keyEncryptionKey.unwrapEncryptionKey(\n Buffer.from(clientEncryptionKeyProperties.wrappedDataEncryptionKey),\n );\n\n keyEncryptionKey = this.encryptionManager.keyEncryptionKeyCache.getOrCreate(\n newKeyWrapMetadata.name,\n newKeyWrapMetadata.value,\n this.encryptionManager.encryptionKeyStoreProvider,\n );\n const rewrappedKey = await keyEncryptionKey.wrapEncryptionKey(unwrappedKey);\n clientEncryptionKeyProperties = {\n id: clientEncryptionKeyId,\n encryptionAlgorithm: clientEncryptionKeyProperties.encryptionAlgorithm,\n etag: clientEncryptionKeyProperties.etag,\n wrappedDataEncryptionKey: rewrappedKey,\n encryptionKeyWrapMetadata: newKeyWrapMetadata,\n };\n const body: ClientEncryptionKeyRequest = {\n id: clientEncryptionKeyId,\n encryptionAlgorithm: clientEncryptionKeyProperties.encryptionAlgorithm,\n keyWrapMetadata: newKeyWrapMetadata,\n wrappedDataEncryptionKey: rewrappedKey.toString(\"base64\"),\n };\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n const path = getPathFromLink(this.url, ResourceType.clientencryptionkey);\n const resourceid = getIdFromLink(this.url);\n const options = {\n accessCondition: { type: \"IfMatch\", condition: clientEncryptionKeyProperties.etag },\n };\n const response = await this.clientContext.replace<ClientEncryptionKeyRequest>({\n body,\n path: path + `/${clientEncryptionKeyId}`,\n resourceType: ResourceType.clientencryptionkey,\n resourceId: resourceid + `/${ResourceType.clientencryptionkey}/${clientEncryptionKeyId}`,\n options,\n diagnosticNode,\n });\n\n if (!response || !response.result) {\n throw new ErrorResponse(\n `Error rewrapping client encryption key with id ${clientEncryptionKeyId}`,\n );\n }\n\n const ref: ClientEncryptionKeyProperties = {\n id: response.result.id,\n encryptionAlgorithm: response.result.encryptionAlgorithm,\n etag: response.result._etag,\n wrappedDataEncryptionKey: new Uint8Array(\n Buffer.from(response.result.wrappedDataEncryptionKey, \"base64\"),\n ),\n encryptionKeyWrapMetadata: response.result.keyWrapMetadata,\n };\n return new ClientEncryptionKeyResponse(\n response.result,\n response.headers,\n response.code,\n ref,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n}\n"]}
@@ -5,5 +5,7 @@ export class DatabaseResponse extends ResourceResponse {
5
5
  super(resource, headers, statusCode, diagnostics);
6
6
  this.database = database;
7
7
  }
8
+ /** A reference to the {@link Database} that the returned {@link DatabaseDefinition} corresponds to. */
9
+ database;
8
10
  }
9
11
  //# sourceMappingURL=DatabaseResponse.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseResponse.js","sourceRoot":"","sources":["../../../../src/client/Database/DatabaseResponse.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAKrE,8CAA8C;AAC9C,MAAM,OAAO,gBAAiB,SAAQ,gBAA+C;IACnF,YACE,QAAuC,EACvC,OAAsB,EACtB,UAAkB,EAClB,QAAkB,EAClB,WAA8B;QAE9B,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CAGF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { CosmosDiagnostics } from \"../../CosmosDiagnostics.js\";\nimport type { CosmosHeaders } from \"../../queryExecutionContext/index.js\";\nimport { ResourceResponse } from \"../../request/ResourceResponse.js\";\nimport type { Resource } from \"../Resource.js\";\nimport type { Database } from \"./Database.js\";\nimport type { DatabaseDefinition } from \"./DatabaseDefinition.js\";\n\n/** Response object for Database operations */\nexport class DatabaseResponse extends ResourceResponse<DatabaseDefinition & Resource> {\n constructor(\n resource: DatabaseDefinition & Resource,\n headers: CosmosHeaders,\n statusCode: number,\n database: Database,\n diagnostics: CosmosDiagnostics,\n ) {\n super(resource, headers, statusCode, diagnostics);\n this.database = database;\n }\n /** A reference to the {@link Database} that the returned {@link DatabaseDefinition} corresponds to. */\n public readonly database: Database;\n}\n"]}
1
+ {"version":3,"file":"DatabaseResponse.js","sourceRoot":"","sources":["../../../../src/client/Database/DatabaseResponse.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAKrE,8CAA8C;AAC9C,MAAM,OAAO,gBAAiB,SAAQ,gBAA+C;IACnF,YACE,QAAuC,EACvC,OAAsB,EACtB,UAAkB,EAClB,QAAkB,EAClB,WAA8B;QAE9B,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IACD,uGAAuG;IACvF,QAAQ,CAAW;CACpC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { CosmosDiagnostics } from \"../../CosmosDiagnostics.js\";\nimport type { CosmosHeaders } from \"../../queryExecutionContext/index.js\";\nimport { ResourceResponse } from \"../../request/ResourceResponse.js\";\nimport type { Resource } from \"../Resource.js\";\nimport type { Database } from \"./Database.js\";\nimport type { DatabaseDefinition } from \"./DatabaseDefinition.js\";\n\n/** Response object for Database operations */\nexport class DatabaseResponse extends ResourceResponse<DatabaseDefinition & Resource> {\n constructor(\n resource: DatabaseDefinition & Resource,\n headers: CosmosHeaders,\n statusCode: number,\n database: Database,\n diagnostics: CosmosDiagnostics,\n ) {\n super(resource, headers, statusCode, diagnostics);\n this.database = database;\n }\n /** A reference to the {@link Database} that the returned {@link DatabaseDefinition} corresponds to. */\n public readonly database: Database;\n}\n"]}
@@ -18,6 +18,9 @@ import { getEmptyCosmosDiagnostics, withDiagnostics } from "../../utils/diagnost
18
18
  * do this once on application start up.
19
19
  */
20
20
  export class Databases {
21
+ client;
22
+ clientContext;
23
+ encryptionManager;
21
24
  /**
22
25
  * @hidden
23
26
  * @param client - The parent {@link CosmosClient} for the Database.
@@ -1 +1 @@
1
- {"version":3,"file":"Databases.js","sourceRoot":"","sources":["../../../../src/client/Database/Databases.ts"],"names":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AC;gBAClB,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,QAAQ,EAAE,CAAC;oBACtC,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;oBAChF,iDAAiD;oBACjD,YAAY,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;oBAClD,OAAO,cAAc,CAAC;gBACxB,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAC;gBACZ,CAAC;YACH,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;IAED,4CAA4C;IAC5C;;;;;;;;;;;;;;OAcG;IACI,OAAO,CAAC,OAAqB;QAClC,OAAO,IAAI,CAAC,KAAK,CAAgC,SAAS,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientContext } from \"../../ClientContext.js\";\nimport { Constants, isResourceValid, ResourceType, StatusCodes } from \"../../common/index.js\";\nimport type { CosmosClient } from \"../../CosmosClient.js\";\nimport type { FetchFunctionCallback, SqlQuerySpec } from \"../../queryExecutionContext/index.js\";\nimport { mergeHeaders } from \"../../queryExecutionContext/index.js\";\nimport { QueryIterator } from \"../../queryIterator.js\";\nimport type { FeedOptions, RequestOptions } from \"../../request/index.js\";\nimport type { Resource } from \"../Resource.js\";\nimport { Database } from \"./Database.js\";\nimport type { DatabaseDefinition } from \"./DatabaseDefinition.js\";\nimport type { DatabaseRequest } from \"./DatabaseRequest.js\";\nimport { DatabaseResponse } from \"./DatabaseResponse.js\";\nimport { validateOffer } from \"../../utils/offers.js\";\nimport type { DiagnosticNodeInternal } from \"../../diagnostics/DiagnosticNodeInternal.js\";\nimport { getEmptyCosmosDiagnostics, withDiagnostics } from \"../../utils/diagnostics.js\";\nimport type { EncryptionManager } from \"../../encryption/EncryptionManager.js\";\n\n/**\n * Operations for creating new databases, and reading/querying all databases\n *\n * @see {@link Database} for reading or deleting an existing database; use `client.database(id)`.\n *\n * Note: all these operations make calls against a fixed budget.\n * You should design your system such that these calls scale sublinearly with your application.\n * For instance, do not call `databases.readAll()` before every single `item.read()` call, to ensure the database exists;\n * do this once on application start up.\n */\nexport class Databases {\n /**\n * @hidden\n * @param client - The parent {@link CosmosClient} for the Database.\n */\n constructor(\n public readonly client: CosmosClient,\n private readonly clientContext: ClientContext,\n private encryptionManager?: EncryptionManager,\n ) {}\n\n /**\n * Queries all databases.\n * @param query - Query configuration for the operation. See {@link SqlQuerySpec} for more info on how to configure a query.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return all databases in an array or iterate over them one at a time.\n * @example Read all databases to array.\n * ```ts snippet:DatabasesQueryDatabases\n * import { CosmosClient, SqlQuerySpec } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const querySpec: SqlQuerySpec = {\n * query: `SELECT * FROM root r WHERE r.id = @database`,\n * parameters: [{ name: \"@database\", value: \"Todo\" }],\n * };\n * const { resources: databaseList } = await client.databases.query(querySpec).fetchAll();\n * ```\n */\n public query(query: string | SqlQuerySpec, options?: FeedOptions): QueryIterator<any>;\n /**\n * Queries all databases.\n * @param query - Query configuration for the operation. See {@link SqlQuerySpec} for more info on how to configure a query.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return all databases in an array or iterate over them one at a time.\n * @example Read all databases to array.\n * ```ts snippet:DatabasesQueryDatabases\n * import { CosmosClient, SqlQuerySpec } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const querySpec: SqlQuerySpec = {\n * query: `SELECT * FROM root r WHERE r.id = @database`,\n * parameters: [{ name: \"@database\", value: \"Todo\" }],\n * };\n * const { resources: databaseList } = await client.databases.query(querySpec).fetchAll();\n * ```\n */\n public query<T>(query: string | SqlQuerySpec, options?: FeedOptions): QueryIterator<T>;\n public query<T>(query: string | SqlQuerySpec, options?: FeedOptions): QueryIterator<T> {\n const cb: FetchFunctionCallback = (diagNode: DiagnosticNodeInternal, innerOptions) => {\n return this.clientContext.queryFeed({\n path: \"/dbs\",\n resourceType: ResourceType.database,\n resourceId: \"\",\n resultFn: (result) => result.Databases,\n query,\n options: innerOptions,\n diagnosticNode: diagNode,\n });\n };\n return new QueryIterator(this.clientContext, query, options, cb);\n }\n\n /**\n * Send a request for creating a database.\n *\n * A database manages users, permissions and a set of containers.\n * Each Azure Cosmos DB Database Account is able to support multiple independent named databases,\n * with the database being the logical container for data.\n *\n * Each Database consists of one or more containers, each of which in turn contain one or more\n * documents. Since databases are an administrative resource, the Service Master Key will be\n * required in order to access and successfully complete any action using the User APIs.\n *\n * @param body - The {@link DatabaseDefinition} that represents the {@link Database} to be created.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @example\n * ```ts snippet:CosmosClientDatabases\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n * const { resource: databaseDefinition, database } = await client.databases.create({\n * id: \"<name here>\",\n * });\n * ```\n */\n public async create(\n body: DatabaseRequest,\n options: RequestOptions = {},\n ): Promise<DatabaseResponse> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n return this.createInternal(diagnosticNode, body, options);\n }, this.clientContext);\n }\n\n /**\n * @hidden\n */\n public async createInternal(\n diagnosticNode: DiagnosticNodeInternal,\n body: DatabaseRequest,\n options: RequestOptions = {},\n ): Promise<DatabaseResponse> {\n const err = {};\n if (!isResourceValid(body, err)) {\n throw err;\n }\n\n validateOffer(body);\n\n if (body.maxThroughput) {\n const autoscaleParams: {\n maxThroughput: number;\n autoUpgradePolicy?: {\n throughputPolicy: {\n incrementPercent: number;\n };\n };\n } = {\n maxThroughput: body.maxThroughput,\n };\n if (body.autoUpgradePolicy) {\n autoscaleParams.autoUpgradePolicy = body.autoUpgradePolicy;\n }\n const autoscaleHeaders = JSON.stringify(autoscaleParams);\n options.initialHeaders = Object.assign({}, options.initialHeaders, {\n [Constants.HttpHeaders.AutoscaleSettings]: autoscaleHeaders,\n });\n delete body.maxThroughput;\n delete body.autoUpgradePolicy;\n }\n\n if (body.throughput) {\n options.initialHeaders = Object.assign({}, options.initialHeaders, {\n [Constants.HttpHeaders.OfferThroughput]: body.throughput,\n });\n delete body.throughput;\n }\n\n const path = \"/dbs\"; // TODO: constant\n const response = await this.clientContext.create<DatabaseRequest>({\n body,\n path,\n resourceType: ResourceType.database,\n resourceId: undefined,\n diagnosticNode,\n options,\n });\n const ref = new Database(\n this.client,\n body.id,\n this.clientContext,\n this.encryptionManager,\n response.result._rid,\n );\n return new DatabaseResponse(\n response.result,\n response.headers,\n response.code,\n ref,\n getEmptyCosmosDiagnostics(),\n );\n }\n\n /**\n * Check if a database exists, and if it doesn't, create it.\n * This will make a read operation based on the id in the `body`, then if it is not found, a create operation.\n *\n * A database manages users, permissions and a set of containers.\n * Each Azure Cosmos DB Database Account is able to support multiple independent named databases,\n * with the database being the logical container for data.\n *\n * Each Database consists of one or more containers, each of which in turn contain one or more\n * documents. Since databases are an an administrative resource, the Service Master Key will be\n * required in order to access and successfully complete any action using the User APIs.\n *\n * @param body - The {@link DatabaseDefinition} that represents the {@link Database} to be created.\n * @param options - Additional options for the request\n * @example\n * ```ts snippet:ReadmeSampleCreateDatabase\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n * ```\n */\n public async createIfNotExists(\n body: DatabaseRequest,\n options?: RequestOptions,\n ): Promise<DatabaseResponse> {\n if (!body || body.id === null || body.id === undefined) {\n throw new Error(\"body parameter must be an object with an id property\");\n }\n /*\n 1. Attempt to read the Database (based on an assumption that most databases will already exist, so its faster)\n 2. If it fails with NotFound error, attempt to create the db. Else, return the read results.\n */\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n try {\n const readResponse = await this.client\n .database(body.id)\n .readInternal(diagnosticNode, options);\n return readResponse;\n } catch (err: any) {\n if (err.code === StatusCodes.NotFound) {\n const createResponse = await this.createInternal(diagnosticNode, body, options);\n // Must merge the headers to capture RU costskaty\n mergeHeaders(createResponse.headers, err.headers);\n return createResponse;\n } else {\n throw err;\n }\n }\n }, this.clientContext);\n }\n\n // TODO: DatabaseResponse for QueryIterator?\n /**\n * Reads all databases.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return all databases in an array or iterate over them one at a time.\n * @example Read all databases to array.\n * ```ts snippet:DatabasesReadAll\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { resources: databaseList } = await client.databases.readAll().fetchAll();\n * ```\n */\n public readAll(options?: FeedOptions): QueryIterator<DatabaseDefinition & Resource> {\n return this.query<DatabaseDefinition & Resource>(undefined, options);\n }\n}\n"]}
1
+ {"version":3,"file":"Databases.js","sourceRoot":"","sources":["../../../../src/client/Database/Databases.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG9F,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA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OAAO,cAAc,CAAC;gBACxB,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAC;gBACZ,CAAC;YACH,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;IAED,4CAA4C;IAC5C;;;;;;;;;;;;;;OAcG;IACI,OAAO,CAAC,OAAqB;QAClC,OAAO,IAAI,CAAC,KAAK,CAAgC,SAAS,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientContext } from \"../../ClientContext.js\";\nimport { Constants, isResourceValid, ResourceType, StatusCodes } from \"../../common/index.js\";\nimport type { CosmosClient } from \"../../CosmosClient.js\";\nimport type { FetchFunctionCallback, SqlQuerySpec } from \"../../queryExecutionContext/index.js\";\nimport { mergeHeaders } from \"../../queryExecutionContext/index.js\";\nimport { QueryIterator } from \"../../queryIterator.js\";\nimport type { FeedOptions, RequestOptions } from \"../../request/index.js\";\nimport type { Resource } from \"../Resource.js\";\nimport { Database } from \"./Database.js\";\nimport type { DatabaseDefinition } from \"./DatabaseDefinition.js\";\nimport type { DatabaseRequest } from \"./DatabaseRequest.js\";\nimport { DatabaseResponse } from \"./DatabaseResponse.js\";\nimport { validateOffer } from \"../../utils/offers.js\";\nimport type { DiagnosticNodeInternal } from \"../../diagnostics/DiagnosticNodeInternal.js\";\nimport { getEmptyCosmosDiagnostics, withDiagnostics } from \"../../utils/diagnostics.js\";\nimport type { EncryptionManager } from \"../../encryption/EncryptionManager.js\";\n\n/**\n * Operations for creating new databases, and reading/querying all databases\n *\n * @see {@link Database} for reading or deleting an existing database; use `client.database(id)`.\n *\n * Note: all these operations make calls against a fixed budget.\n * You should design your system such that these calls scale sublinearly with your application.\n * For instance, do not call `databases.readAll()` before every single `item.read()` call, to ensure the database exists;\n * do this once on application start up.\n */\nexport class Databases {\n /**\n * @hidden\n * @param client - The parent {@link CosmosClient} for the Database.\n */\n constructor(\n public readonly client: CosmosClient,\n private readonly clientContext: ClientContext,\n private encryptionManager?: EncryptionManager,\n ) {}\n\n /**\n * Queries all databases.\n * @param query - Query configuration for the operation. See {@link SqlQuerySpec} for more info on how to configure a query.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return all databases in an array or iterate over them one at a time.\n * @example Read all databases to array.\n * ```ts snippet:DatabasesQueryDatabases\n * import { CosmosClient, SqlQuerySpec } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const querySpec: SqlQuerySpec = {\n * query: `SELECT * FROM root r WHERE r.id = @database`,\n * parameters: [{ name: \"@database\", value: \"Todo\" }],\n * };\n * const { resources: databaseList } = await client.databases.query(querySpec).fetchAll();\n * ```\n */\n public query(query: string | SqlQuerySpec, options?: FeedOptions): QueryIterator<any>;\n /**\n * Queries all databases.\n * @param query - Query configuration for the operation. See {@link SqlQuerySpec} for more info on how to configure a query.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return all databases in an array or iterate over them one at a time.\n * @example Read all databases to array.\n * ```ts snippet:DatabasesQueryDatabases\n * import { CosmosClient, SqlQuerySpec } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const querySpec: SqlQuerySpec = {\n * query: `SELECT * FROM root r WHERE r.id = @database`,\n * parameters: [{ name: \"@database\", value: \"Todo\" }],\n * };\n * const { resources: databaseList } = await client.databases.query(querySpec).fetchAll();\n * ```\n */\n public query<T>(query: string | SqlQuerySpec, options?: FeedOptions): QueryIterator<T>;\n public query<T>(query: string | SqlQuerySpec, options?: FeedOptions): QueryIterator<T> {\n const cb: FetchFunctionCallback = (diagNode: DiagnosticNodeInternal, innerOptions) => {\n return this.clientContext.queryFeed({\n path: \"/dbs\",\n resourceType: ResourceType.database,\n resourceId: \"\",\n resultFn: (result) => result.Databases,\n query,\n options: innerOptions,\n diagnosticNode: diagNode,\n });\n };\n return new QueryIterator(this.clientContext, query, options, cb);\n }\n\n /**\n * Send a request for creating a database.\n *\n * A database manages users, permissions and a set of containers.\n * Each Azure Cosmos DB Database Account is able to support multiple independent named databases,\n * with the database being the logical container for data.\n *\n * Each Database consists of one or more containers, each of which in turn contain one or more\n * documents. Since databases are an administrative resource, the Service Master Key will be\n * required in order to access and successfully complete any action using the User APIs.\n *\n * @param body - The {@link DatabaseDefinition} that represents the {@link Database} to be created.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @example\n * ```ts snippet:CosmosClientDatabases\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n * const { resource: databaseDefinition, database } = await client.databases.create({\n * id: \"<name here>\",\n * });\n * ```\n */\n public async create(\n body: DatabaseRequest,\n options: RequestOptions = {},\n ): Promise<DatabaseResponse> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n return this.createInternal(diagnosticNode, body, options);\n }, this.clientContext);\n }\n\n /**\n * @hidden\n */\n public async createInternal(\n diagnosticNode: DiagnosticNodeInternal,\n body: DatabaseRequest,\n options: RequestOptions = {},\n ): Promise<DatabaseResponse> {\n const err = {};\n if (!isResourceValid(body, err)) {\n throw err;\n }\n\n validateOffer(body);\n\n if (body.maxThroughput) {\n const autoscaleParams: {\n maxThroughput: number;\n autoUpgradePolicy?: {\n throughputPolicy: {\n incrementPercent: number;\n };\n };\n } = {\n maxThroughput: body.maxThroughput,\n };\n if (body.autoUpgradePolicy) {\n autoscaleParams.autoUpgradePolicy = body.autoUpgradePolicy;\n }\n const autoscaleHeaders = JSON.stringify(autoscaleParams);\n options.initialHeaders = Object.assign({}, options.initialHeaders, {\n [Constants.HttpHeaders.AutoscaleSettings]: autoscaleHeaders,\n });\n delete body.maxThroughput;\n delete body.autoUpgradePolicy;\n }\n\n if (body.throughput) {\n options.initialHeaders = Object.assign({}, options.initialHeaders, {\n [Constants.HttpHeaders.OfferThroughput]: body.throughput,\n });\n delete body.throughput;\n }\n\n const path = \"/dbs\"; // TODO: constant\n const response = await this.clientContext.create<DatabaseRequest>({\n body,\n path,\n resourceType: ResourceType.database,\n resourceId: undefined,\n diagnosticNode,\n options,\n });\n const ref = new Database(\n this.client,\n body.id,\n this.clientContext,\n this.encryptionManager,\n response.result._rid,\n );\n return new DatabaseResponse(\n response.result,\n response.headers,\n response.code,\n ref,\n getEmptyCosmosDiagnostics(),\n );\n }\n\n /**\n * Check if a database exists, and if it doesn't, create it.\n * This will make a read operation based on the id in the `body`, then if it is not found, a create operation.\n *\n * A database manages users, permissions and a set of containers.\n * Each Azure Cosmos DB Database Account is able to support multiple independent named databases,\n * with the database being the logical container for data.\n *\n * Each Database consists of one or more containers, each of which in turn contain one or more\n * documents. Since databases are an an administrative resource, the Service Master Key will be\n * required in order to access and successfully complete any action using the User APIs.\n *\n * @param body - The {@link DatabaseDefinition} that represents the {@link Database} to be created.\n * @param options - Additional options for the request\n * @example\n * ```ts snippet:ReadmeSampleCreateDatabase\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n * ```\n */\n public async createIfNotExists(\n body: DatabaseRequest,\n options?: RequestOptions,\n ): Promise<DatabaseResponse> {\n if (!body || body.id === null || body.id === undefined) {\n throw new Error(\"body parameter must be an object with an id property\");\n }\n /*\n 1. Attempt to read the Database (based on an assumption that most databases will already exist, so its faster)\n 2. If it fails with NotFound error, attempt to create the db. Else, return the read results.\n */\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n try {\n const readResponse = await this.client\n .database(body.id)\n .readInternal(diagnosticNode, options);\n return readResponse;\n } catch (err: any) {\n if (err.code === StatusCodes.NotFound) {\n const createResponse = await this.createInternal(diagnosticNode, body, options);\n // Must merge the headers to capture RU costskaty\n mergeHeaders(createResponse.headers, err.headers);\n return createResponse;\n } else {\n throw err;\n }\n }\n }, this.clientContext);\n }\n\n // TODO: DatabaseResponse for QueryIterator?\n /**\n * Reads all databases.\n * @param options - Use to set options like response page size, continuation tokens, etc.\n * @returns {@link QueryIterator} Allows you to return all databases in an array or iterate over them one at a time.\n * @example Read all databases to array.\n * ```ts snippet:DatabasesReadAll\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { resources: databaseList } = await client.databases.readAll().fetchAll();\n * ```\n */\n public readAll(options?: FeedOptions): QueryIterator<DatabaseDefinition & Resource> {\n return this.query<DatabaseDefinition & Resource>(undefined, options);\n }\n}\n"]}
@@ -12,6 +12,10 @@ import { computePartitionKeyRangeId } from "../ClientUtils.js";
12
12
  * @see {@link Items} for operations on all items; see `container.items`.
13
13
  */
14
14
  export class Item {
15
+ container;
16
+ id;
17
+ clientContext;
18
+ partitionKey;
15
19
  /**
16
20
  * Returns a reference URL to the resource. Used for linking in Permissions.
17
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../src/client/Item/Item.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI1D,OAAO,EAAE,YAAY,E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GAC9C,MAAM,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;oBACpE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;oBACzB,cAAc,CAAC,wBAAwB,CACrC,SAAS,CAAC,UAAU,CAAC,2BAA2B,EAChD,wBAAwB,CACzB,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,eAAe,GAAG,IAAI,aAAa,CACvC,yEAAyE,KAAK,CAAC,OAAO,EAAE,CACzF,CAAC;oBACF,eAAe,CAAC,IAAI,GAAG,WAAW,CAAC,kBAAkB,CAAC;oBACtD,MAAM,eAAe,CAAC;gBACxB,CAAC;YACH,CAAC;YAED,OAAO,IAAI,YAAY,CACrB,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,OAAO,EAChB,QAAQ,CAAC,IAAI,EACb,QAAQ,CAAC,SAAS,EAClB,IAAI,EACJ,yBAAyB,EAAE,CAC5B,CAAC;QACJ,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { ClientContext } from \"../../ClientContext.js\";\nimport type { DiagnosticNodeInternal } from \"../../diagnostics/DiagnosticNodeInternal.js\";\nimport {\n Constants,\n copyObject,\n createDocumentUri,\n getIdFromLink,\n getPathFromLink,\n isItemResourceValid,\n ResourceType,\n StatusCodes,\n} from \"../../common/index.js\";\nimport type { PartitionKey, PartitionKeyInternal } from \"../../documents/index.js\";\nimport { convertToInternalPartitionKey } from \"../../documents/index.js\";\nimport type { RequestOptions, Response } from \"../../request/index.js\";\nimport { ErrorResponse } from \"../../request/index.js\";\nimport type { PatchRequestBody } from \"../../utils/patch.js\";\nimport { PatchOperationType } from \"../../utils/patch.js\";\nimport type { Container } from \"../Container/index.js\";\nimport type { Resource } from \"../Resource.js\";\nimport type { ItemDefinition } from \"./ItemDefinition.js\";\nimport { ItemResponse } from \"./ItemResponse.js\";\nimport { getEmptyCosmosDiagnostics, withDiagnostics } from \"../../utils/diagnostics.js\";\nimport { setPartitionKeyIfUndefined } from \"../../extractPartitionKey.js\";\nimport { computePartitionKeyRangeId } from \"../ClientUtils.js\";\n\n/**\n * Used to perform operations on a specific item.\n *\n * @see {@link Items} for operations on all items; see `container.items`.\n */\nexport class Item {\n private partitionKey: PartitionKeyInternal;\n /**\n * Returns a reference URL to the resource. Used for linking in Permissions.\n */\n public get url(): string {\n return createDocumentUri(this.container.database.id, this.container.id, this.id);\n }\n\n /**\n * @hidden\n * @param container - The parent {@link Container}.\n * @param id - The id of the given {@link Item}.\n * @param partitionKey - The primary key of the given {@link Item} (only for partitioned containers).\n */\n constructor(\n public readonly container: Container,\n public readonly id: string,\n private readonly clientContext: ClientContext,\n partitionKey?: PartitionKey,\n ) {\n this.partitionKey =\n partitionKey === undefined ? undefined : convertToInternalPartitionKey(partitionKey);\n }\n\n /**\n * Read the item's definition.\n *\n * Any provided type, T, is not necessarily enforced by the SDK.\n * You may get more or less properties and it's up to your logic to enforce it.\n * If the type, T, is a class, it won't pass `typeof` comparisons, because it won't have a match prototype.\n * It's recommended to only use interfaces.\n *\n * There is no set schema for JSON items. They may contain any number of custom properties.\n *\n * @param options - Additional options for the request\n *\n * @example Using custom type for response\n * ```ts snippet:ItemRead\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n *\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * interface TodoItem {\n * title: string;\n * done: boolean;\n * id: string;\n * }\n *\n * const { resource: item } = await container.item(\"id\", \"<pkValue>\").read<TodoItem>();\n * ```\n */\n public async read<T extends ItemDefinition = any>(\n options: RequestOptions = {},\n ): Promise<ItemResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n this.partitionKey = await setPartitionKeyIfUndefined(\n diagnosticNode,\n this.container,\n this.partitionKey,\n );\n let url = this.url;\n let partitionKey = this.partitionKey;\n let response: Response<T & Resource>;\n try {\n if (this.clientContext.enableEncryption) {\n await this.container.checkAndInitializeEncryption();\n options.containerRid = this.container._rid;\n let count = 0;\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n );\n const { partitionKeyList: encryptedPartitionKey, encryptedCount } =\n await this.container.encryptionProcessor.getEncryptedPartitionKeyValue(\n this.partitionKey,\n );\n partitionKey = encryptedPartitionKey;\n count += encryptedCount;\n if (await this.container.encryptionProcessor.isPathEncrypted(\"/id\")) {\n url = await this.container.encryptionProcessor.getEncryptedUrl(this.url);\n count++;\n }\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n count,\n );\n }\n const path = getPathFromLink(url);\n const id = getIdFromLink(url);\n\n const isPartitionLevelFailOverEnabled =\n this.clientContext.isPartitionLevelFailOverEnabled();\n const partitionKeyRangeId = await computePartitionKeyRangeId(\n diagnosticNode,\n partitionKey,\n this.clientContext.partitionKeyRangeCache,\n isPartitionLevelFailOverEnabled,\n this.container,\n );\n\n response = await this.clientContext.read<T>({\n path,\n resourceType: ResourceType.item,\n resourceId: id,\n options,\n partitionKey: partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n });\n } catch (error: any) {\n if (this.clientContext.enableEncryption) {\n await this.container.throwIfRequestNeedsARetryPostPolicyRefresh(error);\n }\n if (error.code !== StatusCodes.NotFound) {\n throw error;\n }\n response = error;\n }\n if (this.clientContext.enableEncryption) {\n diagnosticNode.beginEncryptionDiagnostics(Constants.Encryption.DiagnosticsDecryptOperation);\n const { body, propertiesDecryptedCount } = await this.container.encryptionProcessor.decrypt(\n response.result,\n );\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsDecryptOperation,\n propertiesDecryptedCount,\n );\n response.result = body;\n }\n return new ItemResponse(\n response.result,\n response.headers,\n response.code,\n response.substatus,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n\n /**\n * Replace the item's definition.\n *\n * There is no set schema for JSON items. They may contain any number of custom properties.\n *\n * @param body - The definition to replace the existing {@link Item}'s definition with.\n * @param options - Additional options for the request\n * @example\n * ```ts snippet:ItemReplaceItemDefinition\n * import { CosmosClient, ItemDefinition } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * const item: ItemDefinition = {\n * id: \"id\",\n * title: \"new_title\",\n * };\n *\n * const { resource: replacedItem } = await container.item(\"id\").replace(item);\n * ```\n */\n\n public replace(\n body: ItemDefinition,\n options?: RequestOptions,\n ): Promise<ItemResponse<ItemDefinition>>;\n /**\n * Replace the item's definition.\n *\n * Any provided type, T, is not necessarily enforced by the SDK.\n * You may get more or less properties and it's up to your logic to enforce it.\n *\n * There is no set schema for JSON items. They may contain any number of custom properties.\n *\n * @param body - The definition to replace the existing {@link Item}'s definition with.\n * @param options - Additional options for the request\n * @example\n * ```ts snippet:ItemReplace\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n *\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * interface TodoItem {\n * title: string;\n * done: boolean;\n * id: string;\n * }\n *\n * const { resource: item } = await container.item(\"id\", \"<pkValue>\").read<TodoItem>();\n *\n * item.done = true;\n * const { resource: replacedItem } = await container.item(\"id\").replace<TodoItem>(item);\n * ```\n */\n public replace<T extends ItemDefinition>(\n body: T,\n options?: RequestOptions,\n ): Promise<ItemResponse<T>>;\n public async replace<T extends ItemDefinition>(\n body: T,\n options: RequestOptions = {},\n ): Promise<ItemResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n this.partitionKey = await setPartitionKeyIfUndefined(\n diagnosticNode,\n this.container,\n this.partitionKey,\n );\n let partitionKey = this.partitionKey;\n const err = {};\n if (!isItemResourceValid(body, err)) {\n throw err;\n }\n let url = this.url;\n\n let response: Response<T & Resource>;\n try {\n if (this.clientContext.enableEncryption) {\n // returns copy to avoid encryption of original body passed\n body = copyObject(body);\n options = options || {};\n await this.container.checkAndInitializeEncryption();\n options.containerRid = this.container._rid;\n let count = 0;\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n );\n const { body: encryptedBody, propertiesEncryptedCount } =\n await this.container.encryptionProcessor.encrypt(body);\n body = encryptedBody;\n count += propertiesEncryptedCount;\n const { partitionKeyList: encryptedPartitionKeyList, encryptedCount } =\n await this.container.encryptionProcessor.getEncryptedPartitionKeyValue(\n this.partitionKey,\n );\n partitionKey = encryptedPartitionKeyList;\n count += encryptedCount;\n if (await this.container.encryptionProcessor.isPathEncrypted(\"/id\")) {\n url = await this.container.encryptionProcessor.getEncryptedUrl(this.url);\n count++;\n }\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n count,\n );\n }\n const path = getPathFromLink(url);\n const id = getIdFromLink(url);\n\n const isPartitionLevelFailOverEnabled =\n this.clientContext.isPartitionLevelFailOverEnabled();\n const partitionKeyRangeId = await computePartitionKeyRangeId(\n diagnosticNode,\n partitionKey,\n this.clientContext.partitionKeyRangeCache,\n isPartitionLevelFailOverEnabled,\n this.container,\n );\n\n response = await this.clientContext.replace<T>({\n body,\n path,\n resourceType: ResourceType.item,\n resourceId: id,\n options,\n partitionKey: partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n });\n } catch (error: any) {\n if (this.clientContext.enableEncryption) {\n await this.container.throwIfRequestNeedsARetryPostPolicyRefresh(error);\n }\n throw error;\n }\n if (this.clientContext.enableEncryption) {\n try {\n // try block for decrypting response. This is done so that we can throw special error message in case of decryption failure\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsDecryptOperation,\n );\n const { body: result, propertiesDecryptedCount } =\n await this.container.encryptionProcessor.decrypt(response.result);\n response.result = result;\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsDecryptOperation,\n propertiesDecryptedCount,\n );\n } catch (error) {\n const decryptionError = new ErrorResponse(\n `Item replace operation was successful but response decryption failed: + ${error.message}`,\n );\n decryptionError.code = StatusCodes.ServiceUnavailable;\n throw decryptionError;\n }\n }\n return new ItemResponse(\n response.result,\n response.headers,\n response.code,\n response.substatus,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n\n /**\n * Delete the item.\n *\n * Any provided type, T, is not necessarily enforced by the SDK.\n * You may get more or less properties and it's up to your logic to enforce it.\n *\n * @param options - Additional options for the request\n * @example\n * ```ts snippet:ItemDelete\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n *\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * interface TodoItem {\n * title: string;\n * done: boolean;\n * id: string;\n * }\n *\n * const { resource: item } = await container.item(\"id\", \"<pkValue>\").read<TodoItem>();\n *\n * await container.item(\"id\").delete<TodoItem>();\n * ```\n */\n public async delete<T extends ItemDefinition = any>(\n options: RequestOptions = {},\n ): Promise<ItemResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n this.partitionKey = await setPartitionKeyIfUndefined(\n diagnosticNode,\n this.container,\n this.partitionKey,\n );\n let partitionKey = this.partitionKey;\n let url = this.url;\n let response: Response<T & Resource>;\n try {\n if (this.clientContext.enableEncryption) {\n await this.container.checkAndInitializeEncryption();\n options.containerRid = this.container._rid;\n let count = 0;\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n );\n const { partitionKeyList, encryptedCount } =\n await this.container.encryptionProcessor.getEncryptedPartitionKeyValue(\n this.partitionKey,\n );\n partitionKey = partitionKeyList;\n count += encryptedCount;\n if (await this.container.encryptionProcessor.isPathEncrypted(\"/id\")) {\n url = await this.container.encryptionProcessor.getEncryptedUrl(this.url);\n count++;\n }\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n count,\n );\n }\n const path = getPathFromLink(url);\n const id = getIdFromLink(url);\n\n const isPartitionLevelFailOverEnabled =\n this.clientContext.isPartitionLevelFailOverEnabled();\n const partitionKeyRangeId = await computePartitionKeyRangeId(\n diagnosticNode,\n partitionKey,\n this.clientContext.partitionKeyRangeCache,\n isPartitionLevelFailOverEnabled,\n this.container,\n );\n\n response = await this.clientContext.delete<T>({\n path,\n resourceType: ResourceType.item,\n resourceId: id,\n options,\n partitionKey: partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n });\n } catch (error: any) {\n if (this.clientContext.enableEncryption) {\n await this.container.throwIfRequestNeedsARetryPostPolicyRefresh(error);\n }\n throw error;\n }\n\n return new ItemResponse(\n response.result,\n response.headers,\n response.code,\n response.substatus,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n\n /**\n * Perform a JSONPatch on the item.\n *\n * Any provided type, T, is not necessarily enforced by the SDK.\n * You may get more or less properties and it's up to your logic to enforce it.\n *\n * @param options - Additional options for the request\n * @example\n * ```ts snippet:ItemPatch\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * interface TodoItem {\n * title: string;\n * done: boolean;\n * id: string;\n * }\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n *\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * const { resource: item } = await container.item(\"id\", \"<pkValue>\").read<TodoItem>();\n *\n * const { resource: patchedItem } = await container.item(\"id\").patch<TodoItem>([\n * {\n * op: \"replace\", // Operation type (can be replace, add, remove, set, incr)\n * path: \"/title\", // The path to the property to update\n * value: \"new-title\", // New value for the property\n * },\n * {\n * op: \"remove\",\n * path: \"/done\",\n * },\n * ]);\n * ```\n */\n public async patch<T extends ItemDefinition = any>(\n body: PatchRequestBody,\n options: RequestOptions = {},\n ): Promise<ItemResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n this.partitionKey = await setPartitionKeyIfUndefined(\n diagnosticNode,\n this.container,\n this.partitionKey,\n );\n let url = this.url;\n let partitionKey = this.partitionKey;\n let response: Response<T & Resource>;\n try {\n if (this.clientContext.enableEncryption) {\n await this.container.checkAndInitializeEncryption();\n options.containerRid = this.container._rid;\n // returns copy to avoid encryption of original body passed\n body = copyObject(body);\n const operations = Array.isArray(body) ? body : body.operations;\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n );\n let propertiesEncryptedCount = 0;\n for (const operation of operations) {\n if (operation.op === PatchOperationType.remove) {\n continue;\n }\n const isPathEncrypted = await this.container.encryptionProcessor.isPathEncrypted(\n operation.path,\n );\n if (!isPathEncrypted) {\n continue;\n }\n if (operation.op === PatchOperationType.incr) {\n throw new ErrorResponse(\n `Increment patch operation is not allowed for encrypted path '${operation.path}'`,\n );\n }\n if (\"value\" in operation) {\n operation.value = await this.container.encryptionProcessor.encryptProperty(\n operation.path,\n operation.value,\n );\n }\n propertiesEncryptedCount++;\n }\n const { partitionKeyList, encryptedCount } =\n await this.container.encryptionProcessor.getEncryptedPartitionKeyValue(partitionKey);\n partitionKey = partitionKeyList;\n propertiesEncryptedCount += encryptedCount;\n if (await this.container.encryptionProcessor.isPathEncrypted(\"/id\")) {\n url = await this.container.encryptionProcessor.getEncryptedUrl(this.url);\n propertiesEncryptedCount++;\n }\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n propertiesEncryptedCount,\n );\n }\n const path = getPathFromLink(url);\n const id = getIdFromLink(url);\n\n const isPartitionLevelFailOverEnabled =\n this.clientContext.isPartitionLevelFailOverEnabled();\n const partitionKeyRangeId = await computePartitionKeyRangeId(\n diagnosticNode,\n partitionKey,\n this.clientContext.partitionKeyRangeCache,\n isPartitionLevelFailOverEnabled,\n this.container,\n );\n\n response = await this.clientContext.patch<T>({\n body,\n path,\n resourceType: ResourceType.item,\n resourceId: id,\n options,\n partitionKey: partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n });\n } catch (error: any) {\n if (this.clientContext.enableEncryption) {\n await this.container.throwIfRequestNeedsARetryPostPolicyRefresh(error);\n }\n throw error;\n }\n if (this.clientContext.enableEncryption) {\n try {\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsDecryptOperation,\n );\n const { body: result, propertiesDecryptedCount } =\n await this.container.encryptionProcessor.decrypt(response.result);\n response.result = result;\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsDecryptOperation,\n propertiesDecryptedCount,\n );\n } catch (error) {\n const decryptionError = new ErrorResponse(\n `Item patch operation was successful but response decryption failed: + ${error.message}`,\n );\n decryptionError.code = StatusCodes.ServiceUnavailable;\n throw decryptionError;\n }\n }\n\n return new ItemResponse(\n response.result,\n response.headers,\n response.code,\n response.substatus,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n}\n"]}
1
+ {"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../src/client/Item/Item.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,eAAe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,0CAA0C,CAAC,KAAK,CAAC,CAAC;gBACzE,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;YACD,IAAI,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC;gBACxC,IAAI,CAAC;oBACH,cAAc,CAAC,0BAA0B,CACvC,SAAS,CAAC,UAAU,CAAC,2BAA2B,CACjD,CAAC;oBACF,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,wBAAwB,EAAE,GAC9C,MAAM,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;oBACpE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;oBACzB,cAAc,CAAC,wBAAwB,CACrC,SAAS,CAAC,UAAU,CAAC,2BAA2B,EAChD,wBAAwB,CACzB,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,eAAe,GAAG,IAAI,aAAa,CACvC,yEAAyE,KAAK,CAAC,OAAO,EAAE,CACzF,CAAC;oBACF,eAAe,CAAC,IAAI,GAAG,WAAW,CAAC,kBAAkB,CAAC;oBACtD,MAAM,eAAe,CAAC;gBACxB,CAAC;YACH,CAAC;YAED,OAAO,IAAI,YAAY,CACrB,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,OAAO,EAChB,QAAQ,CAAC,IAAI,EACb,QAAQ,CAAC,SAAS,EAClB,IAAI,EACJ,yBAAyB,EAAE,CAC5B,CAAC;QACJ,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { ClientContext } from \"../../ClientContext.js\";\nimport type { DiagnosticNodeInternal } from \"../../diagnostics/DiagnosticNodeInternal.js\";\nimport {\n Constants,\n copyObject,\n createDocumentUri,\n getIdFromLink,\n getPathFromLink,\n isItemResourceValid,\n ResourceType,\n StatusCodes,\n} from \"../../common/index.js\";\nimport type { PartitionKey, PartitionKeyInternal } from \"../../documents/index.js\";\nimport { convertToInternalPartitionKey } from \"../../documents/index.js\";\nimport type { RequestOptions, Response } from \"../../request/index.js\";\nimport { ErrorResponse } from \"../../request/index.js\";\nimport type { PatchRequestBody } from \"../../utils/patch.js\";\nimport { PatchOperationType } from \"../../utils/patch.js\";\nimport type { Container } from \"../Container/index.js\";\nimport type { Resource } from \"../Resource.js\";\nimport type { ItemDefinition } from \"./ItemDefinition.js\";\nimport { ItemResponse } from \"./ItemResponse.js\";\nimport { getEmptyCosmosDiagnostics, withDiagnostics } from \"../../utils/diagnostics.js\";\nimport { setPartitionKeyIfUndefined } from \"../../extractPartitionKey.js\";\nimport { computePartitionKeyRangeId } from \"../ClientUtils.js\";\n\n/**\n * Used to perform operations on a specific item.\n *\n * @see {@link Items} for operations on all items; see `container.items`.\n */\nexport class Item {\n private partitionKey: PartitionKeyInternal;\n /**\n * Returns a reference URL to the resource. Used for linking in Permissions.\n */\n public get url(): string {\n return createDocumentUri(this.container.database.id, this.container.id, this.id);\n }\n\n /**\n * @hidden\n * @param container - The parent {@link Container}.\n * @param id - The id of the given {@link Item}.\n * @param partitionKey - The primary key of the given {@link Item} (only for partitioned containers).\n */\n constructor(\n public readonly container: Container,\n public readonly id: string,\n private readonly clientContext: ClientContext,\n partitionKey?: PartitionKey,\n ) {\n this.partitionKey =\n partitionKey === undefined ? undefined : convertToInternalPartitionKey(partitionKey);\n }\n\n /**\n * Read the item's definition.\n *\n * Any provided type, T, is not necessarily enforced by the SDK.\n * You may get more or less properties and it's up to your logic to enforce it.\n * If the type, T, is a class, it won't pass `typeof` comparisons, because it won't have a match prototype.\n * It's recommended to only use interfaces.\n *\n * There is no set schema for JSON items. They may contain any number of custom properties.\n *\n * @param options - Additional options for the request\n *\n * @example Using custom type for response\n * ```ts snippet:ItemRead\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n *\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * interface TodoItem {\n * title: string;\n * done: boolean;\n * id: string;\n * }\n *\n * const { resource: item } = await container.item(\"id\", \"<pkValue>\").read<TodoItem>();\n * ```\n */\n public async read<T extends ItemDefinition = any>(\n options: RequestOptions = {},\n ): Promise<ItemResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n this.partitionKey = await setPartitionKeyIfUndefined(\n diagnosticNode,\n this.container,\n this.partitionKey,\n );\n let url = this.url;\n let partitionKey = this.partitionKey;\n let response: Response<T & Resource>;\n try {\n if (this.clientContext.enableEncryption) {\n await this.container.checkAndInitializeEncryption();\n options.containerRid = this.container._rid;\n let count = 0;\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n );\n const { partitionKeyList: encryptedPartitionKey, encryptedCount } =\n await this.container.encryptionProcessor.getEncryptedPartitionKeyValue(\n this.partitionKey,\n );\n partitionKey = encryptedPartitionKey;\n count += encryptedCount;\n if (await this.container.encryptionProcessor.isPathEncrypted(\"/id\")) {\n url = await this.container.encryptionProcessor.getEncryptedUrl(this.url);\n count++;\n }\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n count,\n );\n }\n const path = getPathFromLink(url);\n const id = getIdFromLink(url);\n\n const isPartitionLevelFailOverEnabled =\n this.clientContext.isPartitionLevelFailOverEnabled();\n const partitionKeyRangeId = await computePartitionKeyRangeId(\n diagnosticNode,\n partitionKey,\n this.clientContext.partitionKeyRangeCache,\n isPartitionLevelFailOverEnabled,\n this.container,\n );\n\n response = await this.clientContext.read<T>({\n path,\n resourceType: ResourceType.item,\n resourceId: id,\n options,\n partitionKey: partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n });\n } catch (error: any) {\n if (this.clientContext.enableEncryption) {\n await this.container.throwIfRequestNeedsARetryPostPolicyRefresh(error);\n }\n if (error.code !== StatusCodes.NotFound) {\n throw error;\n }\n response = error;\n }\n if (this.clientContext.enableEncryption) {\n diagnosticNode.beginEncryptionDiagnostics(Constants.Encryption.DiagnosticsDecryptOperation);\n const { body, propertiesDecryptedCount } = await this.container.encryptionProcessor.decrypt(\n response.result,\n );\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsDecryptOperation,\n propertiesDecryptedCount,\n );\n response.result = body;\n }\n return new ItemResponse(\n response.result,\n response.headers,\n response.code,\n response.substatus,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n\n /**\n * Replace the item's definition.\n *\n * There is no set schema for JSON items. They may contain any number of custom properties.\n *\n * @param body - The definition to replace the existing {@link Item}'s definition with.\n * @param options - Additional options for the request\n * @example\n * ```ts snippet:ItemReplaceItemDefinition\n * import { CosmosClient, ItemDefinition } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * const item: ItemDefinition = {\n * id: \"id\",\n * title: \"new_title\",\n * };\n *\n * const { resource: replacedItem } = await container.item(\"id\").replace(item);\n * ```\n */\n\n public replace(\n body: ItemDefinition,\n options?: RequestOptions,\n ): Promise<ItemResponse<ItemDefinition>>;\n /**\n * Replace the item's definition.\n *\n * Any provided type, T, is not necessarily enforced by the SDK.\n * You may get more or less properties and it's up to your logic to enforce it.\n *\n * There is no set schema for JSON items. They may contain any number of custom properties.\n *\n * @param body - The definition to replace the existing {@link Item}'s definition with.\n * @param options - Additional options for the request\n * @example\n * ```ts snippet:ItemReplace\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n *\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * interface TodoItem {\n * title: string;\n * done: boolean;\n * id: string;\n * }\n *\n * const { resource: item } = await container.item(\"id\", \"<pkValue>\").read<TodoItem>();\n *\n * item.done = true;\n * const { resource: replacedItem } = await container.item(\"id\").replace<TodoItem>(item);\n * ```\n */\n public replace<T extends ItemDefinition>(\n body: T,\n options?: RequestOptions,\n ): Promise<ItemResponse<T>>;\n public async replace<T extends ItemDefinition>(\n body: T,\n options: RequestOptions = {},\n ): Promise<ItemResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n this.partitionKey = await setPartitionKeyIfUndefined(\n diagnosticNode,\n this.container,\n this.partitionKey,\n );\n let partitionKey = this.partitionKey;\n const err = {};\n if (!isItemResourceValid(body, err)) {\n throw err;\n }\n let url = this.url;\n\n let response: Response<T & Resource>;\n try {\n if (this.clientContext.enableEncryption) {\n // returns copy to avoid encryption of original body passed\n body = copyObject(body);\n options = options || {};\n await this.container.checkAndInitializeEncryption();\n options.containerRid = this.container._rid;\n let count = 0;\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n );\n const { body: encryptedBody, propertiesEncryptedCount } =\n await this.container.encryptionProcessor.encrypt(body);\n body = encryptedBody;\n count += propertiesEncryptedCount;\n const { partitionKeyList: encryptedPartitionKeyList, encryptedCount } =\n await this.container.encryptionProcessor.getEncryptedPartitionKeyValue(\n this.partitionKey,\n );\n partitionKey = encryptedPartitionKeyList;\n count += encryptedCount;\n if (await this.container.encryptionProcessor.isPathEncrypted(\"/id\")) {\n url = await this.container.encryptionProcessor.getEncryptedUrl(this.url);\n count++;\n }\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n count,\n );\n }\n const path = getPathFromLink(url);\n const id = getIdFromLink(url);\n\n const isPartitionLevelFailOverEnabled =\n this.clientContext.isPartitionLevelFailOverEnabled();\n const partitionKeyRangeId = await computePartitionKeyRangeId(\n diagnosticNode,\n partitionKey,\n this.clientContext.partitionKeyRangeCache,\n isPartitionLevelFailOverEnabled,\n this.container,\n );\n\n response = await this.clientContext.replace<T>({\n body,\n path,\n resourceType: ResourceType.item,\n resourceId: id,\n options,\n partitionKey: partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n });\n } catch (error: any) {\n if (this.clientContext.enableEncryption) {\n await this.container.throwIfRequestNeedsARetryPostPolicyRefresh(error);\n }\n throw error;\n }\n if (this.clientContext.enableEncryption) {\n try {\n // try block for decrypting response. This is done so that we can throw special error message in case of decryption failure\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsDecryptOperation,\n );\n const { body: result, propertiesDecryptedCount } =\n await this.container.encryptionProcessor.decrypt(response.result);\n response.result = result;\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsDecryptOperation,\n propertiesDecryptedCount,\n );\n } catch (error) {\n const decryptionError = new ErrorResponse(\n `Item replace operation was successful but response decryption failed: + ${error.message}`,\n );\n decryptionError.code = StatusCodes.ServiceUnavailable;\n throw decryptionError;\n }\n }\n return new ItemResponse(\n response.result,\n response.headers,\n response.code,\n response.substatus,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n\n /**\n * Delete the item.\n *\n * Any provided type, T, is not necessarily enforced by the SDK.\n * You may get more or less properties and it's up to your logic to enforce it.\n *\n * @param options - Additional options for the request\n * @example\n * ```ts snippet:ItemDelete\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n *\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * interface TodoItem {\n * title: string;\n * done: boolean;\n * id: string;\n * }\n *\n * const { resource: item } = await container.item(\"id\", \"<pkValue>\").read<TodoItem>();\n *\n * await container.item(\"id\").delete<TodoItem>();\n * ```\n */\n public async delete<T extends ItemDefinition = any>(\n options: RequestOptions = {},\n ): Promise<ItemResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n this.partitionKey = await setPartitionKeyIfUndefined(\n diagnosticNode,\n this.container,\n this.partitionKey,\n );\n let partitionKey = this.partitionKey;\n let url = this.url;\n let response: Response<T & Resource>;\n try {\n if (this.clientContext.enableEncryption) {\n await this.container.checkAndInitializeEncryption();\n options.containerRid = this.container._rid;\n let count = 0;\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n );\n const { partitionKeyList, encryptedCount } =\n await this.container.encryptionProcessor.getEncryptedPartitionKeyValue(\n this.partitionKey,\n );\n partitionKey = partitionKeyList;\n count += encryptedCount;\n if (await this.container.encryptionProcessor.isPathEncrypted(\"/id\")) {\n url = await this.container.encryptionProcessor.getEncryptedUrl(this.url);\n count++;\n }\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n count,\n );\n }\n const path = getPathFromLink(url);\n const id = getIdFromLink(url);\n\n const isPartitionLevelFailOverEnabled =\n this.clientContext.isPartitionLevelFailOverEnabled();\n const partitionKeyRangeId = await computePartitionKeyRangeId(\n diagnosticNode,\n partitionKey,\n this.clientContext.partitionKeyRangeCache,\n isPartitionLevelFailOverEnabled,\n this.container,\n );\n\n response = await this.clientContext.delete<T>({\n path,\n resourceType: ResourceType.item,\n resourceId: id,\n options,\n partitionKey: partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n });\n } catch (error: any) {\n if (this.clientContext.enableEncryption) {\n await this.container.throwIfRequestNeedsARetryPostPolicyRefresh(error);\n }\n throw error;\n }\n\n return new ItemResponse(\n response.result,\n response.headers,\n response.code,\n response.substatus,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n\n /**\n * Perform a JSONPatch on the item.\n *\n * Any provided type, T, is not necessarily enforced by the SDK.\n * You may get more or less properties and it's up to your logic to enforce it.\n *\n * @param options - Additional options for the request\n * @example\n * ```ts snippet:ItemPatch\n * import { CosmosClient } from \"@azure/cosmos\";\n *\n * const endpoint = \"https://your-account.documents.azure.com\";\n * const key = \"<database account masterkey>\";\n * const client = new CosmosClient({ endpoint, key });\n *\n * interface TodoItem {\n * title: string;\n * done: boolean;\n * id: string;\n * }\n *\n * const { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n *\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * const { resource: item } = await container.item(\"id\", \"<pkValue>\").read<TodoItem>();\n *\n * const { resource: patchedItem } = await container.item(\"id\").patch<TodoItem>([\n * {\n * op: \"replace\", // Operation type (can be replace, add, remove, set, incr)\n * path: \"/title\", // The path to the property to update\n * value: \"new-title\", // New value for the property\n * },\n * {\n * op: \"remove\",\n * path: \"/done\",\n * },\n * ]);\n * ```\n */\n public async patch<T extends ItemDefinition = any>(\n body: PatchRequestBody,\n options: RequestOptions = {},\n ): Promise<ItemResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n this.partitionKey = await setPartitionKeyIfUndefined(\n diagnosticNode,\n this.container,\n this.partitionKey,\n );\n let url = this.url;\n let partitionKey = this.partitionKey;\n let response: Response<T & Resource>;\n try {\n if (this.clientContext.enableEncryption) {\n await this.container.checkAndInitializeEncryption();\n options.containerRid = this.container._rid;\n // returns copy to avoid encryption of original body passed\n body = copyObject(body);\n const operations = Array.isArray(body) ? body : body.operations;\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n );\n let propertiesEncryptedCount = 0;\n for (const operation of operations) {\n if (operation.op === PatchOperationType.remove) {\n continue;\n }\n const isPathEncrypted = await this.container.encryptionProcessor.isPathEncrypted(\n operation.path,\n );\n if (!isPathEncrypted) {\n continue;\n }\n if (operation.op === PatchOperationType.incr) {\n throw new ErrorResponse(\n `Increment patch operation is not allowed for encrypted path '${operation.path}'`,\n );\n }\n if (\"value\" in operation) {\n operation.value = await this.container.encryptionProcessor.encryptProperty(\n operation.path,\n operation.value,\n );\n }\n propertiesEncryptedCount++;\n }\n const { partitionKeyList, encryptedCount } =\n await this.container.encryptionProcessor.getEncryptedPartitionKeyValue(partitionKey);\n partitionKey = partitionKeyList;\n propertiesEncryptedCount += encryptedCount;\n if (await this.container.encryptionProcessor.isPathEncrypted(\"/id\")) {\n url = await this.container.encryptionProcessor.getEncryptedUrl(this.url);\n propertiesEncryptedCount++;\n }\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsEncryptOperation,\n propertiesEncryptedCount,\n );\n }\n const path = getPathFromLink(url);\n const id = getIdFromLink(url);\n\n const isPartitionLevelFailOverEnabled =\n this.clientContext.isPartitionLevelFailOverEnabled();\n const partitionKeyRangeId = await computePartitionKeyRangeId(\n diagnosticNode,\n partitionKey,\n this.clientContext.partitionKeyRangeCache,\n isPartitionLevelFailOverEnabled,\n this.container,\n );\n\n response = await this.clientContext.patch<T>({\n body,\n path,\n resourceType: ResourceType.item,\n resourceId: id,\n options,\n partitionKey: partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n });\n } catch (error: any) {\n if (this.clientContext.enableEncryption) {\n await this.container.throwIfRequestNeedsARetryPostPolicyRefresh(error);\n }\n throw error;\n }\n if (this.clientContext.enableEncryption) {\n try {\n diagnosticNode.beginEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsDecryptOperation,\n );\n const { body: result, propertiesDecryptedCount } =\n await this.container.encryptionProcessor.decrypt(response.result);\n response.result = result;\n diagnosticNode.endEncryptionDiagnostics(\n Constants.Encryption.DiagnosticsDecryptOperation,\n propertiesDecryptedCount,\n );\n } catch (error) {\n const decryptionError = new ErrorResponse(\n `Item patch operation was successful but response decryption failed: + ${error.message}`,\n );\n decryptionError.code = StatusCodes.ServiceUnavailable;\n throw decryptionError;\n }\n }\n\n return new ItemResponse(\n response.result,\n response.headers,\n response.code,\n response.substatus,\n this,\n getEmptyCosmosDiagnostics(),\n );\n }, this.clientContext);\n }\n}\n"]}
@@ -4,5 +4,7 @@ export class ItemResponse extends ResourceResponse {
4
4
  super(resource, headers, statusCode, diagnostics, subsstatusCode);
5
5
  this.item = item;
6
6
  }
7
+ /** Reference to the {@link Item} the response corresponds to. */
8
+ item;
7
9
  }
8
10
  //# sourceMappingURL=ItemResponse.js.map