@azure/cosmos 4.4.1 → 4.5.0-alpha.20250718.3

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 (489) hide show
  1. package/dist/browser/ClientContext.d.ts +19 -10
  2. package/dist/browser/ClientContext.d.ts.map +1 -1
  3. package/dist/browser/ClientContext.js +30 -11
  4. package/dist/browser/ClientContext.js.map +1 -1
  5. package/dist/browser/CosmosClient.d.ts.map +1 -1
  6. package/dist/browser/CosmosClient.js +13 -2
  7. package/dist/browser/CosmosClient.js.map +1 -1
  8. package/dist/browser/PartitionKeyRangeFailoverInfo.d.ts +49 -0
  9. package/dist/browser/PartitionKeyRangeFailoverInfo.d.ts.map +1 -0
  10. package/dist/browser/PartitionKeyRangeFailoverInfo.js +130 -0
  11. package/dist/browser/PartitionKeyRangeFailoverInfo.js.map +1 -0
  12. package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
  13. package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.js +4 -0
  14. package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
  15. package/dist/browser/client/ClientUtils.d.ts +3 -1
  16. package/dist/browser/client/ClientUtils.d.ts.map +1 -1
  17. package/dist/browser/client/ClientUtils.js +10 -0
  18. package/dist/browser/client/ClientUtils.js.map +1 -1
  19. package/dist/browser/client/Item/Item.d.ts.map +1 -1
  20. package/dist/browser/client/Item/Item.js +13 -0
  21. package/dist/browser/client/Item/Item.js.map +1 -1
  22. package/dist/browser/client/Item/Items.d.ts +1 -0
  23. package/dist/browser/client/Item/Items.d.ts.map +1 -1
  24. package/dist/browser/client/Item/Items.js +29 -3
  25. package/dist/browser/client/Item/Items.js.map +1 -1
  26. package/dist/browser/common/constants.d.ts +20 -0
  27. package/dist/browser/common/constants.d.ts.map +1 -1
  28. package/dist/browser/common/constants.js +23 -1
  29. package/dist/browser/common/constants.js.map +1 -1
  30. package/dist/browser/common/platform.d.ts +6 -1
  31. package/dist/browser/common/platform.d.ts.map +1 -1
  32. package/dist/browser/common/platform.js +23 -4
  33. package/dist/browser/common/platform.js.map +1 -1
  34. package/dist/browser/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
  35. package/dist/browser/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
  36. package/dist/browser/diagnostics/DiagnosticNodeInternal.js.map +1 -1
  37. package/dist/browser/documents/ConnectionPolicy.d.ts +6 -0
  38. package/dist/browser/documents/ConnectionPolicy.d.ts.map +1 -1
  39. package/dist/browser/documents/ConnectionPolicy.js +2 -0
  40. package/dist/browser/documents/ConnectionPolicy.js.map +1 -1
  41. package/dist/browser/documents/DatabaseAccount.d.ts.map +1 -1
  42. package/dist/browser/documents/DatabaseAccount.js +3 -0
  43. package/dist/browser/documents/DatabaseAccount.js.map +1 -1
  44. package/dist/browser/documents/PartitionKeyDefinition.d.ts +1 -1
  45. package/dist/browser/documents/PartitionKeyDefinition.js.map +1 -1
  46. package/dist/browser/encryption/EncryptionKeyStoreProvider.d.ts.map +1 -1
  47. package/dist/browser/encryption/EncryptionKeyStoreProvider.js +2 -1
  48. package/dist/browser/encryption/EncryptionKeyStoreProvider.js.map +1 -1
  49. package/dist/browser/extractPartitionKey.d.ts.map +1 -1
  50. package/dist/browser/extractPartitionKey.js +33 -20
  51. package/dist/browser/extractPartitionKey.js.map +1 -1
  52. package/dist/browser/globalEndpointManager.d.ts +6 -0
  53. package/dist/browser/globalEndpointManager.d.ts.map +1 -1
  54. package/dist/browser/globalEndpointManager.js +9 -4
  55. package/dist/browser/globalEndpointManager.js.map +1 -1
  56. package/dist/browser/globalPartitionEndpointManager.d.ts +79 -0
  57. package/dist/browser/globalPartitionEndpointManager.d.ts.map +1 -0
  58. package/dist/browser/globalPartitionEndpointManager.js +278 -0
  59. package/dist/browser/globalPartitionEndpointManager.js.map +1 -0
  60. package/dist/browser/queryExecutionContext/Aggregators/index.d.ts.map +1 -1
  61. package/dist/browser/queryExecutionContext/Aggregators/index.js +1 -0
  62. package/dist/browser/queryExecutionContext/Aggregators/index.js.map +1 -1
  63. package/dist/browser/queryExecutionContext/documentProducer.d.ts +2 -3
  64. package/dist/browser/queryExecutionContext/documentProducer.d.ts.map +1 -1
  65. package/dist/browser/queryExecutionContext/documentProducer.js +16 -21
  66. package/dist/browser/queryExecutionContext/documentProducer.js.map +1 -1
  67. package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.d.ts +3 -1
  68. package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
  69. package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.js +10 -2
  70. package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
  71. package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
  72. package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.js +2 -1
  73. package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
  74. package/dist/browser/queryIterator.d.ts.map +1 -1
  75. package/dist/browser/queryIterator.js +2 -3
  76. package/dist/browser/queryIterator.js.map +1 -1
  77. package/dist/browser/request/ErrorResponse.d.ts +1 -1
  78. package/dist/browser/request/ErrorResponse.d.ts.map +1 -1
  79. package/dist/browser/request/ErrorResponse.js.map +1 -1
  80. package/dist/browser/request/RequestContext.d.ts +5 -0
  81. package/dist/browser/request/RequestContext.d.ts.map +1 -1
  82. package/dist/browser/request/RequestContext.js.map +1 -1
  83. package/dist/browser/request/RequestHandler.d.ts.map +1 -1
  84. package/dist/browser/request/RequestHandler.js +14 -4
  85. package/dist/browser/request/RequestHandler.js.map +1 -1
  86. package/dist/browser/request/request.d.ts.map +1 -1
  87. package/dist/browser/request/request.js +3 -3
  88. package/dist/browser/request/request.js.map +1 -1
  89. package/dist/browser/retry/RetryPolicy.d.ts +2 -2
  90. package/dist/browser/retry/RetryPolicy.d.ts.map +1 -1
  91. package/dist/browser/retry/RetryPolicy.js.map +1 -1
  92. package/dist/browser/retry/defaultRetryPolicy.d.ts.map +1 -1
  93. package/dist/browser/retry/defaultRetryPolicy.js +4 -8
  94. package/dist/browser/retry/defaultRetryPolicy.js.map +1 -1
  95. package/dist/browser/retry/endpointDiscoveryRetryPolicy.d.ts +5 -3
  96. package/dist/browser/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
  97. package/dist/browser/retry/endpointDiscoveryRetryPolicy.js +9 -2
  98. package/dist/browser/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
  99. package/dist/browser/retry/retryUtility.d.ts.map +1 -1
  100. package/dist/browser/retry/retryUtility.js +11 -5
  101. package/dist/browser/retry/retryUtility.js.map +1 -1
  102. package/dist/browser/retry/timeoutFailoverRetryPolicy.d.ts +6 -3
  103. package/dist/browser/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
  104. package/dist/browser/retry/timeoutFailoverRetryPolicy.js +15 -7
  105. package/dist/browser/retry/timeoutFailoverRetryPolicy.js.map +1 -1
  106. package/dist/browser/routing/partitionKeyRangeCache.d.ts.map +1 -1
  107. package/dist/browser/routing/partitionKeyRangeCache.js +11 -0
  108. package/dist/browser/routing/partitionKeyRangeCache.js.map +1 -1
  109. package/dist/browser/utils/checkURL.js +6 -0
  110. package/dist/browser/utils/checkURL.js.map +1 -1
  111. package/dist/browser/utils/hashing/hash.d.ts +2 -0
  112. package/dist/browser/utils/hashing/hash.d.ts.map +1 -1
  113. package/dist/browser/utils/hashing/hash.js +19 -0
  114. package/dist/browser/utils/hashing/hash.js.map +1 -1
  115. package/dist/browser/utils/time.d.ts +8 -0
  116. package/dist/browser/utils/time.d.ts.map +1 -1
  117. package/dist/browser/utils/time.js +19 -0
  118. package/dist/browser/utils/time.js.map +1 -1
  119. package/dist/commonjs/ClientContext.d.ts +19 -10
  120. package/dist/commonjs/ClientContext.d.ts.map +1 -1
  121. package/dist/commonjs/ClientContext.js +30 -11
  122. package/dist/commonjs/ClientContext.js.map +1 -1
  123. package/dist/commonjs/CosmosClient.d.ts.map +1 -1
  124. package/dist/commonjs/CosmosClient.js +13 -2
  125. package/dist/commonjs/CosmosClient.js.map +1 -1
  126. package/dist/commonjs/PartitionKeyRangeFailoverInfo.d.ts +49 -0
  127. package/dist/commonjs/PartitionKeyRangeFailoverInfo.d.ts.map +1 -0
  128. package/dist/commonjs/PartitionKeyRangeFailoverInfo.js +135 -0
  129. package/dist/commonjs/PartitionKeyRangeFailoverInfo.js.map +1 -0
  130. package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
  131. package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.js +4 -0
  132. package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
  133. package/dist/commonjs/client/ClientUtils.d.ts +3 -1
  134. package/dist/commonjs/client/ClientUtils.d.ts.map +1 -1
  135. package/dist/commonjs/client/ClientUtils.js +11 -0
  136. package/dist/commonjs/client/ClientUtils.js.map +1 -1
  137. package/dist/commonjs/client/Item/Item.d.ts.map +1 -1
  138. package/dist/commonjs/client/Item/Item.js +13 -0
  139. package/dist/commonjs/client/Item/Item.js.map +1 -1
  140. package/dist/commonjs/client/Item/Items.d.ts +1 -0
  141. package/dist/commonjs/client/Item/Items.d.ts.map +1 -1
  142. package/dist/commonjs/client/Item/Items.js +27 -1
  143. package/dist/commonjs/client/Item/Items.js.map +1 -1
  144. package/dist/commonjs/common/constants.d.ts +20 -0
  145. package/dist/commonjs/common/constants.d.ts.map +1 -1
  146. package/dist/commonjs/common/constants.js +24 -2
  147. package/dist/commonjs/common/constants.js.map +1 -1
  148. package/dist/commonjs/common/platform.d.ts +6 -1
  149. package/dist/commonjs/common/platform.d.ts.map +1 -1
  150. package/dist/commonjs/common/platform.js +23 -3
  151. package/dist/commonjs/common/platform.js.map +1 -1
  152. package/dist/commonjs/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
  153. package/dist/commonjs/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
  154. package/dist/commonjs/diagnostics/DiagnosticNodeInternal.js.map +1 -1
  155. package/dist/commonjs/documents/ConnectionPolicy.d.ts +6 -0
  156. package/dist/commonjs/documents/ConnectionPolicy.d.ts.map +1 -1
  157. package/dist/commonjs/documents/ConnectionPolicy.js +2 -0
  158. package/dist/commonjs/documents/ConnectionPolicy.js.map +1 -1
  159. package/dist/commonjs/documents/DatabaseAccount.d.ts.map +1 -1
  160. package/dist/commonjs/documents/DatabaseAccount.js +3 -0
  161. package/dist/commonjs/documents/DatabaseAccount.js.map +1 -1
  162. package/dist/commonjs/documents/PartitionKeyDefinition.d.ts +1 -1
  163. package/dist/commonjs/documents/PartitionKeyDefinition.js.map +1 -1
  164. package/dist/commonjs/encryption/Cache/ProtectedDataEncryptionKeyCache.d.ts.map +1 -1
  165. package/dist/commonjs/encryption/Cache/ProtectedDataEncryptionKeyCache.js +2 -1
  166. package/dist/commonjs/encryption/Cache/ProtectedDataEncryptionKeyCache.js.map +1 -1
  167. package/dist/commonjs/encryption/EncryptionKeyStoreProvider.d.ts.map +1 -1
  168. package/dist/commonjs/encryption/EncryptionKeyStoreProvider.js +2 -1
  169. package/dist/commonjs/encryption/EncryptionKeyStoreProvider.js.map +1 -1
  170. package/dist/commonjs/extractPartitionKey.d.ts.map +1 -1
  171. package/dist/commonjs/extractPartitionKey.js +33 -20
  172. package/dist/commonjs/extractPartitionKey.js.map +1 -1
  173. package/dist/commonjs/globalEndpointManager.d.ts +6 -0
  174. package/dist/commonjs/globalEndpointManager.d.ts.map +1 -1
  175. package/dist/commonjs/globalEndpointManager.js +10 -5
  176. package/dist/commonjs/globalEndpointManager.js.map +1 -1
  177. package/dist/commonjs/globalPartitionEndpointManager.d.ts +79 -0
  178. package/dist/commonjs/globalPartitionEndpointManager.d.ts.map +1 -0
  179. package/dist/commonjs/globalPartitionEndpointManager.js +282 -0
  180. package/dist/commonjs/globalPartitionEndpointManager.js.map +1 -0
  181. package/dist/commonjs/queryExecutionContext/Aggregators/index.d.ts.map +1 -1
  182. package/dist/commonjs/queryExecutionContext/Aggregators/index.js +1 -0
  183. package/dist/commonjs/queryExecutionContext/Aggregators/index.js.map +1 -1
  184. package/dist/commonjs/queryExecutionContext/documentProducer.d.ts +2 -3
  185. package/dist/commonjs/queryExecutionContext/documentProducer.d.ts.map +1 -1
  186. package/dist/commonjs/queryExecutionContext/documentProducer.js +15 -20
  187. package/dist/commonjs/queryExecutionContext/documentProducer.js.map +1 -1
  188. package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.d.ts +3 -1
  189. package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
  190. package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.js +10 -2
  191. package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
  192. package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
  193. package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.js +2 -1
  194. package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
  195. package/dist/commonjs/queryIterator.d.ts.map +1 -1
  196. package/dist/commonjs/queryIterator.js +2 -3
  197. package/dist/commonjs/queryIterator.js.map +1 -1
  198. package/dist/commonjs/request/ErrorResponse.d.ts +1 -1
  199. package/dist/commonjs/request/ErrorResponse.d.ts.map +1 -1
  200. package/dist/commonjs/request/ErrorResponse.js.map +1 -1
  201. package/dist/commonjs/request/RequestContext.d.ts +5 -0
  202. package/dist/commonjs/request/RequestContext.d.ts.map +1 -1
  203. package/dist/commonjs/request/RequestContext.js.map +1 -1
  204. package/dist/commonjs/request/RequestHandler.d.ts.map +1 -1
  205. package/dist/commonjs/request/RequestHandler.js +12 -2
  206. package/dist/commonjs/request/RequestHandler.js.map +1 -1
  207. package/dist/commonjs/request/defaultAgent.js +4 -4
  208. package/dist/commonjs/request/defaultAgent.js.map +1 -1
  209. package/dist/commonjs/request/request.d.ts.map +1 -1
  210. package/dist/commonjs/request/request.js +3 -3
  211. package/dist/commonjs/request/request.js.map +1 -1
  212. package/dist/commonjs/retry/RetryPolicy.d.ts +2 -2
  213. package/dist/commonjs/retry/RetryPolicy.d.ts.map +1 -1
  214. package/dist/commonjs/retry/RetryPolicy.js.map +1 -1
  215. package/dist/commonjs/retry/defaultRetryPolicy.d.ts.map +1 -1
  216. package/dist/commonjs/retry/defaultRetryPolicy.js +3 -7
  217. package/dist/commonjs/retry/defaultRetryPolicy.js.map +1 -1
  218. package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.d.ts +5 -3
  219. package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
  220. package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.js +9 -2
  221. package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
  222. package/dist/commonjs/retry/retryUtility.d.ts.map +1 -1
  223. package/dist/commonjs/retry/retryUtility.js +11 -5
  224. package/dist/commonjs/retry/retryUtility.js.map +1 -1
  225. package/dist/commonjs/retry/timeoutFailoverRetryPolicy.d.ts +6 -3
  226. package/dist/commonjs/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
  227. package/dist/commonjs/retry/timeoutFailoverRetryPolicy.js +15 -7
  228. package/dist/commonjs/retry/timeoutFailoverRetryPolicy.js.map +1 -1
  229. package/dist/commonjs/routing/partitionKeyRangeCache.d.ts.map +1 -1
  230. package/dist/commonjs/routing/partitionKeyRangeCache.js +11 -0
  231. package/dist/commonjs/routing/partitionKeyRangeCache.js.map +1 -1
  232. package/dist/commonjs/tsdoc-metadata.json +11 -11
  233. package/dist/commonjs/utils/checkURL.js +7 -0
  234. package/dist/commonjs/utils/checkURL.js.map +1 -1
  235. package/dist/commonjs/utils/hashing/hash.d.ts +2 -0
  236. package/dist/commonjs/utils/hashing/hash.d.ts.map +1 -1
  237. package/dist/commonjs/utils/hashing/hash.js +20 -0
  238. package/dist/commonjs/utils/hashing/hash.js.map +1 -1
  239. package/dist/commonjs/utils/time.d.ts +8 -0
  240. package/dist/commonjs/utils/time.d.ts.map +1 -1
  241. package/dist/commonjs/utils/time.js +20 -0
  242. package/dist/commonjs/utils/time.js.map +1 -1
  243. package/dist/esm/ClientContext.d.ts +19 -10
  244. package/dist/esm/ClientContext.d.ts.map +1 -1
  245. package/dist/esm/ClientContext.js +30 -11
  246. package/dist/esm/ClientContext.js.map +1 -1
  247. package/dist/esm/CosmosClient.d.ts.map +1 -1
  248. package/dist/esm/CosmosClient.js +13 -2
  249. package/dist/esm/CosmosClient.js.map +1 -1
  250. package/dist/esm/PartitionKeyRangeFailoverInfo.d.ts +49 -0
  251. package/dist/esm/PartitionKeyRangeFailoverInfo.d.ts.map +1 -0
  252. package/dist/esm/PartitionKeyRangeFailoverInfo.js +130 -0
  253. package/dist/esm/PartitionKeyRangeFailoverInfo.js.map +1 -0
  254. package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
  255. package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.js +4 -0
  256. package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
  257. package/dist/esm/client/ClientUtils.d.ts +3 -1
  258. package/dist/esm/client/ClientUtils.d.ts.map +1 -1
  259. package/dist/esm/client/ClientUtils.js +10 -0
  260. package/dist/esm/client/ClientUtils.js.map +1 -1
  261. package/dist/esm/client/Item/Item.d.ts.map +1 -1
  262. package/dist/esm/client/Item/Item.js +13 -0
  263. package/dist/esm/client/Item/Item.js.map +1 -1
  264. package/dist/esm/client/Item/Items.d.ts +1 -0
  265. package/dist/esm/client/Item/Items.d.ts.map +1 -1
  266. package/dist/esm/client/Item/Items.js +29 -3
  267. package/dist/esm/client/Item/Items.js.map +1 -1
  268. package/dist/esm/common/constants.d.ts +20 -0
  269. package/dist/esm/common/constants.d.ts.map +1 -1
  270. package/dist/esm/common/constants.js +23 -1
  271. package/dist/esm/common/constants.js.map +1 -1
  272. package/dist/esm/common/platform.d.ts +6 -1
  273. package/dist/esm/common/platform.d.ts.map +1 -1
  274. package/dist/esm/common/platform.js +23 -4
  275. package/dist/esm/common/platform.js.map +1 -1
  276. package/dist/esm/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
  277. package/dist/esm/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
  278. package/dist/esm/diagnostics/DiagnosticNodeInternal.js.map +1 -1
  279. package/dist/esm/documents/ConnectionPolicy.d.ts +6 -0
  280. package/dist/esm/documents/ConnectionPolicy.d.ts.map +1 -1
  281. package/dist/esm/documents/ConnectionPolicy.js +2 -0
  282. package/dist/esm/documents/ConnectionPolicy.js.map +1 -1
  283. package/dist/esm/documents/DatabaseAccount.d.ts.map +1 -1
  284. package/dist/esm/documents/DatabaseAccount.js +3 -0
  285. package/dist/esm/documents/DatabaseAccount.js.map +1 -1
  286. package/dist/esm/documents/PartitionKeyDefinition.d.ts +1 -1
  287. package/dist/esm/documents/PartitionKeyDefinition.js.map +1 -1
  288. package/dist/esm/encryption/Cache/ProtectedDataEncryptionKeyCache.d.ts.map +1 -1
  289. package/dist/esm/encryption/Cache/ProtectedDataEncryptionKeyCache.js +2 -1
  290. package/dist/esm/encryption/Cache/ProtectedDataEncryptionKeyCache.js.map +1 -1
  291. package/dist/esm/encryption/EncryptionKeyStoreProvider.d.ts.map +1 -1
  292. package/dist/esm/encryption/EncryptionKeyStoreProvider.js +2 -1
  293. package/dist/esm/encryption/EncryptionKeyStoreProvider.js.map +1 -1
  294. package/dist/esm/extractPartitionKey.d.ts.map +1 -1
  295. package/dist/esm/extractPartitionKey.js +33 -20
  296. package/dist/esm/extractPartitionKey.js.map +1 -1
  297. package/dist/esm/globalEndpointManager.d.ts +6 -0
  298. package/dist/esm/globalEndpointManager.d.ts.map +1 -1
  299. package/dist/esm/globalEndpointManager.js +9 -4
  300. package/dist/esm/globalEndpointManager.js.map +1 -1
  301. package/dist/esm/globalPartitionEndpointManager.d.ts +79 -0
  302. package/dist/esm/globalPartitionEndpointManager.d.ts.map +1 -0
  303. package/dist/esm/globalPartitionEndpointManager.js +278 -0
  304. package/dist/esm/globalPartitionEndpointManager.js.map +1 -0
  305. package/dist/esm/queryExecutionContext/Aggregators/index.d.ts.map +1 -1
  306. package/dist/esm/queryExecutionContext/Aggregators/index.js +1 -0
  307. package/dist/esm/queryExecutionContext/Aggregators/index.js.map +1 -1
  308. package/dist/esm/queryExecutionContext/documentProducer.d.ts +2 -3
  309. package/dist/esm/queryExecutionContext/documentProducer.d.ts.map +1 -1
  310. package/dist/esm/queryExecutionContext/documentProducer.js +16 -21
  311. package/dist/esm/queryExecutionContext/documentProducer.js.map +1 -1
  312. package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.d.ts +3 -1
  313. package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
  314. package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.js +10 -2
  315. package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
  316. package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
  317. package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.js +2 -1
  318. package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
  319. package/dist/esm/queryIterator.d.ts.map +1 -1
  320. package/dist/esm/queryIterator.js +2 -3
  321. package/dist/esm/queryIterator.js.map +1 -1
  322. package/dist/esm/request/ErrorResponse.d.ts +1 -1
  323. package/dist/esm/request/ErrorResponse.d.ts.map +1 -1
  324. package/dist/esm/request/ErrorResponse.js.map +1 -1
  325. package/dist/esm/request/RequestContext.d.ts +5 -0
  326. package/dist/esm/request/RequestContext.d.ts.map +1 -1
  327. package/dist/esm/request/RequestContext.js.map +1 -1
  328. package/dist/esm/request/RequestHandler.d.ts.map +1 -1
  329. package/dist/esm/request/RequestHandler.js +14 -4
  330. package/dist/esm/request/RequestHandler.js.map +1 -1
  331. package/dist/esm/request/defaultAgent.js +2 -2
  332. package/dist/esm/request/defaultAgent.js.map +1 -1
  333. package/dist/esm/request/request.d.ts.map +1 -1
  334. package/dist/esm/request/request.js +3 -3
  335. package/dist/esm/request/request.js.map +1 -1
  336. package/dist/esm/retry/RetryPolicy.d.ts +2 -2
  337. package/dist/esm/retry/RetryPolicy.d.ts.map +1 -1
  338. package/dist/esm/retry/RetryPolicy.js.map +1 -1
  339. package/dist/esm/retry/defaultRetryPolicy.d.ts.map +1 -1
  340. package/dist/esm/retry/defaultRetryPolicy.js +4 -8
  341. package/dist/esm/retry/defaultRetryPolicy.js.map +1 -1
  342. package/dist/esm/retry/endpointDiscoveryRetryPolicy.d.ts +5 -3
  343. package/dist/esm/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
  344. package/dist/esm/retry/endpointDiscoveryRetryPolicy.js +9 -2
  345. package/dist/esm/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
  346. package/dist/esm/retry/retryUtility.d.ts.map +1 -1
  347. package/dist/esm/retry/retryUtility.js +11 -5
  348. package/dist/esm/retry/retryUtility.js.map +1 -1
  349. package/dist/esm/retry/timeoutFailoverRetryPolicy.d.ts +6 -3
  350. package/dist/esm/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
  351. package/dist/esm/retry/timeoutFailoverRetryPolicy.js +15 -7
  352. package/dist/esm/retry/timeoutFailoverRetryPolicy.js.map +1 -1
  353. package/dist/esm/routing/partitionKeyRangeCache.d.ts.map +1 -1
  354. package/dist/esm/routing/partitionKeyRangeCache.js +11 -0
  355. package/dist/esm/routing/partitionKeyRangeCache.js.map +1 -1
  356. package/dist/esm/utils/checkURL.js +6 -0
  357. package/dist/esm/utils/checkURL.js.map +1 -1
  358. package/dist/esm/utils/hashing/hash.d.ts +2 -0
  359. package/dist/esm/utils/hashing/hash.d.ts.map +1 -1
  360. package/dist/esm/utils/hashing/hash.js +19 -0
  361. package/dist/esm/utils/hashing/hash.js.map +1 -1
  362. package/dist/esm/utils/time.d.ts +8 -0
  363. package/dist/esm/utils/time.d.ts.map +1 -1
  364. package/dist/esm/utils/time.js +19 -0
  365. package/dist/esm/utils/time.js.map +1 -1
  366. package/dist/react-native/ClientContext.d.ts +19 -10
  367. package/dist/react-native/ClientContext.d.ts.map +1 -1
  368. package/dist/react-native/ClientContext.js +30 -11
  369. package/dist/react-native/ClientContext.js.map +1 -1
  370. package/dist/react-native/CosmosClient.d.ts.map +1 -1
  371. package/dist/react-native/CosmosClient.js +13 -2
  372. package/dist/react-native/CosmosClient.js.map +1 -1
  373. package/dist/react-native/PartitionKeyRangeFailoverInfo.d.ts +49 -0
  374. package/dist/react-native/PartitionKeyRangeFailoverInfo.d.ts.map +1 -0
  375. package/dist/react-native/PartitionKeyRangeFailoverInfo.js +130 -0
  376. package/dist/react-native/PartitionKeyRangeFailoverInfo.js.map +1 -0
  377. package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
  378. package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.js +4 -0
  379. package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
  380. package/dist/react-native/client/ClientUtils.d.ts +3 -1
  381. package/dist/react-native/client/ClientUtils.d.ts.map +1 -1
  382. package/dist/react-native/client/ClientUtils.js +10 -0
  383. package/dist/react-native/client/ClientUtils.js.map +1 -1
  384. package/dist/react-native/client/Item/Item.d.ts.map +1 -1
  385. package/dist/react-native/client/Item/Item.js +13 -0
  386. package/dist/react-native/client/Item/Item.js.map +1 -1
  387. package/dist/react-native/client/Item/Items.d.ts +1 -0
  388. package/dist/react-native/client/Item/Items.d.ts.map +1 -1
  389. package/dist/react-native/client/Item/Items.js +29 -3
  390. package/dist/react-native/client/Item/Items.js.map +1 -1
  391. package/dist/react-native/common/constants.d.ts +20 -0
  392. package/dist/react-native/common/constants.d.ts.map +1 -1
  393. package/dist/react-native/common/constants.js +23 -1
  394. package/dist/react-native/common/constants.js.map +1 -1
  395. package/dist/react-native/common/platform.d.ts +6 -1
  396. package/dist/react-native/common/platform.d.ts.map +1 -1
  397. package/dist/react-native/common/platform.js +23 -4
  398. package/dist/react-native/common/platform.js.map +1 -1
  399. package/dist/react-native/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
  400. package/dist/react-native/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
  401. package/dist/react-native/diagnostics/DiagnosticNodeInternal.js.map +1 -1
  402. package/dist/react-native/documents/ConnectionPolicy.d.ts +6 -0
  403. package/dist/react-native/documents/ConnectionPolicy.d.ts.map +1 -1
  404. package/dist/react-native/documents/ConnectionPolicy.js +2 -0
  405. package/dist/react-native/documents/ConnectionPolicy.js.map +1 -1
  406. package/dist/react-native/documents/DatabaseAccount.d.ts.map +1 -1
  407. package/dist/react-native/documents/DatabaseAccount.js +3 -0
  408. package/dist/react-native/documents/DatabaseAccount.js.map +1 -1
  409. package/dist/react-native/documents/PartitionKeyDefinition.d.ts +1 -1
  410. package/dist/react-native/documents/PartitionKeyDefinition.js.map +1 -1
  411. package/dist/react-native/encryption/Cache/ProtectedDataEncryptionKeyCache.d.ts.map +1 -1
  412. package/dist/react-native/encryption/Cache/ProtectedDataEncryptionKeyCache.js +2 -1
  413. package/dist/react-native/encryption/Cache/ProtectedDataEncryptionKeyCache.js.map +1 -1
  414. package/dist/react-native/encryption/EncryptionKeyStoreProvider.d.ts.map +1 -1
  415. package/dist/react-native/encryption/EncryptionKeyStoreProvider.js +2 -1
  416. package/dist/react-native/encryption/EncryptionKeyStoreProvider.js.map +1 -1
  417. package/dist/react-native/extractPartitionKey.d.ts.map +1 -1
  418. package/dist/react-native/extractPartitionKey.js +33 -20
  419. package/dist/react-native/extractPartitionKey.js.map +1 -1
  420. package/dist/react-native/globalEndpointManager.d.ts +6 -0
  421. package/dist/react-native/globalEndpointManager.d.ts.map +1 -1
  422. package/dist/react-native/globalEndpointManager.js +9 -4
  423. package/dist/react-native/globalEndpointManager.js.map +1 -1
  424. package/dist/react-native/globalPartitionEndpointManager.d.ts +79 -0
  425. package/dist/react-native/globalPartitionEndpointManager.d.ts.map +1 -0
  426. package/dist/react-native/globalPartitionEndpointManager.js +278 -0
  427. package/dist/react-native/globalPartitionEndpointManager.js.map +1 -0
  428. package/dist/react-native/queryExecutionContext/Aggregators/index.d.ts.map +1 -1
  429. package/dist/react-native/queryExecutionContext/Aggregators/index.js +1 -0
  430. package/dist/react-native/queryExecutionContext/Aggregators/index.js.map +1 -1
  431. package/dist/react-native/queryExecutionContext/documentProducer.d.ts +2 -3
  432. package/dist/react-native/queryExecutionContext/documentProducer.d.ts.map +1 -1
  433. package/dist/react-native/queryExecutionContext/documentProducer.js +16 -21
  434. package/dist/react-native/queryExecutionContext/documentProducer.js.map +1 -1
  435. package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.d.ts +3 -1
  436. package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
  437. package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.js +10 -2
  438. package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
  439. package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
  440. package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.js +2 -1
  441. package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
  442. package/dist/react-native/queryIterator.d.ts.map +1 -1
  443. package/dist/react-native/queryIterator.js +2 -3
  444. package/dist/react-native/queryIterator.js.map +1 -1
  445. package/dist/react-native/request/ErrorResponse.d.ts +1 -1
  446. package/dist/react-native/request/ErrorResponse.d.ts.map +1 -1
  447. package/dist/react-native/request/ErrorResponse.js.map +1 -1
  448. package/dist/react-native/request/RequestContext.d.ts +5 -0
  449. package/dist/react-native/request/RequestContext.d.ts.map +1 -1
  450. package/dist/react-native/request/RequestContext.js.map +1 -1
  451. package/dist/react-native/request/RequestHandler.d.ts.map +1 -1
  452. package/dist/react-native/request/RequestHandler.js +14 -4
  453. package/dist/react-native/request/RequestHandler.js.map +1 -1
  454. package/dist/react-native/request/defaultAgent.js +2 -2
  455. package/dist/react-native/request/defaultAgent.js.map +1 -1
  456. package/dist/react-native/request/request.d.ts.map +1 -1
  457. package/dist/react-native/request/request.js +3 -3
  458. package/dist/react-native/request/request.js.map +1 -1
  459. package/dist/react-native/retry/RetryPolicy.d.ts +2 -2
  460. package/dist/react-native/retry/RetryPolicy.d.ts.map +1 -1
  461. package/dist/react-native/retry/RetryPolicy.js.map +1 -1
  462. package/dist/react-native/retry/defaultRetryPolicy.d.ts.map +1 -1
  463. package/dist/react-native/retry/defaultRetryPolicy.js +4 -8
  464. package/dist/react-native/retry/defaultRetryPolicy.js.map +1 -1
  465. package/dist/react-native/retry/endpointDiscoveryRetryPolicy.d.ts +5 -3
  466. package/dist/react-native/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
  467. package/dist/react-native/retry/endpointDiscoveryRetryPolicy.js +9 -2
  468. package/dist/react-native/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
  469. package/dist/react-native/retry/retryUtility.d.ts.map +1 -1
  470. package/dist/react-native/retry/retryUtility.js +11 -5
  471. package/dist/react-native/retry/retryUtility.js.map +1 -1
  472. package/dist/react-native/retry/timeoutFailoverRetryPolicy.d.ts +6 -3
  473. package/dist/react-native/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
  474. package/dist/react-native/retry/timeoutFailoverRetryPolicy.js +15 -7
  475. package/dist/react-native/retry/timeoutFailoverRetryPolicy.js.map +1 -1
  476. package/dist/react-native/routing/partitionKeyRangeCache.d.ts.map +1 -1
  477. package/dist/react-native/routing/partitionKeyRangeCache.js +11 -0
  478. package/dist/react-native/routing/partitionKeyRangeCache.js.map +1 -1
  479. package/dist/react-native/utils/checkURL.js +6 -0
  480. package/dist/react-native/utils/checkURL.js.map +1 -1
  481. package/dist/react-native/utils/hashing/hash.d.ts +2 -0
  482. package/dist/react-native/utils/hashing/hash.d.ts.map +1 -1
  483. package/dist/react-native/utils/hashing/hash.js +19 -0
  484. package/dist/react-native/utils/hashing/hash.js.map +1 -1
  485. package/dist/react-native/utils/time.d.ts +8 -0
  486. package/dist/react-native/utils/time.d.ts.map +1 -1
  487. package/dist/react-native/utils/time.js +19 -0
  488. package/dist/react-native/utils/time.js.map +1 -1
  489. package/package.json +11 -11
