@cfworker/cosmos 1.12.0 → 1.12.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/dist/client.d.ts +2 -0
- package/dist/client.js +3 -1
- package/package.json +8 -8
- package/src/client.ts +9 -1
package/dist/client.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface CosmosClientConfig {
|
|
|
10
10
|
dbId?: string;
|
|
11
11
|
collId?: string;
|
|
12
12
|
sessions?: SessionContainer;
|
|
13
|
+
enableCrossPartitionQueries?: boolean;
|
|
13
14
|
fetch?: typeof fetch;
|
|
14
15
|
}
|
|
15
16
|
export declare class CosmosClient {
|
|
@@ -19,6 +20,7 @@ export declare class CosmosClient {
|
|
|
19
20
|
private readonly consistencyLevel;
|
|
20
21
|
private readonly dbId;
|
|
21
22
|
private readonly collId;
|
|
23
|
+
private readonly enableCrossPartitionQueries;
|
|
22
24
|
private readonly systemFetch;
|
|
23
25
|
readonly sessions: SessionContainer;
|
|
24
26
|
requestCharges: number;
|
package/dist/client.js
CHANGED
|
@@ -13,6 +13,8 @@ export class CosmosClient {
|
|
|
13
13
|
this.consistencyLevel = config.consistencyLevel ?? 'Session';
|
|
14
14
|
this.dbId = config.dbId;
|
|
15
15
|
this.collId = config.collId;
|
|
16
|
+
this.enableCrossPartitionQueries =
|
|
17
|
+
config.enableCrossPartitionQueries ?? true;
|
|
16
18
|
this.sessions = config.sessions ?? new DefaultSessionContainer();
|
|
17
19
|
this.systemFetch = config.fetch ?? fetch.bind(self);
|
|
18
20
|
}
|
|
@@ -147,7 +149,7 @@ export class CosmosClient {
|
|
|
147
149
|
assertArg('dbId', dbId);
|
|
148
150
|
assertArg('collId', collId);
|
|
149
151
|
const headers = Object.assign({
|
|
150
|
-
enableCrossPartition:
|
|
152
|
+
enableCrossPartition: this.enableCrossPartitionQueries,
|
|
151
153
|
enableScan: false,
|
|
152
154
|
maxItems: -1,
|
|
153
155
|
populateMetrics: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfworker/cosmos",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"description": "Azure Cosmos DB client for Cloudflare Workers and service workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"azure",
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
"test": "cfworker test test/**/*.spec.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@cfworker/worker-types": "^1.12.
|
|
40
|
+
"@cfworker/worker-types": "^1.12.1",
|
|
41
41
|
"@cloudflare/workers-types": "^2.2.2",
|
|
42
|
-
"base64-arraybuffer": "^1.0.
|
|
42
|
+
"base64-arraybuffer": "^1.0.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@cfworker/dev": "^1.
|
|
46
|
-
"@types/chai": "^4.
|
|
47
|
-
"@types/mocha": "^9.
|
|
45
|
+
"@cfworker/dev": "^1.13.1",
|
|
46
|
+
"@types/chai": "^4.3.0",
|
|
47
|
+
"@types/mocha": "^9.1.0",
|
|
48
48
|
"chai": "^4.3.4",
|
|
49
|
-
"mocha": "^9.1.
|
|
50
|
-
"typescript": "^4.5.
|
|
49
|
+
"mocha": "^9.1.4",
|
|
50
|
+
"typescript": "^4.5.5"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/src/client.ts
CHANGED
|
@@ -54,6 +54,11 @@ export interface CosmosClientConfig {
|
|
|
54
54
|
*/
|
|
55
55
|
sessions?: SessionContainer;
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Enables cross partition queries. This can be overriden on individual queries. Defaults to true.
|
|
59
|
+
*/
|
|
60
|
+
enableCrossPartitionQueries?: boolean;
|
|
61
|
+
|
|
57
62
|
/**
|
|
58
63
|
* System fetch function
|
|
59
64
|
*/
|
|
@@ -67,6 +72,7 @@ export class CosmosClient {
|
|
|
67
72
|
private readonly consistencyLevel: ConsistencyLevel;
|
|
68
73
|
private readonly dbId: string | undefined;
|
|
69
74
|
private readonly collId: string | undefined;
|
|
75
|
+
private readonly enableCrossPartitionQueries: boolean;
|
|
70
76
|
private readonly systemFetch: typeof fetch;
|
|
71
77
|
public readonly sessions: SessionContainer;
|
|
72
78
|
public requestCharges = 0;
|
|
@@ -79,6 +85,8 @@ export class CosmosClient {
|
|
|
79
85
|
this.consistencyLevel = config.consistencyLevel ?? 'Session';
|
|
80
86
|
this.dbId = config.dbId;
|
|
81
87
|
this.collId = config.collId;
|
|
88
|
+
this.enableCrossPartitionQueries =
|
|
89
|
+
config.enableCrossPartitionQueries ?? true;
|
|
82
90
|
this.sessions = config.sessions ?? new DefaultSessionContainer();
|
|
83
91
|
this.systemFetch = config.fetch ?? fetch.bind(self);
|
|
84
92
|
}
|
|
@@ -270,7 +278,7 @@ export class CosmosClient {
|
|
|
270
278
|
|
|
271
279
|
const headers = Object.assign(
|
|
272
280
|
{
|
|
273
|
-
enableCrossPartition:
|
|
281
|
+
enableCrossPartition: this.enableCrossPartitionQueries,
|
|
274
282
|
enableScan: false,
|
|
275
283
|
maxItems: -1,
|
|
276
284
|
populateMetrics: false,
|