mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
M
rge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
{
|
||||
"packages": [
|
||||
{
|
||||
"libraryName": "ag-grid",
|
||||
"typingsPackageName": "ag-grid",
|
||||
"sourceRepoURL": "https://github.com/ceolter/ag-grid",
|
||||
"asOfVersion": "3.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "ajv",
|
||||
"typingsPackageName": "ajv",
|
||||
"sourceRepoURL": "https://github.com/epoberezkin/ajv",
|
||||
"asOfVersion": "1.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "angular-ui-router-default",
|
||||
"typingsPackageName": "angular-ui-router-default",
|
||||
"sourceRepoURL": "https://github.com/nonplus/angular-ui-router-default",
|
||||
"asOfVersion": "0.0.5"
|
||||
},
|
||||
{
|
||||
"libraryName": "antd",
|
||||
"typingsPackageName": "antd",
|
||||
@@ -60,6 +72,12 @@
|
||||
"sourceRepoURL": "http://www.babylonjs.com/",
|
||||
"asOfVersion": "2.4.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "base64url",
|
||||
"typingsPackageName": "base64url",
|
||||
"sourceRepoURL": "https://github.com/brianloveswords/base64url",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "BigInteger.js",
|
||||
"typingsPackageName": "big-integer",
|
||||
|
||||
@@ -23,8 +23,5 @@
|
||||
"devDependencies": {
|
||||
"dtslint": "Microsoft/dtslint#production",
|
||||
"types-publisher": "Microsoft/types-publisher#production"
|
||||
},
|
||||
"dependencies": {
|
||||
"jslint": "^0.10.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
|
||||
checkGridOptions(<ag.grid.GridOptions>{});
|
||||
checkColDef(<ag.grid.ColDef>{});
|
||||
|
||||
function checkGridOptions(gridOptions: ag.grid.GridOptions): void {
|
||||
|
||||
gridOptions.virtualPaging = true;
|
||||
gridOptions.toolPanelSuppressPivot = true;
|
||||
gridOptions.toolPanelSuppressValues = true;
|
||||
gridOptions.rowsAlreadyGrouped = true;
|
||||
gridOptions.suppressRowClickSelection = true;
|
||||
gridOptions.suppressCellSelection = true;
|
||||
gridOptions.sortingOrder = ['asc','desc'];
|
||||
gridOptions.suppressMultiSort = true;
|
||||
gridOptions.suppressHorizontalScroll = true;
|
||||
gridOptions.unSortIcon = true;
|
||||
gridOptions.rowHeight = 0;
|
||||
gridOptions.rowBuffer = 0;
|
||||
gridOptions.enableColResize = true;
|
||||
gridOptions.enableCellExpressions = true;
|
||||
gridOptions.enableSorting = true;
|
||||
gridOptions.enableServerSideSorting = true;
|
||||
gridOptions.enableFilter = true;
|
||||
gridOptions.enableServerSideFilter = true;
|
||||
gridOptions.colWidth = 0;
|
||||
gridOptions.suppressMenuHide = true;
|
||||
gridOptions.singleClickEdit = true;
|
||||
gridOptions.debug = true;
|
||||
gridOptions.icons = {};
|
||||
gridOptions.angularCompileRows = true;
|
||||
gridOptions.angularCompileFilters = true;
|
||||
gridOptions.angularCompileHeaders = true;
|
||||
gridOptions.localeText = {};
|
||||
gridOptions.localeTextFunc = function() {}
|
||||
gridOptions.suppressScrollLag = true;
|
||||
gridOptions.groupSuppressAutoColumn = true;
|
||||
gridOptions.groupSelectsChildren = true;
|
||||
gridOptions.groupHidePivotColumns = true;
|
||||
gridOptions.groupIncludeFooter = true;
|
||||
gridOptions.groupUseEntireRow = true;
|
||||
gridOptions.groupSuppressRow = true;
|
||||
gridOptions.groupSuppressBlankHeader = true;
|
||||
gridOptions.forPrint = true;
|
||||
gridOptions.groupColumnDef = {};
|
||||
gridOptions.context = {};
|
||||
gridOptions.rowStyle = {color: 'red'};
|
||||
gridOptions.rowClass = 'green';
|
||||
gridOptions.groupDefaultExpanded = false;
|
||||
gridOptions.slaveGrids = [];
|
||||
gridOptions.rowSelection = 'single';
|
||||
gridOptions.rowDeselection = true;
|
||||
gridOptions.rowData = [];
|
||||
gridOptions.floatingTopRowData = [];
|
||||
gridOptions.floatingBottomRowData = [];
|
||||
gridOptions.showToolPanel = true;
|
||||
gridOptions.groupKeys = ['a','b']
|
||||
gridOptions.groupAggFields = ['a','b']
|
||||
gridOptions.columnDefs = [];
|
||||
gridOptions.datasource = {};
|
||||
gridOptions.pinnedColumnCount = 0;
|
||||
gridOptions.groupHeaders = true;
|
||||
gridOptions.headerHeight = 0;
|
||||
gridOptions.groupRowInnerRenderer = function(params) {};
|
||||
gridOptions.groupRowRenderer = {};
|
||||
gridOptions.isScrollLag = function() {return true;}
|
||||
gridOptions.isExternalFilterPresent = function() { return true; };
|
||||
gridOptions.doesExternalFilterPass = function(node: ag.grid.RowNode) { return false; };
|
||||
gridOptions.getRowStyle = function() {};
|
||||
gridOptions.getRowClass = function() {};
|
||||
gridOptions.headerCellRenderer = function() {};
|
||||
gridOptions.groupAggFunction = function(nodes: any[]) {};
|
||||
gridOptions.onReady = function(api: any) {};
|
||||
gridOptions.onModelUpdated = function() {};
|
||||
gridOptions.onCellClicked = function(params) {};
|
||||
gridOptions.onCellDoubleClicked = function(params) {};
|
||||
gridOptions.onCellContextMenu = function(params) {};
|
||||
gridOptions.onCellValueChanged = function(params) {};
|
||||
gridOptions.onCellFocused = function(params) {};
|
||||
gridOptions.onRowSelected = function(params) {};
|
||||
gridOptions.onSelectionChanged = function() {};
|
||||
gridOptions.onBeforeFilterChanged = function() {};
|
||||
gridOptions.onAfterFilterChanged = function() {};
|
||||
gridOptions.onFilterModified = function() {};
|
||||
gridOptions.onBeforeSortChanged = function() {};
|
||||
gridOptions.onAfterSortChanged = function() {};
|
||||
gridOptions.onVirtualRowRemoved = function(params) {};
|
||||
gridOptions.onRowClicked = function(params) {};
|
||||
gridOptions.api = null;
|
||||
gridOptions.columnApi = null;
|
||||
|
||||
}
|
||||
|
||||
function checkColDef(colDef: ag.grid.ColDef): void {
|
||||
|
||||
colDef.sort = 'test';
|
||||
colDef.sortedAt = 0;
|
||||
colDef.sortingOrder = ['asc','desc'];
|
||||
colDef.headerName = 'test';
|
||||
colDef.field = 'test';
|
||||
colDef.headerValueGetter = 'test';
|
||||
colDef.colId = 'test';
|
||||
colDef.hide = true;
|
||||
colDef.headerTooltip = 'test';
|
||||
colDef.valueGetter = 'test';
|
||||
colDef.headerCellRenderer = {};
|
||||
colDef.headerClass = 'test';
|
||||
colDef.width = 0;
|
||||
colDef.minWidth = 0;
|
||||
colDef.maxWidth = 0;
|
||||
colDef.cellClass = 'test';
|
||||
colDef.cellStyle = {color: 'test'};
|
||||
colDef.cellRenderer = function() {};
|
||||
colDef.floatingCellRenderer = function() {};
|
||||
colDef.aggFunc = 'test';
|
||||
colDef.comparator = function() {};
|
||||
colDef.checkboxSelection = true;
|
||||
colDef.suppressMenu = true;
|
||||
colDef.suppressSorting = true;
|
||||
colDef.unSortIcon = true;
|
||||
colDef.suppressSizeToFit = true;
|
||||
colDef.suppressResize = true;
|
||||
colDef.headerGroup = 'test';
|
||||
colDef.headerGroupShow = 'test';
|
||||
colDef.editable = true;
|
||||
colDef.newValueHandler = function() {};
|
||||
colDef.volatile = true;
|
||||
colDef.template = 'test';
|
||||
colDef.templateUrl = 'test';
|
||||
colDef.filter = 'test';
|
||||
colDef.filterParams = {};
|
||||
colDef.onCellValueChanged = function() {};
|
||||
colDef.onCellClicked = function() {};
|
||||
colDef.onCellDoubleClicked = function() {};
|
||||
colDef.onCellContextMenu = function() {};
|
||||
colDef.cellClassRules = {};
|
||||
}
|
||||
Vendored
-1991
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
import AggregateError = require('aggregate-error');
|
||||
|
||||
const err = new AggregateError([new Error('foo'), 'bar']);
|
||||
|
||||
for (const el of Array.from(err)) {
|
||||
let err: Error = el;
|
||||
}
|
||||
|
||||
throw err;
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for aggregate-error 1.0
|
||||
// Project: https://github.com/sindresorhus/aggregate-error#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = AggregateError;
|
||||
|
||||
declare class AggregateError extends Error implements Iterable<Error> {
|
||||
constructor(errors: Iterable<Error | string>);
|
||||
|
||||
[Symbol.iterator](): Iterator<Error>;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"aggregate-error-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+3
@@ -61,6 +61,9 @@ declare module 'angular' {
|
||||
controllerAs(controllerAs?: string): T;
|
||||
parent(parent?: string | Element | JQuery): T; // default: root node
|
||||
ariaLabel(ariaLabel: string): T;
|
||||
openFrom(from: string | Element | Event | { top: number, left: number }): T;
|
||||
closeTo(to: string | Element | { top: number, left: number }): T;
|
||||
multiple(multiple: boolean): T;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
import * as angular from "angular";
|
||||
|
||||
angular.module("test", [
|
||||
"ui.router",
|
||||
"ui.router.default"
|
||||
])
|
||||
.config(function($stateProvider: angular.ui.IStateProvider) {
|
||||
$stateProvider
|
||||
.state('concrete', {
|
||||
// no abstract or default
|
||||
})
|
||||
.state('string', {
|
||||
abstract: true,
|
||||
default: 'concrete'
|
||||
})
|
||||
.state('func_str', {
|
||||
abstract: true,
|
||||
default: function($rootScope): string { return $rootScope.test; }
|
||||
})
|
||||
.state('func_promise', {
|
||||
abstract: true,
|
||||
default: function($q: ng.IQService): ng.IPromise<string> {
|
||||
return $q.when("concrete");
|
||||
}
|
||||
})
|
||||
.state('injection_str', {
|
||||
abstract: true,
|
||||
default: ["$rootScope", function($rootScope) {
|
||||
return $rootScope.test;
|
||||
}]
|
||||
})
|
||||
.state('injection_promise', {
|
||||
abstract: true,
|
||||
default: ["$q", function($q: ng.IQService) {
|
||||
return $q.when("concrete");
|
||||
}]
|
||||
})
|
||||
;
|
||||
});
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
// Type definitions for angular-ui-router-default 0.5
|
||||
// Project: https://github.com/nonplus/angular-ui-router-default
|
||||
// Definitions by: Stepan Riha <https://github.com/nonplus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as aur from "angular-ui-router";
|
||||
|
||||
declare module "angular" {
|
||||
namespace ui {
|
||||
export type StateDefaultSpecifier = string
|
||||
| ((...args: any[]) => string)
|
||||
| ((...args: any[]) => ng.IPromise<string>)
|
||||
| (string | ((...args: any[]) => string))[]
|
||||
| (string | ((...args: any[]) => ng.IPromise<string>))[];
|
||||
interface IState {
|
||||
default?: StateDefaultSpecifier
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { unlessProduction, isDevelopment, isTest, isProduction, getEnv, setEnv } from 'asenv';
|
||||
import { equal, throws } from 'assert';
|
||||
|
||||
// Test isDevelopment()
|
||||
setEnv('development');
|
||||
equal(getEnv(), 'development', 'Should return be true');
|
||||
equal(isDevelopment(), true, 'NODE_ENV should be "development"');
|
||||
equal(isTest(), false, 'NODE_ENV should be "development"');
|
||||
equal(isProduction(), false, 'NODE_ENV should be "development"');
|
||||
equal(unlessProduction(() => true), true, "Shound return true");
|
||||
|
||||
// Test isTest()
|
||||
setEnv('test');
|
||||
equal(getEnv(), 'test', 'Should return be true');
|
||||
equal(isDevelopment(), false, 'NODE_ENV should be "test"');
|
||||
equal(isTest(), true, 'NODE_ENV should be "test"');
|
||||
equal(isProduction(), false, 'NODE_ENV should be "test"');
|
||||
equal(unlessProduction(() => true), true, "Shound return true");
|
||||
|
||||
// Test isProduction()
|
||||
setEnv('production');
|
||||
equal(getEnv(), 'production', 'Should return be true');
|
||||
equal(isDevelopment(), false, 'NODE_ENV should be "production"');
|
||||
equal(isTest(), false, 'NODE_ENV should be "production"');
|
||||
equal(isProduction(), true, 'NODE_ENV should be "production"');
|
||||
equal(unlessProduction(() => true), false, "Shound return false");
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for asenv 1.1
|
||||
// Project: https://github.com/a-labo/asenv#readme
|
||||
// Definitions by: Remisery <https://github.com/remisery>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export function getEnv(): string;
|
||||
|
||||
export function isDevelopment(): boolean;
|
||||
|
||||
export function isProduction(): boolean;
|
||||
|
||||
export function isTest(): boolean;
|
||||
|
||||
export function setEnv(env: string): void;
|
||||
|
||||
export function unlessProduction(handle: () => any): any;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"asenv-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import * as webpack from 'webpack';
|
||||
import * as AssetsPlugin from 'assets-webpack-plugin';
|
||||
|
||||
const config: webpack.Configuration = {
|
||||
plugins: [
|
||||
new AssetsPlugin(),
|
||||
new AssetsPlugin({
|
||||
filename: 'assets.json'
|
||||
}),
|
||||
new AssetsPlugin({
|
||||
filename: 'assets.json',
|
||||
fullPath: false,
|
||||
includeManifest: true,
|
||||
path: '/foo/bar',
|
||||
prettyPrint: true,
|
||||
processOutput: (assets) => (
|
||||
'window.assets = ' + JSON.stringify(assets)
|
||||
),
|
||||
update: true,
|
||||
metadata: {
|
||||
meta: 'data'
|
||||
},
|
||||
})
|
||||
]
|
||||
};
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
// Type definitions for assets-webpack-plugin 3.5
|
||||
// Project: https://github.com/sporto/assets-webpack-plugin
|
||||
// Definitions by: Michael Strobel <https://github.com/kryops>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
|
||||
declare namespace AssetsWebpackPlugin {
|
||||
interface Assets {
|
||||
[name: string]: {
|
||||
[ext: string]: string;
|
||||
};
|
||||
}
|
||||
|
||||
type ProcessOutputFn = (assets: Assets) => string;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Name for the created json file.
|
||||
* "webpack-assets.json" by default
|
||||
*/
|
||||
filename?: string;
|
||||
|
||||
/**
|
||||
* If false the output will not include the full path of the generated file.
|
||||
* true by default
|
||||
*/
|
||||
fullPath?: boolean;
|
||||
|
||||
/**
|
||||
* Inserts the manifest javascript as a text property in your assets.
|
||||
* Accepts the name of your manifest chunk.
|
||||
* A manifest is the last CommonChunk that only contains the webpack bootstrap code.
|
||||
* This is useful for production use when you want to inline the manifest
|
||||
* in your HTML skeleton for long-term caching.
|
||||
* false by default
|
||||
*/
|
||||
includeManifest?: boolean;
|
||||
|
||||
/**
|
||||
* Inject metadata into the output file. All values will be injected into the key "metadata"
|
||||
*/
|
||||
metadata?: object;
|
||||
|
||||
/**
|
||||
* Path where to save the created JSON file.
|
||||
* Defaults to the current directory
|
||||
*/
|
||||
path?: string;
|
||||
|
||||
/**
|
||||
* Whether to format the JSON output for readability.
|
||||
* false by default
|
||||
*/
|
||||
prettyPrint?: boolean;
|
||||
|
||||
/**
|
||||
* Formats the assets output.
|
||||
* Defaults to JSON.stringify
|
||||
*/
|
||||
processOutput?: ProcessOutputFn;
|
||||
|
||||
/**
|
||||
* When set to true, the output JSON file will be updated instead of overwritten.
|
||||
* false by default
|
||||
*/
|
||||
update?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare class AssetsWebpackPlugin extends webpack.Plugin {
|
||||
constructor(options?: AssetsWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
export = AssetsWebpackPlugin;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"assets-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+2
-2
@@ -98,9 +98,9 @@ export class Scope {
|
||||
|
||||
bindingIdentifierEquals(name: string, node: Node): boolean;
|
||||
|
||||
getBinding(name: string): Binding;
|
||||
getBinding(name: string): Binding | undefined;
|
||||
|
||||
getOwnBinding(name: string): Binding;
|
||||
getOwnBinding(name: string): Binding | undefined;
|
||||
|
||||
getBindingIdentifier(name: string): t.Identifier;
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@ import * as base64js from "base64-js";
|
||||
|
||||
base64js.byteLength(""); // $ExpectType number
|
||||
base64js.toByteArray(""); // $ExpectType Uint8Array
|
||||
base64js.fromByteArray(new Uint8Array(0)); // $ExpectTpe string
|
||||
base64js.fromByteArray(new Uint8Array(0)); // $ExpectType string
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import * as base64url from "base64url";
|
||||
|
||||
// default
|
||||
let str = base64url("some value");
|
||||
str = base64url("some value", "hex");
|
||||
str = base64url(new Buffer("some value"));
|
||||
|
||||
// encode
|
||||
str = base64url.encode("some value");
|
||||
str = base64url.encode("some value", "hex");
|
||||
str = base64url.encode(new Buffer("some value"));
|
||||
|
||||
// decode
|
||||
str = base64url.decode("ADA=");
|
||||
str = base64url.decode("ADA=", "binary");
|
||||
|
||||
// toBase64
|
||||
str = base64url.toBase64("ADA=");
|
||||
str = base64url.toBase64(new Buffer("ADA=", "base64"));
|
||||
|
||||
// fromBase64
|
||||
str = base64url.fromBase64("ADA=");
|
||||
|
||||
let buf = base64url.toBase64("ADA=");
|
||||
Vendored
-72
@@ -1,72 +0,0 @@
|
||||
// Type definitions for base64url v2.0.0
|
||||
// Project: https://github.com/brianloveswords/base64url
|
||||
// Definitions by: Stepan Miroshin <https://github.com/microshine>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
/**
|
||||
* For encoding and decoding base64url!
|
||||
* v2.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Encoding type
|
||||
*/
|
||||
declare type Encoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "utf16le" | "base64" | "binary" | "hex"
|
||||
|
||||
interface IBase64Url {
|
||||
/**
|
||||
* Encode input to base64url
|
||||
* @param {string} input Incoming input
|
||||
* @param {Encoding} encoding Default 'utf8'
|
||||
* @return {string}
|
||||
*/
|
||||
(input: string, encoding?: Encoding): string;
|
||||
/**
|
||||
* Encode input to base64url
|
||||
* @param {Buffer} input Incoming value
|
||||
*/
|
||||
(inout: Buffer): string;
|
||||
/**
|
||||
* Encode input to base64url
|
||||
*
|
||||
* @param {string} input Incoming input
|
||||
* @param {Encoding} encoding Default 'utf8'
|
||||
* @returns {string}
|
||||
*/
|
||||
encode(input: string, encoding?: Encoding): string;
|
||||
/**
|
||||
* Encode input to base64url
|
||||
* @param {Buffer} input Incoming value
|
||||
*/
|
||||
encode(input: Buffer): string;
|
||||
/**
|
||||
* Convert a base64url encoded string into a raw string.
|
||||
* @param {string} base64url base64url encoded string
|
||||
* @param {Encoding} encoding Encoding defaults to 'utf8'
|
||||
* @returns {string}
|
||||
*/
|
||||
decode(base64url: string, encoding?: string): string;
|
||||
/**
|
||||
* Convert a base64url encoded string to a base64 encoded string
|
||||
* @param {string | Buffer} base64url base64url encoded value
|
||||
* @returns {string}
|
||||
*/
|
||||
toBase64(base64url: string | Buffer): string;
|
||||
/**
|
||||
* Convert a base64 encoded string to a base64url encoded string
|
||||
* @param {string} base64 encoded string
|
||||
* @returns {string}
|
||||
*/
|
||||
fromBase64(base64: string): string;
|
||||
/**
|
||||
* Convert a base64url encoded string to a Buffer
|
||||
* @param {string} base64url encoded string
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
toBuffer(base64url: string): Buffer;
|
||||
}
|
||||
|
||||
declare const base64url: IBase64Url;
|
||||
export = base64url;
|
||||
+232
-234
@@ -1,248 +1,246 @@
|
||||
import * as CanvasJS from "canvasjs";
|
||||
|
||||
|
||||
namespace CanvasJS.Tests {
|
||||
// Column Chart
|
||||
var columnChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
title: {
|
||||
text: "Top Oil Reserves",
|
||||
},
|
||||
axisY: {
|
||||
title: "Reserves(MMbbl)"
|
||||
},
|
||||
legend: {
|
||||
verticalAlign: "bottom",
|
||||
horizontalAlign: "center"
|
||||
},
|
||||
theme: "theme2",
|
||||
data: [
|
||||
{
|
||||
type: "column",
|
||||
showInLegend: true,
|
||||
legendMarkerColor: "grey",
|
||||
legendText: "MMbbl = one million barrels",
|
||||
dataPoints: [
|
||||
{ y: 297571, label: "Venezuela" },
|
||||
{ y: 267017, label: "Saudi" },
|
||||
{ y: 175200, label: "Canada" },
|
||||
{ y: 154580, label: "Iran" },
|
||||
{ y: 116000, label: "Russia" },
|
||||
{ y: 97800, label: "UAE" },
|
||||
{ y: 20682, label: "US" },
|
||||
{ y: 20350, label: "China" }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
columnChart.render();
|
||||
|
||||
// Line Chart
|
||||
var lineChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
theme: "theme2",
|
||||
title: {
|
||||
text: "Earthquakes - per month"
|
||||
},
|
||||
axisX: {
|
||||
valueFormatString: "MMM",
|
||||
interval: 1,
|
||||
intervalType: "month"
|
||||
|
||||
},
|
||||
axisY: {
|
||||
includeZero: false
|
||||
|
||||
},
|
||||
data: [
|
||||
{
|
||||
type: "line",
|
||||
//lineThickness: 3,
|
||||
dataPoints: [
|
||||
{ x: new Date(2012, 0, 1), y: 450 },
|
||||
{ x: new Date(2012, 1, 1), y: 414 },
|
||||
{ x: new Date(2012, 2, 1), y: 520, indexLabel: "highest", markerColor: "red", markerType: "triangle" },
|
||||
{ x: new Date(2012, 3, 1), y: 460 },
|
||||
{ x: new Date(2012, 4, 1), y: 450 },
|
||||
{ x: new Date(2012, 5, 1), y: 500 },
|
||||
{ x: new Date(2012, 6, 1), y: 480 },
|
||||
{ x: new Date(2012, 7, 1), y: 480 },
|
||||
{ x: new Date(2012, 8, 1), y: 410, indexLabel: "lowest", markerColor: "DarkSlateGrey", markerType: "cross" },
|
||||
{ x: new Date(2012, 9, 1), y: 500 },
|
||||
{ x: new Date(2012, 10, 1), y: 480 },
|
||||
{ x: new Date(2012, 11, 1), y: 510 }
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
});
|
||||
lineChart.render();
|
||||
|
||||
// Spline Chart
|
||||
var splineChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
theme: "theme2",
|
||||
title: {
|
||||
text: "Game of Thrones, Viewers of the first airing on HBO"
|
||||
},
|
||||
axisY: {
|
||||
includeZero: false,
|
||||
// suffix: " k",
|
||||
valueFormatString: "#,,.",
|
||||
suffix: " mn"
|
||||
},
|
||||
toolTip: {
|
||||
shared: true
|
||||
},
|
||||
data: [
|
||||
{
|
||||
type: "spline",
|
||||
showInLegend: true,
|
||||
name: "Season 2",
|
||||
// markerSize: 0,
|
||||
// color: "rgba(54,158,173,.6)",
|
||||
dataPoints: [
|
||||
{ label: "Ep. 1", y: 3858000 },
|
||||
{ label: "Ep. 2", y: 3759000 },
|
||||
{ label: "Ep. 3", y: 3766000 },
|
||||
{ label: "Ep. 4", y: 3654000 },
|
||||
{ label: "Ep. 5", y: 3903000 },
|
||||
{ label: "Ep. 6", y: 3879000 },
|
||||
{ label: "Ep. 7", y: 3694000 },
|
||||
{ label: "Ep. 8", y: 3864000 },
|
||||
{ label: "Ep. 9", y: 3384000 },
|
||||
{ label: "Ep. 10", y: 4200000 }
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "spline",
|
||||
showInLegend: true,
|
||||
// markerSize: 0,
|
||||
name: "Season 1",
|
||||
dataPoints: [
|
||||
{ label: "Ep. 1", y: 2220000 },
|
||||
{ label: "Ep. 2", y: 2200000 },
|
||||
{ label: "Ep. 3", y: 2440000 },
|
||||
{ label: "Ep. 4", y: 2450000 },
|
||||
{ label: "Ep. 5", y: 2580000 },
|
||||
{ label: "Ep. 6", y: 2440000 },
|
||||
{ label: "Ep. 7", y: 2400000 },
|
||||
{ label: "Ep. 8", y: 2720000 },
|
||||
{ label: "Ep. 9", y: 2660000 },
|
||||
{ label: "Ep. 10", y: 3040000 }
|
||||
|
||||
]
|
||||
}
|
||||
],
|
||||
legend: {
|
||||
cursor: "pointer",
|
||||
itemclick: function (e) {
|
||||
if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
|
||||
e.dataSeries.visible = false;
|
||||
}
|
||||
else {
|
||||
e.dataSeries.visible = true;
|
||||
}
|
||||
splineChart.render();
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
splineChart.render();
|
||||
|
||||
// Bar Chart
|
||||
var barChart = new CanvasJS.Chart("chartContainer", {
|
||||
|
||||
// Column Chart
|
||||
let columnChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
title: {
|
||||
text: "Fortune Global 500 Companies by Country"
|
||||
},
|
||||
axisX: {
|
||||
interval: 1,
|
||||
gridThickness: 0,
|
||||
labelFontSize: 10,
|
||||
labelFontStyle: "normal",
|
||||
labelFontWeight: "normal",
|
||||
labelFontFamily: "Lucida Sans Unicode"
|
||||
text: "Top Oil Reserves",
|
||||
},
|
||||
axisY: {
|
||||
interlacedColor: "rgba(1,77,101,.2)",
|
||||
gridColor: "rgba(1,77,101,.1)"
|
||||
title: "Reserves(MMbbl)"
|
||||
},
|
||||
legend: {
|
||||
verticalAlign: "bottom",
|
||||
horizontalAlign: "center"
|
||||
},
|
||||
theme: "theme2",
|
||||
data: [
|
||||
{
|
||||
type: "bar",
|
||||
name: "companies",
|
||||
axisYType: "secondary",
|
||||
color: "#014D65",
|
||||
type: "column",
|
||||
showInLegend: true,
|
||||
legendMarkerColor: "grey",
|
||||
legendText: "MMbbl = one million barrels",
|
||||
dataPoints: [
|
||||
{ y: 5, label: "Sweden" },
|
||||
{ y: 6, label: "Taiwan" },
|
||||
{ y: 7, label: "Russia" },
|
||||
{ y: 8, label: "Spain" },
|
||||
{ y: 8, label: "Brazil" },
|
||||
{ y: 8, label: "India" },
|
||||
{ y: 9, label: "Italy" },
|
||||
{ y: 9, label: "Australia" },
|
||||
{ y: 12, label: "Canada" },
|
||||
{ y: 13, label: "South Korea" },
|
||||
{ y: 13, label: "Netherlands" },
|
||||
{ y: 15, label: "Switzerland" },
|
||||
{ y: 28, label: "Britain" },
|
||||
{ y: 32, label: "Germany" },
|
||||
{ y: 32, label: "France" },
|
||||
{ y: 68, label: "Japan" },
|
||||
{ y: 73, label: "China" },
|
||||
{ y: 132, label: "US" }
|
||||
{ y: 297571, label: "Venezuela" },
|
||||
{ y: 267017, label: "Saudi" },
|
||||
{ y: 175200, label: "Canada" },
|
||||
{ y: 154580, label: "Iran" },
|
||||
{ y: 116000, label: "Russia" },
|
||||
{ y: 97800, label: "UAE" },
|
||||
{ y: 20682, label: "US" },
|
||||
{ y: 20350, label: "China" }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
barChart.render();
|
||||
columnChart.render();
|
||||
let option = columnChart.get("title");
|
||||
columnChart.print();
|
||||
columnChart.exportChart({ format: "jpg" });
|
||||
columnChart.destroy();
|
||||
columnChart.axisX[0].convertPixelToValue(20);
|
||||
columnChart.toolTip.get("text");
|
||||
|
||||
// Pie Chart
|
||||
var pieChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
title: {
|
||||
text: "Desktop Search Engine Market Share, Dec-2012"
|
||||
},
|
||||
legend: {
|
||||
verticalAlign: "center",
|
||||
horizontalAlign: "left",
|
||||
fontSize: 20,
|
||||
fontFamily: "Helvetica"
|
||||
},
|
||||
theme: "theme2",
|
||||
data: [
|
||||
{
|
||||
type: "pie",
|
||||
indexLabelFontFamily: "Garamond",
|
||||
indexLabelFontSize: 20,
|
||||
indexLabel: "{label} {y}%",
|
||||
startAngle: -20,
|
||||
showInLegend: true,
|
||||
toolTipContent: "{legendText} {y}%",
|
||||
dataPoints: [
|
||||
{ y: 83.24, legendText: "Google", label: "Google" },
|
||||
{ y: 8.16, legendText: "Yahoo!", label: "Yahoo!" },
|
||||
{ y: 4.67, legendText: "Bing", label: "Bing" },
|
||||
{ y: 1.67, legendText: "Baidu", label: "Baidu" },
|
||||
{ y: 0.98, legendText: "Others", label: "Others" }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
pieChart.render();
|
||||
|
||||
addColorSet("MyColorSet", [
|
||||
"123456",
|
||||
"blue",
|
||||
"red",
|
||||
"orange"
|
||||
]);
|
||||
|
||||
addCultureInfo("js", {
|
||||
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
||||
// Line Chart
|
||||
let lineChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
theme: "theme2",
|
||||
title: {
|
||||
text: "Earthquakes - per month"
|
||||
},
|
||||
axisX: {
|
||||
valueFormatString: "MMM",
|
||||
interval: 1,
|
||||
intervalType: "month"
|
||||
},
|
||||
axisY: {
|
||||
includeZero: false
|
||||
},
|
||||
data: [
|
||||
{
|
||||
type: "line",
|
||||
// lineThickness: 3,
|
||||
dataPoints: [
|
||||
{ x: new Date(2012, 0, 1), y: 450 },
|
||||
{ x: new Date(2012, 1, 1), y: 414 },
|
||||
{ x: new Date(2012, 2, 1), y: 520, indexLabel: "highest", markerColor: "red", markerType: "triangle" },
|
||||
{ x: new Date(2012, 3, 1), y: 460 },
|
||||
{ x: new Date(2012, 4, 1), y: 450 },
|
||||
{ x: new Date(2012, 5, 1), y: 500 },
|
||||
{ x: new Date(2012, 6, 1), y: 480 },
|
||||
{ x: new Date(2012, 7, 1), y: 480 },
|
||||
{ x: new Date(2012, 8, 1), y: 410, indexLabel: "lowest", markerColor: "DarkSlateGrey", markerType: "cross" },
|
||||
{ x: new Date(2012, 9, 1), y: 500 },
|
||||
{ x: new Date(2012, 10, 1), y: 480 },
|
||||
{ x: new Date(2012, 11, 1), y: 510 }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
lineChart.render();
|
||||
|
||||
// Spline Chart
|
||||
let splineChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
theme: "theme2",
|
||||
title: {
|
||||
text: "Game of Thrones, Viewers of the first airing on HBO"
|
||||
},
|
||||
axisY: {
|
||||
includeZero: false,
|
||||
// suffix: " k",
|
||||
valueFormatString: "#,,.",
|
||||
suffix: " mn"
|
||||
},
|
||||
toolTip: {
|
||||
shared: true
|
||||
},
|
||||
data: [
|
||||
{
|
||||
type: "spline",
|
||||
showInLegend: true,
|
||||
name: "Season 2",
|
||||
// markerSize: 0,
|
||||
// color: "rgba(54,158,173,.6)",
|
||||
dataPoints: [
|
||||
{ label: "Ep. 1", y: 3858000 },
|
||||
{ label: "Ep. 2", y: 3759000 },
|
||||
{ label: "Ep. 3", y: 3766000 },
|
||||
{ label: "Ep. 4", y: 3654000 },
|
||||
{ label: "Ep. 5", y: 3903000 },
|
||||
{ label: "Ep. 6", y: 3879000 },
|
||||
{ label: "Ep. 7", y: 3694000 },
|
||||
{ label: "Ep. 8", y: 3864000 },
|
||||
{ label: "Ep. 9", y: 3384000 },
|
||||
{ label: "Ep. 10", y: 4200000 }
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "spline",
|
||||
showInLegend: true,
|
||||
// markerSize: 0,
|
||||
name: "Season 1",
|
||||
dataPoints: [
|
||||
{ label: "Ep. 1", y: 2220000 },
|
||||
{ label: "Ep. 2", y: 2200000 },
|
||||
{ label: "Ep. 3", y: 2440000 },
|
||||
{ label: "Ep. 4", y: 2450000 },
|
||||
{ label: "Ep. 5", y: 2580000 },
|
||||
{ label: "Ep. 6", y: 2440000 },
|
||||
{ label: "Ep. 7", y: 2400000 },
|
||||
{ label: "Ep. 8", y: 2720000 },
|
||||
{ label: "Ep. 9", y: 2660000 },
|
||||
{ label: "Ep. 10", y: 3040000 }
|
||||
]
|
||||
}
|
||||
],
|
||||
legend: {
|
||||
cursor: "pointer",
|
||||
itemclick: (e) => {
|
||||
if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
|
||||
e.dataSeries.visible = false;
|
||||
} else {
|
||||
e.dataSeries.visible = true;
|
||||
}
|
||||
splineChart.render();
|
||||
}
|
||||
},
|
||||
});
|
||||
splineChart.render();
|
||||
|
||||
// Bar Chart
|
||||
let barChart = new CanvasJS.Chart("chartContainer", {
|
||||
title: {
|
||||
text: "Fortune Global 500 Companies by Country"
|
||||
},
|
||||
axisX: {
|
||||
interval: 1,
|
||||
gridThickness: 0,
|
||||
labelFontSize: 10,
|
||||
labelFontStyle: "normal",
|
||||
labelFontWeight: "normal",
|
||||
labelFontFamily: "Lucida Sans Unicode"
|
||||
},
|
||||
axisY: {
|
||||
interlacedColor: "rgba(1,77,101,.2)",
|
||||
gridColor: "rgba(1,77,101,.1)"
|
||||
},
|
||||
data: [
|
||||
{
|
||||
type: "bar",
|
||||
name: "companies",
|
||||
axisYType: "secondary",
|
||||
color: "#014D65",
|
||||
dataPoints: [
|
||||
{ y: 5, label: "Sweden" },
|
||||
{ y: 6, label: "Taiwan" },
|
||||
{ y: 7, label: "Russia" },
|
||||
{ y: 8, label: "Spain" },
|
||||
{ y: 8, label: "Brazil" },
|
||||
{ y: 8, label: "India" },
|
||||
{ y: 9, label: "Italy" },
|
||||
{ y: 9, label: "Australia" },
|
||||
{ y: 12, label: "Canada" },
|
||||
{ y: 13, label: "South Korea" },
|
||||
{ y: 13, label: "Netherlands" },
|
||||
{ y: 15, label: "Switzerland" },
|
||||
{ y: 28, label: "Britain" },
|
||||
{ y: 32, label: "Germany" },
|
||||
{ y: 32, label: "France" },
|
||||
{ y: 68, label: "Japan" },
|
||||
{ y: 73, label: "China" },
|
||||
{ y: 132, label: "US" }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
barChart.render();
|
||||
|
||||
// Pie Chart
|
||||
let pieChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
title: {
|
||||
text: "Desktop Search Engine Market Share, Dec-2012"
|
||||
},
|
||||
legend: {
|
||||
verticalAlign: "center",
|
||||
horizontalAlign: "left",
|
||||
fontSize: 20,
|
||||
fontFamily: "Helvetica"
|
||||
},
|
||||
theme: "theme2",
|
||||
data: [
|
||||
{
|
||||
type: "pie",
|
||||
indexLabelFontFamily: "Garamond",
|
||||
indexLabelFontSize: 20,
|
||||
indexLabel: "{label} {y}%",
|
||||
startAngle: -20,
|
||||
showInLegend: true,
|
||||
toolTipContent: "{legendText} {y}%",
|
||||
dataPoints: [
|
||||
{ y: 83.24, legendText: "Google", label: "Google" },
|
||||
{ y: 8.16, legendText: "Yahoo!", label: "Yahoo!" },
|
||||
{ y: 4.67, legendText: "Bing", label: "Bing" },
|
||||
{ y: 1.67, legendText: "Baidu", label: "Baidu" },
|
||||
{ y: 0.98, legendText: "Others", label: "Others" }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
pieChart.render();
|
||||
|
||||
CanvasJS.addColorSet("MyColorSet", [
|
||||
"123456",
|
||||
"blue",
|
||||
"red",
|
||||
"orange"
|
||||
]);
|
||||
|
||||
CanvasJS.addCultureInfo("js", {
|
||||
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
||||
});
|
||||
|
||||
CanvasJS.formatNumber(20);
|
||||
|
||||
CanvasJS.formatDate(new Date());
|
||||
|
||||
Vendored
+1421
-720
File diff suppressed because it is too large
Load Diff
@@ -19,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"canvasjs-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -39,7 +39,7 @@ chai.request(app)
|
||||
|
||||
chai.request(app)
|
||||
.get('/search')
|
||||
.query({name: 'foo', limit: 10});
|
||||
.query({ name: 'foo', limit: 10 });
|
||||
|
||||
chai.request(app)
|
||||
.put('/user/me')
|
||||
@@ -98,3 +98,9 @@ function test1() {
|
||||
}
|
||||
|
||||
when(chai.request(app).get('/')).done(() => console.log('success'), () => console.log('failure'));
|
||||
|
||||
Promise.resolve(1)
|
||||
.then(val => chai.request(app).get(`/user/${val}`))
|
||||
.then(res => {
|
||||
chai.expect(res).to.have.status(200);
|
||||
});
|
||||
|
||||
Vendored
+6
-4
@@ -1,8 +1,10 @@
|
||||
// Type definitions for chai-http 3.0
|
||||
// Project: https://github.com/chaijs/chai-http
|
||||
// Definitions by: Wim Looman <https://github.com/Nemo157>
|
||||
// Liam Jones <https://github.com/G1itcher>
|
||||
// Liam Jones <https://github.com/G1itcher>
|
||||
// Federico Caselli <https://github.com/CaselIT>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
/// <reference types="chai" />
|
||||
@@ -60,9 +62,9 @@ declare global {
|
||||
end(callback?: (err: any, res: Response) => void): FinishedRequest;
|
||||
}
|
||||
|
||||
interface FinishedRequest {
|
||||
then(success?: (res: Response) => void, failure?: (err: any) => void): FinishedRequest;
|
||||
catch(failure?: (err: any) => void): FinishedRequest;
|
||||
interface FinishedRequest<T = Response>{
|
||||
then<TR1 = T, TR2 = void>(success?: (res: T) => TR1 | PromiseLike<TR1>, failure?: (err: any) => TR2 | PromiseLike<TR2>): FinishedRequest<TR1>;
|
||||
catch(failure?: (err: any) => void): FinishedRequest<T>;
|
||||
}
|
||||
|
||||
interface Agent {
|
||||
|
||||
Vendored
+3
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Alberto Nuti <https://github.com/anuti>
|
||||
// Fabien Lavocat <https://github.com/FabienLavocat>
|
||||
// KentarouTakeda <https://github.com/KentarouTakeda/>
|
||||
// Larry Bahr <https://github.com/larrybahr/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -158,6 +159,8 @@ declare namespace Chart {
|
||||
animation?: ChartAnimationOptions;
|
||||
elements?: ChartElementsOptions;
|
||||
scales?: ChartScales;
|
||||
showLines?: boolean;
|
||||
spanGaps?: boolean;
|
||||
cutoutPercentage?: number;
|
||||
circumference?: number;
|
||||
rotation?: number;
|
||||
|
||||
Vendored
+1
-1
@@ -7366,7 +7366,7 @@ declare namespace chrome.webRequest {
|
||||
interface WebRedirectionResponseEvent extends _WebResponseHeadersEvent<WebRedirectionResponseDetails> {}
|
||||
|
||||
interface WebAuthenticationChallengeEvent extends chrome.events.Event<(details: WebAuthenticationChallengeDetails, callback?: (response: BlockingResponse) => void) => void> {
|
||||
addListener(callback: (details: WebAuthenticationChallengeDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: WebAuthenticationChallengeDetails, callback?: (response: BlockingResponse) => void) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
}
|
||||
|
||||
interface WebResponseErrorEvent extends _WebResponseHeadersEvent<WebResponseErrorDetails> {}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import copy = require('copy-text-to-clipboard');
|
||||
|
||||
const button: HTMLButtonElement | null = <HTMLButtonElement> document.getElementById('my-button');
|
||||
if (button) {
|
||||
button.addEventListener('click', () => {
|
||||
copy('🦄🌈');
|
||||
});
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for copy-text-to-clipboard 1.0
|
||||
// Project: https://github.com/sindresorhus/copy-text-to-clipboard#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = copy;
|
||||
|
||||
declare function copy(text: string): boolean;
|
||||
+2
-2
@@ -18,6 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-ui-router-default-tests.ts"
|
||||
"copy-text-to-clipboard-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,19 @@
|
||||
import cpFile = require('cp-file');
|
||||
|
||||
cpFile('src/unicorn.png', 'dist/unicorn.png').then(() => {});
|
||||
cpFile('src/unicorn.png', 'dist/unicorn.png', {overwrite: false}).then(() => {});
|
||||
cpFile('src/unicorn.png', 'dist/unicorn.png')
|
||||
.on('progress', data => {
|
||||
let str: string;
|
||||
let num: number;
|
||||
|
||||
str = data.src;
|
||||
str = data.dest;
|
||||
num = data.size;
|
||||
num = data.written;
|
||||
num = data.percent;
|
||||
})
|
||||
.then(() => {});
|
||||
|
||||
cpFile.sync('src/unicorn.png', 'dist/unicorn.png');
|
||||
cpFile.sync('src/unicorn.png', 'dist/unicorn.png', {overwrite: false});
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for cp-file 4.2
|
||||
// Project: https://github.com/sindresorhus/cp-file#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = cpFile;
|
||||
|
||||
declare function cpFile(source: string, destination: string, options?: cpFile.Options): Promise<void> & cpFile.ProgressEmitter;
|
||||
|
||||
declare namespace cpFile {
|
||||
function sync(source: string, destination: string, options?: Options): void;
|
||||
|
||||
interface ProgressEmitter {
|
||||
on(event: 'progress', handler: (data: ProgressData) => void): Promise<void>;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
overwrite?: boolean;
|
||||
}
|
||||
|
||||
interface ProgressData {
|
||||
src: string;
|
||||
dest: string;
|
||||
size: number;
|
||||
written: number;
|
||||
percent: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cp-file-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+14
-5
@@ -1,9 +1,18 @@
|
||||
import cpy = require('cpy');
|
||||
|
||||
cpy(['src/*.png', '!src/goat.png'], 'dist').then(() => {
|
||||
console.log('files copied');
|
||||
});
|
||||
|
||||
cpy(['src/*.png', '!src/goat.png'], 'dist').then(() => {});
|
||||
cpy('foo.js', 'destination', {
|
||||
rename: basename => `prefix-${basename}`
|
||||
rename: basename => `prefix-${basename}`,
|
||||
cwd: '/',
|
||||
parents: true,
|
||||
stat: true,
|
||||
overwrite: false,
|
||||
});
|
||||
cpy('foo.js', 'destination')
|
||||
.on('progress', progress => {
|
||||
let num: number;
|
||||
num = progress.completedFiles;
|
||||
num = progress.totalFiles;
|
||||
num = progress.completedSize;
|
||||
})
|
||||
.then(() => {});
|
||||
|
||||
Vendored
+26
-5
@@ -1,10 +1,31 @@
|
||||
// Type definitions for cpy 5.0
|
||||
// Type definitions for cpy 5.1
|
||||
// Project: https://github.com/sindresorhus/cpy#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import glob = require('glob');
|
||||
import cpFile = require('cp-file');
|
||||
|
||||
export = cpy;
|
||||
declare function cpy(
|
||||
src: string | string[],
|
||||
dest: string,
|
||||
opts?: { cwd?: string, parents?: boolean, rename?(s: string): string }): Promise<void>;
|
||||
declare function cpy(files: string | string[], destination: string, opts?: cpy.Options): Promise<void> & cpy.ProgressEmitter;
|
||||
|
||||
declare namespace cpy {
|
||||
interface ProgressEmitter {
|
||||
on(event: 'progress', handler: (progress: ProgressData) => void): Promise<void>;
|
||||
}
|
||||
|
||||
type Options = CpyOptions & glob.IOptions & cpFile.Options;
|
||||
|
||||
interface CpyOptions {
|
||||
cwd?: string;
|
||||
parents?: boolean;
|
||||
rename?: string | ((basename: string) => string);
|
||||
}
|
||||
|
||||
interface ProgressData {
|
||||
completedFiles: number;
|
||||
totalFiles: number;
|
||||
completedSize: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
@@ -20,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"cpy-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,18 +54,29 @@ let mixedOrUndefinedExtent: [d3Array.Primitive | NumCoercible, d3Array.Primitive
|
||||
let dateOrUndefinedExtent: [Date, Date] | [undefined, undefined];
|
||||
|
||||
let numbersArray = [10, 20, 30, 40, 50];
|
||||
const numbersOrUndefinedArray = [10, 20, undefined, null, 40, 50];
|
||||
const stringyNumbersArray = ['10', '20', '30', '40', '50'];
|
||||
const numericArray = [new NumCoercible(10), new NumCoercible(20), new NumCoercible(30), new NumCoercible(40), new NumCoercible(50)];
|
||||
const dateArray = [new Date(2016, 6, 1), new Date(2016, 7, 30), new Date(2015, 3, 15)];
|
||||
const mixedObjectArray = [
|
||||
let numbersOrUndefinedArray = [10, 20, undefined, null, 40, 50];
|
||||
let stringyNumbersArray = ['10', '20', '30', '40', '50'];
|
||||
let numericArray = [new NumCoercible(10), new NumCoercible(20), new NumCoercible(30), new NumCoercible(40), new NumCoercible(50)];
|
||||
let dateArray = [new Date(2016, 6, 1), new Date(2016, 7, 30), new Date(2015, 3, 15)];
|
||||
|
||||
let mixedObjectArray = [
|
||||
new MixedObject(10, new Date(2016, 6, 1)),
|
||||
new MixedObject(20, new Date(2016, 7, 30)),
|
||||
new MixedObject(30, new Date(2015, 3, 15)),
|
||||
new MixedObject(40, new Date(2014, 3, 15)),
|
||||
new MixedObject(50, new Date(2017, 4, 15))
|
||||
];
|
||||
const mixedObjectOrUndefinedArray = [...mixedObjectArray, undefined];
|
||||
|
||||
let mixedObjectOrUndefinedArray = [...mixedObjectArray, undefined];
|
||||
|
||||
let typedArray = Uint8Array.from(numbersArray);
|
||||
let readonlyNumbersArray = numbersArray as ReadonlyArray<number>;
|
||||
let readonlyNumbersOrUndefinedArray = numbersOrUndefinedArray as ReadonlyArray<number>;
|
||||
let readonlyStringyNumbersArray = stringyNumbersArray as ReadonlyArray<string>;
|
||||
let readonlyNumericArray = numericArray as ReadonlyArray<NumCoercible>;
|
||||
let readonlyDateArray = dateArray as ReadonlyArray<Date>;
|
||||
let readonlyMixedObjectArray = mixedObjectArray as ReadonlyArray<MixedObject>;
|
||||
let readonlyMixedObjectOrUndefinedArray = mixedObjectOrUndefinedArray as ReadonlyArray<MixedObject>;
|
||||
|
||||
function accessorMixedObjectToNum(datum: MixedObject, index: number, array: MixedObject[]): number {
|
||||
return datum.num;
|
||||
@@ -104,6 +115,14 @@ strOrUndefined = d3Array.max(stringyNumbersArray);
|
||||
numericOrUndefined = d3Array.max(numericArray);
|
||||
dateOrUndefined = d3Array.max(dateArray);
|
||||
|
||||
// ArrayLike test cases
|
||||
|
||||
numOrUndefined = d3Array.max(typedArray);
|
||||
numOrUndefined = d3Array.max(readonlyNumbersOrUndefinedArray);
|
||||
strOrUndefined = d3Array.max(readonlyStringyNumbersArray);
|
||||
numericOrUndefined = d3Array.max(readonlyNumericArray);
|
||||
dateOrUndefined = d3Array.max(readonlyDateArray);
|
||||
|
||||
// with accessors
|
||||
|
||||
numOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNum);
|
||||
@@ -112,6 +131,7 @@ numericOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNumeric)
|
||||
dateOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToDate);
|
||||
numOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
|
||||
strOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
|
||||
numOrUndefined = d3Array.max(readonlyMixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// min() -----------------------------------------------------------------------
|
||||
|
||||
@@ -122,6 +142,14 @@ strOrUndefined = d3Array.min(stringyNumbersArray);
|
||||
numericOrUndefined = d3Array.min(numericArray);
|
||||
dateOrUndefined = d3Array.min(dateArray);
|
||||
|
||||
// ArrayLike test cases
|
||||
|
||||
numOrUndefined = d3Array.min(typedArray);
|
||||
numOrUndefined = d3Array.min(readonlyNumbersOrUndefinedArray);
|
||||
strOrUndefined = d3Array.min(readonlyStringyNumbersArray);
|
||||
numericOrUndefined = d3Array.min(readonlyNumericArray);
|
||||
dateOrUndefined = d3Array.min(readonlyDateArray);
|
||||
|
||||
// with accessors
|
||||
|
||||
numOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNum);
|
||||
@@ -130,6 +158,7 @@ numericOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNumeric)
|
||||
dateOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToDate);
|
||||
numOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
|
||||
strOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
|
||||
numOrUndefined = d3Array.max(readonlyMixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// extent() --------------------------------------------------------------------
|
||||
|
||||
@@ -140,6 +169,14 @@ strOrUndefinedExtent = d3Array.extent(stringyNumbersArray);
|
||||
numericOrUndefinedExtent = d3Array.extent(numericArray);
|
||||
dateOrUndefinedExtent = d3Array.extent(dateArray);
|
||||
|
||||
// ArrayLike test cases
|
||||
|
||||
numOrUndefinedExtent = d3Array.extent(typedArray);
|
||||
numOrUndefinedExtent = d3Array.extent(readonlyNumbersOrUndefinedArray);
|
||||
strOrUndefinedExtent = d3Array.extent(readonlyStringyNumbersArray);
|
||||
numericOrUndefinedExtent = d3Array.extent(readonlyNumericArray);
|
||||
dateOrUndefinedExtent = d3Array.extent(readonlyDateArray);
|
||||
|
||||
// with accessors
|
||||
|
||||
numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNum);
|
||||
@@ -148,6 +185,7 @@ mixedOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToN
|
||||
dateMixedOrUndefined = d3Array.extent(mixedObjectArray, accessorMixedObjectToDate);
|
||||
numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
|
||||
strOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
|
||||
numOrUndefinedExtent = d3Array.extent(readonlyMixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// mean() ----------------------------------------------------------------------
|
||||
|
||||
@@ -155,8 +193,14 @@ numOrUndefined = d3Array.mean(numbersArray);
|
||||
numOrUndefined = d3Array.mean(numericArray);
|
||||
numOrUndefined = d3Array.mean(numbersOrUndefinedArray);
|
||||
|
||||
numOrUndefined = d3Array.mean(typedArray);
|
||||
numOrUndefined = d3Array.mean(readonlyNumbersOrUndefinedArray);
|
||||
numOrUndefined = d3Array.mean(readonlyNumericArray);
|
||||
numOrUndefined = d3Array.mean(readonlyNumbersOrUndefinedArray);
|
||||
|
||||
numOrUndefined = d3Array.mean(mixedObjectArray, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.mean(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
numOrUndefined = d3Array.mean(readonlyMixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// median() --------------------------------------------------------------------
|
||||
|
||||
@@ -164,8 +208,14 @@ numOrUndefined = d3Array.median(numbersArray);
|
||||
numOrUndefined = d3Array.median(numericArray);
|
||||
numOrUndefined = d3Array.median(numbersOrUndefinedArray);
|
||||
|
||||
numOrUndefined = d3Array.median(typedArray);
|
||||
numOrUndefined = d3Array.median(readonlyNumbersArray);
|
||||
numOrUndefined = d3Array.median(readonlyNumericArray);
|
||||
numOrUndefined = d3Array.median(readonlyNumbersOrUndefinedArray);
|
||||
|
||||
numOrUndefined = d3Array.median(mixedObjectArray, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.median(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
numOrUndefined = d3Array.median(readonlyMixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// quantile() ------------------------------------------------------------------
|
||||
|
||||
@@ -173,8 +223,14 @@ numOrUndefined = d3Array.quantile(numbersArray, 0.5);
|
||||
numOrUndefined = d3Array.quantile(numericArray, 0.5);
|
||||
numOrUndefined = d3Array.quantile(numbersOrUndefinedArray, 0.5);
|
||||
|
||||
numOrUndefined = d3Array.quantile(typedArray, 0.5);
|
||||
numOrUndefined = d3Array.quantile(readonlyNumbersArray, 0.5);
|
||||
numOrUndefined = d3Array.quantile(readonlyNumericArray, 0.5);
|
||||
numOrUndefined = d3Array.quantile(readonlyNumbersOrUndefinedArray, 0.5);
|
||||
|
||||
numOrUndefined = d3Array.quantile(mixedObjectArray, 0.5, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.quantile(mixedObjectOrUndefinedArray, 0.5, accessorMixedObjectToNumOrUndefined);
|
||||
numOrUndefined = d3Array.quantile(readonlyMixedObjectOrUndefinedArray, 0.5, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// sum() -----------------------------------------------------------------------
|
||||
|
||||
@@ -182,8 +238,14 @@ numOrUndefined = d3Array.sum(numbersArray);
|
||||
numOrUndefined = d3Array.sum(numericArray);
|
||||
numOrUndefined = d3Array.sum(numbersOrUndefinedArray);
|
||||
|
||||
numOrUndefined = d3Array.sum(typedArray);
|
||||
numOrUndefined = d3Array.sum(readonlyNumbersArray);
|
||||
numOrUndefined = d3Array.sum(readonlyNumericArray);
|
||||
numOrUndefined = d3Array.sum(readonlyNumbersOrUndefinedArray);
|
||||
|
||||
numOrUndefined = d3Array.sum(mixedObjectArray, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.sum(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
numOrUndefined = d3Array.sum(readonlyMixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// deviation() -----------------------------------------------------------------
|
||||
|
||||
@@ -191,8 +253,14 @@ numOrUndefined = d3Array.deviation(numbersArray);
|
||||
numOrUndefined = d3Array.deviation(numericArray);
|
||||
numOrUndefined = d3Array.deviation(numbersOrUndefinedArray);
|
||||
|
||||
numOrUndefined = d3Array.deviation(typedArray);
|
||||
numOrUndefined = d3Array.deviation(readonlyNumbersArray);
|
||||
numOrUndefined = d3Array.deviation(readonlyNumericArray);
|
||||
numOrUndefined = d3Array.deviation(readonlyNumbersOrUndefinedArray);
|
||||
|
||||
numOrUndefined = d3Array.deviation(mixedObjectArray, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.deviation(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
numOrUndefined = d3Array.deviation(readonlyMixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// variance() ------------------------------------------------------------------
|
||||
|
||||
@@ -200,16 +268,29 @@ numOrUndefined = d3Array.variance(numbersArray);
|
||||
numOrUndefined = d3Array.variance(numericArray);
|
||||
numOrUndefined = d3Array.variance(numbersOrUndefinedArray);
|
||||
|
||||
numOrUndefined = d3Array.variance(typedArray);
|
||||
numOrUndefined = d3Array.variance(readonlyNumbersArray);
|
||||
numOrUndefined = d3Array.variance(readonlyNumericArray);
|
||||
numOrUndefined = d3Array.variance(readonlyNumbersOrUndefinedArray);
|
||||
|
||||
numOrUndefined = d3Array.variance(mixedObjectArray, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.variance(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
numOrUndefined = d3Array.variance(readonlyMixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Test Searching Arrays
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
numbersArray = [0, 2, 3, 4, 7, 8];
|
||||
stringyNumbersArray = ['0', '2', '3', '4', '7', '8'];
|
||||
dateArray = [new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)];
|
||||
typedArray = Uint8Array.from(numbersArray);
|
||||
|
||||
// scan() ----------------------------------------------------------------------
|
||||
|
||||
numOrUndefined = d3Array.scan(numbersArray);
|
||||
numOrUndefined = d3Array.scan(typedArray);
|
||||
numOrUndefined = d3Array.scan(readonlyNumbersArray);
|
||||
|
||||
numOrUndefined = d3Array.scan(mixedObjectArray, (a, b) => {
|
||||
const aElem: MixedObject = a;
|
||||
@@ -217,53 +298,113 @@ numOrUndefined = d3Array.scan(mixedObjectArray, (a, b) => {
|
||||
return a.num - b.num;
|
||||
});
|
||||
|
||||
numOrUndefined = d3Array.scan(readonlyMixedObjectArray, (a, b) => {
|
||||
const aElem: MixedObject = a;
|
||||
const bElem: MixedObject = b;
|
||||
return a.num - b.num;
|
||||
});
|
||||
|
||||
numOrUndefined = d3Array.scan(mixedObjectOrUndefinedArray, (a, b) => {
|
||||
const aElem: MixedObject | undefined = a;
|
||||
const bElem: MixedObject | undefined = b;
|
||||
return a && b ? a.num - b.num : NaN;
|
||||
});
|
||||
|
||||
numOrUndefined = d3Array.scan(readonlyMixedObjectOrUndefinedArray, (a, b) => {
|
||||
const aElem: MixedObject | undefined = a;
|
||||
const bElem: MixedObject | undefined = b;
|
||||
return a && b ? a.num - b.num : NaN;
|
||||
});
|
||||
|
||||
// bisectLeft() ----------------------------------------------------------------
|
||||
|
||||
num = d3Array.bisectLeft([0, 2, 3, 4, 7, 8], 4);
|
||||
num = d3Array.bisectLeft([0, 2, 3, 4, 7, 8], 4, 1);
|
||||
num = d3Array.bisectLeft([0, 2, 3, 4, 7, 8], 4, 1, 4);
|
||||
num = d3Array.bisectLeft(numbersArray, 4);
|
||||
num = d3Array.bisectLeft(numbersArray, 4, 1);
|
||||
num = d3Array.bisectLeft(numbersArray, 4, 1, 4);
|
||||
|
||||
num = d3Array.bisectLeft(['0', '2', '3', '4', '7', '8'], '21');
|
||||
num = d3Array.bisectLeft(['0', '2', '3', '4', '7', '8'], '21', 1);
|
||||
num = d3Array.bisectLeft(['0', '2', '3', '4', '7', '8'], '21', 1, 4);
|
||||
num = d3Array.bisectLeft(stringyNumbersArray, '21');
|
||||
num = d3Array.bisectLeft(stringyNumbersArray, '21', 1);
|
||||
num = d3Array.bisectLeft(stringyNumbersArray, '21', 1, 4);
|
||||
|
||||
num = d3Array.bisectLeft([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1));
|
||||
num = d3Array.bisectLeft([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1);
|
||||
num = d3Array.bisectLeft([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1, 2);
|
||||
num = d3Array.bisectLeft(dateArray, new Date(2011, 2, 1));
|
||||
num = d3Array.bisectLeft(dateArray, new Date(2011, 2, 1), 1);
|
||||
num = d3Array.bisectLeft(dateArray, new Date(2011, 2, 1), 1, 2);
|
||||
|
||||
num = d3Array.bisectLeft(typedArray, 4);
|
||||
num = d3Array.bisectLeft(typedArray, 4, 1);
|
||||
num = d3Array.bisectLeft(typedArray, 4, 1, 4);
|
||||
|
||||
num = d3Array.bisectLeft(readonlyNumbersArray, 4);
|
||||
num = d3Array.bisectLeft(readonlyNumbersArray, 4, 1);
|
||||
num = d3Array.bisectLeft(readonlyNumbersArray, 4, 1, 4);
|
||||
|
||||
num = d3Array.bisectLeft(readonlyStringyNumbersArray, '21');
|
||||
num = d3Array.bisectLeft(readonlyStringyNumbersArray, '21', 1);
|
||||
num = d3Array.bisectLeft(readonlyStringyNumbersArray, '21', 1, 4);
|
||||
|
||||
num = d3Array.bisectLeft(readonlyDateArray, new Date(2011, 2, 1));
|
||||
num = d3Array.bisectLeft(readonlyDateArray, new Date(2011, 2, 1), 1);
|
||||
num = d3Array.bisectLeft(readonlyDateArray, new Date(2011, 2, 1), 1, 2);
|
||||
|
||||
// bisectRight() ---------------------------------------------------------------
|
||||
|
||||
num = d3Array.bisectRight([0, 2, 3, 4, 7, 8], 4);
|
||||
num = d3Array.bisectRight([0, 2, 3, 4, 7, 8], 4, 1);
|
||||
num = d3Array.bisectRight([0, 2, 3, 4, 7, 8], 4, 1, 4);
|
||||
num = d3Array.bisectRight(numbersArray, 4);
|
||||
num = d3Array.bisectRight(numbersArray, 4, 1);
|
||||
num = d3Array.bisectRight(numbersArray, 4, 1, 4);
|
||||
|
||||
num = d3Array.bisectRight(['0', '2', '3', '4', '7', '8'], '21');
|
||||
num = d3Array.bisectRight(['0', '2', '3', '4', '7', '8'], '21', 1);
|
||||
num = d3Array.bisectRight(['0', '2', '3', '4', '7', '8'], '21', 1, 4);
|
||||
num = d3Array.bisectRight(stringyNumbersArray, '21');
|
||||
num = d3Array.bisectRight(stringyNumbersArray, '21', 1);
|
||||
num = d3Array.bisectRight(stringyNumbersArray, '21', 1, 4);
|
||||
|
||||
num = d3Array.bisectRight([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1));
|
||||
num = d3Array.bisectRight([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1);
|
||||
num = d3Array.bisectRight([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1, 2);
|
||||
num = d3Array.bisectRight(dateArray, new Date(2011, 2, 1));
|
||||
num = d3Array.bisectRight(dateArray, new Date(2011, 2, 1), 1);
|
||||
num = d3Array.bisectRight(dateArray, new Date(2011, 2, 1), 1, 2);
|
||||
|
||||
num = d3Array.bisectRight(typedArray, 4);
|
||||
num = d3Array.bisectRight(typedArray, 4, 1);
|
||||
num = d3Array.bisectRight(typedArray, 4, 1, 4);
|
||||
|
||||
num = d3Array.bisectRight(readonlyNumbersArray, 4);
|
||||
num = d3Array.bisectRight(readonlyNumbersArray, 4, 1);
|
||||
num = d3Array.bisectRight(readonlyNumbersArray, 4, 1, 4);
|
||||
|
||||
num = d3Array.bisectRight(readonlyStringyNumbersArray, '21');
|
||||
num = d3Array.bisectRight(readonlyStringyNumbersArray, '21', 1);
|
||||
num = d3Array.bisectRight(readonlyStringyNumbersArray, '21', 1, 4);
|
||||
|
||||
num = d3Array.bisectRight(readonlyDateArray, new Date(2011, 2, 1));
|
||||
num = d3Array.bisectRight(readonlyDateArray, new Date(2011, 2, 1), 1);
|
||||
num = d3Array.bisectRight(readonlyDateArray, new Date(2011, 2, 1), 1, 2);
|
||||
|
||||
// bisect() --------------------------------------------------------------------
|
||||
|
||||
num = d3Array.bisect([0, 2, 3, 4, 7, 8], 4);
|
||||
num = d3Array.bisect([0, 2, 3, 4, 7, 8], 4, 1);
|
||||
num = d3Array.bisect([0, 2, 3, 4, 7, 8], 4, 1, 4);
|
||||
num = d3Array.bisect(numbersArray, 4);
|
||||
num = d3Array.bisect(numbersArray, 4, 1);
|
||||
num = d3Array.bisect(numbersArray, 4, 1, 4);
|
||||
|
||||
num = d3Array.bisect(['0', '2', '3', '4', '7', '8'], '21');
|
||||
num = d3Array.bisect(['0', '2', '3', '4', '7', '8'], '21', 1);
|
||||
num = d3Array.bisect(['0', '2', '3', '4', '7', '8'], '21', 1, 4);
|
||||
num = d3Array.bisect(stringyNumbersArray, '21');
|
||||
num = d3Array.bisect(stringyNumbersArray, '21', 1);
|
||||
num = d3Array.bisect(stringyNumbersArray, '21', 1, 4);
|
||||
|
||||
num = d3Array.bisect([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1));
|
||||
num = d3Array.bisect([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1);
|
||||
num = d3Array.bisect([new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)], new Date(2011, 2, 1), 1, 2);
|
||||
num = d3Array.bisect(dateArray, new Date(2011, 2, 1));
|
||||
num = d3Array.bisect(dateArray, new Date(2011, 2, 1), 1);
|
||||
num = d3Array.bisect(dateArray, new Date(2011, 2, 1), 1, 2);
|
||||
|
||||
num = d3Array.bisect(typedArray, 4);
|
||||
num = d3Array.bisect(typedArray, 4, 1);
|
||||
num = d3Array.bisect(typedArray, 4, 1, 4);
|
||||
|
||||
num = d3Array.bisect(readonlyNumbersArray, 4);
|
||||
num = d3Array.bisect(readonlyNumbersArray, 4, 1);
|
||||
num = d3Array.bisect(readonlyNumbersArray, 4, 1, 4);
|
||||
|
||||
num = d3Array.bisect(readonlyStringyNumbersArray, '21');
|
||||
num = d3Array.bisect(readonlyStringyNumbersArray, '21', 1);
|
||||
num = d3Array.bisect(readonlyStringyNumbersArray, '21', 1, 4);
|
||||
|
||||
num = d3Array.bisect(readonlyDateArray, new Date(2011, 2, 1));
|
||||
num = d3Array.bisect(readonlyDateArray, new Date(2011, 2, 1), 1);
|
||||
num = d3Array.bisect(readonlyDateArray, new Date(2011, 2, 1), 1, 2);
|
||||
|
||||
// bisector() ------------------------------------------------------------------
|
||||
|
||||
@@ -283,11 +424,19 @@ num = mixedObjectDateBisectorObject.left(mixedObjectArray, new Date(2015, 3, 14)
|
||||
num = mixedObjectDateBisectorObject.left(mixedObjectArray, new Date(2015, 3, 14), 1);
|
||||
num = mixedObjectDateBisectorObject.left(mixedObjectArray, new Date(2015, 3, 14), 3, 4);
|
||||
|
||||
num = mixedObjectDateBisectorObject.left(readonlyMixedObjectArray, new Date(2015, 3, 14));
|
||||
num = mixedObjectDateBisectorObject.left(readonlyMixedObjectArray, new Date(2015, 3, 14), 1);
|
||||
num = mixedObjectDateBisectorObject.left(readonlyMixedObjectArray, new Date(2015, 3, 14), 3, 4);
|
||||
|
||||
// bisect right
|
||||
num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14));
|
||||
num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14), 1);
|
||||
num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14), 3, 4);
|
||||
|
||||
num = mixedObjectDateBisectorObject.right(readonlyMixedObjectArray, new Date(2015, 3, 14));
|
||||
num = mixedObjectDateBisectorObject.right(readonlyMixedObjectArray, new Date(2015, 3, 14), 1);
|
||||
num = mixedObjectDateBisectorObject.right(readonlyMixedObjectArray, new Date(2015, 3, 14), 3, 4);
|
||||
|
||||
// ascending() -----------------------------------------------------------------
|
||||
|
||||
num = d3Array.ascending(undefined, 20);
|
||||
@@ -308,32 +457,44 @@ num = d3Array.descending(new Date(2016, 6, 13), new Date(2016, 6, 14));
|
||||
|
||||
// merge() ---------------------------------------------------------------------
|
||||
|
||||
let testArrays: MixedObject[][] = [
|
||||
[
|
||||
new MixedObject(10, new Date(2016, 6, 1)),
|
||||
new MixedObject(20, new Date(2016, 7, 30)),
|
||||
new MixedObject(30, new Date(2015, 3, 15)),
|
||||
new MixedObject(40, new Date(2014, 3, 15)),
|
||||
new MixedObject(50, new Date(2017, 4, 15))
|
||||
],
|
||||
[
|
||||
new MixedObject(40, new Date(2016, 3, 1)),
|
||||
new MixedObject(50, new Date(2016, 9, 30)),
|
||||
]
|
||||
let testArray1 = [
|
||||
new MixedObject(10, new Date(2016, 6, 1)),
|
||||
new MixedObject(20, new Date(2016, 7, 30)),
|
||||
new MixedObject(30, new Date(2015, 3, 15)),
|
||||
new MixedObject(40, new Date(2014, 3, 15)),
|
||||
new MixedObject(50, new Date(2017, 4, 15))
|
||||
];
|
||||
|
||||
let testArray2 = [
|
||||
new MixedObject(40, new Date(2016, 3, 1)),
|
||||
new MixedObject(50, new Date(2016, 9, 30)),
|
||||
];
|
||||
|
||||
let testArrays: MixedObject[][] = [testArray1, testArray2];
|
||||
|
||||
let readonlyTestArray1 = testArray1 as ReadonlyArray<MixedObject>;
|
||||
let readonlyTestArray2 = testArray2 as ReadonlyArray<MixedObject>;
|
||||
let readonlyTestArrays = [testArray1, testArray2] as ReadonlyArray<ReadonlyArray<MixedObject>>;
|
||||
|
||||
let mergedArray: MixedObject[];
|
||||
|
||||
mergedArray = d3Array.merge(testArrays); // inferred type
|
||||
mergedArray = d3Array.merge<MixedObject>(testArrays); // explicit type
|
||||
// mergedArray = d3Array.merge<MixedObject>([[10, 40, 30], [15, 30]]); // fails, type mismatch
|
||||
// mergedArray = d3Array.merge([testArray1, [15, 30]]); // fails, type mismatch
|
||||
|
||||
mergedArray = d3Array.merge(readonlyTestArrays); // inferred type
|
||||
mergedArray = d3Array.merge<MixedObject>(readonlyTestArrays); // explicit type
|
||||
|
||||
// cross() ---------------------------------------------------------------------
|
||||
|
||||
let crossed: Array<[string, number]>;
|
||||
|
||||
crossed = d3Array.cross(['x', 'y'], [1, 2]);
|
||||
crossed = d3Array.cross<string, number>(['x', 'y'], [1, 2]);
|
||||
const chars = ['x', 'y'];
|
||||
const nums = [1, 2];
|
||||
|
||||
crossed = d3Array.cross(chars, nums);
|
||||
crossed = d3Array.cross<string, number>(chars, nums);
|
||||
|
||||
let strArray: string[] = d3Array.cross<number, number, string>([2, 3], [5, 6], (a, b) => (a + b) + 'px');
|
||||
strArray = d3Array.cross([2, 3], [5, 6], (a, b) => {
|
||||
@@ -342,6 +503,21 @@ strArray = d3Array.cross([2, 3], [5, 6], (a, b) => {
|
||||
return (aa + bb) + 'px';
|
||||
});
|
||||
|
||||
const readonlyChars = chars as ReadonlyArray<string>;
|
||||
const readonlyNums = new Uint8Array(nums);
|
||||
|
||||
crossed = d3Array.cross(readonlyChars, readonlyNums);
|
||||
crossed = d3Array.cross<string, number>(readonlyChars, readonlyNums);
|
||||
|
||||
strArray = d3Array.cross<number, number, string>([2, 3] as ReadonlyArray<number>, new Uint8ClampedArray([5, 6]), (a, b) => (a + b) + 'px');
|
||||
strArray = d3Array.cross([2, 3] as ReadonlyArray<number>, new Uint8ClampedArray([5, 6]), (a, b) => {
|
||||
const aa: number = a;
|
||||
const bb: number = b;
|
||||
return (aa + bb) + 'px';
|
||||
});
|
||||
|
||||
d3Array.cross(new Uint8Array([1, 2, 3, 4, 5]), new Uint8Array([10, 20, 30, 40, 50]));
|
||||
|
||||
// pairs() ---------------------------------------------------------------------
|
||||
|
||||
let pairs: Array<[MixedObject, MixedObject]>;
|
||||
@@ -355,10 +531,21 @@ numbersArray = d3Array.pairs(mergedArray, (a, b) => {
|
||||
return bb.num - aa.num;
|
||||
});
|
||||
|
||||
const readonlyMergedArray = mergedArray as ReadonlyArray<MixedObject>;
|
||||
pairs = d3Array.pairs(readonlyMergedArray);
|
||||
|
||||
numbersArray = d3Array.pairs<MixedObject, number>(readonlyMergedArray, (a, b) => b.num - a.num);
|
||||
numbersArray = d3Array.pairs(readonlyMergedArray, (a, b) => {
|
||||
const aa: MixedObject = a;
|
||||
const bb: MixedObject = b;
|
||||
return bb.num - aa.num;
|
||||
});
|
||||
|
||||
// permute() -------------------------------------------------------------------
|
||||
|
||||
// getting a permutation of array elements
|
||||
mergedArray = d3Array.permute(mergedArray, [1, 0, 2, 5, 3, 4, 6]);
|
||||
mergedArray = d3Array.permute(readonlyMergedArray, [1, 0, 2, 5, 3, 4, 6]);
|
||||
|
||||
// Getting an ordered array with object properties
|
||||
|
||||
@@ -380,10 +567,20 @@ numbersArray = d3Array.range(1, 10, 0.5);
|
||||
// shuffle() -------------------------------------------------------------------
|
||||
|
||||
mergedArray = d3Array.shuffle(mergedArray);
|
||||
|
||||
mergedArray = d3Array.shuffle(mergedArray, 1);
|
||||
|
||||
mergedArray = d3Array.shuffle(mergedArray, 1, 3);
|
||||
// mergedArray = d3Array.shuffle(readonlyMergedArray); // fails, shuffle mutates input array in-place
|
||||
|
||||
// Test each TypedArray explicitly. Can't use ArrayLike in this case because shuffle is mutable and ArrayLike would include ReadonlyArray
|
||||
let resultInt8: Int8Array = d3Array.shuffle(new Int8Array(numbersArray));
|
||||
let resultUint8: Uint8Array = d3Array.shuffle(new Uint8Array(numbersArray));
|
||||
let resultUint8Clamped: Uint8ClampedArray = d3Array.shuffle(new Uint8ClampedArray(numbersArray));
|
||||
let resultInt16: Int16Array = d3Array.shuffle(new Int16Array(numbersArray));
|
||||
let resultUint6: Uint16Array = d3Array.shuffle(new Uint16Array(numbersArray));
|
||||
let resultInt32: Int32Array = d3Array.shuffle(new Int32Array(numbersArray));
|
||||
let resultUint32: Uint32Array = d3Array.shuffle(new Uint32Array(numbersArray));
|
||||
let resultFloat32: Float32Array = d3Array.shuffle(new Float32Array(numbersArray));
|
||||
let resultFloat64: Float64Array = d3Array.shuffle(new Float64Array(numbersArray));
|
||||
|
||||
// ticks() ---------------------------------------------------------------------
|
||||
|
||||
@@ -399,32 +596,13 @@ numDiff = d3Array.tickStep(1, 10, 5);
|
||||
|
||||
// transpose() -----------------------------------------------------------------
|
||||
|
||||
testArrays = d3Array.transpose([
|
||||
[
|
||||
new MixedObject(10, new Date(2016, 6, 1)),
|
||||
new MixedObject(50, new Date(2017, 4, 15))
|
||||
],
|
||||
[
|
||||
new MixedObject(40, new Date(2016, 3, 1)),
|
||||
new MixedObject(50, new Date(2016, 9, 30)),
|
||||
]
|
||||
]);
|
||||
testArrays = d3Array.transpose([testArray1, testArray2]);
|
||||
testArrays = d3Array.transpose([readonlyTestArray1, readonlyTestArray2] as ReadonlyArray<ReadonlyArray<MixedObject>>);
|
||||
|
||||
// zip() -----------------------------------------------------------------------
|
||||
|
||||
testArrays = d3Array.zip(
|
||||
[
|
||||
new MixedObject(10, new Date(2016, 6, 1)),
|
||||
new MixedObject(20, new Date(2016, 7, 30)),
|
||||
new MixedObject(30, new Date(2015, 3, 15)),
|
||||
new MixedObject(40, new Date(2014, 3, 15)),
|
||||
new MixedObject(50, new Date(2017, 4, 15))
|
||||
],
|
||||
[
|
||||
new MixedObject(40, new Date(2016, 3, 1)),
|
||||
new MixedObject(50, new Date(2016, 9, 30)),
|
||||
]
|
||||
);
|
||||
testArrays = d3Array.zip(testArray1, testArray2);
|
||||
testArrays = d3Array.zip(readonlyTestArray1, readonlyTestArray2);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Test Histogram
|
||||
@@ -447,7 +625,7 @@ testHistogram = d3Array.histogram<MixedObject, Date>();
|
||||
testHistogram = testHistogram.value((d, i, data) => {
|
||||
const datum: MixedObject = d; // d is of type MixedObject
|
||||
const index: number = i; // i is number
|
||||
const array: MixedObject[] = data; // data is of type MixedObject[]
|
||||
const array: ArrayLike<MixedObject> = data; // data is of type MixedObject[]
|
||||
return datum.date;
|
||||
});
|
||||
|
||||
@@ -496,8 +674,10 @@ testHistogram = testHistogram.thresholds(tScale.ticks(timeYear));
|
||||
|
||||
// Use histogram generator =====================================================
|
||||
|
||||
numbersArray = [-1, 0, 1, 1, 3, 20, 234];
|
||||
|
||||
let defaultBins: Array<d3Array.Bin<number, number>>;
|
||||
defaultBins = defaultHistogram([-1, 0, 1, 1, 3, 20, 234]);
|
||||
defaultBins = defaultHistogram(numbersArray);
|
||||
|
||||
let defaultBin: d3Array.Bin<number, number>;
|
||||
defaultBin = defaultBins[0];
|
||||
@@ -509,6 +689,7 @@ num = defaultBin.x1; // bin upper bound is number
|
||||
|
||||
let testBins: Array<d3Array.Bin<MixedObject, Date>>;
|
||||
testBins = testHistogram(mixedObjectArray);
|
||||
testBins = testHistogram(readonlyMixedObjectArray);
|
||||
|
||||
let testBin: d3Array.Bin<MixedObject, Date>;
|
||||
testBin = testBins[0];
|
||||
@@ -520,8 +701,18 @@ date = testBin.x1; // bin upper bound is Date
|
||||
|
||||
// Histogram Tresholds =========================================================
|
||||
|
||||
num = d3Array.thresholdFreedmanDiaconis([-1, 0, 1, 1, 3, 20, 234], -1, 234);
|
||||
numbersArray = [-1, 0, 1, 1, 3, 20, 234];
|
||||
typedArray = new Uint8Array(numbersArray);
|
||||
readonlyNumbersArray = numbersArray as ReadonlyArray<number>;
|
||||
|
||||
num = d3Array.thresholdScott([-1, 0, 1, 1, 3, 20, 234], -1, 234);
|
||||
num = d3Array.thresholdFreedmanDiaconis(numbersArray, -1, 234);
|
||||
num = d3Array.thresholdFreedmanDiaconis(typedArray, -1, 234);
|
||||
num = d3Array.thresholdFreedmanDiaconis(readonlyNumbersArray, -1, 234);
|
||||
|
||||
num = d3Array.thresholdSturges([-1, 0, 1, 1, 3, 20, 234]);
|
||||
num = d3Array.thresholdScott(numbersArray, -1, 234);
|
||||
num = d3Array.thresholdScott(typedArray, -1, 234);
|
||||
num = d3Array.thresholdScott(readonlyNumbersArray, -1, 234);
|
||||
|
||||
num = d3Array.thresholdSturges(numbersArray);
|
||||
num = d3Array.thresholdSturges(typedArray);
|
||||
num = d3Array.thresholdSturges(readonlyNumbersArray);
|
||||
|
||||
Vendored
+63
-54
@@ -28,133 +28,133 @@ export interface Numeric {
|
||||
/**
|
||||
* Return the maximum value in the array of strings using natural order.
|
||||
*/
|
||||
export function max(array: string[]): string | undefined;
|
||||
export function max(array: ArrayLike<string>): string | undefined;
|
||||
|
||||
/**
|
||||
* Return the maximum value in the array of numbers using natural order.
|
||||
*/
|
||||
export function max<T extends Numeric>(array: T[]): T | undefined;
|
||||
export function max<T extends Numeric>(array: ArrayLike<T>): T | undefined;
|
||||
|
||||
/**
|
||||
* Return the maximum value in the array using natural order and a projection function to map values to strings.
|
||||
*/
|
||||
export function max<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string | undefined | null): string | undefined;
|
||||
export function max<T>(array: ArrayLike<T>, accessor: (datum: T, index: number, array: ArrayLike<T>) => string | undefined | null): string | undefined;
|
||||
|
||||
/**
|
||||
* Return the maximum value in the array using natural order and a projection function to map values to easily-sorted values.
|
||||
*/
|
||||
export function max<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U | undefined | null): U | undefined;
|
||||
export function max<T, U extends Numeric>(array: ArrayLike<T>, accessor: (datum: T, index: number, array: ArrayLike<T>) => U | undefined | null): U | undefined;
|
||||
|
||||
/**
|
||||
* Return the minimum value in the array using natural order.
|
||||
*/
|
||||
export function min(array: string[]): string | undefined;
|
||||
export function min(array: ArrayLike<string>): string | undefined;
|
||||
|
||||
/**
|
||||
* Return the minimum value in the array using natural order.
|
||||
*/
|
||||
export function min<T extends Numeric>(array: T[]): T | undefined;
|
||||
export function min<T extends Numeric>(array: ArrayLike<T>): T | undefined;
|
||||
|
||||
/**
|
||||
* Return the minimum value in the array using natural order.
|
||||
*/
|
||||
export function min<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string | undefined | null): string | undefined;
|
||||
export function min<T>(array: ArrayLike<T>, accessor: (datum: T, index: number, array: ArrayLike<T>) => string | undefined | null): string | undefined;
|
||||
|
||||
/**
|
||||
* Return the minimum value in the array using natural order.
|
||||
*/
|
||||
export function min<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U | undefined | null): U | undefined;
|
||||
export function min<T, U extends Numeric>(array: ArrayLike<T>, accessor: (datum: T, index: number, array: ArrayLike<T>) => U | undefined | null): U | undefined;
|
||||
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
export function extent(array: string[]): [string, string] | [undefined, undefined];
|
||||
export function extent(array: ArrayLike<string>): [string, string] | [undefined, undefined];
|
||||
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
export function extent<T extends Numeric>(array: T[]): [T, T] | [undefined, undefined];
|
||||
export function extent<T extends Numeric>(array: ArrayLike<T>): [T, T] | [undefined, undefined];
|
||||
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
export function extent<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string | undefined | null): [string, string] | [undefined, undefined];
|
||||
export function extent<T>(array: ArrayLike<T>, accessor: (datum: T, index: number, array: ArrayLike<T>) => string | undefined | null): [string, string] | [undefined, undefined];
|
||||
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
export function extent<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U | undefined | null): [U, U] | [undefined, undefined];
|
||||
export function extent<T, U extends Numeric>(array: ArrayLike<T>, accessor: (datum: T, index: number, array: ArrayLike<T>) => U | undefined | null): [U, U] | [undefined, undefined];
|
||||
|
||||
/**
|
||||
* Return the mean of an array of numbers
|
||||
*/
|
||||
export function mean<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
|
||||
export function mean<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number | undefined;
|
||||
export function mean<T extends Numeric>(array: ArrayLike<T | undefined | null>): number | undefined;
|
||||
export function mean<T>(array: ArrayLike<T>, accessor: (datum: T, index: number, array: ArrayLike<T>) => number | undefined | null): number | undefined;
|
||||
|
||||
/**
|
||||
* Return the median of an array of numbers
|
||||
*/
|
||||
export function median<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
|
||||
export function median<T>(array: T[], accessor: (element: T, i: number, array: T[]) => number | undefined | null): number | undefined;
|
||||
export function median<T extends Numeric>(array: ArrayLike<T | undefined | null>): number | undefined;
|
||||
export function median<T>(array: ArrayLike<T>, accessor: (element: T, i: number, array: ArrayLike<T>) => number | undefined | null): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the p-quantile of an array of numbers
|
||||
*/
|
||||
export function quantile<T extends Numeric>(array: Array<T | undefined | null>, p: number): number | undefined;
|
||||
export function quantile<T>(array: T[], p: number, accessor: (element: T, i: number, array: T[]) => number | undefined | null): number | undefined;
|
||||
export function quantile<T extends Numeric>(array: ArrayLike<T | undefined | null>, p: number): number | undefined;
|
||||
export function quantile<T>(array: ArrayLike<T>, p: number, accessor: (element: T, i: number, array: ArrayLike<T>) => number | undefined | null): number | undefined;
|
||||
|
||||
/**
|
||||
* Compute the sum of an array of numbers.
|
||||
*/
|
||||
export function sum<T extends Numeric>(array: Array<T | undefined | null>): number;
|
||||
export function sum<T extends Numeric>(array: ArrayLike<T | undefined | null>): number;
|
||||
|
||||
/**
|
||||
* Compute the sum of an array, using the given accessor to convert values to numbers.
|
||||
*/
|
||||
export function sum<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number;
|
||||
export function sum<T>(array: ArrayLike<T>, accessor: (datum: T, index: number, array: ArrayLike<T>) => number | undefined | null): number;
|
||||
|
||||
/**
|
||||
* Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array of numbers.
|
||||
*/
|
||||
export function deviation<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
|
||||
export function deviation<T extends Numeric>(array: ArrayLike<T | undefined | null>): number | undefined;
|
||||
|
||||
/**
|
||||
* Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array,
|
||||
* using the given accessor to convert values to numbers.
|
||||
*/
|
||||
export function deviation<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number | undefined;
|
||||
export function deviation<T>(array: ArrayLike<T>, accessor: (datum: T, index: number, array: ArrayLike<T>) => number | undefined | null): number | undefined;
|
||||
|
||||
/**
|
||||
* Compute an unbiased estimator of the population variance of the given array of numbers.
|
||||
*/
|
||||
export function variance<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
|
||||
export function variance<T extends Numeric>(array: ArrayLike<T | undefined | null>): number | undefined;
|
||||
|
||||
/**
|
||||
* Compute an unbiased estimator of the population variance of the given array,
|
||||
* using the given accessor to convert values to numbers.
|
||||
*/
|
||||
export function variance<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number | undefined;
|
||||
export function variance<T>(array: ArrayLike<T>, accessor: (datum: T, index: number, array: ArrayLike<T>) => number | undefined | null): number | undefined;
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Searching Arrays
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
export function scan(array: number[], comparator?: (a: number, b: number) => number): number | undefined;
|
||||
export function scan<T>(array: T[], comparator: (a: T, b: T) => number): number | undefined;
|
||||
export function scan(array: ArrayLike<number>, comparator?: (a: number, b: number) => number): number | undefined;
|
||||
export function scan<T>(array: ArrayLike<T>, comparator: (a: T, b: T) => number): number | undefined;
|
||||
|
||||
export function bisectLeft(array: number[], x: number, lo?: number, hi?: number): number;
|
||||
export function bisectLeft(array: string[], x: string, lo?: number, hi?: number): number;
|
||||
export function bisectLeft(array: Date[], x: Date, lo?: number, hi?: number): number;
|
||||
export function bisectLeft(array: ArrayLike<number>, x: number, lo?: number, hi?: number): number;
|
||||
export function bisectLeft(array: ArrayLike<string>, x: string, lo?: number, hi?: number): number;
|
||||
export function bisectLeft(array: ArrayLike<Date>, x: Date, lo?: number, hi?: number): number;
|
||||
|
||||
export function bisectRight(array: number[], x: number, lo?: number, hi?: number): number;
|
||||
export function bisectRight(array: string[], x: string, lo?: number, hi?: number): number;
|
||||
export function bisectRight(array: Date[], x: Date, lo?: number, hi?: number): number;
|
||||
export function bisectRight(array: ArrayLike<number>, x: number, lo?: number, hi?: number): number;
|
||||
export function bisectRight(array: ArrayLike<string>, x: string, lo?: number, hi?: number): number;
|
||||
export function bisectRight(array: ArrayLike<Date>, x: Date, lo?: number, hi?: number): number;
|
||||
|
||||
export const bisect: typeof bisectRight;
|
||||
|
||||
export interface Bisector<T, U> {
|
||||
left(array: T[], x: U, lo?: number, hi?: number): number;
|
||||
right(array: T[], x: U, lo?: number, hi?: number): number;
|
||||
left(array: ArrayLike<T>, x: U, lo?: number, hi?: number): number;
|
||||
right(array: ArrayLike<T>, x: U, lo?: number, hi?: number): number;
|
||||
}
|
||||
|
||||
export function bisector<T, U>(comparator: (a: T, b: U) => number): Bisector<T, U>;
|
||||
@@ -184,7 +184,7 @@ export function descending(a: Primitive | undefined, b: Primitive | undefined):
|
||||
* @param a First input array.
|
||||
* @param b Second input array.
|
||||
*/
|
||||
export function cross<S, T>(a: S[], b: T[]): Array<[S, T]>;
|
||||
export function cross<S, T>(a: ArrayLike<S>, b: ArrayLike<T>): Array<[S, T]>;
|
||||
|
||||
/**
|
||||
* Returns the Cartesian product of the two arrays a and b.
|
||||
@@ -195,12 +195,12 @@ export function cross<S, T>(a: S[], b: T[]): Array<[S, T]>;
|
||||
* @param b Second input array.
|
||||
* @param reducer A reducer function taking as input an element from "a" and "b" and returning a reduced value.
|
||||
*/
|
||||
export function cross<S, T, U>(a: S[], b: T[], reducer: (a: S, b: T) => U): U[];
|
||||
export function cross<S, T, U>(a: ArrayLike<S>, b: ArrayLike<T>, reducer: (a: S, b: T) => U): U[];
|
||||
|
||||
/**
|
||||
* Merges the specified arrays into a single array.
|
||||
*/
|
||||
export function merge<T>(arrays: T[][]): T[];
|
||||
export function merge<T>(arrays: ArrayLike<ArrayLike<T>>): T[];
|
||||
|
||||
/**
|
||||
* For each adjacent pair of elements in the specified array, returns a new array of tuples of elements i and i - 1.
|
||||
@@ -208,7 +208,7 @@ export function merge<T>(arrays: T[][]): T[];
|
||||
*
|
||||
* @param array Array of input elements
|
||||
*/
|
||||
export function pairs<T>(array: T[]): Array<[T, T]>;
|
||||
export function pairs<T>(array: ArrayLike<T>): Array<[T, T]>;
|
||||
/**
|
||||
* For each adjacent pair of elements in the specified array, in order, invokes the specified reducer function passing the element i and element i - 1.
|
||||
* Returns the resulting array of pair-wise reduced elements.
|
||||
@@ -217,17 +217,17 @@ export function pairs<T>(array: T[]): Array<[T, T]>;
|
||||
* @param array Array of input elements
|
||||
* @param reducer A reducer function taking as input to adjecent elements of the input array and returning a reduced value.
|
||||
*/
|
||||
export function pairs<T, U>(array: T[], reducer: (a: T, b: T) => U): U[];
|
||||
export function pairs<T, U>(array: ArrayLike<T>, reducer: (a: T, b: T) => U): U[];
|
||||
|
||||
/**
|
||||
* Given the specified array, return an array corresponding to the list of indices in 'keys'.
|
||||
*/
|
||||
export function permute<T>(array: { [key: number]: T }, keys: number[]): T[];
|
||||
export function permute<T>(array: { [key: number]: T }, keys: ArrayLike<number>): T[];
|
||||
|
||||
/**
|
||||
* Given the specified object, return an array corresponding to the list of property names in 'keys'.
|
||||
*/
|
||||
export function permute<T>(object: { [key: string]: T }, keys: string[]): T[];
|
||||
export function permute<T>(object: { [key: string]: T }, keys: ArrayLike<string>): T[];
|
||||
|
||||
/**
|
||||
* Generates a 0-based numeric sequence. The output range does not include 'stop'.
|
||||
@@ -243,6 +243,15 @@ export function range(start: number, stop: number, step?: number): number[];
|
||||
* Randomizes the order of the specified array using the Fisher–Yates shuffle.
|
||||
*/
|
||||
export function shuffle<T>(array: T[], lo?: number, hi?: number): T[];
|
||||
export function shuffle(array: Int8Array, lo?: number, hi?: number): Int8Array;
|
||||
export function shuffle(array: Uint8Array, lo?: number, hi?: number): Uint8Array;
|
||||
export function shuffle(array: Uint8ClampedArray, lo?: number, hi?: number): Uint8ClampedArray;
|
||||
export function shuffle(array: Int16Array, lo?: number, hi?: number): Int16Array;
|
||||
export function shuffle(array: Uint16Array, lo?: number, hi?: number): Uint16Array;
|
||||
export function shuffle(array: Int32Array, lo?: number, hi?: number): Int32Array;
|
||||
export function shuffle(array: Uint32Array, lo?: number, hi?: number): Uint32Array;
|
||||
export function shuffle(array: Float32Array, lo?: number, hi?: number): Float32Array;
|
||||
export function shuffle(array: Float64Array, lo?: number, hi?: number): Float64Array;
|
||||
|
||||
/**
|
||||
* Generate an array of approximately count + 1 uniformly-spaced, nicely-rounded values between start and stop (inclusive).
|
||||
@@ -289,14 +298,14 @@ export function tickStep(start: number, stop: number, count: number): number;
|
||||
/**
|
||||
* Transpose a matrix provided in Array of Arrays format.
|
||||
*/
|
||||
export function transpose<T>(matrix: T[][]): T[][];
|
||||
export function transpose<T>(matrix: ArrayLike<ArrayLike<T>>): T[][];
|
||||
|
||||
/**
|
||||
* Returns an array of arrays, where the ith array contains the ith element from each of the argument arrays.
|
||||
* The returned array is truncated in length to the shortest array in arrays. If arrays contains only a single array, the returned array
|
||||
* contains one-element arrays. With no arguments, the returned array is empty.
|
||||
*/
|
||||
export function zip<T>(...arrays: T[][]): T[][];
|
||||
export function zip<T>(...arrays: Array<ArrayLike<T>>): T[][];
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Histogram
|
||||
@@ -310,20 +319,20 @@ export interface Bin<Datum, Value extends number | Date> extends Array<Datum> {
|
||||
/**
|
||||
* Type definition for threshold generator which returns the count of recommended thresholds
|
||||
*/
|
||||
export type ThresholdCountGenerator = (values: number[], min?: number, max?: number) => number;
|
||||
export type ThresholdCountGenerator = (values: ArrayLike<number>, min?: number, max?: number) => number;
|
||||
|
||||
/**
|
||||
* Type definition for threshold generator which returns an array of recommended thresholds
|
||||
*/
|
||||
export type ThresholdArrayGenerator<Value extends number | Date> = (values: Value[], min?: Value, max?: Value) => Value[];
|
||||
export type ThresholdArrayGenerator<Value extends number | Date> = (values: ArrayLike<Value>, min?: Value, max?: Value) => Value[];
|
||||
|
||||
export interface HistogramGenerator<Datum, Value extends number | Date> {
|
||||
(data: Datum[]): Array<Bin<Datum, Value>>;
|
||||
value(): (d: Datum, i: number, data: Datum[]) => Value;
|
||||
value(valueAccessor: (d: Datum, i: number, data: Datum[]) => Value): this;
|
||||
domain(): (values: Value[]) => [Value, Value];
|
||||
(data: ArrayLike<Datum>): Array<Bin<Datum, Value>>;
|
||||
value(): (d: Datum, i: number, data: ArrayLike<Datum>) => Value;
|
||||
value(valueAccessor: (d: Datum, i: number, data: ArrayLike<Datum>) => Value): this;
|
||||
domain(): (values: ArrayLike<Value>) => [Value, Value];
|
||||
domain(domain: [Value, Value]): this;
|
||||
domain(domainAccessor: (values: Value[]) => [Value, Value]): this;
|
||||
domain(domainAccessor: (values: ArrayLike<Value>) => [Value, Value]): this;
|
||||
thresholds(): ThresholdCountGenerator | ThresholdArrayGenerator<Value>;
|
||||
/**
|
||||
* Divide the domain uniformly into approximately count bins. IMPORTANT: This threshold
|
||||
@@ -357,7 +366,7 @@ export interface HistogramGenerator<Datum, Value extends number | Date> {
|
||||
* @param thresholds Array of threshold values used for binning. The elements must
|
||||
* be of the same type as the materialized values of the histogram.
|
||||
*/
|
||||
thresholds(thresholds: Value[]): this;
|
||||
thresholds(thresholds: ArrayLike<Value>): this;
|
||||
/**
|
||||
* Set a threshold accessor function, which returns the array of values to be used as
|
||||
* thresholds in determining the bins.
|
||||
@@ -379,8 +388,8 @@ export function histogram<Datum, Value extends number | Date>(): HistogramGenera
|
||||
// Histogram Thresholds
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
export function thresholdFreedmanDiaconis(values: number[], min: number, max: number): number; // of type ThresholdCountGenerator
|
||||
export function thresholdFreedmanDiaconis(values: ArrayLike<number>, min: number, max: number): number; // of type ThresholdCountGenerator
|
||||
|
||||
export function thresholdScott(values: number[], min: number, max: number): number; // of type ThresholdCountGenerator
|
||||
export function thresholdScott(values: ArrayLike<number>, min: number, max: number): number; // of type ThresholdCountGenerator
|
||||
|
||||
export function thresholdSturges(values: number[]): number; // of type ThresholdCountGenerator
|
||||
export function thresholdSturges(values: ArrayLike<number>): number; // of type ThresholdCountGenerator
|
||||
|
||||
Vendored
+5
-1
@@ -1,6 +1,7 @@
|
||||
// Type definitions for Date Range Picker v2.1.19
|
||||
// Type definitions for Date Range Picker v2.1.25
|
||||
// Project: http://www.daterangepicker.com/
|
||||
// Definitions by: SirMartin <https://github.com/SirMartin/>
|
||||
// Steven Masala <https://github.com/smasala/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -24,6 +25,9 @@ declare namespace daterangepicker {
|
||||
|
||||
startDate: moment.Moment;
|
||||
endDate: moment.Moment;
|
||||
|
||||
setStartDate(date: Date | moment.Moment | string): void;
|
||||
setEndDate(date: Date | moment.Moment | string): void;
|
||||
}
|
||||
|
||||
interface DatepickerEventObject extends JQueryEventObject {
|
||||
|
||||
@@ -12,6 +12,7 @@ log("Formatted test (%d arg)", 1);
|
||||
log("Formatted %s (%d args)", "test", 2);
|
||||
|
||||
log("Enabled?: %s", debug.enabled("DefinitelyTyped:log"));
|
||||
log("Name Enabled: %s", debug.names.some(name => name.test("DefinitelyTyped:log")));
|
||||
log("Namespace: %s", log.namespace);
|
||||
|
||||
var error:debug.IDebugger = debug("DefinitelyTyped:error");
|
||||
|
||||
Vendored
+5
-3
@@ -1,6 +1,8 @@
|
||||
// Type definitions for debug
|
||||
// Project: https://github.com/visionmedia/debug
|
||||
// Definitions by: Seon-Wook Park <https://github.com/swook>, Gal Talmor <https://github.com/galtalmor>
|
||||
// Definitions by: Seon-Wook Park <https://github.com/swook>
|
||||
// Gal Talmor <https://github.com/galtalmor>
|
||||
// John McLaughlin <https://github.com/zamb3zi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var debug: debug.IDebug;
|
||||
@@ -16,8 +18,8 @@ declare namespace debug {
|
||||
enable: (namespaces: string) => void,
|
||||
enabled: (namespaces: string) => boolean,
|
||||
|
||||
names: string[],
|
||||
skips: string[],
|
||||
names: RegExp[],
|
||||
skips: RegExp[],
|
||||
|
||||
formatters: IFormatters
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -715,6 +715,8 @@ declare namespace Draft {
|
||||
createEntity(type: DraftEntityType, mutability: DraftEntityMutability, data?: Object): ContentState;
|
||||
getEntity(key: string): EntityInstance;
|
||||
getLastCreatedEntityKey(): string;
|
||||
mergeEntityData(key: string, toMerge: { [key: string]: any }): ContentState;
|
||||
|
||||
|
||||
getBlockMap(): BlockMap;
|
||||
getSelectionBefore(): SelectionState;
|
||||
|
||||
Vendored
+3
-3
@@ -63,8 +63,8 @@ declare namespace electronPackager {
|
||||
OriginalFilename?: string;
|
||||
ProductName?: string;
|
||||
InternalName?: string;
|
||||
"requested-execution-level": any;
|
||||
"application-manifest": any;
|
||||
"requested-execution-level"?: "asInvoker" | "highestAvailable" | "requireAdministrator";
|
||||
"application-manifest"?: string;
|
||||
}
|
||||
|
||||
/** Electron-packager Options. */
|
||||
@@ -188,7 +188,7 @@ declare namespace electronPackager {
|
||||
/**
|
||||
* The URL protocol scheme(s) to associate the app with
|
||||
*/
|
||||
protocol?: string;
|
||||
protocol?: string[];
|
||||
/**
|
||||
* The descriptive name(s) of the URL protocol scheme(s) specified via the protocol option.
|
||||
* Maps to the CFBundleURLName metadata property.
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import * as L from 'esri-leaflet-geocoder';
|
||||
|
||||
const map = L.map('map').setView([45.5165, -122.6764], 12);
|
||||
const tiles = L.esri.basemapLayer("Streets").addTo(map);
|
||||
|
||||
const searchControl = L.esri.Geocoding.geosearch().addTo(map);
|
||||
|
||||
const results = L.layerGroup([]).addTo(map);
|
||||
|
||||
// listen for the results event and add every result to the map
|
||||
searchControl.on("results", data => {
|
||||
results.clearLayers();
|
||||
for (let i = (<any> data).results.length - 1; i >= 0; i--) {
|
||||
results.addLayer(L.marker((<any> data).results[i].latlng));
|
||||
}
|
||||
});
|
||||
|
||||
const arcgisOnline = L.esri.Geocoding.arcgisOnlineProvider();
|
||||
const gisDay = L.esri.Geocoding.featureLayerProvider({
|
||||
url: 'https://services.arcgis.com/uCXeTVveQzP4IIcx/arcgis/rest/services/GIS_Day_Final/FeatureServer/0',
|
||||
searchFields: ['Name', 'Organization'], // Search these fields for text matches
|
||||
label: 'GIS Day Events', // Group suggestions under this header
|
||||
formatSuggestion(feature) {
|
||||
return feature.properties.Name + ' - ' + feature.properties.Organization; // format suggestions like this.
|
||||
}
|
||||
});
|
||||
|
||||
L.esri.Geocoding.geosearch({
|
||||
providers: [arcgisOnline, gisDay] // will geocode via ArcGIS Online and search the GIS Day feature service.
|
||||
}).addTo(map);
|
||||
|
||||
L.esri.Geocoding.geocode().text('380 New York St, Redlands, California, 92373').run((err, results, response) => {
|
||||
console.log(results);
|
||||
});
|
||||
|
||||
L.esri.Geocoding.geocode().address('380 New York St').city('Redlands').region('California').postal('92373').run((err, results, response) => {
|
||||
console.log(results);
|
||||
});
|
||||
|
||||
const southWest = L.latLng(37.712, -108.227);
|
||||
const northEast = L.latLng(41.774, -102.125);
|
||||
const bounds = L.latLngBounds(southWest, northEast); // Colorado
|
||||
|
||||
L.esri.Geocoding.geocode().text("Denver").within(bounds).run((err, response) => {
|
||||
console.log(response);
|
||||
});
|
||||
|
||||
const denver = L.latLng(37.712, -108.227);
|
||||
|
||||
L.esri.Geocoding.geocode().text("Highlands Ranch").nearby(denver, 20000).run((err, response) => {
|
||||
const res: any[] = response.results;
|
||||
});
|
||||
|
||||
L.esri.Geocoding.suggest()
|
||||
.text('trea')
|
||||
.nearby([45, -121], 5000)
|
||||
.run((error, response) => {
|
||||
/* response syntax is documented here:
|
||||
https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm#ESRI_SECTION1_FC3884A45AD24E62BD11C9888F1392DB
|
||||
*/
|
||||
});
|
||||
|
||||
L.esri.Geocoding.reverseGeocode()
|
||||
.latlng([48.8583, 2.2945])
|
||||
.run((error, result, response) => {
|
||||
// callback is called with error, result, and raw response.
|
||||
// result.latlng contains the coordinates of the located address
|
||||
// result.address contains information about the match
|
||||
});
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
// Type definitions for esri-leaflet-geocoder 2.2
|
||||
// Project: https://github.com/Esri/esri-leaflet-geocoder
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import * as leaflet from 'leaflet';
|
||||
import { esri as esriLeaflet } from 'esri-leaflet';
|
||||
|
||||
export = L;
|
||||
|
||||
declare global {
|
||||
namespace L.esri.Geocoding {
|
||||
type GeosearchConstructor = new (options?: GeosearchObject) => Geosearch;
|
||||
type Geosearch = GeosearchControl & leaflet.Evented;
|
||||
|
||||
interface GeosearchControl extends leaflet.Control {
|
||||
clear(): this;
|
||||
clearSuggestions(): this;
|
||||
disable(): this;
|
||||
enable(): this;
|
||||
}
|
||||
|
||||
const Geosearch: GeosearchConstructor;
|
||||
|
||||
function geosearch(options?: GeosearchObject): Geosearch;
|
||||
|
||||
interface GeosearchObject {
|
||||
position?: leaflet.ControlPosition;
|
||||
zoomToResult?: boolean;
|
||||
useMapBounds?: boolean | number;
|
||||
collapseAfterResult?: boolean;
|
||||
expanded?: boolean;
|
||||
allowMultipleResults?: boolean;
|
||||
providers?: GeosearchProvider[];
|
||||
placeholder?: string;
|
||||
title?: string;
|
||||
searchBounds?: leaflet.LatLngBoundsExpression | null;
|
||||
}
|
||||
|
||||
class GeocodeService extends esriLeaflet.Service {
|
||||
constructor(options?: GeocodeServiceOptions);
|
||||
geocode(): Geocode;
|
||||
suggest(): Suggest;
|
||||
reverse(): ReverseGeocode;
|
||||
}
|
||||
|
||||
function geocodeService(options?: GeocodeServiceOptions): GeocodeService;
|
||||
|
||||
interface GeocodeServiceOptions extends esriLeaflet.ServiceOptions {
|
||||
supportsSuggest?: boolean;
|
||||
}
|
||||
|
||||
class Geocode extends esriLeaflet.Task {
|
||||
constructor(options?: esriLeaflet.TaskOptions | esriLeaflet.Service);
|
||||
text(text: string): this;
|
||||
address(text: string): this;
|
||||
neighborhood(text: string): this;
|
||||
city(text: string): this;
|
||||
subregion(text: string): this;
|
||||
region(text: string): this;
|
||||
postal(text: string): this;
|
||||
country(text: string): this;
|
||||
category(text: string): this;
|
||||
within(bounds: leaflet.LatLngBoundsExpression): this;
|
||||
nearby(latlng: leaflet.LatLngExpression, distance: number): this;
|
||||
run(callback: (error: any | undefined, results: { results: any[] }, response: any) => void, context?: any): this;
|
||||
}
|
||||
|
||||
function geocode(options?: esriLeaflet.TaskOptions | esriLeaflet.Service): Geocode;
|
||||
|
||||
class Suggest extends esriLeaflet.Task {
|
||||
constructor(options?: esriLeaflet.TaskOptions | esriLeaflet.Service);
|
||||
text(text: string): this;
|
||||
category(text: string): this;
|
||||
within(bounds: leaflet.LatLngBoundsExpression): this;
|
||||
nearby(latlng: leaflet.LatLngExpression, distance: number): this;
|
||||
run(callback: (error: any | undefined, results: any, response: any) => void, context?: any): this;
|
||||
}
|
||||
|
||||
function suggest(options?: esriLeaflet.TaskOptions | esriLeaflet.Service): Suggest;
|
||||
|
||||
class ReverseGeocode extends esriLeaflet.Task {
|
||||
constructor(options?: esriLeaflet.TaskOptions | esriLeaflet.Service);
|
||||
latlng(latlng: leaflet.LatLngExpression): this;
|
||||
distance(distance: number): this;
|
||||
language(language: string): this;
|
||||
run(callback: (error: any | undefined, results: { latlng: leaflet.LatLng; address: string; }, response: any) => void, context?: any): this;
|
||||
}
|
||||
|
||||
function reverseGeocode(options?: esriLeaflet.TaskOptions | esriLeaflet.Service): ReverseGeocode;
|
||||
|
||||
interface GeosearchProvider {
|
||||
suggestions(text: string, bounds: leaflet.LatLngBoundsExpression | undefined | null, callback: GeosearchCallback): esriLeaflet.Task;
|
||||
results(text: string, key: string, bounds: leaflet.LatLngBoundsExpression | undefined | null, callback: GeosearchCallback): esriLeaflet.Task;
|
||||
}
|
||||
type GeosearchCallback = (error: any | undefined, results: any) => void;
|
||||
|
||||
interface BaseProviderOptions {
|
||||
label?: string;
|
||||
maxResults?: number;
|
||||
attribution?: string;
|
||||
token?: string | null;
|
||||
}
|
||||
|
||||
class ArcgisOnlineProvider extends GeocodeService implements GeosearchProvider {
|
||||
constructor(options?: ArcgisOnlineProviderOptions);
|
||||
suggestions(text: string, bounds: leaflet.LatLngBoundsExpression | undefined | null, callback: GeosearchCallback): Suggest;
|
||||
results(text: string, key: string, bounds: leaflet.LatLngBoundsExpression | undefined | null, callback: GeosearchCallback): Geocode;
|
||||
}
|
||||
|
||||
function arcgisOnlineProvider(options?: ArcgisOnlineProviderOptions): ArcgisOnlineProvider;
|
||||
|
||||
interface ArcgisOnlineProviderOptions extends BaseProviderOptions {
|
||||
countries?: string | string[];
|
||||
categories?: string | string[];
|
||||
forStorage?: boolean;
|
||||
}
|
||||
|
||||
class GeocodeServiceProvider extends GeocodeService implements GeosearchProvider {
|
||||
constructor(options?: GeocodeServiceProviderOptions);
|
||||
suggestions(text: string, bounds: leaflet.LatLngBoundsExpression | undefined | null, callback: GeosearchCallback): Suggest;
|
||||
results(text: string, key: string, bounds: leaflet.LatLngBoundsExpression | undefined | null, callback: GeosearchCallback): Geocode;
|
||||
}
|
||||
|
||||
function geocodeServiceProvider(options?: GeocodeServiceProviderOptions): GeocodeServiceProvider;
|
||||
|
||||
interface GeocodeServiceProviderOptions extends BaseProviderOptions {
|
||||
url: string;
|
||||
}
|
||||
|
||||
class FeatureLayerProvider extends esriLeaflet.FeatureLayerService implements GeosearchProvider {
|
||||
constructor(options?: FeatureLayerProviderOptions);
|
||||
suggestions(text: string, bounds: leaflet.LatLngBoundsExpression | undefined | null, callback: GeosearchCallback): esriLeaflet.Query;
|
||||
results(text: string, key: string, bounds: leaflet.LatLngBoundsExpression | undefined | null, callback: GeosearchCallback): esriLeaflet.Query;
|
||||
}
|
||||
|
||||
function featureLayerProvider(options?: FeatureLayerProviderOptions): FeatureLayerProvider;
|
||||
|
||||
interface FeatureLayerProviderOptions extends BaseProviderOptions {
|
||||
url: string;
|
||||
searchFields?: string | string[];
|
||||
bufferRadius?: number;
|
||||
formatSuggestion?(featureInformation: any): string;
|
||||
}
|
||||
|
||||
class MapServiceProvider extends esriLeaflet.MapService implements GeosearchProvider {
|
||||
constructor(options?: MapServiceProviderOptions);
|
||||
suggestions(text: string, bounds: leaflet.LatLngBoundsExpression | undefined | null, callback: GeosearchCallback): esriLeaflet.Find;
|
||||
results(text: string, key: string, bounds: leaflet.LatLngBoundsExpression | undefined | null, callback: GeosearchCallback): esriLeaflet.Query | esriLeaflet.Find;
|
||||
}
|
||||
|
||||
function mapServiceProvider(options?: MapServiceProviderOptions): MapServiceProvider;
|
||||
|
||||
interface MapServiceProviderOptions extends BaseProviderOptions {
|
||||
url: string;
|
||||
searchFields: string | string[];
|
||||
layers: number | number[];
|
||||
bufferRadius: number | number[];
|
||||
formatSuggestion(featureInformation: any): string;
|
||||
}
|
||||
|
||||
interface ResultObject {
|
||||
text?: string;
|
||||
bounds?: leaflet.LatLngBoundsExpression;
|
||||
latlng?: leaflet.LatLngExpression;
|
||||
properties?: any;
|
||||
geojson?: leaflet.GeoJSON;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface Results {
|
||||
bounds: leaflet.LatLngBoundsExpression;
|
||||
latlng: leaflet.LatLngExpression;
|
||||
results: ResultObject[];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"esri-leaflet-geocoder-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as fetchMock from "fetch-mock";
|
||||
import { MockResponse } from "fetch-mock";
|
||||
|
||||
fetchMock.mock("http://test.com", 200);
|
||||
fetchMock.mock(/test\.com/, 200);
|
||||
@@ -65,3 +66,6 @@ const myMatcher: fetchMock.MockMatcherFunction = (
|
||||
url: string,
|
||||
opts: fetchMock.MockRequest
|
||||
) => true;
|
||||
|
||||
fetchMock.flush().then(resolved => resolved.forEach(console.log));
|
||||
fetchMock.flush().catch(r => r);
|
||||
|
||||
Vendored
+11
-2
@@ -1,6 +1,9 @@
|
||||
// Type definitions for fetch-mock 5.8
|
||||
// Type definitions for fetch-mock 5.12
|
||||
// Project: https://github.com/wheresrhys/fetch-mock
|
||||
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>, Tamir Duberstein <https://github.com/tamird>, Risto Keravuori <https://github.com/merrywhether>
|
||||
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>
|
||||
// Tamir Duberstein <https://github.com/tamird>
|
||||
// Risto Keravuori <https://github.com/merrywhether>
|
||||
// Chris Sinclair <https://github.com/chrissinclair>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -333,6 +336,12 @@ declare namespace fetchMock {
|
||||
*/
|
||||
reset(): this;
|
||||
|
||||
/**
|
||||
* Returns a promise that resolves once all fetches handled by fetch-mock
|
||||
* have resolved.
|
||||
*/
|
||||
flush(): Promise<MockResponse[]>;
|
||||
|
||||
/**
|
||||
* Returns all calls to fetch, grouped by whether fetch-mock matched
|
||||
* them or not.
|
||||
|
||||
Vendored
+1
@@ -70,6 +70,7 @@ declare namespace Flatpickr {
|
||||
weekNumbers?: boolean;
|
||||
wrap?: boolean;
|
||||
locale?: string | Locale;
|
||||
plugins?: any[];
|
||||
}
|
||||
|
||||
interface Locale {
|
||||
|
||||
Vendored
+40
@@ -123,6 +123,9 @@ declare namespace gapi.auth2 {
|
||||
getEmail(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2authresponse
|
||||
*/
|
||||
interface AuthResponse {
|
||||
access_token: string;
|
||||
id_token: string;
|
||||
@@ -133,6 +136,37 @@ declare namespace gapi.auth2 {
|
||||
expires_at: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2authorizeconfig
|
||||
*/
|
||||
interface AuthorizeConfig {
|
||||
client_id: string;
|
||||
scope: string;
|
||||
response_type?: string;
|
||||
prompt?: string;
|
||||
cookie_policy?: string;
|
||||
hosted_domain?: string;
|
||||
login_hint?: string;
|
||||
app_package_name?: string;
|
||||
openid_realm?: string;
|
||||
include_granted_scope?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2authorizeresponse
|
||||
*/
|
||||
interface AuthorizeResponse {
|
||||
access_token: string;
|
||||
id_token: string;
|
||||
code: string;
|
||||
scope: string;
|
||||
expires_in: number;
|
||||
first_issued_at: number;
|
||||
expires_at: number;
|
||||
error: string;
|
||||
error_subtype: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A GoogleUser object represents one user account.
|
||||
*/
|
||||
@@ -255,6 +289,12 @@ declare namespace gapi.auth2 {
|
||||
* Returns the GoogleAuth object. You must initialize the GoogleAuth object with gapi.auth2.init() before calling this method.
|
||||
*/
|
||||
function getAuthInstance(): GoogleAuth;
|
||||
|
||||
/**
|
||||
* Performs a one time OAuth 2.0 authorization.
|
||||
* Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2authorizeparams-callback
|
||||
*/
|
||||
function authorize(params: AuthorizeConfig, callback: (response: AuthorizeResponse) => void): void;
|
||||
}
|
||||
|
||||
declare namespace gapi.signin2 {
|
||||
|
||||
Vendored
+14
@@ -180,6 +180,13 @@ declare namespace gapi.client {
|
||||
callback?: () => any;
|
||||
}
|
||||
|
||||
interface TokenObject {
|
||||
/**
|
||||
* The access token to use in requests.
|
||||
*/
|
||||
access_token: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the client library interface to a particular API. If a callback is not provided, a promise is returned.
|
||||
* @param name The name of the API to load.
|
||||
@@ -213,6 +220,13 @@ declare namespace gapi.client {
|
||||
* @param apiKey The API key to set
|
||||
*/
|
||||
export function setApiKey(apiKey: string): void;
|
||||
/**
|
||||
* Sets the authentication token to use in requests.
|
||||
* @param token The token to set.
|
||||
*
|
||||
* Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiclientsettokentokenobject
|
||||
*/
|
||||
export function setToken(token: TokenObject|null): void;
|
||||
|
||||
interface HttpRequestFulfilled<T> {
|
||||
result: T;
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import * as genericPool from "generic-pool";
|
||||
|
||||
class Connection {
|
||||
connected: boolean;
|
||||
}
|
||||
|
||||
const factory = {
|
||||
create: (): Promise<Connection> => {
|
||||
return new Promise<Connection>(resolve => {
|
||||
let conn = new Connection();
|
||||
resolve(conn);
|
||||
});
|
||||
},
|
||||
destroy: (conn: Connection): Promise<undefined> => {
|
||||
return new Promise<undefined>(resolve => {
|
||||
conn.connected = false;
|
||||
resolve();
|
||||
});
|
||||
},
|
||||
validate: (conn: Connection): Promise<boolean> => {
|
||||
return new Promise<boolean>(resolve => {
|
||||
return conn.connected;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let opts = {
|
||||
max: 10,
|
||||
min: 2,
|
||||
maxWaitingClients: 2,
|
||||
testOnBorrow: true,
|
||||
acquireTimeoutMillis: 100,
|
||||
fifo: true,
|
||||
priorityRange: 5,
|
||||
autostart: false,
|
||||
evictionRunIntervalMillis: 200,
|
||||
numTestsPerRun: 3,
|
||||
softIdleTimeoutMillis: 100,
|
||||
idleTimeoutMillis: 5000
|
||||
};
|
||||
|
||||
let pool = genericPool.createPool<Connection>(factory, opts);
|
||||
|
||||
pool.acquire()
|
||||
.then((conn: Connection) => {
|
||||
return pool.release(conn);
|
||||
}).then(() => {
|
||||
return pool.acquire(5);
|
||||
}).then((conn: Connection) => {
|
||||
return pool.destroy(conn);
|
||||
}).then(() => {
|
||||
return pool.clear();
|
||||
}).then((results: undefined[]) => {
|
||||
});
|
||||
|
||||
pool.on('factoryCreateError', (err: Error) => {
|
||||
});
|
||||
|
||||
pool.on('factoryDestroyError', (err: Error) => {
|
||||
});
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
// Type definitions for generic-pool 3.1
|
||||
// Project: https://github.com/coopernurse/node-pool#readme
|
||||
// Definitions by: Jerray Fu <https://github.com/jerray>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
export class Pool<T> extends EventEmitter {
|
||||
spareResourceCapacity: number;
|
||||
size: number;
|
||||
available: number;
|
||||
borrowed: number;
|
||||
pending: number;
|
||||
max: number;
|
||||
min: number;
|
||||
|
||||
acquire(priority?: number): Promise<T>;
|
||||
release(resource: T): void;
|
||||
destroy(resource: T): void;
|
||||
drain(): Promise<undefined>;
|
||||
clear(): Promise<undefined[]>;
|
||||
}
|
||||
|
||||
export interface Factory<T> {
|
||||
create(): Promise<T>;
|
||||
destroy(client: T): Promise<undefined>;
|
||||
validate?(client: T): Promise<boolean>;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
max?: number;
|
||||
min?: number;
|
||||
maxWaitingClients?: number;
|
||||
testOnBorrow?: boolean;
|
||||
acquireTimeoutMillis?: number;
|
||||
fifo?: boolean;
|
||||
priorityRange?: number;
|
||||
autostart?: boolean;
|
||||
evictionRunIntervalMillis?: number;
|
||||
numTestsPerRun?: number;
|
||||
softIdleTimeoutMillis?: number;
|
||||
idleTimeoutMillis?: number;
|
||||
}
|
||||
|
||||
export function createPool<T>(factory: Factory<T>, opts?: Options): Pool<T>;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"generic-pool-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,18 @@
|
||||
import getos = require('getos');
|
||||
|
||||
getos((e, os) => {
|
||||
if (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
const thisOs: getos.Os = os;
|
||||
|
||||
if (os.os === 'linux') {
|
||||
let str: string;
|
||||
let strn: string | undefined;
|
||||
|
||||
str = os.dist;
|
||||
str = os.release;
|
||||
strn = os.codename;
|
||||
}
|
||||
});
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for getos 3.0
|
||||
// Project: https://github.com/retrohacker/getos
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = getos;
|
||||
|
||||
declare function getos(cb: (error: Error | null, os: getos.Os) => void): string;
|
||||
|
||||
declare namespace getos {
|
||||
type Os = OtherOs | LinuxOs;
|
||||
|
||||
interface OtherOs {
|
||||
os: 'aix'
|
||||
| 'android'
|
||||
| 'darwin'
|
||||
| 'freebsd'
|
||||
| 'openbsd'
|
||||
| 'sunos'
|
||||
| 'win32'
|
||||
| 'cygwin';
|
||||
}
|
||||
|
||||
interface LinuxOs {
|
||||
os: 'linux';
|
||||
dist: string;
|
||||
release: string;
|
||||
codename?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"getos-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
import { ReadStream } from "fs";
|
||||
import { Channel, ChannelConfig } from "./channel";
|
||||
import { File } from "./file";
|
||||
import {
|
||||
Acl,
|
||||
ApiResponse,
|
||||
UploadOptions
|
||||
} from "./storage";
|
||||
|
||||
/**
|
||||
* A bucket in the cloud.
|
||||
*/
|
||||
export class Bucket {
|
||||
acl: Acl;
|
||||
combine(sources: string[] | File[], destination: string [] | File[]): Promise<[File, ApiResponse]>;
|
||||
create(config?: BucketConfig): Promise<[Bucket, ApiResponse]>;
|
||||
createChannel(id: string, config: ChannelConfig): Promise<[Channel, ApiResponse]>;
|
||||
delete(): Promise<[ApiResponse]>;
|
||||
deleteFiles(query?: BucketQuery): Promise<void>;
|
||||
exists(): Promise<[boolean]>;
|
||||
file(name: string, options?: BucketFileOptions): File;
|
||||
get(options?: BucketGetOptions): Promise<[Bucket, ApiResponse]>;
|
||||
getFiles(query?: BucketQuery): Promise<[File[]]>;
|
||||
getFilesStream(query?: BucketQuery): ReadStream;
|
||||
getMetadata(): Promise<[BucketMetadata, ApiResponse]>;
|
||||
id: string;
|
||||
makePrivate(options?: BucketPrivacyOptions): Promise<[File[]]>;
|
||||
makePublic(options?: BucketPrivacyOptions): Promise<[File[]]>;
|
||||
metadata: BucketMetadata;
|
||||
name: string;
|
||||
setMetadata(metadata?: BucketMetadata): Promise<[ApiResponse]>;
|
||||
upload(localPath: string, options?: UploadOptions): Promise<[File]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bucket configuration.
|
||||
*/
|
||||
export interface BucketConfig {
|
||||
coldline?: boolean;
|
||||
dra?: boolean;
|
||||
location?: string;
|
||||
multiRegional?: boolean;
|
||||
nearline?: boolean;
|
||||
regional?: boolean;
|
||||
versioning?: {
|
||||
enabled?: boolean
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for getting a file.
|
||||
*/
|
||||
export interface BucketFileOptions {
|
||||
generation?: string | number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for getting a bucket.
|
||||
*/
|
||||
export interface BucketGetOptions {
|
||||
autoCreate?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bucket metadata.
|
||||
*/
|
||||
export interface BucketMetadata {
|
||||
etag?: string;
|
||||
id?: string;
|
||||
kind?: string;
|
||||
location?: string;
|
||||
metageneration?: string;
|
||||
name?: string;
|
||||
projectNumber?: string;
|
||||
selfLink?: string;
|
||||
storageClass?: string;
|
||||
timeCreated?: string;
|
||||
updated?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The options for making the bucket private.
|
||||
*/
|
||||
export interface BucketPrivacyOptions {
|
||||
includeFiles?: boolean;
|
||||
force?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query a bucket.
|
||||
*/
|
||||
export interface BucketQuery {
|
||||
autoPaginate?: boolean;
|
||||
delimiter?: string;
|
||||
prefix?: string;
|
||||
maxApiCalls?: number;
|
||||
maxResults?: number;
|
||||
pageToken?: string;
|
||||
versions?: boolean;
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
import { ApiResponse } from "./storage";
|
||||
|
||||
/**
|
||||
* This class allows you interact with Google Cloud Storage.
|
||||
*/
|
||||
export class Channel {
|
||||
stop(): Promise<[ApiResponse]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel configuration.
|
||||
*/
|
||||
export interface ChannelConfig {
|
||||
address: string;
|
||||
}
|
||||
-95
@@ -1,95 +0,0 @@
|
||||
import { ReadStream, WriteStream } from "fs";
|
||||
import { Bucket } from "./bucket";
|
||||
import {
|
||||
Acl,
|
||||
ApiResponse,
|
||||
DownloadOptions,
|
||||
ReadStreamOptions,
|
||||
UploadOptions,
|
||||
WriteStreamOptions
|
||||
} from "./storage";
|
||||
|
||||
/**
|
||||
* Options for specifying the content length range.
|
||||
*/
|
||||
export interface ContentLengthRange {
|
||||
max?: number;
|
||||
min?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A file in the cloud.
|
||||
*/
|
||||
export class File {
|
||||
acl: Acl;
|
||||
copy(destination: string | Bucket | File): Promise<[File, ApiResponse]>;
|
||||
createReadStream(options?: ReadStreamOptions): ReadStream;
|
||||
createWriteStream(options?: WriteStreamOptions): WriteStream;
|
||||
delete(): Promise<[ApiResponse]>;
|
||||
download(options?: DownloadOptions): Promise<[string]>;
|
||||
exists(): Promise<[boolean]>;
|
||||
get(): Promise<[File, ApiResponse]>;
|
||||
getMetadata(): Promise<[FileMetadata, ApiResponse]>;
|
||||
getSignedPolicy(options?: SignedPolicyOptions): Promise<[SignedPolicy]>;
|
||||
getSignedUrl(config?: SignedUrlConfig): Promise<[string]>;
|
||||
makePrivate(options?: FilePrivateOptions): Promise<[ApiResponse]>;
|
||||
makePublic(): Promise<[ApiResponse]>;
|
||||
move(destination: string | Bucket | File): Promise<[File, ApiResponse]>;
|
||||
name: string;
|
||||
save(data: string, options?: WriteStreamOptions): Promise<void>;
|
||||
setEncryptionKey(encryptionKey: string | Buffer): File;
|
||||
setMetadata(metadata: FileMetadata): Promise<[ApiResponse]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* File metadata.
|
||||
*/
|
||||
export interface FileMetadata {
|
||||
contentType?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when setting the file as private.
|
||||
*/
|
||||
export interface FilePrivateOptions {
|
||||
strict?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A signed policy allowing a user to upload a file with a POST.
|
||||
*/
|
||||
export interface SignedPolicy {
|
||||
base64?: string;
|
||||
signature?: string;
|
||||
string?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when obtaining the signed policy.
|
||||
*/
|
||||
export interface SignedPolicyOptions {
|
||||
acl?: string;
|
||||
contentLengthRange?: ContentLengthRange;
|
||||
equals?: string[] | [string[]];
|
||||
expires?: number | string;
|
||||
max?: number;
|
||||
min?: number;
|
||||
startsWith?: string[] | [string[]];
|
||||
successRedirect?: string;
|
||||
successStatus?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when obtaining a temporary signed URL for a file.
|
||||
*/
|
||||
export interface SignedUrlConfig {
|
||||
action: string;
|
||||
cname?: string;
|
||||
contentMd5?: string;
|
||||
contentType?: string;
|
||||
expires?: number | string;
|
||||
extensionHeaders?: {[key: string]: string};
|
||||
promptSaveAs?: string;
|
||||
responseDisposition?: string;
|
||||
responseType?: string;
|
||||
}
|
||||
@@ -3,83 +3,83 @@ import * as fs from "fs";
|
||||
|
||||
// import Google Cloud Storage
|
||||
import {
|
||||
Acl,
|
||||
Bucket,
|
||||
Channel,
|
||||
File,
|
||||
ApiResponse,
|
||||
BucketConfig,
|
||||
BucketFileOptions,
|
||||
BucketGetOptions,
|
||||
BucketMetadata,
|
||||
BucketPrivacyOptions,
|
||||
BucketQuery,
|
||||
ChannelConfig,
|
||||
DownloadOptions,
|
||||
FileMetadata,
|
||||
FilePrivateOptions,
|
||||
ReadStreamOptions,
|
||||
SignedPolicy,
|
||||
SignedPolicyOptions,
|
||||
SignedUrlConfig,
|
||||
WriteStreamOptions,
|
||||
UploadOptions,
|
||||
Storage
|
||||
Acl,
|
||||
Bucket,
|
||||
Channel,
|
||||
File,
|
||||
ApiResponse,
|
||||
BucketConfig,
|
||||
BucketFileOptions,
|
||||
BucketGetOptions,
|
||||
BucketMetadata,
|
||||
BucketPrivacyOptions,
|
||||
BucketQuery,
|
||||
ChannelConfig,
|
||||
DownloadOptions,
|
||||
FileMetadata,
|
||||
FilePrivateOptions,
|
||||
ReadStreamOptions,
|
||||
SignedPolicy,
|
||||
SignedPolicyOptions,
|
||||
SignedUrlConfig,
|
||||
WriteStreamOptions,
|
||||
UploadOptions
|
||||
} from "@google-cloud/storage";
|
||||
import * as CloudStorage from "@google-cloud/storage";
|
||||
|
||||
/**
|
||||
* Test the storage service.
|
||||
* @class TestStorage
|
||||
*/
|
||||
export class TestStorage {
|
||||
// constants
|
||||
static BUCKET_CONFIG: BucketConfig = {
|
||||
multiRegional: true
|
||||
};
|
||||
// constants
|
||||
static BUCKET_CONFIG: BucketConfig = {
|
||||
multiRegional: true
|
||||
};
|
||||
|
||||
// import Storage class
|
||||
static gcs: Storage = new Storage();
|
||||
// import Storage class
|
||||
static gcs = CloudStorage();
|
||||
|
||||
// the bucket
|
||||
private buckets: Bucket[] = [];
|
||||
// the bucket
|
||||
private buckets: Bucket[] = [];
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
constructor() {
|
||||
// nothing to do
|
||||
}
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
constructor() {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bucket.
|
||||
* @method bucket
|
||||
* @param {string} name
|
||||
* @return {Bucket}
|
||||
*/
|
||||
bucket(name: string): Bucket {
|
||||
return TestStorage.gcs.bucket(name);
|
||||
}
|
||||
/**
|
||||
* Returns the bucket.
|
||||
* @method bucket
|
||||
* @param {string} name
|
||||
* @return {Bucket}
|
||||
*/
|
||||
bucket(name: string): Bucket {
|
||||
return TestStorage.gcs.bucket(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new bucket.
|
||||
* @param {string} name
|
||||
* @param {BucketConfig} metadata
|
||||
* @return {Promise<[Bucket, ApiResponse]>}
|
||||
*/
|
||||
createBucket(name: string, config?: BucketConfig): Promise<[Bucket, ApiResponse]> {
|
||||
// overwrite default values with custom config
|
||||
config = Object.assign(TestStorage.BUCKET_CONFIG, config);
|
||||
/**
|
||||
* Create a new bucket.
|
||||
* @param {string} name
|
||||
* @param {BucketConfig} metadata
|
||||
* @return {Promise<[Bucket, ApiResponse]>}
|
||||
*/
|
||||
createBucket(name: string, config?: BucketConfig): Promise<[Bucket, ApiResponse]> {
|
||||
// overwrite default values with custom config
|
||||
config = Object.assign(TestStorage.BUCKET_CONFIG, config);
|
||||
|
||||
return TestStorage.gcs.createBucket(name, config);
|
||||
}
|
||||
return TestStorage.gcs.createBucket(name, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query for buckets.
|
||||
* @param {BucketQuery} query
|
||||
*/
|
||||
getBuckets(query?: BucketQuery): Promise<[Bucket[]]> {
|
||||
return TestStorage.gcs.getBuckets(query);
|
||||
}
|
||||
/**
|
||||
* Query for buckets.
|
||||
* @param {BucketQuery} query
|
||||
*/
|
||||
getBuckets(query?: BucketQuery): Promise<[Bucket[]]> {
|
||||
return TestStorage.gcs.getBuckets(query);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,143 +87,143 @@ export class TestStorage {
|
||||
* @class TestBucket
|
||||
*/
|
||||
export class TestBucket {
|
||||
// the bucket in the cloud
|
||||
bucket: Bucket;
|
||||
// the bucket in the cloud
|
||||
bucket: Bucket;
|
||||
|
||||
/**
|
||||
* Create a bucket.
|
||||
* @param {BucketConfig} config
|
||||
* @return {Promise<[Bucket, ApiResponse]>}
|
||||
*/
|
||||
create(config?: BucketConfig): Promise<[Bucket, ApiResponse]> {
|
||||
return this.bucket.create(config);
|
||||
}
|
||||
/**
|
||||
* Create a bucket.
|
||||
* @param {BucketConfig} config
|
||||
* @return {Promise<[Bucket, ApiResponse]>}
|
||||
*/
|
||||
create(config?: BucketConfig): Promise<[Bucket, ApiResponse]> {
|
||||
return this.bucket.create(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a channel that will be notified when objects in this bucket changes.
|
||||
* @method createChannel
|
||||
* @param {string} id
|
||||
* @param {ChannelConfig} config
|
||||
* @return {Promise<[Channel, ApiResponse]>}
|
||||
*/
|
||||
createChannel(id: string, config: ChannelConfig): Promise<[Channel, ApiResponse]> {
|
||||
return this.bucket.createChannel(id, config);
|
||||
}
|
||||
/**
|
||||
* Create a channel that will be notified when objects in this bucket changes.
|
||||
* @method createChannel
|
||||
* @param {string} id
|
||||
* @param {ChannelConfig} config
|
||||
* @return {Promise<[Channel, ApiResponse]>}
|
||||
*/
|
||||
createChannel(id: string, config: ChannelConfig): Promise<[Channel, ApiResponse]> {
|
||||
return this.bucket.createChannel(id, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the bucket.
|
||||
* @method delete
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
delete(): Promise<[ApiResponse]> {
|
||||
return this.bucket.delete();
|
||||
}
|
||||
/**
|
||||
* Delete the bucket.
|
||||
* @method delete
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
delete(): Promise<[ApiResponse]> {
|
||||
return this.bucket.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over the bucket's files, calling file.delete() on each.
|
||||
* @method deleteFiles
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
deleteFiles(query?: BucketQuery): Promise<void> {
|
||||
return this.bucket.deleteFiles(query);
|
||||
}
|
||||
/**
|
||||
* Iterate over the bucket's files, calling file.delete() on each.
|
||||
* @method deleteFiles
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
deleteFiles(query?: BucketQuery): Promise<void> {
|
||||
return this.bucket.deleteFiles(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the bucket exists.
|
||||
* @method exists
|
||||
* @return {Promise<[boolean]>}
|
||||
*/
|
||||
exists(): Promise<[boolean]> {
|
||||
return this.bucket.exists();
|
||||
}
|
||||
/**
|
||||
* Check if the bucket exists.
|
||||
* @method exists
|
||||
* @return {Promise<[boolean]>}
|
||||
*/
|
||||
exists(): Promise<[boolean]> {
|
||||
return this.bucket.exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a File object.
|
||||
* @method file
|
||||
* @param {string} name
|
||||
* @param {BucketFileOptions} options
|
||||
*/
|
||||
file(name: string, options?: BucketFileOptions): File {
|
||||
return this.bucket.file(name);
|
||||
}
|
||||
/**
|
||||
* Create a File object.
|
||||
* @method file
|
||||
* @param {string} name
|
||||
* @param {BucketFileOptions} options
|
||||
*/
|
||||
file(name: string, options?: BucketFileOptions): File {
|
||||
return this.bucket.file(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a bucket if it exists.
|
||||
* @method get
|
||||
* @param {BucketGetOptions} options
|
||||
*/
|
||||
get(options?: BucketGetOptions): Promise<[Bucket, ApiResponse]> {
|
||||
return this.bucket.get(options);
|
||||
}
|
||||
/**
|
||||
* Get a bucket if it exists.
|
||||
* @method get
|
||||
* @param {BucketGetOptions} options
|
||||
*/
|
||||
get(options?: BucketGetOptions): Promise<[Bucket, ApiResponse]> {
|
||||
return this.bucket.get(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get File objects for the files currently in the bucket
|
||||
* @method getFiles
|
||||
* @param {BucketQuery} query
|
||||
* @return {Promise<[File[]]>}
|
||||
*/
|
||||
getFiles(query?: BucketQuery): Promise<[File[]]> {
|
||||
return this.bucket.getFiles(query);
|
||||
}
|
||||
/**
|
||||
* Get File objects for the files currently in the bucket
|
||||
* @method getFiles
|
||||
* @param {BucketQuery} query
|
||||
* @return {Promise<[File[]]>}
|
||||
*/
|
||||
getFiles(query?: BucketQuery): Promise<[File[]]> {
|
||||
return this.bucket.getFiles(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get File objects for the files currently in the bucket as a readable object stream.
|
||||
* @method getFilesStream
|
||||
* @param {BucketQuery} query
|
||||
* @return {ReadStream}
|
||||
*/
|
||||
getFilesStream(query?: BucketQuery): fs.ReadStream {
|
||||
return this.bucket.getFilesStream(query);
|
||||
}
|
||||
/**
|
||||
* Get File objects for the files currently in the bucket as a readable object stream.
|
||||
* @method getFilesStream
|
||||
* @param {BucketQuery} query
|
||||
* @return {ReadStream}
|
||||
*/
|
||||
getFilesStream(query?: BucketQuery): fs.ReadStream {
|
||||
return this.bucket.getFilesStream(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bucket's metadata.
|
||||
* @method getMetadata
|
||||
* @return {Promise<[BucketMetadata, ApiResponse]>}
|
||||
*/
|
||||
getMetadata(): Promise<[BucketMetadata, ApiResponse]> {
|
||||
return this.bucket.getMetadata();
|
||||
}
|
||||
/**
|
||||
* Get the bucket's metadata.
|
||||
* @method getMetadata
|
||||
* @return {Promise<[BucketMetadata, ApiResponse]>}
|
||||
*/
|
||||
getMetadata(): Promise<[BucketMetadata, ApiResponse]> {
|
||||
return this.bucket.getMetadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the bucket listing private.
|
||||
* @method makePrivate
|
||||
* @param {} options
|
||||
* @return Promise<[File[]]>
|
||||
*/
|
||||
makePrivate(options?: BucketPrivacyOptions): Promise<[File[]]> {
|
||||
return this.bucket.makePrivate(options);
|
||||
}
|
||||
/**
|
||||
* Make the bucket listing private.
|
||||
* @method makePrivate
|
||||
* @param {} options
|
||||
* @return Promise<[File[]]>
|
||||
*/
|
||||
makePrivate(options?: BucketPrivacyOptions): Promise<[File[]]> {
|
||||
return this.bucket.makePrivate(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the bucket publicly readable.
|
||||
* @method makePublic
|
||||
* @param {} options
|
||||
* @return Promise<[File[]]>
|
||||
*/
|
||||
makePublic(options?: BucketPrivacyOptions): Promise<[File[]]> {
|
||||
return this.bucket.makePublic(options);
|
||||
}
|
||||
/**
|
||||
* Make the bucket publicly readable.
|
||||
* @method makePublic
|
||||
* @param {} options
|
||||
* @return Promise<[File[]]>
|
||||
*/
|
||||
makePublic(options?: BucketPrivacyOptions): Promise<[File[]]> {
|
||||
return this.bucket.makePublic(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the bucket's metadata.
|
||||
* @method setMetadata
|
||||
* @param {BucketMetadata} metadata
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
setMetadata(metadata?: BucketMetadata): Promise<[ApiResponse]> {
|
||||
return this.bucket.setMetadata(metadata);
|
||||
}
|
||||
/**
|
||||
* Set the bucket's metadata.
|
||||
* @method setMetadata
|
||||
* @param {BucketMetadata} metadata
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
setMetadata(metadata?: BucketMetadata): Promise<[ApiResponse]> {
|
||||
return this.bucket.setMetadata(metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a file.
|
||||
* @method upload
|
||||
* @param {localPath} string
|
||||
* @param {UploadOptions} options
|
||||
*/
|
||||
upload(localPath: string, options?: UploadOptions): Promise<[File]> {
|
||||
return this.bucket.upload(localPath, options);
|
||||
}
|
||||
/**
|
||||
* Upload a file.
|
||||
* @method upload
|
||||
* @param {localPath} string
|
||||
* @param {UploadOptions} options
|
||||
*/
|
||||
upload(localPath: string, options?: UploadOptions): Promise<[File]> {
|
||||
return this.bucket.upload(localPath, options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,168 +231,168 @@ export class TestBucket {
|
||||
* @class TestFile
|
||||
*/
|
||||
export class TestFile {
|
||||
// the file in the cloud
|
||||
file: File;
|
||||
// the file in the cloud
|
||||
file: File;
|
||||
|
||||
/**
|
||||
* Copy this file to another file.
|
||||
* By default, this will copy the file to the same bucket, but you can choose to copy it to another
|
||||
* Bucket by providing a Bucket or File object or a URL starting with "gs:// ".
|
||||
* @method copy
|
||||
* @param {string} destination
|
||||
* @return Promise<[File, ApiResponse]>
|
||||
*/
|
||||
/**
|
||||
* Copy this file to another file.
|
||||
* By default, this will copy the file to the same bucket, but you can choose to copy it to another
|
||||
* Bucket by providing a Bucket or File object or a URL starting with "gs:// ".
|
||||
* @method copy
|
||||
* @param {string} destination
|
||||
* @return Promise<[File, ApiResponse]>
|
||||
*/
|
||||
|
||||
copy(destination: string | Bucket | File): Promise<[File, ApiResponse]> {
|
||||
return this.file.copy(destination);
|
||||
}
|
||||
copy(destination: string | Bucket | File): Promise<[File, ApiResponse]> {
|
||||
return this.file.copy(destination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a readable stream to read the contents of the remote file.
|
||||
* It can be piped to a writable stream or listened to for 'data' events to read a file's contents.
|
||||
* @method createReadStream
|
||||
* @param {ReadStreamOptions} options
|
||||
* @return {ReadStream}
|
||||
*/
|
||||
createReadStream(options?: ReadStreamOptions): fs.ReadStream {
|
||||
return this.file.createReadStream(options);
|
||||
}
|
||||
/**
|
||||
* Create a readable stream to read the contents of the remote file.
|
||||
* It can be piped to a writable stream or listened to for 'data' events to read a file's contents.
|
||||
* @method createReadStream
|
||||
* @param {ReadStreamOptions} options
|
||||
* @return {ReadStream}
|
||||
*/
|
||||
createReadStream(options?: ReadStreamOptions): fs.ReadStream {
|
||||
return this.file.createReadStream(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a writable stream to overwrite the contents of the file in your bucket.
|
||||
* @method createWriteStream
|
||||
* @param {WriteStreamOptions} options
|
||||
* @return {WriteStream}
|
||||
*/
|
||||
createWriteStream(options?: WriteStreamOptions): fs.WriteStream {
|
||||
return this.file.createWriteStream(options);
|
||||
}
|
||||
/**
|
||||
* Create a writable stream to overwrite the contents of the file in your bucket.
|
||||
* @method createWriteStream
|
||||
* @param {WriteStreamOptions} options
|
||||
* @return {WriteStream}
|
||||
*/
|
||||
createWriteStream(options?: WriteStreamOptions): fs.WriteStream {
|
||||
return this.file.createWriteStream(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the file.
|
||||
* @method delete
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
delete(): Promise<[ApiResponse]> {
|
||||
return this.file.delete();
|
||||
}
|
||||
/**
|
||||
* Delete the file.
|
||||
* @method delete
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
delete(): Promise<[ApiResponse]> {
|
||||
return this.file.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to download a file into memory or to a local destination.
|
||||
* @method download
|
||||
* @param {DownloadOptions} options
|
||||
* @return {Promise<[string]>}
|
||||
*/
|
||||
download(options?: DownloadOptions): Promise<[string]> {
|
||||
return this.file.download(options);
|
||||
}
|
||||
/**
|
||||
* Convenience method to download a file into memory or to a local destination.
|
||||
* @method download
|
||||
* @param {DownloadOptions} options
|
||||
* @return {Promise<[string]>}
|
||||
*/
|
||||
download(options?: DownloadOptions): Promise<[string]> {
|
||||
return this.file.download(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the file exists.
|
||||
* @method exists
|
||||
* @return {Promise<[boolean]>}
|
||||
*/
|
||||
exists(): Promise<[boolean]> {
|
||||
return this.file.exists();
|
||||
}
|
||||
/**
|
||||
* Check if the file exists.
|
||||
* @method exists
|
||||
* @return {Promise<[boolean]>}
|
||||
*/
|
||||
exists(): Promise<[boolean]> {
|
||||
return this.file.exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a file object and its metadata if it exists.
|
||||
* @method get
|
||||
* @return {Promise<[File, ApiResponse]>}
|
||||
*/
|
||||
get(): Promise<[File, ApiResponse]> {
|
||||
return this.file.get();
|
||||
}
|
||||
/**
|
||||
* Get a file object and its metadata if it exists.
|
||||
* @method get
|
||||
* @return {Promise<[File, ApiResponse]>}
|
||||
*/
|
||||
get(): Promise<[File, ApiResponse]> {
|
||||
return this.file.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file's metadata.
|
||||
* @method getMetadata
|
||||
* @return {Promise<[FileMetadata, ApiResponse]>}
|
||||
*/
|
||||
getMetadata(): Promise<[FileMetadata, ApiResponse]> {
|
||||
return this.file.getMetadata();
|
||||
}
|
||||
/**
|
||||
* Get the file's metadata.
|
||||
* @method getMetadata
|
||||
* @return {Promise<[FileMetadata, ApiResponse]>}
|
||||
*/
|
||||
getMetadata(): Promise<[FileMetadata, ApiResponse]> {
|
||||
return this.file.getMetadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a signed policy document to allow a user to upload data with a POST request
|
||||
* @method getSignedPolicy
|
||||
* @param {SignedPolicyOptions} options
|
||||
* @return {Promise<[SignedPolicy]>}
|
||||
*/
|
||||
getSignedPolicy(options?: SignedPolicyOptions): Promise<[SignedPolicy]> {
|
||||
return this.file.getSignedPolicy(options);
|
||||
}
|
||||
/**
|
||||
* Get a signed policy document to allow a user to upload data with a POST request
|
||||
* @method getSignedPolicy
|
||||
* @param {SignedPolicyOptions} options
|
||||
* @return {Promise<[SignedPolicy]>}
|
||||
*/
|
||||
getSignedPolicy(options?: SignedPolicyOptions): Promise<[SignedPolicy]> {
|
||||
return this.file.getSignedPolicy(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a signed URL to allow limited time access to the file
|
||||
* @method getSignedUrl
|
||||
* @param {SignedUrlConfig} config
|
||||
* @return {Promise<[string]>}
|
||||
*/
|
||||
getSignedUrl(config?: SignedUrlConfig): Promise<[string]> {
|
||||
return this.file.getSignedUrl(config);
|
||||
}
|
||||
/**
|
||||
* Get a signed URL to allow limited time access to the file
|
||||
* @method getSignedUrl
|
||||
* @param {SignedUrlConfig} config
|
||||
* @return {Promise<[string]>}
|
||||
*/
|
||||
getSignedUrl(config?: SignedUrlConfig): Promise<[string]> {
|
||||
return this.file.getSignedUrl(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a file private to the project and remove all other permissions.
|
||||
* @method makePrivate
|
||||
* @param {FilePrivateOptions} options
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
makePrivate(options?: FilePrivateOptions): Promise<[ApiResponse]> {
|
||||
return this.file.makePrivate(options);
|
||||
}
|
||||
/**
|
||||
* Make a file private to the project and remove all other permissions.
|
||||
* @method makePrivate
|
||||
* @param {FilePrivateOptions} options
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
makePrivate(options?: FilePrivateOptions): Promise<[ApiResponse]> {
|
||||
return this.file.makePrivate(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a file to be publicly readable and maintain all previous permissions.
|
||||
* @method makePublic
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
makePublic(): Promise<[ApiResponse]> {
|
||||
return this.file.makePublic();
|
||||
}
|
||||
/**
|
||||
* Set a file to be publicly readable and maintain all previous permissions.
|
||||
* @method makePublic
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
makePublic(): Promise<[ApiResponse]> {
|
||||
return this.file.makePublic();
|
||||
}
|
||||
|
||||
/**
|
||||
* Move this file to another location.
|
||||
* By default, this will move the file to the same bucket, but you can choose to move it to
|
||||
* another Bucket by providing a Bucket or File object or a URL beginning with "gs:// ".
|
||||
* @method move
|
||||
* @param {string|Bucket|File} destination
|
||||
* @return {Promise<[File, ApiResponse]>}
|
||||
*/
|
||||
move(destination: string | Bucket | File): Promise<[File, ApiResponse]> {
|
||||
return this.file.move(destination);
|
||||
}
|
||||
/**
|
||||
* Move this file to another location.
|
||||
* By default, this will move the file to the same bucket, but you can choose to move it to
|
||||
* another Bucket by providing a Bucket or File object or a URL beginning with "gs:// ".
|
||||
* @method move
|
||||
* @param {string|Bucket|File} destination
|
||||
* @return {Promise<[File, ApiResponse]>}
|
||||
*/
|
||||
move(destination: string | Bucket | File): Promise<[File, ApiResponse]> {
|
||||
return this.file.move(destination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write arbitrary data to a file.
|
||||
* @param {string} data
|
||||
* @param {WriteStreamOptions} options
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
save(data: string, options?: WriteStreamOptions): Promise<void> {
|
||||
return this.file.save(data);
|
||||
}
|
||||
/**
|
||||
* Write arbitrary data to a file.
|
||||
* @param {string} data
|
||||
* @param {WriteStreamOptions} options
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
save(data: string, options?: WriteStreamOptions): Promise<void> {
|
||||
return this.file.save(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Storage API allows you to use a custom key for server-side encryption.
|
||||
* @param {string|Buffer} encryptionKey
|
||||
* @return {File}
|
||||
*/
|
||||
setEncryptionKey(encryptionKey: string | Buffer): File {
|
||||
return this.file.setEncryptionKey(encryptionKey);
|
||||
}
|
||||
/**
|
||||
* The Storage API allows you to use a custom key for server-side encryption.
|
||||
* @param {string|Buffer} encryptionKey
|
||||
* @return {File}
|
||||
*/
|
||||
setEncryptionKey(encryptionKey: string | Buffer): File {
|
||||
return this.file.setEncryptionKey(encryptionKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge the given metadata with the current remote file's metadata.
|
||||
* This will set metadata if it was previously unset or update previously set metadata.
|
||||
* To unset previously set metadata, set its value to null.
|
||||
* @method setMetadata
|
||||
* @param {FileMetadata} metadata
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
setMetadata(metadata: FileMetadata): Promise<[ApiResponse]> {
|
||||
return this.file.setMetadata(metadata);
|
||||
}
|
||||
/**
|
||||
* Merge the given metadata with the current remote file's metadata.
|
||||
* This will set metadata if it was previously unset or update previously set metadata.
|
||||
* To unset previously set metadata, set its value to null.
|
||||
* @method setMetadata
|
||||
* @param {FileMetadata} metadata
|
||||
* @return {Promise<[ApiResponse]>}
|
||||
*/
|
||||
setMetadata(metadata: FileMetadata): Promise<[ApiResponse]> {
|
||||
return this.file.setMetadata(metadata);
|
||||
}
|
||||
}
|
||||
|
||||
+337
-4
@@ -5,7 +5,340 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export * from "./bucket";
|
||||
export * from "./channel";
|
||||
export * from "./file";
|
||||
export * from "./storage";
|
||||
import { ReadStream, WriteStream } from "fs";
|
||||
|
||||
type PromiseLibrary<T> = () => PromiseLike<T>;
|
||||
|
||||
declare namespace Storage {
|
||||
/**
|
||||
* A bucket in the cloud.
|
||||
*/
|
||||
class Bucket {
|
||||
constructor(storage: Storage, name: string);
|
||||
acl: Storage.Acl;
|
||||
combine(sources: string[] | File[], destination: string[] | File[]): Promise<[File, Storage.ApiResponse]>;
|
||||
create(config?: BucketConfig): Promise<[Bucket, Storage.ApiResponse]>;
|
||||
createChannel(id: string, config: ChannelConfig): Promise<[Channel, Storage.ApiResponse]>;
|
||||
delete(): Promise<[Storage.ApiResponse]>;
|
||||
deleteFiles(query?: BucketQuery): Promise<void>;
|
||||
exists(): Promise<[boolean]>;
|
||||
file(name: string, options?: BucketFileOptions): File;
|
||||
get(options?: BucketGetOptions): Promise<[Bucket, Storage.ApiResponse]>;
|
||||
getFiles(query?: BucketQuery): Promise<[File[]]>;
|
||||
getFilesStream(query?: BucketQuery): ReadStream;
|
||||
getMetadata(): Promise<[BucketMetadata, Storage.ApiResponse]>;
|
||||
id: string;
|
||||
makePrivate(options?: BucketPrivacyOptions): Promise<[File[]]>;
|
||||
makePublic(options?: BucketPrivacyOptions): Promise<[File[]]>;
|
||||
metadata: BucketMetadata;
|
||||
name: string;
|
||||
setMetadata(metadata?: BucketMetadata): Promise<[Storage.ApiResponse]>;
|
||||
upload(localPath: string, options?: Storage.UploadOptions): Promise<[File]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bucket configuration.
|
||||
*/
|
||||
interface BucketConfig {
|
||||
coldline?: boolean;
|
||||
dra?: boolean;
|
||||
location?: string;
|
||||
multiRegional?: boolean;
|
||||
nearline?: boolean;
|
||||
regional?: boolean;
|
||||
versioning?: {
|
||||
enabled?: boolean
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for getting a file.
|
||||
*/
|
||||
interface BucketFileOptions {
|
||||
generation?: string | number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for getting a bucket.
|
||||
*/
|
||||
interface BucketGetOptions {
|
||||
autoCreate?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bucket metadata.
|
||||
*/
|
||||
interface BucketMetadata {
|
||||
etag?: string;
|
||||
id?: string;
|
||||
kind?: string;
|
||||
location?: string;
|
||||
metageneration?: string;
|
||||
name?: string;
|
||||
projectNumber?: string;
|
||||
selfLink?: string;
|
||||
storageClass?: string;
|
||||
timeCreated?: string;
|
||||
updated?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The options for making the bucket private.
|
||||
*/
|
||||
interface BucketPrivacyOptions {
|
||||
includeFiles?: boolean;
|
||||
force?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query a bucket.
|
||||
*/
|
||||
interface BucketQuery {
|
||||
autoPaginate?: boolean;
|
||||
delimiter?: string;
|
||||
prefix?: string;
|
||||
maxApiCalls?: number;
|
||||
maxResults?: number;
|
||||
pageToken?: string;
|
||||
versions?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for specifying the content length range.
|
||||
*/
|
||||
interface ContentLengthRange {
|
||||
max?: number;
|
||||
min?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A file in the cloud.
|
||||
*/
|
||||
class File {
|
||||
constructor(bucket: Bucket, name: string, options?: BucketFileOptions);
|
||||
acl: Acl;
|
||||
copy(destination: string | Bucket | File): Promise<[File, ApiResponse]>;
|
||||
createReadStream(options?: ReadStreamOptions): ReadStream;
|
||||
createWriteStream(options?: WriteStreamOptions): WriteStream;
|
||||
delete(): Promise<[ApiResponse]>;
|
||||
download(options?: DownloadOptions): Promise<[Buffer]>;
|
||||
exists(): Promise<[boolean]>;
|
||||
get(): Promise<[File, ApiResponse]>;
|
||||
getMetadata(): Promise<[FileMetadata, ApiResponse]>;
|
||||
getSignedPolicy(options?: SignedPolicyOptions): Promise<[SignedPolicy]>;
|
||||
getSignedUrl(config?: SignedUrlConfig): Promise<[string]>;
|
||||
makePrivate(options?: FilePrivateOptions): Promise<[ApiResponse]>;
|
||||
makePublic(): Promise<[ApiResponse]>;
|
||||
move(destination: string | Bucket | File): Promise<[File, ApiResponse]>;
|
||||
name: string;
|
||||
save(data: string, options?: WriteStreamOptions): Promise<void>;
|
||||
setEncryptionKey(encryptionKey: string | Buffer): File;
|
||||
setMetadata(metadata: FileMetadata): Promise<[ApiResponse]>;
|
||||
metadata?: FileMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* File metadata.
|
||||
*/
|
||||
interface FileMetadata {
|
||||
contentType?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when setting the file as private.
|
||||
*/
|
||||
interface FilePrivateOptions {
|
||||
strict?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A signed policy allowing a user to upload a file with a POST.
|
||||
*/
|
||||
interface SignedPolicy {
|
||||
base64?: string;
|
||||
signature?: string;
|
||||
string?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when obtaining the signed policy.
|
||||
*/
|
||||
interface SignedPolicyOptions {
|
||||
acl?: string;
|
||||
contentLengthRange?: ContentLengthRange;
|
||||
equals?: string[] | [string[]];
|
||||
expires?: number | string;
|
||||
max?: number;
|
||||
min?: number;
|
||||
startsWith?: string[] | [string[]];
|
||||
successRedirect?: string;
|
||||
successStatus?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when obtaining a temporary signed URL for a file.
|
||||
*/
|
||||
interface SignedUrlConfig {
|
||||
action: string;
|
||||
cname?: string;
|
||||
contentMd5?: string;
|
||||
contentType?: string;
|
||||
expires?: number | string;
|
||||
extensionHeaders?: { [key: string]: string };
|
||||
promptSaveAs?: string;
|
||||
responseDisposition?: string;
|
||||
responseType?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access control list for storage buckets and files.
|
||||
*/
|
||||
interface Acl extends AclActions {
|
||||
default: AclEntity;
|
||||
owners: AclEntity;
|
||||
readers: AclEntity;
|
||||
writers: AclEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Actions that can be performed on all ACL entities, including the root Acl.
|
||||
*/
|
||||
interface AclActions {
|
||||
add(options: AclOptions): Promise<[Acl, ApiResponse]>;
|
||||
delete(options: AclOptions): Promise<[Acl, ApiResponse]>;
|
||||
get(options: AclOptions): Promise<[Acl, ApiResponse]>;
|
||||
update(options: AclOptions): Promise<[Acl, ApiResponse]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An object of convenience methods to add or delete reader ACL permissions for a given entity.
|
||||
*/
|
||||
interface AclEntity extends AclActions {
|
||||
addAllAuthenticatedUsers(): Promise<[Acl, ApiResponse]>;
|
||||
addAllUsers(): Promise<[Acl, ApiResponse]>;
|
||||
addDomain(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
addGroup(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
addProject(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
addUser(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
deleteAllAuthenticatedUsers(): Promise<[Acl, ApiResponse]>;
|
||||
deleteAllUsers(): Promise<[Acl, ApiResponse]>;
|
||||
deleteDomain(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
deleteGroup(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
deleteProject(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
deleteUser(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* ACL options.
|
||||
*/
|
||||
interface AclOptions {
|
||||
entity?: string;
|
||||
role?: string;
|
||||
generation?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The response object.
|
||||
*/
|
||||
interface ApiResponse {
|
||||
etag?: string;
|
||||
id?: string;
|
||||
kind?: string;
|
||||
location?: string;
|
||||
metageneration?: string;
|
||||
name?: string;
|
||||
projectNumber?: string;
|
||||
selfLink?: string;
|
||||
storageClass?: string;
|
||||
timeCreated?: string;
|
||||
updated?: string;
|
||||
}
|
||||
|
||||
interface Credentials {
|
||||
client_email?: string;
|
||||
private_key?: string;
|
||||
}
|
||||
|
||||
interface ConfigurationObject {
|
||||
autoRetry?: boolean;
|
||||
credentials?: Credentials;
|
||||
email?: string;
|
||||
keyFilename?: string;
|
||||
maxRetries?: number;
|
||||
projectId?: string;
|
||||
promise?: PromiseLibrary<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The options when downloading a file.
|
||||
*/
|
||||
interface DownloadOptions extends ReadStreamOptions {
|
||||
destination?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when reading a file stream.
|
||||
*/
|
||||
interface ReadStreamOptions {
|
||||
end?: number;
|
||||
start?: number;
|
||||
validation?: string | boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when uploading file to bucket.
|
||||
*/
|
||||
interface UploadOptions extends WriteStreamOptions {
|
||||
destination?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when writing to a file stream.
|
||||
*/
|
||||
interface WriteStreamOptions {
|
||||
gzip?: boolean;
|
||||
metadata?: FileMetadata;
|
||||
offset?: number;
|
||||
predefinedAcl?: string;
|
||||
private?: boolean;
|
||||
public?: boolean;
|
||||
resumable?: boolean;
|
||||
uri?: string;
|
||||
validation?: string | boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Storage class allows you interact with Google Cloud Storage.
|
||||
*/
|
||||
class Storage {
|
||||
constructor(config?: ConfigurationObject);
|
||||
acl: Acl;
|
||||
bucket(name: string | Bucket): Bucket;
|
||||
channel(id: string, resourceId: string): Channel;
|
||||
createBucket(name: string, metadata?: BucketConfig): Promise<[Bucket, ApiResponse]>;
|
||||
getBuckets(query?: BucketQuery): Promise<[Bucket[]]>;
|
||||
getBucketsStream(query?: BucketQuery): Promise<[ReadStream]>;
|
||||
Channel: (storage: Storage, id: string, resourceId: string) => Channel;
|
||||
File: (bucket: Bucket, name: string, opts: BucketFileOptions) => File;
|
||||
Bucket: (storage: Storage, name: string) => Bucket;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class allows you interact with Google Cloud Storage.
|
||||
*/
|
||||
class Channel {
|
||||
constructor(storage: Storage, id: string, resourceId: string);
|
||||
stop(): Promise<[Storage.ApiResponse]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel configuration.
|
||||
*/
|
||||
interface ChannelConfig {
|
||||
address: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare function Storage(config?: Storage.ConfigurationObject): Storage.Storage;
|
||||
|
||||
export = Storage;
|
||||
|
||||
-136
@@ -1,136 +0,0 @@
|
||||
import { ReadStream } from "fs";
|
||||
import { Bucket, BucketConfig, BucketQuery } from "./bucket";
|
||||
import { Channel } from "./channel";
|
||||
import { FileMetadata } from "./file";
|
||||
|
||||
/**
|
||||
* Access control list for storage buckets and files.
|
||||
*/
|
||||
export class Acl extends AclActions {
|
||||
default: AclEntity;
|
||||
owners: AclEntity;
|
||||
readers: AclEntity;
|
||||
writers: AclEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Actions that can be performed on all ACL entities, including the root Acl.
|
||||
*/
|
||||
export class AclActions {
|
||||
add(options: AclOptions): Promise<[Acl, ApiResponse]>;
|
||||
delete(options: AclOptions): Promise<[Acl, ApiResponse]>;
|
||||
get(options: AclOptions): Promise<[Acl, ApiResponse]>;
|
||||
update(options: AclOptions): Promise<[Acl, ApiResponse]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An object of convenience methods to add or delete reader ACL permissions for a given entity.
|
||||
*/
|
||||
export class AclEntity extends AclActions {
|
||||
addAllAuthenticatedUsers(): Promise<[Acl, ApiResponse]>;
|
||||
addAllUsers(): Promise<[Acl, ApiResponse]>;
|
||||
addDomain(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
addGroup(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
addProject(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
addUser(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
deleteAllAuthenticatedUsers(): Promise<[Acl, ApiResponse]>;
|
||||
deleteAllUsers(): Promise<[Acl, ApiResponse]>;
|
||||
deleteDomain(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
deleteGroup(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
deleteProject(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
deleteUser(entity: string): Promise<[Acl, ApiResponse]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* ACL options.
|
||||
*/
|
||||
export interface AclOptions {
|
||||
entity?: string;
|
||||
role?: string;
|
||||
generation?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The response object.
|
||||
*/
|
||||
export interface ApiResponse {
|
||||
etag?: string;
|
||||
id?: string;
|
||||
kind?: string;
|
||||
location?: string;
|
||||
metageneration?: string;
|
||||
name?: string;
|
||||
projectNumber?: string;
|
||||
selfLink?: string;
|
||||
storageClass?: string;
|
||||
timeCreated?: string;
|
||||
updated?: string;
|
||||
}
|
||||
|
||||
export interface Credentials {
|
||||
client_email?: string;
|
||||
private_key?: string;
|
||||
}
|
||||
|
||||
export interface ConfigurationObject {
|
||||
autoRetry?: boolean;
|
||||
credentials?: Credentials;
|
||||
email?: string;
|
||||
keyFilename?: string;
|
||||
maxRetries?: number;
|
||||
projectId?: string;
|
||||
promise?: PromiseLibrary<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The options when downloading a file.
|
||||
*/
|
||||
export interface DownloadOptions extends ReadStreamOptions {
|
||||
destination?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when reading a file stream.
|
||||
*/
|
||||
export interface ReadStreamOptions {
|
||||
end?: number;
|
||||
start?: number;
|
||||
validation?: string | boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when uploading file to bucket.
|
||||
*/
|
||||
export interface UploadOptions extends WriteStreamOptions {
|
||||
destination?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when writing to a file stream.
|
||||
*/
|
||||
export interface WriteStreamOptions {
|
||||
gzip?: boolean;
|
||||
metadata?: FileMetadata;
|
||||
offset?: number;
|
||||
predefinedAcl?: string;
|
||||
private?: boolean;
|
||||
public?: boolean;
|
||||
resumable?: boolean;
|
||||
uri?: string;
|
||||
validation?: string | boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Storage class allows you interact with Google Cloud Storage.
|
||||
*/
|
||||
export class Storage {
|
||||
constructor(options?: ConfigurationObject);
|
||||
acl: Acl;
|
||||
bucket(name: string|Bucket): Bucket;
|
||||
channel(id: string, resourceId: string): Channel;
|
||||
createBucket(name: string, metadata?: BucketConfig): Promise<[Bucket, ApiResponse]>;
|
||||
getBuckets(query?: BucketQuery): Promise<[Bucket[]]>;
|
||||
getBucketsStream(query?: BucketQuery): Promise<[ReadStream]>;
|
||||
}
|
||||
|
||||
export type PromiseLibrary<T> = () => PromiseLike<T>;
|
||||
@@ -11,10 +11,10 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types" : [],
|
||||
"paths":{
|
||||
"@google-cloud/storage": ["google-cloud__storage"]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
@@ -22,4 +22,4 @@
|
||||
"index.d.ts",
|
||||
"google-cloud__storage-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -27,7 +27,7 @@ declare namespace got {
|
||||
(url: GotUrl, options: GotBodyOptions<string>): GotPromise<string>;
|
||||
(url: GotUrl, options: GotBodyOptions<null>): GotPromise<Buffer>;
|
||||
}
|
||||
// tslint:disable unified-signatures
|
||||
// tslint:enable unified-signatures
|
||||
|
||||
type GotStreamFn = (url: GotUrl, options?: GotOptions<string | null>) => GotEmitter & nodeStream.Duplex;
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import { src, dest } from 'gulp';
|
||||
import * as gulpModernizr from 'gulp-modernizr';
|
||||
|
||||
let s1 = gulpModernizr();
|
||||
let s2 = gulpModernizr('filename.js', {});
|
||||
let s3 = gulpModernizr({cache: false});
|
||||
|
||||
src('fixtures.js').pipe(s1).pipe(s2);
|
||||
Vendored
+79
@@ -0,0 +1,79 @@
|
||||
// Type definitions for gulp-modernizr 1.0
|
||||
// Project: https://github.com/doctyper/gulp-modernizr
|
||||
// Definitions by: remisery <https://github.com/remisery>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import stream = require('stream');
|
||||
|
||||
declare function GulpModernizr(parames?: GulpModernizr.Params): stream.Transform;
|
||||
declare function GulpModernizr(file?: string, parames?: GulpModernizr.Params): stream.Transform;
|
||||
|
||||
declare namespace GulpModernizr {
|
||||
interface Params {
|
||||
/**
|
||||
* Avoid unnecessary builds (see Caching section below)
|
||||
*/
|
||||
cache?: boolean;
|
||||
|
||||
/**
|
||||
* Path to the build you're using for development.
|
||||
*/
|
||||
devFile?: string | false;
|
||||
|
||||
/**
|
||||
* Path to save out the built file
|
||||
*/
|
||||
dest?: string | false;
|
||||
|
||||
/**
|
||||
* Based on default settings on http://modernizr.com/download/
|
||||
*/
|
||||
options?: {
|
||||
classPrefix: string;
|
||||
enableJSClass: boolean;
|
||||
enableClasses: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* By default, source is uglified before saving
|
||||
*/
|
||||
uglify?: boolean;
|
||||
|
||||
/**
|
||||
* Define any tests you want to explicitly include
|
||||
*/
|
||||
tests?: string[];
|
||||
|
||||
/**
|
||||
* Useful for excluding any tests that this tool will match
|
||||
* e.g. you use .notification class for notification elements,
|
||||
* but don’t want the test for Notification API
|
||||
*/
|
||||
excludeTests?: string[];
|
||||
|
||||
/**
|
||||
* By default, will crawl your project for references to Modernizr tests
|
||||
* Set to false to disable
|
||||
*/
|
||||
crawl?: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to pass in buffers via the "files" parameter below
|
||||
*/
|
||||
useBuffers?: boolean;
|
||||
|
||||
/**
|
||||
* By default, this task will crawl all *.js, *.css, *.scss files.
|
||||
*/
|
||||
files?: { src: string[] };
|
||||
|
||||
/**
|
||||
* Have custom Modernizr tests? Add them here.
|
||||
*/
|
||||
customTests?: string[];
|
||||
}
|
||||
}
|
||||
|
||||
export = GulpModernizr;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gulp-modernizr-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import * as mustache from "gulp-mustache";
|
||||
// noinspection ES6UnusedImports
|
||||
import { Transform } from "stream";
|
||||
|
||||
mustache({ // $ExpectType Transform
|
||||
msg: "Hello Gulp!"
|
||||
});
|
||||
|
||||
mustache({ // $ExpectType Transform
|
||||
msg: "Hello Gulp!",
|
||||
nested_value: "I am nested.",
|
||||
another_value: "1 2 3"
|
||||
}, {}, {
|
||||
some_inner_partial: "<p>{{nested_value}}</p>",
|
||||
another_partial: "<div>{{another_value}}</div>"
|
||||
});
|
||||
|
||||
mustache('your_json_file.json', {}, {}); // $ExpectType Transform
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for gulp-mustache v 3.0
|
||||
// Project: https://github.com/rogeriopvl/gulp-mustache
|
||||
// Definitions by: Christopher Durham <cad97@cad97.com>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Transform } from "stream";
|
||||
|
||||
declare namespace GulpMustache {
|
||||
type View = Hash | string | undefined;
|
||||
|
||||
interface Hash {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
extension?: string;
|
||||
tags?: ReadonlyArray<string> | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
declare function GulpMustache(view: GulpMustache.View,
|
||||
options?: GulpMustache.Options,
|
||||
partials?: GulpMustache.Hash): Transform;
|
||||
|
||||
export = GulpMustache;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gulp-mustache-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,8 @@
|
||||
import { src, dest } from 'gulp';
|
||||
import * as gulpPug from 'gulp-pug';
|
||||
|
||||
let s1 = gulpPug();
|
||||
let s2 = gulpPug({});
|
||||
let s3 = gulpPug({ basedir: '.' });
|
||||
|
||||
src('fixtures.js').pipe(s1).pipe(s2).pipe(s3);
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for gulp-pug 3.3
|
||||
// Project: https://github.com/pugjs/gulp-pug#readme
|
||||
// Definitions by: remisery <https://github.com/remisery>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import stream = require('stream');
|
||||
|
||||
import { Options } from 'pug';
|
||||
|
||||
declare function GulpPug(params?: GulpPug.Params): stream.Transform;
|
||||
|
||||
declare namespace GulpPug {
|
||||
interface Params extends Options {
|
||||
locals?: any;
|
||||
data?: any;
|
||||
client?: boolean;
|
||||
pug?: any;
|
||||
verbose?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = GulpPug;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gulp-pug-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -1,6 +1,3 @@
|
||||
|
||||
|
||||
|
||||
import * as gulp from 'gulp';
|
||||
import * as size from 'gulp-size';
|
||||
import * as debug from 'gulp-debug';
|
||||
@@ -11,9 +8,8 @@ gulp.task('default', () =>
|
||||
.pipe(gulp.dest('dist'))
|
||||
);
|
||||
|
||||
|
||||
gulp.task('default', () => {
|
||||
var s = size();
|
||||
let s = size();
|
||||
|
||||
return gulp.src('fixture.js')
|
||||
.pipe(s)
|
||||
@@ -21,6 +17,5 @@ gulp.task('default', () => {
|
||||
.pipe(debug({title: 'Total size ' + s.prettySize}));
|
||||
});
|
||||
|
||||
|
||||
size();
|
||||
size({showFiles: true, gzip: true});
|
||||
|
||||
Vendored
+4
-2
@@ -1,16 +1,18 @@
|
||||
// Type definitions for gulp-size v1.2.3
|
||||
// Type definitions for gulp-size 2.1
|
||||
// Project: https://github.com/sindresorhus/gulp-size
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Remisery <https://github.com/remisery>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
declare namespace size {
|
||||
interface Options {
|
||||
showFiles?: boolean;
|
||||
gzip?: boolean;
|
||||
title?: string;
|
||||
pretty?: boolean;
|
||||
showTotal?: boolean;
|
||||
}
|
||||
|
||||
interface SizeStream extends NodeJS.ReadWriteStream {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -22,4 +22,4 @@
|
||||
"index.d.ts",
|
||||
"gulp-size-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
import * as UglifyJS from 'uglify-js';
|
||||
import * as GulpUglify from 'gulp-uglify';
|
||||
|
||||
interface Composer {
|
||||
(uglify: Uglify, log: Logger): typeof GulpUglify;
|
||||
}
|
||||
|
||||
interface Uglify {
|
||||
minify: typeof UglifyJS.minify;
|
||||
}
|
||||
|
||||
interface Logger {
|
||||
warn: typeof console.warn;
|
||||
}
|
||||
|
||||
declare const composer: Composer;
|
||||
|
||||
export = composer;
|
||||
@@ -1,17 +1,19 @@
|
||||
import * as gulp from 'gulp';
|
||||
import * as uglify from 'gulp-uglify';
|
||||
import pump = require('pump');
|
||||
import uglifyjs = require('uglify-js');
|
||||
import composer = require('gulp-uglify/composer');
|
||||
|
||||
gulp.task('compress', function() {
|
||||
var tsResult = gulp.src('lib/*.ts')
|
||||
gulp.task('compress', () => {
|
||||
const tsResult = gulp.src('lib/*.ts')
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('compress2', function() {
|
||||
var tsResult = gulp.src('lib/*.ts')
|
||||
gulp.task('compress2', () => {
|
||||
const tsResult = gulp.src('lib/*.ts')
|
||||
.pipe(uglify({
|
||||
mangle: false,
|
||||
preserveComments: "some",
|
||||
compress: false,
|
||||
output: {
|
||||
max_line_len: 300
|
||||
@@ -19,3 +21,34 @@ gulp.task('compress2', function() {
|
||||
}))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('compress', (cb) => {
|
||||
pump([
|
||||
gulp.src('lib/*.js'),
|
||||
uglify(),
|
||||
gulp.dest('dist')
|
||||
],
|
||||
cb
|
||||
);
|
||||
});
|
||||
|
||||
const minify = composer(uglifyjs, console);
|
||||
|
||||
gulp.task('compress', (cb) => {
|
||||
// the same options as described above
|
||||
const options = {};
|
||||
|
||||
pump([
|
||||
gulp.src('lib/*.js'),
|
||||
minify(options),
|
||||
gulp.dest('dist')
|
||||
],
|
||||
cb
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task('compress', () => {
|
||||
return gulp.src('lib/*.js')
|
||||
.pipe(minify())
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
Vendored
+2
-9
@@ -1,6 +1,7 @@
|
||||
// Type definitions for gulp-uglify
|
||||
// Type definitions for gulp-uglify 3.0
|
||||
// Project: https://github.com/terinjokes/gulp-uglify
|
||||
// Definitions by: Christopher Haws <https://github.com/ChristopherHaws/>
|
||||
// Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
@@ -23,14 +24,6 @@ declare namespace GulpUglify {
|
||||
* Pass an object to specify custom compressor options. Pass false to skip compression completely.
|
||||
*/
|
||||
compress?: UglifyJS.CompressorOptions | boolean;
|
||||
|
||||
/**
|
||||
* A convenience option for options.output.comments. Defaults to preserving no comments.
|
||||
* all - Preserve all comments in code blocks
|
||||
* some - Preserve comments that start with a bang (!) or include a Closure Compiler directive (@preserve, @license, @cc_on)
|
||||
* function - Specify your own comment preservation function. You will be passed the current node and the current comment and are expected to return either true or false.
|
||||
*/
|
||||
preserveComments?: string | ((node: any, comment: UglifyJS.Tokenizer) => boolean);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,20 +6,18 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"composer.d.ts",
|
||||
"gulp-uglify-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"callable-types": false
|
||||
}
|
||||
}
|
||||
Vendored
+16
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for helmet
|
||||
// Project: https://github.com/helmetjs/helmet
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, Evan Hahn <https://github.com/EvanHahn>
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, Evan Hahn <https://github.com/EvanHahn>, Elliot Blackburn <https://github.com/bluehatbrit>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import express = require('express');
|
||||
@@ -19,7 +19,8 @@ declare namespace helmet {
|
||||
ieNoOpen?: boolean,
|
||||
noCache?: boolean,
|
||||
noSniff?: boolean,
|
||||
xssFilter?: boolean | IHelmetXssFilterConfiguration
|
||||
xssFilter?: boolean | IHelmetXssFilterConfiguration,
|
||||
expectCt?: boolean | IHelmetExpectCtConfiguration,
|
||||
}
|
||||
|
||||
export interface IHelmetContentSecurityPolicyDirectiveFunction {
|
||||
@@ -96,6 +97,12 @@ declare namespace helmet {
|
||||
setOnOldIE?: boolean;
|
||||
}
|
||||
|
||||
export interface IHelmetExpectCtConfiguration {
|
||||
enforce?: boolean;
|
||||
maxAge?: number;
|
||||
reportUri?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Interface for helmet class.
|
||||
* @interface
|
||||
@@ -179,5 +186,12 @@ declare namespace helmet {
|
||||
* @return {RequestHandler} The Request handler.
|
||||
*/
|
||||
xssFilter(options?: IHelmetXssFilterConfiguration): express.RequestHandler;
|
||||
|
||||
/**
|
||||
* @summary Adds the "Expect-CT" header.
|
||||
* @param {helmet.IHelmetExpectCtConfiguration} options
|
||||
* @returns {e.RequestHandler}
|
||||
*/
|
||||
expectCt(options?: IHelmetExpectCtConfiguration): express.RequestHandler;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
@@ -1455,6 +1455,11 @@ declare namespace Highcharts {
|
||||
* @since 3.0.8
|
||||
*/
|
||||
drillup?(event: Event): void;
|
||||
/**
|
||||
* Fires after drilling up from all drilldown series.
|
||||
* @since 4.2.4
|
||||
*/
|
||||
drillupall?(event: Event): void;
|
||||
/**
|
||||
* Fires when the chart is finished loading. One parameter, event, is passed to the function. This contains common
|
||||
* event information based on jQuery or MooTools depending on which library is used as the base for Highcharts.
|
||||
|
||||
@@ -242,6 +242,7 @@ function test_ChartOptions() {
|
||||
click: () => { },
|
||||
drilldown: () => { },
|
||||
drillup: () => { },
|
||||
drillupall: () => { },
|
||||
load: () => { },
|
||||
redraw: () => { },
|
||||
selection: () => { }
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import * as express from 'express';
|
||||
import * as hpp from 'hpp';
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(hpp());
|
||||
|
||||
app.use(hpp({
|
||||
checkBody: true,
|
||||
checkBodyOnlyForContentType: 'urlencoded',
|
||||
checkQuery: true,
|
||||
whitelist: ['foo', 'bar']
|
||||
}));
|
||||
|
||||
app.use(hpp({
|
||||
whitelist: 'foobar'
|
||||
}));
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for hpp 0.2
|
||||
// Project: https://github.com/analog-nico/hpp
|
||||
// Definitions by: Michael Strobel <https://github.com/kryops>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as express from 'express';
|
||||
|
||||
declare namespace hpp {
|
||||
interface Options {
|
||||
checkBody?: boolean;
|
||||
checkBodyOnlyForContentType?: string;
|
||||
checkQuery?: boolean;
|
||||
whitelist?: string | string[];
|
||||
}
|
||||
}
|
||||
|
||||
declare function hpp(options?: hpp.Options): express.RequestHandler;
|
||||
|
||||
export = hpp;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user