Remove Buffer (#330)
This commit is contained in:
Родитель
703223f17d
Коммит
4f502ecffa
|
@ -466,10 +466,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"atob": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz",
|
||||
"integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=",
|
||||
"dev": true
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
|
||||
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg=="
|
||||
},
|
||||
"babel-runtime": {
|
||||
"version": "6.26.0",
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@azure/cosmos-sign": "1.0.2",
|
||||
"atob": "2.1.2",
|
||||
"binary-search-bounds": "2.0.3",
|
||||
"crypto-hash": "1.1.0",
|
||||
"fast-json-stable-stringify": "2.0.0",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import atob from "atob";
|
||||
import { Constants, getContainerLink, OperationType, ResourceType, trimSlashes } from "../common";
|
||||
import { CosmosHeaders } from "../queryExecutionContext";
|
||||
import { SessionContext } from "./SessionContext";
|
||||
|
@ -71,13 +72,9 @@ export class SessionContainer {
|
|||
}
|
||||
|
||||
private validateOwnerID(ownerId: string) {
|
||||
const ownerIdBuffer = Buffer.from(ownerId, "base64");
|
||||
// If ownerId contains exactly 8 bytes it represents a unique database+collection identifier. Otherwise it represents another resource
|
||||
// The first 4 bytes are the database. The last 4 bytes are the collection.
|
||||
if (ownerIdBuffer.length === 8) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return atob(ownerId).length === 8;
|
||||
}
|
||||
|
||||
private getPartitionKeyRangeIdToTokenMap(collectionName: string): Map<string, VectorSessionToken> {
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
declare module "atob" {
|
||||
const _atob: typeof atob;
|
||||
export = _atob;
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
declare module "binary-search-bounds" {
|
||||
// tslint:disable-next-line:variable-name
|
||||
const _bs: any;
|
||||
export = _bs;
|
||||
}
|
Загрузка…
Ссылка в новой задаче