@cfworker/cosmos 1.10.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +1 -1
- package/dist/client.js +2 -10
- package/dist/response.js +0 -3
- package/dist/retry.js +0 -3
- package/dist/session.js +0 -1
- package/dist/signer.js +1 -2
- package/package.json +10 -11
- package/src/client.ts +1 -5
- package/tsconfig.json +8 -3
- package/LICENSE.md +0 -21
package/dist/client.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare class CosmosClient {
|
|
|
45
45
|
private fetch;
|
|
46
46
|
private setHeaders;
|
|
47
47
|
}
|
|
48
|
-
export declare type DocumentInit = BufferSource | ReadableStream
|
|
48
|
+
export declare type DocumentInit = BufferSource | ReadableStream | string | Resource;
|
|
49
49
|
interface CommonArgs {
|
|
50
50
|
activityId?: string;
|
|
51
51
|
consistencyLevel?: ConsistencyLevel;
|
package/dist/client.js
CHANGED
|
@@ -4,17 +4,9 @@ import { DefaultSessionContainer } from './session.js';
|
|
|
4
4
|
import { getSigner } from './signer.js';
|
|
5
5
|
import { assertArg, escapeNonASCII, uri } from './util.js';
|
|
6
6
|
export class CosmosClient {
|
|
7
|
-
endpoint;
|
|
8
|
-
signer;
|
|
9
|
-
retryPolicy;
|
|
10
|
-
consistencyLevel;
|
|
11
|
-
dbId;
|
|
12
|
-
collId;
|
|
13
|
-
systemFetch;
|
|
14
|
-
sessions;
|
|
15
|
-
requestCharges = 0;
|
|
16
|
-
retries = { count: 0, delayMs: 0 };
|
|
17
7
|
constructor(config) {
|
|
8
|
+
this.requestCharges = 0;
|
|
9
|
+
this.retries = { count: 0, delayMs: 0 };
|
|
18
10
|
this.endpoint = config.endpoint;
|
|
19
11
|
this.signer = getSigner(config.masterKey);
|
|
20
12
|
this.retryPolicy = config.retryPolicy ?? defaultRetryPolicy;
|
package/dist/response.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export class CosmosResponse {
|
|
2
|
-
response;
|
|
3
2
|
constructor(response) {
|
|
4
3
|
this.response = response;
|
|
5
4
|
}
|
|
@@ -34,8 +33,6 @@ export class ItemResponse extends CosmosResponse {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
export class FeedResponse extends CosmosResponse {
|
|
37
|
-
next;
|
|
38
|
-
itemsProperty;
|
|
39
36
|
constructor(response, next, itemsProperty) {
|
|
40
37
|
super(response);
|
|
41
38
|
this.next = next;
|
package/dist/retry.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { readSessionNotAvailable } from './session';
|
|
2
2
|
export class DefaultRetryPolicy {
|
|
3
|
-
maxAttempts;
|
|
4
|
-
maxCumulativeWaitTimeMs;
|
|
5
|
-
defaultRetryDelayMs;
|
|
6
3
|
constructor(maxAttempts = 10, maxCumulativeWaitTimeMs = 30000, defaultRetryDelayMs = 5000) {
|
|
7
4
|
this.maxAttempts = maxAttempts;
|
|
8
5
|
this.maxCumulativeWaitTimeMs = maxCumulativeWaitTimeMs;
|
package/dist/session.js
CHANGED
package/dist/signer.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { decode as base64ToArrayBuffer, encode as arrayBufferToBase64 } from 'base64-arraybuffer';
|
|
2
2
|
export class Signer {
|
|
3
|
-
masterkey;
|
|
4
|
-
encoder = new TextEncoder();
|
|
5
3
|
constructor(masterkey) {
|
|
4
|
+
this.encoder = new TextEncoder();
|
|
6
5
|
const promiseLike = crypto.subtle.importKey('raw', base64ToArrayBuffer(masterkey), { name: 'HMAC', hash: { name: 'SHA-256' } }, false, ['sign']);
|
|
7
6
|
this.masterkey = Promise.resolve(promiseLike);
|
|
8
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfworker/cosmos",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Azure Cosmos DB client for Cloudflare Workers and service workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"azure",
|
|
@@ -37,17 +37,16 @@
|
|
|
37
37
|
"test": "cfworker test test/**/*.spec.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@cfworker/worker-types": "^1.
|
|
41
|
-
"@cloudflare/workers-types": "^2.
|
|
42
|
-
"base64-arraybuffer": "^0.
|
|
40
|
+
"@cfworker/worker-types": "^1.12.0",
|
|
41
|
+
"@cloudflare/workers-types": "^2.2.2",
|
|
42
|
+
"base64-arraybuffer": "^1.0.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@cfworker/dev": "^1.
|
|
46
|
-
"@types/chai": "^4.2.
|
|
47
|
-
"@types/mocha": "^
|
|
45
|
+
"@cfworker/dev": "^1.12.0",
|
|
46
|
+
"@types/chai": "^4.2.22",
|
|
47
|
+
"@types/mocha": "^9.0.0",
|
|
48
48
|
"chai": "^4.3.4",
|
|
49
|
-
"mocha": "^
|
|
50
|
-
"typescript": "^4.
|
|
51
|
-
}
|
|
52
|
-
"gitHead": "a05bcc6295252bf391d548977f28a8975da47317"
|
|
49
|
+
"mocha": "^9.1.3",
|
|
50
|
+
"typescript": "^4.5.2"
|
|
51
|
+
}
|
|
53
52
|
}
|
package/src/client.ts
CHANGED
|
@@ -404,11 +404,7 @@ export class CosmosClient {
|
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
-
export type DocumentInit =
|
|
408
|
-
| BufferSource
|
|
409
|
-
| ReadableStream<Uint8Array>
|
|
410
|
-
| string
|
|
411
|
-
| Resource;
|
|
407
|
+
export type DocumentInit = BufferSource | ReadableStream | string | Resource;
|
|
412
408
|
|
|
413
409
|
function toBodyInit(obj: DocumentInit): BodyInit {
|
|
414
410
|
if (
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../tsconfig-base",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"target": "
|
|
5
|
-
"lib": ["
|
|
6
|
-
"types": [
|
|
4
|
+
"target": "ES2021",
|
|
5
|
+
"lib": ["ESNext", "WebWorker", "Webworker.Iterable"],
|
|
6
|
+
"types": [
|
|
7
|
+
"chai",
|
|
8
|
+
"mocha",
|
|
9
|
+
"@cfworker/worker-types",
|
|
10
|
+
"@cloudflare/workers-types"
|
|
11
|
+
],
|
|
7
12
|
"outDir": "dist",
|
|
8
13
|
"rootDir": "./src"
|
|
9
14
|
},
|
package/LICENSE.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Jeremy Danyow
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|