@azure/cosmos 4.9.0 → 4.9.1
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/README.md +74 -2
- package/dist/browser/common/constants.js +1 -1
- package/dist/browser/common/constants.js.map +1 -1
- package/dist/browser/queryExecutionContext/PartitionRangeManager.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/PartitionRangeManager.js +5 -0
- package/dist/browser/queryExecutionContext/PartitionRangeManager.js.map +1 -1
- package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.js +8 -2
- package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.d.ts +5 -0
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.js +16 -5
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/browser/queryExecutionContext/pipelinedQueryExecutionContext.d.ts +2 -1
- package/dist/browser/queryExecutionContext/pipelinedQueryExecutionContext.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/pipelinedQueryExecutionContext.js +5 -2
- package/dist/browser/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
- package/dist/commonjs/common/constants.js +1 -1
- package/dist/commonjs/common/constants.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/PartitionRangeManager.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/PartitionRangeManager.js +5 -0
- package/dist/commonjs/queryExecutionContext/PartitionRangeManager.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.js +8 -2
- package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.d.ts +5 -0
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.js +16 -5
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/pipelinedQueryExecutionContext.d.ts +2 -1
- package/dist/commonjs/queryExecutionContext/pipelinedQueryExecutionContext.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/pipelinedQueryExecutionContext.js +5 -2
- package/dist/commonjs/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/esm/common/constants.js +1 -1
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/queryExecutionContext/PartitionRangeManager.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/PartitionRangeManager.js +5 -0
- package/dist/esm/queryExecutionContext/PartitionRangeManager.js.map +1 -1
- package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.js +8 -2
- package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.d.ts +5 -0
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.js +16 -5
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/esm/queryExecutionContext/pipelinedQueryExecutionContext.d.ts +2 -1
- package/dist/esm/queryExecutionContext/pipelinedQueryExecutionContext.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/pipelinedQueryExecutionContext.js +5 -2
- package/dist/esm/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
- package/dist/react-native/common/constants.js +1 -1
- package/dist/react-native/common/constants.js.map +1 -1
- package/dist/react-native/queryExecutionContext/PartitionRangeManager.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/PartitionRangeManager.js +5 -0
- package/dist/react-native/queryExecutionContext/PartitionRangeManager.js.map +1 -1
- package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.js +8 -2
- package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.js.map +1 -1
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.d.ts +5 -0
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.js +16 -5
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/react-native/queryExecutionContext/pipelinedQueryExecutionContext.d.ts +2 -1
- package/dist/react-native/queryExecutionContext/pipelinedQueryExecutionContext.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/pipelinedQueryExecutionContext.js +5 -2
- package/dist/react-native/queryExecutionContext/pipelinedQueryExecutionContext.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -399,6 +399,77 @@ const { resources } = await container.items
|
|
|
399
399
|
.fetchAll();
|
|
400
400
|
```
|
|
401
401
|
|
|
402
|
+
**Note:** To use continuation tokens with queries, ensure that `enableQueryControl` is set to `true` in the query options. This enables support for retrieving query continuation tokens for paginating through large result sets.
|
|
403
|
+
|
|
404
|
+
Here's an example of using continuation tokens with `enableQueryControl`:
|
|
405
|
+
|
|
406
|
+
```ts snippet:QueryWithContinuationToken
|
|
407
|
+
import { CosmosClient } from "@azure/cosmos";
|
|
408
|
+
|
|
409
|
+
const endpoint = "https://your-account.documents.azure.com";
|
|
410
|
+
const key = "<database account masterkey>";
|
|
411
|
+
const client = new CosmosClient({ endpoint, key });
|
|
412
|
+
|
|
413
|
+
const { database } = await client.databases.createIfNotExists({ id: "Test Database" });
|
|
414
|
+
|
|
415
|
+
const { container } = await database.containers.createIfNotExists({ id: "Test Container" });
|
|
416
|
+
|
|
417
|
+
const queryIterator = container.items.query("SELECT * from c", {
|
|
418
|
+
maxItemCount: 10,
|
|
419
|
+
enableQueryControl: true,
|
|
420
|
+
forceQueryPlan: true,
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
let pageCount = 0;
|
|
424
|
+
while (queryIterator.hasMoreResults()) {
|
|
425
|
+
pageCount++;
|
|
426
|
+
const { resources, continuationToken } = await queryIterator.fetchNext();
|
|
427
|
+
console.log(`Page ${pageCount} has ${resources.length} items`);
|
|
428
|
+
// continuationToken can be saved and used later to resume from where you left off
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
**Special case: ORDER BY queries**
|
|
433
|
+
|
|
434
|
+
When using `enableQueryControl` with ORDER BY queries, be aware that the continuation token behavior requires special handling:
|
|
435
|
+
|
|
436
|
+
```ts snippet:QueryWithContinuationTokenOrderBy
|
|
437
|
+
import { CosmosClient } from "@azure/cosmos";
|
|
438
|
+
|
|
439
|
+
const endpoint = "https://your-account.documents.azure.com";
|
|
440
|
+
const key = "<database account masterkey>";
|
|
441
|
+
const client = new CosmosClient({ endpoint, key });
|
|
442
|
+
|
|
443
|
+
const { database } = await client.databases.createIfNotExists({ id: "Test Database" });
|
|
444
|
+
|
|
445
|
+
const { container } = await database.containers.createIfNotExists({ id: "Test Container" });
|
|
446
|
+
|
|
447
|
+
const queryIterator = container.items.query("SELECT * from c ORDER BY c.id", {
|
|
448
|
+
maxItemCount: 10,
|
|
449
|
+
enableQueryControl: true,
|
|
450
|
+
forceQueryPlan: true,
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
let pageCount = 0;
|
|
454
|
+
while (queryIterator.hasMoreResults()) {
|
|
455
|
+
pageCount++;
|
|
456
|
+
const { resources, continuationToken } = await queryIterator.fetchNext();
|
|
457
|
+
if (resources.length > 0) {
|
|
458
|
+
// Process results
|
|
459
|
+
// Safe to use continuationToken after receiving data
|
|
460
|
+
if (continuationToken) {
|
|
461
|
+
// Can persist token for resuming later
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
**Important:** When using `enableQueryControl` with ORDER BY queries:
|
|
468
|
+
- The `resources` array and `continuationToken` may be empty and `undefined` repectively during the initial calls
|
|
469
|
+
- This occurs because the query needs to consolidate results across partitions before returning
|
|
470
|
+
- Always verify `resources.length > 0` before relying on the continuation token
|
|
471
|
+
- Use `forceQueryPlan: true` in your query options to ensure consistent query execution behavior across partitions, which helps with continuation token stability
|
|
472
|
+
|
|
402
473
|
For more information on querying Cosmos DB databases using the SQL API, see [Query Azure Cosmos DB data with SQL queries][cosmos_sql_queries].
|
|
403
474
|
|
|
404
475
|
### Change Feed Pull Model
|
|
@@ -741,6 +812,7 @@ Currently the features below are **not supported**. For alternatives options, ch
|
|
|
741
812
|
- Change Feed: Processor
|
|
742
813
|
- Change Feed: Read multiple partitions key values
|
|
743
814
|
- Cross-partition ORDER BY for mixed types
|
|
815
|
+
- We recommend upgrading to the latest SDK to use continuation tokens for pagination. When using continuation tokens with `enableQueryControl` on cross-partition queries (queries that scan multiple partitions), ensure you set `forceQueryPlan: true` in query options to enforce a deterministic execution plan. Without it, query execution behavior may vary across partitions, affecting continuation token consistency.
|
|
744
816
|
|
|
745
817
|
### Control Plane Limitations:
|
|
746
818
|
|
|
@@ -750,9 +822,9 @@ Currently the features below are **not supported**. For alternatives options, ch
|
|
|
750
822
|
|
|
751
823
|
## Workarounds
|
|
752
824
|
|
|
753
|
-
### Continuation token for cross partitions queries
|
|
825
|
+
### Continuation token for cross partitions queries for older versions(< 4.9.0)
|
|
754
826
|
|
|
755
|
-
You can achieve cross partition queries with continuation token support by using
|
|
827
|
+
You can achieve cross partition queries with continuation token support for older versions before 4.9.0 by using
|
|
756
828
|
[Side car pattern](https://github.com/Azure-Samples/Cosmosdb-query-sidecar).
|
|
757
829
|
This pattern can also enable applications to be composed of heterogeneous components and technologies.
|
|
758
830
|
|
|
@@ -188,7 +188,7 @@ export const Constants = {
|
|
|
188
188
|
AzureNamespace: "Azure.Cosmos",
|
|
189
189
|
AzurePackageName: "@azure/cosmos",
|
|
190
190
|
SDKName: "azure-cosmos-js",
|
|
191
|
-
SDKVersion: "4.9.
|
|
191
|
+
SDKVersion: "4.9.1",
|
|
192
192
|
// Diagnostics
|
|
193
193
|
CosmosDbDiagnosticLevelEnvVarName: "AZURE_COSMOSDB_DIAGNOSTICS_LEVEL",
|
|
194
194
|
// Bulk Operations
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,WAAW,EAAE;QACX,aAAa,EAAE,eAAe;QAC9B,IAAI,EAAE,MAAM;QACZ,cAAc,EAAE,eAAe;QAC/B,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,cAAc;QAC3B,YAAY,EAAE,eAAe;QAC7B,eAAe,EAAE,kBAAkB;QACnC,YAAY,EAAE,cAAc;QAC5B,SAAS,EAAE,YAAY;QACvB,eAAe,EAAE,gBAAgB;QACjC,eAAe,EAAE,mBAAmB;QACpC,OAAO,EAAE,UAAU;QACnB,WAAW,EAAE,eAAe;QAC5B,aAAa,EAAE,gBAAgB;QAC/B,cAAc,EAAE,iBAAiB;QACjC,SAAS,EAAE,YAAY;QACvB,YAAY,EAAE,eAAe;QAC7B,gBAAgB,EAAE,mBAAmB;QACrC,eAAe,EAAE,kBAAkB;QACnC,eAAe,EAAE,kBAAkB;QACnC,UAAU,EAAE,aAAa;QACzB,YAAY,EAAE,eAAe;QAC7B,MAAM,EAAE,QAAQ;QAChB,aAAa,EAAE,gBAAgB;QAC/B,cAAc,EAAE,iBAAiB;QACjC,OAAO,EAAE,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,mCAAmB,CAAA;IACnB,6CAA6B,CAAA;IAC7B,yDAAyC,CAAA;IACzC,iFAAiE,CAAA;AACnE,CAAC,EAjBW,YAAY,KAAZ,YAAY,QAiBvB;AAED,MAAM,CAAN,IAAY,wBAEX;AAFD,WAAY,wBAAwB;IAClC,2FAAkB,CAAA;AACpB,CAAC,EAFW,wBAAwB,KAAxB,wBAAwB,QAEnC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,4BAGX;AAHD,WAAY,4BAA4B;IACtC,yFAAS,CAAA;IACT,6FAAW,CAAA;AACb,CAAC,EAHW,4BAA4B,KAA5B,4BAA4B,QAGvC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,mHAAiC,CAAA;IACjC,6GAA8B,CAAA;AAChC,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport interface PartitionKeyRangePropertiesNames {\n // Partition Key Range Constants\n MinInclusive: \"minInclusive\";\n MaxExclusive: \"maxExclusive\";\n Id: \"id\";\n}\n\n/**\n * @hidden\n */\nexport const Constants = {\n HttpHeaders: {\n Authorization: \"authorization\",\n ETag: \"etag\",\n MethodOverride: \"X-HTTP-Method\",\n Slug: \"Slug\",\n ContentType: \"Content-Type\",\n LastModified: \"Last-Modified\",\n ContentEncoding: \"Content-Encoding\",\n CharacterSet: \"CharacterSet\",\n UserAgent: \"User-Agent\",\n CustomUserAgent: \"x-ms-useragent\",\n IfModifiedSince: \"If-Modified-Since\",\n IfMatch: \"If-Match\",\n IfNoneMatch: \"If-None-Match\",\n ContentLength: \"Content-Length\",\n AcceptEncoding: \"Accept-Encoding\",\n KeepAlive: \"Keep-Alive\",\n CacheControl: \"Cache-Control\",\n TransferEncoding: \"Transfer-Encoding\",\n ContentLanguage: \"Content-Language\",\n ContentLocation: \"Content-Location\",\n ContentMd5: \"Content-Md5\",\n ContentRange: \"Content-Range\",\n Accept: \"Accept\",\n AcceptCharset: \"Accept-Charset\",\n AcceptLanguage: \"Accept-Language\",\n IfRange: \"If-Range\",\n IfUnmodifiedSince: \"If-Unmodified-Since\",\n MaxForwards: \"Max-Forwards\",\n ProxyAuthorization: \"Proxy-Authorization\",\n AcceptRanges: \"Accept-Ranges\",\n ProxyAuthenticate: \"Proxy-Authenticate\",\n RetryAfter: \"Retry-After\",\n SetCookie: \"Set-Cookie\",\n WwwAuthenticate: \"Www-Authenticate\",\n Origin: \"Origin\",\n Host: \"Host\",\n AccessControlAllowOrigin: \"Access-Control-Allow-Origin\",\n AccessControlAllowHeaders: \"Access-Control-Allow-Headers\",\n KeyValueEncodingFormat: \"application/x-www-form-urlencoded\",\n WrapAssertionFormat: \"wrap_assertion_format\",\n WrapAssertion: \"wrap_assertion\",\n WrapScope: \"wrap_scope\",\n SimpleToken: \"SWT\",\n HttpDate: \"date\",\n Prefer: \"Prefer\",\n Location: \"Location\",\n Referer: \"referer\",\n A_IM: \"A-IM\",\n PreferReturnMinimal: \"return=minimal\",\n\n // Query\n Query: \"x-ms-documentdb-query\",\n IsQuery: \"x-ms-documentdb-isquery\",\n IsQueryPlan: \"x-ms-cosmos-is-query-plan-request\",\n SupportedQueryFeatures: \"x-ms-cosmos-supported-query-features\",\n QueryVersion: \"x-ms-cosmos-query-version\",\n\n // Our custom Azure Cosmos DB headers\n Continuation: \"x-ms-continuation\",\n ContinuationToken: \"x-ms-continuation-token\",\n PageSize: \"x-ms-max-item-count\",\n ItemCount: \"x-ms-item-count\",\n ChangeFeedWireFormatVersion: \"x-ms-cosmos-changefeed-wire-format-version\",\n\n // Request sender generated. Simply echoed by backend.\n ActivityId: \"x-ms-activity-id\",\n CorrelatedActivityId: \"x-ms-cosmos-correlated-activityid\",\n PreTriggerInclude: \"x-ms-documentdb-pre-trigger-include\",\n PreTriggerExclude: \"x-ms-documentdb-pre-trigger-exclude\",\n PostTriggerInclude: \"x-ms-documentdb-post-trigger-include\",\n PostTriggerExclude: \"x-ms-documentdb-post-trigger-exclude\",\n IndexingDirective: \"x-ms-indexing-directive\",\n SessionToken: \"x-ms-session-token\",\n ConsistencyLevel: \"x-ms-consistency-level\",\n XDate: \"x-ms-date\",\n CollectionPartitionInfo: \"x-ms-collection-partition-info\",\n CollectionServiceInfo: \"x-ms-collection-service-info\",\n // Deprecated, use RetryAfterInMs instead.\n RetryAfterInMilliseconds: \"x-ms-retry-after-ms\",\n RetryAfterInMs: \"x-ms-retry-after-ms\",\n IsFeedUnfiltered: \"x-ms-is-feed-unfiltered\",\n ResourceTokenExpiry: \"x-ms-documentdb-expiry-seconds\",\n EnableScanInQuery: \"x-ms-documentdb-query-enable-scan\",\n EmitVerboseTracesInQuery: \"x-ms-documentdb-query-emit-traces\",\n EnableCrossPartitionQuery: \"x-ms-documentdb-query-enablecrosspartition\",\n ParallelizeCrossPartitionQuery: \"x-ms-documentdb-query-parallelizecrosspartitionquery\",\n ResponseContinuationTokenLimitInKB: \"x-ms-documentdb-responsecontinuationtokenlimitinkb\",\n SDKSupportedCapabilities: \"x-ms-cosmos-sdk-supportedcapabilities\",\n\n // QueryMetrics\n // Request header to tell backend to give you query metrics.\n PopulateQueryMetrics: \"x-ms-documentdb-populatequerymetrics\",\n // Response header that holds the serialized version of query metrics.\n QueryMetrics: \"x-ms-documentdb-query-metrics\",\n\n // IndexMetrics\n // Request header to tell backend to give you index metrics.\n PopulateIndexMetrics: \"x-ms-cosmos-populateindexmetrics-V2\",\n // Response header that holds the serialized version of index metrics.\n IndexUtilization: \"x-ms-cosmos-index-utilization\",\n // Version headers and values\n Version: \"x-ms-version\",\n\n // Owner name\n OwnerFullName: \"x-ms-alt-content-path\",\n\n // Owner ID used for name based request in session token.\n OwnerId: \"x-ms-content-path\",\n\n // Partition Key\n PartitionKey: \"x-ms-documentdb-partitionkey\",\n PartitionKeyRangeID: \"x-ms-documentdb-partitionkeyrangeid\",\n\n // Epk Range headers\n StartEpk: \"x-ms-start-epk\",\n EndEpk: \"x-ms-end-epk\",\n\n // Read Feed Type\n ReadFeedKeyType: \"x-ms-read-key-type\",\n\n // Quota Info\n MaxEntityCount: \"x-ms-root-entity-max-count\",\n CurrentEntityCount: \"x-ms-root-entity-current-count\",\n CollectionQuotaInMb: \"x-ms-collection-quota-mb\",\n CollectionCurrentUsageInMb: \"x-ms-collection-usage-mb\",\n MaxMediaStorageUsageInMB: \"x-ms-max-media-storage-usage-mb\",\n CurrentMediaStorageUsageInMB: \"x-ms-media-storage-usage-mb\",\n RequestCharge: \"x-ms-request-charge\",\n PopulateQuotaInfo: \"x-ms-documentdb-populatequotainfo\",\n MaxResourceQuota: \"x-ms-resource-quota\",\n\n // Offer header\n OfferType: \"x-ms-offer-type\",\n OfferThroughput: \"x-ms-offer-throughput\",\n AutoscaleSettings: \"x-ms-cosmos-offer-autopilot-settings\",\n\n // Custom RUs/minute headers\n DisableRUPerMinuteUsage: \"x-ms-documentdb-disable-ru-per-minute-usage\",\n IsRUPerMinuteUsed: \"x-ms-documentdb-is-ru-per-minute-used\",\n OfferIsRUPerMinuteThroughputEnabled: \"x-ms-offer-is-ru-per-minute-throughput-enabled\",\n\n // Index progress headers\n IndexTransformationProgress: \"x-ms-documentdb-collection-index-transformation-progress\",\n LazyIndexingProgress: \"x-ms-documentdb-collection-lazy-indexing-progress\",\n\n // Upsert header\n IsUpsert: \"x-ms-documentdb-is-upsert\",\n\n // Sub status of the error\n SubStatus: \"x-ms-substatus\",\n\n // StoredProcedure related headers\n EnableScriptLogging: \"x-ms-documentdb-script-enable-logging\",\n ScriptLogResults: \"x-ms-documentdb-script-log-results\",\n\n // Multi-Region Write\n ALLOW_MULTIPLE_WRITES: \"x-ms-cosmos-allow-tentative-writes\",\n\n // Bulk/Batch header\n IsBatchRequest: \"x-ms-cosmos-is-batch-request\",\n IsBatchAtomic: \"x-ms-cosmos-batch-atomic\",\n BatchContinueOnError: \"x-ms-cosmos-batch-continue-on-error\",\n\n // Dedicated Gateway Headers\n DedicatedGatewayPerRequestCacheStaleness: \"x-ms-dedicatedgateway-max-age\",\n DedicatedGatewayPerRequestBypassCache: \"x-ms-dedicatedgateway-bypass-cache\",\n\n // Cache Refresh header\n ForceRefresh: \"x-ms-force-refresh\",\n\n // Throughput related headers\n PriorityLevel: \"x-ms-cosmos-priority-level\",\n ThroughputBucket: \"x-ms-cosmos-throughput-bucket\",\n\n // Encryption Headers\n IsClientEncryptedHeader: \"x-ms-cosmos-is-client-encrypted\",\n IntendedCollectionHeader: \"x-ms-cosmos-intended-collection-rid\",\n DatabaseRidHeader: \"x-ms-cosmos-database-rid\",\n AllowCachedReadsHeader: \"x-ms-cosmos-allow-cachedreads\",\n },\n // ThrottledRequests Retry policy default values\n ThrottledRequestMaxRetryAttemptCount: 9,\n ThrottledRequestMaxWaitTimeInSeconds: 30,\n ThrottledRequestFixedRetryIntervalInMs: 0,\n\n // GlobalDB related constants\n WritableLocations: \"writableLocations\",\n ReadableLocations: \"readableLocations\",\n LocationUnavailableExpirationTimeInMs: 5 * 60 * 1000, // 5 minutes\n StalePartitionUnavailabilityRefreshIntervalInMs: 1 * 60 * 1000, // 1 minute\n AllowedPartitionUnavailabilityDurationInMs: 5 * 60 * 1000, // 5 minutes\n ReadRequestFailureCountThreshold: 10,\n WriteRequestFailureCountThreshold: 5,\n ConsecutiveFailureCountResetIntervalInMS: 1000 * 60 * 1, // 1 minute\n\n // ServiceDocument Resource\n ENABLE_MULTIPLE_WRITABLE_LOCATIONS: \"enableMultipleWriteLocations\",\n EnablePerPartitionFailover: \"enablePerPartitionFailoverBehavior\",\n\n // Background refresh time\n DefaultUnavailableLocationExpirationTimeMS: 5 * 60 * 1000,\n\n // Client generated retry count response header\n ThrottleRetryCount: \"x-ms-throttle-retry-count\",\n ThrottleRetryWaitTimeInMs: \"x-ms-throttle-retry-wait-time-ms\",\n\n // Platform\n CurrentVersion: \"2020-07-15\",\n AzureNamespace: \"Azure.Cosmos\",\n AzurePackageName: \"@azure/cosmos\",\n SDKName: \"azure-cosmos-js\",\n SDKVersion: \"4.9.0\",\n\n // Diagnostics\n CosmosDbDiagnosticLevelEnvVarName: \"AZURE_COSMOSDB_DIAGNOSTICS_LEVEL\",\n\n // Bulk Operations\n DefaultMaxBulkRequestBodySizeInBytes: 220201,\n MaxBulkOperationsCount: 100,\n BulkMaxDegreeOfConcurrency: 20,\n\n // Encryption\n Encryption: {\n DiagnosticsDecryptOperation: \"Decrypt\",\n DiagnosticsDuration: \"Duration in milliseconds\",\n DiagnosticsEncryptionDiagnostics: \"EncryptionDiagnostics\",\n DiagnosticsEncryptOperation: \"Encrypt\",\n DiagnosticsPropertiesEncryptedCount: \"Properties Encrypted Count\",\n DiagnosticsPropertiesDecryptedCount: \"Properties Decrypted Count\",\n DiagnosticsStartTime: \"Start time\",\n },\n\n Quota: {\n CollectionSize: \"collectionSize\",\n },\n\n Path: {\n Root: \"/\",\n DatabasesPathSegment: \"dbs\",\n CollectionsPathSegment: \"colls\",\n UsersPathSegment: \"users\",\n DocumentsPathSegment: \"docs\",\n PermissionsPathSegment: \"permissions\",\n StoredProceduresPathSegment: \"sprocs\",\n TriggersPathSegment: \"triggers\",\n UserDefinedFunctionsPathSegment: \"udfs\",\n ConflictsPathSegment: \"conflicts\",\n AttachmentsPathSegment: \"attachments\",\n PartitionKeyRangesPathSegment: \"pkranges\",\n SchemasPathSegment: \"schemas\",\n OffersPathSegment: \"offers\",\n TopologyPathSegment: \"topology\",\n DatabaseAccountPathSegment: \"databaseaccount\",\n },\n\n PartitionKeyRange: {\n // Partition Key Range Constants\n MinInclusive: \"minInclusive\",\n MaxExclusive: \"maxExclusive\",\n Id: \"id\",\n } as PartitionKeyRangePropertiesNames,\n\n QueryRangeConstants: {\n // Partition Key Range Constants\n MinInclusive: \"minInclusive\",\n MaxExclusive: \"maxExclusive\",\n min: \"min\",\n },\n\n /**\n * @deprecated Use EffectivePartitionKeyConstants instead\n */\n EffectiveParitionKeyConstants: {\n MinimumInclusiveEffectivePartitionKey: \"\",\n MaximumExclusiveEffectivePartitionKey: \"FF\",\n },\n\n EffectivePartitionKeyConstants: {\n MinimumInclusiveEffectivePartitionKey: \"\",\n MaximumExclusiveEffectivePartitionKey: \"FF\",\n },\n\n // Changefeed AllVersionsAndDeletesMode formatting version\n AllVersionsAndDeletesChangeFeedWireFormatVersion: \"2021-09-15\",\n ChangeFeedIfNoneMatchStartFromNowHeader: \"*\",\n // Default TTL for encryption caches is 2 hrs (7200 sec)\n DefaultEncryptionCacheTimeToLiveInSeconds: 7200,\n // Timeout to clear encryption related cache\n EncryptionCacheRefreshIntervalInMs: 60000, // 1 minute\n\n RequestTimeoutForReadsInMs: 2000, // 2 seconds\n};\n\nexport const AAD_DEFAULT_SCOPE = \"https://cosmos.azure.com/.default\";\nexport const AAD_AUTH_PREFIX = \"type=aad&ver=1.0&sig=\";\nexport const AAD_RESOURCE_NOT_FOUND_ERROR = \"AADSTS500011\";\n\n/**\n * @internal\n * Internal query execution constants - not part of public API\n */\nconst QueryExecution = {\n /** Default page size for query execution when maxItemCount is not specified */\n DEFAULT_PAGE_SIZE: 10,\n /** Default maximum buffer size for vector search queries */\n DEFAULT_MAX_VECTOR_SEARCH_BUFFER_SIZE: 50000,\n} as const;\n\n/**\n * @internal\n * Export for internal SDK use only\n */\nexport { QueryExecution };\n\n/**\n * @hidden\n */\nexport enum ResourceType {\n none = \"\",\n database = \"dbs\",\n offer = \"offers\",\n user = \"users\",\n permission = \"permissions\",\n container = \"colls\",\n conflicts = \"conflicts\",\n sproc = \"sprocs\",\n udf = \"udfs\",\n trigger = \"triggers\",\n item = \"docs\",\n pkranges = \"pkranges\",\n partitionkey = \"partitionKey\",\n /** resource representing client encryption keys to encrypt/decrypt data */\n clientencryptionkey = \"clientencryptionkeys\",\n}\n\n/**\n * @hidden\n */\nexport enum HTTPMethod {\n get = \"GET\",\n patch = \"PATCH\",\n post = \"POST\",\n put = \"PUT\",\n delete = \"DELETE\",\n}\n\n/**\n * @hidden\n */\nexport enum OperationType {\n Create = \"create\",\n Replace = \"replace\",\n Upsert = \"upsert\",\n Delete = \"delete\",\n Read = \"read\",\n Query = \"query\",\n Execute = \"execute\",\n Batch = \"batch\",\n Patch = \"patch\",\n}\n\n/**\n * @hidden\n */\nexport enum CosmosKeyType {\n PrimaryMaster = \"PRIMARY_MASTER\",\n SecondaryMaster = \"SECONDARY_MASTER\",\n PrimaryReadOnly = \"PRIMARY_READONLY\",\n SecondaryReadOnly = \"SECONDARY_READONLY\",\n}\n\n/**\n * @hidden\n */\nexport enum CosmosContainerChildResourceKind {\n Item = \"ITEM\",\n StoredProcedure = \"STORED_PROCEDURE\",\n UserDefinedFunction = \"USER_DEFINED_FUNCTION\",\n Trigger = \"TRIGGER\",\n}\n/**\n * @hidden\n */\nexport enum PermissionScopeValues {\n /**\n * Values which set permission Scope applicable to control plane related operations.\n */\n ScopeAccountReadValue = 0x0001,\n ScopeAccountListDatabasesValue = 0x0002,\n ScopeDatabaseReadValue = 0x0004,\n ScopeDatabaseReadOfferValue = 0x0008,\n ScopeDatabaseListContainerValue = 0x0010,\n ScopeContainerReadValue = 0x0020,\n ScopeContainerReadOfferValue = 0x0040,\n\n ScopeAccountCreateDatabasesValue = 0x0001,\n ScopeAccountDeleteDatabasesValue = 0x0002,\n ScopeDatabaseDeleteValue = 0x0004,\n ScopeDatabaseReplaceOfferValue = 0x0008,\n ScopeDatabaseCreateContainerValue = 0x0010,\n ScopeDatabaseDeleteContainerValue = 0x0020,\n ScopeContainerReplaceValue = 0x0040,\n ScopeContainerDeleteValue = 0x0080,\n ScopeContainerReplaceOfferValue = 0x0100,\n\n ScopeAccountReadAllAccessValue = 0xffff,\n ScopeDatabaseReadAllAccessValue = PermissionScopeValues.ScopeDatabaseReadValue |\n PermissionScopeValues.ScopeDatabaseReadOfferValue |\n PermissionScopeValues.ScopeDatabaseListContainerValue |\n PermissionScopeValues.ScopeContainerReadValue |\n PermissionScopeValues.ScopeContainerReadOfferValue,\n\n ScopeContainersReadAllAccessValue = PermissionScopeValues.ScopeContainerReadValue |\n PermissionScopeValues.ScopeContainerReadOfferValue,\n\n ScopeAccountWriteAllAccessValue = 0xffff,\n ScopeDatabaseWriteAllAccessValue = PermissionScopeValues.ScopeDatabaseDeleteValue |\n PermissionScopeValues.ScopeDatabaseReplaceOfferValue |\n PermissionScopeValues.ScopeDatabaseCreateContainerValue |\n PermissionScopeValues.ScopeDatabaseDeleteContainerValue |\n PermissionScopeValues.ScopeContainerReplaceValue |\n PermissionScopeValues.ScopeContainerDeleteValue |\n PermissionScopeValues.ScopeContainerReplaceOfferValue,\n\n ScopeContainersWriteAllAccessValue = PermissionScopeValues.ScopeContainerReplaceValue |\n PermissionScopeValues.ScopeContainerDeleteValue |\n PermissionScopeValues.ScopeContainerReplaceOfferValue,\n\n /**\n * Values which set permission Scope applicable to data plane related operations.\n */\n ScopeContainerExecuteQueriesValue = 0x00000001,\n ScopeContainerReadFeedsValue = 0x00000002,\n ScopeContainerReadStoredProceduresValue = 0x00000004,\n ScopeContainerReadUserDefinedFunctionsValue = 0x00000008,\n ScopeContainerReadTriggersValue = 0x00000010,\n ScopeContainerReadConflictsValue = 0x00000020,\n ScopeItemReadValue = 0x00000040,\n ScopeStoredProcedureReadValue = 0x00000080,\n ScopeUserDefinedFunctionReadValue = 0x00000100,\n ScopeTriggerReadValue = 0x00000200,\n\n ScopeContainerCreateItemsValue = 0x00000001,\n ScopeContainerReplaceItemsValue = 0x00000002,\n ScopeContainerUpsertItemsValue = 0x00000004,\n ScopeContainerDeleteItemsValue = 0x00000008,\n ScopeContainerCreateStoredProceduresValue = 0x00000010,\n ScopeContainerReplaceStoredProceduresValue = 0x00000020,\n ScopeContainerDeleteStoredProceduresValue = 0x00000040,\n ScopeContainerExecuteStoredProceduresValue = 0x00000080,\n ScopeContainerCreateTriggersValue = 0x00000100,\n ScopeContainerReplaceTriggersValue = 0x00000200,\n ScopeContainerDeleteTriggersValue = 0x00000400,\n ScopeContainerCreateUserDefinedFunctionsValue = 0x00000800,\n ScopeContainerReplaceUserDefinedFunctionsValue = 0x00001000,\n ScopeContainerDeleteUserDefinedFunctionSValue = 0x00002000,\n ScopeContainerDeleteCONFLICTSValue = 0x00004000,\n ScopeItemReplaceValue = 0x00010000,\n ScopeItemUpsertValue = 0x00020000,\n ScopeItemDeleteValue = 0x00040000,\n ScopeStoredProcedureReplaceValue = 0x00100000,\n ScopeStoredProcedureDeleteValue = 0x00200000,\n ScopeStoredProcedureExecuteValue = 0x00400000,\n ScopeUserDefinedFunctionReplaceValue = 0x00800000,\n ScopeUserDefinedFunctionDeleteValue = 0x01000000,\n ScopeTriggerReplaceValue = 0x02000000,\n ScopeTriggerDeleteValue = 0x04000000,\n\n ScopeContainerReadAllAccessValue = 0xffffffff,\n ScopeItemReadAllAccessValue = PermissionScopeValues.ScopeContainerExecuteQueriesValue |\n PermissionScopeValues.ScopeItemReadValue,\n ScopeContainerWriteAllAccessValue = 0xffffffff,\n ScopeItemWriteAllAccessValue = PermissionScopeValues.ScopeContainerCreateItemsValue |\n PermissionScopeValues.ScopeContainerReplaceItemsValue |\n PermissionScopeValues.ScopeContainerUpsertItemsValue |\n PermissionScopeValues.ScopeContainerDeleteItemsValue |\n PermissionScopeValues.ScopeItemReplaceValue |\n PermissionScopeValues.ScopeItemUpsertValue |\n PermissionScopeValues.ScopeItemDeleteValue,\n\n NoneValue = 0,\n}\n/**\n * @hidden\n */\nexport enum SasTokenPermissionKind {\n ContainerCreateItems = PermissionScopeValues.ScopeContainerCreateItemsValue,\n ContainerReplaceItems = PermissionScopeValues.ScopeContainerReplaceItemsValue,\n ContainerUpsertItems = PermissionScopeValues.ScopeContainerUpsertItemsValue,\n ContainerDeleteItems = PermissionScopeValues.ScopeContainerDeleteValue,\n ContainerExecuteQueries = PermissionScopeValues.ScopeContainerExecuteQueriesValue,\n ContainerReadFeeds = PermissionScopeValues.ScopeContainerReadFeedsValue,\n ContainerCreateStoreProcedure = PermissionScopeValues.ScopeContainerCreateStoredProceduresValue,\n ContainerReadStoreProcedure = PermissionScopeValues.ScopeContainerReadStoredProceduresValue,\n ContainerReplaceStoreProcedure = PermissionScopeValues.ScopeContainerReplaceStoredProceduresValue,\n ContainerDeleteStoreProcedure = PermissionScopeValues.ScopeContainerDeleteStoredProceduresValue,\n ContainerCreateTriggers = PermissionScopeValues.ScopeContainerCreateTriggersValue,\n ContainerReadTriggers = PermissionScopeValues.ScopeContainerReadTriggersValue,\n ContainerReplaceTriggers = PermissionScopeValues.ScopeContainerReplaceTriggersValue,\n ContainerDeleteTriggers = PermissionScopeValues.ScopeContainerDeleteTriggersValue,\n ContainerCreateUserDefinedFunctions = PermissionScopeValues.ScopeContainerCreateUserDefinedFunctionsValue,\n ContainerReadUserDefinedFunctions = PermissionScopeValues.ScopeContainerReadUserDefinedFunctionsValue,\n ContainerReplaceUserDefinedFunctions = PermissionScopeValues.ScopeContainerReplaceUserDefinedFunctionsValue,\n ContainerDeleteUserDefinedFunctions = PermissionScopeValues.ScopeContainerDeleteUserDefinedFunctionSValue,\n ContainerExecuteStoredProcedure = PermissionScopeValues.ScopeContainerExecuteStoredProceduresValue,\n ContainerReadConflicts = PermissionScopeValues.ScopeContainerReadConflictsValue,\n ContainerDeleteConflicts = PermissionScopeValues.ScopeContainerDeleteCONFLICTSValue,\n ContainerReadAny = PermissionScopeValues.ScopeContainerReadOfferValue,\n ContainerFullAccess = PermissionScopeValues.ScopeContainerReadAllAccessValue,\n ItemReadAny = PermissionScopeValues.ScopeItemReplaceValue,\n ItemFullAccess = PermissionScopeValues.ScopeItemReadAllAccessValue,\n ItemRead = PermissionScopeValues.ScopeItemReadValue,\n ItemReplace = PermissionScopeValues.ScopeItemReplaceValue,\n ItemUpsert = PermissionScopeValues.ScopeItemUpsertValue,\n ItemDelete = PermissionScopeValues.ScopeItemDeleteValue,\n StoreProcedureRead = PermissionScopeValues.ScopeStoredProcedureReadValue,\n StoreProcedureReplace = PermissionScopeValues.ScopeStoredProcedureReplaceValue,\n StoreProcedureDelete = PermissionScopeValues.ScopeStoredProcedureDeleteValue,\n StoreProcedureExecute = PermissionScopeValues.ScopeStoredProcedureExecuteValue,\n UserDefinedFuntionRead = PermissionScopeValues.ScopeUserDefinedFunctionReadValue,\n UserDefinedFuntionReplace = PermissionScopeValues.ScopeUserDefinedFunctionReplaceValue,\n UserDefinedFuntionDelete = PermissionScopeValues.ScopeUserDefinedFunctionDeleteValue,\n TriggerRead = PermissionScopeValues.ScopeTriggerReadValue,\n TriggerReplace = PermissionScopeValues.ScopeTriggerReplaceValue,\n TriggerDelete = PermissionScopeValues.ScopeTriggerDeleteValue,\n}\n\nexport enum QueryFeature {\n NonValueAggregate = \"NonValueAggregate\",\n Aggregate = \"Aggregate\",\n Distinct = \"Distinct\",\n MultipleOrderBy = \"MultipleOrderBy\",\n OffsetAndLimit = \"OffsetAndLimit\",\n OrderBy = \"OrderBy\",\n Top = \"Top\",\n CompositeAggregate = \"CompositeAggregate\",\n GroupBy = \"GroupBy\",\n MultipleAggregates = \"MultipleAggregates\",\n NonStreamingOrderBy = \"NonStreamingOrderBy\",\n ListAndSetAggregate = \"ListAndSetAggregate\",\n CountIf = \"CountIf\",\n HybridSearch = \"HybridSearch\",\n WeightedRankFusion = \"WeightedRankFusion\",\n HybridSearchSkipOrderByRewrite = \"HybridSearchSkipOrderByRewrite\",\n}\n\nexport enum SDKSupportedCapabilities {\n PartitionMerge = 1,\n}\n\n/**\n * @hidden\n */\nexport enum PartitionAvailablilityStatus {\n Available,\n Unavailable,\n}\n\n/**\n * @hidden\n */\nexport enum UserAgentFeatureFlags {\n PerPartitionAutomaticFailover = 1,\n PerPartitionCircuitBreaker = 2,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,WAAW,EAAE;QACX,aAAa,EAAE,eAAe;QAC9B,IAAI,EAAE,MAAM;QACZ,cA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ACzD,oFAAuD,CAAA;IACvD,oFAAuD,CAAA;IACvD,iGAAwE,CAAA;IACxE,2GAA8E,CAAA;IAC9E,yGAA4E,CAAA;IAC5E,2GAA8E,CAAA;IAC9E,yGAAgF,CAAA;IAChF,mHAAsF,CAAA;IACtF,kHAAoF,CAAA;IACpF,mFAAyD,CAAA;IACzD,8FAA+D,CAAA;IAC/D,4FAA6D,CAAA;AAC/D,CAAC,EAxCW,sBAAsB,KAAtB,sBAAsB,QAwCjC;AAED,MAAM,CAAN,IAAY,YAiBX;AAjBD,WAAY,YAAY;IACtB,uDAAuC,CAAA;IACvC,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IACrB,mDAAmC,CAAA;IACnC,iDAAiC,CAAA;IACjC,mCAAmB,CAAA;IACnB,2BAAW,CAAA;IACX,yDAAyC,CAAA;IACzC,mCAAmB,CAAA;IACnB,yDAAyC,CAAA;IACzC,2DAA2C,CAAA;IAC3C,2DAA2C,CAAA;IAC3C,mCAAmB,CAAA;IACnB,6CAA6B,CAAA;IAC7B,yDAAyC,CAAA;IACzC,iFAAiE,CAAA;AACnE,CAAC,EAjBW,YAAY,KAAZ,YAAY,QAiBvB;AAED,MAAM,CAAN,IAAY,wBAEX;AAFD,WAAY,wBAAwB;IAClC,2FAAkB,CAAA;AACpB,CAAC,EAFW,wBAAwB,KAAxB,wBAAwB,QAEnC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,4BAGX;AAHD,WAAY,4BAA4B;IACtC,yFAAS,CAAA;IACT,6FAAW,CAAA;AACb,CAAC,EAHW,4BAA4B,KAA5B,4BAA4B,QAGvC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,mHAAiC,CAAA;IACjC,6GAA8B,CAAA;AAChC,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport interface PartitionKeyRangePropertiesNames {\n // Partition Key Range Constants\n MinInclusive: \"minInclusive\";\n MaxExclusive: \"maxExclusive\";\n Id: \"id\";\n}\n\n/**\n * @hidden\n */\nexport const Constants = {\n HttpHeaders: {\n Authorization: \"authorization\",\n ETag: \"etag\",\n MethodOverride: \"X-HTTP-Method\",\n Slug: \"Slug\",\n ContentType: \"Content-Type\",\n LastModified: \"Last-Modified\",\n ContentEncoding: \"Content-Encoding\",\n CharacterSet: \"CharacterSet\",\n UserAgent: \"User-Agent\",\n CustomUserAgent: \"x-ms-useragent\",\n IfModifiedSince: \"If-Modified-Since\",\n IfMatch: \"If-Match\",\n IfNoneMatch: \"If-None-Match\",\n ContentLength: \"Content-Length\",\n AcceptEncoding: \"Accept-Encoding\",\n KeepAlive: \"Keep-Alive\",\n CacheControl: \"Cache-Control\",\n TransferEncoding: \"Transfer-Encoding\",\n ContentLanguage: \"Content-Language\",\n ContentLocation: \"Content-Location\",\n ContentMd5: \"Content-Md5\",\n ContentRange: \"Content-Range\",\n Accept: \"Accept\",\n AcceptCharset: \"Accept-Charset\",\n AcceptLanguage: \"Accept-Language\",\n IfRange: \"If-Range\",\n IfUnmodifiedSince: \"If-Unmodified-Since\",\n MaxForwards: \"Max-Forwards\",\n ProxyAuthorization: \"Proxy-Authorization\",\n AcceptRanges: \"Accept-Ranges\",\n ProxyAuthenticate: \"Proxy-Authenticate\",\n RetryAfter: \"Retry-After\",\n SetCookie: \"Set-Cookie\",\n WwwAuthenticate: \"Www-Authenticate\",\n Origin: \"Origin\",\n Host: \"Host\",\n AccessControlAllowOrigin: \"Access-Control-Allow-Origin\",\n AccessControlAllowHeaders: \"Access-Control-Allow-Headers\",\n KeyValueEncodingFormat: \"application/x-www-form-urlencoded\",\n WrapAssertionFormat: \"wrap_assertion_format\",\n WrapAssertion: \"wrap_assertion\",\n WrapScope: \"wrap_scope\",\n SimpleToken: \"SWT\",\n HttpDate: \"date\",\n Prefer: \"Prefer\",\n Location: \"Location\",\n Referer: \"referer\",\n A_IM: \"A-IM\",\n PreferReturnMinimal: \"return=minimal\",\n\n // Query\n Query: \"x-ms-documentdb-query\",\n IsQuery: \"x-ms-documentdb-isquery\",\n IsQueryPlan: \"x-ms-cosmos-is-query-plan-request\",\n SupportedQueryFeatures: \"x-ms-cosmos-supported-query-features\",\n QueryVersion: \"x-ms-cosmos-query-version\",\n\n // Our custom Azure Cosmos DB headers\n Continuation: \"x-ms-continuation\",\n ContinuationToken: \"x-ms-continuation-token\",\n PageSize: \"x-ms-max-item-count\",\n ItemCount: \"x-ms-item-count\",\n ChangeFeedWireFormatVersion: \"x-ms-cosmos-changefeed-wire-format-version\",\n\n // Request sender generated. Simply echoed by backend.\n ActivityId: \"x-ms-activity-id\",\n CorrelatedActivityId: \"x-ms-cosmos-correlated-activityid\",\n PreTriggerInclude: \"x-ms-documentdb-pre-trigger-include\",\n PreTriggerExclude: \"x-ms-documentdb-pre-trigger-exclude\",\n PostTriggerInclude: \"x-ms-documentdb-post-trigger-include\",\n PostTriggerExclude: \"x-ms-documentdb-post-trigger-exclude\",\n IndexingDirective: \"x-ms-indexing-directive\",\n SessionToken: \"x-ms-session-token\",\n ConsistencyLevel: \"x-ms-consistency-level\",\n XDate: \"x-ms-date\",\n CollectionPartitionInfo: \"x-ms-collection-partition-info\",\n CollectionServiceInfo: \"x-ms-collection-service-info\",\n // Deprecated, use RetryAfterInMs instead.\n RetryAfterInMilliseconds: \"x-ms-retry-after-ms\",\n RetryAfterInMs: \"x-ms-retry-after-ms\",\n IsFeedUnfiltered: \"x-ms-is-feed-unfiltered\",\n ResourceTokenExpiry: \"x-ms-documentdb-expiry-seconds\",\n EnableScanInQuery: \"x-ms-documentdb-query-enable-scan\",\n EmitVerboseTracesInQuery: \"x-ms-documentdb-query-emit-traces\",\n EnableCrossPartitionQuery: \"x-ms-documentdb-query-enablecrosspartition\",\n ParallelizeCrossPartitionQuery: \"x-ms-documentdb-query-parallelizecrosspartitionquery\",\n ResponseContinuationTokenLimitInKB: \"x-ms-documentdb-responsecontinuationtokenlimitinkb\",\n SDKSupportedCapabilities: \"x-ms-cosmos-sdk-supportedcapabilities\",\n\n // QueryMetrics\n // Request header to tell backend to give you query metrics.\n PopulateQueryMetrics: \"x-ms-documentdb-populatequerymetrics\",\n // Response header that holds the serialized version of query metrics.\n QueryMetrics: \"x-ms-documentdb-query-metrics\",\n\n // IndexMetrics\n // Request header to tell backend to give you index metrics.\n PopulateIndexMetrics: \"x-ms-cosmos-populateindexmetrics-V2\",\n // Response header that holds the serialized version of index metrics.\n IndexUtilization: \"x-ms-cosmos-index-utilization\",\n // Version headers and values\n Version: \"x-ms-version\",\n\n // Owner name\n OwnerFullName: \"x-ms-alt-content-path\",\n\n // Owner ID used for name based request in session token.\n OwnerId: \"x-ms-content-path\",\n\n // Partition Key\n PartitionKey: \"x-ms-documentdb-partitionkey\",\n PartitionKeyRangeID: \"x-ms-documentdb-partitionkeyrangeid\",\n\n // Epk Range headers\n StartEpk: \"x-ms-start-epk\",\n EndEpk: \"x-ms-end-epk\",\n\n // Read Feed Type\n ReadFeedKeyType: \"x-ms-read-key-type\",\n\n // Quota Info\n MaxEntityCount: \"x-ms-root-entity-max-count\",\n CurrentEntityCount: \"x-ms-root-entity-current-count\",\n CollectionQuotaInMb: \"x-ms-collection-quota-mb\",\n CollectionCurrentUsageInMb: \"x-ms-collection-usage-mb\",\n MaxMediaStorageUsageInMB: \"x-ms-max-media-storage-usage-mb\",\n CurrentMediaStorageUsageInMB: \"x-ms-media-storage-usage-mb\",\n RequestCharge: \"x-ms-request-charge\",\n PopulateQuotaInfo: \"x-ms-documentdb-populatequotainfo\",\n MaxResourceQuota: \"x-ms-resource-quota\",\n\n // Offer header\n OfferType: \"x-ms-offer-type\",\n OfferThroughput: \"x-ms-offer-throughput\",\n AutoscaleSettings: \"x-ms-cosmos-offer-autopilot-settings\",\n\n // Custom RUs/minute headers\n DisableRUPerMinuteUsage: \"x-ms-documentdb-disable-ru-per-minute-usage\",\n IsRUPerMinuteUsed: \"x-ms-documentdb-is-ru-per-minute-used\",\n OfferIsRUPerMinuteThroughputEnabled: \"x-ms-offer-is-ru-per-minute-throughput-enabled\",\n\n // Index progress headers\n IndexTransformationProgress: \"x-ms-documentdb-collection-index-transformation-progress\",\n LazyIndexingProgress: \"x-ms-documentdb-collection-lazy-indexing-progress\",\n\n // Upsert header\n IsUpsert: \"x-ms-documentdb-is-upsert\",\n\n // Sub status of the error\n SubStatus: \"x-ms-substatus\",\n\n // StoredProcedure related headers\n EnableScriptLogging: \"x-ms-documentdb-script-enable-logging\",\n ScriptLogResults: \"x-ms-documentdb-script-log-results\",\n\n // Multi-Region Write\n ALLOW_MULTIPLE_WRITES: \"x-ms-cosmos-allow-tentative-writes\",\n\n // Bulk/Batch header\n IsBatchRequest: \"x-ms-cosmos-is-batch-request\",\n IsBatchAtomic: \"x-ms-cosmos-batch-atomic\",\n BatchContinueOnError: \"x-ms-cosmos-batch-continue-on-error\",\n\n // Dedicated Gateway Headers\n DedicatedGatewayPerRequestCacheStaleness: \"x-ms-dedicatedgateway-max-age\",\n DedicatedGatewayPerRequestBypassCache: \"x-ms-dedicatedgateway-bypass-cache\",\n\n // Cache Refresh header\n ForceRefresh: \"x-ms-force-refresh\",\n\n // Throughput related headers\n PriorityLevel: \"x-ms-cosmos-priority-level\",\n ThroughputBucket: \"x-ms-cosmos-throughput-bucket\",\n\n // Encryption Headers\n IsClientEncryptedHeader: \"x-ms-cosmos-is-client-encrypted\",\n IntendedCollectionHeader: \"x-ms-cosmos-intended-collection-rid\",\n DatabaseRidHeader: \"x-ms-cosmos-database-rid\",\n AllowCachedReadsHeader: \"x-ms-cosmos-allow-cachedreads\",\n },\n // ThrottledRequests Retry policy default values\n ThrottledRequestMaxRetryAttemptCount: 9,\n ThrottledRequestMaxWaitTimeInSeconds: 30,\n ThrottledRequestFixedRetryIntervalInMs: 0,\n\n // GlobalDB related constants\n WritableLocations: \"writableLocations\",\n ReadableLocations: \"readableLocations\",\n LocationUnavailableExpirationTimeInMs: 5 * 60 * 1000, // 5 minutes\n StalePartitionUnavailabilityRefreshIntervalInMs: 1 * 60 * 1000, // 1 minute\n AllowedPartitionUnavailabilityDurationInMs: 5 * 60 * 1000, // 5 minutes\n ReadRequestFailureCountThreshold: 10,\n WriteRequestFailureCountThreshold: 5,\n ConsecutiveFailureCountResetIntervalInMS: 1000 * 60 * 1, // 1 minute\n\n // ServiceDocument Resource\n ENABLE_MULTIPLE_WRITABLE_LOCATIONS: \"enableMultipleWriteLocations\",\n EnablePerPartitionFailover: \"enablePerPartitionFailoverBehavior\",\n\n // Background refresh time\n DefaultUnavailableLocationExpirationTimeMS: 5 * 60 * 1000,\n\n // Client generated retry count response header\n ThrottleRetryCount: \"x-ms-throttle-retry-count\",\n ThrottleRetryWaitTimeInMs: \"x-ms-throttle-retry-wait-time-ms\",\n\n // Platform\n CurrentVersion: \"2020-07-15\",\n AzureNamespace: \"Azure.Cosmos\",\n AzurePackageName: \"@azure/cosmos\",\n SDKName: \"azure-cosmos-js\",\n SDKVersion: \"4.9.1\",\n\n // Diagnostics\n CosmosDbDiagnosticLevelEnvVarName: \"AZURE_COSMOSDB_DIAGNOSTICS_LEVEL\",\n\n // Bulk Operations\n DefaultMaxBulkRequestBodySizeInBytes: 220201,\n MaxBulkOperationsCount: 100,\n BulkMaxDegreeOfConcurrency: 20,\n\n // Encryption\n Encryption: {\n DiagnosticsDecryptOperation: \"Decrypt\",\n DiagnosticsDuration: \"Duration in milliseconds\",\n DiagnosticsEncryptionDiagnostics: \"EncryptionDiagnostics\",\n DiagnosticsEncryptOperation: \"Encrypt\",\n DiagnosticsPropertiesEncryptedCount: \"Properties Encrypted Count\",\n DiagnosticsPropertiesDecryptedCount: \"Properties Decrypted Count\",\n DiagnosticsStartTime: \"Start time\",\n },\n\n Quota: {\n CollectionSize: \"collectionSize\",\n },\n\n Path: {\n Root: \"/\",\n DatabasesPathSegment: \"dbs\",\n CollectionsPathSegment: \"colls\",\n UsersPathSegment: \"users\",\n DocumentsPathSegment: \"docs\",\n PermissionsPathSegment: \"permissions\",\n StoredProceduresPathSegment: \"sprocs\",\n TriggersPathSegment: \"triggers\",\n UserDefinedFunctionsPathSegment: \"udfs\",\n ConflictsPathSegment: \"conflicts\",\n AttachmentsPathSegment: \"attachments\",\n PartitionKeyRangesPathSegment: \"pkranges\",\n SchemasPathSegment: \"schemas\",\n OffersPathSegment: \"offers\",\n TopologyPathSegment: \"topology\",\n DatabaseAccountPathSegment: \"databaseaccount\",\n },\n\n PartitionKeyRange: {\n // Partition Key Range Constants\n MinInclusive: \"minInclusive\",\n MaxExclusive: \"maxExclusive\",\n Id: \"id\",\n } as PartitionKeyRangePropertiesNames,\n\n QueryRangeConstants: {\n // Partition Key Range Constants\n MinInclusive: \"minInclusive\",\n MaxExclusive: \"maxExclusive\",\n min: \"min\",\n },\n\n /**\n * @deprecated Use EffectivePartitionKeyConstants instead\n */\n EffectiveParitionKeyConstants: {\n MinimumInclusiveEffectivePartitionKey: \"\",\n MaximumExclusiveEffectivePartitionKey: \"FF\",\n },\n\n EffectivePartitionKeyConstants: {\n MinimumInclusiveEffectivePartitionKey: \"\",\n MaximumExclusiveEffectivePartitionKey: \"FF\",\n },\n\n // Changefeed AllVersionsAndDeletesMode formatting version\n AllVersionsAndDeletesChangeFeedWireFormatVersion: \"2021-09-15\",\n ChangeFeedIfNoneMatchStartFromNowHeader: \"*\",\n // Default TTL for encryption caches is 2 hrs (7200 sec)\n DefaultEncryptionCacheTimeToLiveInSeconds: 7200,\n // Timeout to clear encryption related cache\n EncryptionCacheRefreshIntervalInMs: 60000, // 1 minute\n\n RequestTimeoutForReadsInMs: 2000, // 2 seconds\n};\n\nexport const AAD_DEFAULT_SCOPE = \"https://cosmos.azure.com/.default\";\nexport const AAD_AUTH_PREFIX = \"type=aad&ver=1.0&sig=\";\nexport const AAD_RESOURCE_NOT_FOUND_ERROR = \"AADSTS500011\";\n\n/**\n * @internal\n * Internal query execution constants - not part of public API\n */\nconst QueryExecution = {\n /** Default page size for query execution when maxItemCount is not specified */\n DEFAULT_PAGE_SIZE: 10,\n /** Default maximum buffer size for vector search queries */\n DEFAULT_MAX_VECTOR_SEARCH_BUFFER_SIZE: 50000,\n} as const;\n\n/**\n * @internal\n * Export for internal SDK use only\n */\nexport { QueryExecution };\n\n/**\n * @hidden\n */\nexport enum ResourceType {\n none = \"\",\n database = \"dbs\",\n offer = \"offers\",\n user = \"users\",\n permission = \"permissions\",\n container = \"colls\",\n conflicts = \"conflicts\",\n sproc = \"sprocs\",\n udf = \"udfs\",\n trigger = \"triggers\",\n item = \"docs\",\n pkranges = \"pkranges\",\n partitionkey = \"partitionKey\",\n /** resource representing client encryption keys to encrypt/decrypt data */\n clientencryptionkey = \"clientencryptionkeys\",\n}\n\n/**\n * @hidden\n */\nexport enum HTTPMethod {\n get = \"GET\",\n patch = \"PATCH\",\n post = \"POST\",\n put = \"PUT\",\n delete = \"DELETE\",\n}\n\n/**\n * @hidden\n */\nexport enum OperationType {\n Create = \"create\",\n Replace = \"replace\",\n Upsert = \"upsert\",\n Delete = \"delete\",\n Read = \"read\",\n Query = \"query\",\n Execute = \"execute\",\n Batch = \"batch\",\n Patch = \"patch\",\n}\n\n/**\n * @hidden\n */\nexport enum CosmosKeyType {\n PrimaryMaster = \"PRIMARY_MASTER\",\n SecondaryMaster = \"SECONDARY_MASTER\",\n PrimaryReadOnly = \"PRIMARY_READONLY\",\n SecondaryReadOnly = \"SECONDARY_READONLY\",\n}\n\n/**\n * @hidden\n */\nexport enum CosmosContainerChildResourceKind {\n Item = \"ITEM\",\n StoredProcedure = \"STORED_PROCEDURE\",\n UserDefinedFunction = \"USER_DEFINED_FUNCTION\",\n Trigger = \"TRIGGER\",\n}\n/**\n * @hidden\n */\nexport enum PermissionScopeValues {\n /**\n * Values which set permission Scope applicable to control plane related operations.\n */\n ScopeAccountReadValue = 0x0001,\n ScopeAccountListDatabasesValue = 0x0002,\n ScopeDatabaseReadValue = 0x0004,\n ScopeDatabaseReadOfferValue = 0x0008,\n ScopeDatabaseListContainerValue = 0x0010,\n ScopeContainerReadValue = 0x0020,\n ScopeContainerReadOfferValue = 0x0040,\n\n ScopeAccountCreateDatabasesValue = 0x0001,\n ScopeAccountDeleteDatabasesValue = 0x0002,\n ScopeDatabaseDeleteValue = 0x0004,\n ScopeDatabaseReplaceOfferValue = 0x0008,\n ScopeDatabaseCreateContainerValue = 0x0010,\n ScopeDatabaseDeleteContainerValue = 0x0020,\n ScopeContainerReplaceValue = 0x0040,\n ScopeContainerDeleteValue = 0x0080,\n ScopeContainerReplaceOfferValue = 0x0100,\n\n ScopeAccountReadAllAccessValue = 0xffff,\n ScopeDatabaseReadAllAccessValue = PermissionScopeValues.ScopeDatabaseReadValue |\n PermissionScopeValues.ScopeDatabaseReadOfferValue |\n PermissionScopeValues.ScopeDatabaseListContainerValue |\n PermissionScopeValues.ScopeContainerReadValue |\n PermissionScopeValues.ScopeContainerReadOfferValue,\n\n ScopeContainersReadAllAccessValue = PermissionScopeValues.ScopeContainerReadValue |\n PermissionScopeValues.ScopeContainerReadOfferValue,\n\n ScopeAccountWriteAllAccessValue = 0xffff,\n ScopeDatabaseWriteAllAccessValue = PermissionScopeValues.ScopeDatabaseDeleteValue |\n PermissionScopeValues.ScopeDatabaseReplaceOfferValue |\n PermissionScopeValues.ScopeDatabaseCreateContainerValue |\n PermissionScopeValues.ScopeDatabaseDeleteContainerValue |\n PermissionScopeValues.ScopeContainerReplaceValue |\n PermissionScopeValues.ScopeContainerDeleteValue |\n PermissionScopeValues.ScopeContainerReplaceOfferValue,\n\n ScopeContainersWriteAllAccessValue = PermissionScopeValues.ScopeContainerReplaceValue |\n PermissionScopeValues.ScopeContainerDeleteValue |\n PermissionScopeValues.ScopeContainerReplaceOfferValue,\n\n /**\n * Values which set permission Scope applicable to data plane related operations.\n */\n ScopeContainerExecuteQueriesValue = 0x00000001,\n ScopeContainerReadFeedsValue = 0x00000002,\n ScopeContainerReadStoredProceduresValue = 0x00000004,\n ScopeContainerReadUserDefinedFunctionsValue = 0x00000008,\n ScopeContainerReadTriggersValue = 0x00000010,\n ScopeContainerReadConflictsValue = 0x00000020,\n ScopeItemReadValue = 0x00000040,\n ScopeStoredProcedureReadValue = 0x00000080,\n ScopeUserDefinedFunctionReadValue = 0x00000100,\n ScopeTriggerReadValue = 0x00000200,\n\n ScopeContainerCreateItemsValue = 0x00000001,\n ScopeContainerReplaceItemsValue = 0x00000002,\n ScopeContainerUpsertItemsValue = 0x00000004,\n ScopeContainerDeleteItemsValue = 0x00000008,\n ScopeContainerCreateStoredProceduresValue = 0x00000010,\n ScopeContainerReplaceStoredProceduresValue = 0x00000020,\n ScopeContainerDeleteStoredProceduresValue = 0x00000040,\n ScopeContainerExecuteStoredProceduresValue = 0x00000080,\n ScopeContainerCreateTriggersValue = 0x00000100,\n ScopeContainerReplaceTriggersValue = 0x00000200,\n ScopeContainerDeleteTriggersValue = 0x00000400,\n ScopeContainerCreateUserDefinedFunctionsValue = 0x00000800,\n ScopeContainerReplaceUserDefinedFunctionsValue = 0x00001000,\n ScopeContainerDeleteUserDefinedFunctionSValue = 0x00002000,\n ScopeContainerDeleteCONFLICTSValue = 0x00004000,\n ScopeItemReplaceValue = 0x00010000,\n ScopeItemUpsertValue = 0x00020000,\n ScopeItemDeleteValue = 0x00040000,\n ScopeStoredProcedureReplaceValue = 0x00100000,\n ScopeStoredProcedureDeleteValue = 0x00200000,\n ScopeStoredProcedureExecuteValue = 0x00400000,\n ScopeUserDefinedFunctionReplaceValue = 0x00800000,\n ScopeUserDefinedFunctionDeleteValue = 0x01000000,\n ScopeTriggerReplaceValue = 0x02000000,\n ScopeTriggerDeleteValue = 0x04000000,\n\n ScopeContainerReadAllAccessValue = 0xffffffff,\n ScopeItemReadAllAccessValue = PermissionScopeValues.ScopeContainerExecuteQueriesValue |\n PermissionScopeValues.ScopeItemReadValue,\n ScopeContainerWriteAllAccessValue = 0xffffffff,\n ScopeItemWriteAllAccessValue = PermissionScopeValues.ScopeContainerCreateItemsValue |\n PermissionScopeValues.ScopeContainerReplaceItemsValue |\n PermissionScopeValues.ScopeContainerUpsertItemsValue |\n PermissionScopeValues.ScopeContainerDeleteItemsValue |\n PermissionScopeValues.ScopeItemReplaceValue |\n PermissionScopeValues.ScopeItemUpsertValue |\n PermissionScopeValues.ScopeItemDeleteValue,\n\n NoneValue = 0,\n}\n/**\n * @hidden\n */\nexport enum SasTokenPermissionKind {\n ContainerCreateItems = PermissionScopeValues.ScopeContainerCreateItemsValue,\n ContainerReplaceItems = PermissionScopeValues.ScopeContainerReplaceItemsValue,\n ContainerUpsertItems = PermissionScopeValues.ScopeContainerUpsertItemsValue,\n ContainerDeleteItems = PermissionScopeValues.ScopeContainerDeleteValue,\n ContainerExecuteQueries = PermissionScopeValues.ScopeContainerExecuteQueriesValue,\n ContainerReadFeeds = PermissionScopeValues.ScopeContainerReadFeedsValue,\n ContainerCreateStoreProcedure = PermissionScopeValues.ScopeContainerCreateStoredProceduresValue,\n ContainerReadStoreProcedure = PermissionScopeValues.ScopeContainerReadStoredProceduresValue,\n ContainerReplaceStoreProcedure = PermissionScopeValues.ScopeContainerReplaceStoredProceduresValue,\n ContainerDeleteStoreProcedure = PermissionScopeValues.ScopeContainerDeleteStoredProceduresValue,\n ContainerCreateTriggers = PermissionScopeValues.ScopeContainerCreateTriggersValue,\n ContainerReadTriggers = PermissionScopeValues.ScopeContainerReadTriggersValue,\n ContainerReplaceTriggers = PermissionScopeValues.ScopeContainerReplaceTriggersValue,\n ContainerDeleteTriggers = PermissionScopeValues.ScopeContainerDeleteTriggersValue,\n ContainerCreateUserDefinedFunctions = PermissionScopeValues.ScopeContainerCreateUserDefinedFunctionsValue,\n ContainerReadUserDefinedFunctions = PermissionScopeValues.ScopeContainerReadUserDefinedFunctionsValue,\n ContainerReplaceUserDefinedFunctions = PermissionScopeValues.ScopeContainerReplaceUserDefinedFunctionsValue,\n ContainerDeleteUserDefinedFunctions = PermissionScopeValues.ScopeContainerDeleteUserDefinedFunctionSValue,\n ContainerExecuteStoredProcedure = PermissionScopeValues.ScopeContainerExecuteStoredProceduresValue,\n ContainerReadConflicts = PermissionScopeValues.ScopeContainerReadConflictsValue,\n ContainerDeleteConflicts = PermissionScopeValues.ScopeContainerDeleteCONFLICTSValue,\n ContainerReadAny = PermissionScopeValues.ScopeContainerReadOfferValue,\n ContainerFullAccess = PermissionScopeValues.ScopeContainerReadAllAccessValue,\n ItemReadAny = PermissionScopeValues.ScopeItemReplaceValue,\n ItemFullAccess = PermissionScopeValues.ScopeItemReadAllAccessValue,\n ItemRead = PermissionScopeValues.ScopeItemReadValue,\n ItemReplace = PermissionScopeValues.ScopeItemReplaceValue,\n ItemUpsert = PermissionScopeValues.ScopeItemUpsertValue,\n ItemDelete = PermissionScopeValues.ScopeItemDeleteValue,\n StoreProcedureRead = PermissionScopeValues.ScopeStoredProcedureReadValue,\n StoreProcedureReplace = PermissionScopeValues.ScopeStoredProcedureReplaceValue,\n StoreProcedureDelete = PermissionScopeValues.ScopeStoredProcedureDeleteValue,\n StoreProcedureExecute = PermissionScopeValues.ScopeStoredProcedureExecuteValue,\n UserDefinedFuntionRead = PermissionScopeValues.ScopeUserDefinedFunctionReadValue,\n UserDefinedFuntionReplace = PermissionScopeValues.ScopeUserDefinedFunctionReplaceValue,\n UserDefinedFuntionDelete = PermissionScopeValues.ScopeUserDefinedFunctionDeleteValue,\n TriggerRead = PermissionScopeValues.ScopeTriggerReadValue,\n TriggerReplace = PermissionScopeValues.ScopeTriggerReplaceValue,\n TriggerDelete = PermissionScopeValues.ScopeTriggerDeleteValue,\n}\n\nexport enum QueryFeature {\n NonValueAggregate = \"NonValueAggregate\",\n Aggregate = \"Aggregate\",\n Distinct = \"Distinct\",\n MultipleOrderBy = \"MultipleOrderBy\",\n OffsetAndLimit = \"OffsetAndLimit\",\n OrderBy = \"OrderBy\",\n Top = \"Top\",\n CompositeAggregate = \"CompositeAggregate\",\n GroupBy = \"GroupBy\",\n MultipleAggregates = \"MultipleAggregates\",\n NonStreamingOrderBy = \"NonStreamingOrderBy\",\n ListAndSetAggregate = \"ListAndSetAggregate\",\n CountIf = \"CountIf\",\n HybridSearch = \"HybridSearch\",\n WeightedRankFusion = \"WeightedRankFusion\",\n HybridSearchSkipOrderByRewrite = \"HybridSearchSkipOrderByRewrite\",\n}\n\nexport enum SDKSupportedCapabilities {\n PartitionMerge = 1,\n}\n\n/**\n * @hidden\n */\nexport enum PartitionAvailablilityStatus {\n Available,\n Unavailable,\n}\n\n/**\n * @hidden\n */\nexport enum UserAgentFeatureFlags {\n PerPartitionAutomaticFailover = 1,\n PerPartitionCircuitBreaker = 2,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PartitionRangeManager.d.ts","sourceRoot":"","sources":["../../../src/queryExecutionContext/PartitionRangeManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mEAAmE,CAAC;AACpH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;;;GAIG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,oBAAoB,CAA6C;gBAE7D,2BAA2B,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAMxE;;OAEG;IACI,uBAAuB,IAAI,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAIhE;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAMhC;;OAEG;IACI,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIzD;;;OAGG;IACI,uBAAuB,CAAC,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,IAAI;IAQ1F;;OAEG;IACI,oBAAoB,IAAI,OAAO;IAItC;;;;OAIG;IACI,qBAAqB,CAAC,aAAa,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE;IAkBrF;;OAEG;IACI,oBAAoB,CAAC,QA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G,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,IAAI;IAQ1F;;OAEG;IACI,oBAAoB,IAAI,OAAO;IAItC;;;;OAIG;IACI,qBAAqB,CAAC,aAAa,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE;IAkBrF;;OAEG;IACI,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG;QAC7C,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,wBAAwB,EAAE,iBAAiB,GAAG,IAAI,CAAC;KACpD;IAqBM,yBAAyB,CAAC,MAAM,EAAE,+BAA+B,EAAE,GAAG;QAC3E,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,wBAAwB,EAAE,iBAAiB,GAAG,SAAS,CAAC;KACzD;IAsBD;;OAEG;IACI,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG;QAC9C,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,sBAAsB,EAAE,iBAAiB,EAAE,CAAC;QAC5C,yBAAyB,CAAC,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,iBAAiB,CAAA;SAAE,CAAC;KAC7E;CAkCF"}
|
|
@@ -140,6 +140,11 @@ export class PartitionRangeManager {
|
|
|
140
140
|
continue;
|
|
141
141
|
}
|
|
142
142
|
const { itemCount } = value;
|
|
143
|
+
// ASSUMPTION: Backend should respect maxItemCount and return pageSize or fewer items per partition.
|
|
144
|
+
// The logic below expects itemCount (items from a partition) to be <= pageSize.
|
|
145
|
+
// KNOWN ISSUE: Backend currently violates this contract for non-streaming queries (e.g., hybrid queries),
|
|
146
|
+
// returning more items per partition than maxItemCount specified. This causes pagination logic to fail,
|
|
147
|
+
// as ranges with itemCount > pageSize cannot fit and result in endIndex=0.
|
|
143
148
|
if (endIndex + itemCount <= pageSize) {
|
|
144
149
|
lastPartitionBeforeCutoff = { rangeId, mapping: value };
|
|
145
150
|
endIndex += itemCount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PartitionRangeManager.js","sourceRoot":"","sources":["../../../src/queryExecutionContext/PartitionRangeManager.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IACxB,oBAAoB,GAAmC,IAAI,GAAG,EAAE,CAAC;IAEzE,YAAY,2BAA4D;QACtE,IAAI,2BAA2B,EAAE,CAAC;YAChC,IAAI,CAAC,oBAAoB,GAAG,IAAI,GAAG,CAAC,2BAA2B,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED;;OAEG;IACI,uBAAuB;QAC5B,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACK,oBAAoB,CAAC,iBAAqC;QAChE,OAAO,CACL,CAAC,iBAAiB;YAClB,iBAAiB,KAAK,EAAE;YACxB,iBAAiB,KAAK,MAAM;YAC5B,iBAAiB,CAAC,WAAW,EAAE,KAAK,MAAM,CAC3C,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACK,wBAAwB,CAAC,OAAe,EAAE,OAA0B;QAC1E,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED;;OAEG;IACI,2BAA2B,CAAC,OAAe;QAChD,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACI,uBAAuB,CAAC,oBAAoD;QACjF,IAAI,oBAAoB,EAAE,CAAC;YACzB,KAAK,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,oBAAoB,EAA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,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;gBAC5C,SAAS;YACX,CAAC;YAED,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;YAC5B,IAAI,QAAQ,GAAG,SAAS,IAAI,QAAQ,EAAE,CAAC;gBACrC,yBAAyB,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;gBACxD,QAAQ,IAAI,SAAS,CAAC;gBACtB,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC9B,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,oCAAoC;YAC7C,CAAC;QACH,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,CAAC;IAC1F,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { QueryRangeWithContinuationToken } from \"../documents/ContinuationToken/CompositeQueryContinuationToken.js\";\nimport type { QueryRangeMapping } from \"./queryRangeMapping.js\";\n\n/**\n * Manages partition key range mappings for query execution.\n * Handles range operations, offset/limit processing, and distinct query logic.\n * @hidden\n */\nexport class PartitionRangeManager {\n private partitionKeyRangeMap: Map<string, QueryRangeMapping> = new Map();\n\n constructor(initialPartitionKeyRangeMap?: Map<string, QueryRangeMapping>) {\n if (initialPartitionKeyRangeMap) {\n this.partitionKeyRangeMap = new Map(initialPartitionKeyRangeMap);\n }\n }\n\n /**\n * Gets a copy of the current partition key range map for constructor pattern\n */\n public getPartitionKeyRangeMap(): Map<string, QueryRangeMapping> {\n return new Map(this.partitionKeyRangeMap);\n }\n\n /**\n * Checks if a continuation token indicates an exhausted partition\n * @param continuationToken - The continuation token to check\n * @returns true if the partition is exhausted (null, empty, or \"null\" string)\n */\n private isPartitionExhausted(continuationToken: string | undefined): boolean {\n return (\n !continuationToken ||\n continuationToken === \"\" ||\n continuationToken === \"null\" ||\n continuationToken.toLowerCase() === \"null\"\n );\n }\n\n /**\n * Adds a range mapping to the partition key range map\n * Does not allow updates to existing keys - only new additions\n * @param rangeId - Unique identifier for the partition range\n * @param mapping - The QueryRangeMapping to add\n */\n private addPartitionRangeMapping(rangeId: string, mapping: QueryRangeMapping): void {\n if (!this.partitionKeyRangeMap.has(rangeId)) {\n this.partitionKeyRangeMap.set(rangeId, mapping);\n }\n }\n\n /**\n * Removes a range mapping from the partition key range map\n */\n public removePartitionRangeMapping(rangeId: string): void {\n this.partitionKeyRangeMap.delete(rangeId);\n }\n\n /**\n * Updates the partition key range map with new mappings from the endpoint response\n * @param partitionKeyRangeMap - Map of range IDs to QueryRangeMapping objects\n */\n public addPartitionKeyRangeMap(partitionKeyRangeMap: Map<string, QueryRangeMapping>): void {\n if (partitionKeyRangeMap) {\n for (const [rangeId, mapping] of partitionKeyRangeMap) {\n this.addPartitionRangeMapping(rangeId, mapping);\n }\n }\n }\n\n /**\n * Checks if there are any unprocessed ranges in the sliding window\n */\n public hasUnprocessedRanges(): boolean {\n return this.partitionKeyRangeMap.size > 0;\n }\n\n /**\n * Removes exhausted(fully drained) ranges from the given range mappings\n * @param rangeMappings - Array of range mappings to filter\n * @returns Filtered array without exhausted ranges\n */\n public removeExhaustedRanges(rangeMappings: QueryRangeMapping[]): QueryRangeMapping[] {\n if (!rangeMappings || !Array.isArray(rangeMappings)) {\n return [];\n }\n\n return rangeMappings.filter((mapping) => {\n if (!mapping) {\n return false;\n }\n const isExhausted = this.isPartitionExhausted(mapping.continuationToken);\n\n if (isExhausted) {\n return false;\n }\n return true;\n });\n }\n\n /**\n * Processes ranges for ORDER BY queries\n */\n public processOrderByRanges(pageSize: number): {\n endIndex: number;\n processedRanges: string[];\n lastRangeBeforePageLimit: QueryRangeMapping | null;\n } {\n let endIndex = 0;\n const processedRanges: string[] = [];\n let lastRangeBeforePageLimit: QueryRangeMapping | null = null;\n let rangeIndex = 0;\n for (const [rangeId, value] of this.partitionKeyRangeMap) {\n rangeIndex++;\n const { itemCount } = value;\n // Check if this complete range fits within remaining page size capacity\n if (endIndex + itemCount <= pageSize) {\n lastRangeBeforePageLimit = value;\n endIndex += itemCount;\n processedRanges.push(rangeId);\n } else {\n break;\n }\n }\n\n return { endIndex, processedRanges, lastRangeBeforePageLimit };\n }\n\n public processEmptyOrderByRanges(ranges: QueryRangeWithContinuationToken[]): {\n endIndex: number;\n processedRanges: string[];\n lastRangeBeforePageLimit: QueryRangeMapping | undefined;\n } {\n const endIndex = 0;\n const processedRanges: string[] = [];\n let lastRangeBeforePageLimit: QueryRangeMapping | undefined;\n\n // since there is no data returned add all the ids to processed ranges\n for (const [rangeId, _] of this.partitionKeyRangeMap) {\n processedRanges.push(rangeId);\n }\n // search for matching range in the map(min max value exact match) and return that as lastRangeBeforePageLimit\n for (const [_, mapping] of this.partitionKeyRangeMap) {\n if (\n mapping.partitionKeyRange!.minInclusive === ranges[0].queryRange.min &&\n mapping.partitionKeyRange!.maxExclusive === ranges[0].queryRange.max\n ) {\n lastRangeBeforePageLimit = mapping;\n break;\n }\n }\n\n return { endIndex, processedRanges, lastRangeBeforePageLimit };\n }\n /**\n * Processes ranges for parallel queries - multi-range aggregation\n */\n public processParallelRanges(pageSize: number): {\n endIndex: number;\n processedRanges: string[];\n processedRangeMappings: QueryRangeMapping[];\n lastPartitionBeforeCutoff?: { rangeId: string; mapping: QueryRangeMapping };\n } {\n let endIndex = 0;\n const processedRanges: string[] = [];\n const processedRangeMappings: QueryRangeMapping[] = [];\n let rangesAggregatedInCurrentToken = 0;\n let lastPartitionBeforeCutoff: { rangeId: string; mapping: QueryRangeMapping } | undefined;\n\n for (const [rangeId, value] of this.partitionKeyRangeMap) {\n rangesAggregatedInCurrentToken++;\n\n // Validate range data\n if (!value || value.itemCount === undefined) {\n continue;\n }\n\n const { itemCount } = value;\n if (endIndex + itemCount <= pageSize) {\n lastPartitionBeforeCutoff = { rangeId, mapping: value };\n endIndex += itemCount;\n processedRanges.push(rangeId);\n processedRangeMappings.push(value);\n } else {\n break; // No more ranges can fit, exit loop\n }\n }\n\n return { endIndex, processedRanges, processedRangeMappings, lastPartitionBeforeCutoff };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PartitionRangeManager.js","sourceRoot":"","sources":["../../../src/queryExecutionContext/PartitionRangeManager.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IACxB,oBAAoB,GAAmC,IAAI,GAAG,EAAE,CAAC;IAEzE,YAAY,2BAA4D;QACtE,IAAI,2BAA2B,EAAE,CAAC;YAChC,IAAI,CAAC,oBAAoB,GAAG,IAAI,GAAG,CAAC,2BAA2B,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED;;OAEG;IACI,uBAAuB;QAC5B,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACK,oBAAoB,CAAC,iBAAqC;QAChE,OAAO,CACL,CAAC,iBAAiB;YAClB,iBAAiB,KAAK,EAAE;YACxB,iBAAiB,KAAK,MAAM;YAC5B,iBAAiB,CAAC,WAAW,EAAE,KAAK,MAAM,CAC3C,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACK,wBAAwB,CAAC,OAAe,EAAE,OAA0B;QAC1E,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED;;OAEG;IACI,2BAA2B,CAAC,OAAe;QAChD,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACI,uBAAuB,CAAC,oBAAoD;QACjF,IAAI,oBAAoB,EAAE,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AAC,oBAAoB,EAAE,CAAC;YACzD,8BAA8B,EAAE,CAAC;YAEjC,sBAAsB;YACtB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;gBAC5C,SAAS;YACX,CAAC;YAED,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;YAE5B,oGAAoG;YACpG,gFAAgF;YAChF,0GAA0G;YAC1G,wGAAwG;YACxG,2EAA2E;YAC3E,IAAI,QAAQ,GAAG,SAAS,IAAI,QAAQ,EAAE,CAAC;gBACrC,yBAAyB,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;gBACxD,QAAQ,IAAI,SAAS,CAAC;gBACtB,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC9B,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,oCAAoC;YAC7C,CAAC;QACH,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,CAAC;IAC1F,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { QueryRangeWithContinuationToken } from \"../documents/ContinuationToken/CompositeQueryContinuationToken.js\";\nimport type { QueryRangeMapping } from \"./queryRangeMapping.js\";\n\n/**\n * Manages partition key range mappings for query execution.\n * Handles range operations, offset/limit processing, and distinct query logic.\n * @hidden\n */\nexport class PartitionRangeManager {\n private partitionKeyRangeMap: Map<string, QueryRangeMapping> = new Map();\n\n constructor(initialPartitionKeyRangeMap?: Map<string, QueryRangeMapping>) {\n if (initialPartitionKeyRangeMap) {\n this.partitionKeyRangeMap = new Map(initialPartitionKeyRangeMap);\n }\n }\n\n /**\n * Gets a copy of the current partition key range map for constructor pattern\n */\n public getPartitionKeyRangeMap(): Map<string, QueryRangeMapping> {\n return new Map(this.partitionKeyRangeMap);\n }\n\n /**\n * Checks if a continuation token indicates an exhausted partition\n * @param continuationToken - The continuation token to check\n * @returns true if the partition is exhausted (null, empty, or \"null\" string)\n */\n private isPartitionExhausted(continuationToken: string | undefined): boolean {\n return (\n !continuationToken ||\n continuationToken === \"\" ||\n continuationToken === \"null\" ||\n continuationToken.toLowerCase() === \"null\"\n );\n }\n\n /**\n * Adds a range mapping to the partition key range map\n * Does not allow updates to existing keys - only new additions\n * @param rangeId - Unique identifier for the partition range\n * @param mapping - The QueryRangeMapping to add\n */\n private addPartitionRangeMapping(rangeId: string, mapping: QueryRangeMapping): void {\n if (!this.partitionKeyRangeMap.has(rangeId)) {\n this.partitionKeyRangeMap.set(rangeId, mapping);\n }\n }\n\n /**\n * Removes a range mapping from the partition key range map\n */\n public removePartitionRangeMapping(rangeId: string): void {\n this.partitionKeyRangeMap.delete(rangeId);\n }\n\n /**\n * Updates the partition key range map with new mappings from the endpoint response\n * @param partitionKeyRangeMap - Map of range IDs to QueryRangeMapping objects\n */\n public addPartitionKeyRangeMap(partitionKeyRangeMap: Map<string, QueryRangeMapping>): void {\n if (partitionKeyRangeMap) {\n for (const [rangeId, mapping] of partitionKeyRangeMap) {\n this.addPartitionRangeMapping(rangeId, mapping);\n }\n }\n }\n\n /**\n * Checks if there are any unprocessed ranges in the sliding window\n */\n public hasUnprocessedRanges(): boolean {\n return this.partitionKeyRangeMap.size > 0;\n }\n\n /**\n * Removes exhausted(fully drained) ranges from the given range mappings\n * @param rangeMappings - Array of range mappings to filter\n * @returns Filtered array without exhausted ranges\n */\n public removeExhaustedRanges(rangeMappings: QueryRangeMapping[]): QueryRangeMapping[] {\n if (!rangeMappings || !Array.isArray(rangeMappings)) {\n return [];\n }\n\n return rangeMappings.filter((mapping) => {\n if (!mapping) {\n return false;\n }\n const isExhausted = this.isPartitionExhausted(mapping.continuationToken);\n\n if (isExhausted) {\n return false;\n }\n return true;\n });\n }\n\n /**\n * Processes ranges for ORDER BY queries\n */\n public processOrderByRanges(pageSize: number): {\n endIndex: number;\n processedRanges: string[];\n lastRangeBeforePageLimit: QueryRangeMapping | null;\n } {\n let endIndex = 0;\n const processedRanges: string[] = [];\n let lastRangeBeforePageLimit: QueryRangeMapping | null = null;\n let rangeIndex = 0;\n for (const [rangeId, value] of this.partitionKeyRangeMap) {\n rangeIndex++;\n const { itemCount } = value;\n // Check if this complete range fits within remaining page size capacity\n if (endIndex + itemCount <= pageSize) {\n lastRangeBeforePageLimit = value;\n endIndex += itemCount;\n processedRanges.push(rangeId);\n } else {\n break;\n }\n }\n\n return { endIndex, processedRanges, lastRangeBeforePageLimit };\n }\n\n public processEmptyOrderByRanges(ranges: QueryRangeWithContinuationToken[]): {\n endIndex: number;\n processedRanges: string[];\n lastRangeBeforePageLimit: QueryRangeMapping | undefined;\n } {\n const endIndex = 0;\n const processedRanges: string[] = [];\n let lastRangeBeforePageLimit: QueryRangeMapping | undefined;\n\n // since there is no data returned add all the ids to processed ranges\n for (const [rangeId, _] of this.partitionKeyRangeMap) {\n processedRanges.push(rangeId);\n }\n // search for matching range in the map(min max value exact match) and return that as lastRangeBeforePageLimit\n for (const [_, mapping] of this.partitionKeyRangeMap) {\n if (\n mapping.partitionKeyRange!.minInclusive === ranges[0].queryRange.min &&\n mapping.partitionKeyRange!.maxExclusive === ranges[0].queryRange.max\n ) {\n lastRangeBeforePageLimit = mapping;\n break;\n }\n }\n\n return { endIndex, processedRanges, lastRangeBeforePageLimit };\n }\n /**\n * Processes ranges for parallel queries - multi-range aggregation\n */\n public processParallelRanges(pageSize: number): {\n endIndex: number;\n processedRanges: string[];\n processedRangeMappings: QueryRangeMapping[];\n lastPartitionBeforeCutoff?: { rangeId: string; mapping: QueryRangeMapping };\n } {\n let endIndex = 0;\n const processedRanges: string[] = [];\n const processedRangeMappings: QueryRangeMapping[] = [];\n let rangesAggregatedInCurrentToken = 0;\n let lastPartitionBeforeCutoff: { rangeId: string; mapping: QueryRangeMapping } | undefined;\n\n for (const [rangeId, value] of this.partitionKeyRangeMap) {\n rangesAggregatedInCurrentToken++;\n\n // Validate range data\n if (!value || value.itemCount === undefined) {\n continue;\n }\n\n const { itemCount } = value;\n\n // ASSUMPTION: Backend should respect maxItemCount and return pageSize or fewer items per partition.\n // The logic below expects itemCount (items from a partition) to be <= pageSize.\n // KNOWN ISSUE: Backend currently violates this contract for non-streaming queries (e.g., hybrid queries),\n // returning more items per partition than maxItemCount specified. This causes pagination logic to fail,\n // as ranges with itemCount > pageSize cannot fit and result in endIndex=0.\n if (endIndex + itemCount <= pageSize) {\n lastPartitionBeforeCutoff = { rangeId, mapping: value };\n endIndex += itemCount;\n processedRanges.push(rangeId);\n processedRangeMappings.push(value);\n } else {\n break; // No more ranges can fit, exit loop\n }\n }\n\n return { endIndex, processedRanges, processedRangeMappings, lastPartitionBeforeCutoff };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hybridQueryExecutionContext.d.ts","sourceRoot":"","sources":["../../../src/queryExecutionContext/hybridQueryExecutionContext.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,KAAK,EACV,WAAW,EAEX,6BAA6B,EAE7B,UAAU,EACV,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOtD,cAAc;AACd,oBAAY,qCAAqC;IAC/C,aAAa,kBAAkB;IAC/B,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AACD,qBAAa,2BAA4B,YAAW,gBAAgB;IAoBhE,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,6BAA6B;IACrC,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,mBAAmB;IAzB7B,OAAO,CAAC,gCAAgC,CAAmB;IAC3D,OAAO,CAAC,0BAA0B,CAA0B;IAC5D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,KAAK,CAAwC;IACrD,OAAO,CAAC,0BAA0B,CAA6B;IAC/D,OAAO,CAAC,qBAAqB,CAAiB;IAC9C,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,iBAAiB,CAAM;IAC/B,OAAO,CAAC,4BAA4B,CAA4D;IAChG,OAAO,CAAC,4BAA4B,CAA4D;IAChG,OAAO,CAAC,gCAAgC,CACuB;IAC/D,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,MAAM,CAAkE;IAChF,OAAO,CAAC,kBAAkB,CAAiC;IAC3D,OAAO,CAAC,WAAW,CAA8C;IACjE,OAAO,CAAC,iBAAiB,CAAkB;gBAGjC,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,GAAG,YAAY,EAC5B,OAAO,EAAE,WAAW,EACpB,6BAA6B,EAAE,6BAA6B,EAC5D,oBAAoB,EAAE,MAAM,EAC5B,mBAAmB,EAAE,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"hybridQueryExecutionContext.d.ts","sourceRoot":"","sources":["../../../src/queryExecutionContext/hybridQueryExecutionContext.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,KAAK,EACV,WAAW,EAEX,6BAA6B,EAE7B,UAAU,EACV,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,OAAO,KAAK,EAAE,YAAY,EAAE,M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AAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAKzE,iBAAiB;YA2BjB,UAAU;YA6BV,uBAAuB;IA2DrC,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,wBAAwB;YAUlB,KAAK;YAqBL,QAAQ;IAoBtB,OAAO,CAAC,IAAI;IAOZ,OAAO,CAAC,gCAAgC;YAiD1B,oBAAoB;IAuDlC,OAAO,CAAC,gCAAgC;IAsCxC,OAAO,CAAC,uBAAuB;IAmD/B,OAAO,CAAC,4BAA4B;IAmCpC,OAAO,CAAC,eAAe,CAerB;IAEF,OAAO,CAAC,uBAAuB;CAmChC;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC9C"}
|
|
@@ -58,7 +58,12 @@ export class HybridQueryExecutionContext {
|
|
|
58
58
|
if (partitionedQueryExecutionInfo.hybridSearchQueryInfo.requiresGlobalStatistics) {
|
|
59
59
|
const globalStaticsQueryOptions = { maxItemCount: this.pageSize };
|
|
60
60
|
this.globalStatisticsAggregator = new GlobalStatisticsAggregator();
|
|
61
|
-
const globalStatisticsQuery = this.
|
|
61
|
+
const globalStatisticsQuery = typeof this.query === "string"
|
|
62
|
+
? this.partitionedQueryExecutionInfo.hybridSearchQueryInfo.globalStatisticsQuery
|
|
63
|
+
: {
|
|
64
|
+
query: this.partitionedQueryExecutionInfo.hybridSearchQueryInfo.globalStatisticsQuery,
|
|
65
|
+
parameters: this.query?.parameters ?? [],
|
|
66
|
+
};
|
|
62
67
|
const globalStatisticsQueryExecutionInfo = {
|
|
63
68
|
partitionedQueryExecutionInfoVersion: 1,
|
|
64
69
|
queryInfo: {
|
|
@@ -387,7 +392,8 @@ export class HybridQueryExecutionContext {
|
|
|
387
392
|
query: componentQueryInfo.rewrittenQuery,
|
|
388
393
|
parameters: this.query?.parameters ?? [],
|
|
389
394
|
};
|
|
390
|
-
const executionContext = new PipelinedQueryExecutionContext(this.clientContext, this.collectionLink, rewrittenSqlQuerySpec, this.options, componentPartitionExecutionInfo, this.correlatedActivityId, this.emitRawOrderByPayload
|
|
395
|
+
const executionContext = new PipelinedQueryExecutionContext(this.clientContext, this.collectionLink, rewrittenSqlQuerySpec, this.options, componentPartitionExecutionInfo, this.correlatedActivityId, this.emitRawOrderByPayload,
|
|
396
|
+
/* supportsContinuationTokens */ false);
|
|
391
397
|
this.componentsExecutionContext.push(executionContext);
|
|
392
398
|
}
|
|
393
399
|
this.isSingleComponent = this.componentsExecutionContext.length === 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hybridQueryExecutionContext.js","sourceRoot":"","sources":["../../../src/queryExecutionContext/hybridQueryExecutionContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAWnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AAGzF,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAGrF,OAAO,EACL,4CAA4C,EAC5C,UAAU,GACX,MAAM,4BAA4B,CAAC;AAEpC,cAAc;AACd,MAAM,CAAN,IAAY,qCAKX;AALD,WAAY,qCAAqC;IAC/C,wEAA+B,CAAA;IAC/B,oEAA2B,CAAA;IAC3B,8DAAqB,CAAA;IACrB,sDAAa,CAAA;AACf,CAAC,EALW,qCAAqC,KAArC,qCAAqC,QAKhD;AACD,MAAM,OAAO,2BAA2B;IAoB5B;IACA;IACA;IACA;IACA;IACA;IACA;IAzB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C,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAClD,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;YACrE,MAAM,SAAS,GAAG,UAAU,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACpF,MAAM,CAAC,IAAI,CAAC;gBACV,MAAM,EAAE,eAAe;gBACvB,UAAU,EAAE,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;aAC1D,CAAC,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AzureLogger } from \"@azure/logger\";\nimport { createClientLogger } from \"@azure/logger\";\nimport type { ClientContext } from \"../ClientContext.js\";\nimport type { DiagnosticNodeInternal } from \"../diagnostics/DiagnosticNodeInternal.js\";\nimport type {\n FeedOptions,\n GlobalStatistics,\n PartitionedQueryExecutionInfo,\n QueryInfo,\n QueryRange,\n Response,\n} from \"../request/index.js\";\nimport { HybridSearchQueryResult } from \"../request/hybridSearchQueryResult.js\";\nimport { GlobalStatisticsAggregator } from \"./Aggregators/GlobalStatisticsAggregator.js\";\nimport type { CosmosHeaders } from \"./CosmosHeaders.js\";\nimport type { ExecutionContext } from \"./ExecutionContext.js\";\nimport { getInitialHeader, mergeHeaders } from \"./headerUtils.js\";\nimport { ParallelQueryExecutionContext } from \"./parallelQueryExecutionContext.js\";\nimport { PipelinedQueryExecutionContext } from \"./pipelinedQueryExecutionContext.js\";\nimport type { SqlQuerySpec } from \"./SqlQuerySpec.js\";\nimport { type ParallelQueryResult } from \"./parallelQueryResult.js\";\nimport {\n rejectContinuationTokenForUnsupportedQueries,\n QueryTypes,\n} from \"./QueryValidationHelper.js\";\n\n/** @hidden */\nexport enum HybridQueryExecutionContextBaseStates {\n uninitialized = \"uninitialized\",\n initialized = \"initialized\",\n draining = \"draining\",\n done = \"done\",\n}\nexport class HybridQueryExecutionContext implements ExecutionContext {\n private globalStatisticsExecutionContext: ExecutionContext;\n private componentsExecutionContext: ExecutionContext[] = [];\n private pageSize: number;\n private state: HybridQueryExecutionContextBaseStates;\n private globalStatisticsAggregator: GlobalStatisticsAggregator;\n private emitRawOrderByPayload: boolean = true;\n private buffer: HybridSearchQueryResult[] = [];\n private DEFAULT_PAGE_SIZE = 10;\n private TOTAL_WORD_COUNT_PLACEHOLDER = \"documentdb-formattablehybridsearchquery-totalwordcount\";\n private HIT_COUNTS_ARRAY_PLACEHOLDER = \"documentdb-formattablehybridsearchquery-hitcountsarray\";\n private TOTAL_DOCUMENT_COUNT_PLACEHOLDER =\n \"documentdb-formattablehybridsearchquery-totaldocumentcount\";\n private RRF_CONSTANT = 60; // Constant for RRF score calculation\n private logger: AzureLogger = createClientLogger(\"HybridQueryExecutionContext\");\n private hybridSearchResult: HybridSearchQueryResult[] = [];\n private uniqueItems = new Map<string, HybridSearchQueryResult>();\n private isSingleComponent: boolean = false;\n\n constructor(\n private clientContext: ClientContext,\n private collectionLink: string,\n private query: string | SqlQuerySpec,\n private options: FeedOptions,\n private partitionedQueryExecutionInfo: PartitionedQueryExecutionInfo,\n private correlatedActivityId: string,\n private allPartitionsRanges: QueryRange[],\n ) {\n rejectContinuationTokenForUnsupportedQueries(this.options.continuationToken, [\n QueryTypes.hybridSearch(true),\n ]);\n\n this.state = HybridQueryExecutionContextBaseStates.uninitialized;\n this.pageSize = this.options.maxItemCount;\n if (this.pageSize === undefined) {\n this.pageSize = this.DEFAULT_PAGE_SIZE;\n }\n if (partitionedQueryExecutionInfo.hybridSearchQueryInfo.requiresGlobalStatistics) {\n const globalStaticsQueryOptions: FeedOptions = { maxItemCount: this.pageSize };\n this.globalStatisticsAggregator = new GlobalStatisticsAggregator();\n\n const globalStatisticsQuery =\n this.partitionedQueryExecutionInfo.hybridSearchQueryInfo.globalStatisticsQuery;\n const globalStatisticsQueryExecutionInfo: PartitionedQueryExecutionInfo = {\n partitionedQueryExecutionInfoVersion: 1,\n queryInfo: {\n distinctType: \"None\",\n hasSelectValue: false,\n groupByAliasToAggregateType: {},\n rewrittenQuery: globalStatisticsQuery,\n hasNonStreamingOrderBy: false,\n },\n queryRanges: this.allPartitionsRanges,\n };\n\n this.globalStatisticsExecutionContext = new ParallelQueryExecutionContext(\n this.clientContext,\n this.collectionLink,\n globalStatisticsQuery,\n globalStaticsQueryOptions,\n globalStatisticsQueryExecutionInfo,\n this.correlatedActivityId,\n );\n } else {\n this.createComponentExecutionContexts();\n this.state = HybridQueryExecutionContextBaseStates.initialized;\n }\n }\n public async nextItem(diagnosticNode: DiagnosticNodeInternal): Promise<Response<any>> {\n const nextItemRespHeaders = getInitialHeader();\n while (\n (this.state === HybridQueryExecutionContextBaseStates.uninitialized ||\n this.state === HybridQueryExecutionContextBaseStates.initialized) &&\n this.buffer.length === 0\n ) {\n await this.fetchMoreInternal(diagnosticNode, nextItemRespHeaders);\n }\n\n if (this.state === HybridQueryExecutionContextBaseStates.draining && this.buffer.length > 0) {\n return this.drainOne(nextItemRespHeaders);\n } else {\n return this.done(nextItemRespHeaders);\n }\n }\n\n public hasMoreResults(): boolean {\n switch (this.state) {\n case HybridQueryExecutionContextBaseStates.uninitialized:\n return true;\n case HybridQueryExecutionContextBaseStates.initialized:\n return true;\n case HybridQueryExecutionContextBaseStates.draining:\n return this.buffer.length > 0;\n case HybridQueryExecutionContextBaseStates.done:\n return false;\n default:\n return false;\n }\n }\n\n public async fetchMore(diagnosticNode?: DiagnosticNodeInternal): Promise<Response<any>> {\n const fetchMoreRespHeaders = getInitialHeader();\n return this.fetchMoreInternal(diagnosticNode, fetchMoreRespHeaders);\n }\n\n private async fetchMoreInternal(\n diagnosticNode: DiagnosticNodeInternal,\n headers: CosmosHeaders,\n ): Promise<Response<any>> {\n switch (this.state) {\n case HybridQueryExecutionContextBaseStates.uninitialized:\n await this.initialize(diagnosticNode, headers);\n return {\n result: [],\n headers: headers,\n };\n\n case HybridQueryExecutionContextBaseStates.initialized:\n await this.executeComponentQueries(diagnosticNode, headers);\n return {\n result: [],\n headers: headers,\n };\n case HybridQueryExecutionContextBaseStates.draining:\n return this.drain(headers);\n case HybridQueryExecutionContextBaseStates.done:\n return this.done(headers);\n default:\n throw new Error(`Invalid state: ${this.state}`);\n }\n }\n\n private async initialize(\n diagnosticNode: DiagnosticNodeInternal,\n fetchMoreRespHeaders: CosmosHeaders,\n ): Promise<void> {\n try {\n while (this.globalStatisticsExecutionContext.hasMoreResults()) {\n const result = await this.globalStatisticsExecutionContext.fetchMore(diagnosticNode);\n mergeHeaders(fetchMoreRespHeaders, result.headers);\n if (result && result.result) {\n const resultData = (result.result as ParallelQueryResult).buffer;\n for (const item of resultData) {\n const globalStatistics: GlobalStatistics = item;\n if (globalStatistics) {\n // iterate over the components update placeholders from globalStatistics\n this.globalStatisticsAggregator.aggregate(globalStatistics);\n }\n }\n }\n }\n } catch (error) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n throw error;\n }\n\n // create component execution contexts for each component query\n this.createComponentExecutionContexts();\n this.state = HybridQueryExecutionContextBaseStates.initialized;\n }\n\n private async executeComponentQueries(\n diagnosticNode: DiagnosticNodeInternal,\n fetchMoreRespHeaders: CosmosHeaders,\n ): Promise<void> {\n if (this.isSingleComponent) {\n await this.drainSingleComponent(diagnosticNode, fetchMoreRespHeaders);\n return;\n }\n try {\n if (this.options.enableQueryControl) {\n // track componentExecutionContexts with remaining results and call them in LIFO order\n if (this.componentsExecutionContext.length > 0) {\n const componentExecutionContext = this.componentsExecutionContext.pop();\n if (componentExecutionContext.hasMoreResults()) {\n const result = await componentExecutionContext.fetchMore(diagnosticNode);\n mergeHeaders(fetchMoreRespHeaders, result.headers);\n\n const resultData = result.result;\n if (result && resultData) {\n resultData.forEach((item: any) => {\n const hybridItem = HybridSearchQueryResult.create(item);\n if (!this.uniqueItems.has(hybridItem.rid)) {\n this.uniqueItems.set(hybridItem.rid, hybridItem);\n }\n });\n }\n if (componentExecutionContext.hasMoreResults()) {\n this.componentsExecutionContext.push(componentExecutionContext);\n }\n }\n }\n if (this.componentsExecutionContext.length === 0) {\n this.processUniqueItems();\n }\n } else {\n for (const componentExecutionContext of this.componentsExecutionContext) {\n while (componentExecutionContext.hasMoreResults()) {\n const result = await componentExecutionContext.fetchMore(diagnosticNode);\n mergeHeaders(fetchMoreRespHeaders, result.headers);\n\n const resultData = result.result;\n if (result && resultData) {\n resultData.forEach((item: any) => {\n const hybridItem = HybridSearchQueryResult.create(item);\n if (!this.uniqueItems.has(hybridItem.rid)) {\n this.uniqueItems.set(hybridItem.rid, hybridItem);\n }\n });\n }\n }\n }\n this.processUniqueItems();\n }\n } catch (error) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n throw error;\n }\n }\n\n private processUniqueItems(): void {\n this.uniqueItems.forEach((item) => this.hybridSearchResult.push(item));\n if (this.hybridSearchResult.length === 0 || this.hybridSearchResult.length === 1) {\n // return the result as no or one element is present\n this.hybridSearchResult.forEach((item) => this.buffer.push(item.data));\n this.state = HybridQueryExecutionContextBaseStates.draining;\n return;\n }\n\n // Initialize an array to hold ranks for each document\n const componentWeights = this.extractComponentWeights();\n const sortedHybridSearchResult = this.sortHybridSearchResultByRRFScore(\n this.hybridSearchResult,\n componentWeights,\n );\n // store the result to buffer\n // add only data from the sortedHybridSearchResult in the buffer\n sortedHybridSearchResult.forEach((item) => this.buffer.push(item.data));\n this.applySkipAndTakeToBuffer();\n this.state = HybridQueryExecutionContextBaseStates.draining;\n }\n\n private applySkipAndTakeToBuffer(): void {\n const { skip, take } = this.partitionedQueryExecutionInfo.hybridSearchQueryInfo;\n if (skip) {\n this.buffer = skip >= this.buffer.length ? [] : this.buffer.slice(skip);\n }\n if (take) {\n this.buffer = take <= 0 ? [] : this.buffer.slice(0, take);\n }\n }\n\n private async drain(fetchMoreRespHeaders: CosmosHeaders): Promise<Response<any>> {\n try {\n if (this.buffer.length === 0) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n return this.done(fetchMoreRespHeaders);\n }\n const result = this.buffer.slice(0, this.pageSize);\n this.buffer = this.buffer.slice(this.pageSize);\n if (this.buffer.length === 0) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n }\n return {\n result: result,\n headers: fetchMoreRespHeaders,\n };\n } catch (error) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n throw error;\n }\n }\n\n private async drainOne(nextItemRespHeaders: CosmosHeaders): Promise<Response<any>> {\n try {\n if (this.buffer.length === 0) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n return this.done(nextItemRespHeaders);\n }\n const result = this.buffer.shift();\n if (this.buffer.length === 0) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n }\n return {\n result: result,\n headers: nextItemRespHeaders,\n };\n } catch (error) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n throw error;\n }\n }\n\n private done(fetchMoreRespHeaders: CosmosHeaders): Response<any> {\n return {\n result: undefined,\n headers: fetchMoreRespHeaders,\n };\n }\n\n private sortHybridSearchResultByRRFScore(\n hybridSearchResult: HybridSearchQueryResult[],\n componentWeights: ComponentWeight[],\n ): HybridSearchQueryResult[] {\n if (hybridSearchResult.length === 0) {\n return [];\n }\n const ranksArray: { rid: string; ranks: number[] }[] = hybridSearchResult.map((item) => ({\n rid: item.rid,\n ranks: new Array(item.componentScores.length).fill(0),\n }));\n // Compute ranks for each component score\n for (let i = 0; i < hybridSearchResult[0].componentScores.length; i++) {\n // Sort based on the i-th component score\n hybridSearchResult.sort((a, b) =>\n componentWeights[i].comparator(a.componentScores[i], b.componentScores[i]),\n );\n\n // Assign ranks\n let rank = 1;\n for (let j = 0; j < hybridSearchResult.length; j++) {\n if (\n j > 0 &&\n hybridSearchResult[j].componentScores[i] !== hybridSearchResult[j - 1].componentScores[i]\n ) {\n ++rank;\n }\n const rankIndex = ranksArray.findIndex(\n (rankItem) => rankItem.rid === hybridSearchResult[j].rid,\n );\n ranksArray[rankIndex].ranks[i] = rank; // 1-based rank\n }\n }\n\n // Compute RRF scores and sort based on them\n const rrfScores = ranksArray.map((item) => ({\n rid: item.rid,\n rrfScore: this.computeRRFScore(item.ranks, this.RRF_CONSTANT, componentWeights),\n }));\n\n // Sort based on RRF scores\n rrfScores.sort((a, b) => b.rrfScore - a.rrfScore);\n // Map sorted RRF scores back to hybridSearchResult\n const sortedHybridSearchResult = rrfScores.map((scoreItem) =>\n hybridSearchResult.find((item) => item.rid === scoreItem.rid),\n );\n return sortedHybridSearchResult;\n }\n\n private async drainSingleComponent(\n diagNode: DiagnosticNodeInternal,\n fetchMoreRespHeaders: CosmosHeaders,\n ): Promise<void> {\n if (this.componentsExecutionContext && this.componentsExecutionContext.length !== 1) {\n this.logger.error(\"drainSingleComponent called on multiple components\");\n return;\n }\n try {\n if (this.options.enableQueryControl) {\n const componentExecutionContext = this.componentsExecutionContext[0];\n if (componentExecutionContext.hasMoreResults()) {\n const result = await componentExecutionContext.fetchMore(diagNode);\n mergeHeaders(fetchMoreRespHeaders, result.headers);\n\n const resultData = result.result;\n\n if (result && resultData) {\n resultData.forEach((item: any) => {\n this.hybridSearchResult.push(HybridSearchQueryResult.create(item));\n });\n }\n }\n if (!componentExecutionContext.hasMoreResults()) {\n this.state = HybridQueryExecutionContextBaseStates.draining;\n this.hybridSearchResult.forEach((item) => this.buffer.push(item.data));\n this.applySkipAndTakeToBuffer();\n this.state = HybridQueryExecutionContextBaseStates.draining;\n }\n return;\n } else {\n const componentExecutionContext = this.componentsExecutionContext[0];\n const hybridSearchResult: HybridSearchQueryResult[] = [];\n // add check for enable query control\n while (componentExecutionContext.hasMoreResults()) {\n const result = await componentExecutionContext.fetchMore(diagNode);\n mergeHeaders(fetchMoreRespHeaders, result.headers);\n\n const resultData = result.result;\n if (result && resultData) {\n resultData.forEach((item: any) => {\n hybridSearchResult.push(HybridSearchQueryResult.create(item));\n });\n }\n }\n hybridSearchResult.forEach((item) => this.buffer.push(item.data));\n this.applySkipAndTakeToBuffer();\n this.state = HybridQueryExecutionContextBaseStates.draining;\n }\n } catch (error) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n throw error;\n }\n }\n\n private createComponentExecutionContexts(): void {\n // rewrite queries based on global statistics\n let queryInfos: QueryInfo[] =\n this.partitionedQueryExecutionInfo.hybridSearchQueryInfo.componentQueryInfos;\n if (this.partitionedQueryExecutionInfo.hybridSearchQueryInfo.requiresGlobalStatistics) {\n queryInfos = this.processComponentQueries(\n this.partitionedQueryExecutionInfo.hybridSearchQueryInfo.componentQueryInfos,\n this.globalStatisticsAggregator.getResult(),\n );\n }\n // create component execution contexts\n for (const componentQueryInfo of queryInfos) {\n const componentPartitionExecutionInfo: PartitionedQueryExecutionInfo = {\n partitionedQueryExecutionInfoVersion: 1,\n queryInfo: componentQueryInfo,\n queryRanges: this.partitionedQueryExecutionInfo.queryRanges,\n };\n const rewrittenSqlQuerySpec: string | SqlQuerySpec =\n typeof this.query === \"string\"\n ? componentQueryInfo.rewrittenQuery\n : {\n query: componentQueryInfo.rewrittenQuery,\n parameters: this.query?.parameters ?? [],\n };\n const executionContext = new PipelinedQueryExecutionContext(\n this.clientContext,\n this.collectionLink,\n rewrittenSqlQuerySpec,\n this.options,\n componentPartitionExecutionInfo,\n this.correlatedActivityId,\n this.emitRawOrderByPayload,\n );\n this.componentsExecutionContext.push(executionContext);\n }\n this.isSingleComponent = this.componentsExecutionContext.length === 1;\n }\n private processComponentQueries(\n componentQueryInfos: QueryInfo[],\n globalStats: GlobalStatistics,\n ): QueryInfo[] {\n return componentQueryInfos.map((queryInfo) => {\n let rewrittenOrderByExpressions = queryInfo.orderByExpressions;\n if (queryInfo.orderBy && queryInfo.orderBy.length > 0) {\n if (!queryInfo.hasNonStreamingOrderBy) {\n throw new Error(\"The component query must have a non-streaming order by clause.\");\n }\n rewrittenOrderByExpressions = queryInfo.orderByExpressions.map((expr) =>\n this.replacePlaceholdersWorkaroud(expr, globalStats, componentQueryInfos.length),\n );\n }\n return {\n ...queryInfo,\n rewrittenQuery: this.replacePlaceholdersWorkaroud(\n queryInfo.rewrittenQuery,\n globalStats,\n componentQueryInfos.length,\n ),\n orderByExpressions: rewrittenOrderByExpressions,\n };\n });\n }\n // This method is commented currently, but we will switch back to using this\n // once the gateway has been redeployed with the fix for placeholder indexes\n // private replacePlaceholders(query: string, globalStats: GlobalStatistics): string {\n // // Replace total document count\n // query = query.replace(\n // new RegExp(`{${this.TOTAL_DOCUMENT_COUNT_PLACEHOLDER}}`, \"g\"),\n // globalStats.documentCount.toString(),\n // );\n\n // // Replace total word counts and hit counts from fullTextStatistics\n // globalStats.fullTextStatistics.forEach((stats, index) => {\n // // Replace total word counts\n // query = query.replace(\n // new RegExp(`{${this.TOTAL_WORD_COUNT_PLACEHOLDER}-${index}}`, \"g\"),\n // stats.totalWordCount.toString(),\n // );\n // // Replace hit counts\n // query = query.replace(\n // new RegExp(`{${this.HIT_COUNTS_ARRAY_PLACEHOLDER}-${index}}`, \"g\"),\n // `[${stats.hitCounts.join(\",\")}]`,\n // );\n // });\n\n // return query;\n // }\n\n private replacePlaceholdersWorkaroud(\n query: string,\n globalStats: GlobalStatistics,\n componentCount: number,\n ): string {\n if (\n !globalStats ||\n !globalStats.documentCount ||\n !Array.isArray(globalStats.fullTextStatistics)\n ) {\n throw new Error(\"GlobalStats validation failed\");\n }\n // Replace total document count\n query = query.replace(\n new RegExp(`{${this.TOTAL_DOCUMENT_COUNT_PLACEHOLDER}}`, \"g\"),\n globalStats.documentCount.toString(),\n );\n let statisticsIndex: number = 0;\n for (let i = 0; i < componentCount; i++) {\n // Replace total word counts and hit counts from fullTextStatistics\n const wordCountPlaceholder = `{${this.TOTAL_WORD_COUNT_PLACEHOLDER}-${i}}`;\n const hitCountPlaceholder = `{${this.HIT_COUNTS_ARRAY_PLACEHOLDER}-${i}}`;\n if (!query.includes(wordCountPlaceholder)) {\n continue;\n }\n const stats = globalStats.fullTextStatistics[statisticsIndex];\n // Replace total word counts\n query = query.replace(new RegExp(wordCountPlaceholder, \"g\"), stats.totalWordCount.toString());\n // Replace hit counts\n query = query.replace(new RegExp(hitCountPlaceholder, \"g\"), `[${stats.hitCounts.join(\",\")}]`);\n statisticsIndex++;\n }\n return query;\n }\n\n private computeRRFScore = (\n ranks: number[],\n k: number,\n componentWeights: ComponentWeight[],\n ): number => {\n if (ranks.length !== componentWeights.length) {\n throw new Error(\"Ranks and component weights length mismatch\");\n }\n let rrfScore = 0;\n for (let i = 0; i < ranks.length; i++) {\n const rank = ranks[i];\n const weight = componentWeights[i].weight;\n rrfScore += weight * (1 / (k + rank));\n }\n return rrfScore;\n };\n\n private extractComponentWeights(): ComponentWeight[] {\n const hybridSearchQueryInfo = this.partitionedQueryExecutionInfo.hybridSearchQueryInfo;\n const useDefaultComponentWeight =\n !hybridSearchQueryInfo.componentWeights ||\n hybridSearchQueryInfo.componentWeights.length === 0;\n\n const result: {\n weight: number;\n comparator: (x: number, y: number) => number;\n }[] = [];\n\n for (let index = 0; index < hybridSearchQueryInfo.componentQueryInfos.length; ++index) {\n const queryInfo = hybridSearchQueryInfo.componentQueryInfos[index];\n\n if (queryInfo.orderBy && queryInfo.orderBy.length > 0) {\n if (!queryInfo.hasNonStreamingOrderBy) {\n throw new Error(\"The component query should have a non streaming order by\");\n }\n\n if (!queryInfo.orderByExpressions || queryInfo.orderByExpressions.length !== 1) {\n throw new Error(\"The component query should have exactly one order by expression\");\n }\n }\n const componentWeight = useDefaultComponentWeight\n ? 1\n : hybridSearchQueryInfo.componentWeights[index];\n const hasOrderBy = queryInfo.orderBy && queryInfo.orderBy.length > 0;\n const sortOrder = hasOrderBy && queryInfo.orderBy[0].includes(\"Ascending\") ? 1 : -1;\n result.push({\n weight: componentWeight,\n comparator: (x: number, y: number) => sortOrder * (x - y),\n });\n }\n return result;\n }\n}\n\nexport interface ComponentWeight {\n weight: number;\n comparator: (x: number, y: number) => number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"hybridQueryExecutionContext.js","sourceRoot":"","sources":["../../../src/queryExecutionContext/hybridQueryExecutionContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAWnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AAGzF,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAGrF,OAAO,EACL,4CAA4C,EAC5C,UAAU,GACX,MAAM,4BAA4B,CAAC;AAEpC,cAAc;AACd,MAAM,CAAN,IAAY,qCAKX;AALD,WAAY,qCAAqC;IAC/C,wEAA+B,CAAA;IAC/B,oEAA2B,CAAA;IAC3B,8DAAqB,CAAA;IACrB,sDAAa,CAAA;AACf,CAAC,EALW,qCAAqC,KAArC,qCAAqC,QAKhD;AACD,MAAM,OAAO,2BAA2B;IAoB5B;IACA;IACA;IACA;IACA;IACA;IACA;IAzBF,gCAAgC,CAAmB;IACnD,0BAA0B,GAAuB,EAAE,CAAC;IACpD,QAAQ,CAAS;IACjB,KAAK,CAAwC;IAC7C,0BAA0B,CAA6B;IACvD,qBAAqB,GAAY,IAAI,CAAC;IACtC,MAAM,GAA8B,EAAE,CAAC;IACvC,iBAAiB,GAAG,EAAE,CAAC;IACvB,4BAA4B,GAAG,wDAAwD,CAAC;IACxF,4BAA4B,GAAG,wDAAwD,CAAC;IACxF,gCAAgC,GACtC,4DAA4D,CAAC;IACvD,YAAY,GAAG,EAAE,CAAC,CAAC,qCAAqC;IACxD,MAAM,GAAgB,kBAAkB,CAAC,6BAA6B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IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACpF,MAAM,CAAC,IAAI,CAAC;gBACV,MAAM,EAAE,eAAe;gBACvB,UAAU,EAAE,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;aAC1D,CAAC,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AzureLogger } from \"@azure/logger\";\nimport { createClientLogger } from \"@azure/logger\";\nimport type { ClientContext } from \"../ClientContext.js\";\nimport type { DiagnosticNodeInternal } from \"../diagnostics/DiagnosticNodeInternal.js\";\nimport type {\n FeedOptions,\n GlobalStatistics,\n PartitionedQueryExecutionInfo,\n QueryInfo,\n QueryRange,\n Response,\n} from \"../request/index.js\";\nimport { HybridSearchQueryResult } from \"../request/hybridSearchQueryResult.js\";\nimport { GlobalStatisticsAggregator } from \"./Aggregators/GlobalStatisticsAggregator.js\";\nimport type { CosmosHeaders } from \"./CosmosHeaders.js\";\nimport type { ExecutionContext } from \"./ExecutionContext.js\";\nimport { getInitialHeader, mergeHeaders } from \"./headerUtils.js\";\nimport { ParallelQueryExecutionContext } from \"./parallelQueryExecutionContext.js\";\nimport { PipelinedQueryExecutionContext } from \"./pipelinedQueryExecutionContext.js\";\nimport type { SqlQuerySpec } from \"./SqlQuerySpec.js\";\nimport { type ParallelQueryResult } from \"./parallelQueryResult.js\";\nimport {\n rejectContinuationTokenForUnsupportedQueries,\n QueryTypes,\n} from \"./QueryValidationHelper.js\";\n\n/** @hidden */\nexport enum HybridQueryExecutionContextBaseStates {\n uninitialized = \"uninitialized\",\n initialized = \"initialized\",\n draining = \"draining\",\n done = \"done\",\n}\nexport class HybridQueryExecutionContext implements ExecutionContext {\n private globalStatisticsExecutionContext: ExecutionContext;\n private componentsExecutionContext: ExecutionContext[] = [];\n private pageSize: number;\n private state: HybridQueryExecutionContextBaseStates;\n private globalStatisticsAggregator: GlobalStatisticsAggregator;\n private emitRawOrderByPayload: boolean = true;\n private buffer: HybridSearchQueryResult[] = [];\n private DEFAULT_PAGE_SIZE = 10;\n private TOTAL_WORD_COUNT_PLACEHOLDER = \"documentdb-formattablehybridsearchquery-totalwordcount\";\n private HIT_COUNTS_ARRAY_PLACEHOLDER = \"documentdb-formattablehybridsearchquery-hitcountsarray\";\n private TOTAL_DOCUMENT_COUNT_PLACEHOLDER =\n \"documentdb-formattablehybridsearchquery-totaldocumentcount\";\n private RRF_CONSTANT = 60; // Constant for RRF score calculation\n private logger: AzureLogger = createClientLogger(\"HybridQueryExecutionContext\");\n private hybridSearchResult: HybridSearchQueryResult[] = [];\n private uniqueItems = new Map<string, HybridSearchQueryResult>();\n private isSingleComponent: boolean = false;\n\n constructor(\n private clientContext: ClientContext,\n private collectionLink: string,\n private query: string | SqlQuerySpec,\n private options: FeedOptions,\n private partitionedQueryExecutionInfo: PartitionedQueryExecutionInfo,\n private correlatedActivityId: string,\n private allPartitionsRanges: QueryRange[],\n ) {\n rejectContinuationTokenForUnsupportedQueries(this.options.continuationToken, [\n QueryTypes.hybridSearch(true),\n ]);\n\n this.state = HybridQueryExecutionContextBaseStates.uninitialized;\n this.pageSize = this.options.maxItemCount;\n if (this.pageSize === undefined) {\n this.pageSize = this.DEFAULT_PAGE_SIZE;\n }\n if (partitionedQueryExecutionInfo.hybridSearchQueryInfo.requiresGlobalStatistics) {\n const globalStaticsQueryOptions: FeedOptions = { maxItemCount: this.pageSize };\n this.globalStatisticsAggregator = new GlobalStatisticsAggregator();\n\n const globalStatisticsQuery: string | SqlQuerySpec =\n typeof this.query === \"string\"\n ? this.partitionedQueryExecutionInfo.hybridSearchQueryInfo.globalStatisticsQuery\n : {\n query: this.partitionedQueryExecutionInfo.hybridSearchQueryInfo.globalStatisticsQuery,\n parameters: this.query?.parameters ?? [],\n };\n const globalStatisticsQueryExecutionInfo: PartitionedQueryExecutionInfo = {\n partitionedQueryExecutionInfoVersion: 1,\n queryInfo: {\n distinctType: \"None\",\n hasSelectValue: false,\n groupByAliasToAggregateType: {},\n rewrittenQuery: globalStatisticsQuery,\n hasNonStreamingOrderBy: false,\n },\n queryRanges: this.allPartitionsRanges,\n };\n\n this.globalStatisticsExecutionContext = new ParallelQueryExecutionContext(\n this.clientContext,\n this.collectionLink,\n globalStatisticsQuery,\n globalStaticsQueryOptions,\n globalStatisticsQueryExecutionInfo,\n this.correlatedActivityId,\n );\n } else {\n this.createComponentExecutionContexts();\n this.state = HybridQueryExecutionContextBaseStates.initialized;\n }\n }\n public async nextItem(diagnosticNode: DiagnosticNodeInternal): Promise<Response<any>> {\n const nextItemRespHeaders = getInitialHeader();\n while (\n (this.state === HybridQueryExecutionContextBaseStates.uninitialized ||\n this.state === HybridQueryExecutionContextBaseStates.initialized) &&\n this.buffer.length === 0\n ) {\n await this.fetchMoreInternal(diagnosticNode, nextItemRespHeaders);\n }\n\n if (this.state === HybridQueryExecutionContextBaseStates.draining && this.buffer.length > 0) {\n return this.drainOne(nextItemRespHeaders);\n } else {\n return this.done(nextItemRespHeaders);\n }\n }\n\n public hasMoreResults(): boolean {\n switch (this.state) {\n case HybridQueryExecutionContextBaseStates.uninitialized:\n return true;\n case HybridQueryExecutionContextBaseStates.initialized:\n return true;\n case HybridQueryExecutionContextBaseStates.draining:\n return this.buffer.length > 0;\n case HybridQueryExecutionContextBaseStates.done:\n return false;\n default:\n return false;\n }\n }\n\n public async fetchMore(diagnosticNode?: DiagnosticNodeInternal): Promise<Response<any>> {\n const fetchMoreRespHeaders = getInitialHeader();\n return this.fetchMoreInternal(diagnosticNode, fetchMoreRespHeaders);\n }\n\n private async fetchMoreInternal(\n diagnosticNode: DiagnosticNodeInternal,\n headers: CosmosHeaders,\n ): Promise<Response<any>> {\n switch (this.state) {\n case HybridQueryExecutionContextBaseStates.uninitialized:\n await this.initialize(diagnosticNode, headers);\n return {\n result: [],\n headers: headers,\n };\n\n case HybridQueryExecutionContextBaseStates.initialized:\n await this.executeComponentQueries(diagnosticNode, headers);\n return {\n result: [],\n headers: headers,\n };\n case HybridQueryExecutionContextBaseStates.draining:\n return this.drain(headers);\n case HybridQueryExecutionContextBaseStates.done:\n return this.done(headers);\n default:\n throw new Error(`Invalid state: ${this.state}`);\n }\n }\n\n private async initialize(\n diagnosticNode: DiagnosticNodeInternal,\n fetchMoreRespHeaders: CosmosHeaders,\n ): Promise<void> {\n try {\n while (this.globalStatisticsExecutionContext.hasMoreResults()) {\n const result = await this.globalStatisticsExecutionContext.fetchMore(diagnosticNode);\n mergeHeaders(fetchMoreRespHeaders, result.headers);\n if (result && result.result) {\n const resultData = (result.result as ParallelQueryResult).buffer;\n for (const item of resultData) {\n const globalStatistics: GlobalStatistics = item;\n if (globalStatistics) {\n // iterate over the components update placeholders from globalStatistics\n this.globalStatisticsAggregator.aggregate(globalStatistics);\n }\n }\n }\n }\n } catch (error) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n throw error;\n }\n\n // create component execution contexts for each component query\n this.createComponentExecutionContexts();\n this.state = HybridQueryExecutionContextBaseStates.initialized;\n }\n\n private async executeComponentQueries(\n diagnosticNode: DiagnosticNodeInternal,\n fetchMoreRespHeaders: CosmosHeaders,\n ): Promise<void> {\n if (this.isSingleComponent) {\n await this.drainSingleComponent(diagnosticNode, fetchMoreRespHeaders);\n return;\n }\n try {\n if (this.options.enableQueryControl) {\n // track componentExecutionContexts with remaining results and call them in LIFO order\n if (this.componentsExecutionContext.length > 0) {\n const componentExecutionContext = this.componentsExecutionContext.pop();\n if (componentExecutionContext.hasMoreResults()) {\n const result = await componentExecutionContext.fetchMore(diagnosticNode);\n mergeHeaders(fetchMoreRespHeaders, result.headers);\n\n const resultData = result.result;\n if (result && resultData) {\n resultData.forEach((item: any) => {\n const hybridItem = HybridSearchQueryResult.create(item);\n if (!this.uniqueItems.has(hybridItem.rid)) {\n this.uniqueItems.set(hybridItem.rid, hybridItem);\n }\n });\n }\n if (componentExecutionContext.hasMoreResults()) {\n this.componentsExecutionContext.push(componentExecutionContext);\n }\n }\n }\n if (this.componentsExecutionContext.length === 0) {\n this.processUniqueItems();\n }\n } else {\n for (const componentExecutionContext of this.componentsExecutionContext) {\n while (componentExecutionContext.hasMoreResults()) {\n const result = await componentExecutionContext.fetchMore(diagnosticNode);\n mergeHeaders(fetchMoreRespHeaders, result.headers);\n\n const resultData = result.result;\n if (result && resultData) {\n resultData.forEach((item: any) => {\n const hybridItem = HybridSearchQueryResult.create(item);\n if (!this.uniqueItems.has(hybridItem.rid)) {\n this.uniqueItems.set(hybridItem.rid, hybridItem);\n }\n });\n }\n }\n }\n this.processUniqueItems();\n }\n } catch (error) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n throw error;\n }\n }\n\n private processUniqueItems(): void {\n this.uniqueItems.forEach((item) => this.hybridSearchResult.push(item));\n if (this.hybridSearchResult.length === 0 || this.hybridSearchResult.length === 1) {\n // return the result as no or one element is present\n this.hybridSearchResult.forEach((item) => this.buffer.push(item.data));\n this.state = HybridQueryExecutionContextBaseStates.draining;\n return;\n }\n\n // Initialize an array to hold ranks for each document\n const componentWeights = this.extractComponentWeights();\n const sortedHybridSearchResult = this.sortHybridSearchResultByRRFScore(\n this.hybridSearchResult,\n componentWeights,\n );\n // store the result to buffer\n // add only data from the sortedHybridSearchResult in the buffer\n sortedHybridSearchResult.forEach((item) => this.buffer.push(item.data));\n this.applySkipAndTakeToBuffer();\n this.state = HybridQueryExecutionContextBaseStates.draining;\n }\n\n private applySkipAndTakeToBuffer(): void {\n const { skip, take } = this.partitionedQueryExecutionInfo.hybridSearchQueryInfo;\n if (skip) {\n this.buffer = skip >= this.buffer.length ? [] : this.buffer.slice(skip);\n }\n if (take) {\n this.buffer = take <= 0 ? [] : this.buffer.slice(0, take);\n }\n }\n\n private async drain(fetchMoreRespHeaders: CosmosHeaders): Promise<Response<any>> {\n try {\n if (this.buffer.length === 0) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n return this.done(fetchMoreRespHeaders);\n }\n const result = this.buffer.slice(0, this.pageSize);\n this.buffer = this.buffer.slice(this.pageSize);\n if (this.buffer.length === 0) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n }\n return {\n result: result,\n headers: fetchMoreRespHeaders,\n };\n } catch (error) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n throw error;\n }\n }\n\n private async drainOne(nextItemRespHeaders: CosmosHeaders): Promise<Response<any>> {\n try {\n if (this.buffer.length === 0) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n return this.done(nextItemRespHeaders);\n }\n const result = this.buffer.shift();\n if (this.buffer.length === 0) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n }\n return {\n result: result,\n headers: nextItemRespHeaders,\n };\n } catch (error) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n throw error;\n }\n }\n\n private done(fetchMoreRespHeaders: CosmosHeaders): Response<any> {\n return {\n result: undefined,\n headers: fetchMoreRespHeaders,\n };\n }\n\n private sortHybridSearchResultByRRFScore(\n hybridSearchResult: HybridSearchQueryResult[],\n componentWeights: ComponentWeight[],\n ): HybridSearchQueryResult[] {\n if (hybridSearchResult.length === 0) {\n return [];\n }\n const ranksArray: { rid: string; ranks: number[] }[] = hybridSearchResult.map((item) => ({\n rid: item.rid,\n ranks: new Array(item.componentScores.length).fill(0),\n }));\n // Compute ranks for each component score\n for (let i = 0; i < hybridSearchResult[0].componentScores.length; i++) {\n // Sort based on the i-th component score\n hybridSearchResult.sort((a, b) =>\n componentWeights[i].comparator(a.componentScores[i], b.componentScores[i]),\n );\n\n // Assign ranks\n let rank = 1;\n for (let j = 0; j < hybridSearchResult.length; j++) {\n if (\n j > 0 &&\n hybridSearchResult[j].componentScores[i] !== hybridSearchResult[j - 1].componentScores[i]\n ) {\n ++rank;\n }\n const rankIndex = ranksArray.findIndex(\n (rankItem) => rankItem.rid === hybridSearchResult[j].rid,\n );\n ranksArray[rankIndex].ranks[i] = rank; // 1-based rank\n }\n }\n\n // Compute RRF scores and sort based on them\n const rrfScores = ranksArray.map((item) => ({\n rid: item.rid,\n rrfScore: this.computeRRFScore(item.ranks, this.RRF_CONSTANT, componentWeights),\n }));\n\n // Sort based on RRF scores\n rrfScores.sort((a, b) => b.rrfScore - a.rrfScore);\n // Map sorted RRF scores back to hybridSearchResult\n const sortedHybridSearchResult = rrfScores.map((scoreItem) =>\n hybridSearchResult.find((item) => item.rid === scoreItem.rid),\n );\n return sortedHybridSearchResult;\n }\n\n private async drainSingleComponent(\n diagNode: DiagnosticNodeInternal,\n fetchMoreRespHeaders: CosmosHeaders,\n ): Promise<void> {\n if (this.componentsExecutionContext && this.componentsExecutionContext.length !== 1) {\n this.logger.error(\"drainSingleComponent called on multiple components\");\n return;\n }\n try {\n if (this.options.enableQueryControl) {\n const componentExecutionContext = this.componentsExecutionContext[0];\n if (componentExecutionContext.hasMoreResults()) {\n const result = await componentExecutionContext.fetchMore(diagNode);\n mergeHeaders(fetchMoreRespHeaders, result.headers);\n\n const resultData = result.result;\n\n if (result && resultData) {\n resultData.forEach((item: any) => {\n this.hybridSearchResult.push(HybridSearchQueryResult.create(item));\n });\n }\n }\n if (!componentExecutionContext.hasMoreResults()) {\n this.state = HybridQueryExecutionContextBaseStates.draining;\n this.hybridSearchResult.forEach((item) => this.buffer.push(item.data));\n this.applySkipAndTakeToBuffer();\n this.state = HybridQueryExecutionContextBaseStates.draining;\n }\n return;\n } else {\n const componentExecutionContext = this.componentsExecutionContext[0];\n const hybridSearchResult: HybridSearchQueryResult[] = [];\n // add check for enable query control\n while (componentExecutionContext.hasMoreResults()) {\n const result = await componentExecutionContext.fetchMore(diagNode);\n mergeHeaders(fetchMoreRespHeaders, result.headers);\n\n const resultData = result.result;\n if (result && resultData) {\n resultData.forEach((item: any) => {\n hybridSearchResult.push(HybridSearchQueryResult.create(item));\n });\n }\n }\n hybridSearchResult.forEach((item) => this.buffer.push(item.data));\n this.applySkipAndTakeToBuffer();\n this.state = HybridQueryExecutionContextBaseStates.draining;\n }\n } catch (error) {\n this.state = HybridQueryExecutionContextBaseStates.done;\n throw error;\n }\n }\n\n private createComponentExecutionContexts(): void {\n // rewrite queries based on global statistics\n let queryInfos: QueryInfo[] =\n this.partitionedQueryExecutionInfo.hybridSearchQueryInfo.componentQueryInfos;\n if (this.partitionedQueryExecutionInfo.hybridSearchQueryInfo.requiresGlobalStatistics) {\n queryInfos = this.processComponentQueries(\n this.partitionedQueryExecutionInfo.hybridSearchQueryInfo.componentQueryInfos,\n this.globalStatisticsAggregator.getResult(),\n );\n }\n // create component execution contexts\n for (const componentQueryInfo of queryInfos) {\n const componentPartitionExecutionInfo: PartitionedQueryExecutionInfo = {\n partitionedQueryExecutionInfoVersion: 1,\n queryInfo: componentQueryInfo,\n queryRanges: this.partitionedQueryExecutionInfo.queryRanges,\n };\n const rewrittenSqlQuerySpec: string | SqlQuerySpec =\n typeof this.query === \"string\"\n ? componentQueryInfo.rewrittenQuery\n : {\n query: componentQueryInfo.rewrittenQuery,\n parameters: this.query?.parameters ?? [],\n };\n const executionContext = new PipelinedQueryExecutionContext(\n this.clientContext,\n this.collectionLink,\n rewrittenSqlQuerySpec,\n this.options,\n componentPartitionExecutionInfo,\n this.correlatedActivityId,\n this.emitRawOrderByPayload,\n /* supportsContinuationTokens */ false,\n );\n this.componentsExecutionContext.push(executionContext);\n }\n this.isSingleComponent = this.componentsExecutionContext.length === 1;\n }\n private processComponentQueries(\n componentQueryInfos: QueryInfo[],\n globalStats: GlobalStatistics,\n ): QueryInfo[] {\n return componentQueryInfos.map((queryInfo) => {\n let rewrittenOrderByExpressions = queryInfo.orderByExpressions;\n if (queryInfo.orderBy && queryInfo.orderBy.length > 0) {\n if (!queryInfo.hasNonStreamingOrderBy) {\n throw new Error(\"The component query must have a non-streaming order by clause.\");\n }\n rewrittenOrderByExpressions = queryInfo.orderByExpressions.map((expr) =>\n this.replacePlaceholdersWorkaroud(expr, globalStats, componentQueryInfos.length),\n );\n }\n return {\n ...queryInfo,\n rewrittenQuery: this.replacePlaceholdersWorkaroud(\n queryInfo.rewrittenQuery,\n globalStats,\n componentQueryInfos.length,\n ),\n orderByExpressions: rewrittenOrderByExpressions,\n };\n });\n }\n // This method is commented currently, but we will switch back to using this\n // once the gateway has been redeployed with the fix for placeholder indexes\n // private replacePlaceholders(query: string, globalStats: GlobalStatistics): string {\n // // Replace total document count\n // query = query.replace(\n // new RegExp(`{${this.TOTAL_DOCUMENT_COUNT_PLACEHOLDER}}`, \"g\"),\n // globalStats.documentCount.toString(),\n // );\n\n // // Replace total word counts and hit counts from fullTextStatistics\n // globalStats.fullTextStatistics.forEach((stats, index) => {\n // // Replace total word counts\n // query = query.replace(\n // new RegExp(`{${this.TOTAL_WORD_COUNT_PLACEHOLDER}-${index}}`, \"g\"),\n // stats.totalWordCount.toString(),\n // );\n // // Replace hit counts\n // query = query.replace(\n // new RegExp(`{${this.HIT_COUNTS_ARRAY_PLACEHOLDER}-${index}}`, \"g\"),\n // `[${stats.hitCounts.join(\",\")}]`,\n // );\n // });\n\n // return query;\n // }\n\n private replacePlaceholdersWorkaroud(\n query: string,\n globalStats: GlobalStatistics,\n componentCount: number,\n ): string {\n if (\n !globalStats ||\n !globalStats.documentCount ||\n !Array.isArray(globalStats.fullTextStatistics)\n ) {\n throw new Error(\"GlobalStats validation failed\");\n }\n // Replace total document count\n query = query.replace(\n new RegExp(`{${this.TOTAL_DOCUMENT_COUNT_PLACEHOLDER}}`, \"g\"),\n globalStats.documentCount.toString(),\n );\n let statisticsIndex: number = 0;\n for (let i = 0; i < componentCount; i++) {\n // Replace total word counts and hit counts from fullTextStatistics\n const wordCountPlaceholder = `{${this.TOTAL_WORD_COUNT_PLACEHOLDER}-${i}}`;\n const hitCountPlaceholder = `{${this.HIT_COUNTS_ARRAY_PLACEHOLDER}-${i}}`;\n if (!query.includes(wordCountPlaceholder)) {\n continue;\n }\n const stats = globalStats.fullTextStatistics[statisticsIndex];\n // Replace total word counts\n query = query.replace(new RegExp(wordCountPlaceholder, \"g\"), stats.totalWordCount.toString());\n // Replace hit counts\n query = query.replace(new RegExp(hitCountPlaceholder, \"g\"), `[${stats.hitCounts.join(\",\")}]`);\n statisticsIndex++;\n }\n return query;\n }\n\n private computeRRFScore = (\n ranks: number[],\n k: number,\n componentWeights: ComponentWeight[],\n ): number => {\n if (ranks.length !== componentWeights.length) {\n throw new Error(\"Ranks and component weights length mismatch\");\n }\n let rrfScore = 0;\n for (let i = 0; i < ranks.length; i++) {\n const rank = ranks[i];\n const weight = componentWeights[i].weight;\n rrfScore += weight * (1 / (k + rank));\n }\n return rrfScore;\n };\n\n private extractComponentWeights(): ComponentWeight[] {\n const hybridSearchQueryInfo = this.partitionedQueryExecutionInfo.hybridSearchQueryInfo;\n const useDefaultComponentWeight =\n !hybridSearchQueryInfo.componentWeights ||\n hybridSearchQueryInfo.componentWeights.length === 0;\n\n const result: {\n weight: number;\n comparator: (x: number, y: number) => number;\n }[] = [];\n\n for (let index = 0; index < hybridSearchQueryInfo.componentQueryInfos.length; ++index) {\n const queryInfo = hybridSearchQueryInfo.componentQueryInfos[index];\n\n if (queryInfo.orderBy && queryInfo.orderBy.length > 0) {\n if (!queryInfo.hasNonStreamingOrderBy) {\n throw new Error(\"The component query should have a non streaming order by\");\n }\n\n if (!queryInfo.orderByExpressions || queryInfo.orderByExpressions.length !== 1) {\n throw new Error(\"The component query should have exactly one order by expression\");\n }\n }\n const componentWeight = useDefaultComponentWeight\n ? 1\n : hybridSearchQueryInfo.componentWeights[index];\n const hasOrderBy = queryInfo.orderBy && queryInfo.orderBy.length > 0;\n const sortOrder = hasOrderBy && queryInfo.orderBy[0].includes(\"Ascending\") ? 1 : -1;\n result.push({\n weight: componentWeight,\n comparator: (x: number, y: number) => sortOrder * (x - y),\n });\n }\n return result;\n }\n}\n\nexport interface ComponentWeight {\n weight: number;\n comparator: (x: number, y: number) => number;\n}\n"]}
|
|
@@ -196,6 +196,11 @@ export declare abstract class ParallelQueryExecutionContextBase implements Execu
|
|
|
196
196
|
*/
|
|
197
197
|
private _createQueryRangeWithContinuationToken;
|
|
198
198
|
private static _needPartitionKeyRangeCacheRefresh;
|
|
199
|
+
/**
|
|
200
|
+
* Replaces the format placeholder in the rewritten query with the provided filter condition.
|
|
201
|
+
* Handles both string queries and SqlQuerySpec objects.
|
|
202
|
+
*/
|
|
203
|
+
private _replaceFormatPlaceholder;
|
|
199
204
|
/**
|
|
200
205
|
* Creates target partition range Query Execution Context
|
|
201
206
|
*/
|