Replace crypto with create-hmac package (#107)
Decreases the webpacked size by ~1mb
This commit is contained in:
Родитель
28648b998f
Коммит
fd8a46efb3
|
@ -2259,7 +2259,6 @@
|
|||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz",
|
||||
"integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"inherits": "^2.0.1",
|
||||
"safe-buffer": "^5.0.1"
|
||||
|
@ -2634,7 +2633,6 @@
|
|||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
|
||||
"integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cipher-base": "^1.0.1",
|
||||
"inherits": "^2.0.1",
|
||||
|
@ -2647,7 +2645,6 @@
|
|||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
|
||||
"integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cipher-base": "^1.0.3",
|
||||
"create-hash": "^1.1.0",
|
||||
|
@ -4875,7 +4872,6 @@
|
|||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz",
|
||||
"integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"inherits": "^2.0.1",
|
||||
"safe-buffer": "^5.0.1"
|
||||
|
@ -6671,7 +6667,6 @@
|
|||
"version": "1.3.4",
|
||||
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz",
|
||||
"integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"hash-base": "^3.0.0",
|
||||
"inherits": "^2.0.1"
|
||||
|
@ -8544,7 +8539,6 @@
|
|||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz",
|
||||
"integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"hash-base": "^3.0.0",
|
||||
"inherits": "^2.0.1"
|
||||
|
@ -8713,7 +8707,6 @@
|
|||
"version": "2.4.11",
|
||||
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
|
||||
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"inherits": "^2.0.1",
|
||||
"safe-buffer": "^5.0.1"
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
"dependencies": {
|
||||
"big-integer": "^1.6.32",
|
||||
"binary-search-bounds": "2.0.3",
|
||||
"create-hmac": "^1.1.7",
|
||||
"int64-buffer": "^0.1.9",
|
||||
"priorityqueuejs": "1.0.0",
|
||||
"semaphore": "1.0.5",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as crypto from "crypto";
|
||||
import createHmac from "create-hmac";
|
||||
import { PermissionDefinition } from "./client";
|
||||
import { Helper } from "./common";
|
||||
import { IHeaders } from "./queryExecutionContext";
|
||||
|
@ -95,8 +95,7 @@ export class AuthHandler {
|
|||
"\n";
|
||||
|
||||
const body = new Buffer(text, "utf8");
|
||||
const signature = crypto
|
||||
.createHmac("sha256", key)
|
||||
const signature = createHmac("sha256", key)
|
||||
.update(body)
|
||||
.digest("base64");
|
||||
const MasterToken = "master";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// tslint:disable:no-bitwise
|
||||
import * as BigInt from "big-integer";
|
||||
import BigInt from "big-integer";
|
||||
import { Int64BE } from "int64-buffer";
|
||||
|
||||
/** @hidden */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { FetchFunctionCallback, SqlQuerySpec } from ".";
|
||||
import { ClientContext } from "../ClientContext";
|
||||
import { Constants, Helper, StatusCodes, SubStatusCodes } from "../common";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import * as util from "util";
|
||||
import { Constants } from "../common";
|
||||
import { QueryMetrics } from "../queryMetrics";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import * as util from "util";
|
||||
import { DocumentProducer } from "./documentProducer";
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import * as bs from "binary-search-bounds";
|
||||
import * as PriorityQueue from "priorityqueuejs";
|
||||
import * as semaphore from "semaphore";
|
||||
import PriorityQueue from "priorityqueuejs";
|
||||
import semaphore from "semaphore";
|
||||
import * as util from "util";
|
||||
import {
|
||||
DocumentProducer,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import * as util from "util";
|
||||
|
||||
/** @hidden */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import {
|
||||
DefaultQueryExecutionContext,
|
||||
FetchFunctionCallback,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import * as bs from "binary-search-bounds"; // TODO: missing types
|
||||
import { Constants } from "../common";
|
||||
import { Range } from "../range";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as semaphore from "semaphore";
|
||||
import semaphore from "semaphore";
|
||||
import { CollectionRoutingMapFactory, InMemoryCollectionRoutingMap, QueryRange } from ".";
|
||||
import { ClientContext } from "../ClientContext";
|
||||
import { Helper } from "../common";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { PartitionKeyRangeCache, QueryRange } from ".";
|
||||
import { ClientContext } from "../ClientContext";
|
||||
import { Constants } from "../common";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as BigInt from "big-integer";
|
||||
import BigInt from "big-integer";
|
||||
import { Constants, EMPTY, Helper, ResourceId } from "./common";
|
||||
import { IHeaders } from "./queryExecutionContext";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Container, CosmosClient, Database, DatabaseDefinition, Item, RequestOptions, Response } from "../..";
|
||||
import {
|
||||
ContainerDefinition,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { CosmosClient, DocumentBase } from "../..";
|
||||
import { PermissionDefinition } from "../../client";
|
||||
import { endpoint } from "../common/_testConfig";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { CosmosClient, DocumentBase } from "../..";
|
||||
import { endpoint, masterKey } from "../common/_testConfig";
|
||||
import { getTestDatabase, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Constants, DocumentBase } from "../..";
|
||||
import { ContainerDefinition, Database } from "../../client";
|
||||
import { DataType, Index, IndexedPath, IndexingMode, IndexingPolicy, IndexKind } from "../../documents";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { CosmosClient, DatabaseDefinition } from "../..";
|
||||
import { endpoint, masterKey } from "../common/_testConfig";
|
||||
import { addEntropy, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { CosmosClient } from "../..";
|
||||
import { endpoint, masterKey } from "../common/_testConfig";
|
||||
import { removeAllDatabases } from "../common/TestHelpers";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Container, DocumentBase } from "../..";
|
||||
import {
|
||||
bulkDeleteItems,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
|
||||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Base, Constants, CosmosClient } from "../../";
|
||||
import testConfig from "./../common/_testConfig";
|
||||
import { TestHelpers } from "./../common/TestHelpers";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { DocumentBase } from "../..";
|
||||
import { PermissionDefinition } from "../../client";
|
||||
import {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Constants, CosmosClient, DocumentBase } from "../..";
|
||||
import { Container } from "../../client";
|
||||
import { endpoint, masterKey } from "../common/_testConfig";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Database, DocumentBase } from "../..";
|
||||
import { createOrUpsertItem, getTestDatabase, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Constants, CosmosClient, DocumentBase } from "../..";
|
||||
import { Container, StoredProcedureDefinition } from "../../client";
|
||||
import { bulkInsertItems, getTestContainer, getTestDatabase, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { DocumentBase } from "../..";
|
||||
import { Container, TriggerDefinition } from "../../client";
|
||||
import { getTestContainer, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Container, ContainerDefinition, Database } from "../../client";
|
||||
import { getTestDatabase, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Container } from "../..";
|
||||
import { UserDefinedFunctionDefinition } from "../../client";
|
||||
import { getTestDatabase, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { UserDefinition } from "../../client";
|
||||
import { createOrUpsertUser, getTestDatabase, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import * as util from "util";
|
||||
import { QueryIterator } from "../..";
|
||||
import { Container, ContainerDefinition, Database } from "../../client";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Container, CosmosClient, DocumentBase } from "../..";
|
||||
import { Database } from "../../client";
|
||||
import { endpoint } from "../common/_testConfig";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Container } from "../../client";
|
||||
|
||||
describe("Container", function() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import * as util from "util";
|
||||
import { Constants } from "../..";
|
||||
import { Container, ContainerDefinition } from "../../client";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { IndexingMode } from "../../documents";
|
||||
import { getTestDatabase, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { FeedOptions } from "../..";
|
||||
import { Container } from "../../client";
|
||||
import { getTestContainer, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Constants, FeedOptions } from "../..";
|
||||
import { PartitionKind } from "../../documents";
|
||||
import { getTestContainer, getTestDatabase, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Constants } from "../../common";
|
||||
import {
|
||||
ClientSideMetrics,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { AzureDocuments, Constants, CosmosClient, RetryOptions } from "../..";
|
||||
import * as request from "../../request";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Constants, CosmosClient, Database } from "../..";
|
||||
import { endpoint, masterKey } from "../common/_testConfig";
|
||||
import { getTestDatabase, removeAllDatabases } from "../common/TestHelpers";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import * as sinon from "sinon";
|
||||
import { Constants, CosmosClient, IHeaders } from "../..";
|
||||
import { ClientContext } from "../../ClientContext";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// import * as assert from "assert";
|
||||
// import assert from "assert";
|
||||
// import { execFileSync, spawnSync } from "child_process";
|
||||
// import * as Stream from "stream";
|
||||
// import * as _ from "underscore";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { CosmosClient, DocumentBase } from "../..";
|
||||
import { getTestDatabase } from "../common/TestHelpers";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { IHeaders } from "../..";
|
||||
import { Constants, Helper } from "../../common";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { CollectionRoutingMapFactory, InMemoryCollectionRoutingMap, QueryRange } from "../../routing";
|
||||
|
||||
describe("InMemoryCollectionRoutingMap Tests", function() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import * as os from "os";
|
||||
import * as util from "util";
|
||||
import { Constants } from "../..";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Range } from "../../range";
|
||||
|
||||
describe("Range Tests", function() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { Range, RangePartitionResolver } from "../../range";
|
||||
import { CompareFunction } from "../../range";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { ResourceId } from "../../common";
|
||||
import { SessionContainer } from "../../sessionContainer";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as assert from "assert";
|
||||
import assert from "assert";
|
||||
import { ClientContext } from "../../ClientContext";
|
||||
import { PartitionKeyRangeCache, QueryRange, SmartRoutingMapProvider } from "../../routing";
|
||||
import { MockedClientContext } from "../common/MockClientContext";
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
/// <reference types="node" />
|
||||
|
||||
declare module "create-hmac" {
|
||||
import { createHmac } from "crypto";
|
||||
|
||||
export = createHmac;
|
||||
}
|
|
@ -4,6 +4,8 @@
|
|||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"noImplicitAny": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"outDir": "./lib",
|
||||
"preserveConstEnums": true,
|
||||
"removeComments": false,
|
||||
|
|
Загрузка…
Ссылка в новой задаче