@@ -1 +1 @@
1
- {"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../src/client/Item/Item.ts"],"names":[],"mappings":";;;AAIA,oDAS+B;AAE/B,uDAAyE;AAEzE,qDAAuD;AAEvD,mDAA0D;AAI1D,uDAAiD;AACjD,+DAAwF;AACxF,yEAA0E;AAE1E;;;;GAIG;AACH,MAAa,IAAI;IAEf;;OAEG;IACH,IAAW,GAAG;QACZ,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACnF,CAAC;IAED;;;;;OAKG;IACH,YACkB,SAAoB,EACpB,EAAU,EACT,aAA4B,EAC7C,YAA2B;QAHX,cAAS,GAAT,SAAS,CAAW;QACpB,OAAE,GAAF,EAAE,CAAQ;QACT,kBAAa,GAAb,aAAa,CAAe;QAG7C,IAAI,CAAC,YAAY;YACf,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,wCAA6B,EAAC,YAAY,CAAC,CAAC;IACzF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACI,KAAK,CAAC,IAAI,CACf,UAA0B,EAAE;QAE5B,OAAO,IAAA,gCAAe,EAAC,KAAK,EAAE,cAAsC,EAAE,EAAE;YACtE,IAAI,CAAC,YAAY,GAAG,MAAM,IAAA,mDAA0B,EAClD,cAAc,EACd,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,YAAY,CAClB,CAAC;YACF,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;YACnB,IAAI,YAAY,GAAG,IAAI,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,CAC5B,CAAC;QACJ,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;CACF;AA/hBD,oBA+hBC","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\";\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 response = await this.clientContext.read<T>({\n path,\n resourceType: ResourceType.item,\n resourceId: id,\n options,\n partitionKey: partitionKey,\n diagnosticNode,\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 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 });\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 response = await this.clientContext.delete<T>({\n path,\n resourceType: ResourceType.item,\n resourceId: id,\n options,\n partitionKey: partitionKey,\n diagnosticNode,\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 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 });\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,oDAS+B;AAE/B,uDAAyE;AAEzE,qDAAuD;AAEvD,mDAA0D;AAI1D,uDAAiD;AACjD,+DAAwF;AACxF,yEAA0E;AAC1E,sDAA+D;AAE/D;;;;GAIG;AACH,MAAa,IAAI;IAEf;;OAEG;IACH,IAAW,GAAG;QACZ,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,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ACpE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;oBACzB,cAAc,CAAC,wBAAwB,CACrC,oBAAS,CAAC,UAAU,CAAC,2BAA2B,EAChD,wBAAwB,CACzB,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,eAAe,GAAG,IAAI,wBAAa,CACvC,yEAAyE,KAAK,CAAC,OAAO,EAAE,CACzF,CAAC;oBACF,eAAe,CAAC,IAAI,GAAG,sBAAW,CAAC,kBAAkB,CAAC;oBACtD,MAAM,eAAe,CAAC;gBACxB,CAAC;YACH,CAAC;YAED,OAAO,IAAI,8BAAY,CACrB,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,OAAO,EAChB,QAAQ,CAAC,IAAI,EACb,QAAQ,CAAC,SAAS,EAClB,IAAI,EACJ,IAAA,0CAAyB,GAAE,CAC5B,CAAC;QACJ,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;CACF;AA5kBD,oBA4kBC","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"]}
@@ -359,6 +359,7 @@ export declare class Items {
359
359
  executeBulkOperations(operations: OperationInput[], options?: RequestOptions): Promise<BulkOperationResult[]>;
360
360
  /**
361
361
  * Execute bulk operations on items.
362
+ * @deprecated Use `executeBulkOperations` instead.
362
363
  *
363
364
  * Bulk takes an array of Operations which are typed based on what the operation does.
364
365
  * The choices are: Create, Upsert, Read, Replace, and Delete
@@ -1 +1 @@
1
- {"version":3,"file":"Items.d.ts","sourceRoot":"","sources":["../../../../src/client/Item/Items.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAY5D,OAAO,KAAK,EAAyB,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAqB,MAAM,uBAAuB,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAEV,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,qBAAqB,EAErB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAW9B,OAAO,KAAK,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAErF,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,kCAAkC,CAAC;AAY1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAexE;;;;GAIG;AACH,qBAAa,KAAK;aAQE,SAAS,EAAE,SAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,aAAa;IARhC,OAAO,CAAC,sBAAsB,CAAyB;IACvD;;;;OAIG;gBAEe,SAAS,EAAE,SAAS,EACnB,aAAa,EAAE,aAAa;IAK/C;;;;;;;;;;;;;;;;;;;;;;OAsBG;IAGI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACU,MAAM,CAAC,CAAC,SAAS,cAAc,EAC1C,IAAI,EAAE,CAAC,EACP,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAiH3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACU,qBAAqB,CAChC,UAAU,EAAE,cAAc,EAAE,EAC5B,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAUjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACU,IAAI,CACf,UAAU,EAAE,cAAc,EAAE,EAC5B,WAAW,CAAC,EAAE,WAAW,EACzB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,qBAAqB,CAAC;IAgEjC,OAAO,CAAC,sBAAsB;IAwH9B;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAqCxB;;;;;;OAMG;IACH,OAAO,CAAC,kCAAkC;IA8B1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACU,KAAK,CAChB,UAAU,EAAE,cAAc,EAAE,EAC5B,YAAY,CAAC,EAAE,YAAY,EAC3B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,CAAC;YA+F3B,yBAAyB;CAiBxC"}
@@ -44,12 +44,18 @@ class Items {
44
44
  constructor(container, clientContext) {
45
45
  this.container = container;
46
46
  this.clientContext = clientContext;
47
- this.partitionKeyRangeCache = new index_js_2.PartitionKeyRangeCache(this.clientContext);
47
+ this.partitionKeyRangeCache = this.clientContext.partitionKeyRangeCache;
48
48
  }
49
49
  query(query, options = {}) {
50
50
  const path = (0, index_js_1.getPathFromLink)(this.container.url, index_js_1.ResourceType.item);
51
51
  const id = (0, index_js_1.getIdFromLink)(this.container.url);
52
52
  const fetchFunction = async (diagnosticNode, innerOptions, correlatedActivityId) => {
53
+ let internalPartitionKey;
54
+ if (options.partitionKey) {
55
+ internalPartitionKey = (0, index_js_3.convertToInternalPartitionKey)(options.partitionKey);
56
+ }
57
+ const isPartitionLevelFailOverEnabled = this.clientContext.isPartitionLevelFailOverEnabled();
58
+ const partitionKeyRangeId = await (0, ClientUtils_js_1.computePartitionKeyRangeId)(diagnosticNode, internalPartitionKey, this.partitionKeyRangeCache, isPartitionLevelFailOverEnabled, this.container);
53
59
  const response = await this.clientContext.queryFeed({
54
60
  path,
55
61
  resourceType: index_js_1.ResourceType.item,
@@ -60,6 +66,7 @@ class Items {
60
66
  partitionKey: options.partitionKey,
61
67
  diagnosticNode,
62
68
  correlatedActivityId: correlatedActivityId,
69
+ partitionKeyRangeId,
63
70
  });
64
71
  return response;
65
72
  };
@@ -99,6 +106,15 @@ class Items {
99
106
  async getEncryptionQueryIterator(queryBuilder, options = {}) {
100
107
  const encryptionSqlQuerySpec = queryBuilder.toEncryptionSqlQuerySpec();
101
108
  const sqlQuerySpec = await this.buildSqlQuerySpec(encryptionSqlQuerySpec);
109
+ if (this.clientContext.enableEncryption && options.partitionKey) {
110
+ await this.container.checkAndInitializeEncryption();
111
+ const { partitionKeyList, encryptedCount } = await this.container.encryptionProcessor.getEncryptedPartitionKeyValue([
112
+ options.partitionKey,
113
+ ]);
114
+ if (encryptedCount > 0) {
115
+ options.partitionKey = partitionKeyList[0];
116
+ }
117
+ }
102
118
  const iterator = this.query(sqlQuerySpec, options);
103
119
  return iterator;
104
120
  }
@@ -250,6 +266,8 @@ class Items {
250
266
  }
251
267
  const path = (0, index_js_1.getPathFromLink)(this.container.url, index_js_1.ResourceType.item);
252
268
  const id = (0, index_js_1.getIdFromLink)(this.container.url);
269
+ const isPartitionLevelFailOverEnabled = this.clientContext.isPartitionLevelFailOverEnabled();
270
+ const partitionKeyRangeId = await (0, ClientUtils_js_1.computePartitionKeyRangeId)(diagnosticNode, partitionKey, this.partitionKeyRangeCache, isPartitionLevelFailOverEnabled, this.container, partitionKeyDefinition);
253
271
  response = await this.clientContext.create({
254
272
  body,
255
273
  path,
@@ -258,6 +276,7 @@ class Items {
258
276
  diagnosticNode,
259
277
  options,
260
278
  partitionKey,
279
+ partitionKeyRangeId,
261
280
  });
262
281
  }
263
282
  catch (error) {
@@ -315,6 +334,8 @@ class Items {
315
334
  }
316
335
  const path = (0, index_js_1.getPathFromLink)(this.container.url, index_js_1.ResourceType.item);
317
336
  const id = (0, index_js_1.getIdFromLink)(this.container.url);
337
+ const isPartitionLevelFailOverEnabled = this.clientContext.isPartitionLevelFailOverEnabled();
338
+ const partitionKeyRangeId = await (0, ClientUtils_js_1.computePartitionKeyRangeId)(diagnosticNode, partitionKey, this.partitionKeyRangeCache, isPartitionLevelFailOverEnabled, this.container, partitionKeyDefinition);
318
339
  response = await this.clientContext.upsert({
319
340
  body,
320
341
  path,
@@ -323,6 +344,7 @@ class Items {
323
344
  options,
324
345
  partitionKey,
325
346
  diagnosticNode,
347
+ partitionKeyRangeId,
326
348
  });
327
349
  }
328
350
  catch (error) {
@@ -389,6 +411,7 @@ class Items {
389
411
  }
390
412
  /**
391
413
  * Execute bulk operations on items.
414
+ * @deprecated Use `executeBulkOperations` instead.
392
415
  *
393
416
  * Bulk takes an array of Operations which are typed based on what the operation does.
394
417
  * The choices are: Create, Upsert, Read, Replace, and Delete
@@ -654,6 +677,8 @@ class Items {
654
677
  count += totalPropertiesEncryptedCount;
655
678
  diagnosticNode.endEncryptionDiagnostics(index_js_1.Constants.Encryption.DiagnosticsEncryptOperation, count);
656
679
  }
680
+ const isPartitionLevelFailOverEnabled = this.clientContext.isPartitionLevelFailOverEnabled();
681
+ const partitionKeyRangeId = await (0, ClientUtils_js_1.computePartitionKeyRangeId)(diagnosticNode, partitionKey, this.partitionKeyRangeCache, isPartitionLevelFailOverEnabled, this.container);
657
682
  response = await this.clientContext.batch({
658
683
  body: operations,
659
684
  partitionKey,
@@ -661,6 +686,7 @@ class Items {
661
686
  resourceId: this.container.url,
662
687
  options,
663
688
  diagnosticNode,
689
+ partitionKeyRangeId,
664
690
  });
665
691
  }
666
692
  catch (err) {