@azure/cosmos 4.7.0-alpha.20251118.1 → 4.8.0-alpha.20251120.6
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.
- package/dist/browser/CosmosClientOptions.d.ts +1 -1
- package/dist/browser/CosmosClientOptions.js.map +1 -1
- package/dist/browser/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
- package/dist/browser/client/ChangeFeed/ChangeFeedForEpkRange.js +2 -34
- package/dist/browser/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
- package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
- package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.js +2 -35
- package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
- package/dist/browser/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +15 -0
- package/dist/browser/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
- package/dist/browser/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
- package/dist/browser/client/ChangeFeed/InternalChangeFeedOptions.d.ts +3 -0
- package/dist/browser/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
- package/dist/browser/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
- package/dist/browser/client/ChangeFeed/changeFeedUtils.d.ts +6 -0
- package/dist/browser/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
- package/dist/browser/client/ChangeFeed/changeFeedUtils.js +47 -0
- package/dist/browser/client/ChangeFeed/changeFeedUtils.js.map +1 -1
- package/dist/browser/common/constants.d.ts.map +1 -1
- package/dist/browser/common/constants.js +16 -1
- package/dist/browser/common/constants.js.map +1 -1
- package/dist/browser/documents/ContinuationToken/CompositeQueryContinuationToken.d.ts +99 -0
- package/dist/browser/documents/ContinuationToken/CompositeQueryContinuationToken.d.ts.map +1 -0
- package/dist/browser/documents/ContinuationToken/CompositeQueryContinuationToken.js +84 -0
- package/dist/browser/documents/ContinuationToken/CompositeQueryContinuationToken.js.map +1 -0
- package/dist/browser/documents/ContinuationToken/OrderByQueryContinuationToken.d.ts +40 -0
- package/dist/browser/documents/ContinuationToken/OrderByQueryContinuationToken.d.ts.map +1 -0
- package/dist/browser/documents/ContinuationToken/OrderByQueryContinuationToken.js +39 -0
- package/dist/browser/documents/ContinuationToken/OrderByQueryContinuationToken.js.map +1 -0
- package/dist/browser/documents/ContinuationToken/PartitionRangeUpdate.d.ts +21 -0
- package/dist/browser/documents/ContinuationToken/PartitionRangeUpdate.d.ts.map +1 -0
- package/dist/browser/documents/ContinuationToken/PartitionRangeUpdate.js +4 -0
- package/dist/browser/documents/ContinuationToken/PartitionRangeUpdate.js.map +1 -0
- package/dist/browser/documents/VectorEmbeddingPolicy.d.ts +4 -0
- package/dist/browser/documents/VectorEmbeddingPolicy.d.ts.map +1 -1
- package/dist/browser/documents/VectorEmbeddingPolicy.js +4 -0
- package/dist/browser/documents/VectorEmbeddingPolicy.js.map +1 -1
- package/dist/browser/queryExecutionContext/Aggregators/MaxAggregator.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/Aggregators/MaxAggregator.js +4 -0
- package/dist/browser/queryExecutionContext/Aggregators/MaxAggregator.js.map +1 -1
- package/dist/browser/queryExecutionContext/Aggregators/MinAggregator.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/Aggregators/MinAggregator.js +4 -0
- package/dist/browser/queryExecutionContext/Aggregators/MinAggregator.js.map +1 -1
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.d.ts +2 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.js +174 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.js.map +1 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.d.ts +2 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.js +28 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.js.map +1 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.d.ts +2 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.js +129 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.js.map +1 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.d.ts +2 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.js +66 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.js.map +1 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenParser.d.ts +2 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenParser.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenParser.js +23 -0
- package/dist/browser/queryExecutionContext/ContinuationTokenParser.js.map +1 -0
- package/dist/browser/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js +22 -7
- package/dist/browser/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js +21 -5
- package/dist/browser/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js +28 -6
- package/dist/browser/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js +23 -7
- package/dist/browser/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js +35 -4
- package/dist/browser/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.d.ts +1 -0
- package/dist/browser/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js +22 -4
- package/dist/browser/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.d.ts +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js +24 -5
- package/dist/browser/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js +18 -5
- package/dist/browser/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js.map +1 -1
- package/dist/browser/queryExecutionContext/LegacyFetchImplementation.d.ts +14 -0
- package/dist/browser/queryExecutionContext/LegacyFetchImplementation.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/LegacyFetchImplementation.js +55 -0
- package/dist/browser/queryExecutionContext/LegacyFetchImplementation.js.map +1 -0
- package/dist/browser/queryExecutionContext/PartitionRangeManager.d.ts +73 -0
- package/dist/browser/queryExecutionContext/PartitionRangeManager.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/PartitionRangeManager.js +156 -0
- package/dist/browser/queryExecutionContext/PartitionRangeManager.js.map +1 -0
- package/dist/browser/queryExecutionContext/PartitionRangeUtils.d.ts +19 -0
- package/dist/browser/queryExecutionContext/PartitionRangeUtils.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/PartitionRangeUtils.js +105 -0
- package/dist/browser/queryExecutionContext/PartitionRangeUtils.js.map +1 -0
- package/dist/browser/queryExecutionContext/QueryControlFetchImplementation.d.ts +20 -0
- package/dist/browser/queryExecutionContext/QueryControlFetchImplementation.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/QueryControlFetchImplementation.js +93 -0
- package/dist/browser/queryExecutionContext/QueryControlFetchImplementation.js.map +1 -0
- package/dist/browser/queryExecutionContext/QueryValidationHelper.d.ts +9 -0
- package/dist/browser/queryExecutionContext/QueryValidationHelper.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/QueryValidationHelper.js +65 -0
- package/dist/browser/queryExecutionContext/QueryValidationHelper.js.map +1 -0
- package/dist/browser/queryExecutionContext/defaultQueryExecutionContext.d.ts +2 -2
- package/dist/browser/queryExecutionContext/defaultQueryExecutionContext.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/defaultQueryExecutionContext.js +2 -1
- package/dist/browser/queryExecutionContext/defaultQueryExecutionContext.js.map +1 -1
- package/dist/browser/queryExecutionContext/documentProducer.d.ts +9 -3
- package/dist/browser/queryExecutionContext/documentProducer.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/documentProducer.js +17 -4
- package/dist/browser/queryExecutionContext/documentProducer.js.map +1 -1
- package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.d.ts +1 -1
- package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.js +18 -13
- package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
- package/dist/browser/queryExecutionContext/index.d.ts +7 -0
- package/dist/browser/queryExecutionContext/index.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/index.js +4 -0
- package/dist/browser/queryExecutionContext/index.js.map +1 -1
- package/dist/browser/queryExecutionContext/nonStreamingOrderByResult.d.ts +5 -1
- package/dist/browser/queryExecutionContext/nonStreamingOrderByResult.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/nonStreamingOrderByResult.js.map +1 -1
- package/dist/browser/queryExecutionContext/orderByComparator.d.ts +11 -2
- package/dist/browser/queryExecutionContext/orderByComparator.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/orderByComparator.js +20 -3
- package/dist/browser/queryExecutionContext/orderByComparator.js.map +1 -1
- package/dist/browser/queryExecutionContext/orderByDocumentProducerComparator.d.ts +4 -0
- package/dist/browser/queryExecutionContext/orderByDocumentProducerComparator.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/orderByDocumentProducerComparator.js +18 -7
- package/dist/browser/queryExecutionContext/orderByDocumentProducerComparator.js.map +1 -1
- package/dist/browser/queryExecutionContext/orderByQueryExecutionContext.d.ts +7 -10
- package/dist/browser/queryExecutionContext/orderByQueryExecutionContext.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/orderByQueryExecutionContext.js +30 -23
- package/dist/browser/queryExecutionContext/orderByQueryExecutionContext.js.map +1 -1
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContext.d.ts +18 -10
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContext.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContext.js +47 -23
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContext.js.map +1 -1
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.d.ts +160 -26
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.js +453 -106
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/browser/queryExecutionContext/parallelQueryResult.d.ts +35 -0
- package/dist/browser/queryExecutionContext/parallelQueryResult.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/parallelQueryResult.js +23 -0
- package/dist/browser/queryExecutionContext/parallelQueryResult.js.map +1 -0
- package/dist/browser/queryExecutionContext/pipelinedQueryExecutionContext.d.ts +37 -7
- package/dist/browser/queryExecutionContext/pipelinedQueryExecutionContext.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/pipelinedQueryExecutionContext.js +173 -120
- package/dist/browser/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/FilterStrategy.d.ts +40 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/FilterStrategy.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/FilterStrategy.js +4 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/FilterStrategy.js.map +1 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.d.ts +49 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.js +310 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.js.map +1 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.d.ts +18 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.js +102 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.js.map +1 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.d.ts +51 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.js +180 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.js.map +1 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.d.ts +76 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.js +93 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.js.map +1 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.d.ts +30 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.js +4 -0
- package/dist/browser/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.js.map +1 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.d.ts +29 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.js +53 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.js.map +1 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.d.ts +27 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.js +34 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.js.map +1 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.d.ts +36 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.js +4 -0
- package/dist/browser/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.js.map +1 -0
- package/dist/browser/queryExecutionContext/queryRangeMapping.d.ts +22 -0
- package/dist/browser/queryExecutionContext/queryRangeMapping.d.ts.map +1 -0
- package/dist/browser/queryExecutionContext/queryRangeMapping.js +4 -0
- package/dist/browser/queryExecutionContext/queryRangeMapping.js.map +1 -0
- package/dist/browser/queryIterator.js.map +1 -1
- package/dist/browser/utils/offers.d.ts.map +1 -1
- package/dist/browser/utils/offers.js +0 -1
- package/dist/browser/utils/offers.js.map +1 -1
- package/dist/commonjs/CosmosClientOptions.d.ts +1 -1
- package/dist/commonjs/CosmosClientOptions.js.map +1 -1
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForEpkRange.js +1 -33
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.js +1 -34
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
- package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +15 -0
- package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
- package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
- package/dist/commonjs/client/ChangeFeed/InternalChangeFeedOptions.d.ts +3 -0
- package/dist/commonjs/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
- package/dist/commonjs/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
- package/dist/commonjs/client/ChangeFeed/changeFeedUtils.d.ts +6 -0
- package/dist/commonjs/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
- package/dist/commonjs/client/ChangeFeed/changeFeedUtils.js +48 -0
- package/dist/commonjs/client/ChangeFeed/changeFeedUtils.js.map +1 -1
- package/dist/commonjs/common/constants.d.ts.map +1 -1
- package/dist/commonjs/common/constants.js +13 -2
- package/dist/commonjs/common/constants.js.map +1 -1
- package/dist/commonjs/documents/ContinuationToken/CompositeQueryContinuationToken.d.ts +99 -0
- package/dist/commonjs/documents/ContinuationToken/CompositeQueryContinuationToken.d.ts.map +1 -0
- package/dist/commonjs/documents/ContinuationToken/CompositeQueryContinuationToken.js +93 -0
- package/dist/commonjs/documents/ContinuationToken/CompositeQueryContinuationToken.js.map +1 -0
- package/dist/commonjs/documents/ContinuationToken/OrderByQueryContinuationToken.d.ts +40 -0
- package/dist/commonjs/documents/ContinuationToken/OrderByQueryContinuationToken.d.ts.map +1 -0
- package/dist/commonjs/documents/ContinuationToken/OrderByQueryContinuationToken.js +44 -0
- package/dist/commonjs/documents/ContinuationToken/OrderByQueryContinuationToken.js.map +1 -0
- package/dist/commonjs/documents/ContinuationToken/PartitionRangeUpdate.d.ts +21 -0
- package/dist/commonjs/documents/ContinuationToken/PartitionRangeUpdate.d.ts.map +1 -0
- package/dist/commonjs/documents/ContinuationToken/PartitionRangeUpdate.js +5 -0
- package/dist/commonjs/documents/ContinuationToken/PartitionRangeUpdate.js.map +1 -0
- package/dist/commonjs/documents/VectorEmbeddingPolicy.d.ts +4 -0
- package/dist/commonjs/documents/VectorEmbeddingPolicy.d.ts.map +1 -1
- package/dist/commonjs/documents/VectorEmbeddingPolicy.js +4 -0
- package/dist/commonjs/documents/VectorEmbeddingPolicy.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/Aggregators/MaxAggregator.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/Aggregators/MaxAggregator.js +4 -0
- package/dist/commonjs/queryExecutionContext/Aggregators/MaxAggregator.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/Aggregators/MinAggregator.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/Aggregators/MinAggregator.js +4 -0
- package/dist/commonjs/queryExecutionContext/Aggregators/MinAggregator.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.d.ts +2 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.js +178 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.d.ts +2 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.js +31 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.d.ts +2 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.js +133 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.d.ts +2 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.js +70 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenParser.d.ts +2 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenParser.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenParser.js +26 -0
- package/dist/commonjs/queryExecutionContext/ContinuationTokenParser.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js +22 -7
- package/dist/commonjs/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js +21 -5
- package/dist/commonjs/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js +28 -6
- package/dist/commonjs/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js +23 -7
- package/dist/commonjs/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js +35 -4
- package/dist/commonjs/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.d.ts +1 -0
- package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js +22 -4
- package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.d.ts +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js +24 -5
- package/dist/commonjs/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js +18 -5
- package/dist/commonjs/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/LegacyFetchImplementation.d.ts +14 -0
- package/dist/commonjs/queryExecutionContext/LegacyFetchImplementation.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/LegacyFetchImplementation.js +59 -0
- package/dist/commonjs/queryExecutionContext/LegacyFetchImplementation.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/PartitionRangeManager.d.ts +73 -0
- package/dist/commonjs/queryExecutionContext/PartitionRangeManager.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/PartitionRangeManager.js +160 -0
- package/dist/commonjs/queryExecutionContext/PartitionRangeManager.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/PartitionRangeUtils.d.ts +19 -0
- package/dist/commonjs/queryExecutionContext/PartitionRangeUtils.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/PartitionRangeUtils.js +109 -0
- package/dist/commonjs/queryExecutionContext/PartitionRangeUtils.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/QueryControlFetchImplementation.d.ts +20 -0
- package/dist/commonjs/queryExecutionContext/QueryControlFetchImplementation.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/QueryControlFetchImplementation.js +97 -0
- package/dist/commonjs/queryExecutionContext/QueryControlFetchImplementation.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/QueryValidationHelper.d.ts +9 -0
- package/dist/commonjs/queryExecutionContext/QueryValidationHelper.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/QueryValidationHelper.js +69 -0
- package/dist/commonjs/queryExecutionContext/QueryValidationHelper.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/defaultQueryExecutionContext.d.ts +2 -2
- package/dist/commonjs/queryExecutionContext/defaultQueryExecutionContext.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/defaultQueryExecutionContext.js +2 -1
- package/dist/commonjs/queryExecutionContext/defaultQueryExecutionContext.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/documentProducer.d.ts +9 -3
- package/dist/commonjs/queryExecutionContext/documentProducer.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/documentProducer.js +17 -4
- package/dist/commonjs/queryExecutionContext/documentProducer.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.d.ts +1 -1
- package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.js +18 -13
- package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/index.d.ts +7 -0
- package/dist/commonjs/queryExecutionContext/index.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/index.js +10 -0
- package/dist/commonjs/queryExecutionContext/index.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/nonStreamingOrderByResult.d.ts +5 -1
- package/dist/commonjs/queryExecutionContext/nonStreamingOrderByResult.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/nonStreamingOrderByResult.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/orderByComparator.d.ts +11 -2
- package/dist/commonjs/queryExecutionContext/orderByComparator.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/orderByComparator.js +21 -3
- package/dist/commonjs/queryExecutionContext/orderByComparator.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/orderByDocumentProducerComparator.d.ts +4 -0
- package/dist/commonjs/queryExecutionContext/orderByDocumentProducerComparator.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/orderByDocumentProducerComparator.js +18 -7
- package/dist/commonjs/queryExecutionContext/orderByDocumentProducerComparator.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/orderByQueryExecutionContext.d.ts +7 -10
- package/dist/commonjs/queryExecutionContext/orderByQueryExecutionContext.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/orderByQueryExecutionContext.js +30 -23
- package/dist/commonjs/queryExecutionContext/orderByQueryExecutionContext.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContext.d.ts +18 -10
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContext.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContext.js +47 -23
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContext.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.d.ts +160 -26
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.js +453 -106
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/parallelQueryResult.d.ts +35 -0
- package/dist/commonjs/queryExecutionContext/parallelQueryResult.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/parallelQueryResult.js +26 -0
- package/dist/commonjs/queryExecutionContext/parallelQueryResult.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/pipelinedQueryExecutionContext.d.ts +37 -7
- package/dist/commonjs/queryExecutionContext/pipelinedQueryExecutionContext.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/pipelinedQueryExecutionContext.js +173 -120
- package/dist/commonjs/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/FilterStrategy.d.ts +40 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/FilterStrategy.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/FilterStrategy.js +5 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/FilterStrategy.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.d.ts +49 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.js +314 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.d.ts +18 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.js +106 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.d.ts +51 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.js +184 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.d.ts +76 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.js +97 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.d.ts +30 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.js +5 -0
- package/dist/commonjs/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.d.ts +29 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.js +57 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.d.ts +27 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.js +38 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.d.ts +36 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.js +5 -0
- package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryRangeMapping.d.ts +22 -0
- package/dist/commonjs/queryExecutionContext/queryRangeMapping.d.ts.map +1 -0
- package/dist/commonjs/queryExecutionContext/queryRangeMapping.js +5 -0
- package/dist/commonjs/queryExecutionContext/queryRangeMapping.js.map +1 -0
- package/dist/commonjs/queryIterator.js.map +1 -1
- package/dist/commonjs/utils/offers.d.ts.map +1 -1
- package/dist/commonjs/utils/offers.js +0 -1
- package/dist/commonjs/utils/offers.js.map +1 -1
- package/dist/esm/CosmosClientOptions.d.ts +1 -1
- package/dist/esm/CosmosClientOptions.js.map +1 -1
- package/dist/esm/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
- package/dist/esm/client/ChangeFeed/ChangeFeedForEpkRange.js +2 -34
- package/dist/esm/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
- package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
- package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.js +2 -35
- package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
- package/dist/esm/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +15 -0
- package/dist/esm/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
- package/dist/esm/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
- package/dist/esm/client/ChangeFeed/InternalChangeFeedOptions.d.ts +3 -0
- package/dist/esm/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
- package/dist/esm/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
- package/dist/esm/client/ChangeFeed/changeFeedUtils.d.ts +6 -0
- package/dist/esm/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
- package/dist/esm/client/ChangeFeed/changeFeedUtils.js +47 -0
- package/dist/esm/client/ChangeFeed/changeFeedUtils.js.map +1 -1
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +16 -1
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/documents/ContinuationToken/CompositeQueryContinuationToken.d.ts +99 -0
- package/dist/esm/documents/ContinuationToken/CompositeQueryContinuationToken.d.ts.map +1 -0
- package/dist/esm/documents/ContinuationToken/CompositeQueryContinuationToken.js +84 -0
- package/dist/esm/documents/ContinuationToken/CompositeQueryContinuationToken.js.map +1 -0
- package/dist/esm/documents/ContinuationToken/OrderByQueryContinuationToken.d.ts +40 -0
- package/dist/esm/documents/ContinuationToken/OrderByQueryContinuationToken.d.ts.map +1 -0
- package/dist/esm/documents/ContinuationToken/OrderByQueryContinuationToken.js +39 -0
- package/dist/esm/documents/ContinuationToken/OrderByQueryContinuationToken.js.map +1 -0
- package/dist/esm/documents/ContinuationToken/PartitionRangeUpdate.d.ts +21 -0
- package/dist/esm/documents/ContinuationToken/PartitionRangeUpdate.d.ts.map +1 -0
- package/dist/esm/documents/ContinuationToken/PartitionRangeUpdate.js +4 -0
- package/dist/esm/documents/ContinuationToken/PartitionRangeUpdate.js.map +1 -0
- package/dist/esm/documents/VectorEmbeddingPolicy.d.ts +4 -0
- package/dist/esm/documents/VectorEmbeddingPolicy.d.ts.map +1 -1
- package/dist/esm/documents/VectorEmbeddingPolicy.js +4 -0
- package/dist/esm/documents/VectorEmbeddingPolicy.js.map +1 -1
- package/dist/esm/queryExecutionContext/Aggregators/MaxAggregator.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/Aggregators/MaxAggregator.js +4 -0
- package/dist/esm/queryExecutionContext/Aggregators/MaxAggregator.js.map +1 -1
- package/dist/esm/queryExecutionContext/Aggregators/MinAggregator.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/Aggregators/MinAggregator.js +4 -0
- package/dist/esm/queryExecutionContext/Aggregators/MinAggregator.js.map +1 -1
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.d.ts +2 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.js +174 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.js.map +1 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.d.ts +2 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.js +28 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.js.map +1 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.d.ts +2 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.js +129 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.js.map +1 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.d.ts +2 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.js +66 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.js.map +1 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenParser.d.ts +2 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenParser.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenParser.js +23 -0
- package/dist/esm/queryExecutionContext/ContinuationTokenParser.js.map +1 -0
- package/dist/esm/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js +22 -7
- package/dist/esm/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js +21 -5
- package/dist/esm/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js +28 -6
- package/dist/esm/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js +23 -7
- package/dist/esm/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js +35 -4
- package/dist/esm/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.d.ts +1 -0
- package/dist/esm/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js +22 -4
- package/dist/esm/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.d.ts +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js +24 -5
- package/dist/esm/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js +18 -5
- package/dist/esm/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js.map +1 -1
- package/dist/esm/queryExecutionContext/LegacyFetchImplementation.d.ts +14 -0
- package/dist/esm/queryExecutionContext/LegacyFetchImplementation.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/LegacyFetchImplementation.js +55 -0
- package/dist/esm/queryExecutionContext/LegacyFetchImplementation.js.map +1 -0
- package/dist/esm/queryExecutionContext/PartitionRangeManager.d.ts +73 -0
- package/dist/esm/queryExecutionContext/PartitionRangeManager.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/PartitionRangeManager.js +156 -0
- package/dist/esm/queryExecutionContext/PartitionRangeManager.js.map +1 -0
- package/dist/esm/queryExecutionContext/PartitionRangeUtils.d.ts +19 -0
- package/dist/esm/queryExecutionContext/PartitionRangeUtils.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/PartitionRangeUtils.js +105 -0
- package/dist/esm/queryExecutionContext/PartitionRangeUtils.js.map +1 -0
- package/dist/esm/queryExecutionContext/QueryControlFetchImplementation.d.ts +20 -0
- package/dist/esm/queryExecutionContext/QueryControlFetchImplementation.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/QueryControlFetchImplementation.js +93 -0
- package/dist/esm/queryExecutionContext/QueryControlFetchImplementation.js.map +1 -0
- package/dist/esm/queryExecutionContext/QueryValidationHelper.d.ts +9 -0
- package/dist/esm/queryExecutionContext/QueryValidationHelper.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/QueryValidationHelper.js +65 -0
- package/dist/esm/queryExecutionContext/QueryValidationHelper.js.map +1 -0
- package/dist/esm/queryExecutionContext/defaultQueryExecutionContext.d.ts +2 -2
- package/dist/esm/queryExecutionContext/defaultQueryExecutionContext.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/defaultQueryExecutionContext.js +2 -1
- package/dist/esm/queryExecutionContext/defaultQueryExecutionContext.js.map +1 -1
- package/dist/esm/queryExecutionContext/documentProducer.d.ts +9 -3
- package/dist/esm/queryExecutionContext/documentProducer.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/documentProducer.js +17 -4
- package/dist/esm/queryExecutionContext/documentProducer.js.map +1 -1
- package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.d.ts +1 -1
- package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.js +18 -13
- package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
- package/dist/esm/queryExecutionContext/index.d.ts +7 -0
- package/dist/esm/queryExecutionContext/index.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/index.js +4 -0
- package/dist/esm/queryExecutionContext/index.js.map +1 -1
- package/dist/esm/queryExecutionContext/nonStreamingOrderByResult.d.ts +5 -1
- package/dist/esm/queryExecutionContext/nonStreamingOrderByResult.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/nonStreamingOrderByResult.js.map +1 -1
- package/dist/esm/queryExecutionContext/orderByComparator.d.ts +11 -2
- package/dist/esm/queryExecutionContext/orderByComparator.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/orderByComparator.js +20 -3
- package/dist/esm/queryExecutionContext/orderByComparator.js.map +1 -1
- package/dist/esm/queryExecutionContext/orderByDocumentProducerComparator.d.ts +4 -0
- package/dist/esm/queryExecutionContext/orderByDocumentProducerComparator.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/orderByDocumentProducerComparator.js +18 -7
- package/dist/esm/queryExecutionContext/orderByDocumentProducerComparator.js.map +1 -1
- package/dist/esm/queryExecutionContext/orderByQueryExecutionContext.d.ts +7 -10
- package/dist/esm/queryExecutionContext/orderByQueryExecutionContext.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/orderByQueryExecutionContext.js +30 -23
- package/dist/esm/queryExecutionContext/orderByQueryExecutionContext.js.map +1 -1
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContext.d.ts +18 -10
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContext.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContext.js +47 -23
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContext.js.map +1 -1
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.d.ts +160 -26
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.js +453 -106
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/esm/queryExecutionContext/parallelQueryResult.d.ts +35 -0
- package/dist/esm/queryExecutionContext/parallelQueryResult.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/parallelQueryResult.js +23 -0
- package/dist/esm/queryExecutionContext/parallelQueryResult.js.map +1 -0
- package/dist/esm/queryExecutionContext/pipelinedQueryExecutionContext.d.ts +37 -7
- package/dist/esm/queryExecutionContext/pipelinedQueryExecutionContext.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/pipelinedQueryExecutionContext.js +173 -120
- package/dist/esm/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/FilterStrategy.d.ts +40 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/FilterStrategy.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/FilterStrategy.js +4 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/FilterStrategy.js.map +1 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.d.ts +49 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.js +310 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.js.map +1 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.d.ts +18 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.js +102 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.js.map +1 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.d.ts +51 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.js +180 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.js.map +1 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.d.ts +76 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.js +93 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.js.map +1 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.d.ts +30 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.js +4 -0
- package/dist/esm/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.js.map +1 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.d.ts +29 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.js +53 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.js.map +1 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.d.ts +27 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.js +34 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.js.map +1 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.d.ts +36 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.js +4 -0
- package/dist/esm/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.js.map +1 -0
- package/dist/esm/queryExecutionContext/queryRangeMapping.d.ts +22 -0
- package/dist/esm/queryExecutionContext/queryRangeMapping.d.ts.map +1 -0
- package/dist/esm/queryExecutionContext/queryRangeMapping.js +4 -0
- package/dist/esm/queryExecutionContext/queryRangeMapping.js.map +1 -0
- package/dist/esm/queryIterator.js.map +1 -1
- package/dist/esm/utils/offers.d.ts.map +1 -1
- package/dist/esm/utils/offers.js +0 -1
- package/dist/esm/utils/offers.js.map +1 -1
- package/dist/react-native/CosmosClientOptions.d.ts +1 -1
- package/dist/react-native/CosmosClientOptions.js.map +1 -1
- package/dist/react-native/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
- package/dist/react-native/client/ChangeFeed/ChangeFeedForEpkRange.js +2 -34
- package/dist/react-native/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
- package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
- package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.js +2 -35
- package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
- package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +15 -0
- package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
- package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
- package/dist/react-native/client/ChangeFeed/InternalChangeFeedOptions.d.ts +3 -0
- package/dist/react-native/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
- package/dist/react-native/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
- package/dist/react-native/client/ChangeFeed/changeFeedUtils.d.ts +6 -0
- package/dist/react-native/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
- package/dist/react-native/client/ChangeFeed/changeFeedUtils.js +47 -0
- package/dist/react-native/client/ChangeFeed/changeFeedUtils.js.map +1 -1
- package/dist/react-native/common/constants.d.ts.map +1 -1
- package/dist/react-native/common/constants.js +16 -1
- package/dist/react-native/common/constants.js.map +1 -1
- package/dist/react-native/documents/ContinuationToken/CompositeQueryContinuationToken.d.ts +99 -0
- package/dist/react-native/documents/ContinuationToken/CompositeQueryContinuationToken.d.ts.map +1 -0
- package/dist/react-native/documents/ContinuationToken/CompositeQueryContinuationToken.js +84 -0
- package/dist/react-native/documents/ContinuationToken/CompositeQueryContinuationToken.js.map +1 -0
- package/dist/react-native/documents/ContinuationToken/OrderByQueryContinuationToken.d.ts +40 -0
- package/dist/react-native/documents/ContinuationToken/OrderByQueryContinuationToken.d.ts.map +1 -0
- package/dist/react-native/documents/ContinuationToken/OrderByQueryContinuationToken.js +39 -0
- package/dist/react-native/documents/ContinuationToken/OrderByQueryContinuationToken.js.map +1 -0
- package/dist/react-native/documents/ContinuationToken/PartitionRangeUpdate.d.ts +21 -0
- package/dist/react-native/documents/ContinuationToken/PartitionRangeUpdate.d.ts.map +1 -0
- package/dist/react-native/documents/ContinuationToken/PartitionRangeUpdate.js +4 -0
- package/dist/react-native/documents/ContinuationToken/PartitionRangeUpdate.js.map +1 -0
- package/dist/react-native/documents/VectorEmbeddingPolicy.d.ts +4 -0
- package/dist/react-native/documents/VectorEmbeddingPolicy.d.ts.map +1 -1
- package/dist/react-native/documents/VectorEmbeddingPolicy.js +4 -0
- package/dist/react-native/documents/VectorEmbeddingPolicy.js.map +1 -1
- package/dist/react-native/queryExecutionContext/Aggregators/MaxAggregator.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/Aggregators/MaxAggregator.js +4 -0
- package/dist/react-native/queryExecutionContext/Aggregators/MaxAggregator.js.map +1 -1
- package/dist/react-native/queryExecutionContext/Aggregators/MinAggregator.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/Aggregators/MinAggregator.js +4 -0
- package/dist/react-native/queryExecutionContext/Aggregators/MinAggregator.js.map +1 -1
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.d.ts +2 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.js +174 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/BaseContinuationTokenManager.js.map +1 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.d.ts +2 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.js +28 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/ContinuationTokenManagerFactory.js.map +1 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.d.ts +2 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.js +129 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/OrderByQueryContinuationTokenManager.js.map +1 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.d.ts +2 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.js +66 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenManager/ParallelQueryContinuationTokenManager.js.map +1 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenParser.d.ts +2 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenParser.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenParser.js +23 -0
- package/dist/react-native/queryExecutionContext/ContinuationTokenParser.js.map +1 -0
- package/dist/react-native/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js +22 -7
- package/dist/react-native/queryExecutionContext/EndpointComponent/GroupByEndpointComponent.js.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js +21 -5
- package/dist/react-native/queryExecutionContext/EndpointComponent/GroupByValueEndpointComponent.js.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js +28 -6
- package/dist/react-native/queryExecutionContext/EndpointComponent/NonStreamingOrderByDistinctEndpointComponent.js.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js +23 -7
- package/dist/react-native/queryExecutionContext/EndpointComponent/NonStreamingOrderByEndpointComponent.js.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js +35 -4
- package/dist/react-native/queryExecutionContext/EndpointComponent/OffsetLimitEndpointComponent.js.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.d.ts +1 -0
- package/dist/react-native/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js +22 -4
- package/dist/react-native/queryExecutionContext/EndpointComponent/OrderByEndpointComponent.js.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.d.ts +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js +24 -5
- package/dist/react-native/queryExecutionContext/EndpointComponent/OrderedDistinctEndpointComponent.js.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js +18 -5
- package/dist/react-native/queryExecutionContext/EndpointComponent/UnorderedDistinctEndpointComponent.js.map +1 -1
- package/dist/react-native/queryExecutionContext/LegacyFetchImplementation.d.ts +14 -0
- package/dist/react-native/queryExecutionContext/LegacyFetchImplementation.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/LegacyFetchImplementation.js +55 -0
- package/dist/react-native/queryExecutionContext/LegacyFetchImplementation.js.map +1 -0
- package/dist/react-native/queryExecutionContext/PartitionRangeManager.d.ts +73 -0
- package/dist/react-native/queryExecutionContext/PartitionRangeManager.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/PartitionRangeManager.js +156 -0
- package/dist/react-native/queryExecutionContext/PartitionRangeManager.js.map +1 -0
- package/dist/react-native/queryExecutionContext/PartitionRangeUtils.d.ts +19 -0
- package/dist/react-native/queryExecutionContext/PartitionRangeUtils.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/PartitionRangeUtils.js +105 -0
- package/dist/react-native/queryExecutionContext/PartitionRangeUtils.js.map +1 -0
- package/dist/react-native/queryExecutionContext/QueryControlFetchImplementation.d.ts +20 -0
- package/dist/react-native/queryExecutionContext/QueryControlFetchImplementation.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/QueryControlFetchImplementation.js +93 -0
- package/dist/react-native/queryExecutionContext/QueryControlFetchImplementation.js.map +1 -0
- package/dist/react-native/queryExecutionContext/QueryValidationHelper.d.ts +9 -0
- package/dist/react-native/queryExecutionContext/QueryValidationHelper.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/QueryValidationHelper.js +65 -0
- package/dist/react-native/queryExecutionContext/QueryValidationHelper.js.map +1 -0
- package/dist/react-native/queryExecutionContext/defaultQueryExecutionContext.d.ts +2 -2
- package/dist/react-native/queryExecutionContext/defaultQueryExecutionContext.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/defaultQueryExecutionContext.js +2 -1
- package/dist/react-native/queryExecutionContext/defaultQueryExecutionContext.js.map +1 -1
- package/dist/react-native/queryExecutionContext/documentProducer.d.ts +9 -3
- package/dist/react-native/queryExecutionContext/documentProducer.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/documentProducer.js +17 -4
- package/dist/react-native/queryExecutionContext/documentProducer.js.map +1 -1
- package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.d.ts +1 -1
- package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.js +18 -13
- package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
- package/dist/react-native/queryExecutionContext/index.d.ts +7 -0
- package/dist/react-native/queryExecutionContext/index.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/index.js +4 -0
- package/dist/react-native/queryExecutionContext/index.js.map +1 -1
- package/dist/react-native/queryExecutionContext/nonStreamingOrderByResult.d.ts +5 -1
- package/dist/react-native/queryExecutionContext/nonStreamingOrderByResult.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/nonStreamingOrderByResult.js.map +1 -1
- package/dist/react-native/queryExecutionContext/orderByComparator.d.ts +11 -2
- package/dist/react-native/queryExecutionContext/orderByComparator.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/orderByComparator.js +20 -3
- package/dist/react-native/queryExecutionContext/orderByComparator.js.map +1 -1
- package/dist/react-native/queryExecutionContext/orderByDocumentProducerComparator.d.ts +4 -0
- package/dist/react-native/queryExecutionContext/orderByDocumentProducerComparator.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/orderByDocumentProducerComparator.js +18 -7
- package/dist/react-native/queryExecutionContext/orderByDocumentProducerComparator.js.map +1 -1
- package/dist/react-native/queryExecutionContext/orderByQueryExecutionContext.d.ts +7 -10
- package/dist/react-native/queryExecutionContext/orderByQueryExecutionContext.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/orderByQueryExecutionContext.js +30 -23
- package/dist/react-native/queryExecutionContext/orderByQueryExecutionContext.js.map +1 -1
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContext.d.ts +18 -10
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContext.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContext.js +47 -23
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContext.js.map +1 -1
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.d.ts +160 -26
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.js +453 -106
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/react-native/queryExecutionContext/parallelQueryResult.d.ts +35 -0
- package/dist/react-native/queryExecutionContext/parallelQueryResult.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/parallelQueryResult.js +23 -0
- package/dist/react-native/queryExecutionContext/parallelQueryResult.js.map +1 -0
- package/dist/react-native/queryExecutionContext/pipelinedQueryExecutionContext.d.ts +37 -7
- package/dist/react-native/queryExecutionContext/pipelinedQueryExecutionContext.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/pipelinedQueryExecutionContext.js +173 -120
- package/dist/react-native/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/FilterStrategy.d.ts +40 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/FilterStrategy.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/FilterStrategy.js +4 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/FilterStrategy.js.map +1 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.d.ts +49 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.js +310 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/OrderByQueryRangeStrategy.js.map +1 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.d.ts +18 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.js +102 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/ParallelQueryRangeStrategy.js.map +1 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.d.ts +51 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.js +180 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/RidSkipCountFilter.js.map +1 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.d.ts +76 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.js +93 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeManager.js.map +1 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.d.ts +30 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.js +4 -0
- package/dist/react-native/queryExecutionContext/queryFilteringStrategy/TargetPartitionRangeStrategy.js.map +1 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.d.ts +29 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.js +53 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/OrderByQueryProcessingStrategy.js.map +1 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.d.ts +27 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.js +34 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/ParallelQueryProcessingStrategy.js.map +1 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.d.ts +36 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.js +4 -0
- package/dist/react-native/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.js.map +1 -0
- package/dist/react-native/queryExecutionContext/queryRangeMapping.d.ts +22 -0
- package/dist/react-native/queryExecutionContext/queryRangeMapping.d.ts.map +1 -0
- package/dist/react-native/queryExecutionContext/queryRangeMapping.js +4 -0
- package/dist/react-native/queryExecutionContext/queryRangeMapping.js.map +1 -0
- package/dist/react-native/queryIterator.js.map +1 -1
- package/dist/react-native/utils/offers.d.ts.map +1 -1
- package/dist/react-native/utils/offers.js +0 -1
- package/dist/react-native/utils/offers.js.map +1 -1
- package/package.json +6 -5
package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { OrderByQueryContinuationToken } from "../../documents/ContinuationToken/OrderByQueryContinuationToken.js";
|
|
2
|
+
import type { CompositeQueryContinuationToken } from "../../documents/ContinuationToken/CompositeQueryContinuationToken.js";
|
|
3
|
+
import type { FilterContext } from "../queryFilteringStrategy/FilterStrategy.js";
|
|
4
|
+
/**
|
|
5
|
+
* Strategy interface for processing different query types
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
export interface QueryProcessingStrategy {
|
|
9
|
+
/**
|
|
10
|
+
* Creates additional query info from parsed continuation token
|
|
11
|
+
* @param parsedToken - The parsed continuation token
|
|
12
|
+
* @returns Additional query info or undefined
|
|
13
|
+
*/
|
|
14
|
+
createAdditionalQueryInfo(parsedToken: OrderByQueryContinuationToken | CompositeQueryContinuationToken): any;
|
|
15
|
+
/**
|
|
16
|
+
* Creates filter context for continuation token processing
|
|
17
|
+
* @param parsedToken - The parsed continuation token
|
|
18
|
+
* @returns Filter context or undefined
|
|
19
|
+
*/
|
|
20
|
+
createFilterContext(parsedToken: OrderByQueryContinuationToken | CompositeQueryContinuationToken): FilterContext | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Determines if filter context should be applied to a specific partition
|
|
23
|
+
* @param filterContext - The filter context
|
|
24
|
+
* @param targetPartitionId - ID of the target partition
|
|
25
|
+
* @param partitionTargetRangeId - ID of the current partition range
|
|
26
|
+
* @returns Filter context to apply or undefined
|
|
27
|
+
*/
|
|
28
|
+
getPartitionFilterContext(filterContext: FilterContext | undefined, targetPartitionId: string | undefined, partitionTargetRangeId: string): FilterContext | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Parses continuation token based on query type
|
|
31
|
+
* @param continuationToken - The continuation token string to parse
|
|
32
|
+
* @returns Parsed continuation token object
|
|
33
|
+
*/
|
|
34
|
+
parseContinuationToken(continuationToken: string): OrderByQueryContinuationToken | CompositeQueryContinuationToken;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=QueryProcessingStrategy.d.ts.map
|
package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryProcessingStrategy.d.ts","sourceRoot":"","sources":["../../../../src/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oEAAoE,CAAC;AACxH,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,sEAAsE,CAAC;AAC5H,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,yBAAyB,CACvB,WAAW,EAAE,6BAA6B,GAAG,+BAA+B,GAC3E,GAAG,CAAC;IAEP;;;;OAIG;IACH,mBAAmB,CACjB,WAAW,EAAE,6BAA6B,GAAG,+BAA+B,GAC3E,aAAa,GAAG,SAAS,CAAC;IAE7B;;;;;;OAMG;IACH,yBAAyB,CACvB,aAAa,EAAE,aAAa,GAAG,SAAS,EACxC,iBAAiB,EAAE,MAAM,GAAG,SAAS,EACrC,sBAAsB,EAAE,MAAM,GAC7B,aAAa,GAAG,SAAS,CAAC;IAE7B;;;;OAIG;IACH,sBAAsB,CACpB,iBAAiB,EAAE,MAAM,GACxB,6BAA6B,GAAG,+BAA+B,CAAC;CACpE"}
|
package/dist/commonjs/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryProcessingStrategy.js","sourceRoot":"","sources":["../../../../src/queryExecutionContext/queryProcessingStrategy/QueryProcessingStrategy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OrderByQueryContinuationToken } from \"../../documents/ContinuationToken/OrderByQueryContinuationToken.js\";\nimport type { CompositeQueryContinuationToken } from \"../../documents/ContinuationToken/CompositeQueryContinuationToken.js\";\nimport type { FilterContext } from \"../queryFilteringStrategy/FilterStrategy.js\";\n\n/**\n * Strategy interface for processing different query types\n * @hidden\n */\nexport interface QueryProcessingStrategy {\n /**\n * Creates additional query info from parsed continuation token\n * @param parsedToken - The parsed continuation token\n * @returns Additional query info or undefined\n */\n createAdditionalQueryInfo(\n parsedToken: OrderByQueryContinuationToken | CompositeQueryContinuationToken,\n ): any;\n\n /**\n * Creates filter context for continuation token processing\n * @param parsedToken - The parsed continuation token\n * @returns Filter context or undefined\n */\n createFilterContext(\n parsedToken: OrderByQueryContinuationToken | CompositeQueryContinuationToken,\n ): FilterContext | undefined;\n\n /**\n * Determines if filter context should be applied to a specific partition\n * @param filterContext - The filter context\n * @param targetPartitionId - ID of the target partition\n * @param partitionTargetRangeId - ID of the current partition range\n * @returns Filter context to apply or undefined\n */\n getPartitionFilterContext(\n filterContext: FilterContext | undefined,\n targetPartitionId: string | undefined,\n partitionTargetRangeId: string,\n ): FilterContext | undefined;\n\n /**\n * Parses continuation token based on query type\n * @param continuationToken - The continuation token string to parse\n * @returns Parsed continuation token object\n */\n parseContinuationToken(\n continuationToken: string,\n ): OrderByQueryContinuationToken | CompositeQueryContinuationToken;\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PartitionKeyRange } from "../client/Container/PartitionKeyRange.js";
|
|
2
|
+
/**
|
|
3
|
+
* @hidden
|
|
4
|
+
* Represents a range mapping for partition key range
|
|
5
|
+
*/
|
|
6
|
+
export interface QueryRangeMapping {
|
|
7
|
+
/**
|
|
8
|
+
* Continuation token for this partition key range
|
|
9
|
+
*/
|
|
10
|
+
continuationToken: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The partition key range this mapping belongs to
|
|
13
|
+
*/
|
|
14
|
+
partitionKeyRange: PartitionKeyRange;
|
|
15
|
+
/**
|
|
16
|
+
* Hash of the last document result for this partition key range (for distinct queries)
|
|
17
|
+
*/
|
|
18
|
+
hashedLastResult?: string;
|
|
19
|
+
offset?: number;
|
|
20
|
+
limit?: number;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=queryRangeMapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryRangeMapping.d.ts","sourceRoot":"","sources":["../../../src/queryExecutionContext/queryRangeMapping.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAElF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAOhC;;OAEG;IACH,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IAEtC;;OAEG;IACH,iBAAiB,EAAE,iBAAiB,CAAC;IAErC;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryRangeMapping.js","sourceRoot":"","sources":["../../../src/queryExecutionContext/queryRangeMapping.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PartitionKeyRange } from \"../client/Container/PartitionKeyRange.js\";\n\n/**\n * @hidden\n * Represents a range mapping for partition key range\n */\nexport interface QueryRangeMapping {\n /**\n * @internal\n * Number of items from this partition range in the current buffer\n */\n itemCount: number;\n\n /**\n * Continuation token for this partition key range\n */\n continuationToken: string | undefined;\n\n /**\n * The partition key range this mapping belongs to\n */\n partitionKeyRange: PartitionKeyRange;\n\n /**\n * Hash of the last document result for this partition key range (for distinct queries)\n */\n hashedLastResult?: string;\n\n offset?: number;\n\n limit?: number;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryIterator.js","sourceRoot":"","sources":["../../src/queryIterator.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAIlC,uFAGiD;AACjD,gDAA+E;A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C;YACD,OAAO,KAAK,CAAC,IAAI,KAAK,sBAAW,CAAC,UAAU,IAAI,IAAI,CAAC,YAAY,KAAK,uBAAY,CAAC,IAAI,CAAC;QAC1F,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAEO,WAAW,CAAgB;IACnC;;OAEG;IACI,KAAK,CAAC,IAAI,CAAC,cAAsC;QACtD,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;YAChC,OAAO;QACT,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IACO,KAAK,CAAC,KAAK,CAAC,cAAsC;QACxD,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,IAAI,IAAI,IAAI,CAAC,YAAY,KAAK,uBAAY,CAAC,IAAI,EAAE,CAAC;YACpF,MAAM,IAAI,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,CAAC;IAEO,gBAAgB,CAAC,GAAQ;QAC/B,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;YACrB,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,8EAA8E,CACxE,CAAC;YACT,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC;YACjB,KAAK,CAAC,aAAa,GAAG,GAAG,CAAC;YAC1B,MAAM,KAAK,CAAC;QACd,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AA9aD,sCA8aC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/// <reference lib=\"esnext.asynciterable\" />\nimport type { ClientContext } from \"./ClientContext.js\";\nimport {\n DiagnosticNodeInternal,\n DiagnosticNodeType,\n} from \"./diagnostics/DiagnosticNodeInternal.js\";\nimport { getPathFromLink, ResourceType, StatusCodes } from \"./common/index.js\";\nimport type {\n CosmosHeaders,\n ExecutionContext,\n FetchFunctionCallback,\n SqlQuerySpec,\n} from \"./queryExecutionContext/index.js\";\nimport {\n DefaultQueryExecutionContext,\n getInitialHeader,\n mergeHeaders,\n PipelinedQueryExecutionContext,\n} from \"./queryExecutionContext/index.js\";\nimport type { Response } from \"./request/index.js\";\nimport type {\n ErrorResponse,\n PartitionedQueryExecutionInfo,\n QueryRange,\n} from \"./request/ErrorResponse.js\";\nimport type { FeedOptions } from \"./request/FeedOptions.js\";\nimport { FeedResponse } from \"./request/FeedResponse.js\";\nimport {\n getEmptyCosmosDiagnostics,\n withDiagnostics,\n withMetadataDiagnostics,\n} from \"./utils/diagnostics.js\";\nimport { MetadataLookUpType } from \"./CosmosDiagnostics.js\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { HybridQueryExecutionContext } from \"./queryExecutionContext/hybridQueryExecutionContext.js\";\nimport { PartitionKeyRangeCache } from \"./routing/index.js\";\n\n/**\n * Represents a QueryIterator Object, an implementation of feed or query response that enables\n * traversal and iterating over the response\n * in the Azure Cosmos DB database service.\n */\nexport class QueryIterator<T> {\n private fetchAllTempResources: T[]; // TODO\n private fetchAllLastResHeaders: CosmosHeaders;\n private queryExecutionContext: ExecutionContext;\n private queryPlanPromise: Promise<Response<PartitionedQueryExecutionInfo>>;\n private isInitialized: boolean;\n private correlatedActivityId: string;\n private partitionKeyRangeCache: PartitionKeyRangeCache;\n /**\n * @hidden\n */\n constructor(\n private clientContext: ClientContext,\n private query: SqlQuerySpec | string,\n private options: FeedOptions,\n private fetchFunctions: FetchFunctionCallback | FetchFunctionCallback[],\n private resourceLink?: string,\n private resourceType?: ResourceType,\n ) {\n this.query = query;\n this.fetchFunctions = fetchFunctions;\n this.options = options || {};\n this.resourceLink = resourceLink;\n this.fetchAllLastResHeaders = getInitialHeader();\n this.reset();\n this.isInitialized = false;\n this.partitionKeyRangeCache = this.clientContext.partitionKeyRangeCache;\n }\n\n /**\n * Gets an async iterator that will yield results until completion.\n *\n * NOTE: AsyncIterators are a very new feature and you might need to\n * use polyfils/etc. in order to use them in your code.\n *\n * If you're using TypeScript, you can use the following polyfill as long\n * as you target ES6 or higher and are running on Node 6 or higher.\n *\n * ```ts snippet:ignore\n * if (!Symbol || !Symbol.asyncIterator) {\n * (Symbol as any).asyncIterator = Symbol.for(\"Symbol.asyncIterator\");\n * }\n * ```\n *\n * @example Iterate over all databases\n * ```ts snippet:QueryIteratorIterateDatabases\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 * for await (const { resources: db } of client.databases.readAll().getAsyncIterator()) {\n * console.log(`Got ${db} from AsyncIterator`);\n * }\n * ```\n */\n public async *getAsyncIterator(): AsyncIterable<FeedResponse<T>> {\n const diagnosticNode = new DiagnosticNodeInternal(\n this.clientContext.diagnosticLevel,\n DiagnosticNodeType.CLIENT_REQUEST_NODE,\n null,\n );\n yield* this.getAsyncIteratorInternal(diagnosticNode);\n }\n /**\n * @internal\n */\n public async *getAsyncIteratorInternal(\n diagnosticNode: DiagnosticNodeInternal,\n ): AsyncIterable<FeedResponse<T>> {\n this.reset();\n this.queryPlanPromise = this.fetchQueryPlan(diagnosticNode);\n while (this.queryExecutionContext.hasMoreResults()) {\n let response: Response<any>;\n try {\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } catch (error: any) {\n if (this.needsQueryPlan(error)) {\n await this.createExecutionContext(diagnosticNode);\n try {\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } catch (queryError: any) {\n this.handleSplitError(queryError);\n }\n } else {\n throw error;\n }\n }\n\n const feedResponse = new FeedResponse<T>(\n response.result,\n response.headers,\n this.queryExecutionContext.hasMoreResults(),\n diagnosticNode.toDiagnostic(this.clientContext.getClientConfig()),\n );\n diagnosticNode = new DiagnosticNodeInternal(\n this.clientContext.diagnosticLevel,\n DiagnosticNodeType.CLIENT_REQUEST_NODE,\n null,\n );\n if (response.result !== undefined) {\n yield feedResponse;\n }\n }\n }\n\n /**\n * Determine if there are still remaining resources to process based on the value of the continuation token or the\n * elements remaining on the current batch in the QueryIterator.\n * @returns true if there is other elements to process in the QueryIterator.\n */\n public hasMoreResults(): boolean {\n return this.queryExecutionContext.hasMoreResults();\n }\n\n /**\n * Fetch all pages for the query and return a single FeedResponse.\n * @example\n * ```ts snippet:ReadmeSampleQueryDatabase\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 * const { resources } = await container.items\n * .query(\"SELECT * from c WHERE c.isCapitol = true\")\n * .fetchAll();\n * ```\n */\n\n public async fetchAll(): Promise<FeedResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n return this.fetchAllInternal(diagnosticNode);\n }, this.clientContext);\n }\n\n /**\n * @hidden\n */\n public async fetchAllInternal(diagnosticNode: DiagnosticNodeInternal): Promise<FeedResponse<T>> {\n this.reset();\n let response: FeedResponse<T>;\n try {\n response = await this.toArrayImplementation(diagnosticNode);\n } catch (error: any) {\n this.handleSplitError(error);\n }\n return response;\n }\n\n /**\n * Retrieve the next batch from the feed.\n *\n * This may or may not fetch more pages from the backend depending on your settings\n * and the type of query. Aggregate queries will generally fetch all backend pages\n * before returning the first batch of responses.\n *\n * @example\n * ```ts snippet:ReadmeSampleNonStreamableCrossPartitionQuery\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 * const querySpec = {\n * query: \"SELECT c.status, COUNT(c.id) AS count FROM c GROUP BY c.status\",\n * };\n * const queryOptions = {\n * maxItemCount: 10, // maximum number of items to return per page\n * enableCrossPartitionQuery: true,\n * };\n * const queryIterator = container.items.query(querySpec, queryOptions);\n * while (queryIterator.hasMoreResults()) {\n * const { resources: result } = await queryIterator.fetchNext();\n * // process results\n * }\n * ```\n */\n public async fetchNext(): Promise<FeedResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n return this.fetchNextInternal(diagnosticNode);\n }, this.clientContext);\n }\n /**\n * @internal\n */\n public async fetchNextInternal(diagnosticNode: DiagnosticNodeInternal): Promise<FeedResponse<T>> {\n this.queryPlanPromise = withMetadataDiagnostics(\n async (metadataNode: DiagnosticNodeInternal) => {\n return this.fetchQueryPlan(metadataNode);\n },\n diagnosticNode,\n MetadataLookUpType.QueryPlanLookUp,\n );\n if (!this.isInitialized) {\n await this.init(diagnosticNode);\n }\n let response: Response<any>;\n try {\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } catch (error: any) {\n if (this.needsQueryPlan(error)) {\n await this.createExecutionContext(diagnosticNode);\n try {\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } catch (queryError: any) {\n this.handleSplitError(queryError);\n }\n } else {\n throw error;\n }\n }\n return new FeedResponse<T>(\n response.result,\n response.headers,\n this.queryExecutionContext.hasMoreResults(),\n getEmptyCosmosDiagnostics(),\n );\n }\n\n /**\n * Reset the QueryIterator to the beginning and clear all the resources inside it\n * @example\n * ```ts snippet:QueryIteratorReset\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 { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * const querySpec = {\n * query: \"SELECT c.status, COUNT(c.id) AS count FROM c GROUP BY c.status\",\n * };\n * const queryIterator = container.items.query(querySpec);\n * while (queryIterator.hasMoreResults()) {\n * const { resources: result } = await queryIterator.fetchNext();\n * // process results\n * }\n * queryIterator.reset();\n * ```\n *\n */\n public reset(): void {\n this.correlatedActivityId = randomUUID();\n this.queryPlanPromise = undefined;\n this.fetchAllLastResHeaders = getInitialHeader();\n this.fetchAllTempResources = [];\n this.queryExecutionContext = new DefaultQueryExecutionContext(\n this.options,\n this.fetchFunctions,\n this.correlatedActivityId,\n );\n }\n\n private async toArrayImplementation(\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<FeedResponse<T>> {\n this.queryPlanPromise = withMetadataDiagnostics(\n async (metadataNode: DiagnosticNodeInternal) => {\n return this.fetchQueryPlan(metadataNode);\n },\n diagnosticNode,\n MetadataLookUpType.QueryPlanLookUp,\n );\n // this.queryPlanPromise = this.fetchQueryPlan(diagnosticNode);\n if (!this.isInitialized) {\n await this.init(diagnosticNode);\n }\n while (this.queryExecutionContext.hasMoreResults()) {\n let response: Response<any>;\n try {\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } catch (error: any) {\n if (this.needsQueryPlan(error)) {\n await this.createExecutionContext(diagnosticNode);\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } else {\n throw error;\n }\n }\n const { result, headers } = response;\n // concatenate the results and fetch more\n mergeHeaders(this.fetchAllLastResHeaders, headers);\n if (result) {\n this.fetchAllTempResources.push(...result);\n }\n }\n return new FeedResponse(\n this.fetchAllTempResources,\n this.fetchAllLastResHeaders,\n this.queryExecutionContext.hasMoreResults(),\n getEmptyCosmosDiagnostics(),\n );\n }\n\n private async createExecutionContext(diagnosticNode?: DiagnosticNodeInternal): Promise<void> {\n const queryPlanResponse = await this.queryPlanPromise;\n\n // We always coerce queryPlanPromise to resolved. So if it errored, we need to manually inspect the resolved value\n if (queryPlanResponse instanceof Error) {\n throw queryPlanResponse;\n }\n\n const queryPlan: PartitionedQueryExecutionInfo = queryPlanResponse.result;\n if (queryPlan.hybridSearchQueryInfo && queryPlan.hybridSearchQueryInfo !== null) {\n await this.createHybridQueryExecutionContext(queryPlan, diagnosticNode);\n } else {\n await this.createPipelinedExecutionContext(queryPlan);\n }\n }\n\n private async createHybridQueryExecutionContext(\n queryPlan: PartitionedQueryExecutionInfo,\n diagnosticNode?: DiagnosticNodeInternal,\n ): Promise<void> {\n const allPartitionKeyRanges = (\n await this.partitionKeyRangeCache.onCollectionRoutingMap(this.resourceLink, diagnosticNode)\n ).getOrderedParitionKeyRanges();\n\n // convert allPartitionKeyRanges to QueryRanges\n const queryRanges: QueryRange[] = allPartitionKeyRanges.map((partitionKeyRange) => {\n return {\n min: partitionKeyRange.minInclusive,\n max: partitionKeyRange.maxExclusive,\n isMinInclusive: true,\n isMaxInclusive: false,\n };\n });\n\n this.queryExecutionContext = new HybridQueryExecutionContext(\n this.clientContext,\n this.resourceLink,\n this.query,\n this.options,\n queryPlan,\n this.correlatedActivityId,\n queryRanges,\n );\n }\n\n private async createPipelinedExecutionContext(\n queryPlan: PartitionedQueryExecutionInfo,\n ): Promise<void> {\n const queryInfo = queryPlan.queryInfo;\n if (queryInfo.aggregates.length > 0 && queryInfo.hasSelectValue === false) {\n throw new Error(\"Aggregate queries must use the VALUE keyword\");\n }\n this.queryExecutionContext = new PipelinedQueryExecutionContext(\n this.clientContext,\n this.resourceLink,\n this.query,\n this.options,\n queryPlan,\n this.correlatedActivityId,\n );\n }\n\n private async fetchQueryPlan(diagnosticNode: DiagnosticNodeInternal): Promise<any> {\n if (!this.queryPlanPromise && this.resourceType === ResourceType.item) {\n return this.clientContext\n .getQueryPlan(\n getPathFromLink(this.resourceLink) + \"/docs\",\n ResourceType.item,\n this.resourceLink,\n this.query,\n this.options,\n diagnosticNode,\n this.correlatedActivityId,\n )\n .catch((error: any) => error); // Without this catch, node reports an unhandled rejection. So we stash the promise as resolved even if it errored.\n }\n return this.queryPlanPromise;\n }\n\n private needsQueryPlan(error: ErrorResponse): error is ErrorResponse {\n if (\n error.body?.additionalErrorInfo ||\n error.message.includes(\"Cross partition query only supports\")\n ) {\n return error.code === StatusCodes.BadRequest && this.resourceType === ResourceType.item;\n } else {\n throw error;\n }\n }\n\n private initPromise: Promise<void>;\n /**\n * @internal\n */\n public async init(diagnosticNode: DiagnosticNodeInternal): Promise<void> {\n if (this.isInitialized === true) {\n return;\n }\n if (this.initPromise === undefined) {\n this.initPromise = this._init(diagnosticNode);\n }\n return this.initPromise;\n }\n private async _init(diagnosticNode: DiagnosticNodeInternal): Promise<void> {\n if (this.options.forceQueryPlan === true && this.resourceType === ResourceType.item) {\n await this.createExecutionContext(diagnosticNode);\n }\n this.isInitialized = true;\n }\n\n private handleSplitError(err: any): void {\n if (err.code === 410) {\n const error = new Error(\n \"Encountered partition split and could not recover. This request is retryable\",\n ) as any;\n error.code = 503;\n error.originalError = err;\n throw error;\n } else {\n throw err;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"queryIterator.js","sourceRoot":"","sources":["../../src/queryIterator.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAIlC,uFAGiD;AACjD,gDAA+E;AAO/E,+DAK0C;AAQ1C,+DAAyD;AACzD,2DAIgC;AAChC,iEAA4D;AAC5D,gDAA8C;AAC9C,2GAAqG;AAGrG;;;;GAIG;AACH,MAAa,aAAa;IAYd;IACA;IACA;IACA;IACA;IACA;IAhBF,qBAAqB,CAAM,CAAC,OAAO;IACnC,sBAAsB,CAAgB;IACtC,qBAAqB,CAAmB;IACxC,gBAAgB,CAAmD;IACnE,aAAa,CAAU;IACvB,oBAAoB,CAAS;IAC7B,sBAAsB,CAAyB;IACvD;;OAEG;IACH,YACU,aAA4B,EAC5B,KAA4B,EAC5B,OAAoB,EACpB,cAA+D,EAC/D,YAAqB,EACrB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AG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IACO,KAAK,CAAC,KAAK,CAAC,cAAsC;QACxD,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,IAAI,IAAI,IAAI,CAAC,YAAY,KAAK,uBAAY,CAAC,IAAI,EAAE,CAAC;YACpF,MAAM,IAAI,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,CAAC;IAEO,gBAAgB,CAAC,GAAQ;QAC/B,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;YACrB,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,8EAA8E,CACxE,CAAC;YACT,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC;YACjB,KAAK,CAAC,aAAa,GAAG,GAAG,CAAC;YAC1B,MAAM,KAAK,CAAC;QACd,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AA9aD,sCA8aC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/// <reference lib=\"esnext.asynciterable\" />\nimport type { ClientContext } from \"./ClientContext.js\";\nimport {\n DiagnosticNodeInternal,\n DiagnosticNodeType,\n} from \"./diagnostics/DiagnosticNodeInternal.js\";\nimport { getPathFromLink, ResourceType, StatusCodes } from \"./common/index.js\";\nimport type {\n CosmosHeaders,\n ExecutionContext,\n FetchFunctionCallback,\n SqlQuerySpec,\n} from \"./queryExecutionContext/index.js\";\nimport {\n DefaultQueryExecutionContext,\n getInitialHeader,\n mergeHeaders,\n PipelinedQueryExecutionContext,\n} from \"./queryExecutionContext/index.js\";\nimport type { Response } from \"./request/index.js\";\nimport type {\n ErrorResponse,\n PartitionedQueryExecutionInfo,\n QueryRange,\n} from \"./request/ErrorResponse.js\";\nimport type { FeedOptions } from \"./request/FeedOptions.js\";\nimport { FeedResponse } from \"./request/FeedResponse.js\";\nimport {\n getEmptyCosmosDiagnostics,\n withDiagnostics,\n withMetadataDiagnostics,\n} from \"./utils/diagnostics.js\";\nimport { MetadataLookUpType } from \"./CosmosDiagnostics.js\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { HybridQueryExecutionContext } from \"./queryExecutionContext/hybridQueryExecutionContext.js\";\nimport type { PartitionKeyRangeCache } from \"./routing/index.js\";\n\n/**\n * Represents a QueryIterator Object, an implementation of feed or query response that enables\n * traversal and iterating over the response\n * in the Azure Cosmos DB database service.\n */\nexport class QueryIterator<T> {\n private fetchAllTempResources: T[]; // TODO\n private fetchAllLastResHeaders: CosmosHeaders;\n private queryExecutionContext: ExecutionContext;\n private queryPlanPromise: Promise<Response<PartitionedQueryExecutionInfo>>;\n private isInitialized: boolean;\n private correlatedActivityId: string;\n private partitionKeyRangeCache: PartitionKeyRangeCache;\n /**\n * @hidden\n */\n constructor(\n private clientContext: ClientContext,\n private query: SqlQuerySpec | string,\n private options: FeedOptions,\n private fetchFunctions: FetchFunctionCallback | FetchFunctionCallback[],\n private resourceLink?: string,\n private resourceType?: ResourceType,\n ) {\n this.query = query;\n this.fetchFunctions = fetchFunctions;\n this.options = options || {};\n this.resourceLink = resourceLink;\n this.fetchAllLastResHeaders = getInitialHeader();\n this.reset();\n this.isInitialized = false;\n this.partitionKeyRangeCache = this.clientContext.partitionKeyRangeCache;\n }\n\n /**\n * Gets an async iterator that will yield results until completion.\n *\n * NOTE: AsyncIterators are a very new feature and you might need to\n * use polyfils/etc. in order to use them in your code.\n *\n * If you're using TypeScript, you can use the following polyfill as long\n * as you target ES6 or higher and are running on Node 6 or higher.\n *\n * ```ts snippet:ignore\n * if (!Symbol || !Symbol.asyncIterator) {\n * (Symbol as any).asyncIterator = Symbol.for(\"Symbol.asyncIterator\");\n * }\n * ```\n *\n * @example Iterate over all databases\n * ```ts snippet:QueryIteratorIterateDatabases\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 * for await (const { resources: db } of client.databases.readAll().getAsyncIterator()) {\n * console.log(`Got ${db} from AsyncIterator`);\n * }\n * ```\n */\n public async *getAsyncIterator(): AsyncIterable<FeedResponse<T>> {\n const diagnosticNode = new DiagnosticNodeInternal(\n this.clientContext.diagnosticLevel,\n DiagnosticNodeType.CLIENT_REQUEST_NODE,\n null,\n );\n yield* this.getAsyncIteratorInternal(diagnosticNode);\n }\n /**\n * @internal\n */\n public async *getAsyncIteratorInternal(\n diagnosticNode: DiagnosticNodeInternal,\n ): AsyncIterable<FeedResponse<T>> {\n this.reset();\n this.queryPlanPromise = this.fetchQueryPlan(diagnosticNode);\n while (this.queryExecutionContext.hasMoreResults()) {\n let response: Response<any>;\n try {\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } catch (error: any) {\n if (this.needsQueryPlan(error)) {\n await this.createExecutionContext(diagnosticNode);\n try {\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } catch (queryError: any) {\n this.handleSplitError(queryError);\n }\n } else {\n throw error;\n }\n }\n\n const feedResponse = new FeedResponse<T>(\n response.result,\n response.headers,\n this.queryExecutionContext.hasMoreResults(),\n diagnosticNode.toDiagnostic(this.clientContext.getClientConfig()),\n );\n diagnosticNode = new DiagnosticNodeInternal(\n this.clientContext.diagnosticLevel,\n DiagnosticNodeType.CLIENT_REQUEST_NODE,\n null,\n );\n if (response.result !== undefined) {\n yield feedResponse;\n }\n }\n }\n\n /**\n * Determine if there are still remaining resources to process based on the value of the continuation token or the\n * elements remaining on the current batch in the QueryIterator.\n * @returns true if there is other elements to process in the QueryIterator.\n */\n public hasMoreResults(): boolean {\n return this.queryExecutionContext.hasMoreResults();\n }\n\n /**\n * Fetch all pages for the query and return a single FeedResponse.\n * @example\n * ```ts snippet:ReadmeSampleQueryDatabase\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 * const { resources } = await container.items\n * .query(\"SELECT * from c WHERE c.isCapitol = true\")\n * .fetchAll();\n * ```\n */\n\n public async fetchAll(): Promise<FeedResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n return this.fetchAllInternal(diagnosticNode);\n }, this.clientContext);\n }\n\n /**\n * @hidden\n */\n public async fetchAllInternal(diagnosticNode: DiagnosticNodeInternal): Promise<FeedResponse<T>> {\n this.reset();\n let response: FeedResponse<T>;\n try {\n response = await this.toArrayImplementation(diagnosticNode);\n } catch (error: any) {\n this.handleSplitError(error);\n }\n return response;\n }\n\n /**\n * Retrieve the next batch from the feed.\n *\n * This may or may not fetch more pages from the backend depending on your settings\n * and the type of query. Aggregate queries will generally fetch all backend pages\n * before returning the first batch of responses.\n *\n * @example\n * ```ts snippet:ReadmeSampleNonStreamableCrossPartitionQuery\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 * const querySpec = {\n * query: \"SELECT c.status, COUNT(c.id) AS count FROM c GROUP BY c.status\",\n * };\n * const queryOptions = {\n * maxItemCount: 10, // maximum number of items to return per page\n * enableCrossPartitionQuery: true,\n * };\n * const queryIterator = container.items.query(querySpec, queryOptions);\n * while (queryIterator.hasMoreResults()) {\n * const { resources: result } = await queryIterator.fetchNext();\n * // process results\n * }\n * ```\n */\n public async fetchNext(): Promise<FeedResponse<T>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n return this.fetchNextInternal(diagnosticNode);\n }, this.clientContext);\n }\n /**\n * @internal\n */\n public async fetchNextInternal(diagnosticNode: DiagnosticNodeInternal): Promise<FeedResponse<T>> {\n this.queryPlanPromise = withMetadataDiagnostics(\n async (metadataNode: DiagnosticNodeInternal) => {\n return this.fetchQueryPlan(metadataNode);\n },\n diagnosticNode,\n MetadataLookUpType.QueryPlanLookUp,\n );\n if (!this.isInitialized) {\n await this.init(diagnosticNode);\n }\n let response: Response<any>;\n try {\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } catch (error: any) {\n if (this.needsQueryPlan(error)) {\n await this.createExecutionContext(diagnosticNode);\n try {\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } catch (queryError: any) {\n this.handleSplitError(queryError);\n }\n } else {\n throw error;\n }\n }\n return new FeedResponse<T>(\n response.result,\n response.headers,\n this.queryExecutionContext.hasMoreResults(),\n getEmptyCosmosDiagnostics(),\n );\n }\n\n /**\n * Reset the QueryIterator to the beginning and clear all the resources inside it\n * @example\n * ```ts snippet:QueryIteratorReset\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 { database } = await client.databases.createIfNotExists({ id: \"Test Database\" });\n * const { container } = await database.containers.createIfNotExists({ id: \"Test Container\" });\n *\n * const querySpec = {\n * query: \"SELECT c.status, COUNT(c.id) AS count FROM c GROUP BY c.status\",\n * };\n * const queryIterator = container.items.query(querySpec);\n * while (queryIterator.hasMoreResults()) {\n * const { resources: result } = await queryIterator.fetchNext();\n * // process results\n * }\n * queryIterator.reset();\n * ```\n *\n */\n public reset(): void {\n this.correlatedActivityId = randomUUID();\n this.queryPlanPromise = undefined;\n this.fetchAllLastResHeaders = getInitialHeader();\n this.fetchAllTempResources = [];\n this.queryExecutionContext = new DefaultQueryExecutionContext(\n this.options,\n this.fetchFunctions,\n this.correlatedActivityId,\n );\n }\n\n private async toArrayImplementation(\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<FeedResponse<T>> {\n this.queryPlanPromise = withMetadataDiagnostics(\n async (metadataNode: DiagnosticNodeInternal) => {\n return this.fetchQueryPlan(metadataNode);\n },\n diagnosticNode,\n MetadataLookUpType.QueryPlanLookUp,\n );\n // this.queryPlanPromise = this.fetchQueryPlan(diagnosticNode);\n if (!this.isInitialized) {\n await this.init(diagnosticNode);\n }\n while (this.queryExecutionContext.hasMoreResults()) {\n let response: Response<any>;\n try {\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } catch (error: any) {\n if (this.needsQueryPlan(error)) {\n await this.createExecutionContext(diagnosticNode);\n response = await this.queryExecutionContext.fetchMore(diagnosticNode);\n } else {\n throw error;\n }\n }\n const { result, headers } = response;\n // concatenate the results and fetch more\n mergeHeaders(this.fetchAllLastResHeaders, headers);\n if (result) {\n this.fetchAllTempResources.push(...result);\n }\n }\n return new FeedResponse(\n this.fetchAllTempResources,\n this.fetchAllLastResHeaders,\n this.queryExecutionContext.hasMoreResults(),\n getEmptyCosmosDiagnostics(),\n );\n }\n\n private async createExecutionContext(diagnosticNode?: DiagnosticNodeInternal): Promise<void> {\n const queryPlanResponse = await this.queryPlanPromise;\n\n // We always coerce queryPlanPromise to resolved. So if it errored, we need to manually inspect the resolved value\n if (queryPlanResponse instanceof Error) {\n throw queryPlanResponse;\n }\n\n const queryPlan: PartitionedQueryExecutionInfo = queryPlanResponse.result;\n if (queryPlan.hybridSearchQueryInfo && queryPlan.hybridSearchQueryInfo !== null) {\n await this.createHybridQueryExecutionContext(queryPlan, diagnosticNode);\n } else {\n await this.createPipelinedExecutionContext(queryPlan);\n }\n }\n\n private async createHybridQueryExecutionContext(\n queryPlan: PartitionedQueryExecutionInfo,\n diagnosticNode?: DiagnosticNodeInternal,\n ): Promise<void> {\n const allPartitionKeyRanges = (\n await this.partitionKeyRangeCache.onCollectionRoutingMap(this.resourceLink, diagnosticNode)\n ).getOrderedParitionKeyRanges();\n\n // convert allPartitionKeyRanges to QueryRanges\n const queryRanges: QueryRange[] = allPartitionKeyRanges.map((partitionKeyRange) => {\n return {\n min: partitionKeyRange.minInclusive,\n max: partitionKeyRange.maxExclusive,\n isMinInclusive: true,\n isMaxInclusive: false,\n };\n });\n\n this.queryExecutionContext = new HybridQueryExecutionContext(\n this.clientContext,\n this.resourceLink,\n this.query,\n this.options,\n queryPlan,\n this.correlatedActivityId,\n queryRanges,\n );\n }\n\n private async createPipelinedExecutionContext(\n queryPlan: PartitionedQueryExecutionInfo,\n ): Promise<void> {\n const queryInfo = queryPlan.queryInfo;\n if (queryInfo.aggregates.length > 0 && queryInfo.hasSelectValue === false) {\n throw new Error(\"Aggregate queries must use the VALUE keyword\");\n }\n this.queryExecutionContext = new PipelinedQueryExecutionContext(\n this.clientContext,\n this.resourceLink,\n this.query,\n this.options,\n queryPlan,\n this.correlatedActivityId,\n );\n }\n\n private async fetchQueryPlan(diagnosticNode: DiagnosticNodeInternal): Promise<any> {\n if (!this.queryPlanPromise && this.resourceType === ResourceType.item) {\n return this.clientContext\n .getQueryPlan(\n getPathFromLink(this.resourceLink) + \"/docs\",\n ResourceType.item,\n this.resourceLink,\n this.query,\n this.options,\n diagnosticNode,\n this.correlatedActivityId,\n )\n .catch((error: any) => error); // Without this catch, node reports an unhandled rejection. So we stash the promise as resolved even if it errored.\n }\n return this.queryPlanPromise;\n }\n\n private needsQueryPlan(error: ErrorResponse): error is ErrorResponse {\n if (\n error.body?.additionalErrorInfo ||\n error.message.includes(\"Cross partition query only supports\")\n ) {\n return error.code === StatusCodes.BadRequest && this.resourceType === ResourceType.item;\n } else {\n throw error;\n }\n }\n\n private initPromise: Promise<void>;\n /**\n * @internal\n */\n public async init(diagnosticNode: DiagnosticNodeInternal): Promise<void> {\n if (this.isInitialized === true) {\n return;\n }\n if (this.initPromise === undefined) {\n this.initPromise = this._init(diagnosticNode);\n }\n return this.initPromise;\n }\n private async _init(diagnosticNode: DiagnosticNodeInternal): Promise<void> {\n if (this.options.forceQueryPlan === true && this.resourceType === ResourceType.item) {\n await this.createExecutionContext(diagnosticNode);\n }\n this.isInitialized = true;\n }\n\n private handleSplitError(err: any): void {\n if (err.code === 410) {\n const error = new Error(\n \"Encountered partition split and could not recover. This request is retryable\",\n ) as any;\n error.code = 503;\n error.originalError = err;\n throw error;\n } else {\n throw err;\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["../../../src/utils/offers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,wBAAgB,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["../../../src/utils/offers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,wBAAgB,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAW1D"}
|
|
@@ -6,7 +6,6 @@ exports.validateOffer = validateOffer;
|
|
|
6
6
|
function validateOffer(body) {
|
|
7
7
|
if (body.throughput) {
|
|
8
8
|
if (body.maxThroughput) {
|
|
9
|
-
console.log("should be erroring");
|
|
10
9
|
throw new Error("Cannot specify `throughput` with `maxThroughput`");
|
|
11
10
|
}
|
|
12
11
|
if (body.autoUpgradePolicy) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offers.js","sourceRoot":"","sources":["../../../src/utils/offers.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAIlC,
|
|
1
|
+
{"version":3,"file":"offers.js","sourceRoot":"","sources":["../../../src/utils/offers.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAIlC,sCAWC;AAXD,SAAgB,aAAa,CAAC,IAAsB;IAClD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QACD,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ContainerRequest } from \"../client/Container/ContainerRequest.js\";\n\nexport function validateOffer(body: ContainerRequest): void {\n if (body.throughput) {\n if (body.maxThroughput) {\n throw new Error(\"Cannot specify `throughput` with `maxThroughput`\");\n }\n if (body.autoUpgradePolicy) {\n throw new Error(\n \"Cannot specify autoUpgradePolicy with throughput. Use `maxThroughput` instead\",\n );\n }\n }\n}\n"]}
|
|
@@ -61,7 +61,7 @@ export interface CosmosClientOptions {
|
|
|
61
61
|
*/
|
|
62
62
|
clientEncryptionOptions?: ClientEncryptionOptions;
|
|
63
63
|
/** An optional parameter to set throughput bucket number. This value can be overridden at request level
|
|
64
|
-
* For more information, visit [Cosmos DB throughput Bucketing](https://aka.ms/
|
|
64
|
+
* For more information, visit [Cosmos DB throughput Bucketing](https://aka.ms/cosmosdb-bucketing).
|
|
65
65
|
*/
|
|
66
66
|
throughputBucket?: number;
|
|
67
67
|
/** An optional parameter that represents the connection string. Your database connection string can be found in the Azure Portal. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosClientOptions.js","sourceRoot":"","sources":["../../src/CosmosClientOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { TokenProvider } from \"./auth.js\";\nimport type { PermissionDefinition } from \"./client/index.js\";\nimport type { ConnectionPolicy, ConsistencyLevel } from \"./documents/index.js\";\nimport type { PluginConfig } from \"./plugins/Plugin.js\";\nimport type { CosmosHeaders } from \"./queryExecutionContext/CosmosHeaders.js\";\nimport type { CosmosDbDiagnosticLevel } from \"./diagnostics/CosmosDbDiagnosticLevel.js\";\nimport type { HttpClient } from \"@azure/core-rest-pipeline\";\nimport type { ClientEncryptionOptions } from \"./encryption/ClientEncryptionOptions.js\";\n\n// We expose our own Agent interface to avoid taking a dependency on and leaking node types. This interface should mirror the node Agent interface\nexport interface Agent {\n maxFreeSockets: number;\n maxSockets: number;\n sockets: any;\n requests: any;\n destroy(): void;\n}\n\nexport interface CosmosClientOptions {\n /** The service endpoint to use to create the client. */\n endpoint?: string;\n /** The account master or readonly key */\n key?: string;\n /** An object that contains resources tokens.\n * Keys for the object are resource Ids and values are the resource tokens.\n */\n resourceTokens?: { [resourcePath: string]: string };\n /** A user supplied function for resolving header authorization tokens.\n * Allows users to generating their own auth tokens, potentially using a separate service\n */\n tokenProvider?: TokenProvider;\n /** AAD token from `@azure/identity`\n * Obtain a credential object by creating an `@azure/identity` credential object\n * We will then use your credential object and a scope URL (your cosmos db endpoint)\n * to authenticate requests to Cosmos\n */\n aadCredentials?: TokenCredential;\n /**\n * @internal\n * Optional custom AAD scope to override the default account-based scope for authentication.\n * If not provided, the default scope will be constructed from the endpoint URL.\n * When provided, no fallback mechanism will be applied if authentication fails.\n */\n aadScope?: string;\n /** An array of {@link Permission} objects. */\n permissionFeed?: PermissionDefinition[];\n /** An instance of {@link ConnectionPolicy} class.\n * This parameter is optional and the default connectionPolicy will be used if omitted.\n */\n connectionPolicy?: ConnectionPolicy;\n /** An optional parameter that represents the consistency level.\n * It can take any value from {@link ConsistencyLevel}.\n */\n consistencyLevel?: keyof typeof ConsistencyLevel;\n defaultHeaders?: CosmosHeaders;\n /** An optional custom http(s) Agent to be used in NodeJS environments\n * Use an agent such as https://github.com/TooTallNate/node-proxy-agent if you need to connect to Cosmos via a proxy\n */\n agent?: Agent;\n /** An optional custom `HttpClient` shape to customize how requests are made by the HTTP pipeline.\n * See `@azure/core-rest-pipeline` for details on how to implement this interface. */\n httpClient?: HttpClient;\n /** A custom string to append to the default SDK user agent. */\n userAgentSuffix?: string;\n diagnosticLevel?: CosmosDbDiagnosticLevel;\n /** encryption policy for operations involving encryption\n * must be set on the client if using client-side encryption\n * @see {@link ClientEncryptionOptions}\n */\n clientEncryptionOptions?: ClientEncryptionOptions;\n /** @internal */\n plugins?: PluginConfig[];\n\n /** An optional parameter to set throughput bucket number. This value can be overridden at request level\n * For more information, visit [Cosmos DB throughput Bucketing](https://aka.ms/
|
|
1
|
+
{"version":3,"file":"CosmosClientOptions.js","sourceRoot":"","sources":["../../src/CosmosClientOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { TokenProvider } from \"./auth.js\";\nimport type { PermissionDefinition } from \"./client/index.js\";\nimport type { ConnectionPolicy, ConsistencyLevel } from \"./documents/index.js\";\nimport type { PluginConfig } from \"./plugins/Plugin.js\";\nimport type { CosmosHeaders } from \"./queryExecutionContext/CosmosHeaders.js\";\nimport type { CosmosDbDiagnosticLevel } from \"./diagnostics/CosmosDbDiagnosticLevel.js\";\nimport type { HttpClient } from \"@azure/core-rest-pipeline\";\nimport type { ClientEncryptionOptions } from \"./encryption/ClientEncryptionOptions.js\";\n\n// We expose our own Agent interface to avoid taking a dependency on and leaking node types. This interface should mirror the node Agent interface\nexport interface Agent {\n maxFreeSockets: number;\n maxSockets: number;\n sockets: any;\n requests: any;\n destroy(): void;\n}\n\nexport interface CosmosClientOptions {\n /** The service endpoint to use to create the client. */\n endpoint?: string;\n /** The account master or readonly key */\n key?: string;\n /** An object that contains resources tokens.\n * Keys for the object are resource Ids and values are the resource tokens.\n */\n resourceTokens?: { [resourcePath: string]: string };\n /** A user supplied function for resolving header authorization tokens.\n * Allows users to generating their own auth tokens, potentially using a separate service\n */\n tokenProvider?: TokenProvider;\n /** AAD token from `@azure/identity`\n * Obtain a credential object by creating an `@azure/identity` credential object\n * We will then use your credential object and a scope URL (your cosmos db endpoint)\n * to authenticate requests to Cosmos\n */\n aadCredentials?: TokenCredential;\n /**\n * @internal\n * Optional custom AAD scope to override the default account-based scope for authentication.\n * If not provided, the default scope will be constructed from the endpoint URL.\n * When provided, no fallback mechanism will be applied if authentication fails.\n */\n aadScope?: string;\n /** An array of {@link Permission} objects. */\n permissionFeed?: PermissionDefinition[];\n /** An instance of {@link ConnectionPolicy} class.\n * This parameter is optional and the default connectionPolicy will be used if omitted.\n */\n connectionPolicy?: ConnectionPolicy;\n /** An optional parameter that represents the consistency level.\n * It can take any value from {@link ConsistencyLevel}.\n */\n consistencyLevel?: keyof typeof ConsistencyLevel;\n defaultHeaders?: CosmosHeaders;\n /** An optional custom http(s) Agent to be used in NodeJS environments\n * Use an agent such as https://github.com/TooTallNate/node-proxy-agent if you need to connect to Cosmos via a proxy\n */\n agent?: Agent;\n /** An optional custom `HttpClient` shape to customize how requests are made by the HTTP pipeline.\n * See `@azure/core-rest-pipeline` for details on how to implement this interface. */\n httpClient?: HttpClient;\n /** A custom string to append to the default SDK user agent. */\n userAgentSuffix?: string;\n diagnosticLevel?: CosmosDbDiagnosticLevel;\n /** encryption policy for operations involving encryption\n * must be set on the client if using client-side encryption\n * @see {@link ClientEncryptionOptions}\n */\n clientEncryptionOptions?: ClientEncryptionOptions;\n /** @internal */\n plugins?: PluginConfig[];\n\n /** An optional parameter to set throughput bucket number. This value can be overridden at request level\n * For more information, visit [Cosmos DB throughput Bucketing](https://aka.ms/cosmosdb-bucketing).\n */\n throughputBucket?: number;\n\n /** An optional parameter that represents the connection string. Your database connection string can be found in the Azure Portal. */\n connectionString?: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeFeedForEpkRange.d.ts","sourceRoot":"","sources":["../../../../src/client/ChangeFeed/ChangeFeedForEpkRange.ts"],"names":[],"mappings":"AAGA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;IACU,QAAQ,IAAI,OAAO,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;IA+CjF,OAAO,CAAC,yBAAyB,CAE/B;IAEF;;OAEG;YACW,SAAS;IA+BvB,OAAO,CAAC,oBAAoB;IAa5B;;;;OAIG;YACW,oBAAoB;YAgDpB,kBAAkB;IA2ChC;;;;OAIG;YACW,mBAAmB;YA4BnB,eAAe;IA0D7B,OAAO,CAAC,mBAAmB;CAU5B"}
|
|
@@ -7,9 +7,8 @@ import { FeedRangeQueue } from "./FeedRangeQueue.js";
|
|
|
7
7
|
import { Constants, SubStatusCodes, StatusCodes, ResourceType } from "../../common/index.js";
|
|
8
8
|
import { ErrorResponse } from "../../request/index.js";
|
|
9
9
|
import { CompositeContinuationToken } from "./CompositeContinuationToken.js";
|
|
10
|
-
import { decryptChangeFeedResponse, extractOverlappingRanges } from "./changeFeedUtils.js";
|
|
10
|
+
import { buildFeedOptions, decryptChangeFeedResponse, extractOverlappingRanges, } from "./changeFeedUtils.js";
|
|
11
11
|
import { getEmptyCosmosDiagnostics, withDiagnostics } from "../../utils/diagnostics.js";
|
|
12
|
-
import { ChangeFeedMode } from "./ChangeFeedMode.js";
|
|
13
12
|
/**
|
|
14
13
|
* @hidden
|
|
15
14
|
* Provides iterator for change feed for entire container or an epk range.
|
|
@@ -295,38 +294,7 @@ export class ChangeFeedForEpkRange {
|
|
|
295
294
|
return firstResolvedRange.id;
|
|
296
295
|
}
|
|
297
296
|
async getFeedResponse(feedRange, diagnosticNode) {
|
|
298
|
-
const feedOptions =
|
|
299
|
-
initialHeaders: {},
|
|
300
|
-
useLatestVersionFeed: true,
|
|
301
|
-
useAllVersionsAndDeletesFeed: false,
|
|
302
|
-
};
|
|
303
|
-
if (typeof this.changeFeedOptions.maxItemCount === "number") {
|
|
304
|
-
feedOptions.maxItemCount = this.changeFeedOptions.maxItemCount;
|
|
305
|
-
}
|
|
306
|
-
if (this.changeFeedOptions.sessionToken) {
|
|
307
|
-
feedOptions.sessionToken = this.changeFeedOptions.sessionToken;
|
|
308
|
-
}
|
|
309
|
-
if (this.changeFeedOptions.excludedLocations) {
|
|
310
|
-
feedOptions.excludedLocations = this.changeFeedOptions.excludedLocations;
|
|
311
|
-
}
|
|
312
|
-
if (feedRange.continuationToken) {
|
|
313
|
-
feedOptions.accessCondition = {
|
|
314
|
-
type: Constants.HttpHeaders.IfNoneMatch,
|
|
315
|
-
condition: feedRange.continuationToken,
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
else if (this.startFromNow) {
|
|
319
|
-
feedOptions.initialHeaders[Constants.HttpHeaders.IfNoneMatch] =
|
|
320
|
-
Constants.ChangeFeedIfNoneMatchStartFromNowHeader;
|
|
321
|
-
}
|
|
322
|
-
if (this.startTime) {
|
|
323
|
-
feedOptions.initialHeaders[Constants.HttpHeaders.IfModifiedSince] = this.startTime;
|
|
324
|
-
}
|
|
325
|
-
if (this.changeFeedOptions.changeFeedMode &&
|
|
326
|
-
this.changeFeedOptions.changeFeedMode === ChangeFeedMode.AllVersionsAndDeletes) {
|
|
327
|
-
feedOptions.useAllVersionsAndDeletesFeed = true;
|
|
328
|
-
feedOptions.useLatestVersionFeed = false;
|
|
329
|
-
}
|
|
297
|
+
const feedOptions = buildFeedOptions(this.changeFeedOptions, feedRange.continuationToken, this.startFromNow, this.startTime);
|
|
330
298
|
const rangeId = await this.getPartitionRangeId(feedRange, diagnosticNode);
|
|
331
299
|
if (this.clientContext.enableEncryption) {
|
|
332
300
|
await this.container.checkAndInitializeEncryption();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeFeedForEpkRange.js","sourceRoot":"","sources":["../../../../src/client/ChangeFeed/ChangeFeedForEpkRange.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAi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E,EAC3B,GAAG,CAAC,SAAS,CACd,CAAC;YACJ,CAAC;YACD,wDAAwD;YACxD,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACrD,aAAa,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;YAC9B,aAAa,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;YACpC,MAAM,aAAa,CAAC;QACtB,CAAC;IACH,CAAC;IACO,mBAAmB;QACzB,wFAAwF;QACxF,mGAAmG;QACnG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACpC,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,SAAS,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,aAAa,CAAC,sBAAsB,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ChangeFeedRange } from \"./ChangeFeedRange.js\";\nimport { ChangeFeedIteratorResponse } from \"./ChangeFeedIteratorResponse.js\";\nimport type { PartitionKeyRangeCache } from \"../../routing/index.js\";\nimport { QueryRange } from \"../../routing/index.js\";\nimport { FeedRangeQueue } from \"./FeedRangeQueue.js\";\nimport type { ClientContext } from \"../../ClientContext.js\";\nimport type { Container, Resource } from \"../../client/index.js\";\nimport { Constants, SubStatusCodes, StatusCodes, ResourceType } from \"../../common/index.js\";\nimport type { Response, FeedOptions } from \"../../request/index.js\";\nimport { ErrorResponse } from \"../../request/index.js\";\nimport { CompositeContinuationToken } from \"./CompositeContinuationToken.js\";\nimport type { ChangeFeedPullModelIterator } from \"./ChangeFeedPullModelIterator.js\";\nimport { decryptChangeFeedResponse, extractOverlappingRanges } from \"./changeFeedUtils.js\";\nimport type { InternalChangeFeedIteratorOptions } from \"./InternalChangeFeedOptions.js\";\nimport type { DiagnosticNodeInternal } from \"../../diagnostics/DiagnosticNodeInternal.js\";\nimport { getEmptyCosmosDiagnostics, withDiagnostics } from \"../../utils/diagnostics.js\";\nimport { ChangeFeedMode } from \"./ChangeFeedMode.js\";\n/**\n * @hidden\n * Provides iterator for change feed for entire container or an epk range.\n *\n * Use `Items.getChangeFeedIterator()` to get an instance of the iterator.\n */\nexport class ChangeFeedForEpkRange<T> implements ChangeFeedPullModelIterator<T> {\n private continuationToken?: CompositeContinuationToken;\n private queue: FeedRangeQueue<ChangeFeedRange>;\n private startTime: string;\n private isInstantiated: boolean;\n private rId: string;\n private startFromNow: boolean;\n /**\n * @internal\n */\n constructor(\n private clientContext: ClientContext,\n private container: Container,\n private partitionKeyRangeCache: PartitionKeyRangeCache,\n private resourceId: string,\n private resourceLink: string,\n private url: string,\n private changeFeedOptions: InternalChangeFeedIteratorOptions,\n private epkRange: QueryRange,\n ) {\n this.queue = new FeedRangeQueue<ChangeFeedRange>();\n this.continuationToken = changeFeedOptions.continuationToken\n ? JSON.parse(changeFeedOptions.continuationToken)\n : undefined;\n this.isInstantiated = false;\n // startTime is used to store and specify time from which change feed should start reading new changes. StartFromNow flag is used to indicate fetching changes from now.\n if (changeFeedOptions.startFromNow) {\n this.startFromNow = true;\n } else if (changeFeedOptions.startTime) {\n this.startTime = changeFeedOptions.startTime.toUTCString();\n }\n }\n\n private async setIteratorRid(diagnosticNode: DiagnosticNodeInternal): Promise<void> {\n const { resource } = await this.container.readInternal(diagnosticNode);\n this.rId = resource._rid;\n }\n\n private continuationTokenRidMatchContainerRid(): boolean {\n if (this.continuationToken.rid !== this.rId) {\n return false;\n }\n return true;\n }\n\n private async fillChangeFeedQueue(diagnosticNode: DiagnosticNodeInternal): Promise<void> {\n if (this.continuationToken) {\n // fill the queue with feed ranges in continuation token.\n await this.fetchContinuationTokenFeedRanges(diagnosticNode);\n } else {\n // fill the queue with feed ranges overlapping the given epk range.\n await this.fetchOverLappingFeedRanges(diagnosticNode);\n }\n this.isInstantiated = true;\n }\n\n /**\n * Fill the queue with the feed ranges overlapping with the given epk range.\n */\n private async fetchOverLappingFeedRanges(diagnosticNode: DiagnosticNodeInternal): Promise<void> {\n try {\n const overLappingRanges = await this.partitionKeyRangeCache.getOverlappingRanges(\n this.url,\n this.epkRange,\n diagnosticNode,\n );\n for (const overLappingRange of overLappingRanges) {\n const [epkMinHeader, epkMaxHeader] = await extractOverlappingRanges(\n this.epkRange,\n overLappingRange,\n );\n const feedRange: ChangeFeedRange = new ChangeFeedRange(\n overLappingRange.minInclusive,\n overLappingRange.maxExclusive,\n \"\",\n epkMinHeader,\n epkMaxHeader,\n );\n this.queue.enqueue(feedRange);\n }\n } catch (err) {\n throw new ErrorResponse(err.message);\n }\n }\n /**\n * Fill the queue with feed ranges from continuation token\n */\n private async fetchContinuationTokenFeedRanges(\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<void> {\n const contToken = this.continuationToken;\n if (!this.continuationTokenRidMatchContainerRid()) {\n throw new ErrorResponse(\"The continuation token is not for the current container definition\");\n } else {\n for (const cToken of contToken.Continuation) {\n const queryRange = new QueryRange(cToken.minInclusive, cToken.maxExclusive, true, false);\n try {\n const overLappingRanges = await this.partitionKeyRangeCache.getOverlappingRanges(\n this.url,\n queryRange,\n diagnosticNode,\n );\n for (const overLappingRange of overLappingRanges) {\n // check if the epk range present in continuation token entirely covers the overlapping range.\n // If yes, minInclusive and maxExclusive of the overlapping range will be set.\n // If no, i.e. there is only partial overlap, epkMinHeader and epkMaxHeader are set as min and max of overlap.\n // This will be used when we make a call to fetch change feed.\n const [epkMinHeader, epkMaxHeader] = await extractOverlappingRanges(\n queryRange,\n overLappingRange,\n );\n const feedRange: ChangeFeedRange = new ChangeFeedRange(\n overLappingRange.minInclusive,\n overLappingRange.maxExclusive,\n cToken.continuationToken,\n epkMinHeader,\n epkMaxHeader,\n );\n this.queue.enqueue(feedRange);\n }\n } catch (err) {\n throw new ErrorResponse(err.message);\n }\n }\n }\n }\n\n /**\n * Change feed is an infinite feed. hasMoreResults is always true.\n */\n get hasMoreResults(): boolean {\n return true;\n }\n\n /**\n * Gets an async iterator which will yield change feed results.\n */\n public async *getAsyncIterator(): AsyncIterable<ChangeFeedIteratorResponse<Array<T & Resource>>> {\n do {\n const result = await this.readNext();\n yield result;\n } while (this.hasMoreResults);\n }\n\n /**\n * Gets an async iterator which will yield pages of results from Azure Cosmos DB.\n *\n * Keeps iterating over the feedranges and checks if any feed range has new result. Keeps note of the last feed range which returned non 304 result.\n *\n * When same feed range is reached and no new changes are found, a 304 (not Modified) is returned to the end user. Then starts process all over again.\n */\n public async readNext(): Promise<ChangeFeedIteratorResponse<Array<T & Resource>>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n // validate if the internal queue is filled up with feed ranges.\n if (!this.isInstantiated) {\n await this.setIteratorRid(diagnosticNode);\n await this.fillChangeFeedQueue(diagnosticNode);\n }\n\n // stores the last feedRange for which statusCode is not 304 i.e. there were new changes in that feed range.\n let firstNotModifiedFeedRange: ChangeFeedRange = undefined;\n let result: ChangeFeedIteratorResponse<Array<T & Resource>>;\n do {\n const [processedFeedRange, response] = await this.fetchNext(diagnosticNode);\n result = response;\n\n if (result !== undefined) {\n {\n if (firstNotModifiedFeedRange === undefined) {\n firstNotModifiedFeedRange = processedFeedRange;\n }\n // move current feed range to end of queue to fetch result of next feed range.\n // This is done to fetch changes in breadth first manner and avoid starvation.\n this.queue.moveFirstElementToTheEnd();\n // check if there are new results for the given feed range.\n if (result.statusCode === StatusCodes.Ok) {\n result.headers[Constants.HttpHeaders.ContinuationToken] =\n this.generateContinuationToken();\n\n if (this.clientContext.enableEncryption) {\n await decryptChangeFeedResponse(\n result,\n diagnosticNode,\n this.changeFeedOptions.changeFeedMode,\n this.container.encryptionProcessor,\n );\n }\n return result;\n }\n }\n }\n } while (!this.checkedAllFeedRanges(firstNotModifiedFeedRange));\n // set the continuation token after processing.\n result.headers[Constants.HttpHeaders.ContinuationToken] = this.generateContinuationToken();\n return result;\n }, this.clientContext);\n }\n\n private generateContinuationToken = (): string => {\n return JSON.stringify(new CompositeContinuationToken(this.rId, this.queue.returnSnapshot()));\n };\n\n /**\n * Read feed and retrieves the next page of results in Azure Cosmos DB.\n */\n private async fetchNext(\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<[ChangeFeedRange | undefined, ChangeFeedIteratorResponse<Array<T & Resource>>]> {\n const feedRange = this.queue.peek();\n if (feedRange) {\n // fetch results for feed range at the beginning of the queue.\n const result = await this.getFeedResponse(feedRange, diagnosticNode);\n\n // check if results need to be fetched again depending on status code returned.\n // Eg. in case of paritionSplit, results need to be fetched for the child partitions.\n const shouldRetry: boolean = await this.shouldRetryOnFailure(\n feedRange,\n result,\n diagnosticNode,\n );\n\n if (shouldRetry) {\n this.queue.dequeue();\n return this.fetchNext(diagnosticNode);\n } else {\n // update the continuation value for the current feed range.\n const continuationValueForFeedRange = result.headers[Constants.HttpHeaders.ETag];\n const newFeedRange = this.queue.peek();\n newFeedRange.continuationToken = continuationValueForFeedRange;\n return [newFeedRange, result];\n }\n } else {\n return [undefined, undefined];\n }\n }\n\n private checkedAllFeedRanges(firstNotModifiedFeedRange: ChangeFeedRange | undefined): boolean {\n if (firstNotModifiedFeedRange === undefined) {\n return false;\n }\n const feedRangeQueueFirstElement = this.queue.peek();\n return (\n firstNotModifiedFeedRange.minInclusive === feedRangeQueueFirstElement?.minInclusive &&\n firstNotModifiedFeedRange.maxExclusive === feedRangeQueueFirstElement?.maxExclusive &&\n firstNotModifiedFeedRange.epkMinHeader === feedRangeQueueFirstElement?.epkMinHeader &&\n firstNotModifiedFeedRange.epkMaxHeader === feedRangeQueueFirstElement?.epkMaxHeader\n );\n }\n\n /**\n * Checks whether the current EpkRange is split into multiple ranges or not.\n *\n * If yes, it force refreshes the partitionKeyRange cache and enqueue children epk ranges.\n */\n private async shouldRetryOnFailure(\n feedRange: ChangeFeedRange,\n response: ChangeFeedIteratorResponse<Array<T & Resource>>,\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<boolean> {\n if (response.statusCode === StatusCodes.Ok || response.statusCode === StatusCodes.NotModified) {\n return false;\n }\n\n const partitionSplit =\n response.statusCode === StatusCodes.Gone &&\n (response.subStatusCode === SubStatusCodes.PartitionKeyRangeGone ||\n response.subStatusCode === SubStatusCodes.CompletingSplit);\n\n if (partitionSplit) {\n const queryRange = new QueryRange(\n feedRange.epkMinHeader ? feedRange.epkMinHeader : feedRange.minInclusive,\n feedRange.epkMaxHeader ? feedRange.epkMaxHeader : feedRange.maxExclusive,\n true,\n false,\n );\n const resolvedRanges = await this.partitionKeyRangeCache.getOverlappingRanges(\n this.url,\n queryRange,\n diagnosticNode,\n true,\n );\n if (resolvedRanges.length < 1) {\n throw new ErrorResponse(\"Partition split/merge detected but no overlapping ranges found.\");\n }\n // This covers both cases of merge and split.\n // resolvedRanges.length > 1 in case of split.\n // resolvedRanges.length === 1 in case of merge. EpkRange headers will be added in this case.\n if (resolvedRanges.length >= 1) {\n await this.handleSplitOrMerge(\n false,\n resolvedRanges,\n queryRange,\n feedRange.continuationToken,\n );\n }\n return true;\n }\n return false;\n }\n /*\n * Enqueues all the children feed ranges for the given feed range.\n */\n private async handleSplitOrMerge(\n shiftLeft: boolean,\n resolvedRanges: any,\n oldFeedRange: QueryRange,\n continuationToken: string,\n ): Promise<void> {\n let flag = 0;\n if (shiftLeft) {\n // This section is only applicable when handleSplitOrMerge is called by getPartitionRangeId().\n // used only when existing partition key range cache is used to check for any overlapping ranges.\n // Modifies the first element with the first overlapping range.\n const [epkMinHeader, epkMaxHeader] = await extractOverlappingRanges(\n oldFeedRange,\n resolvedRanges[0],\n );\n const newFeedRange = new ChangeFeedRange(\n resolvedRanges[0].minInclusive,\n resolvedRanges[0].maxExclusive,\n continuationToken,\n epkMinHeader,\n epkMaxHeader,\n );\n\n this.queue.modifyFirstElement(newFeedRange);\n flag = 1;\n }\n // Enqueue the overlapping ranges.\n for (let i = flag; i < resolvedRanges.length; i++) {\n const [epkMinHeader, epkMaxHeader] = await extractOverlappingRanges(\n oldFeedRange,\n resolvedRanges[i],\n );\n const newFeedRange = new ChangeFeedRange(\n resolvedRanges[i].minInclusive,\n resolvedRanges[i].maxExclusive,\n continuationToken,\n epkMinHeader,\n epkMaxHeader,\n );\n this.queue.enqueue(newFeedRange);\n }\n }\n\n /**\n * Fetch the partitionKeyRangeId for the given feed range.\n *\n * This partitionKeyRangeId is passed to queryFeed to fetch the results.\n */\n private async getPartitionRangeId(\n feedRange: ChangeFeedRange,\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<string> {\n const min = feedRange.epkMinHeader ? feedRange.epkMinHeader : feedRange.minInclusive;\n const max = feedRange.epkMaxHeader ? feedRange.epkMaxHeader : feedRange.maxExclusive;\n const queryRange = new QueryRange(min, max, true, false);\n const resolvedRanges = await this.partitionKeyRangeCache.getOverlappingRanges(\n this.url,\n queryRange,\n diagnosticNode,\n false,\n );\n if (resolvedRanges.length < 1) {\n throw new ErrorResponse(\"No overlapping ranges found.\");\n }\n const firstResolvedRange = resolvedRanges[0];\n const isPartitionRangeChanged =\n feedRange.minInclusive !== firstResolvedRange.minInclusive ||\n feedRange.maxExclusive !== firstResolvedRange.maxExclusive ||\n resolvedRanges.length > 1;\n // If the partition range is changed, we need to handle split/merge\n if (isPartitionRangeChanged) {\n await this.handleSplitOrMerge(true, resolvedRanges, queryRange, feedRange.continuationToken);\n }\n return firstResolvedRange.id;\n }\n\n private async getFeedResponse(\n feedRange: ChangeFeedRange,\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<ChangeFeedIteratorResponse<Array<T & Resource>>> {\n const feedOptions: FeedOptions = {\n initialHeaders: {},\n useLatestVersionFeed: true,\n useAllVersionsAndDeletesFeed: false,\n };\n\n if (typeof this.changeFeedOptions.maxItemCount === \"number\") {\n feedOptions.maxItemCount = this.changeFeedOptions.maxItemCount;\n }\n\n if (this.changeFeedOptions.sessionToken) {\n feedOptions.sessionToken = this.changeFeedOptions.sessionToken;\n }\n\n if (this.changeFeedOptions.excludedLocations) {\n feedOptions.excludedLocations = this.changeFeedOptions.excludedLocations;\n }\n\n if (feedRange.continuationToken) {\n feedOptions.accessCondition = {\n type: Constants.HttpHeaders.IfNoneMatch,\n condition: feedRange.continuationToken,\n };\n } else if (this.startFromNow) {\n feedOptions.initialHeaders[Constants.HttpHeaders.IfNoneMatch] =\n Constants.ChangeFeedIfNoneMatchStartFromNowHeader;\n }\n\n if (this.startTime) {\n feedOptions.initialHeaders[Constants.HttpHeaders.IfModifiedSince] = this.startTime;\n }\n\n if (\n this.changeFeedOptions.changeFeedMode &&\n this.changeFeedOptions.changeFeedMode === ChangeFeedMode.AllVersionsAndDeletes\n ) {\n feedOptions.useAllVersionsAndDeletesFeed = true;\n feedOptions.useLatestVersionFeed = false;\n }\n\n const rangeId = await this.getPartitionRangeId(feedRange, diagnosticNode);\n if (this.clientContext.enableEncryption) {\n await this.container.checkAndInitializeEncryption();\n feedOptions.containerRid = this.container._rid;\n }\n try {\n // startEpk and endEpk are only valid in case we want to fetch result for a part of partition and not the entire partition.\n const finalFeedRange = this.fetchFinalFeedRange();\n const response: Response<Array<T & Resource>> = await (this.clientContext.queryFeed<T>({\n path: this.resourceLink,\n resourceType: ResourceType.item,\n resourceId: this.resourceId,\n resultFn: (result) => (result ? result.Documents : []),\n query: undefined,\n options: feedOptions,\n diagnosticNode,\n partitionKey: undefined,\n partitionKeyRangeId: rangeId,\n startEpk: finalFeedRange.epkMinHeader,\n endEpk: finalFeedRange.epkMaxHeader,\n }) as Promise<any>);\n\n return new ChangeFeedIteratorResponse(\n response.result,\n response.result ? response.result.length : 0,\n response.code,\n response.headers,\n getEmptyCosmosDiagnostics(),\n );\n } catch (err) {\n // If partition split/merge is encountered, handle it gracefully and continue fetching results.\n if (err.code === StatusCodes.Gone) {\n return new ChangeFeedIteratorResponse(\n [],\n 0,\n err.code,\n err.headers,\n getEmptyCosmosDiagnostics(),\n err.substatus,\n );\n }\n // If any other errors are encountered, throw the error.\n const errorResponse = new ErrorResponse(err.message);\n errorResponse.code = err.code;\n errorResponse.headers = err.headers;\n throw errorResponse;\n }\n }\n private fetchFinalFeedRange(): ChangeFeedRange {\n // this is used to fetch the final feed range before making a call to fetch the results.\n // In case of merge, the final updated feed range is present in the queue and needs to be returned.\n const feedRange = this.queue.peek();\n if (feedRange) {\n return feedRange;\n } else {\n throw new ErrorResponse(\"No feed range found.\");\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ChangeFeedForEpkRange.js","sourceRoot":"","sources":["../../../../src/client/ChangeFeed/ChangeFeedForEpkRange.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE7F,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACxF;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IAWtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAjBF,iBAAiB,CAA8B;IAC/C,KAAK,CAAkC;IACvC,SAAS,CAAS;IAClB,cAAc,CAAU;IACxB,GAAG,CAAS;IACZ,YAAY,CAAU;IAC9B;;OAEG;IACH,YACU,aAA4B,EAC5B,SAAoB,EACpB,sBAA8C,EAC9C,UAAkB,EAClB,YAAoB,EACpB,GAAW,EACX,iBAAoD,EACpD,QAAoB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Y;gBACrC,MAAM,EAAE,cAAc,CAAC,YAAY;aACpC,CAAkB,CAAC;YAEpB,OAAO,IAAI,0BAA0B,CACnC,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAC5C,QAAQ,CAAC,IAAI,EACb,QAAQ,CAAC,OAAO,EAChB,yBAAyB,EAAE,CAC5B,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,+FAA+F;YAC/F,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,EAAE,CAAC;gBAClC,OAAO,IAAI,0BAA0B,CACnC,EAAE,EACF,CAAC,EACD,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,OAAO,EACX,yBAAyB,EAAE,EAC3B,GAAG,CAAC,SAAS,CACd,CAAC;YACJ,CAAC;YACD,wDAAwD;YACxD,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACrD,aAAa,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;YAC9B,aAAa,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;YACpC,MAAM,aAAa,CAAC;QACtB,CAAC;IACH,CAAC;IACO,mBAAmB;QACzB,wFAAwF;QACxF,mGAAmG;QACnG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACpC,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,SAAS,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,aAAa,CAAC,sBAAsB,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ChangeFeedRange } from \"./ChangeFeedRange.js\";\nimport { ChangeFeedIteratorResponse } from \"./ChangeFeedIteratorResponse.js\";\nimport type { PartitionKeyRangeCache } from \"../../routing/index.js\";\nimport { QueryRange } from \"../../routing/index.js\";\nimport { FeedRangeQueue } from \"./FeedRangeQueue.js\";\nimport type { ClientContext } from \"../../ClientContext.js\";\nimport type { Container, Resource } from \"../../client/index.js\";\nimport { Constants, SubStatusCodes, StatusCodes, ResourceType } from \"../../common/index.js\";\nimport type { Response, FeedOptions } from \"../../request/index.js\";\nimport { ErrorResponse } from \"../../request/index.js\";\nimport { CompositeContinuationToken } from \"./CompositeContinuationToken.js\";\nimport type { ChangeFeedPullModelIterator } from \"./ChangeFeedPullModelIterator.js\";\nimport {\n buildFeedOptions,\n decryptChangeFeedResponse,\n extractOverlappingRanges,\n} from \"./changeFeedUtils.js\";\nimport type { InternalChangeFeedIteratorOptions } from \"./InternalChangeFeedOptions.js\";\nimport type { DiagnosticNodeInternal } from \"../../diagnostics/DiagnosticNodeInternal.js\";\nimport { getEmptyCosmosDiagnostics, withDiagnostics } from \"../../utils/diagnostics.js\";\n/**\n * @hidden\n * Provides iterator for change feed for entire container or an epk range.\n *\n * Use `Items.getChangeFeedIterator()` to get an instance of the iterator.\n */\nexport class ChangeFeedForEpkRange<T> implements ChangeFeedPullModelIterator<T> {\n private continuationToken?: CompositeContinuationToken;\n private queue: FeedRangeQueue<ChangeFeedRange>;\n private startTime: string;\n private isInstantiated: boolean;\n private rId: string;\n private startFromNow: boolean;\n /**\n * @internal\n */\n constructor(\n private clientContext: ClientContext,\n private container: Container,\n private partitionKeyRangeCache: PartitionKeyRangeCache,\n private resourceId: string,\n private resourceLink: string,\n private url: string,\n private changeFeedOptions: InternalChangeFeedIteratorOptions,\n private epkRange: QueryRange,\n ) {\n this.queue = new FeedRangeQueue<ChangeFeedRange>();\n this.continuationToken = changeFeedOptions.continuationToken\n ? JSON.parse(changeFeedOptions.continuationToken)\n : undefined;\n this.isInstantiated = false;\n // startTime is used to store and specify time from which change feed should start reading new changes. StartFromNow flag is used to indicate fetching changes from now.\n if (changeFeedOptions.startFromNow) {\n this.startFromNow = true;\n } else if (changeFeedOptions.startTime) {\n this.startTime = changeFeedOptions.startTime.toUTCString();\n }\n }\n\n private async setIteratorRid(diagnosticNode: DiagnosticNodeInternal): Promise<void> {\n const { resource } = await this.container.readInternal(diagnosticNode);\n this.rId = resource._rid;\n }\n\n private continuationTokenRidMatchContainerRid(): boolean {\n if (this.continuationToken.rid !== this.rId) {\n return false;\n }\n return true;\n }\n\n private async fillChangeFeedQueue(diagnosticNode: DiagnosticNodeInternal): Promise<void> {\n if (this.continuationToken) {\n // fill the queue with feed ranges in continuation token.\n await this.fetchContinuationTokenFeedRanges(diagnosticNode);\n } else {\n // fill the queue with feed ranges overlapping the given epk range.\n await this.fetchOverLappingFeedRanges(diagnosticNode);\n }\n this.isInstantiated = true;\n }\n\n /**\n * Fill the queue with the feed ranges overlapping with the given epk range.\n */\n private async fetchOverLappingFeedRanges(diagnosticNode: DiagnosticNodeInternal): Promise<void> {\n try {\n const overLappingRanges = await this.partitionKeyRangeCache.getOverlappingRanges(\n this.url,\n this.epkRange,\n diagnosticNode,\n );\n for (const overLappingRange of overLappingRanges) {\n const [epkMinHeader, epkMaxHeader] = await extractOverlappingRanges(\n this.epkRange,\n overLappingRange,\n );\n const feedRange: ChangeFeedRange = new ChangeFeedRange(\n overLappingRange.minInclusive,\n overLappingRange.maxExclusive,\n \"\",\n epkMinHeader,\n epkMaxHeader,\n );\n this.queue.enqueue(feedRange);\n }\n } catch (err) {\n throw new ErrorResponse(err.message);\n }\n }\n /**\n * Fill the queue with feed ranges from continuation token\n */\n private async fetchContinuationTokenFeedRanges(\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<void> {\n const contToken = this.continuationToken;\n if (!this.continuationTokenRidMatchContainerRid()) {\n throw new ErrorResponse(\"The continuation token is not for the current container definition\");\n } else {\n for (const cToken of contToken.Continuation) {\n const queryRange = new QueryRange(cToken.minInclusive, cToken.maxExclusive, true, false);\n try {\n const overLappingRanges = await this.partitionKeyRangeCache.getOverlappingRanges(\n this.url,\n queryRange,\n diagnosticNode,\n );\n for (const overLappingRange of overLappingRanges) {\n // check if the epk range present in continuation token entirely covers the overlapping range.\n // If yes, minInclusive and maxExclusive of the overlapping range will be set.\n // If no, i.e. there is only partial overlap, epkMinHeader and epkMaxHeader are set as min and max of overlap.\n // This will be used when we make a call to fetch change feed.\n const [epkMinHeader, epkMaxHeader] = await extractOverlappingRanges(\n queryRange,\n overLappingRange,\n );\n const feedRange: ChangeFeedRange = new ChangeFeedRange(\n overLappingRange.minInclusive,\n overLappingRange.maxExclusive,\n cToken.continuationToken,\n epkMinHeader,\n epkMaxHeader,\n );\n this.queue.enqueue(feedRange);\n }\n } catch (err) {\n throw new ErrorResponse(err.message);\n }\n }\n }\n }\n\n /**\n * Change feed is an infinite feed. hasMoreResults is always true.\n */\n get hasMoreResults(): boolean {\n return true;\n }\n\n /**\n * Gets an async iterator which will yield change feed results.\n */\n public async *getAsyncIterator(): AsyncIterable<ChangeFeedIteratorResponse<Array<T & Resource>>> {\n do {\n const result = await this.readNext();\n yield result;\n } while (this.hasMoreResults);\n }\n\n /**\n * Gets an async iterator which will yield pages of results from Azure Cosmos DB.\n *\n * Keeps iterating over the feedranges and checks if any feed range has new result. Keeps note of the last feed range which returned non 304 result.\n *\n * When same feed range is reached and no new changes are found, a 304 (not Modified) is returned to the end user. Then starts process all over again.\n */\n public async readNext(): Promise<ChangeFeedIteratorResponse<Array<T & Resource>>> {\n return withDiagnostics(async (diagnosticNode: DiagnosticNodeInternal) => {\n // validate if the internal queue is filled up with feed ranges.\n if (!this.isInstantiated) {\n await this.setIteratorRid(diagnosticNode);\n await this.fillChangeFeedQueue(diagnosticNode);\n }\n\n // stores the last feedRange for which statusCode is not 304 i.e. there were new changes in that feed range.\n let firstNotModifiedFeedRange: ChangeFeedRange = undefined;\n let result: ChangeFeedIteratorResponse<Array<T & Resource>>;\n do {\n const [processedFeedRange, response] = await this.fetchNext(diagnosticNode);\n result = response;\n\n if (result !== undefined) {\n {\n if (firstNotModifiedFeedRange === undefined) {\n firstNotModifiedFeedRange = processedFeedRange;\n }\n // move current feed range to end of queue to fetch result of next feed range.\n // This is done to fetch changes in breadth first manner and avoid starvation.\n this.queue.moveFirstElementToTheEnd();\n // check if there are new results for the given feed range.\n if (result.statusCode === StatusCodes.Ok) {\n result.headers[Constants.HttpHeaders.ContinuationToken] =\n this.generateContinuationToken();\n\n if (this.clientContext.enableEncryption) {\n await decryptChangeFeedResponse(\n result,\n diagnosticNode,\n this.changeFeedOptions.changeFeedMode,\n this.container.encryptionProcessor,\n );\n }\n return result;\n }\n }\n }\n } while (!this.checkedAllFeedRanges(firstNotModifiedFeedRange));\n // set the continuation token after processing.\n result.headers[Constants.HttpHeaders.ContinuationToken] = this.generateContinuationToken();\n return result;\n }, this.clientContext);\n }\n\n private generateContinuationToken = (): string => {\n return JSON.stringify(new CompositeContinuationToken(this.rId, this.queue.returnSnapshot()));\n };\n\n /**\n * Read feed and retrieves the next page of results in Azure Cosmos DB.\n */\n private async fetchNext(\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<[ChangeFeedRange | undefined, ChangeFeedIteratorResponse<Array<T & Resource>>]> {\n const feedRange = this.queue.peek();\n if (feedRange) {\n // fetch results for feed range at the beginning of the queue.\n const result = await this.getFeedResponse(feedRange, diagnosticNode);\n\n // check if results need to be fetched again depending on status code returned.\n // Eg. in case of paritionSplit, results need to be fetched for the child partitions.\n const shouldRetry: boolean = await this.shouldRetryOnFailure(\n feedRange,\n result,\n diagnosticNode,\n );\n\n if (shouldRetry) {\n this.queue.dequeue();\n return this.fetchNext(diagnosticNode);\n } else {\n // update the continuation value for the current feed range.\n const continuationValueForFeedRange = result.headers[Constants.HttpHeaders.ETag];\n const newFeedRange = this.queue.peek();\n newFeedRange.continuationToken = continuationValueForFeedRange;\n return [newFeedRange, result];\n }\n } else {\n return [undefined, undefined];\n }\n }\n\n private checkedAllFeedRanges(firstNotModifiedFeedRange: ChangeFeedRange | undefined): boolean {\n if (firstNotModifiedFeedRange === undefined) {\n return false;\n }\n const feedRangeQueueFirstElement = this.queue.peek();\n return (\n firstNotModifiedFeedRange.minInclusive === feedRangeQueueFirstElement?.minInclusive &&\n firstNotModifiedFeedRange.maxExclusive === feedRangeQueueFirstElement?.maxExclusive &&\n firstNotModifiedFeedRange.epkMinHeader === feedRangeQueueFirstElement?.epkMinHeader &&\n firstNotModifiedFeedRange.epkMaxHeader === feedRangeQueueFirstElement?.epkMaxHeader\n );\n }\n\n /**\n * Checks whether the current EpkRange is split into multiple ranges or not.\n *\n * If yes, it force refreshes the partitionKeyRange cache and enqueue children epk ranges.\n */\n private async shouldRetryOnFailure(\n feedRange: ChangeFeedRange,\n response: ChangeFeedIteratorResponse<Array<T & Resource>>,\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<boolean> {\n if (response.statusCode === StatusCodes.Ok || response.statusCode === StatusCodes.NotModified) {\n return false;\n }\n\n const partitionSplit =\n response.statusCode === StatusCodes.Gone &&\n (response.subStatusCode === SubStatusCodes.PartitionKeyRangeGone ||\n response.subStatusCode === SubStatusCodes.CompletingSplit);\n\n if (partitionSplit) {\n const queryRange = new QueryRange(\n feedRange.epkMinHeader ? feedRange.epkMinHeader : feedRange.minInclusive,\n feedRange.epkMaxHeader ? feedRange.epkMaxHeader : feedRange.maxExclusive,\n true,\n false,\n );\n const resolvedRanges = await this.partitionKeyRangeCache.getOverlappingRanges(\n this.url,\n queryRange,\n diagnosticNode,\n true,\n );\n if (resolvedRanges.length < 1) {\n throw new ErrorResponse(\"Partition split/merge detected but no overlapping ranges found.\");\n }\n // This covers both cases of merge and split.\n // resolvedRanges.length > 1 in case of split.\n // resolvedRanges.length === 1 in case of merge. EpkRange headers will be added in this case.\n if (resolvedRanges.length >= 1) {\n await this.handleSplitOrMerge(\n false,\n resolvedRanges,\n queryRange,\n feedRange.continuationToken,\n );\n }\n return true;\n }\n return false;\n }\n /*\n * Enqueues all the children feed ranges for the given feed range.\n */\n private async handleSplitOrMerge(\n shiftLeft: boolean,\n resolvedRanges: any,\n oldFeedRange: QueryRange,\n continuationToken: string,\n ): Promise<void> {\n let flag = 0;\n if (shiftLeft) {\n // This section is only applicable when handleSplitOrMerge is called by getPartitionRangeId().\n // used only when existing partition key range cache is used to check for any overlapping ranges.\n // Modifies the first element with the first overlapping range.\n const [epkMinHeader, epkMaxHeader] = await extractOverlappingRanges(\n oldFeedRange,\n resolvedRanges[0],\n );\n const newFeedRange = new ChangeFeedRange(\n resolvedRanges[0].minInclusive,\n resolvedRanges[0].maxExclusive,\n continuationToken,\n epkMinHeader,\n epkMaxHeader,\n );\n\n this.queue.modifyFirstElement(newFeedRange);\n flag = 1;\n }\n // Enqueue the overlapping ranges.\n for (let i = flag; i < resolvedRanges.length; i++) {\n const [epkMinHeader, epkMaxHeader] = await extractOverlappingRanges(\n oldFeedRange,\n resolvedRanges[i],\n );\n const newFeedRange = new ChangeFeedRange(\n resolvedRanges[i].minInclusive,\n resolvedRanges[i].maxExclusive,\n continuationToken,\n epkMinHeader,\n epkMaxHeader,\n );\n this.queue.enqueue(newFeedRange);\n }\n }\n\n /**\n * Fetch the partitionKeyRangeId for the given feed range.\n *\n * This partitionKeyRangeId is passed to queryFeed to fetch the results.\n */\n private async getPartitionRangeId(\n feedRange: ChangeFeedRange,\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<string> {\n const min = feedRange.epkMinHeader ? feedRange.epkMinHeader : feedRange.minInclusive;\n const max = feedRange.epkMaxHeader ? feedRange.epkMaxHeader : feedRange.maxExclusive;\n const queryRange = new QueryRange(min, max, true, false);\n const resolvedRanges = await this.partitionKeyRangeCache.getOverlappingRanges(\n this.url,\n queryRange,\n diagnosticNode,\n false,\n );\n if (resolvedRanges.length < 1) {\n throw new ErrorResponse(\"No overlapping ranges found.\");\n }\n const firstResolvedRange = resolvedRanges[0];\n const isPartitionRangeChanged =\n feedRange.minInclusive !== firstResolvedRange.minInclusive ||\n feedRange.maxExclusive !== firstResolvedRange.maxExclusive ||\n resolvedRanges.length > 1;\n // If the partition range is changed, we need to handle split/merge\n if (isPartitionRangeChanged) {\n await this.handleSplitOrMerge(true, resolvedRanges, queryRange, feedRange.continuationToken);\n }\n return firstResolvedRange.id;\n }\n\n private async getFeedResponse(\n feedRange: ChangeFeedRange,\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<ChangeFeedIteratorResponse<Array<T & Resource>>> {\n const feedOptions: FeedOptions = buildFeedOptions(\n this.changeFeedOptions,\n feedRange.continuationToken,\n this.startFromNow,\n this.startTime,\n );\n const rangeId = await this.getPartitionRangeId(feedRange, diagnosticNode);\n if (this.clientContext.enableEncryption) {\n await this.container.checkAndInitializeEncryption();\n feedOptions.containerRid = this.container._rid;\n }\n try {\n // startEpk and endEpk are only valid in case we want to fetch result for a part of partition and not the entire partition.\n const finalFeedRange = this.fetchFinalFeedRange();\n const response: Response<Array<T & Resource>> = await (this.clientContext.queryFeed<T>({\n path: this.resourceLink,\n resourceType: ResourceType.item,\n resourceId: this.resourceId,\n resultFn: (result) => (result ? result.Documents : []),\n query: undefined,\n options: feedOptions,\n diagnosticNode,\n partitionKey: undefined,\n partitionKeyRangeId: rangeId,\n startEpk: finalFeedRange.epkMinHeader,\n endEpk: finalFeedRange.epkMaxHeader,\n }) as Promise<any>);\n\n return new ChangeFeedIteratorResponse(\n response.result,\n response.result ? response.result.length : 0,\n response.code,\n response.headers,\n getEmptyCosmosDiagnostics(),\n );\n } catch (err) {\n // If partition split/merge is encountered, handle it gracefully and continue fetching results.\n if (err.code === StatusCodes.Gone) {\n return new ChangeFeedIteratorResponse(\n [],\n 0,\n err.code,\n err.headers,\n getEmptyCosmosDiagnostics(),\n err.substatus,\n );\n }\n // If any other errors are encountered, throw the error.\n const errorResponse = new ErrorResponse(err.message);\n errorResponse.code = err.code;\n errorResponse.headers = err.headers;\n throw errorResponse;\n }\n }\n private fetchFinalFeedRange(): ChangeFeedRange {\n // this is used to fetch the final feed range before making a call to fetch the results.\n // In case of merge, the final updated feed range is present in the queue and needs to be returned.\n const feedRange = this.queue.peek();\n if (feedRange) {\n return feedRange;\n } else {\n throw new ErrorResponse(\"No feed range found.\");\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeFeedForPartitionKey.d.ts","sourceRoot":"","sources":["../../../../src/client/ChangeFeed/ChangeFeedForPartitionKey.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAa,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"ChangeFeedForPartitionKey.d.ts","sourceRoot":"","sources":["../../../../src/client/ChangeFeed/ChangeFeedForPartitionKey.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAa,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAM/E;;;;;GAKG;AACH,qBAAa,yBAAyB,CAAC,CAAC,CAAE,YAAW,2BAA2B,CAAC,CAAC,CAAC;IAU/E,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,iBAAiB;IAd3B,OAAO,CAAC,iBAAiB,CAAmC;IAC5D,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,YAAY,CAAU;YAwBhB,mBAAmB;IAgCjC,OAAO,CAAC,qCAAqC;YAO/B,cAAc;IAK5B;;OAEG;IACH,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED;;OAEG;IACW,gBAAgB,IAAI,aAAa,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;IAOhG;;OAEG;IACU,QAAQ,IAAI,OAAO,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;IAoBjF;;OAEG;YACW,SAAS;YAWT,eAAe;CA+C9B"}
|
|
@@ -4,8 +4,7 @@ import { ErrorResponse } from "../../request/index.js";
|
|
|
4
4
|
import { ContinuationTokenForPartitionKey } from "./ContinuationTokenForPartitionKey.js";
|
|
5
5
|
import { convertToInternalPartitionKey } from "../../documents/index.js";
|
|
6
6
|
import { getEmptyCosmosDiagnostics, withDiagnostics } from "../../utils/diagnostics.js";
|
|
7
|
-
import {
|
|
8
|
-
import { decryptChangeFeedResponse } from "./changeFeedUtils.js";
|
|
7
|
+
import { buildFeedOptions, decryptChangeFeedResponse } from "./changeFeedUtils.js";
|
|
9
8
|
import { computePartitionKeyRangeId } from "../ClientUtils.js";
|
|
10
9
|
/**
|
|
11
10
|
* @hidden
|
|
@@ -120,39 +119,7 @@ export class ChangeFeedForPartitionKey {
|
|
|
120
119
|
return response;
|
|
121
120
|
}
|
|
122
121
|
async getFeedResponse(diagnosticNode) {
|
|
123
|
-
const feedOptions =
|
|
124
|
-
initialHeaders: {},
|
|
125
|
-
useLatestVersionFeed: true,
|
|
126
|
-
useAllVersionsAndDeletesFeed: false,
|
|
127
|
-
};
|
|
128
|
-
if (typeof this.changeFeedOptions.maxItemCount === "number") {
|
|
129
|
-
feedOptions.maxItemCount = this.changeFeedOptions.maxItemCount;
|
|
130
|
-
}
|
|
131
|
-
if (this.changeFeedOptions.sessionToken) {
|
|
132
|
-
feedOptions.sessionToken = this.changeFeedOptions.sessionToken;
|
|
133
|
-
}
|
|
134
|
-
if (this.changeFeedOptions.excludedLocations) {
|
|
135
|
-
feedOptions.excludedLocations = this.changeFeedOptions.excludedLocations;
|
|
136
|
-
}
|
|
137
|
-
const continuation = this.continuationToken.Continuation;
|
|
138
|
-
if (continuation) {
|
|
139
|
-
feedOptions.accessCondition = {
|
|
140
|
-
type: Constants.HttpHeaders.IfNoneMatch,
|
|
141
|
-
condition: continuation,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
else if (this.startFromNow) {
|
|
145
|
-
feedOptions.initialHeaders[Constants.HttpHeaders.IfNoneMatch] =
|
|
146
|
-
Constants.ChangeFeedIfNoneMatchStartFromNowHeader;
|
|
147
|
-
}
|
|
148
|
-
if (this.startTime) {
|
|
149
|
-
feedOptions.initialHeaders[Constants.HttpHeaders.IfModifiedSince] = this.startTime;
|
|
150
|
-
}
|
|
151
|
-
if (this.changeFeedOptions.changeFeedMode &&
|
|
152
|
-
this.changeFeedOptions.changeFeedMode === ChangeFeedMode.AllVersionsAndDeletes) {
|
|
153
|
-
feedOptions.useAllVersionsAndDeletesFeed = true;
|
|
154
|
-
feedOptions.useLatestVersionFeed = false;
|
|
155
|
-
}
|
|
122
|
+
const feedOptions = buildFeedOptions(this.changeFeedOptions, this.continuationToken?.Continuation, this.startFromNow, this.startTime);
|
|
156
123
|
if (this.clientContext.enableEncryption) {
|
|
157
124
|
feedOptions.containerRid = this.container._rid;
|
|
158
125
|
}
|