mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Merge branch 'master' of https://github.com/adamzerella/DefinitelyTyped into types/mumath
This commit is contained in:
@@ -223,7 +223,7 @@ namespace adoneTests.system.process {
|
||||
});
|
||||
|
||||
ret.on("message", () => {});
|
||||
ret.stdout.pipe(adone.fs.createWriteStream(__filename));
|
||||
ret.stdout!.pipe(adone.fs.createWriteStream(__filename));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -811,7 +811,7 @@ namespace adoneTests.system.process {
|
||||
});
|
||||
|
||||
ret.on("message", () => {});
|
||||
ret.stdout.pipe(adone.fs.createWriteStream(__filename));
|
||||
ret.stdout!.pipe(adone.fs.createWriteStream(__filename));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for autoprefixer 9.1
|
||||
// Type definitions for autoprefixer 9.4
|
||||
// Project: https://github.com/postcss/autoprefixer
|
||||
// Definitions by: Armando Meziat <https://github.com/odnamrataizem>, murt <https://github.com/murt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -15,7 +15,7 @@ declare namespace autoprefixer {
|
||||
remove?: boolean;
|
||||
supports?: boolean;
|
||||
flexbox?: boolean | 'no-2009';
|
||||
grid?: boolean;
|
||||
grid?: boolean | 'autoplace' | 'no-autoplace';
|
||||
stats?: any;
|
||||
ignoreUnknownVersions?: boolean;
|
||||
}
|
||||
|
||||
Vendored
+45
-5
@@ -878,7 +878,7 @@ export class Buy implements Resource {
|
||||
/**
|
||||
* Associated transaction (e.g. a bank, fiat account)
|
||||
*/
|
||||
transaction: ResourceRef;
|
||||
transaction: ResourceRef | null;
|
||||
|
||||
/**
|
||||
* Amount in bitcoin, litecoin or ethereum
|
||||
@@ -896,7 +896,7 @@ export class Buy implements Resource {
|
||||
subtotal: MoneyHash;
|
||||
|
||||
/**
|
||||
* Fee associated to this buy
|
||||
* Fees associated to this buy
|
||||
*/
|
||||
fees: Fee[];
|
||||
|
||||
@@ -935,6 +935,26 @@ export class Buy implements Resource {
|
||||
*/
|
||||
requires_completion_step: boolean;
|
||||
|
||||
/**
|
||||
* Transfer identifier
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Reference code shown in user's dashboard.
|
||||
*/
|
||||
user_reference: string;
|
||||
|
||||
/**
|
||||
* ISO timestamp
|
||||
*/
|
||||
created_at: string;
|
||||
|
||||
/**
|
||||
* ISO timestamp
|
||||
*/
|
||||
updated_at: string;
|
||||
|
||||
/**
|
||||
* Completes a buy that is created in commit: false state.
|
||||
* If the exchange rate has changed since the buy was created, this call will fail with the error “The exchange rate updated while you
|
||||
@@ -995,7 +1015,7 @@ export class Sell implements Resource {
|
||||
/**
|
||||
* Associated transaction (e.g. a bank, fiat account)
|
||||
*/
|
||||
transaction: ResourceRef;
|
||||
transaction: ResourceRef | null;
|
||||
|
||||
/**
|
||||
* Amount in bitcoin, litecoin or ethereum
|
||||
@@ -1013,9 +1033,9 @@ export class Sell implements Resource {
|
||||
subtotal: MoneyHash;
|
||||
|
||||
/**
|
||||
* Fee associated to this sell
|
||||
* Fees associated to this sell
|
||||
*/
|
||||
fee: MoneyHash;
|
||||
fees: MoneyHash[];
|
||||
|
||||
/**
|
||||
* Has this sell been committed?
|
||||
@@ -1032,6 +1052,26 @@ export class Sell implements Resource {
|
||||
*/
|
||||
payout_at?: string;
|
||||
|
||||
/**
|
||||
* Transfer identifier
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Reference code shown in user's dashboard.
|
||||
*/
|
||||
user_reference: string;
|
||||
|
||||
/**
|
||||
* ISO timestamp
|
||||
*/
|
||||
created_at: string;
|
||||
|
||||
/**
|
||||
* ISO timestamp
|
||||
*/
|
||||
updated_at: string;
|
||||
|
||||
/**
|
||||
* Completes a sell that is created in commit: false state.
|
||||
* If the exchange rate has changed since the sell was created, this call will fail with the error “The exchange rate updated while you
|
||||
|
||||
@@ -511,6 +511,7 @@ consul = new Consul();
|
||||
// Consul.Health
|
||||
{
|
||||
let health: Consul.Health = consul.health;
|
||||
let name: string;
|
||||
|
||||
health = new HealthStatic(consul);
|
||||
consul = health.consul;
|
||||
|
||||
@@ -8,7 +8,7 @@ pw.on('error', (err: Error) => {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
const r1: Error = spawn.sync('foo').error;
|
||||
const r1: Error | undefined = spawn.sync('foo').error;
|
||||
const r2: string[] = spawn.sync('foo').output;
|
||||
const r3: Buffer = spawn.sync('foo').stdout;
|
||||
const r4: Buffer = spawn.sync('foo').stderr;
|
||||
|
||||
@@ -43,8 +43,8 @@ execa.shell('echo unicorns').then(result => result.stdout.toLocaleLowerCase());
|
||||
result = execa.shellSync('noop foo').stdout;
|
||||
}
|
||||
|
||||
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
|
||||
execa('echo', ['unicorns']).stderr.pipe(process.stderr);
|
||||
execa('echo', ['unicorns']).stdout!.pipe(process.stdout);
|
||||
execa('echo', ['unicorns']).stderr!.pipe(process.stderr);
|
||||
|
||||
execa('forever', { extendEnv: false }).pid;
|
||||
execa('forever', { argv0: 'hi' }).pid;
|
||||
@@ -85,7 +85,7 @@ async () => {
|
||||
|
||||
async () => {
|
||||
const child = execa('stdin');
|
||||
child.stdin.end('unicorns');
|
||||
child.stdin!.end('unicorns');
|
||||
const { stdout } = await child;
|
||||
assert(stdout === 'unicorns');
|
||||
};
|
||||
@@ -104,7 +104,7 @@ async () => {
|
||||
stdio: [null, 'ignore', null]
|
||||
});
|
||||
|
||||
child.stdout.setEncoding('utf8');
|
||||
child.stdout!.setEncoding('utf8');
|
||||
|
||||
assert(child.pid === 0);
|
||||
child.kill();
|
||||
|
||||
Vendored
+3
-2
@@ -3815,9 +3815,10 @@ export class Text extends Object {
|
||||
/**
|
||||
* measure a text line measuring all characters.
|
||||
* @param {Number} lineIndex line number
|
||||
* @return {Number} Line width
|
||||
* @return {Object} object.width total width of characters
|
||||
* @return {Object} object.numOfSpaces length of chars that match this._reSpacesAndTabs
|
||||
*/
|
||||
measureLine(lineIndex: number): number;
|
||||
measureLine(lineIndex: number): { width: number, numOfSpaces: number };
|
||||
/**
|
||||
* Calculate height of line at 'lineIndex'
|
||||
* @param {Number} lineIndex index of line to calculate
|
||||
|
||||
@@ -11,26 +11,26 @@ giphyApi({ apiKey: 'API KEY' });
|
||||
const searchOptions: giphyApi.SearchOptions = { q: 'pokemon', rating: 'g' };
|
||||
const giphy: giphyApi.Giphy = giphyApi();
|
||||
giphy.search('pokemon', cb);
|
||||
giphy.search('pokemon').then(res => {});
|
||||
giphy.search('pokemon').then(res => res.data[0]);
|
||||
giphy.search(searchOptions, cb);
|
||||
giphy.search({ q: 'pokemon', rating: 'g' }).then(res => {});
|
||||
giphy.search({ q: 'pokemon', rating: 'g' }).then(res => res.data[0]);
|
||||
|
||||
giphy.id('feqkVgjJpYtjy', cb);
|
||||
giphy.id('feqkVgjJpYtjy').then(res => {});
|
||||
giphy.id('feqkVgjJpYtjy').then(res => res.data[0]);
|
||||
giphy.id(['feqkVgjJpYtjy'], cb);
|
||||
giphy.id(['feqkVgjJpYtjy']).then(res => {});
|
||||
giphy.id(['feqkVgjJpYtjy']).then(res => res.data[0]);
|
||||
|
||||
giphy.translate('superman', cb);
|
||||
giphy.translate('superman').then(res => {});
|
||||
giphy.translate('superman').then(res => res.data.id);
|
||||
giphy.translate({ s: 'superman', rating: 'g', fmt: 'html' }, cb);
|
||||
giphy.translate({ s: 'superman', rating: 'g' }).then(res => {});
|
||||
giphy.translate({ s: 'superman', rating: 'g' }).then(res => res.data.id);
|
||||
|
||||
giphy.random('superman', cb);
|
||||
giphy.random('superman').then(res => {});
|
||||
giphy.random('superman').then(res => res.data.id);
|
||||
giphy.random({ tag: 'superman', rating: 'g' }, cb);
|
||||
giphy.random({ tag: 'superman', rating: 'g' }).then(res => {});
|
||||
giphy.random({ tag: 'superman', rating: 'g' }).then(res => res.data.id);
|
||||
|
||||
giphy.trending(cb);
|
||||
giphy.trending().then(res => {});
|
||||
giphy.trending().then(res => res.data[0]);
|
||||
giphy.trending({ limit: 2, rating: 'g' });
|
||||
giphy.trending({ limit: 2, rating: 'g' }).then(res => {});
|
||||
giphy.trending({ limit: 2, rating: 'g' }).then(res => res.data[0]);
|
||||
|
||||
Vendored
+132
-123
@@ -30,7 +30,16 @@ interface BaseImage {
|
||||
height: string;
|
||||
}
|
||||
|
||||
type Callback = (err: Error, res: giphyApi.Result) => void;
|
||||
interface BaseResponse {
|
||||
pagination: { total_count: number; count: number; offset: number };
|
||||
meta: {
|
||||
status: number;
|
||||
msg: string;
|
||||
response_id: string;
|
||||
};
|
||||
}
|
||||
|
||||
type Callback<TResponse> = (err: Error, res: TResponse) => void;
|
||||
|
||||
declare function giphyApi(apiKeyOrOptions?: string | giphyApi.GiphyOptions): giphyApi.Giphy;
|
||||
|
||||
@@ -48,131 +57,131 @@ declare namespace giphyApi {
|
||||
}
|
||||
|
||||
interface Giphy {
|
||||
search(queryOrOptions: string | SearchOptions, cb: Callback): void;
|
||||
search(queryOrOptions: string | SearchOptions): Promise<Result>;
|
||||
id(ids: string | string[], cb: Callback): void;
|
||||
id(ids: string | string[]): Promise<Result>;
|
||||
translate(termOrOptions: string | TranslateOptions, cb: Callback): void;
|
||||
translate(termOrOptions: string | TranslateOptions): Promise<Result>;
|
||||
random(tagOrOptions: string | RandomOptions, cb: Callback): void;
|
||||
random(tagOrOptions: string | RandomOptions): Promise<Result>;
|
||||
trending(options: TrendingOptions, cb: Callback): void;
|
||||
trending(cb: Callback): void;
|
||||
trending(options?: TrendingOptions): Promise<Result>;
|
||||
search(queryOrOptions: string | SearchOptions, cb: Callback<MultiResponse>): void;
|
||||
search(queryOrOptions: string | SearchOptions): Promise<MultiResponse>;
|
||||
id(ids: string | string[], cb: Callback<MultiResponse>): void;
|
||||
id(ids: string | string[]): Promise<MultiResponse>;
|
||||
translate(termOrOptions: string | TranslateOptions, cb: Callback<SingleResponse>): void;
|
||||
translate(termOrOptions: string | TranslateOptions): Promise<SingleResponse>;
|
||||
random(tagOrOptions: string | RandomOptions, cb: Callback<SingleResponse>): void;
|
||||
random(tagOrOptions: string | RandomOptions): Promise<SingleResponse>;
|
||||
trending(options: TrendingOptions, cb: Callback<MultiResponse>): void;
|
||||
trending(cb: Callback<MultiResponse>): void;
|
||||
trending(options?: TrendingOptions): Promise<MultiResponse>;
|
||||
}
|
||||
|
||||
interface Result {
|
||||
data: [
|
||||
{
|
||||
type: string;
|
||||
id: string;
|
||||
slug: string;
|
||||
url: string;
|
||||
bitly_url: string;
|
||||
embed_url: string;
|
||||
username: string;
|
||||
source: string;
|
||||
rating: Rating;
|
||||
content_url: string;
|
||||
user?: {
|
||||
avatar_url: string;
|
||||
banner_url: string;
|
||||
profile_url: string;
|
||||
username: string;
|
||||
display_name: string;
|
||||
twitter: string;
|
||||
},
|
||||
source_tld: string;
|
||||
source_post_url: string;
|
||||
update_datetime: string;
|
||||
create_datetime: string;
|
||||
import_datetime: string;
|
||||
trending_datetime: string;
|
||||
title: string;
|
||||
images: {
|
||||
fixed_height: BaseImage & {
|
||||
size: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
fixed_height_still: BaseImage;
|
||||
fixed_height_downsampled: BaseImage & {
|
||||
size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
fixed_width: BaseImage & {
|
||||
size: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
original_still: BaseImage;
|
||||
fixed_width_still: BaseImage;
|
||||
fixed_width_downsampled: BaseImage & {
|
||||
size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
fixed_height_small: BaseImage & {
|
||||
size: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
fixed_height_small_still: BaseImage;
|
||||
fixed_width_small: BaseImage & {
|
||||
size: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
fixed_width_small_still: BaseImage;
|
||||
downsized: BaseImage & {
|
||||
size: string;
|
||||
};
|
||||
downsized_still: BaseImage;
|
||||
downsized_large: BaseImage & {
|
||||
size: string;
|
||||
};
|
||||
downsized_medium: BaseImage & {
|
||||
size: string;
|
||||
};
|
||||
downsized_small: BaseImage & {
|
||||
size: string;
|
||||
};
|
||||
original: BaseImage & {
|
||||
size: string;
|
||||
frames: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
looping: { mp4: string; };
|
||||
preview: {
|
||||
width: string;
|
||||
height: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
};
|
||||
preview_gif: BaseImage & {
|
||||
size: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
pagination: { total_count: number; count: number; offset: number };
|
||||
meta: {
|
||||
status: number;
|
||||
msg: string;
|
||||
response_id: string;
|
||||
interface Images {
|
||||
fixed_height: BaseImage & {
|
||||
size: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
fixed_height_still: BaseImage;
|
||||
fixed_height_downsampled: BaseImage & {
|
||||
size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
fixed_width: BaseImage & {
|
||||
size: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
original_still: BaseImage;
|
||||
fixed_width_still: BaseImage;
|
||||
fixed_width_downsampled: BaseImage & {
|
||||
size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
fixed_height_small: BaseImage & {
|
||||
size: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
fixed_height_small_still: BaseImage;
|
||||
fixed_width_small: BaseImage & {
|
||||
size: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
fixed_width_small_still: BaseImage;
|
||||
downsized: BaseImage & {
|
||||
size: string;
|
||||
};
|
||||
downsized_still: BaseImage;
|
||||
downsized_large: BaseImage & {
|
||||
size: string;
|
||||
};
|
||||
downsized_medium: BaseImage & {
|
||||
size: string;
|
||||
};
|
||||
downsized_small: BaseImage & {
|
||||
size: string;
|
||||
};
|
||||
original: BaseImage & {
|
||||
size: string;
|
||||
frames: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
webp: string;
|
||||
webp_size: string;
|
||||
};
|
||||
looping: { mp4: string; };
|
||||
preview: {
|
||||
width: string;
|
||||
height: string;
|
||||
mp4: string;
|
||||
mp4_size: string;
|
||||
};
|
||||
preview_gif: BaseImage & {
|
||||
size: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface GIFObject {
|
||||
type: string;
|
||||
id: string;
|
||||
slug: string;
|
||||
url: string;
|
||||
bitly_url: string;
|
||||
embed_url: string;
|
||||
username: string;
|
||||
source: string;
|
||||
rating: Rating;
|
||||
content_url: string;
|
||||
user?: {
|
||||
avatar_url: string;
|
||||
banner_url: string;
|
||||
profile_url: string;
|
||||
username: string;
|
||||
display_name: string;
|
||||
twitter: string;
|
||||
};
|
||||
source_tld: string;
|
||||
source_post_url: string;
|
||||
update_datetime: string;
|
||||
create_datetime: string;
|
||||
import_datetime: string;
|
||||
trending_datetime: string;
|
||||
title: string;
|
||||
images: Images;
|
||||
}
|
||||
|
||||
interface MultiResponse extends BaseResponse {
|
||||
data: GIFObject[];
|
||||
}
|
||||
|
||||
interface SingleResponse extends BaseResponse {
|
||||
data: GIFObject;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Adds two number's.
|
||||
*/
|
||||
declare function add(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default add;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Get the angle between two 3D vectors.
|
||||
*/
|
||||
declare function angle(a: number[], b: number[]): number;
|
||||
|
||||
export default angle;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Creates a new number initialized with values from an existing vector.
|
||||
*/
|
||||
declare function clone(a: number[]): number[];
|
||||
|
||||
export default clone;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Copy the values from one number to another.
|
||||
*/
|
||||
declare function copy(out: number[], a: number[]): number[];
|
||||
|
||||
export default copy;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Creates a new, empty number.
|
||||
*/
|
||||
declare function create(): number[];
|
||||
|
||||
export default create;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Calculates the euclidian distance between two number's. Aliased as dist.
|
||||
*/
|
||||
declare function dist(a: number[], b: number[]): number;
|
||||
|
||||
export default dist;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Divides two number's. Aliased as div.
|
||||
*/
|
||||
declare function div(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default div;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Calculates the dot product of two number's.
|
||||
*/
|
||||
declare function dot(a: number[], b: number[]): number;
|
||||
|
||||
export default dot;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Returns whether or not the vectors have approximately the same elements in the same position..
|
||||
*/
|
||||
declare function equals(a: number[], b: number[]): boolean;
|
||||
|
||||
export default equals;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===).
|
||||
*/
|
||||
declare function exactEquals(a: number[], b: number[]): boolean;
|
||||
|
||||
export default exactEquals;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Perform some operation over an array of numbers.
|
||||
*/
|
||||
declare function forEach(a: number[], stride: number, offset: number, count: number, fn: (a: number[], b: number[], arg: object) => number[], arg: object): number[];
|
||||
|
||||
export default forEach;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Creates a new number initialized with the given values.
|
||||
*/
|
||||
declare function fromValues(x: number, y: number, z: number): number[];
|
||||
|
||||
export default fromValues;
|
||||
@@ -0,0 +1,121 @@
|
||||
import * as GlVec3 from "gl-vec3";
|
||||
import GLVec3Add from "gl-vec3/add";
|
||||
import GLVec3Angle from "gl-vec3/angle";
|
||||
import GLVec3Clone from "gl-vec3/clone";
|
||||
import GLVec3Copy from "gl-vec3/copy";
|
||||
import GLVec3Create from "gl-vec3/create";
|
||||
import GLVec3Dist from "gl-vec3/dist";
|
||||
import GLVec3Div from "gl-vec3/div";
|
||||
import GLVec3Dot from "gl-vec3/dot";
|
||||
import GLVec3Equals from "gl-vec3/equals";
|
||||
import GLVec3exactEquals from "gl-vec3/exactEquals";
|
||||
import GLVec3forEach from "gl-vec3/forEach";
|
||||
import GLVec3fromValues from "gl-vec3/fromValues";
|
||||
import GLVec3Inverse from "gl-vec3/inverse";
|
||||
import GLVec3Len from "gl-vec3/len";
|
||||
import GLVec3Lerp from "gl-vec3/lerp";
|
||||
import GLVec3Max from "gl-vec3/max";
|
||||
import GLVec3Min from "gl-vec3/min";
|
||||
import GLVec3Mul from "gl-vec3/mul";
|
||||
import GLVec3Negate from "gl-vec3/negate";
|
||||
import GLVec3Normalize from "gl-vec3/normalize";
|
||||
import GLVec3Random from "gl-vec3/random";
|
||||
import GLVec3Scale from "gl-vec3/scale";
|
||||
import GLVec3ScaleAndAdd from "gl-vec3/scaleAndAdd";
|
||||
import GLVec3Set from "gl-vec3/set";
|
||||
import GLVec3SqrDist from "gl-vec3/sqrDist";
|
||||
import GLVec3SqrLen from "gl-vec3/sqrLen";
|
||||
import GLVec3Sub from "gl-vec3/sub";
|
||||
import GLVec3TransformMat3 from "gl-vec3/transformMat3";
|
||||
import GLVec3TransformMat4 from "gl-vec3/transformMat4";
|
||||
import GLVec3TransformQuat from "gl-vec3/transformQuat";
|
||||
|
||||
GlVec3.add([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Add([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.angle([1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Angle([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.clone([1, 2, 3]);
|
||||
GLVec3Clone([1, 2, 3]);
|
||||
|
||||
GlVec3.copy([1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Copy([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.create();
|
||||
GLVec3Create();
|
||||
|
||||
GlVec3.dist([1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Dist([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.div([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Div([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.dot([1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Dot([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.forEach([1, 2, 3], 5, 6, 1, () => [3], {});
|
||||
GLVec3forEach([1, 2, 3], 5, 6, 1, () => [3], {});
|
||||
|
||||
GlVec3.fromValues(1, 2, 3);
|
||||
GLVec3fromValues(1, 2, 3);
|
||||
|
||||
GlVec3.equals([1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Equals([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.exactEquals([1, 2, 3], [1, 2, 3]);
|
||||
GLVec3exactEquals([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.inverse([1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Inverse([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.len([1, 2, 3]);
|
||||
GLVec3Len([1, 2, 3]);
|
||||
|
||||
GlVec3.lerp([1, 2, 3], [1, 2, 3], [1, 2, 3], 6);
|
||||
GLVec3Lerp([1, 2, 3], [1, 2, 3], [1, 2, 3], 6);
|
||||
|
||||
GlVec3.max([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Max([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.min([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Min([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.mul([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Mul([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.negate([1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Negate([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.normalize([1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Normalize([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.random([1, 2, 3], 6);
|
||||
GLVec3Random([1, 2, 3], 6);
|
||||
|
||||
GlVec3.scale([1, 2, 3], [1, 2, 3], 6);
|
||||
GLVec3Scale([1, 2, 3], [1, 2, 3], 6);
|
||||
|
||||
GlVec3.scaleAndAdd([1, 2, 3], [1, 2, 3], [1, 2, 3], 6);
|
||||
GLVec3ScaleAndAdd([1, 2, 3], [1, 2, 3], [1, 2, 3], 6);
|
||||
|
||||
GlVec3.set([1, 2, 3], 1, 2, 6);
|
||||
GLVec3Set([1, 2, 3], 1, 2, 6);
|
||||
|
||||
GlVec3.sqrDist([1, 2, 3], [1, 2, 3]);
|
||||
GLVec3SqrDist([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.sqrLen([1, 2, 3]);
|
||||
GLVec3SqrLen([1, 2, 3]);
|
||||
|
||||
GlVec3.sub([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
GLVec3Sub([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.transformMat3([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
GLVec3TransformMat3([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.transformMat4([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
GLVec3TransformMat4([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
GlVec3.transformQuat([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
GLVec3TransformQuat([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
Vendored
+190
@@ -0,0 +1,190 @@
|
||||
// Type definitions for gl-vec3 1.1
|
||||
// Project: https://github.com/stackgl/gl-vec3
|
||||
// Definitions by: Adam Zerella <https://github.com/adamzerella>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.3
|
||||
|
||||
/**
|
||||
* Adds two number's.
|
||||
*/
|
||||
export function add(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Get the angle between two 3D vectors.
|
||||
*/
|
||||
export function angle(a: number[], b: number[]): number;
|
||||
|
||||
/**
|
||||
* Creates a new number initialized with values from an existing vector.
|
||||
*/
|
||||
export function clone(a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Math.ceil the components of a number.
|
||||
*/
|
||||
export function ceil(out: number[], a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Copy the values from one number to another.
|
||||
*/
|
||||
export function copy(out: number[], a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Creates a new, empty number.
|
||||
*/
|
||||
export function create(): number[];
|
||||
|
||||
/**
|
||||
* Computes the cross product of two number's.
|
||||
*/
|
||||
export function cross(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Calculates the euclidian distance between two number's. Aliased as dist.
|
||||
*/
|
||||
export function dist(a: number[], b: number[]): number;
|
||||
|
||||
/**
|
||||
* Divides two number's. Aliased as div.
|
||||
*/
|
||||
export function div(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Calculates the dot product of two number's.
|
||||
*/
|
||||
export function dot(a: number[], b: number[]): number;
|
||||
|
||||
/**
|
||||
* Returns whether or not the vectors have approximately the same elements in the same position..
|
||||
*/
|
||||
export function equals(a: number[], b: number[]): boolean;
|
||||
|
||||
/**
|
||||
* Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===).
|
||||
*/
|
||||
export function exactEquals(a: number[], b: number[]): boolean;
|
||||
|
||||
/**
|
||||
* Math.floor the components of a number.
|
||||
*/
|
||||
export function floor(out: number[], a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Perform some operation over an array of numbers.
|
||||
*/
|
||||
export function forEach(a: number[], stride: number, offset: number, count: number, fn: (a: number[], b: number[], arg: object) => number[], arg: object): number[];
|
||||
|
||||
/**
|
||||
* Creates a new number initialized with the given values.
|
||||
*/
|
||||
export function fromValues(x: number, y: number, z: number): number[];
|
||||
|
||||
/**
|
||||
* Returns the inverse of the components of a number.
|
||||
*/
|
||||
export function inverse(out: number[], a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Calculates the length of a number. Aliased as len.
|
||||
*/
|
||||
export function len(a: number[]): number;
|
||||
|
||||
/**
|
||||
* Performs a linear interpolation between two number]'s.
|
||||
*/
|
||||
export function lerp(out: number[], a: number[], b: number[], t: number): number[];
|
||||
|
||||
/**
|
||||
* Returns the maximum of two number's.
|
||||
*/
|
||||
export function max(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Returns the minimum of two number's.
|
||||
*/
|
||||
export function min(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Multiplies two number's. Aliased as mul.
|
||||
*/
|
||||
export function mul(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Negates the components of a number.
|
||||
*/
|
||||
export function negate(out: number[], a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Normalize a number
|
||||
*/
|
||||
export function normalize(out: number[], a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Generates a random vector with the given scale.
|
||||
*/
|
||||
export function random(out: number[], scale: number): number[];
|
||||
|
||||
/**
|
||||
* Rotate a 3D vector around the x-axis.
|
||||
*/
|
||||
export function rotateX(out: number[], a: number[], b: number[], c: number): number[];
|
||||
|
||||
/**
|
||||
* Rotate a 3D vector around the y-axis.
|
||||
*/
|
||||
export function rotateY(out: number[], a: number[], b: number[], c: number): number[];
|
||||
|
||||
/**
|
||||
* Rotate a 3D vector around the z-axis.
|
||||
*/
|
||||
export function rotateZ(out: number[], a: number[], b: number[], c: number): number[];
|
||||
|
||||
/**
|
||||
* Math.round the components of a number.
|
||||
*/
|
||||
export function round(out: number[], a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Scales a number by a scalar number.
|
||||
*/
|
||||
export function scale(out: number[], a: number[], b: number): number[];
|
||||
|
||||
/**
|
||||
* Adds two numbers after scaling the second operand by a scalar value.
|
||||
*/
|
||||
export function scaleAndAdd(out: number[], a: number[], b: number[], scale: number): number[];
|
||||
|
||||
/**
|
||||
* Set the components of a number to the given values.
|
||||
*/
|
||||
export function set(out: number[], x: number, y: number, z: number): number[];
|
||||
|
||||
/**
|
||||
* Calculates the squared euclidian distance between two number's. Aliased as sqrDist.
|
||||
*/
|
||||
export function sqrDist(a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Calculates the squared length of a number. Aliased as sqrLen.
|
||||
*/
|
||||
export function sqrLen(a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Subtracts vector b from vector a. Aliased as sub.
|
||||
*/
|
||||
export function sub(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Transforms the number with a mat3.
|
||||
*/
|
||||
export function transformMat3(out: number[], a: number[], m: number[]): number[];
|
||||
|
||||
/**
|
||||
* Transforms the number with a mat4. 4th vector component is implicitly '1'.
|
||||
*/
|
||||
export function transformMat4(out: number[], a: number[], m: number[]): number[];
|
||||
|
||||
/**
|
||||
* Transforms the number with a quat.
|
||||
*/
|
||||
export function transformQuat(out: number[], a: number[], q: number[]): number[];
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Returns the inverse of the components of a number.
|
||||
*/
|
||||
declare function inverse(out: number[], a: number[]): number[];
|
||||
|
||||
export default inverse;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Calculates the length of a number. Aliased as len.
|
||||
*/
|
||||
declare function len(a: number[]): number;
|
||||
|
||||
export default len;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Performs a linear interpolation between two number]'s.
|
||||
*/
|
||||
declare function lerp(out: number[], a: number[], b: number[], t: number): number[];
|
||||
|
||||
export default lerp;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Returns the maximum of two number's.
|
||||
*/
|
||||
declare function max(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default max;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Returns the minimum of two number's.
|
||||
*/
|
||||
declare function min(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default min;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Multiplies two number's. Aliased as mul.
|
||||
*/
|
||||
declare function mul(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default mul;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Negates the components of a number.
|
||||
*/
|
||||
declare function negate(out: number[], a: number[]): number[];
|
||||
|
||||
export default negate;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Normalize a number
|
||||
*/
|
||||
declare function normalize(out: number[], a: number[]): number[];
|
||||
|
||||
export default normalize;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Generates a random vector with the given scale.
|
||||
*/
|
||||
declare function random(out: number[], scale: number): number[];
|
||||
|
||||
export default random;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Scales a number by a scalar number.
|
||||
*/
|
||||
declare function scale(out: number[], a: number[], b: number): number[];
|
||||
|
||||
export default scale;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Adds two numbers after scaling the second operand by a scalar value.
|
||||
*/
|
||||
declare function scaleAndAdd(out: number[], a: number[], b: number[], scale: number): number[];
|
||||
|
||||
export default scaleAndAdd;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Set the components of a number to the given values.
|
||||
*/
|
||||
declare function set(out: number[], x: number, y: number, z: number): number[];
|
||||
|
||||
export default set;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Calculates the squared euclidian distance between two number's. Aliased as sqrDist.
|
||||
*/
|
||||
declare function sqrDist(a: number[], b: number[]): number[];
|
||||
|
||||
export default sqrDist;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Calculates the squared length of a number. Aliased as sqrLen.
|
||||
*/
|
||||
declare function sqrLen(a: number[]): number[];
|
||||
|
||||
export default sqrLen;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Subtracts vector b from vector a. Aliased as sub.
|
||||
*/
|
||||
declare function sub(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default sub;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Transforms the number with a mat3.
|
||||
*/
|
||||
declare function transformMat3(out: number[], a: number[], m: number[]): number[];
|
||||
|
||||
export default transformMat3;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Transforms the number with a mat4. 4th vector component is implicitly '1'.
|
||||
*/
|
||||
declare function transformMat4(out: number[], a: number[], m: number[]): number[];
|
||||
|
||||
export default transformMat4;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Transforms the number with a quat.
|
||||
*/
|
||||
declare function transformQuat(out: number[], a: number[], q: number[]): number[];
|
||||
|
||||
export default transformQuat;
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [
|
||||
|
||||
],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angle.d.ts",
|
||||
"add.d.ts",
|
||||
"clone.d.ts",
|
||||
"copy.d.ts",
|
||||
"create.d.ts",
|
||||
"dist.d.ts",
|
||||
"div.d.ts",
|
||||
"dot.d.ts",
|
||||
"equals.d.ts",
|
||||
"exactEquals.d.ts",
|
||||
"forEach.d.ts",
|
||||
"fromValues.d.ts",
|
||||
"inverse.d.ts",
|
||||
"len.d.ts",
|
||||
"lerp.d.ts",
|
||||
"max.d.ts",
|
||||
"min.d.ts",
|
||||
"mul.d.ts",
|
||||
"negate.d.ts",
|
||||
"normalize.d.ts",
|
||||
"random.d.ts",
|
||||
"scale.d.ts",
|
||||
"scaleAndAdd.d.ts",
|
||||
"set.d.ts",
|
||||
"sqrDist.d.ts",
|
||||
"sqrLen.d.ts",
|
||||
"sub.d.ts",
|
||||
"transformMat3.d.ts",
|
||||
"transformMat4.d.ts",
|
||||
"transformQuat.d.ts",
|
||||
"gl-vec3-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Adds two vec4's.
|
||||
*/
|
||||
declare function add(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default add;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Creates a new vec4 initialized with values from an existing vector.
|
||||
*/
|
||||
declare function clone(a: number[]): number[];
|
||||
|
||||
export default clone;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Copy the values from one vec4 to another.
|
||||
*/
|
||||
declare function copy(out: number[], a: number[]): number[];
|
||||
|
||||
export default copy;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Creates a new, empty vec4.
|
||||
*/
|
||||
declare function create(): number[];
|
||||
|
||||
export default create;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Calculates the euclidian distance between two vec4's.
|
||||
*/
|
||||
declare function distance(a: number[], b: number[]): number;
|
||||
|
||||
export default distance;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Divides two vec4's.
|
||||
*/
|
||||
declare function divide(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default divide;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Calculates the dot product of two vec4's.
|
||||
*/
|
||||
declare function dot(a: number[], b: number[]): number;
|
||||
|
||||
export default dot;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Creates a new vec4 initialized with the given values.
|
||||
*/
|
||||
declare function fromValues(x: number, y: number, z: number, w: number): number[];
|
||||
|
||||
export default fromValues;
|
||||
@@ -0,0 +1,102 @@
|
||||
import * as glVec from "gl-vec4";
|
||||
|
||||
import glVecAdd from "gl-vec4/add";
|
||||
import glVecClone from "gl-vec4/clone";
|
||||
import glVecCopy from "gl-vec4/copy";
|
||||
import glVecCreate from "gl-vec4/create";
|
||||
import glVecDistance from "gl-vec4/distance";
|
||||
import glVecDivide from "gl-vec4/divide";
|
||||
import glVecDot from "gl-vec4/dot";
|
||||
import glVecFromValues from "gl-vec4/fromValues";
|
||||
import glVecInverse from "gl-vec4/inverse";
|
||||
import glVecLength from "gl-vec4/length";
|
||||
import glVecLerp from "gl-vec4/lerp";
|
||||
import glVecMax from "gl-vec4/max";
|
||||
import glVecMin from "gl-vec4/min";
|
||||
import glVecMultiply from "gl-vec4/multiply";
|
||||
import glVecNegate from "gl-vec4/negate";
|
||||
import glVecNormalize from "gl-vec4/normalize";
|
||||
import glVecRandom from "gl-vec4/random";
|
||||
import glVecScale from "gl-vec4/scale";
|
||||
import glVecScaleAndAdd from "gl-vec4/scaleAndAdd";
|
||||
import glVecSet from "gl-vec4/set";
|
||||
import glVecSqrdDistance from "gl-vec4/squaredDistance";
|
||||
import glVecSqrdLength from "gl-vec4/squaredLength";
|
||||
import glVecSubtract from "gl-vec4/subtract";
|
||||
import glVecTransformMat4 from "gl-vec4/transformMat4";
|
||||
import glVecTransformQuat from "gl-vec4/transformQuat";
|
||||
|
||||
glVec.add([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
glVecAdd([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.clone([1, 2, 3]);
|
||||
glVecClone([1, 2, 3]);
|
||||
|
||||
glVec.copy([1, 2, 3], [1, 2, 3]);
|
||||
glVecCopy([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.create();
|
||||
glVecCreate();
|
||||
|
||||
glVec.distance([1, 2, 3], [1, 2, 3]);
|
||||
glVecDistance([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.divide([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
glVecDivide([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.dot([1, 2, 3], [1, 2, 3]);
|
||||
glVecDot([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.fromValues(1, 2, 4, 5);
|
||||
glVecFromValues(1, 2, 4, 5);
|
||||
|
||||
glVec.inverse([1, 2, 3], [1, 2, 3]);
|
||||
glVecInverse([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.length([1, 2, 3]);
|
||||
glVecLength([1, 2, 3]);
|
||||
|
||||
glVec.lerp([1, 2, 3], [1, 2, 3], [1, 2, 3], 6);
|
||||
glVecLerp([1, 2, 3], [1, 2, 3], [1, 2, 3], 6);
|
||||
|
||||
glVec.max([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
glVecMax([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.min([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
glVecMin([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.multiply([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
glVecMultiply([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.negate([1, 2, 3], [1, 2, 3]);
|
||||
glVecNegate([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.normalize([1, 2, 3], [1, 2, 3]);
|
||||
glVecNormalize([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.random([1, 2, 3], 6);
|
||||
glVecRandom([1, 2, 3], 6);
|
||||
|
||||
glVec.scale([1, 2, 3], [1, 2, 3], 6);
|
||||
glVecScale([1, 2, 3], [1, 2, 3], 6);
|
||||
|
||||
glVec.scaleAndAdd([1, 2, 3], [1, 2, 3], [1, 2, 3], 6);
|
||||
glVecScaleAndAdd([1, 2, 3], [1, 2, 3], [1, 2, 3], 6);
|
||||
|
||||
glVec.set([1, 2, 3], [1, 2, 3], [1, 2, 3], 6, 6);
|
||||
glVecSet([1, 2, 3], [1, 2, 3], [1, 2, 3], 6, 6);
|
||||
|
||||
glVec.squaredDistance([1, 2, 3], [1, 2, 3]);
|
||||
glVecSqrdDistance([1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.squaredLength([1, 2, 3]);
|
||||
glVecSqrdLength([1, 2, 3]);
|
||||
|
||||
glVec.subtract([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
glVecSubtract([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.transformMat4([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
glVecTransformMat4([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
|
||||
glVec.transformQuat([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
glVecTransformQuat([1, 2, 3], [1, 2, 3], [1, 2, 3]);
|
||||
Vendored
+129
@@ -0,0 +1,129 @@
|
||||
// Type definitions for gl-vec4 1.0
|
||||
// Project: https://github.com/stackgl/gl-vec4
|
||||
// Definitions by: Adam Zerella <https://github.com/adamzerella>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Adds two vec4's.
|
||||
*/
|
||||
export function add(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Creates a new vec4 initialized with values from an existing vector.
|
||||
*/
|
||||
export function clone(a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Copy the values from one vec4 to another.
|
||||
*/
|
||||
export function copy(out: number[], a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Creates a new, empty vec4.
|
||||
*/
|
||||
export function create(): number[];
|
||||
|
||||
/**
|
||||
* Calculates the euclidian distance between two vec4's.
|
||||
*/
|
||||
export function distance(a: number[], b: number[]): number;
|
||||
|
||||
/**
|
||||
* Divides two vec4's.
|
||||
*/
|
||||
export function divide(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Calculates the dot product of two vec4's.
|
||||
*/
|
||||
export function dot(a: number[], b: number[]): number;
|
||||
|
||||
/**
|
||||
* Creates a new vec4 initialized with the given values.
|
||||
*/
|
||||
export function fromValues(x: number, y: number, z: number, w: number): number[];
|
||||
|
||||
/**
|
||||
* Returns the inverse of the components of a vec4.
|
||||
*/
|
||||
export function inverse(out: number[], a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Calculates the length of a vec4.
|
||||
*/
|
||||
export function length(a: number[]): number;
|
||||
|
||||
/**
|
||||
* Performs a linear interpolation between two vec4's.
|
||||
*/
|
||||
export function lerp(out: number[], a: number[], b: number[], t: number): number[];
|
||||
|
||||
/**
|
||||
* Returns the maximum of two vec4's.
|
||||
*/
|
||||
export function max(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Returns the minimum of two vec4's.
|
||||
*/
|
||||
export function min(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Multiplies two vec4's.
|
||||
*/
|
||||
export function multiply(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Negates the components of a vec4.
|
||||
*/
|
||||
export function negate(out: number[], a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Normalize a vec4.
|
||||
*/
|
||||
export function normalize(out: number[], a: number[]): number[];
|
||||
|
||||
/**
|
||||
* Generates a random vector with the given scale.
|
||||
*/
|
||||
export function random(out: number[], scale: number): number[];
|
||||
|
||||
/**
|
||||
* Scales a vec4 by a scalar number.
|
||||
*/
|
||||
export function scale(out: number[], a: number[], b: number): number[];
|
||||
|
||||
/**
|
||||
* Adds two vec4's after scaling the second operand by a scalar value.
|
||||
*/
|
||||
export function scaleAndAdd(out: number[], a: number[], b: number[], scale: number): number[];
|
||||
|
||||
/**
|
||||
* Set the components of a vec4 to the given values.
|
||||
*/
|
||||
export function set(out: number[], x: number[], y: number[], z: number, w: number): number[];
|
||||
|
||||
/**
|
||||
* Calculates the squared euclidian distance between two vec4's.
|
||||
*/
|
||||
export function squaredDistance(a: number[], b: number[]): number;
|
||||
|
||||
/**
|
||||
* Calculates the squared length of a vec4.
|
||||
*/
|
||||
export function squaredLength(a: number[]): number;
|
||||
|
||||
/**
|
||||
* Subtracts vector b from vector a.
|
||||
*/
|
||||
export function subtract(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
/**
|
||||
* Transforms the vec4 with a mat4..
|
||||
*/
|
||||
export function transformMat4(out: number[], a: number[], m: number[]): number[];
|
||||
|
||||
/**
|
||||
* Transforms the vec4 with a quat.
|
||||
*/
|
||||
export function transformQuat(out: number[], a: number[], q: number[]): number[];
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Returns the inverse of the components of a vec4.
|
||||
*/
|
||||
declare function inverse(out: number[], a: number[]): number[];
|
||||
|
||||
export default inverse;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Calculates the length of a vec4.
|
||||
*/
|
||||
declare function length(a: number[]): number;
|
||||
|
||||
export default length;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Performs a linear interpolation between two vec4's.
|
||||
*/
|
||||
declare function lerp(out: number[], a: number[], b: number[], t: number): number[];
|
||||
|
||||
export default lerp;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Returns the maximum of two vec4's.
|
||||
*/
|
||||
declare function max(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default max;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Returns the minimum of two vec4's.
|
||||
*/
|
||||
declare function min(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default min;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Multiplies two vec4's.
|
||||
*/
|
||||
declare function multiply(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default multiply;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Negates the components of a vec4.
|
||||
*/
|
||||
declare function negate(out: number[], a: number[]): number[];
|
||||
|
||||
export default negate;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Normalize a vec4.
|
||||
*/
|
||||
declare function normalize(out: number[], a: number[]): number[];
|
||||
|
||||
export default normalize;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Generates a random vector with the given scale.
|
||||
*/
|
||||
declare function random(out: number[], scale: number): number[];
|
||||
|
||||
export default random;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Scales a vec4 by a scalar number.
|
||||
*/
|
||||
declare function scale(out: number[], a: number[], b: number): number[];
|
||||
|
||||
export default scale;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Adds two vec4's after scaling the second operand by a scalar value.
|
||||
*/
|
||||
declare function scaleAndAdd(out: number[], a: number[], b: number[], scale: number): number[];
|
||||
|
||||
export default scaleAndAdd;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Set the components of a vec4 to the given values.
|
||||
*/
|
||||
declare function set(out: number[], x: number[], y: number[], z: number, w: number): number[];
|
||||
|
||||
export default set;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Calculates the squared euclidian distance between two vec4's.
|
||||
*/
|
||||
declare function squaredDistance(a: number[], b: number[]): number;
|
||||
|
||||
export default squaredDistance;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Calculates the squared length of a vec4.
|
||||
*/
|
||||
declare function squaredLength(a: number[]): number;
|
||||
|
||||
export default squaredLength;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Subtracts vector b from vector a.
|
||||
*/
|
||||
declare function subtract(out: number[], a: number[], b: number[]): number[];
|
||||
|
||||
export default subtract;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Transforms the vec4 with a mat4..
|
||||
*/
|
||||
declare function transformMat4(out: number[], a: number[], m: number[]): number[];
|
||||
|
||||
export default transformMat4;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Transforms the vec4 with a quat.
|
||||
*/
|
||||
declare function transformQuat(out: number[], a: number[], q: number[]): number[];
|
||||
|
||||
export default transformQuat;
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [
|
||||
|
||||
],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"add.d.ts",
|
||||
"clone.d.ts",
|
||||
"copy.d.ts",
|
||||
"create.d.ts",
|
||||
"distance.d.ts",
|
||||
"divide.d.ts",
|
||||
"dot.d.ts",
|
||||
"fromValues.d.ts",
|
||||
"inverse.d.ts",
|
||||
"length.d.ts",
|
||||
"lerp.d.ts",
|
||||
"max.d.ts",
|
||||
"min.d.ts",
|
||||
"multiply.d.ts",
|
||||
"negate.d.ts",
|
||||
"normalize.d.ts",
|
||||
"random.d.ts",
|
||||
"scale.d.ts",
|
||||
"scaleAndAdd.d.ts",
|
||||
"set.d.ts",
|
||||
"squaredDistance.d.ts",
|
||||
"squaredLength.d.ts",
|
||||
"subtract.d.ts",
|
||||
"transformMat4.d.ts",
|
||||
"transformQuat.d.ts",
|
||||
"gl-vec4-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
+4
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Google Apps Script 2019-01-23
|
||||
// Type definitions for Google Apps Script 2019-02-27
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -284,7 +284,9 @@ declare namespace GoogleAppsScript {
|
||||
* // A simple INFO log message, using sprintf() formatting.
|
||||
* console.info('Timing the %s function (%d arguments)', 'myFunction', 1);
|
||||
*
|
||||
* // Log a JSON object at a DEBUG level. Writes the stringified object to the log.
|
||||
* // Log a JSON object at a DEBUG level. If the object contains a property called "message",
|
||||
* // that is used as the summary in the log viewer, otherwise a stringified version of
|
||||
* // the object is used as the summary.
|
||||
* var parameters = {
|
||||
* isValid: true,
|
||||
* content: 'some string',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Google Apps Script 2019-01-23
|
||||
// Type definitions for Google Apps Script 2019-02-27
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -127,6 +127,7 @@ declare namespace GoogleAppsScript {
|
||||
getFormula(): string;
|
||||
getGroup(): string;
|
||||
getId(): string;
|
||||
getIsReaggregatable(): boolean;
|
||||
getName(): string;
|
||||
getType(): FieldType;
|
||||
isDefault(): boolean;
|
||||
@@ -139,6 +140,7 @@ declare namespace GoogleAppsScript {
|
||||
setGroup(group: string): Field;
|
||||
setId(id: string): Field;
|
||||
setIsHidden(isHidden: boolean): Field;
|
||||
setIsReaggregatable(isReaggregatable: boolean): Field;
|
||||
setName(name: string): Field;
|
||||
setType(type: FieldType): Field;
|
||||
}
|
||||
|
||||
+189
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Google Apps Script 2019-01-23
|
||||
// Type definitions for Google Apps Script 2019-02-27
|
||||
// Project: https://developers.google.com/apps-script/
|
||||
// Definitions by: motemen <https://github.com/motemen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -49,6 +49,35 @@ declare namespace GoogleAppsScript {
|
||||
*/
|
||||
export enum BandingTheme { LIGHT_GREY, CYAN, GREEN, YELLOW, ORANGE, BLUE, TEAL, GREY, BROWN, LIGHT_GREEN, INDIGO, PINK }
|
||||
|
||||
/**
|
||||
* Access the existing BigQuery data source specification. To create a new data source
|
||||
* specification, use SpreadsheetApp.newDataSourceSpec().
|
||||
*/
|
||||
export interface BigQueryDataSourceSpec {
|
||||
copy(): DataSourceSpecBuilder;
|
||||
getParameters(): DataSourceParameter[];
|
||||
getProjectId(): string;
|
||||
getRawQuery(): string;
|
||||
getType(): DataSourceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* The builder for BigQueryDataSourceSpecBuilder.
|
||||
*/
|
||||
export interface BigQueryDataSourceSpecBuilder {
|
||||
build(): DataSourceSpec;
|
||||
copy(): DataSourceSpecBuilder;
|
||||
getParameters(): DataSourceParameter[];
|
||||
getProjectId(): string;
|
||||
getRawQuery(): string;
|
||||
getType(): DataSourceType;
|
||||
removeAllParameters(): BigQueryDataSourceSpecBuilder;
|
||||
removeParameter(parameterName: string): BigQueryDataSourceSpecBuilder;
|
||||
setParameterFromCell(parameterName: string, sourceCell: string): BigQueryDataSourceSpecBuilder;
|
||||
setProjectId(projectId: string): BigQueryDataSourceSpecBuilder;
|
||||
setRawQuery(rawQuery: string): BigQueryDataSourceSpecBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access boolean conditions in ConditionalFormatRules. Each
|
||||
* conditional format rule may contain a single boolean condition. The boolean condition itself
|
||||
@@ -167,6 +196,154 @@ declare namespace GoogleAppsScript {
|
||||
*/
|
||||
export enum CopyPasteType { PASTE_NORMAL, PASTE_NO_BORDERS, PASTE_FORMAT, PASTE_FORMULA, PASTE_DATA_VALIDATION, PASTE_VALUES, PASTE_CONDITIONAL_FORMATTING, PASTE_COLUMN_WIDTHS }
|
||||
|
||||
/**
|
||||
* An enumeration of data execution error codes.
|
||||
*/
|
||||
export enum DataExecutionErrorCode { DATA_EXECUTION_ERROR_CODE_UNSUPPORTED, NONE, TIME_OUT, TOO_MANY_ROWS, TOO_MANY_CELLS, ENGINE, PARAMETER_INVALID, UNSUPPORTED_DATA_TYPE, DUPLICATE_COLUMN_NAMES, INTERRUPTED, OTHER, TOO_MANY_CHARS_PER_CELL }
|
||||
|
||||
/**
|
||||
* An enumeration of data execution states.
|
||||
*/
|
||||
export enum DataExecutionState { DATA_EXECUTION_STATE_UNSUPPORTED, RUNNING, SUCCESS, ERROR, NOT_STARTED }
|
||||
|
||||
/**
|
||||
* The data execution status.
|
||||
*/
|
||||
export interface DataExecutionStatus {
|
||||
getErrorCode(): DataExecutionErrorCode;
|
||||
getErrorMessage(): string;
|
||||
getExecutionState(): DataExecutionState;
|
||||
getLastRefreshedTime(): Date;
|
||||
isTruncated(): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access and modify existing data source. To create a data source table with new data source, see
|
||||
* DataSourceTable.
|
||||
*/
|
||||
export interface DataSource {
|
||||
getSpec(): DataSourceSpec;
|
||||
updateSpec(spec: DataSourceSpec): DataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access existing data source parameters.
|
||||
*/
|
||||
export interface DataSourceParameter {
|
||||
getName(): string;
|
||||
getSourceCell(): string;
|
||||
getType(): DataSourceParameterType;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of data source parameter types.
|
||||
*/
|
||||
export enum DataSourceParameterType { DATA_SOURCE_PARAMETER_TYPE_UNSUPPORTED, CELL }
|
||||
|
||||
/**
|
||||
* Access the general settings of an existing data source spec. To access data source spec for
|
||||
* certain type, use as...() method. To create a new data source spec, use SpreadsheetApp.newDataSourceSpec().
|
||||
*
|
||||
* This example shows how to get information from a BigQuery data source spec.
|
||||
*
|
||||
* var dataSourceTable =
|
||||
* SpreadsheetApp.getActive().getSheetByName("Data Sheet 1").getDataSourceTables()[0];
|
||||
* var spec = dataSourceTable.getDataSource().getSpec();
|
||||
* if (spec.getType() == SpreadsheetApp.DataSourceType.BIGQUERY) {
|
||||
* var bqSpec = spec.asBigQuery();
|
||||
* Logger.log("Project ID: %s\n", bqSpec.getProjectId());
|
||||
* Logger.log("Raw query string: %s\n", bqSpec.getRawQuery());
|
||||
* }
|
||||
*/
|
||||
export interface DataSourceSpec {
|
||||
asBigQuery(): BigQueryDataSourceSpec;
|
||||
copy(): DataSourceSpecBuilder;
|
||||
getParameters(): DataSourceParameter[];
|
||||
getType(): DataSourceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* The builder for DataSourceSpec. To create a specification for certain type, use as...() method. To create a new builder, use SpreadsheetApp.newDataSourceSpec(). To use the specification, see DataSourceTable.
|
||||
*
|
||||
* This examples show how to build a BigQuery data source specification.
|
||||
*
|
||||
* var spec = SpreadsheetApp.newDataSourceSpec()
|
||||
* .asBigQuery()
|
||||
* .setProjectId('big_query_project')
|
||||
* .setRawQuery('select @FIELD from table limit @LIMIT')
|
||||
* .setParameterFromCell('FIELD', 'Sheet1!A1')
|
||||
* .setParameterFromCell('LIMIT', 'namedRangeCell')
|
||||
* .build();
|
||||
*/
|
||||
export interface DataSourceSpecBuilder {
|
||||
asBigQuery(): BigQueryDataSourceSpecBuilder;
|
||||
build(): DataSourceSpec;
|
||||
copy(): DataSourceSpecBuilder;
|
||||
getParameters(): DataSourceParameter[];
|
||||
getType(): DataSourceType;
|
||||
removeAllParameters(): DataSourceSpecBuilder;
|
||||
removeParameter(parameterName: string): DataSourceSpecBuilder;
|
||||
setParameterFromCell(parameterName: string, sourceCell: string): DataSourceSpecBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access and modify existing data source table. To create a new data source table on a new sheet,
|
||||
* use Spreadsheet.insertSheetWithDataSourceTable(spec).
|
||||
*
|
||||
* This example shows how to create a new data source table.
|
||||
*
|
||||
* SpreadsheetApp.enableBigQueryExecution();
|
||||
* var spreadsheet = SpreadsheetApp.getActive();
|
||||
* var spec = SpreadsheetApp.newDataSourceSpec()
|
||||
* .asBigQuery()
|
||||
* .setProjectId('big_query_project')
|
||||
* .setRawQuery('select @FIELD from table limit @LIMIT')
|
||||
* .setParameterFromCell('FIELD', 'Sheet1!A1')
|
||||
* .setParameterFromCell('LIMIT', 'namedRangeCell')
|
||||
* .build();
|
||||
* // Starts data execution asynchronously.
|
||||
* var dataSheet = spreadsheet.insertSheetWithDataSourceTable(spec);
|
||||
* var dataSourceTable = dataSheet.getDataSourceTables()[0];
|
||||
* // waitForCompletion() blocks script execution until data execution completes.
|
||||
* dataSourceTable.waitForCompletion(60);
|
||||
* // Check status after execution.
|
||||
* Logger.log("Data execution state: %s.", dataSourceTable.getStatus().getExecutionState());
|
||||
*
|
||||
* This example shows how to edit a data source.
|
||||
*
|
||||
* SpreadsheetApp.enableBigQueryExecution();
|
||||
* var dataSheet = SpreadsheetApp.getActive().getSheetByName("Data Sheet 1");
|
||||
* var dataSourceTable = dataSheet.getDataSourceTables()[0];
|
||||
* var dataSource = dataSourceTable.getDataSource();
|
||||
* var newSpec = dataSource.getSpec()
|
||||
* .copy()
|
||||
* .asBigQuery()
|
||||
* .setRawQuery('select name from table limit 2')
|
||||
* .removeAllParameters()
|
||||
* .build();
|
||||
* // Updates data source specification and starts data execution asynchronously.
|
||||
* dataSource.updateSpec(newSpec);
|
||||
* // Check status during execution.
|
||||
* Logger.log("Data execution state: %s.", dataSourceTable.getStatus().getExecutionState());
|
||||
* // waitForCompletion() blocks script execution until data execution completes.
|
||||
* dataSourceTable.waitForCompletion(60);
|
||||
* // Check status after execution.
|
||||
* Logger.log("Data execution state: %s.", dataSourceTable.getStatus().getExecutionState());
|
||||
*/
|
||||
export interface DataSourceTable {
|
||||
forceRefreshData(): DataSourceTable;
|
||||
getDataSource(): DataSource;
|
||||
getRange(): Range;
|
||||
getStatus(): DataExecutionStatus;
|
||||
refreshData(): DataSourceTable;
|
||||
waitForCompletion(timeoutInSeconds: Integer): DataExecutionStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of data source types.
|
||||
*/
|
||||
export enum DataSourceType { DATA_SOURCE_TYPE_UNSUPPORTED, BIGQUERY }
|
||||
|
||||
/**
|
||||
* Access data validation rules. To create a new rule, use SpreadsheetApp.newDataValidation() and DataValidationBuilder. You can use
|
||||
* Range.setDataValidation(rule) to set the validation rule for a range.
|
||||
@@ -1215,6 +1392,7 @@ declare namespace GoogleAppsScript {
|
||||
getBandings(): Banding[];
|
||||
getCell(row: Integer, column: Integer): Range;
|
||||
getColumn(): Integer;
|
||||
getDataSourceTables(): DataSourceTable[];
|
||||
getDataSourceUrl(): string;
|
||||
getDataTable(): Charts.DataTable;
|
||||
getDataTable(firstRowIsHeader: boolean): Charts.DataTable;
|
||||
@@ -1493,6 +1671,7 @@ declare namespace GoogleAppsScript {
|
||||
getConditionalFormatRules(): ConditionalFormatRule[];
|
||||
getCurrentCell(): Range;
|
||||
getDataRange(): Range;
|
||||
getDataSourceTables(): DataSourceTable[];
|
||||
getDeveloperMetadata(): DeveloperMetadata[];
|
||||
getFilter(): Filter;
|
||||
getFormUrl(): string;
|
||||
@@ -1627,6 +1806,7 @@ declare namespace GoogleAppsScript {
|
||||
getColumnWidth(columnPosition: Integer): Integer;
|
||||
getCurrentCell(): Range;
|
||||
getDataRange(): Range;
|
||||
getDataSourceTables(): DataSourceTable[];
|
||||
getDeveloperMetadata(): DeveloperMetadata[];
|
||||
getEditors(): Base.User[];
|
||||
getFormUrl(): string;
|
||||
@@ -1677,6 +1857,7 @@ declare namespace GoogleAppsScript {
|
||||
insertSheet(sheetName: string, sheetIndex: Integer): Sheet;
|
||||
insertSheet(sheetName: string, sheetIndex: Integer, options: Object): Sheet;
|
||||
insertSheet(sheetName: string, options: Object): Sheet;
|
||||
insertSheetWithDataSourceTable(spec: DataSourceSpec): Sheet;
|
||||
isColumnHiddenByUser(columnPosition: Integer): boolean;
|
||||
isRowHiddenByFilter(rowPosition: Integer): boolean;
|
||||
isRowHiddenByUser(rowPosition: Integer): boolean;
|
||||
@@ -1728,6 +1909,10 @@ declare namespace GoogleAppsScript {
|
||||
BooleanCriteria: typeof BooleanCriteria;
|
||||
BorderStyle: typeof BorderStyle;
|
||||
CopyPasteType: typeof CopyPasteType;
|
||||
DataExecutionErrorCode: typeof DataExecutionErrorCode;
|
||||
DataExecutionState: typeof DataExecutionState;
|
||||
DataSourceParameterType: typeof DataSourceParameterType;
|
||||
DataSourceType: typeof DataSourceType;
|
||||
DataValidationCriteria: typeof DataValidationCriteria;
|
||||
DeveloperMetadataLocationType: typeof DeveloperMetadataLocationType;
|
||||
DeveloperMetadataVisibility: typeof DeveloperMetadataVisibility;
|
||||
@@ -1744,6 +1929,8 @@ declare namespace GoogleAppsScript {
|
||||
WrapStrategy: typeof WrapStrategy;
|
||||
create(name: string): Spreadsheet;
|
||||
create(name: string, rows: Integer, columns: Integer): Spreadsheet;
|
||||
enableAllDataSourcesExecution(): void;
|
||||
enableBigQueryExecution(): void;
|
||||
flush(): void;
|
||||
getActive(): Spreadsheet;
|
||||
getActiveRange(): Range;
|
||||
@@ -1754,6 +1941,7 @@ declare namespace GoogleAppsScript {
|
||||
getSelection(): Selection;
|
||||
getUi(): Base.Ui;
|
||||
newConditionalFormatRule(): ConditionalFormatRuleBuilder;
|
||||
newDataSourceSpec(): DataSourceSpecBuilder;
|
||||
newDataValidation(): DataValidationBuilder;
|
||||
newFilterCriteria(): FilterCriteriaBuilder;
|
||||
newRichTextValue(): RichTextValueBuilder;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import i = require("icepick");
|
||||
import * as _ from 'underscore';
|
||||
|
||||
"use strict"; // so attempted modifications of frozen objects will throw errors
|
||||
|
||||
@@ -146,15 +145,13 @@ class Foo {}
|
||||
{
|
||||
i.map(function(v) { return v * 2 }, [1, 2, 3]); // [2, 4, 6]
|
||||
|
||||
var removeEvens = _.partial(i.filter, function(v: number) { return v % 2; });
|
||||
|
||||
removeEvens([1, 2, 3]); // [1, 3]
|
||||
i.filter(function(v: number) { return v % 2 === 0; }, [1, 2, 3]); // [1, 3]
|
||||
}
|
||||
{
|
||||
var arr = i.freeze([{ a: 1 }, { b: 2 }]);
|
||||
|
||||
//ECMAScript 2015
|
||||
//arr.find(function(item) { return item.b != null; }); // {b: 2}
|
||||
//arr.find(function(item) { return item.b != null; }); // {b: 2}
|
||||
}
|
||||
|
||||
// chain(coll) - not defined
|
||||
|
||||
Vendored
+1
-1
@@ -41,7 +41,7 @@ export class JSDOM {
|
||||
* Behind the scenes, a jsdom Window is indeed a VM context.
|
||||
* To get access to this ability, use the runVMScript() method.
|
||||
*/
|
||||
runVMScript(script: Script): void;
|
||||
runVMScript(script: Script): any;
|
||||
|
||||
reconfigure(settings: ReconfigureSettings): void;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Type definitions for massive 5.4
|
||||
// Project: https://github.com/dmfay/massive-js.git, https://dmfay.github.io/massive-js
|
||||
// Project: https://massivejs.org, https://github.com/dmfay/massive-js.git, https://dmfay.github.io/massive-js
|
||||
// Definitions by: Pascal Birchler <https://github.com/swissspidy>
|
||||
// Clarence Ho <https://github.com/clarenceh>
|
||||
// Felix Faust <https://github.com/AmazingTurtle>
|
||||
|
||||
Vendored
+243
-227
File diff suppressed because it is too large
Load Diff
+114
-87
@@ -1,19 +1,19 @@
|
||||
// Test source : https://github.com/mongodb/node-mongodb-native
|
||||
import mongodb = require('mongodb');
|
||||
var MongoClient = mongodb.MongoClient;
|
||||
|
||||
import { format } from 'util';
|
||||
import * as mongodb from 'mongodb';
|
||||
|
||||
const connectionString = 'mongodb://127.0.0.1:27017/test';
|
||||
|
||||
var format = require('util').format;
|
||||
let options: mongodb.MongoClientOptions = {
|
||||
const options: mongodb.MongoClientOptions = {
|
||||
authSource: ' ',
|
||||
loggerLevel: 'debug',
|
||||
w: 1,
|
||||
wtimeout: 300,
|
||||
j: true,
|
||||
bufferMaxEntries: 1000,
|
||||
readPreference: 'ReadPreference | string',
|
||||
promoteValues: {},
|
||||
readPreference: true ? mongodb.ReadPreference.NEAREST : 'string',
|
||||
promoteValues: true,
|
||||
pkFactory: {},
|
||||
poolSize: 1,
|
||||
|
||||
@@ -24,7 +24,7 @@ let options: mongodb.MongoClientOptions = {
|
||||
reconnectInterval: 123456,
|
||||
ssl: true,
|
||||
sslValidate: false,
|
||||
checkServerIdentity: function () { },
|
||||
checkServerIdentity: true ? true : (host, cert) => { return undefined; },
|
||||
sslCA: ['str'],
|
||||
sslCRL: ['str'],
|
||||
sslCert: new Buffer(999),
|
||||
@@ -34,58 +34,63 @@ let options: mongodb.MongoClientOptions = {
|
||||
useNewUrlParser: false,
|
||||
authMechanism: 'SCRAM-SHA-1',
|
||||
forceServerObjectId: false
|
||||
}
|
||||
MongoClient.connect(connectionString, options, function (err: mongodb.MongoError, client: mongodb.MongoClient) {
|
||||
};
|
||||
|
||||
mongodb.MongoClient.connect(connectionString, options, (err: mongodb.MongoError, client: mongodb.MongoClient) => {
|
||||
if (err) throw err;
|
||||
const db = client.db('test');
|
||||
|
||||
var collection = db.collection('test_insert');
|
||||
collection.insertOne({ a: 2 }, function (err: mongodb.MongoError, docs: any) {
|
||||
const collection = db.collection('test_insert');
|
||||
collection.insertOne({ a: 2 }, (err: mongodb.MongoError, result) => {
|
||||
result.insertedCount; // $ExpectType number
|
||||
result.insertedId; // $ExpectType ObjectId
|
||||
result.result.n; // $ExpectType number
|
||||
result.result.ok; // $ExpectType number
|
||||
|
||||
// Intentionally omitted type annotation from 'count'.
|
||||
// This way it requires a more accurate typedef which allows inferring that it's a number.
|
||||
collection.countDocuments(function (err: mongodb.MongoError, count) {
|
||||
collection.countDocuments((err: mongodb.MongoError, count) => {
|
||||
console.log(format("count = %s", count));
|
||||
});
|
||||
|
||||
collection.countDocuments().then(function (count: number) {
|
||||
collection.countDocuments().then((count: number) => {
|
||||
console.log(format("count = %s", count));
|
||||
});
|
||||
|
||||
collection.countDocuments({ foo: 1 }, function (err: mongodb.MongoError, count: number) {
|
||||
collection.countDocuments({ foo: 1 }, (err: mongodb.MongoError, count: number) => {
|
||||
console.log(format("count = %s", count));
|
||||
});
|
||||
|
||||
collection.countDocuments({ foo: 1 }).then(function (count: number) {
|
||||
collection.countDocuments({ foo: 1 }).then((count: number) => {
|
||||
console.log(format("count = %s", count));
|
||||
});
|
||||
|
||||
collection.countDocuments({ foo: 1 }, { limit: 10 }, function (err: mongodb.MongoError, count: number) {
|
||||
collection.countDocuments({ foo: 1 }, { limit: 10 }, (err: mongodb.MongoError, count: number) => {
|
||||
console.log(format("count = %s", count));
|
||||
});
|
||||
|
||||
collection.countDocuments({ foo: 1 }, { limit: 10 }).then(function (count: number) {
|
||||
collection.countDocuments({ foo: 1 }, { limit: 10 }).then((count: number) => {
|
||||
console.log(format("count = %s", count));
|
||||
});
|
||||
|
||||
// Locate all the entries using find
|
||||
collection.find({}).toArray(function (err: mongodb.MongoError, results: any) {
|
||||
collection.find({}).toArray((err: mongodb.MongoError, results: any) => {
|
||||
console.dir(results);
|
||||
// Let's close the db
|
||||
client.close();
|
||||
});
|
||||
|
||||
// Get some statistics
|
||||
collection.stats(function (err: mongodb.MongoError, stats: any) {
|
||||
collection.stats((err: mongodb.MongoError, stats: any) => {
|
||||
console.log(stats.count + " documents");
|
||||
});
|
||||
|
||||
//
|
||||
collection.stats().then(function (stats) {
|
||||
collection.stats().then((stats) => {
|
||||
console.log(stats.wiredTiger.cache['bytes currently in the cache']);
|
||||
})
|
||||
});
|
||||
|
||||
collection.createIndex({}, { partialFilterExpression: { rating: { $exists: 1 } } })
|
||||
collection.createIndex({}, { partialFilterExpression: { rating: { $exists: 1 } } });
|
||||
});
|
||||
|
||||
{
|
||||
@@ -95,10 +100,11 @@ MongoClient.connect(connectionString, options, function (err: mongodb.MongoError
|
||||
cursor = cursor.addQueryModifier('', true);
|
||||
cursor = cursor.batchSize(1);
|
||||
cursor = cursor.comment('');
|
||||
cursor = cursor.filter(1);
|
||||
cursor = cursor.hint({});
|
||||
cursor = cursor.filter({a: 1});
|
||||
cursor = cursor.hint({ age: 1 });
|
||||
cursor = cursor.hint('age_1');
|
||||
cursor = cursor.limit(1);
|
||||
cursor = cursor.map(function (result) { });
|
||||
cursor = cursor.map((result) => {});
|
||||
cursor = cursor.max(1);
|
||||
cursor = cursor.min(1);
|
||||
cursor = cursor.maxAwaitTimeMS(1);
|
||||
@@ -116,54 +122,64 @@ MongoClient.connect(connectionString, options, function (err: mongodb.MongoError
|
||||
}
|
||||
// Collection .findM<T>() & .agggregate<T>() generic tests
|
||||
{
|
||||
let bag: { cost: number, color: string };
|
||||
type bag = typeof bag;
|
||||
let cursor: mongodb.Cursor<bag> = collection.find<bag>({ color: 'black' })
|
||||
cursor.toArray(function (err, r) { r[0].cost });
|
||||
cursor.forEach(function (bag) { bag.color }, () => { });
|
||||
collection.findOne({ color: 'white' }).then(b => { let _b: bag = b; })
|
||||
collection.findOne<bag>({ color: 'white' }).then(b => { b.cost; })
|
||||
interface Bag {
|
||||
cost: number;
|
||||
color: string;
|
||||
}
|
||||
const cursor: mongodb.Cursor<Bag> = collection.find<Bag>({ color: 'black' });
|
||||
cursor.toArray((err, r) => { r[0].cost; });
|
||||
cursor.forEach((bag) => { bag.color; }, () => {});
|
||||
collection.findOne({ color: 'white' }).then(b => { const _b: Bag = b; });
|
||||
collection.findOne<Bag>({ color: 'white' }).then(b => { b.cost; });
|
||||
}
|
||||
{
|
||||
let payment: { total: number };
|
||||
type payment = typeof payment;
|
||||
let cursor: mongodb.AggregationCursor<payment> = collection.aggregate<payment>([{}])
|
||||
interface Payment {
|
||||
total: number;
|
||||
}
|
||||
const cursor: mongodb.AggregationCursor<Payment> = collection.aggregate<Payment>([{}]);
|
||||
|
||||
collection.aggregate([{ $match: { bar: 1 } }, { $limit: 10 }])
|
||||
collection.aggregate([{ $match: { bar: 1 } }]).limit(10)
|
||||
collection.aggregate([]).match({ bar: 1 }).limit(10)
|
||||
collection.aggregate().match({ bar: 1 }).limit(10)
|
||||
collection.aggregate([{ $match: { bar: 1 } }, { $limit: 10 }]);
|
||||
collection.aggregate([{ $match: { bar: 1 } }]).limit(10);
|
||||
collection.aggregate([]).match({ bar: 1 }).limit(10);
|
||||
collection.aggregate().match({ bar: 1 }).limit(10);
|
||||
|
||||
collection.aggregate<payment>(
|
||||
collection.aggregate<Payment>(
|
||||
[{ $match: { bar: 1 } }],
|
||||
function (err: mongodb.MongoError, cursor: mongodb.AggregationCursor<payment>) {
|
||||
cursor.limit(10)
|
||||
(err: mongodb.MongoError, cursor: mongodb.AggregationCursor<Payment>) => {
|
||||
cursor.limit(10);
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
collection.aggregate<payment>(
|
||||
collection.aggregate<Payment>(
|
||||
[],
|
||||
function (err: mongodb.MongoError, cursor: mongodb.AggregationCursor<payment>) {
|
||||
cursor.match({ bar: 1 }).limit(10)
|
||||
(err: mongodb.MongoError, cursor: mongodb.AggregationCursor<Payment>) => {
|
||||
cursor.match({ bar: 1 }).limit(10);
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
collection.aggregate<payment>(
|
||||
function (err: mongodb.MongoError, cursor: mongodb.AggregationCursor<payment>) {
|
||||
cursor.match({ bar: 1 }).limit(10)
|
||||
collection.aggregate<Payment>(
|
||||
(err: mongodb.MongoError, cursor: mongodb.AggregationCursor<Payment>) => {
|
||||
cursor.match({ bar: 1 }).limit(10);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// test for new typings
|
||||
{
|
||||
type TestCollection = {
|
||||
interface TestCollection {
|
||||
stringField: string;
|
||||
numberField?: number;
|
||||
};
|
||||
let testCollection = db.collection<TestCollection>('testCollection');
|
||||
testCollection.insertOne({stringField:'hola'})
|
||||
testCollection.insertMany([{stringField:'hola'},{stringField:'hola', numberField: 1}])
|
||||
fruitTags: string[];
|
||||
}
|
||||
const testCollection = db.collection<TestCollection>('testCollection');
|
||||
testCollection.insertOne({
|
||||
stringField: 'hola',
|
||||
fruitTags: ['Strawberry'],
|
||||
});
|
||||
testCollection.insertMany([
|
||||
{ stringField: 'hola', fruitTags: ['Apple', 'Lemon'] },
|
||||
{ stringField: 'hola', numberField: 1, fruitTags: [] },
|
||||
]);
|
||||
testCollection.find({
|
||||
numberField: {
|
||||
$and: [{ $gt: 0, $lt: 100 }]
|
||||
@@ -171,16 +187,28 @@ MongoClient.connect(connectionString, options, function (err: mongodb.MongoError
|
||||
});
|
||||
|
||||
const res: mongodb.Cursor<TestCollection> = testCollection.find({ _id: 123 });
|
||||
|
||||
testCollection.updateOne(
|
||||
{ stringField: 'hola' },
|
||||
{
|
||||
$addToSet: {
|
||||
fruitTags: 'Orange',
|
||||
},
|
||||
$pull: {
|
||||
fruitTags: 'Lemon',
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
let testFunc = async () => {
|
||||
let testClient: mongodb.MongoClient;
|
||||
testClient = await mongodb.connect(connectionString);
|
||||
};
|
||||
async function testFunc(): Promise<mongodb.MongoClient> {
|
||||
const testClient: mongodb.MongoClient = await mongodb.connect(connectionString);
|
||||
return testClient;
|
||||
}
|
||||
|
||||
mongodb.connect(connectionString, (err: mongodb.MongoError, client: mongodb.MongoClient) => { });
|
||||
mongodb.connect(connectionString, options, (err: mongodb.MongoError, client: mongodb.MongoClient) => { });
|
||||
mongodb.connect(connectionString, (err: mongodb.MongoError, client: mongodb.MongoClient) => {});
|
||||
mongodb.connect(connectionString, options, (err: mongodb.MongoError, client: mongodb.MongoClient) => {});
|
||||
|
||||
// https://docs.mongodb.com/manual/core/transactions/
|
||||
|
||||
@@ -193,10 +221,10 @@ async function commitWithRetry(session: mongodb.ClientSession) {
|
||||
error.errorLabels &&
|
||||
error.errorLabels.indexOf('UnknownTransactionCommitResult') < 0
|
||||
) {
|
||||
console.log('UnknownTransactionCommitResult, retrying commit operation ...');
|
||||
console.log('UnknownTransactionCommitResult, retrying commit operation...');
|
||||
await commitWithRetry(session);
|
||||
} else {
|
||||
console.log('Error during commit ...');
|
||||
console.log('Error during commit...');
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -205,7 +233,8 @@ async function commitWithRetry(session: mongodb.ClientSession) {
|
||||
async function runTransactionWithRetry(
|
||||
txnFunc: (client: mongodb.MongoClient, session: mongodb.ClientSession) => Promise<void>,
|
||||
client: mongodb.MongoClient,
|
||||
session: mongodb.ClientSession) {
|
||||
session: mongodb.ClientSession
|
||||
) {
|
||||
try {
|
||||
await txnFunc(client, session);
|
||||
} catch (error) {
|
||||
@@ -256,31 +285,31 @@ async function transfer(client: mongodb.MongoClient, from: any, to: any, amount:
|
||||
const session = client.startSession();
|
||||
session.startTransaction();
|
||||
try {
|
||||
const opts = { session, returnOriginal: false };
|
||||
const A = await db.collection('Account').
|
||||
const opts = { session, returnOriginal: false };
|
||||
const A = await db.collection('Account').
|
||||
findOneAndUpdate({ name: from }, { $inc: { balance: -amount } }, opts).
|
||||
then(res => res.value);
|
||||
if (A.balance < 0) {
|
||||
// If A would have negative balance, fail and abort the transaction
|
||||
// `session.abortTransaction()` will undo the above `findOneAndUpdate()`
|
||||
throw new Error('Insufficient funds: ' + (A.balance + amount));
|
||||
}
|
||||
if (A.balance < 0) {
|
||||
// If A would have negative balance, fail and abort the transaction
|
||||
// `session.abortTransaction()` will undo the above `findOneAndUpdate()`
|
||||
throw new Error('Insufficient funds: ' + (A.balance + amount));
|
||||
}
|
||||
|
||||
const B = await db.collection('Account').
|
||||
findOneAndUpdate({ name: to }, { $inc: { balance: amount } }, opts).
|
||||
then(res => res.value);
|
||||
const B = await db.collection('Account')
|
||||
.findOneAndUpdate({ name: to }, { $inc: { balance: amount } }, opts)
|
||||
.then(res => res.value);
|
||||
|
||||
await session.commitTransaction();
|
||||
session.endSession();
|
||||
return { from: A, to: B };
|
||||
await session.commitTransaction();
|
||||
session.endSession();
|
||||
return { from: A, to: B };
|
||||
} catch (error) {
|
||||
// If an error occurred, abort the whole transaction and
|
||||
// undo any changes that might have happened
|
||||
await session.abortTransaction();
|
||||
session.endSession();
|
||||
throw error; // Rethrow so calling function sees error
|
||||
// If an error occurred, abort the whole transaction and
|
||||
// undo any changes that might have happened
|
||||
await session.abortTransaction();
|
||||
session.endSession();
|
||||
throw error; // Rethrow so calling function sees error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mongodb.connect(connectionString).then((client) => {
|
||||
client.startSession();
|
||||
@@ -288,5 +317,3 @@ mongodb.connect(connectionString).then((client) => {
|
||||
runTransactionWithRetry(updateEmployeeInfo, client, session)
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
||||
+10
-39
@@ -2,79 +2,50 @@
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"ban-types": {
|
||||
"options": [
|
||||
["Object", "Avoid using the `Object` type. Did you mean `object`?"],
|
||||
["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
|
||||
["Number", "Avoid using the `Number` type. Did you mean `number`?"],
|
||||
["String", "Avoid using the `String` type. Did you mean `string`?"],
|
||||
["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"]
|
||||
]
|
||||
},
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"use-default-type-parameter": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"use-default-type-parameter": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
@@ -2,6 +2,10 @@ declare module "buffer" {
|
||||
export const INSPECT_MAX_BYTES: number;
|
||||
const BuffType: typeof Buffer;
|
||||
|
||||
export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary";
|
||||
|
||||
export function transcode(source: Buffer | Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
|
||||
|
||||
export const SlowBuffer: {
|
||||
/** @deprecated since v6.0.0, use Buffer.allocUnsafeSlow() */
|
||||
new(size: number): Buffer;
|
||||
|
||||
Vendored
+26
-20
@@ -1,20 +1,27 @@
|
||||
declare module "child_process" {
|
||||
import * as events from "events";
|
||||
import * as stream from "stream";
|
||||
import * as net from "net";
|
||||
import { Writable, Readable, Stream, Pipe } from "stream";
|
||||
|
||||
interface ChildProcess extends events.EventEmitter {
|
||||
stdin: stream.Writable;
|
||||
stdout: stream.Readable;
|
||||
stderr: stream.Readable;
|
||||
stdio: [stream.Writable, stream.Readable, stream.Readable];
|
||||
killed: boolean;
|
||||
pid: number;
|
||||
stdin: Writable | null;
|
||||
stdout: Readable | null;
|
||||
stderr: Readable | null;
|
||||
readonly channel?: Pipe | null;
|
||||
readonly stdio: [
|
||||
Writable | null, // stdin
|
||||
Readable | null, // stdout
|
||||
Readable | null, // stderr
|
||||
Readable | Writable | null | undefined, // extra
|
||||
Readable | Writable | null | undefined // extra
|
||||
];
|
||||
readonly killed: boolean;
|
||||
readonly pid: number;
|
||||
readonly connected: boolean;
|
||||
kill(signal?: string): void;
|
||||
send(message: any, callback?: (error: Error) => void): boolean;
|
||||
send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error) => void): boolean;
|
||||
send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error) => void): boolean;
|
||||
connected: boolean;
|
||||
disconnect(): void;
|
||||
unref(): void;
|
||||
ref(): void;
|
||||
@@ -75,17 +82,20 @@ declare module "child_process" {
|
||||
keepOpen?: boolean;
|
||||
}
|
||||
|
||||
type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | stream.Stream | number | null | undefined)>;
|
||||
type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | Stream | number | null | undefined)>;
|
||||
|
||||
interface CommonOptions {
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
windowsHide?: boolean;
|
||||
interface ProcessEnvOptions {
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
cwd?: string;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
}
|
||||
|
||||
interface CommonOptions extends ProcessEnvOptions {
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
windowsHide?: boolean;
|
||||
/**
|
||||
* @default 0
|
||||
*/
|
||||
@@ -249,16 +259,12 @@ declare module "child_process" {
|
||||
): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
||||
}
|
||||
|
||||
interface ForkOptions {
|
||||
cwd?: string;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
interface ForkOptions extends ProcessEnvOptions {
|
||||
execPath?: string;
|
||||
execArgv?: string[];
|
||||
silent?: boolean;
|
||||
stdio?: StdioOptions;
|
||||
windowsVerbatimArguments?: boolean;
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
}
|
||||
function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
|
||||
|
||||
@@ -285,7 +291,7 @@ declare module "child_process" {
|
||||
stderr: T;
|
||||
status: number;
|
||||
signal: string;
|
||||
error: Error;
|
||||
error?: Error;
|
||||
}
|
||||
function spawnSync(command: string): SpawnSyncReturns<Buffer>;
|
||||
function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
||||
|
||||
Vendored
+51
-6
@@ -169,17 +169,17 @@ declare module "crypto" {
|
||||
function createCipheriv(
|
||||
algorithm: CipherCCMTypes,
|
||||
key: CipherKey,
|
||||
iv: BinaryLike,
|
||||
iv: BinaryLike | null,
|
||||
options: CipherCCMOptions
|
||||
): CipherCCM;
|
||||
function createCipheriv(
|
||||
algorithm: CipherGCMTypes,
|
||||
key: CipherKey,
|
||||
iv: BinaryLike,
|
||||
iv: BinaryLike | null,
|
||||
options?: CipherGCMOptions
|
||||
): CipherGCM;
|
||||
function createCipheriv(
|
||||
algorithm: string, key: CipherKey, iv: BinaryLike, options?: stream.TransformOptions
|
||||
algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions
|
||||
): Cipher;
|
||||
|
||||
interface Cipher extends NodeJS.ReadWriteStream {
|
||||
@@ -213,16 +213,16 @@ declare module "crypto" {
|
||||
function createDecipheriv(
|
||||
algorithm: CipherCCMTypes,
|
||||
key: BinaryLike,
|
||||
iv: BinaryLike,
|
||||
iv: BinaryLike | null,
|
||||
options: CipherCCMOptions,
|
||||
): DecipherCCM;
|
||||
function createDecipheriv(
|
||||
algorithm: CipherGCMTypes,
|
||||
key: BinaryLike,
|
||||
iv: BinaryLike,
|
||||
iv: BinaryLike | null,
|
||||
options?: CipherGCMOptions,
|
||||
): DecipherGCM;
|
||||
function createDecipheriv(algorithm: string, key: BinaryLike, iv: BinaryLike, options?: stream.TransformOptions): Decipher;
|
||||
function createDecipheriv(algorithm: string, key: BinaryLike, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher;
|
||||
|
||||
interface Decipher extends NodeJS.ReadWriteStream {
|
||||
update(data: Binary): Buffer;
|
||||
@@ -405,6 +405,42 @@ declare module "crypto" {
|
||||
passphrase: string;
|
||||
}
|
||||
|
||||
interface KeyPairKeyObjectResult {
|
||||
publicKey: KeyObject;
|
||||
privateKey: KeyObject;
|
||||
}
|
||||
|
||||
interface ECKeyPairKeyObjectOptions {
|
||||
/**
|
||||
* Name of the curve to use.
|
||||
*/
|
||||
namedCurve: string;
|
||||
}
|
||||
|
||||
interface RSAKeyPairKeyObjectOptions {
|
||||
/**
|
||||
* Key size in bits
|
||||
*/
|
||||
modulusLength: number;
|
||||
|
||||
/**
|
||||
* @default 0x10001
|
||||
*/
|
||||
publicExponent?: number;
|
||||
}
|
||||
|
||||
interface DSAKeyPairKeyObjectOptions {
|
||||
/**
|
||||
* Key size in bits
|
||||
*/
|
||||
modulusLength: number;
|
||||
|
||||
/**
|
||||
* Size of q in bits
|
||||
*/
|
||||
divisorLength: number;
|
||||
}
|
||||
|
||||
interface RSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
||||
/**
|
||||
* Key size in bits
|
||||
@@ -467,46 +503,55 @@ declare module "crypto" {
|
||||
function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
|
||||
function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
|
||||
function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
|
||||
function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
||||
|
||||
function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
|
||||
function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
|
||||
function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
|
||||
function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
|
||||
function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
||||
|
||||
function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
|
||||
function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
|
||||
function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
|
||||
function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
|
||||
function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
||||
|
||||
function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
|
||||
|
||||
function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
|
||||
|
||||
function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
|
||||
function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
|
||||
function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
|
||||
|
||||
namespace generateKeyPair {
|
||||
function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
|
||||
function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
|
||||
function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
|
||||
function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
|
||||
function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
||||
|
||||
function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
|
||||
function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
|
||||
function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
|
||||
function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
|
||||
function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
||||
|
||||
function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
|
||||
function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
|
||||
function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
|
||||
function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
|
||||
function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+16
-2
@@ -681,7 +681,7 @@ declare namespace NodeJS {
|
||||
type ExitListener = (code: number) => void;
|
||||
type RejectionHandledListener = (promise: Promise<any>) => void;
|
||||
type UncaughtExceptionListener = (error: Error) => void;
|
||||
type UnhandledRejectionListener = (reason: any, promise: Promise<any>) => void;
|
||||
type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<any>) => void;
|
||||
type WarningListener = (warning: Error) => void;
|
||||
type MessageListener = (message: any, sendHandle: any) => void;
|
||||
type SignalsListener = (signal: Signals) => void;
|
||||
@@ -721,6 +721,10 @@ declare namespace NodeJS {
|
||||
destroy(error?: Error): void;
|
||||
}
|
||||
|
||||
interface HRTime {
|
||||
(time?: [number, number]): [number, number];
|
||||
}
|
||||
|
||||
interface Process extends EventEmitter {
|
||||
/**
|
||||
* Can also be a tty.WriteStream, not typed due to limitation.s
|
||||
@@ -795,12 +799,22 @@ declare namespace NodeJS {
|
||||
cpuUsage(previousValue?: CpuUsage): CpuUsage;
|
||||
nextTick(callback: Function, ...args: any[]): void;
|
||||
release: ProcessRelease;
|
||||
features: {
|
||||
inspector: boolean;
|
||||
debug: boolean;
|
||||
uv: boolean;
|
||||
ipv6: boolean;
|
||||
tls_alpn: boolean;
|
||||
tls_sni: boolean;
|
||||
tls_ocsp: boolean;
|
||||
tls: boolean;
|
||||
};
|
||||
/**
|
||||
* Can only be set if not in worker thread.
|
||||
*/
|
||||
umask(mask?: number): number;
|
||||
uptime(): number;
|
||||
hrtime(time?: [number, number]): [number, number];
|
||||
hrtime: HRTime;
|
||||
domain: Domain;
|
||||
|
||||
// Worker
|
||||
|
||||
Vendored
+3
-2
@@ -147,8 +147,8 @@ declare module "http" {
|
||||
// https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53
|
||||
// no args in writeContinue callback
|
||||
writeContinue(callback?: () => void): void;
|
||||
writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders): void;
|
||||
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): void;
|
||||
writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders): this;
|
||||
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
|
||||
}
|
||||
|
||||
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L77
|
||||
@@ -159,6 +159,7 @@ declare module "http" {
|
||||
|
||||
constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
|
||||
|
||||
readonly path: string;
|
||||
abort(): void;
|
||||
onSocket(socket: net.Socket): void;
|
||||
setTimeout(timeout: number, callback?: () => void): this;
|
||||
|
||||
Vendored
+2
-2
@@ -582,8 +582,8 @@ declare module "http2" {
|
||||
write(chunk: string | Buffer, callback?: (err: Error) => void): boolean;
|
||||
write(chunk: string | Buffer, encoding?: string, callback?: (err: Error) => void): boolean;
|
||||
writeContinue(): void;
|
||||
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): void;
|
||||
writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders): void;
|
||||
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
|
||||
writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders): this;
|
||||
createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void;
|
||||
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
|
||||
Vendored
+13
-8
@@ -1,4 +1,4 @@
|
||||
// Type definitions for non-npm package Node.js 11.9
|
||||
// Type definitions for non-npm package Node.js 11.10
|
||||
// Project: http://nodejs.org/
|
||||
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
||||
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
||||
@@ -35,18 +35,19 @@
|
||||
// Jeremie Rodriguez <https://github.com/jeremiergz>
|
||||
// Samuel Ainsworth <https://github.com/samuela>
|
||||
// Kyle Uehlein <https://github.com/kuehlein>
|
||||
// Jordi Oliveras Rovira <https://github.com/j-oliveras>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.1.
|
||||
// NOTE: These definitions support NodeJS and TypeScript 3.2.
|
||||
|
||||
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
||||
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
||||
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
|
||||
// - ~/ts3.1/index.d.ts - Definitions specific to TypeScript 3.1
|
||||
// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2
|
||||
|
||||
// NOTE: Augmentations for TypeScript 3.1 and later should use individual files for overrides
|
||||
// within the respective ~/ts3.1 (or later) folder. However, this is disallowed for versions
|
||||
// prior to TypeScript 3.1, so the older definitions will be found here.
|
||||
// NOTE: Augmentations for TypeScript 3.2 and later should use individual files for overrides
|
||||
// within the respective ~/ts3.2 (or later) folder. However, this is disallowed for versions
|
||||
// prior to TypeScript 3.2, so the older definitions will be found here.
|
||||
|
||||
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
||||
/// <reference path="base.d.ts" />
|
||||
@@ -54,6 +55,9 @@
|
||||
// TypeScript 2.1-specific augmentations:
|
||||
|
||||
// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)
|
||||
// Empty interfaces are used here which merge fine with the real declarations in the lib XXX files
|
||||
// just to ensure the names are known and node typings can be sued without importing these libs.
|
||||
// if someone really needs these types the libs need to be added via --lib or in tsconfig.json
|
||||
interface MapConstructor { }
|
||||
interface WeakMapConstructor { }
|
||||
interface SetConstructor { }
|
||||
@@ -72,8 +76,9 @@ interface SymbolConstructor {
|
||||
readonly asyncIterator: symbol;
|
||||
}
|
||||
declare var Symbol: SymbolConstructor;
|
||||
declare class SharedArrayBuffer {
|
||||
constructor(byteSize: number);
|
||||
// even this is just a forward declaration some properties are added otherwise
|
||||
// it would be allowed to pass anything to e.g. Buffer.from()
|
||||
interface SharedArrayBuffer {
|
||||
readonly byteLength: number;
|
||||
slice(begin?: number, end?: number): SharedArrayBuffer;
|
||||
}
|
||||
|
||||
+1
-1431
File diff suppressed because it is too large
Load Diff
@@ -2,10 +2,10 @@
|
||||
"private": true,
|
||||
"types": "index",
|
||||
"typesVersions": {
|
||||
">=3.1.0-0": {
|
||||
">=3.2.0-0": {
|
||||
"*": [
|
||||
"ts3.1/*"
|
||||
"ts3.2/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+63
@@ -238,4 +238,67 @@ declare module "perf_hooks" {
|
||||
}
|
||||
|
||||
const performance: Performance;
|
||||
|
||||
interface EventLoopMonitorOptions {
|
||||
/**
|
||||
* The sampling rate in milliseconds.
|
||||
* Must be greater than zero.
|
||||
* @default 10
|
||||
*/
|
||||
resolution?: number;
|
||||
}
|
||||
|
||||
interface EventLoopDelayMonitor {
|
||||
/**
|
||||
* Enables the event loop delay sample timer. Returns `true` if the timer was started, `false` if it was already started.
|
||||
*/
|
||||
enable(): boolean;
|
||||
/**
|
||||
* Disables the event loop delay sample timer. Returns `true` if the timer was stopped, `false` if it was already stopped.
|
||||
*/
|
||||
disable(): boolean;
|
||||
|
||||
/**
|
||||
* Resets the collected histogram data.
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
/**
|
||||
* Returns the value at the given percentile.
|
||||
* @param percentile A percentile value between 1 and 100.
|
||||
*/
|
||||
percentile(percentile: number): number;
|
||||
|
||||
/**
|
||||
* A `Map` object detailing the accumulated percentile distribution.
|
||||
*/
|
||||
readonly percentiles: Map<number, number>;
|
||||
|
||||
/**
|
||||
* The number of times the event loop delay exceeded the maximum 1 hour eventloop delay threshold.
|
||||
*/
|
||||
readonly exceeds: number;
|
||||
|
||||
/**
|
||||
* The minimum recorded event loop delay.
|
||||
*/
|
||||
readonly min: number;
|
||||
|
||||
/**
|
||||
* The maximum recorded event loop delay.
|
||||
*/
|
||||
readonly max: number;
|
||||
|
||||
/**
|
||||
* The mean of the recorded event loop delays.
|
||||
*/
|
||||
readonly mean: number;
|
||||
|
||||
/**
|
||||
* The standard deviation of the recorded event loop delays.
|
||||
*/
|
||||
readonly stddev: number;
|
||||
}
|
||||
|
||||
function monitorEventLoopDelay(options?: EventLoopMonitorOptions): EventLoopDelayMonitor;
|
||||
}
|
||||
|
||||
Vendored
+10
@@ -260,6 +260,16 @@ declare module "repl" {
|
||||
*/
|
||||
clearBufferedCommand(): void;
|
||||
|
||||
/**
|
||||
* Initializes a history log file for the REPL instance. When executing the
|
||||
* Node.js binary and using the command line REPL, a history file is initialized
|
||||
* by default. However, this is not the case when creating a REPL
|
||||
* programmatically. Use this method to initialize a history log file when working
|
||||
* with REPL instances programmatically.
|
||||
* @param path The path to the history file
|
||||
*/
|
||||
setupHistory(path: string, cb: (err: Error | null, repl: this) => void): void;
|
||||
|
||||
/**
|
||||
* events.EventEmitter
|
||||
* 1. close - inherited from `readline.Interface`
|
||||
|
||||
Vendored
+2
@@ -288,6 +288,8 @@ declare module "stream" {
|
||||
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream>,
|
||||
): Promise<void>;
|
||||
}
|
||||
|
||||
interface Pipe { }
|
||||
}
|
||||
|
||||
export = internal;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Specifically test buffer module regression.
|
||||
import { Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer } from "buffer";
|
||||
import { Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer, transcode, TranscodeEncoding } from "buffer";
|
||||
|
||||
const utf8Buffer = new Buffer('test');
|
||||
const base64Buffer = new Buffer('', 'base64');
|
||||
@@ -38,7 +38,8 @@ const result2 = Buffer.concat([utf8Buffer, base64Buffer], 9999999);
|
||||
const arrUint8: Uint8Array = new Uint8Array(2);
|
||||
const buf5: Buffer = Buffer.from(arrUint8);
|
||||
const buf6: Buffer = Buffer.from(buf1);
|
||||
const buf7: Buffer = Buffer.from(new SharedArrayBuffer(123));
|
||||
const sb: SharedArrayBuffer = {} as any;
|
||||
const buf7: Buffer = Buffer.from(sb);
|
||||
}
|
||||
|
||||
// Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]])
|
||||
@@ -208,3 +209,12 @@ b.fill('a').fill('b');
|
||||
let res: Buffer = b.reverse();
|
||||
res = b.subarray(1);
|
||||
}
|
||||
|
||||
// Buffer module, transcode function
|
||||
{
|
||||
transcode(Buffer.from('€'), 'utf8', 'ascii'); // $ExpectType Buffer
|
||||
|
||||
const source: TranscodeEncoding = 'utf8';
|
||||
const target: TranscodeEncoding = 'ascii';
|
||||
transcode(Buffer.from('€'), source, target); // $ExpectType Buffer
|
||||
}
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
import * as childProcess from 'child_process';
|
||||
import * as net from 'net';
|
||||
import * as fs from 'fs';
|
||||
import * as assert from 'assert';
|
||||
import { promisify } from 'util';
|
||||
import { Writable, Readable, Pipe } from 'stream';
|
||||
|
||||
{
|
||||
childProcess.exec("echo test");
|
||||
childProcess.exec("echo test", { windowsHide: true });
|
||||
childProcess.spawn("echo");
|
||||
childProcess.spawn("echo", { windowsHide: true });
|
||||
childProcess.spawn("echo", ["test"], { windowsHide: true });
|
||||
childProcess.spawn("echo", ["test"], { windowsHide: true, argv0: "echo-test" });
|
||||
childProcess.spawn("echo", ["test"], { stdio: [0xdeadbeef, "inherit", undefined, "pipe"] });
|
||||
childProcess.spawnSync("echo test");
|
||||
childProcess.spawnSync("echo test", {windowsVerbatimArguments: false});
|
||||
childProcess.spawnSync("echo test", {windowsVerbatimArguments: false, argv0: "echo-test"});
|
||||
childProcess.spawnSync("echo test", {input: new Uint8Array([])});
|
||||
childProcess.spawnSync("echo test", {input: new DataView(new ArrayBuffer(1))});
|
||||
}
|
||||
|
||||
{
|
||||
childProcess.execFile("npm", () => {});
|
||||
childProcess.execFile("npm", { windowsHide: true }, () => {});
|
||||
childProcess.execFile("npm", ["-v"], () => {});
|
||||
childProcess.execFile("npm", ["-v"], { windowsHide: true, encoding: 'utf-8' }, (stdout, stderr) => { assert(stdout instanceof String); });
|
||||
childProcess.execFile("npm", ["-v"], { windowsHide: true, encoding: 'buffer' }, (stdout, stderr) => { assert(stdout instanceof Buffer); });
|
||||
childProcess.execFile("npm", { encoding: 'utf-8' }, (stdout, stderr) => { assert(stdout instanceof String); });
|
||||
childProcess.execFile("npm", { encoding: 'buffer' }, (stdout, stderr) => { assert(stdout instanceof Buffer); });
|
||||
}
|
||||
|
||||
{
|
||||
childProcess.execFileSync("echo test", {input: new Uint8Array([])});
|
||||
childProcess.execFileSync("echo test", {input: new DataView(new ArrayBuffer(1))});
|
||||
}
|
||||
|
||||
{
|
||||
const forked = childProcess.fork('./', ['asd'], {
|
||||
windowsVerbatimArguments: true,
|
||||
silent: false,
|
||||
stdio: "inherit",
|
||||
execPath: '',
|
||||
execArgv: ['asda']
|
||||
});
|
||||
const ipc: Pipe = forked.channel!;
|
||||
}
|
||||
|
||||
async function testPromisify() {
|
||||
const execFile = promisify(childProcess.execFile);
|
||||
let r: { stdout: string | Buffer, stderr: string | Buffer } = await execFile("npm");
|
||||
r = await execFile("npm", ["-v"]);
|
||||
r = await execFile("npm", ["-v"], { encoding: 'utf-8' });
|
||||
r = await execFile("npm", ["-v"], { encoding: 'buffer' });
|
||||
r = await execFile("npm", { encoding: 'utf-8' });
|
||||
r = await execFile("npm", { encoding: 'buffer' });
|
||||
}
|
||||
|
||||
{
|
||||
let cp = childProcess.spawn('asd');
|
||||
const _socket: net.Socket = net.createConnection(1);
|
||||
const _server: net.Server = net.createServer();
|
||||
let _boolean: boolean;
|
||||
|
||||
_boolean = cp.send(1);
|
||||
_boolean = cp.send('one');
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
_boolean = cp.send('one', (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, _socket);
|
||||
_boolean = cp.send('one', _socket);
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _socket);
|
||||
|
||||
_boolean = cp.send(1, _socket, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
_boolean = cp.send('one', _socket, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _socket, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, _socket, {
|
||||
keepOpen: true
|
||||
});
|
||||
_boolean = cp.send('one', _socket, {
|
||||
keepOpen: true
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _socket, {
|
||||
keepOpen: true
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, _socket, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
_boolean = cp.send('one', _socket, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _socket, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, _server);
|
||||
_boolean = cp.send('one', _server);
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _server);
|
||||
|
||||
_boolean = cp.send(1, _server, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
_boolean = cp.send('one', _server, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _server, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, _server, {
|
||||
keepOpen: true
|
||||
});
|
||||
_boolean = cp.send('one', _server, {
|
||||
keepOpen: true
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _server, {
|
||||
keepOpen: true
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, _server, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
_boolean = cp.send('one', _server, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _server, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
});
|
||||
|
||||
const stdin: Writable | null = cp.stdio[0];
|
||||
const stdout: Readable | null = cp.stdio[1];
|
||||
const stderr: Readable | null = cp.stdio[2];
|
||||
const fd4: Readable | Writable | null = cp.stdio[3]!;
|
||||
const fd5: Readable | Writable | null = cp.stdio[4]!;
|
||||
|
||||
cp = cp.addListener("close", (code, signal) => {
|
||||
const _code: number = code;
|
||||
const _signal: string = signal;
|
||||
});
|
||||
cp = cp.addListener("disconnect", () => { });
|
||||
cp = cp.addListener("error", (err) => {
|
||||
const _err: Error = err;
|
||||
});
|
||||
cp = cp.addListener("exit", (code, signal) => {
|
||||
const _code: number | null = code;
|
||||
const _signal: string | null = signal;
|
||||
});
|
||||
cp = cp.addListener("message", (message, sendHandle) => {
|
||||
const _message: any = message;
|
||||
const _sendHandle: net.Socket | net.Server = sendHandle;
|
||||
});
|
||||
|
||||
_boolean = cp.emit("close", () => { });
|
||||
_boolean = cp.emit("disconnect", () => { });
|
||||
_boolean = cp.emit("error", () => { });
|
||||
_boolean = cp.emit("exit", () => { });
|
||||
_boolean = cp.emit("message", () => { });
|
||||
|
||||
cp = cp.on("close", (code, signal) => {
|
||||
const _code: number = code;
|
||||
const _signal: string = signal;
|
||||
});
|
||||
cp = cp.on("disconnect", () => { });
|
||||
cp = cp.on("error", (err) => {
|
||||
const _err: Error = err;
|
||||
});
|
||||
cp = cp.on("exit", (code, signal) => {
|
||||
const _code: number | null = code;
|
||||
const _signal: string | null = signal;
|
||||
});
|
||||
cp = cp.on("message", (message, sendHandle) => {
|
||||
const _message: any = message;
|
||||
const _sendHandle: net.Socket | net.Server = sendHandle;
|
||||
});
|
||||
|
||||
cp = cp.once("close", (code, signal) => {
|
||||
const _code: number = code;
|
||||
const _signal: string = signal;
|
||||
});
|
||||
cp = cp.once("disconnect", () => { });
|
||||
cp = cp.once("error", (err) => {
|
||||
const _err: Error = err;
|
||||
});
|
||||
cp = cp.once("exit", (code, signal) => {
|
||||
const _code: number | null = code;
|
||||
const _signal: string | null = signal;
|
||||
});
|
||||
cp = cp.once("message", (message, sendHandle) => {
|
||||
const _message: any = message;
|
||||
const _sendHandle: net.Socket | net.Server = sendHandle;
|
||||
});
|
||||
|
||||
cp = cp.prependListener("close", (code, signal) => {
|
||||
const _code: number = code;
|
||||
const _signal: string = signal;
|
||||
});
|
||||
cp = cp.prependListener("disconnect", () => { });
|
||||
cp = cp.prependListener("error", (err) => {
|
||||
const _err: Error = err;
|
||||
});
|
||||
cp = cp.prependListener("exit", (code, signal) => {
|
||||
const _code: number | null = code;
|
||||
const _signal: string | null = signal;
|
||||
});
|
||||
cp = cp.prependListener("message", (message, sendHandle) => {
|
||||
const _message: any = message;
|
||||
const _sendHandle: net.Socket | net.Server = sendHandle;
|
||||
});
|
||||
|
||||
cp = cp.prependOnceListener("close", (code, signal) => {
|
||||
const _code: number = code;
|
||||
const _signal: string = signal;
|
||||
});
|
||||
cp = cp.prependOnceListener("disconnect", () => { });
|
||||
cp = cp.prependOnceListener("error", (err) => {
|
||||
const _err: Error = err;
|
||||
});
|
||||
cp = cp.prependOnceListener("exit", (code, signal) => {
|
||||
const _code: number | null = code;
|
||||
const _signal: string | null = signal;
|
||||
});
|
||||
cp = cp.prependOnceListener("message", (message, sendHandle) => {
|
||||
const _message: any = message;
|
||||
const _sendHandle: net.Socket | net.Server = sendHandle;
|
||||
});
|
||||
}
|
||||
{
|
||||
process.stdin.setEncoding('utf8');
|
||||
|
||||
process.stdin.on('readable', () => {
|
||||
const chunk = process.stdin.read();
|
||||
if (chunk !== null) {
|
||||
process.stdout.write(`data: ${chunk}`);
|
||||
}
|
||||
});
|
||||
|
||||
process.stdin.on('end', () => {
|
||||
process.stdout.write('end');
|
||||
});
|
||||
|
||||
process.stdin.pipe(process.stdout);
|
||||
|
||||
console.log(process.stdin.isTTY);
|
||||
console.log(process.stdout.isTTY);
|
||||
|
||||
console.log(process.stdin instanceof net.Socket);
|
||||
console.log(process.stdout instanceof fs.ReadStream);
|
||||
|
||||
const stdin: Readable = process.stdin;
|
||||
console.log(stdin instanceof net.Socket);
|
||||
console.log(stdin instanceof fs.ReadStream);
|
||||
|
||||
const stdout: Writable = process.stdout;
|
||||
console.log(stdout instanceof net.Socket);
|
||||
console.log(stdout instanceof fs.WriteStream);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ import { promisify } from 'util';
|
||||
}
|
||||
|
||||
{
|
||||
const key = 'keykeykeykeykeykeykeykey';
|
||||
const key: string | null = 'keykeykeykeykeykeykeykey';
|
||||
const nonce = crypto.randomBytes(12);
|
||||
const aad = Buffer.from('0123456789', 'hex');
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ import * as net from 'net';
|
||||
res.addTrailers({ 'x-foo': 'bar' });
|
||||
|
||||
// writeHead
|
||||
res.writeHead(200, 'OK\r\nContent-Type: text/html\r\n');
|
||||
res.writeHead(200, 'OK\r\nContent-Type: text/html\r\n').end();
|
||||
res.writeHead(200, { 'Transfer-Encoding': 'chunked' });
|
||||
res.writeHead(200);
|
||||
|
||||
@@ -112,6 +112,9 @@ import * as net from 'net';
|
||||
|
||||
// event
|
||||
req.on('data', () => { });
|
||||
|
||||
// path
|
||||
const path: string = req.path;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -0,0 +1,604 @@
|
||||
import {
|
||||
Settings,
|
||||
Http2Session,
|
||||
Http2Stream,
|
||||
ClientSessionRequestOptions,
|
||||
ClientHttp2Session,
|
||||
SessionState,
|
||||
StreamState,
|
||||
ClientHttp2Stream,
|
||||
IncomingHttpStatusHeader,
|
||||
ServerHttp2Stream,
|
||||
ServerStreamResponseOptions,
|
||||
ServerStreamFileResponseOptions,
|
||||
StatOptions,
|
||||
ServerStreamFileResponseOptionsWithError,
|
||||
Http2Server,
|
||||
Http2SecureServer,
|
||||
createSecureServer,
|
||||
Http2ServerRequest,
|
||||
Http2ServerResponse,
|
||||
SecureServerOptions,
|
||||
ClientSessionOptions,
|
||||
SecureClientSessionOptions,
|
||||
ServerHttp2Session,
|
||||
connect,
|
||||
getDefaultSettings,
|
||||
getPackedSettings,
|
||||
getUnpackedSettings,
|
||||
OutgoingHttpHeaders,
|
||||
IncomingHttpHeaders,
|
||||
createServer,
|
||||
constants,
|
||||
ServerOptions
|
||||
} from "http2";
|
||||
import { EventEmitter } from "events";
|
||||
import { Stats } from "fs";
|
||||
import { Socket, Server } from "net";
|
||||
import { TLSSocket } from "tls";
|
||||
import { Duplex, Readable } from "stream";
|
||||
import { URL } from 'url';
|
||||
|
||||
// Headers & Settings
|
||||
{
|
||||
const headers: OutgoingHttpHeaders = {
|
||||
':status': 200,
|
||||
'content-type': 'text-plain',
|
||||
ABC: ['has', 'more', 'than', 'one', 'value'],
|
||||
undef: undefined
|
||||
};
|
||||
|
||||
const settings: Settings = {
|
||||
headerTableSize: 0,
|
||||
enablePush: true,
|
||||
initialWindowSize: 0,
|
||||
maxFrameSize: 0,
|
||||
maxConcurrentStreams: 0,
|
||||
maxHeaderListSize: 0
|
||||
};
|
||||
}
|
||||
|
||||
// Http2Session
|
||||
{
|
||||
const http2Session: Http2Session = {} as any;
|
||||
const ee: EventEmitter = http2Session;
|
||||
|
||||
http2Session.on('close', () => {});
|
||||
http2Session.on('connect', (session: Http2Session, socket: Socket) => {});
|
||||
http2Session.on('error', (err: Error) => {});
|
||||
http2Session.on('frameError', (frameType: number, errorCode: number, streamID: number) => {});
|
||||
http2Session.on('goaway', (errorCode: number, lastStreamID: number, opaqueData: Buffer) => {});
|
||||
http2Session.on('localSettings', (settings: Settings) => {});
|
||||
http2Session.on('remoteSettings', (settings: Settings) => {});
|
||||
http2Session.on('stream', (stream: Http2Stream, headers: IncomingHttpHeaders, flags: number) => {});
|
||||
http2Session.on('timeout', () => {});
|
||||
http2Session.on('ping', () => {});
|
||||
|
||||
http2Session.destroy();
|
||||
|
||||
const alpnProtocol: string | undefined = http2Session.alpnProtocol;
|
||||
const destroyed: boolean | undefined = http2Session.destroyed;
|
||||
const encrypted: boolean | undefined = http2Session.encrypted;
|
||||
const originSet: string[] | undefined = http2Session.originSet;
|
||||
const pendingSettingsAck: boolean = http2Session.pendingSettingsAck;
|
||||
let settings: Settings = http2Session.localSettings;
|
||||
const closed: boolean = http2Session.closed;
|
||||
const connecting: boolean = http2Session.connecting;
|
||||
settings = http2Session.remoteSettings;
|
||||
|
||||
http2Session.ref();
|
||||
http2Session.unref();
|
||||
|
||||
const headers: OutgoingHttpHeaders = {};
|
||||
const options: ClientSessionRequestOptions = {
|
||||
endStream: true,
|
||||
exclusive: true,
|
||||
parent: 0,
|
||||
weight: 0,
|
||||
getTrailers: (trailers: OutgoingHttpHeaders) => {}
|
||||
};
|
||||
(http2Session as ClientHttp2Session).request();
|
||||
(http2Session as ClientHttp2Session).request(headers);
|
||||
(http2Session as ClientHttp2Session).request(headers, options);
|
||||
|
||||
const stream: Http2Stream = {} as any;
|
||||
http2Session.rstStream(stream);
|
||||
http2Session.rstStream(stream, 0);
|
||||
|
||||
http2Session.setTimeout(100, () => {});
|
||||
http2Session.close(() => {});
|
||||
|
||||
const socket: Socket | TLSSocket = http2Session.socket;
|
||||
let state: SessionState = http2Session.state;
|
||||
state = {
|
||||
effectiveLocalWindowSize: 0,
|
||||
effectiveRecvDataLength: 0,
|
||||
nextStreamID: 0,
|
||||
localWindowSize: 0,
|
||||
lastProcStreamID: 0,
|
||||
remoteWindowSize: 0,
|
||||
outboundQueueSize: 0,
|
||||
deflateDynamicTableSize: 0,
|
||||
inflateDynamicTableSize: 0
|
||||
};
|
||||
|
||||
http2Session.priority(stream, {
|
||||
exclusive: true,
|
||||
parent: 0,
|
||||
weight: 0,
|
||||
silent: true
|
||||
});
|
||||
|
||||
http2Session.settings(settings);
|
||||
|
||||
http2Session.ping((err: Error | null, duration: number, payload: Buffer) => {});
|
||||
http2Session.ping(Buffer.from(''), (err: Error | null, duration: number, payload: Buffer) => {});
|
||||
http2Session.ping(new DataView(new Int8Array(1).buffer), (err: Error | null, duration: number, payload: Buffer) => {});
|
||||
}
|
||||
|
||||
// Http2Stream
|
||||
{
|
||||
const http2Stream: Http2Stream = {} as any;
|
||||
const duplex: Duplex = http2Stream;
|
||||
|
||||
http2Stream.on('aborted', () => {});
|
||||
http2Stream.on('error', (err: Error) => {});
|
||||
http2Stream.on('frameError', (frameType: number, errorCode: number, streamID: number) => {});
|
||||
http2Stream.on('streamClosed', (code: number) => {});
|
||||
http2Stream.on('timeout', () => {});
|
||||
http2Stream.on('trailers', (trailers: IncomingHttpHeaders, flags: number) => {});
|
||||
http2Stream.on('wantTrailers', () => {});
|
||||
|
||||
const aborted: boolean = http2Stream.aborted;
|
||||
const closed: boolean = http2Stream.closed;
|
||||
const destroyed: boolean = http2Stream.destroyed;
|
||||
const pending: boolean = http2Stream.pending;
|
||||
|
||||
http2Stream.priority({
|
||||
exclusive: true,
|
||||
parent: 0,
|
||||
weight: 0,
|
||||
silent: true
|
||||
});
|
||||
|
||||
const sesh: Http2Session = http2Stream.session;
|
||||
|
||||
http2Stream.setTimeout(100, () => {});
|
||||
|
||||
let state: StreamState = http2Stream.state;
|
||||
state = {
|
||||
localWindowSize: 0,
|
||||
state: 0,
|
||||
streamLocalClose: 0,
|
||||
streamRemoteClose: 0,
|
||||
sumDependencyWeight: 0,
|
||||
weight: 0
|
||||
};
|
||||
|
||||
http2Stream.close();
|
||||
http2Stream.close(0);
|
||||
http2Stream.close(0, () => {});
|
||||
http2Stream.close(undefined, () => {});
|
||||
|
||||
// ClientHttp2Stream
|
||||
const clientHttp2Stream: ClientHttp2Stream = {} as any;
|
||||
clientHttp2Stream.on('headers', (headers: IncomingHttpHeaders, flags: number) => {});
|
||||
clientHttp2Stream.on('push', (headers: IncomingHttpHeaders, flags: number) => {});
|
||||
clientHttp2Stream.on('response', (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => {
|
||||
const s: number = headers[':status']!;
|
||||
});
|
||||
|
||||
// ServerHttp2Stream
|
||||
const serverHttp2Stream: ServerHttp2Stream = {} as any;
|
||||
const headers: OutgoingHttpHeaders = {};
|
||||
|
||||
serverHttp2Stream.additionalHeaders(headers);
|
||||
const headerSent: boolean = serverHttp2Stream.headersSent;
|
||||
const pushAllowed: boolean = serverHttp2Stream.pushAllowed;
|
||||
serverHttp2Stream.pushStream(headers, (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => {});
|
||||
|
||||
const options: ServerStreamResponseOptions = {
|
||||
endStream: true,
|
||||
waitForTrailers: true,
|
||||
};
|
||||
serverHttp2Stream.respond();
|
||||
serverHttp2Stream.respond(headers);
|
||||
serverHttp2Stream.respond(headers, options);
|
||||
|
||||
const options2: ServerStreamFileResponseOptions = {
|
||||
statCheck: (stats: Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => {},
|
||||
getTrailers: (trailers: OutgoingHttpHeaders) => {},
|
||||
offset: 0,
|
||||
length: 0
|
||||
};
|
||||
serverHttp2Stream.respondWithFD(0);
|
||||
serverHttp2Stream.respondWithFD(0, headers);
|
||||
serverHttp2Stream.respondWithFD(0, headers, options2);
|
||||
serverHttp2Stream.respondWithFD(0, headers, {statCheck: () => false});
|
||||
const options3: ServerStreamFileResponseOptionsWithError = {
|
||||
onError: (err: NodeJS.ErrnoException) => {},
|
||||
statCheck: (stats: Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => {},
|
||||
getTrailers: (trailers: OutgoingHttpHeaders) => {},
|
||||
offset: 0,
|
||||
length: 0
|
||||
};
|
||||
serverHttp2Stream.respondWithFile('');
|
||||
serverHttp2Stream.respondWithFile('', headers);
|
||||
serverHttp2Stream.respondWithFile('', headers, options3);
|
||||
serverHttp2Stream.respondWithFile('', headers, {statCheck: () => false});
|
||||
}
|
||||
|
||||
// Http2Server / Http2SecureServer
|
||||
{
|
||||
const http2Server: Http2Server = createServer();
|
||||
const http2SecureServer: Http2SecureServer = createSecureServer();
|
||||
const s1: Server = http2Server;
|
||||
const s2: Server = http2SecureServer;
|
||||
[http2Server, http2SecureServer].forEach((server) => {
|
||||
server.on('sessionError', (err: Error) => {});
|
||||
server.on('checkContinue', (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => {});
|
||||
server.on('stream', (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => {});
|
||||
server.on('request', (request: Http2ServerRequest, response: Http2ServerResponse) => {});
|
||||
server.on('timeout', () => {});
|
||||
});
|
||||
|
||||
http2SecureServer.on('unknownProtocol', (socket: TLSSocket) => {});
|
||||
}
|
||||
|
||||
// Public API (except constants)
|
||||
{
|
||||
let settings: Settings = {
|
||||
};
|
||||
const serverOptions: ServerOptions = {
|
||||
maxDeflateDynamicTableSize: 0,
|
||||
maxReservedRemoteStreams: 0,
|
||||
maxSendHeaderBlockLength: 0,
|
||||
paddingStrategy: 0,
|
||||
peerMaxConcurrentStreams: 0,
|
||||
selectPadding: (frameLen: number, maxFrameLen: number) => 0,
|
||||
settings,
|
||||
allowHTTP1: true
|
||||
};
|
||||
// tslint:disable-next-line prefer-object-spread (ts2.1 feature)
|
||||
const secureServerOptions: SecureServerOptions = Object.assign({}, serverOptions);
|
||||
secureServerOptions.ca = '';
|
||||
const onRequestHandler = (request: Http2ServerRequest, response: Http2ServerResponse) => {
|
||||
// Http2ServerRequest
|
||||
|
||||
const readable: Readable = request;
|
||||
let incomingHeaders: IncomingHttpHeaders = request.headers;
|
||||
incomingHeaders = request.trailers;
|
||||
const httpVersion: string = request.httpVersion;
|
||||
let method: string = request.method;
|
||||
let rawHeaders: string[] = request.rawHeaders;
|
||||
rawHeaders = request.rawTrailers;
|
||||
let socket: Socket | TLSSocket = request.socket;
|
||||
let stream: ServerHttp2Stream = request.stream;
|
||||
const url: string = request.url;
|
||||
|
||||
request.setTimeout(0, () => {});
|
||||
request.on('aborted', (hadError: boolean, code: number) => {});
|
||||
|
||||
// Http2ServerResponse
|
||||
|
||||
let outgoingHeaders: OutgoingHttpHeaders = {
|
||||
};
|
||||
response.addTrailers(outgoingHeaders);
|
||||
socket = response.connection;
|
||||
const finished: boolean = response.finished;
|
||||
response.sendDate = true;
|
||||
response.statusCode = 200;
|
||||
response.statusMessage = '';
|
||||
socket = response.socket;
|
||||
stream = response.stream;
|
||||
|
||||
method = response.getHeader(':method');
|
||||
const headers: string[] = response.getHeaderNames();
|
||||
outgoingHeaders = response.getHeaders();
|
||||
const hasMethod = response.hasHeader(':method');
|
||||
response.removeHeader(':method');
|
||||
response.setHeader(':method', 'GET');
|
||||
response.setHeader(':status', 200);
|
||||
response.setHeader('some-list', ['', '']);
|
||||
const headersSent: boolean = response.headersSent;
|
||||
|
||||
response.setTimeout(0, () => {});
|
||||
response.createPushResponse(outgoingHeaders, (err: Error | null, res: Http2ServerResponse) => {});
|
||||
|
||||
response.writeContinue();
|
||||
response.writeHead(200).end();
|
||||
response.writeHead(200, outgoingHeaders);
|
||||
response.writeHead(200, 'OK', outgoingHeaders);
|
||||
response.writeHead(200, 'OK');
|
||||
response.write('');
|
||||
response.write('', (err: Error) => {});
|
||||
response.write('', 'utf8');
|
||||
response.write('', 'utf8', (err: Error) => {});
|
||||
response.write(Buffer.from([]));
|
||||
response.write(Buffer.from([]), (err: Error) => {});
|
||||
response.write(Buffer.from([]), 'utf8');
|
||||
response.write(Buffer.from([]), 'utf8', (err: Error) => {});
|
||||
response.end();
|
||||
response.end(() => {});
|
||||
response.end('');
|
||||
response.end('', () => {});
|
||||
response.end('', 'utf8');
|
||||
response.end('', 'utf8', () => {});
|
||||
response.end(Buffer.from([]));
|
||||
response.end(Buffer.from([]), () => {});
|
||||
response.end(Buffer.from([]), 'utf8');
|
||||
response.end(Buffer.from([]), 'utf8', () => {});
|
||||
|
||||
request.on('aborted', (hadError: boolean, code: number) => {});
|
||||
request.on('close', () => {});
|
||||
request.on('drain', () => {});
|
||||
request.on('error', (error: Error) => {});
|
||||
request.on('finish', () => {});
|
||||
};
|
||||
|
||||
let http2Server: Http2Server;
|
||||
let http2SecureServer: Http2SecureServer;
|
||||
|
||||
http2Server = createServer();
|
||||
http2Server = createServer(serverOptions);
|
||||
http2Server = createServer(onRequestHandler);
|
||||
http2Server = createServer(serverOptions, onRequestHandler);
|
||||
|
||||
http2SecureServer = createSecureServer();
|
||||
http2SecureServer = createSecureServer(secureServerOptions);
|
||||
http2SecureServer = createSecureServer(onRequestHandler);
|
||||
http2SecureServer = createSecureServer(secureServerOptions, onRequestHandler);
|
||||
|
||||
const clientSessionOptions: ClientSessionOptions = {
|
||||
maxDeflateDynamicTableSize: 0,
|
||||
maxReservedRemoteStreams: 0,
|
||||
maxSendHeaderBlockLength: 0,
|
||||
paddingStrategy: 0,
|
||||
peerMaxConcurrentStreams: 0,
|
||||
selectPadding: (frameLen: number, maxFrameLen: number) => 0,
|
||||
settings
|
||||
};
|
||||
// tslint:disable-next-line prefer-object-spread (ts2.1 feature)
|
||||
const secureClientSessionOptions: SecureClientSessionOptions = Object.assign({}, clientSessionOptions);
|
||||
secureClientSessionOptions.ca = '';
|
||||
const onConnectHandler = (session: Http2Session, socket: Socket) => {};
|
||||
|
||||
const serverHttp2Session: ServerHttp2Session = {} as any;
|
||||
|
||||
serverHttp2Session.altsvc('', '');
|
||||
serverHttp2Session.altsvc('', 0);
|
||||
serverHttp2Session.altsvc('', new URL(''));
|
||||
serverHttp2Session.altsvc('', { origin: '' });
|
||||
serverHttp2Session.altsvc('', { origin: 0 });
|
||||
serverHttp2Session.altsvc('', { origin: new URL('') });
|
||||
|
||||
let clientHttp2Session: ClientHttp2Session;
|
||||
|
||||
clientHttp2Session = connect('');
|
||||
clientHttp2Session = connect('', onConnectHandler);
|
||||
clientHttp2Session = connect('', clientSessionOptions);
|
||||
clientHttp2Session = connect('', clientSessionOptions, onConnectHandler);
|
||||
clientHttp2Session = connect('', secureClientSessionOptions);
|
||||
clientHttp2Session = connect('', secureClientSessionOptions, onConnectHandler);
|
||||
clientHttp2Session.on('altsvc', (alt: string, origin: string, number: number) => {});
|
||||
|
||||
settings = getDefaultSettings();
|
||||
settings = getPackedSettings(settings);
|
||||
settings = getUnpackedSettings(Buffer.from([]));
|
||||
settings = getUnpackedSettings(Uint8Array.from([]));
|
||||
}
|
||||
|
||||
// constants
|
||||
{
|
||||
const consts = constants;
|
||||
let num: number;
|
||||
let str: string;
|
||||
num = consts.NGHTTP2_SESSION_SERVER;
|
||||
num = consts.NGHTTP2_SESSION_CLIENT;
|
||||
num = consts.NGHTTP2_STREAM_STATE_IDLE;
|
||||
num = consts.NGHTTP2_STREAM_STATE_OPEN;
|
||||
num = consts.NGHTTP2_STREAM_STATE_RESERVED_LOCAL;
|
||||
num = consts.NGHTTP2_STREAM_STATE_RESERVED_REMOTE;
|
||||
num = consts.NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL;
|
||||
num = consts.NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
|
||||
num = consts.NGHTTP2_STREAM_STATE_CLOSED;
|
||||
num = consts.NGHTTP2_NO_ERROR;
|
||||
num = consts.NGHTTP2_PROTOCOL_ERROR;
|
||||
num = consts.NGHTTP2_INTERNAL_ERROR;
|
||||
num = consts.NGHTTP2_FLOW_CONTROL_ERROR;
|
||||
num = consts.NGHTTP2_SETTINGS_TIMEOUT;
|
||||
num = consts.NGHTTP2_STREAM_CLOSED;
|
||||
num = consts.NGHTTP2_FRAME_SIZE_ERROR;
|
||||
num = consts.NGHTTP2_REFUSED_STREAM;
|
||||
num = consts.NGHTTP2_CANCEL;
|
||||
num = consts.NGHTTP2_COMPRESSION_ERROR;
|
||||
num = consts.NGHTTP2_CONNECT_ERROR;
|
||||
num = consts.NGHTTP2_ENHANCE_YOUR_CALM;
|
||||
num = consts.NGHTTP2_INADEQUATE_SECURITY;
|
||||
num = consts.NGHTTP2_HTTP_1_1_REQUIRED;
|
||||
num = consts.NGHTTP2_ERR_FRAME_SIZE_ERROR;
|
||||
num = consts.NGHTTP2_FLAG_NONE;
|
||||
num = consts.NGHTTP2_FLAG_END_STREAM;
|
||||
num = consts.NGHTTP2_FLAG_END_HEADERS;
|
||||
num = consts.NGHTTP2_FLAG_ACK;
|
||||
num = consts.NGHTTP2_FLAG_PADDED;
|
||||
num = consts.NGHTTP2_FLAG_PRIORITY;
|
||||
num = consts.DEFAULT_SETTINGS_HEADER_TABLE_SIZE;
|
||||
num = consts.DEFAULT_SETTINGS_ENABLE_PUSH;
|
||||
num = consts.DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE;
|
||||
num = consts.DEFAULT_SETTINGS_MAX_FRAME_SIZE;
|
||||
num = consts.MAX_MAX_FRAME_SIZE;
|
||||
num = consts.MIN_MAX_FRAME_SIZE;
|
||||
num = consts.MAX_INITIAL_WINDOW_SIZE;
|
||||
num = consts.NGHTTP2_DEFAULT_WEIGHT;
|
||||
num = consts.NGHTTP2_SETTINGS_HEADER_TABLE_SIZE;
|
||||
num = consts.NGHTTP2_SETTINGS_ENABLE_PUSH;
|
||||
num = consts.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;
|
||||
num = consts.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
|
||||
num = consts.NGHTTP2_SETTINGS_MAX_FRAME_SIZE;
|
||||
num = consts.NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE;
|
||||
num = consts.PADDING_STRATEGY_NONE;
|
||||
num = consts.PADDING_STRATEGY_MAX;
|
||||
num = consts.PADDING_STRATEGY_CALLBACK;
|
||||
num = consts.HTTP_STATUS_CONTINUE;
|
||||
num = consts.HTTP_STATUS_SWITCHING_PROTOCOLS;
|
||||
num = consts.HTTP_STATUS_PROCESSING;
|
||||
num = consts.HTTP_STATUS_OK;
|
||||
num = consts.HTTP_STATUS_CREATED;
|
||||
num = consts.HTTP_STATUS_ACCEPTED;
|
||||
num = consts.HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION;
|
||||
num = consts.HTTP_STATUS_NO_CONTENT;
|
||||
num = consts.HTTP_STATUS_RESET_CONTENT;
|
||||
num = consts.HTTP_STATUS_PARTIAL_CONTENT;
|
||||
num = consts.HTTP_STATUS_MULTI_STATUS;
|
||||
num = consts.HTTP_STATUS_ALREADY_REPORTED;
|
||||
num = consts.HTTP_STATUS_IM_USED;
|
||||
num = consts.HTTP_STATUS_MULTIPLE_CHOICES;
|
||||
num = consts.HTTP_STATUS_MOVED_PERMANENTLY;
|
||||
num = consts.HTTP_STATUS_FOUND;
|
||||
num = consts.HTTP_STATUS_SEE_OTHER;
|
||||
num = consts.HTTP_STATUS_NOT_MODIFIED;
|
||||
num = consts.HTTP_STATUS_USE_PROXY;
|
||||
num = consts.HTTP_STATUS_TEMPORARY_REDIRECT;
|
||||
num = consts.HTTP_STATUS_PERMANENT_REDIRECT;
|
||||
num = consts.HTTP_STATUS_BAD_REQUEST;
|
||||
num = consts.HTTP_STATUS_UNAUTHORIZED;
|
||||
num = consts.HTTP_STATUS_PAYMENT_REQUIRED;
|
||||
num = consts.HTTP_STATUS_FORBIDDEN;
|
||||
num = consts.HTTP_STATUS_NOT_FOUND;
|
||||
num = consts.HTTP_STATUS_METHOD_NOT_ALLOWED;
|
||||
num = consts.HTTP_STATUS_NOT_ACCEPTABLE;
|
||||
num = consts.HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED;
|
||||
num = consts.HTTP_STATUS_REQUEST_TIMEOUT;
|
||||
num = consts.HTTP_STATUS_CONFLICT;
|
||||
num = consts.HTTP_STATUS_GONE;
|
||||
num = consts.HTTP_STATUS_LENGTH_REQUIRED;
|
||||
num = consts.HTTP_STATUS_PRECONDITION_FAILED;
|
||||
num = consts.HTTP_STATUS_PAYLOAD_TOO_LARGE;
|
||||
num = consts.HTTP_STATUS_URI_TOO_LONG;
|
||||
num = consts.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE;
|
||||
num = consts.HTTP_STATUS_RANGE_NOT_SATISFIABLE;
|
||||
num = consts.HTTP_STATUS_EXPECTATION_FAILED;
|
||||
num = consts.HTTP_STATUS_TEAPOT;
|
||||
num = consts.HTTP_STATUS_MISDIRECTED_REQUEST;
|
||||
num = consts.HTTP_STATUS_UNPROCESSABLE_ENTITY;
|
||||
num = consts.HTTP_STATUS_LOCKED;
|
||||
num = consts.HTTP_STATUS_FAILED_DEPENDENCY;
|
||||
num = consts.HTTP_STATUS_UNORDERED_COLLECTION;
|
||||
num = consts.HTTP_STATUS_UPGRADE_REQUIRED;
|
||||
num = consts.HTTP_STATUS_PRECONDITION_REQUIRED;
|
||||
num = consts.HTTP_STATUS_TOO_MANY_REQUESTS;
|
||||
num = consts.HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE;
|
||||
num = consts.HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS;
|
||||
num = consts.HTTP_STATUS_INTERNAL_SERVER_ERROR;
|
||||
num = consts.HTTP_STATUS_NOT_IMPLEMENTED;
|
||||
num = consts.HTTP_STATUS_BAD_GATEWAY;
|
||||
num = consts.HTTP_STATUS_SERVICE_UNAVAILABLE;
|
||||
num = consts.HTTP_STATUS_GATEWAY_TIMEOUT;
|
||||
num = consts.HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED;
|
||||
num = consts.HTTP_STATUS_VARIANT_ALSO_NEGOTIATES;
|
||||
num = consts.HTTP_STATUS_INSUFFICIENT_STORAGE;
|
||||
num = consts.HTTP_STATUS_LOOP_DETECTED;
|
||||
num = consts.HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED;
|
||||
num = consts.HTTP_STATUS_NOT_EXTENDED;
|
||||
num = consts.HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED;
|
||||
str = consts.HTTP2_HEADER_STATUS;
|
||||
str = consts.HTTP2_HEADER_METHOD;
|
||||
str = consts.HTTP2_HEADER_AUTHORITY;
|
||||
str = consts.HTTP2_HEADER_SCHEME;
|
||||
str = consts.HTTP2_HEADER_PATH;
|
||||
str = consts.HTTP2_HEADER_ACCEPT_CHARSET;
|
||||
str = consts.HTTP2_HEADER_ACCEPT_ENCODING;
|
||||
str = consts.HTTP2_HEADER_ACCEPT_LANGUAGE;
|
||||
str = consts.HTTP2_HEADER_ACCEPT_RANGES;
|
||||
str = consts.HTTP2_HEADER_ACCEPT;
|
||||
str = consts.HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN;
|
||||
str = consts.HTTP2_HEADER_AGE;
|
||||
str = consts.HTTP2_HEADER_ALLOW;
|
||||
str = consts.HTTP2_HEADER_AUTHORIZATION;
|
||||
str = consts.HTTP2_HEADER_CACHE_CONTROL;
|
||||
str = consts.HTTP2_HEADER_CONNECTION;
|
||||
str = consts.HTTP2_HEADER_CONTENT_DISPOSITION;
|
||||
str = consts.HTTP2_HEADER_CONTENT_ENCODING;
|
||||
str = consts.HTTP2_HEADER_CONTENT_LANGUAGE;
|
||||
str = consts.HTTP2_HEADER_CONTENT_LENGTH;
|
||||
str = consts.HTTP2_HEADER_CONTENT_LOCATION;
|
||||
str = consts.HTTP2_HEADER_CONTENT_MD5;
|
||||
str = consts.HTTP2_HEADER_CONTENT_RANGE;
|
||||
str = consts.HTTP2_HEADER_CONTENT_TYPE;
|
||||
str = consts.HTTP2_HEADER_COOKIE;
|
||||
str = consts.HTTP2_HEADER_DATE;
|
||||
str = consts.HTTP2_HEADER_ETAG;
|
||||
str = consts.HTTP2_HEADER_EXPECT;
|
||||
str = consts.HTTP2_HEADER_EXPIRES;
|
||||
str = consts.HTTP2_HEADER_FROM;
|
||||
str = consts.HTTP2_HEADER_HOST;
|
||||
str = consts.HTTP2_HEADER_IF_MATCH;
|
||||
str = consts.HTTP2_HEADER_IF_MODIFIED_SINCE;
|
||||
str = consts.HTTP2_HEADER_IF_NONE_MATCH;
|
||||
str = consts.HTTP2_HEADER_IF_RANGE;
|
||||
str = consts.HTTP2_HEADER_IF_UNMODIFIED_SINCE;
|
||||
str = consts.HTTP2_HEADER_LAST_MODIFIED;
|
||||
str = consts.HTTP2_HEADER_LINK;
|
||||
str = consts.HTTP2_HEADER_LOCATION;
|
||||
str = consts.HTTP2_HEADER_MAX_FORWARDS;
|
||||
str = consts.HTTP2_HEADER_PREFER;
|
||||
str = consts.HTTP2_HEADER_PROXY_AUTHENTICATE;
|
||||
str = consts.HTTP2_HEADER_PROXY_AUTHORIZATION;
|
||||
str = consts.HTTP2_HEADER_RANGE;
|
||||
str = consts.HTTP2_HEADER_REFERER;
|
||||
str = consts.HTTP2_HEADER_REFRESH;
|
||||
str = consts.HTTP2_HEADER_RETRY_AFTER;
|
||||
str = consts.HTTP2_HEADER_SERVER;
|
||||
str = consts.HTTP2_HEADER_SET_COOKIE;
|
||||
str = consts.HTTP2_HEADER_STRICT_TRANSPORT_SECURITY;
|
||||
str = consts.HTTP2_HEADER_TRANSFER_ENCODING;
|
||||
str = consts.HTTP2_HEADER_TE;
|
||||
str = consts.HTTP2_HEADER_UPGRADE;
|
||||
str = consts.HTTP2_HEADER_USER_AGENT;
|
||||
str = consts.HTTP2_HEADER_VARY;
|
||||
str = consts.HTTP2_HEADER_VIA;
|
||||
str = consts.HTTP2_HEADER_WWW_AUTHENTICATE;
|
||||
str = consts.HTTP2_HEADER_HTTP2_SETTINGS;
|
||||
str = consts.HTTP2_HEADER_KEEP_ALIVE;
|
||||
str = consts.HTTP2_HEADER_PROXY_CONNECTION;
|
||||
str = consts.HTTP2_METHOD_ACL;
|
||||
str = consts.HTTP2_METHOD_BASELINE_CONTROL;
|
||||
str = consts.HTTP2_METHOD_BIND;
|
||||
str = consts.HTTP2_METHOD_CHECKIN;
|
||||
str = consts.HTTP2_METHOD_CHECKOUT;
|
||||
str = consts.HTTP2_METHOD_CONNECT;
|
||||
str = consts.HTTP2_METHOD_COPY;
|
||||
str = consts.HTTP2_METHOD_DELETE;
|
||||
str = consts.HTTP2_METHOD_GET;
|
||||
str = consts.HTTP2_METHOD_HEAD;
|
||||
str = consts.HTTP2_METHOD_LABEL;
|
||||
str = consts.HTTP2_METHOD_LINK;
|
||||
str = consts.HTTP2_METHOD_LOCK;
|
||||
str = consts.HTTP2_METHOD_MERGE;
|
||||
str = consts.HTTP2_METHOD_MKACTIVITY;
|
||||
str = consts.HTTP2_METHOD_MKCALENDAR;
|
||||
str = consts.HTTP2_METHOD_MKCOL;
|
||||
str = consts.HTTP2_METHOD_MKREDIRECTREF;
|
||||
str = consts.HTTP2_METHOD_MKWORKSPACE;
|
||||
str = consts.HTTP2_METHOD_MOVE;
|
||||
str = consts.HTTP2_METHOD_OPTIONS;
|
||||
str = consts.HTTP2_METHOD_ORDERPATCH;
|
||||
str = consts.HTTP2_METHOD_PATCH;
|
||||
str = consts.HTTP2_METHOD_POST;
|
||||
str = consts.HTTP2_METHOD_PRI;
|
||||
str = consts.HTTP2_METHOD_PROPFIND;
|
||||
str = consts.HTTP2_METHOD_PROPPATCH;
|
||||
str = consts.HTTP2_METHOD_PUT;
|
||||
str = consts.HTTP2_METHOD_REBIND;
|
||||
str = consts.HTTP2_METHOD_REPORT;
|
||||
str = consts.HTTP2_METHOD_SEARCH;
|
||||
str = consts.HTTP2_METHOD_TRACE;
|
||||
str = consts.HTTP2_METHOD_UNBIND;
|
||||
str = consts.HTTP2_METHOD_UNCHECKOUT;
|
||||
str = consts.HTTP2_METHOD_UNLINK;
|
||||
str = consts.HTTP2_METHOD_UNLOCK;
|
||||
str = consts.HTTP2_METHOD_UPDATE;
|
||||
str = consts.HTTP2_METHOD_UPDATEREDIRECTREF;
|
||||
str = consts.HTTP2_METHOD_VERSION_CONTROL;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { performance, monitorEventLoopDelay, PerformanceObserverCallback, PerformanceObserver } from 'perf_hooks';
|
||||
|
||||
performance.mark('start');
|
||||
(
|
||||
() => {}
|
||||
)();
|
||||
performance.mark('end');
|
||||
|
||||
const { duration } = performance.getEntriesByName('discover')[0];
|
||||
const timeOrigin = performance.timeOrigin;
|
||||
|
||||
const performanceObserverCallback: PerformanceObserverCallback = (list, obs) => {
|
||||
const {
|
||||
duration,
|
||||
entryType,
|
||||
name,
|
||||
startTime,
|
||||
} = list.getEntries()[0];
|
||||
obs.disconnect();
|
||||
performance.clearFunctions();
|
||||
};
|
||||
const obs = new PerformanceObserver(performanceObserverCallback);
|
||||
obs.observe({
|
||||
entryTypes: ['function'],
|
||||
buffered: true,
|
||||
});
|
||||
|
||||
const monitor = monitorEventLoopDelay({
|
||||
resolution: 42,
|
||||
});
|
||||
|
||||
monitor.enable();
|
||||
monitor.reset();
|
||||
monitor.disable();
|
||||
const perc: number = monitor.percentile(99);
|
||||
const perc2: number | undefined = monitor.percentiles.get(42);
|
||||
|
||||
const min: number = monitor.min;
|
||||
const max: number = monitor.max;
|
||||
const mean: number = monitor.mean;
|
||||
const stddev: number = monitor.stddev;
|
||||
const exceeds: number = monitor.exceeds;
|
||||
@@ -0,0 +1,73 @@
|
||||
import { start, Recoverable } from "repl";
|
||||
import { Context } from "vm";
|
||||
|
||||
{
|
||||
let server = start();
|
||||
let _boolean: boolean;
|
||||
const _ctx: Context = {};
|
||||
|
||||
server.setupHistory('hurr/durr', (err, repl) => {
|
||||
});
|
||||
|
||||
server = server.addListener("exit", () => { });
|
||||
server = server.addListener("reset", () => { });
|
||||
|
||||
_boolean = server.emit("exit", () => { });
|
||||
_boolean = server.emit("reset", _ctx);
|
||||
|
||||
server = server.on("exit", () => { });
|
||||
server = server.on("reset", () => { });
|
||||
|
||||
server = server.once("exit", () => { });
|
||||
server = server.once("reset", () => { });
|
||||
|
||||
server = server.prependListener("exit", () => { });
|
||||
server = server.prependListener("reset", () => { });
|
||||
|
||||
server = server.prependOnceListener("exit", () => { });
|
||||
server = server.prependOnceListener("reset", () => { });
|
||||
|
||||
server.outputStream.write("test");
|
||||
const line = server.inputStream.read();
|
||||
|
||||
server.clearBufferedCommand();
|
||||
server.displayPrompt();
|
||||
server.displayPrompt(true);
|
||||
server.defineCommand("cmd", function(text) {
|
||||
// $ExpectType string
|
||||
text;
|
||||
// $ExpectType REPLServer
|
||||
this;
|
||||
});
|
||||
server.defineCommand("cmd", {
|
||||
help: "",
|
||||
action(text) {
|
||||
// $ExpectType string
|
||||
text;
|
||||
// $ExpectType REPLServer
|
||||
this;
|
||||
}
|
||||
});
|
||||
|
||||
start({
|
||||
eval() {
|
||||
// $ExpectType REPLServer
|
||||
this;
|
||||
},
|
||||
writer() {
|
||||
// $ExpectType REPLServer
|
||||
this;
|
||||
return "";
|
||||
}
|
||||
});
|
||||
|
||||
function test() {
|
||||
throw new Recoverable(new Error("test"));
|
||||
}
|
||||
|
||||
server.context['key0'] = 1;
|
||||
server.context['key1'] = "";
|
||||
server.context['key2'] = true;
|
||||
server.context['key3'] = [];
|
||||
server.context['key4'] = {};
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user