mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-10 20:20:12 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
@@ -3663,7 +3663,7 @@
|
||||
/types/onionoo/ @BendingBender
|
||||
/types/onoff/ @marcel-ernst @Kallu609
|
||||
/types/ontime/ @Hirse
|
||||
/types/open/ @Bartvds
|
||||
/types/open/ @shinnn @SomaticIT @tlent @ffflorian
|
||||
/types/open-editor/ @BendingBender
|
||||
/types/open-graph/ @ffflorian
|
||||
/types/openapi-factory/ @runebaas
|
||||
@@ -3681,7 +3681,6 @@
|
||||
/types/openstack-wrapper/ @sanjaymadane
|
||||
/types/opentok/ @westy92 @CatGuardian @pronebird
|
||||
/types/opentype.js/ @danmarshall @edzis
|
||||
/types/opn/ @shinnn @SomaticIT @tlent
|
||||
/types/opossum/ @quinnlangille @merufm @lance @mastermatt
|
||||
/types/optics-agent/ @crevil
|
||||
/types/optimist/ @soywiz @chbrown
|
||||
|
||||
@@ -332,5 +332,3 @@ Es más apropiado importar este módulo utilizando la sintaxis `import foo = req
|
||||
Este proyecto es licenciado bajo la licencia MIT.
|
||||
|
||||
Los derechos de autor de cada archivo de definición son respectivos de cada contribuidor listado al comienzo de cada archivo de definición.
|
||||
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
@@ -334,5 +334,3 @@ NPM 패키지의 경우, `node -p 'require("foo")'` 가 원하는 값이라면 `
|
||||
이 프로젝트는 MIT license 가 적용되어 있습니다.
|
||||
|
||||
각 자료형 정의(Type definition) 파일들의 저작권은 각 기여자들에게 있으며, 기여자들은 해당 자료형 정의(Type definition) 파일들의 맨 위에 나열되어 있습니다.
|
||||
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
@@ -452,5 +452,3 @@ GitHub doesn't [support](http://stackoverflow.com/questions/5646174/how-to-make-
|
||||
This project is licensed under the MIT license.
|
||||
|
||||
Copyrights on the definition files are respective of each contributor listed at the beginning of each definition file.
|
||||
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
@@ -346,8 +346,6 @@ GitHub не [поддерживает](http://stackoverflow.com/questions/564617
|
||||
|
||||
Авторские права на файлы определений принадлежат каждому участнику, указанному в начале каждого файла определения.
|
||||
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=13) В среднем пакеты публикуются на npm менее чем за 10000 секунд?
|
||||
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=14) Был ли typescript-bot активным на DefinitelyTyped в последние два часа?
|
||||
|
||||
@@ -1416,6 +1416,12 @@
|
||||
"sourceRepoURL": "http://onsen.io",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "opn",
|
||||
"typingsPackageName": "opn",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/opn",
|
||||
"asOfVersion": "5.5.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "ora",
|
||||
"typingsPackageName": "ora",
|
||||
@@ -2130,6 +2136,12 @@
|
||||
"sourceRepoURL": "https://servicestack.net/",
|
||||
"asOfVersion": "0.1.5"
|
||||
},
|
||||
{
|
||||
"libraryName": "@storybook/addon-notes",
|
||||
"typingsPackageName": "storybook__addon-notes",
|
||||
"sourceRepoURL": "https://github.com/storybooks/storybook",
|
||||
"asOfVersion": "5.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "striptags",
|
||||
"typingsPackageName": "striptags",
|
||||
|
||||
2
types/activestorage/index.d.ts
vendored
2
types/activestorage/index.d.ts
vendored
@@ -13,7 +13,7 @@ export class DirectUpload {
|
||||
file: File;
|
||||
url: string;
|
||||
|
||||
constructor(file: File, url: string, delegate: DirectUploadDelegate)
|
||||
constructor(file: File, url: string, delegate?: DirectUploadDelegate)
|
||||
|
||||
create(callback: (error: Error, blob: Blob) => void): void;
|
||||
}
|
||||
|
||||
@@ -104,12 +104,13 @@ AirbnbPropTypes.forbidExtraProps<ForbidShape>({
|
||||
// $ExpectType Requireable<number>
|
||||
AirbnbPropTypes.integer();
|
||||
|
||||
// $ExpectType Requireable<{}>
|
||||
AirbnbPropTypes.keysOf(PropTypes.number);
|
||||
// $ExpectType Requireable<{}>
|
||||
AirbnbPropTypes.keysOf(PropTypes.number, 'foo');
|
||||
// $ExpectType Requireable<{}>
|
||||
AirbnbPropTypes.keysOf(PropTypes.oneOf(['foo', 'bar']));
|
||||
const top = (<T>(x?: T): T => x!)();
|
||||
type Top = typeof top;
|
||||
declare function validateRequireableTop(x: React.Requireable<Top>): void;
|
||||
|
||||
validateRequireableTop(AirbnbPropTypes.keysOf(PropTypes.number));
|
||||
validateRequireableTop(AirbnbPropTypes.keysOf(PropTypes.number, 'foo'));
|
||||
validateRequireableTop(AirbnbPropTypes.keysOf(PropTypes.oneOf(['foo', 'bar'])));
|
||||
|
||||
// $ExpectType Requireable<number>
|
||||
AirbnbPropTypes.mutuallyExclusiveProps(PropTypes.number);
|
||||
@@ -137,8 +138,8 @@ AirbnbPropTypes.nonNegativeNumber();
|
||||
// $ExpectType Requireable<string>
|
||||
AirbnbPropTypes.numericString();
|
||||
|
||||
// $ExpectType Requireable<{}>
|
||||
AirbnbPropTypes.object();
|
||||
// $ExpectType Requireable<object>
|
||||
const props: PropTypes.Requireable<object> = AirbnbPropTypes.object();
|
||||
// $ExpectType Requireable<{ foo: string; }>
|
||||
AirbnbPropTypes.object<{ foo: string }>();
|
||||
|
||||
@@ -156,23 +157,17 @@ AirbnbPropTypes.requiredBy('foo', PropTypes.string);
|
||||
// $ExpectType Validator<number>
|
||||
AirbnbPropTypes.requiredBy('bar', PropTypes.number, 42).isRequired;
|
||||
|
||||
// $ExpectType Requireable<{}>
|
||||
AirbnbPropTypes.restrictedProp();
|
||||
// $ExpectType Requireable<{}>
|
||||
AirbnbPropTypes.restrictedProp(() => 'Error');
|
||||
// $ExpectType Requireable<{}>
|
||||
AirbnbPropTypes.restrictedProp(() => new Error('Error'));
|
||||
validateRequireableTop(AirbnbPropTypes.restrictedProp());
|
||||
validateRequireableTop(AirbnbPropTypes.restrictedProp(() => 'Error'));
|
||||
validateRequireableTop(AirbnbPropTypes.restrictedProp(() => new Error('Error')));
|
||||
|
||||
// $ExpectType Requireable<{}>
|
||||
AirbnbPropTypes.sequenceOf({ validator: PropTypes.number });
|
||||
// $ExpectType Requireable<{}>
|
||||
AirbnbPropTypes.sequenceOf({ validator: PropTypes.number }, { validator: PropTypes.string });
|
||||
// $ExpectType Requireable<{}>
|
||||
AirbnbPropTypes.sequenceOf(
|
||||
validateRequireableTop(AirbnbPropTypes.sequenceOf({ validator: PropTypes.number }));
|
||||
validateRequireableTop(AirbnbPropTypes.sequenceOf({ validator: PropTypes.number }, { validator: PropTypes.string }));
|
||||
validateRequireableTop(AirbnbPropTypes.sequenceOf(
|
||||
{ validator: PropTypes.number, min: 0, max: 10 },
|
||||
{ validator: PropTypes.string },
|
||||
{ validator: PropTypes.bool },
|
||||
);
|
||||
));
|
||||
|
||||
interface ShapeShape {
|
||||
foo: string;
|
||||
|
||||
19
types/arcgis-js-api/v3/index.d.ts
vendored
19
types/arcgis-js-api/v3/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for ArcGIS API for JavaScript 3.27
|
||||
// Type definitions for ArcGIS API for JavaScript 3.28
|
||||
// Project: https://developers.arcgis.com/javascript/3/
|
||||
// Definitions by: Esri <https://github.com/Esri>
|
||||
// Bjorn Svensson <https://github.com/bsvensson>
|
||||
@@ -3477,19 +3477,19 @@ declare module "esri/basemaps" {
|
||||
var basemaps: {
|
||||
/** The Light Gray Canvas basemap is designed to be used as a neutral background map for overlaying and emphasizing other map layers. */
|
||||
gray: any;
|
||||
/** The World Imagery map is a detailed imagery map layer and labels that is designed to be used as a basemap for various maps and applications. */
|
||||
/** The World Imagery with Labels map is a detailed imagery map layer and labels that is designed to be used as a basemap for various maps and applications: https://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer */
|
||||
hybrid: any;
|
||||
/** The Ocean Basemap is designed to be used as a basemap by marine GIS professionals and as a reference map by anyone interested in ocean data. */
|
||||
oceans: any;
|
||||
/** The OpenStreetMap is a community map layer that is designed to be used as a basemap for various maps and applications. */
|
||||
osm: any;
|
||||
/** The World Imagery map is a detailed imagery map layer that is designed to be used as a basemap for various maps and applications. */
|
||||
/** The World Imagery map is a detailed imagery map layer that is designed to be used as a basemap for various maps and applications: https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer. */
|
||||
satellite: any;
|
||||
/** The Streets basemap presents a multiscale street map for the world. */
|
||||
/** The Streets basemap presents a multiscale street map for the world: https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer. */
|
||||
streets: any;
|
||||
/** The Terrain with Labels basemap is designed to be used to overlay and emphasize other thematic map layers. */
|
||||
terrain: any;
|
||||
/** The Topographic map includes boundaries, cities, water features, physiographic features, parks, landmarks, transportation, and buildings. */
|
||||
/** The Topographic map includes boundaries, cities, water features, physiographic features, parks, landmarks, transportation, and buildings: https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer */
|
||||
topo: any;
|
||||
};
|
||||
export = basemaps;
|
||||
@@ -9228,8 +9228,9 @@ declare module "esri/lang" {
|
||||
* @param data The data object used in the substitution.
|
||||
* @param template The template used for the substitution.
|
||||
* @param first When true, returns only the first property found in the data object.
|
||||
* @param format The format object used in the substitution.
|
||||
*/
|
||||
substitute(data: any, template?: string, first?: boolean): string;
|
||||
substitute(data: any, template?: string, first?: boolean, format?: any): string;
|
||||
/**
|
||||
* Iterates through the argument array and searches for the identifier to which the argument value matches.
|
||||
* @param array The argument array for testing.
|
||||
@@ -10000,6 +10001,8 @@ declare module "esri/layers/FeatureLayer" {
|
||||
displayField: string;
|
||||
/** Indicates the field names for the editor fields. */
|
||||
editFieldsInfo: any;
|
||||
/** Applicable to ArcGIS Online hosted feature services. */
|
||||
editingInfo: any;
|
||||
/** The array of fields in the layer. */
|
||||
fields: Field[];
|
||||
/** The full extent of the layer. */
|
||||
@@ -10054,6 +10057,8 @@ declare module "esri/layers/FeatureLayer" {
|
||||
supportsAttachmentsByUploadId: boolean;
|
||||
/** When true, the layer supports the Calculate REST operation when updating features. */
|
||||
supportsCalculate: boolean;
|
||||
/** If true, the layer supports a user-defined field description. */
|
||||
supportsFieldDescription: boolean;
|
||||
/** When true, the layer supports statistical functions in query operations. */
|
||||
supportsStatistics: boolean;
|
||||
/** When true, the layer is suspended. */
|
||||
@@ -10468,6 +10473,8 @@ declare module "esri/layers/Field" {
|
||||
class Field {
|
||||
/** The alias name for the field. */
|
||||
alias: string;
|
||||
/** A string that describes the default value set for a field. */
|
||||
defaultValue: string;
|
||||
/** Domain associated with the field. */
|
||||
domain: Domain;
|
||||
/** Indicates whether the field is editable. */
|
||||
|
||||
@@ -11,7 +11,7 @@ const registrationOptions: Sqlite.RegistrationOptions = {
|
||||
};
|
||||
|
||||
let db: Sqlite.Database = Sqlite('.');
|
||||
db = new Sqlite('.', { memory: true });
|
||||
db = new Sqlite('.', { memory: true, verbose: () => {} });
|
||||
db.exec('CREATE TABLE test (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL);');
|
||||
db.exec('INSERT INTO test(name) VALUES("name");');
|
||||
db.pragma('data_version', { simple: true });
|
||||
|
||||
2
types/better-sqlite3/index.d.ts
vendored
2
types/better-sqlite3/index.d.ts
vendored
@@ -5,6 +5,7 @@
|
||||
// Santiago Aguilar <https://github.com/sant123>
|
||||
// Alessandro Vergani <https://github.com/loghorn>
|
||||
// Andrew Kaiser <https://github.com/andykais>
|
||||
// Mark Stewart <https://github.com/mrkstwrt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
@@ -97,6 +98,7 @@ declare namespace Database {
|
||||
readonly?: boolean;
|
||||
fileMustExist?: boolean;
|
||||
timeout?: number;
|
||||
verbose?: (message?: any, ...additionalArgs: any[]) => void;
|
||||
}
|
||||
|
||||
interface PragmaOptions {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import btoa = require('btoa');
|
||||
|
||||
btoa('foo');
|
||||
|
||||
btoa(Buffer.from('foo'));
|
||||
|
||||
4
types/btoa/index.d.ts
vendored
4
types/btoa/index.d.ts
vendored
@@ -5,6 +5,8 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
declare function btoa(str: string): string;
|
||||
/// <reference types="node" />
|
||||
|
||||
declare function btoa(str: string | Buffer): string;
|
||||
|
||||
export = btoa;
|
||||
|
||||
@@ -5,12 +5,20 @@ const options = {
|
||||
removeMarkdown: false
|
||||
};
|
||||
|
||||
parseChangelog({filePath: 'path/to/CHANGELOG.md'}, (result, error) => {});
|
||||
const fn = (obj: object): void => {};
|
||||
|
||||
parseChangelog(options, (result, error) => {});
|
||||
parseChangelog({filePath: 'path/to/CHANGELOG.md'}, (error, result) => {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
parseChangelog({filePath: 'path/to/CHANGELOG.md'}, (result) => {});
|
||||
fn(result);
|
||||
});
|
||||
|
||||
parseChangelog(options);
|
||||
parseChangelog(options, (error, result) => {});
|
||||
|
||||
parseChangelog('path/to/CHANGELOG.md');
|
||||
parseChangelog({filePath: 'path/to/CHANGELOG.md'}, (error) => {});
|
||||
|
||||
parseChangelog(options).then((result) => {});
|
||||
|
||||
parseChangelog('path/to/CHANGELOG.md').then((result) => {});
|
||||
|
||||
3
types/changelog-parser/index.d.ts
vendored
3
types/changelog-parser/index.d.ts
vendored
@@ -19,6 +19,7 @@ interface Options {
|
||||
/**
|
||||
* Change log parser for node.
|
||||
*/
|
||||
declare function parseChangelog(options: Partial<Options>|string, callback?: (result: object, error: string|null) => void): Promise<object>;
|
||||
declare function parseChangelog(options: Partial<Options>|string,
|
||||
callback?: (error: string|null, result: object) => void): Promise<object>;
|
||||
|
||||
export = parseChangelog;
|
||||
|
||||
4
types/countries-and-timezones/index.d.ts
vendored
4
types/countries-and-timezones/index.d.ts
vendored
@@ -16,9 +16,9 @@ export interface Timezone {
|
||||
countries: string[];
|
||||
}
|
||||
|
||||
export function getAllCountries(): Country[];
|
||||
export function getAllCountries(): {[key: string]: Country};
|
||||
|
||||
export function getAllTimezones(): Timezone[];
|
||||
export function getAllTimezones(): {[key: string]: Timezone};
|
||||
|
||||
export function getCountriesForTimezone(timezoneId: string): Country[];
|
||||
|
||||
|
||||
@@ -29,3 +29,7 @@ extendedLog("Testing this is also an IDebugger.");
|
||||
|
||||
const extendedWithCustomDelimiter: debug1.Debugger = log.extend('with-delim', '.');
|
||||
extendedWithCustomDelimiter("Testing this is an IDebugger, too.");
|
||||
|
||||
debug2.log = console.log.bind(console);
|
||||
const anotherLogger = debug2("DefinitelyTyped:error");
|
||||
anotherLogger("This should be printed to stdout");
|
||||
|
||||
4
types/debug/index.d.ts
vendored
4
types/debug/index.d.ts
vendored
@@ -5,9 +5,10 @@
|
||||
// John McLaughlin <https://github.com/zamb3zi>
|
||||
// Brasten Sager <https://github.com/brasten>
|
||||
// Nicolas Penin <https://github.com/npenin>
|
||||
// Kristian Brünn <https://github.com/kristianmitk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var debug: debug.Debug & {debug: debug.Debug, default: debug.Debug};
|
||||
declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug };
|
||||
|
||||
export = debug;
|
||||
export as namespace debug;
|
||||
@@ -19,6 +20,7 @@ declare namespace debug {
|
||||
disable: () => string;
|
||||
enable: (namespaces: string) => void;
|
||||
enabled: (namespaces: string) => boolean;
|
||||
log: (...args: any[]) => any;
|
||||
|
||||
names: RegExp[];
|
||||
skips: RegExp[];
|
||||
|
||||
@@ -3,7 +3,7 @@ import dotenv = require("dotenv");
|
||||
const env = dotenv.config();
|
||||
const dbUrl: string | null = env.error || !env.parsed ? null : env.parsed["BASIC"];
|
||||
|
||||
dotenv.load({
|
||||
dotenv.config({
|
||||
path: ".env-example",
|
||||
encoding: "utf8",
|
||||
debug: true
|
||||
|
||||
1
types/dotenv/index.d.ts
vendored
1
types/dotenv/index.d.ts
vendored
@@ -62,4 +62,5 @@ export interface DotenvConfigOutput {
|
||||
*
|
||||
*/
|
||||
export function config(options?: DotenvConfigOptions): DotenvConfigOutput;
|
||||
/** @deprecated since v7.0.0 Use config instead. */
|
||||
export const load: typeof config;
|
||||
|
||||
3
types/draft-js/index.d.ts
vendored
3
types/draft-js/index.d.ts
vendored
@@ -10,6 +10,7 @@
|
||||
// Ulf Schwekendiek <https://github.com/sulf>
|
||||
// Pablo Varela <https://github.com/pablopunk>
|
||||
// Claudio Procida <https://github.com/claudiopro>
|
||||
// Kevin Hawkinson <https://github.com/khawkinson>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -211,6 +212,8 @@ declare namespace Draft {
|
||||
static isOptionKeyCommand(e: SyntheticKeyboardEvent): boolean;
|
||||
|
||||
static hasCommandModifier(e: SyntheticKeyboardEvent): boolean;
|
||||
|
||||
static isSoftNewlineEvent(e: SyntheticKeyboardEvent): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
1
types/dwt/Dynamsoft.d.ts
vendored
1
types/dwt/Dynamsoft.d.ts
vendored
@@ -27,6 +27,7 @@ interface dwtEnv {
|
||||
DynamicContainers: string[];
|
||||
DynamicDWTMap: {};
|
||||
GetWebTwain(cid: string): WebTwain;
|
||||
IfInstallDWTModuleWithZIP: boolean;
|
||||
IfUpdateService: boolean;
|
||||
IfUseActiveXForIE10Plus: boolean;
|
||||
JSVersion: string;
|
||||
|
||||
1
types/dwt/index.d.ts
vendored
1
types/dwt/index.d.ts
vendored
@@ -4,6 +4,7 @@
|
||||
// Josh Hall <https://github.com/jbh>
|
||||
// Lincoln Hu <https://github.com/lincoln2018>
|
||||
// Tom Kent <https://github.com/Tom-Dynamsoft>
|
||||
// Dave Sueltenfuss <https://github.com/dsueltenfuss>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
|
||||
98
types/elliptic/index.d.ts
vendored
98
types/elliptic/index.d.ts
vendored
@@ -4,7 +4,7 @@
|
||||
// Gaylor Bosson <https://github.com/Gilthoniel>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import BN = require('bn.js');
|
||||
import BN = require("bn.js");
|
||||
|
||||
// incomplete typings
|
||||
export const utils: any;
|
||||
@@ -29,10 +29,10 @@ export namespace curve {
|
||||
g: base.BasePoint;
|
||||
redN: BN;
|
||||
|
||||
constructor(type: string, conf: base.BaseCurveOptions)
|
||||
constructor(type: string, conf: base.BaseCurveOptions);
|
||||
|
||||
validate(point: base.BasePoint): boolean;
|
||||
decodePoint(bytes: Buffer | string, enc?: 'hex'): base.BasePoint;
|
||||
decodePoint(bytes: Buffer | string, enc?: "hex"): base.BasePoint;
|
||||
}
|
||||
|
||||
namespace base {
|
||||
@@ -83,7 +83,12 @@ export namespace curve {
|
||||
|
||||
constructor(conf: edwards.EdwardsConf);
|
||||
|
||||
point(x: BNInput, y: BNInput, z?: BNInput, t?: BNInput): edwards.EdwardsPoint;
|
||||
point(
|
||||
x: BNInput,
|
||||
y: BNInput,
|
||||
z?: BNInput,
|
||||
t?: BNInput
|
||||
): edwards.EdwardsPoint;
|
||||
pointFromX(x: BNInput, odd?: boolean): edwards.EdwardsPoint;
|
||||
pointFromY(y: BNInput, odd?: boolean): edwards.EdwardsPoint;
|
||||
pointFromJSON(obj: BNInput[]): edwards.EdwardsPoint;
|
||||
@@ -144,7 +149,7 @@ export namespace curves {
|
||||
n: BN | undefined | null;
|
||||
hash: any; // ?
|
||||
|
||||
constructor(options: PresetCurve.Options)
|
||||
constructor(options: PresetCurve.Options);
|
||||
}
|
||||
|
||||
namespace PresetCurve {
|
||||
@@ -172,17 +177,47 @@ export class ec {
|
||||
g: any;
|
||||
hash: any;
|
||||
|
||||
constructor(options: string | curves.PresetCurve)
|
||||
constructor(options: string | curves.PresetCurve);
|
||||
|
||||
keyPair(options: ec.KeyPairOptions): ec.KeyPair;
|
||||
keyFromPrivate(priv: Buffer | string | ec.KeyPair, enc?: string): ec.KeyPair;
|
||||
keyFromPublic(pub: Buffer | string | {x: string, y: string} | ec.KeyPair, enc?: string): ec.KeyPair;
|
||||
keyFromPrivate(
|
||||
priv: Buffer | string | ec.KeyPair,
|
||||
enc?: string
|
||||
): ec.KeyPair;
|
||||
keyFromPublic(
|
||||
pub: Buffer | string | { x: string; y: string } | ec.KeyPair,
|
||||
enc?: string
|
||||
): ec.KeyPair;
|
||||
genKeyPair(options?: ec.GenKeyPairOptions): ec.KeyPair;
|
||||
sign(msg: BNInput, key: Buffer | ec.KeyPair, enc: string, options?: ec.SignOptions): ec.Signature;
|
||||
sign(msg: BNInput, key: Buffer | ec.KeyPair, options?: ec.SignOptions): ec.Signature;
|
||||
verify(msg: BNInput, signature: ec.Signature | ec.SignatureOptions, key: Buffer | ec.KeyPair, enc?: string): boolean;
|
||||
recoverPubKey(msg: BNInput, signature: ec.Signature | ec.SignatureOptions, j: number, enc?: string): any;
|
||||
getKeyRecoveryParam(e: Error | undefined, signature: ec.Signature | ec.SignatureOptions, Q: BN, enc?: string): number;
|
||||
sign(
|
||||
msg: BNInput,
|
||||
key: Buffer | ec.KeyPair,
|
||||
enc: string,
|
||||
options?: ec.SignOptions
|
||||
): ec.Signature;
|
||||
sign(
|
||||
msg: BNInput,
|
||||
key: Buffer | ec.KeyPair,
|
||||
options?: ec.SignOptions
|
||||
): ec.Signature;
|
||||
verify(
|
||||
msg: BNInput,
|
||||
signature: ec.Signature | ec.SignatureOptions,
|
||||
key: Buffer | ec.KeyPair,
|
||||
enc?: string
|
||||
): boolean;
|
||||
recoverPubKey(
|
||||
msg: BNInput,
|
||||
signature: ec.Signature | ec.SignatureOptions,
|
||||
j: number,
|
||||
enc?: string
|
||||
): any;
|
||||
getKeyRecoveryParam(
|
||||
e: Error | undefined,
|
||||
signature: ec.Signature | ec.SignatureOptions,
|
||||
Q: BN,
|
||||
enc?: string
|
||||
): number;
|
||||
}
|
||||
|
||||
export namespace ec {
|
||||
@@ -201,21 +236,32 @@ export namespace ec {
|
||||
}
|
||||
|
||||
class KeyPair {
|
||||
static fromPublic(ec: ec, pub: Buffer | string | {x: string, y: string} | KeyPair, enc?: string): KeyPair;
|
||||
static fromPrivate(ec: ec, priv: Buffer | string | KeyPair, enc?: string): KeyPair;
|
||||
static fromPublic(
|
||||
ec: ec,
|
||||
pub: Buffer | string | { x: string; y: string } | KeyPair,
|
||||
enc?: string
|
||||
): KeyPair;
|
||||
static fromPrivate(
|
||||
ec: ec,
|
||||
priv: Buffer | string | KeyPair,
|
||||
enc?: string
|
||||
): KeyPair;
|
||||
|
||||
ec: ec;
|
||||
|
||||
constructor(ec: ec, options: KeyPairOptions)
|
||||
constructor(ec: ec, options: KeyPairOptions);
|
||||
|
||||
validate(): { readonly result: boolean, readonly reason: string };
|
||||
validate(): { readonly result: boolean; readonly reason: string };
|
||||
getPublic(compact: boolean, enc?: string): any; // ?
|
||||
getPublic(enc?: string): any; // ?
|
||||
getPrivate(enc?: 'hex'): Buffer | BN | string;
|
||||
getPrivate(enc?: "hex"): Buffer | BN | string;
|
||||
derive(pub: any): any; // ?
|
||||
sign(msg: BNInput, enc: string, options?: SignOptions): Signature;
|
||||
sign(msg: BNInput, options?: SignOptions): Signature;
|
||||
verify(msg: BNInput, signature: Signature | SignatureOptions): boolean;
|
||||
verify(
|
||||
msg: BNInput,
|
||||
signature: Signature | SignatureOptions | string
|
||||
): boolean;
|
||||
inspect(): string;
|
||||
}
|
||||
|
||||
@@ -224,7 +270,7 @@ export namespace ec {
|
||||
s: BN;
|
||||
recoveryParam: number | null;
|
||||
|
||||
constructor(options: SignatureOptions | Signature, enc?: string)
|
||||
constructor(options: SignatureOptions | Signature, enc?: string);
|
||||
|
||||
toDER(enc?: string | null): any; // ?
|
||||
}
|
||||
@@ -246,10 +292,14 @@ export namespace ec {
|
||||
export class eddsa {
|
||||
curve: curve.edwards;
|
||||
|
||||
constructor(name: 'ed25519');
|
||||
constructor(name: "ed25519");
|
||||
|
||||
sign(message: eddsa.Bytes, secret: eddsa.Bytes): eddsa.Signature;
|
||||
verify(message: eddsa.Bytes, sig: eddsa.Bytes | eddsa.Signature, pub: eddsa.Bytes | eddsa.Point | eddsa.KeyPair): boolean;
|
||||
verify(
|
||||
message: eddsa.Bytes,
|
||||
sig: eddsa.Bytes | eddsa.Signature,
|
||||
pub: eddsa.Bytes | eddsa.Point | eddsa.KeyPair
|
||||
): boolean;
|
||||
hashInt(): BN;
|
||||
keyFromPublic(pub: eddsa.Bytes): eddsa.KeyPair;
|
||||
keyFromSecret(secret: eddsa.Bytes): eddsa.KeyPair;
|
||||
@@ -281,9 +331,9 @@ export namespace eddsa {
|
||||
secret(): Buffer;
|
||||
sign(message: Bytes): Signature;
|
||||
verify(message: Bytes, sig: Signature | Bytes): boolean;
|
||||
getSecret(enc: 'hex'): string;
|
||||
getSecret(enc: "hex"): string;
|
||||
getSecret(): Buffer;
|
||||
getPublic(enc: 'hex'): string;
|
||||
getPublic(enc: "hex"): string;
|
||||
getPublic(): Buffer;
|
||||
}
|
||||
|
||||
|
||||
98
types/ember-data/index.d.ts
vendored
98
types/ember-data/index.d.ts
vendored
@@ -16,8 +16,14 @@ import ModelRegistry from 'ember-data/types/registries/model';
|
||||
import SerializerRegistry from 'ember-data/types/registries/serializer';
|
||||
import AdapterRegistry from 'ember-data/types/registries/adapter';
|
||||
|
||||
type AttributesFor<Model> = keyof Model; // TODO: filter to attr properties only (TS 2.8)
|
||||
type RelationshipsFor<Model> = keyof Model; // TODO: filter to hasMany/belongsTo properties only (TS 2.8)
|
||||
/**
|
||||
The keys from the actual Model class, removing all the keys which come from
|
||||
the base class.
|
||||
*/
|
||||
type ModelKeys<Model extends DS.Model> = Exclude<keyof Model, keyof DS.Model>;
|
||||
|
||||
type AttributesFor<Model extends DS.Model> = ModelKeys<Model>; // TODO: filter to attr properties only (TS 2.8)
|
||||
type RelationshipsFor<Model extends DS.Model> = ModelKeys<Model>; // TODO: filter to hasMany/belongsTo properties only (TS 2.8)
|
||||
|
||||
export interface ChangedAttributes {
|
||||
[key: string]: [any, any] | undefined;
|
||||
@@ -49,9 +55,9 @@ export namespace DS {
|
||||
*/
|
||||
function errorsArrayToHash(errors: any[]): {};
|
||||
|
||||
interface RelationshipOptions<Model> {
|
||||
interface RelationshipOptions<M extends Model> {
|
||||
async?: boolean;
|
||||
inverse?: RelationshipsFor<Model> | null;
|
||||
inverse?: RelationshipsFor<M> | null;
|
||||
polymorphic?: boolean;
|
||||
}
|
||||
|
||||
@@ -457,12 +463,12 @@ export namespace DS {
|
||||
* Create a JSON representation of the record, using the serialization
|
||||
* strategy of the store's adapter.
|
||||
*/
|
||||
serialize(options?: { includeId?: boolean }): {};
|
||||
serialize(options?: { includeId?: boolean }): object;
|
||||
/**
|
||||
* Use [DS.JSONSerializer](DS.JSONSerializer.html) to
|
||||
* get the JSON representation of a record.
|
||||
*/
|
||||
toJSON(options: {}): {};
|
||||
toJSON(options?: { includeId?: boolean }): object;
|
||||
/**
|
||||
* Fired when the record is ready to be interacted with,
|
||||
* that is either loaded from the server or created locally.
|
||||
@@ -502,15 +508,15 @@ export namespace DS {
|
||||
* method if you want to allow the user to still `rollbackAttributes()`
|
||||
* after a delete was made.
|
||||
*/
|
||||
deleteRecord(): any;
|
||||
deleteRecord(): void;
|
||||
/**
|
||||
* Same as `deleteRecord`, but saves the record immediately.
|
||||
*/
|
||||
destroyRecord(options?: {}): RSVP.Promise<any>;
|
||||
destroyRecord(options?: { adapterOptions?: object }): RSVP.Promise<this>;
|
||||
/**
|
||||
* Unloads the record from the store. This will cause the record to be destroyed and freed up for garbage collection.
|
||||
*/
|
||||
unloadRecord(): any;
|
||||
unloadRecord(): void;
|
||||
/**
|
||||
* Returns an object, whose keys are changed properties, and value is
|
||||
* an [oldProp, newProp] array.
|
||||
@@ -520,16 +526,16 @@ export namespace DS {
|
||||
* If the model `hasDirtyAttributes` this function will discard any unsaved
|
||||
* changes. If the model `isNew` it will be removed from the store.
|
||||
*/
|
||||
rollbackAttributes(): any;
|
||||
rollbackAttributes(): void;
|
||||
/**
|
||||
* Save the record and persist any changes to the record to an
|
||||
* external source via the adapter.
|
||||
*/
|
||||
save(options?: {}): RSVP.Promise<this>;
|
||||
save(options?: { adapterOptions?: object }): RSVP.Promise<this>;
|
||||
/**
|
||||
* Reload the record from the adapter.
|
||||
*/
|
||||
reload(): RSVP.Promise<any>;
|
||||
reload(options?: { adapterOptions?: object }): RSVP.Promise<this>;
|
||||
/**
|
||||
* Get the reference for the specified belongsTo relationship.
|
||||
*/
|
||||
@@ -547,7 +553,7 @@ export namespace DS {
|
||||
this: T,
|
||||
callback: (name: string, details: RelationshipMeta<T>) => void,
|
||||
binding?: any
|
||||
): any;
|
||||
): void;
|
||||
/**
|
||||
* Represents the model's class name as a string. This can be used to look up the model's class name through
|
||||
* `DS.Store`'s modelFor method.
|
||||
@@ -605,14 +611,14 @@ export namespace DS {
|
||||
static eachRelationship<M extends Model = Model>(
|
||||
callback: (name: string, details: RelationshipMeta<M>) => void,
|
||||
binding?: any
|
||||
): any;
|
||||
): void;
|
||||
/**
|
||||
* Given a callback, iterates over each of the types related to a model,
|
||||
* invoking the callback with the related type's class. Each type will be
|
||||
* returned just once, regardless of how many different relationships it has
|
||||
* with a model.
|
||||
*/
|
||||
static eachRelatedType(callback: Function, binding: any): any;
|
||||
static eachRelatedType(callback: (name: string) => void, binding?: any): void;
|
||||
/**
|
||||
* A map whose keys are the attributes of the model (properties
|
||||
* described by DS.attr) and whose values are the meta object for the
|
||||
@@ -630,26 +636,27 @@ export namespace DS {
|
||||
* Iterates through the attributes of the model, calling the passed function on each
|
||||
* attribute.
|
||||
*/
|
||||
static eachAttribute(callback: Function, binding: {}): any;
|
||||
static eachAttribute<Class extends typeof Model, M extends InstanceType<Class>>(
|
||||
this: Class,
|
||||
callback: (
|
||||
name: ModelKeys<M>,
|
||||
meta: AttributeMeta<M>
|
||||
) => void,
|
||||
binding?: any
|
||||
): void;
|
||||
/**
|
||||
* Iterates through the transformedAttributes of the model, calling
|
||||
* the passed function on each attribute. Note the callback will not be
|
||||
* called for any attributes that do not have an transformation type.
|
||||
*/
|
||||
static eachTransformedAttribute(callback: Function, binding: {}): any;
|
||||
/**
|
||||
* Discards any unsaved changes to the given attribute. This feature is not enabled by default. You must enable `ds-rollback-attribute` and be running a canary build.
|
||||
*/
|
||||
rollbackAttribute(): any;
|
||||
/**
|
||||
* This Ember.js hook allows an object to be notified when a property
|
||||
* is defined.
|
||||
*/
|
||||
didDefineProperty(
|
||||
proto: {},
|
||||
key: string,
|
||||
value: Ember.ComputedProperty<any>
|
||||
): any;
|
||||
static eachTransformedAttribute<Class extends typeof Model>(
|
||||
this: Class,
|
||||
callback: (
|
||||
name: ModelKeys<InstanceType<Class>>,
|
||||
type: keyof TransformRegistry
|
||||
) => void,
|
||||
binding?: any
|
||||
): void;
|
||||
}
|
||||
/**
|
||||
* ### State
|
||||
@@ -700,7 +707,7 @@ export namespace DS {
|
||||
* Used to get the latest version of all of the records in this array
|
||||
* from the adapter.
|
||||
*/
|
||||
update(): any;
|
||||
update(): PromiseArray<T>;
|
||||
/**
|
||||
* Saves all of the records in the `RecordArray`.
|
||||
*/
|
||||
@@ -782,7 +789,7 @@ export namespace DS {
|
||||
/**
|
||||
* `ids()` returns an array of the record ids in this relationship.
|
||||
*/
|
||||
ids(): any[];
|
||||
ids(): string[];
|
||||
/**
|
||||
* The meta data for the has-many relationship.
|
||||
*/
|
||||
@@ -948,7 +955,7 @@ export namespace DS {
|
||||
/**
|
||||
* Get snapshots of the underlying record array
|
||||
*/
|
||||
snapshots(): any[];
|
||||
snapshots(): Snapshot[];
|
||||
}
|
||||
class Snapshot<K extends keyof ModelRegistry = any> {
|
||||
/**
|
||||
@@ -994,14 +1001,19 @@ export namespace DS {
|
||||
belongsTo<L extends RelationshipsFor<ModelRegistry[K]>>(
|
||||
keyName: L,
|
||||
options?: {}
|
||||
): Snapshot<K>['record'][L] | string | null | undefined;
|
||||
): Snapshot | null | undefined;
|
||||
belongsTo<L extends RelationshipsFor<ModelRegistry[K]>>(
|
||||
keyName: L,
|
||||
options: { id: true }
|
||||
): string | null | undefined;
|
||||
|
||||
/**
|
||||
* Returns the current value of a hasMany relationship.
|
||||
*/
|
||||
hasMany<L extends RelationshipsFor<ModelRegistry[K]>>(
|
||||
keyName: L,
|
||||
options?: { ids: false }
|
||||
): Array<Snapshot<K>['record'][L]> | undefined;
|
||||
): Snapshot[] | undefined;
|
||||
hasMany<L extends RelationshipsFor<ModelRegistry[K]>>(
|
||||
keyName: L,
|
||||
options: { ids: true }
|
||||
@@ -1011,21 +1023,21 @@ export namespace DS {
|
||||
* function on each attribute.
|
||||
*/
|
||||
eachAttribute<M extends ModelRegistry[K]>(
|
||||
callback: (key: keyof M, meta: AttributeMeta<M>) => void,
|
||||
callback: (key: ModelKeys<M>, meta: AttributeMeta<M>) => void,
|
||||
binding?: {}
|
||||
): any;
|
||||
): void;
|
||||
/**
|
||||
* Iterates through all the relationships of the model, calling the passed
|
||||
* function on each relationship.
|
||||
*/
|
||||
eachRelationship<M extends ModelRegistry[K]>(
|
||||
callback: (key: keyof M, meta: RelationshipMeta<M>) => void,
|
||||
callback: (key: ModelKeys<M>, meta: RelationshipMeta<M>) => void,
|
||||
binding?: {}
|
||||
): any;
|
||||
): void;
|
||||
/**
|
||||
* Serializes the snapshot using the serializer for the model.
|
||||
*/
|
||||
serialize(options: {}): {};
|
||||
serialize<O extends object>(options: O): object;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1095,7 +1107,8 @@ export namespace DS {
|
||||
*/
|
||||
query<K extends keyof ModelRegistry>(
|
||||
modelName: K,
|
||||
query: any
|
||||
query: object,
|
||||
options?: { adapterOptions?: object }
|
||||
): AdapterPopulatedRecordArray<ModelRegistry[K]> &
|
||||
PromiseArray<ModelRegistry[K]>;
|
||||
/**
|
||||
@@ -1105,7 +1118,8 @@ export namespace DS {
|
||||
*/
|
||||
queryRecord<K extends keyof ModelRegistry>(
|
||||
modelName: K,
|
||||
query: any
|
||||
query: object,
|
||||
options?: { adapterOptions?: object }
|
||||
): RSVP.Promise<ModelRegistry[K]>;
|
||||
/**
|
||||
* `findAll` asks the adapter's `findAll` method to find the records for the
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Ember from 'ember';
|
||||
import DS, { ChangedAttributes } from 'ember-data';
|
||||
import { assertType } from "./lib/assert";
|
||||
import RSVP from 'rsvp';
|
||||
|
||||
const Person = DS.Model.extend({
|
||||
firstName: DS.attr(),
|
||||
@@ -33,5 +34,26 @@ user.serialize();
|
||||
user.serialize({ includeId: true });
|
||||
user.serialize({ includeId: true });
|
||||
|
||||
const attributes = user.changedAttributes();
|
||||
assertType<ChangedAttributes>(attributes);
|
||||
const attributes: ChangedAttributes = user.changedAttributes();
|
||||
|
||||
user.rollbackAttributes(); // $ExpectType void
|
||||
|
||||
let destroyResult: RSVP.Promise<typeof user>;
|
||||
destroyResult = user.destroyRecord();
|
||||
destroyResult = user.destroyRecord({});
|
||||
destroyResult = user.destroyRecord({ adapterOptions: {}});
|
||||
destroyResult = user.destroyRecord({ adapterOptions: { waffles: 'are yummy' }});
|
||||
|
||||
user.deleteRecord(); // $ExpectType void
|
||||
|
||||
user.unloadRecord(); // $ExpectType void
|
||||
|
||||
let jsonified: object;
|
||||
jsonified = user.toJSON();
|
||||
jsonified = user.toJSON({ includeId: true });
|
||||
|
||||
let reloaded: RSVP.Promise<typeof user>;
|
||||
reloaded = user.reload();
|
||||
reloaded = user.reload({});
|
||||
reloaded = user.reload({ adapterOptions: {} });
|
||||
reloaded = user.reload({ adapterOptions: { fastAsCanBe: 'yessirree' } });
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
import TransformRegistry from 'ember-data/types/registries/transform';
|
||||
import { assertType } from './lib/assert';
|
||||
|
||||
declare const store: DS.Store;
|
||||
|
||||
@@ -8,24 +10,65 @@ const Person = DS.Model.extend({
|
||||
parent: DS.belongsTo('folder', { inverse: 'children' })
|
||||
});
|
||||
|
||||
// $ExpectType void
|
||||
Person.eachAttribute(() => {});
|
||||
// $ExpectType void
|
||||
Person.eachAttribute(() => {}, {});
|
||||
// $ExpectType void
|
||||
Person.eachAttribute((name, meta) => {
|
||||
assertType<'children' | 'parent'>(name);
|
||||
assertType<{
|
||||
type: keyof TransformRegistry;
|
||||
options: object;
|
||||
name: 'children' | 'parent';
|
||||
parentType: DS.Model;
|
||||
isAttribute: true;
|
||||
}>(meta);
|
||||
});
|
||||
|
||||
// $ExpectType void
|
||||
Person.eachTransformedAttribute(() => {});
|
||||
// $ExpectType void
|
||||
Person.eachTransformedAttribute(() => {}, {});
|
||||
// $ExpectType void
|
||||
Person.eachTransformedAttribute((name, type) => {
|
||||
assertType<'children' | 'parent'>(name);
|
||||
let t: keyof TransformRegistry = type;
|
||||
});
|
||||
|
||||
const Polymorphic = DS.Model.extend({
|
||||
paymentMethods: DS.hasMany('payment-method', { polymorphic: true })
|
||||
});
|
||||
|
||||
// $ExpectType void
|
||||
Polymorphic.eachRelationship(() => '');
|
||||
// $ExpectType void
|
||||
Polymorphic.eachRelationship(() => '', {});
|
||||
// $ExpectType void
|
||||
Polymorphic.eachRelationship((n, meta) => {
|
||||
let s: string = n;
|
||||
let m: 'belongsTo' | 'hasMany' = meta.kind;
|
||||
});
|
||||
let p = Polymorphic.create();
|
||||
// $ExpectType void
|
||||
p.eachRelationship(() => '');
|
||||
// $ExpectType void
|
||||
p.eachRelationship(() => '', {});
|
||||
// $ExpectType void
|
||||
p.eachRelationship((n, meta) => {
|
||||
let s: string = n;
|
||||
let m: 'belongsTo' | 'hasMany' = meta.kind;
|
||||
});
|
||||
|
||||
// $ExpectType void
|
||||
Polymorphic.eachRelatedType(() => '');
|
||||
// $ExpectType void
|
||||
Polymorphic.eachRelatedType(() => '', {});
|
||||
// $ExpectType void
|
||||
Polymorphic.eachRelatedType((name) => {
|
||||
let s: string = name;
|
||||
});
|
||||
|
||||
export class Comment extends DS.Model {
|
||||
author = DS.attr('string');
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
|
||||
interface Dict<T> {
|
||||
[key: string]: T | null | undefined;
|
||||
}
|
||||
|
||||
const JsonApi = DS.JSONAPISerializer.extend({});
|
||||
|
||||
const Customized = DS.JSONAPISerializer.extend({
|
||||
@@ -74,14 +78,16 @@ const SerializerUsingSnapshots = DS.RESTSerializer.extend({
|
||||
|
||||
DS.Serializer.extend({
|
||||
serialize(snapshot: DS.Snapshot<'message-for-serializer'>, options: {}) {
|
||||
let json: any = {
|
||||
let json: Dict<any> = {
|
||||
id: snapshot.id
|
||||
};
|
||||
|
||||
// $ExpectType void
|
||||
snapshot.eachAttribute((key, attribute) => {
|
||||
json[key] = snapshot.attr(key);
|
||||
});
|
||||
|
||||
// $ExpectType void
|
||||
snapshot.eachRelationship((key, relationship) => {
|
||||
if (relationship.kind === 'belongsTo') {
|
||||
json[key] = snapshot.belongsTo(key, { id: true });
|
||||
|
||||
@@ -24,6 +24,7 @@ let post = store.createRecord('post', {
|
||||
});
|
||||
|
||||
post.save(); // => POST to '/posts'
|
||||
post.save({ adapterOptions: { makeItSo: 'number one ' } });
|
||||
post.save().then(saved => {
|
||||
assertType<Post>(saved);
|
||||
});
|
||||
|
||||
@@ -2,8 +2,12 @@ import Ember from 'ember';
|
||||
|
||||
// $
|
||||
Ember.$; // $ExpectType JQueryStatic
|
||||
|
||||
const top = (<T>(x?: T): T => x!)();
|
||||
type Top = typeof top;
|
||||
declare function expectTypeNativeArrayTop(x: Ember.NativeArray<Top>): void;
|
||||
// A
|
||||
Ember.A(); // $ExpectType NativeArray<{}>
|
||||
expectTypeNativeArrayTop(Ember.A());
|
||||
Ember.A([1, 2]); // $ExpectType NativeArray<number>
|
||||
// addListener
|
||||
Ember.addListener({ a: 'foo' }, 'a', {}, () => {});
|
||||
|
||||
49
types/ember__routing/-private/route-info.d.ts
vendored
Normal file
49
types/ember__routing/-private/route-info.d.ts
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// https://api.emberjs.com/ember/3.6/classes/RouteInfo
|
||||
/**
|
||||
* A `RouteInfo` is an object that contains metadata about a specific route within a `Transition`.
|
||||
* It is read-only and internally immutable.
|
||||
* It is also not observable, because a `Transition` instance is never changed after creation.
|
||||
*/
|
||||
export default interface RouteInfo {
|
||||
/**
|
||||
* A reference to the childe route's `RouteInfo`.
|
||||
* This can be used to traverse downward to the leafmost `RouteInfo`.
|
||||
*/
|
||||
readonly child: RouteInfo | null;
|
||||
/**
|
||||
* The final segment of the fully-qualified name of the route, like "index".
|
||||
*/
|
||||
readonly localName: string;
|
||||
/**
|
||||
* The dot-separated, fully-qualified name of the route, like "people.index".
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* The ordered list of the names of the params required for this route.
|
||||
* It will contain the same strings as `Object.keys(params)`, but here the order is significant.
|
||||
* This allows users to correctly pass params into routes programmatically.
|
||||
*/
|
||||
readonly paramNames: string[];
|
||||
/**
|
||||
* The values of the route's parameters.
|
||||
* These are the same params that are received as arguments to the route's `model` hook.
|
||||
* Contains only the parameters valid for this route, if any (params for parent or child routes are not merged).
|
||||
*/
|
||||
readonly params: { [key: string]: string | undefined };
|
||||
/**
|
||||
* A reference to the parent route's `RouteInfo`.
|
||||
* This can be used to traverse upward to the topmost `RouteInfo`.
|
||||
*/
|
||||
readonly parent: RouteInfo | null;
|
||||
/**
|
||||
* The values of any query params on this route.
|
||||
*/
|
||||
readonly queryParams: { [key: string]: string | undefined };
|
||||
/**
|
||||
* Allows you to traverse through the linked list of `RouteInfo`s from the topmost to leafmost.
|
||||
* Returns the first `RouteInfo` in the linked list for which the callback returns true.
|
||||
*
|
||||
* @param callback the callback to execute.
|
||||
*/
|
||||
find(callback: (item: RouteInfo) => boolean): RouteInfo | undefined;
|
||||
}
|
||||
13
types/ember__routing/-private/transition.d.ts
vendored
13
types/ember__routing/-private/transition.d.ts
vendored
@@ -1,4 +1,17 @@
|
||||
import RouteInfo from './route-info';
|
||||
|
||||
export default interface Transition {
|
||||
/**
|
||||
* This property is a `RouteInfo` object that represents where transition originated from.
|
||||
* It's important to note that a `RouteInfo` is a linked list and this property is simply the head node of the list.
|
||||
* In the case of an initial render, `from` will be set to `null`.
|
||||
*/
|
||||
readonly from: RouteInfo | null;
|
||||
/**
|
||||
* This property is a `RouteInfo` object that represents where the router is transitioning to.
|
||||
* It's important to note that a `RouteInfo` is a linked list and this property is simply the leafmost route.
|
||||
*/
|
||||
readonly to: RouteInfo;
|
||||
/**
|
||||
* Aborts the Transition. Note you can also implicitly abort a transition
|
||||
* by initiating another transition while a previous one is underway.
|
||||
|
||||
26
types/ember__routing/router-service.d.ts
vendored
26
types/ember__routing/router-service.d.ts
vendored
@@ -1,3 +1,4 @@
|
||||
import RouteInfo from '@ember/routing/-private/route-info';
|
||||
import Transition from '@ember/routing/-private/transition';
|
||||
import Service from '@ember/service';
|
||||
|
||||
@@ -10,6 +11,12 @@ type RouteModel = object | string | number;
|
||||
*/
|
||||
export default class RouterService extends Service {
|
||||
//
|
||||
/**
|
||||
* A `RouteInfo` that represents the current leaf route.
|
||||
* It is guaranteed to change whenever a route transition happens
|
||||
* (even when that transition only changes parameters and doesn't change the active route)
|
||||
*/
|
||||
readonly currentRoute: RouteInfo;
|
||||
/**
|
||||
* Name of the current route.
|
||||
* This property represent the logical name of the route,
|
||||
@@ -212,4 +219,23 @@ export default class RouterService extends Service {
|
||||
modelsD: RouteModel,
|
||||
options?: { queryParams: object }
|
||||
): string;
|
||||
|
||||
// https://api.emberjs.com/ember/3.6/classes/RouterService/events/routeDidChange?anchor=routeDidChange
|
||||
/**
|
||||
* Register a callback for an event.
|
||||
*
|
||||
* The `routeWillChange` event is fired at the beginning of any attempted transition with a `Transition` object as the sole argument.
|
||||
* This action can be used for aborting, redirecting, or decorating the transition from the currently active routes.
|
||||
*
|
||||
* The `routeDidChange` event only fires once a transition has settled.
|
||||
* This includes aborts and error substates.
|
||||
* Like the `routeWillChange` event it recieves a `Transition` as the sole argument.
|
||||
*
|
||||
* @param name the name of the event
|
||||
* @param callback the callback to execute
|
||||
*/
|
||||
on(
|
||||
name: 'routeDidChange' | 'routeWillChange',
|
||||
callback: (transition: Transition) => void
|
||||
): RouterService;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { assertType } from './lib/assert';
|
||||
import Router from '@ember/routing/router';
|
||||
import Service, { inject as service } from '@ember/service';
|
||||
import EmberObject, { get } from '@ember/object';
|
||||
@@ -52,5 +51,33 @@ const RouterServiceConsumer = Service.extend({
|
||||
const model = EmberObject.create();
|
||||
get(this, 'router')
|
||||
.transitionTo('index', model, { queryParams: { search: 'ember' }});
|
||||
}
|
||||
},
|
||||
onAndRouteInfo() {
|
||||
const router = get(this, 'router');
|
||||
router
|
||||
.on('routeWillChange', transition => {
|
||||
const to = transition.to;
|
||||
to.child; // $ExpectType RouteInfo | null
|
||||
to.localName; // $ExpectType string
|
||||
to.name; // $ExpectType string
|
||||
to.paramNames; // $ExpectType string[]
|
||||
to.params.foo; // $ExpectType string | undefined
|
||||
to.parent; // $ExpectType RouteInfo | null
|
||||
to.queryParams.foo; // $ExpectType string | undefined
|
||||
to.find(info => info.name === 'foo'); // $ExpectType RouteInfo | undefined
|
||||
})
|
||||
.on('routeDidChange', transition => {
|
||||
const from = transition.from;
|
||||
if (from) {
|
||||
from.child; // $ExpectType RouteInfo | null
|
||||
from.localName; // $ExpectType string
|
||||
from.name; // $ExpectType string
|
||||
from.paramNames; // $ExpectType string[]
|
||||
from.params.foo; // $ExpectType string | undefined
|
||||
from.parent; // $ExpectType RouteInfo | null
|
||||
from.queryParams.foo; // $ExpectType string | undefined
|
||||
from.find(info => info.name === 'foo'); // $ExpectType RouteInfo | undefined
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"router.d.ts",
|
||||
"types.d.ts",
|
||||
"-private/router-dsl.d.ts",
|
||||
"-private/route-info.d.ts",
|
||||
"-private/transition.d.ts",
|
||||
"test/lib/assert.ts",
|
||||
"test/route.ts",
|
||||
|
||||
2
types/fabric/fabric-impl.d.ts
vendored
2
types/fabric/fabric-impl.d.ts
vendored
@@ -143,7 +143,7 @@ interface IDataURLOptions {
|
||||
interface IEvent {
|
||||
e: Event;
|
||||
target?: Object;
|
||||
transform?: { corner: string };
|
||||
transform?: { corner: string, original: Object, width: number };
|
||||
}
|
||||
|
||||
interface IFillOptions {
|
||||
|
||||
@@ -6,6 +6,9 @@ get(obj, "a");
|
||||
get(obj, "a.b");
|
||||
get(obj, "a.b.c");
|
||||
get(obj, "a.b.c.d");
|
||||
get(obj, ['a']);
|
||||
get(obj, ['a', 'b', 'c']);
|
||||
get(obj, ['a', 'b', 'c', 'd']);
|
||||
|
||||
{
|
||||
const isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
3
types/get-value/index.d.ts
vendored
3
types/get-value/index.d.ts
vendored
@@ -1,13 +1,14 @@
|
||||
// Type definitions for get-value 3.0
|
||||
// Project: https://github.com/jonschlinkert/get-value
|
||||
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
|
||||
// Mathew Allen <https://github.com/TheMallen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
export = get;
|
||||
|
||||
declare function get<T>(obj: T): T;
|
||||
declare function get(obj: object, key: string, options?: get.Options): any;
|
||||
declare function get(obj: object, key: string | string[], options?: get.Options): any;
|
||||
|
||||
declare namespace get {
|
||||
interface Options {
|
||||
|
||||
2
types/glob-parent/index.d.ts
vendored
2
types/glob-parent/index.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
// Type definitions for glob-parent 3.1
|
||||
// Project: https://github.com/es128/glob-parent
|
||||
// Project: https://github.com/gulpjs/glob-parent
|
||||
// Definitions by: mrmlnc <https://github.com/mrmlnc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
10
types/graphql/execution/execute.d.ts
vendored
10
types/graphql/execution/execute.d.ts
vendored
@@ -17,7 +17,7 @@ import {
|
||||
InlineFragmentNode,
|
||||
FragmentDefinitionNode,
|
||||
} from "../language/ast";
|
||||
import { MaybePromise } from "../jsutils/MaybePromise";
|
||||
import { PromiseOrValue } from "../jsutils/PromiseOrValue";
|
||||
|
||||
/**
|
||||
* Data that must be available at all points during query execution.
|
||||
@@ -37,7 +37,7 @@ export interface ExecutionContext {
|
||||
}
|
||||
|
||||
export interface ExecutionResultDataDefault {
|
||||
[key: string]: any
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,9 @@ export type ExecutionArgs = {
|
||||
*
|
||||
* Accepts either an object with named arguments, or individual arguments.
|
||||
*/
|
||||
export function execute<TData = ExecutionResultDataDefault>(args: ExecutionArgs): MaybePromise<ExecutionResult<TData>>;
|
||||
export function execute<TData = ExecutionResultDataDefault>(
|
||||
args: ExecutionArgs
|
||||
): PromiseOrValue<ExecutionResult<TData>>;
|
||||
export function execute<TData = ExecutionResultDataDefault>(
|
||||
schema: GraphQLSchema,
|
||||
document: DocumentNode,
|
||||
@@ -82,7 +84,7 @@ export function execute<TData = ExecutionResultDataDefault>(
|
||||
variableValues?: Maybe<{ [key: string]: any }>,
|
||||
operationName?: Maybe<string>,
|
||||
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>
|
||||
): MaybePromise<ExecutionResult<TData>>;
|
||||
): PromiseOrValue<ExecutionResult<TData>>;
|
||||
|
||||
/**
|
||||
* Given a ResponsePath (found in the `path` entry in the information provided
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { assertInputType, isInputType, isOutputType } from 'graphql';
|
||||
import { assertInputType, isInputType, isOutputType } from "graphql";
|
||||
|
||||
///////////////////////////
|
||||
// graphql //
|
||||
|
||||
3
types/graphql/index.d.ts
vendored
3
types/graphql/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for graphql 14.0
|
||||
// Type definitions for graphql 14.2
|
||||
// Project: https://github.com/graphql/graphql-js
|
||||
// Definitions by: TonyYang <https://github.com/TonyPythoneer>
|
||||
// Caleb Meredith <https://github.com/calebmer>
|
||||
@@ -18,6 +18,7 @@
|
||||
// Jonathan Cardoso <https://github.com/JCMais>
|
||||
// Pavel Lang <https://github.com/langpavel>
|
||||
// Mark Caudill <https://github.com/mc0>
|
||||
// Martijn Walraven <https://github.com/martijnwalraven>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
|
||||
1
types/graphql/jsutils/MaybePromise.d.ts
vendored
1
types/graphql/jsutils/MaybePromise.d.ts
vendored
@@ -1 +0,0 @@
|
||||
export type MaybePromise<T> = Promise<T> | T;
|
||||
1
types/graphql/jsutils/PromiseOrValue.d.ts
vendored
Normal file
1
types/graphql/jsutils/PromiseOrValue.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export type PromiseOrValue<T> = Promise<T> | T;
|
||||
@@ -4,4 +4,4 @@
|
||||
*
|
||||
* This implements the GraphQL spec's BlockStringValue() static algorithm.
|
||||
*/
|
||||
export default function blockStringValue(rawString: string): string;
|
||||
export function dedentBlockStringValue(rawString: string): string;
|
||||
4
types/graphql/language/printer.d.ts
vendored
4
types/graphql/language/printer.d.ts
vendored
@@ -1,5 +1,7 @@
|
||||
import { ASTNode } from "./ast";
|
||||
|
||||
/**
|
||||
* Converts an AST into a string, using one set of reasonable
|
||||
* formatting rules.
|
||||
*/
|
||||
export function print(ast: any): string;
|
||||
export function print(ast: ASTNode): string;
|
||||
|
||||
4
types/graphql/tsutils/Maybe.d.ts
vendored
4
types/graphql/tsutils/Maybe.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Conveniently represents flow's "Maybe" type https://flow.org/en/docs/types/maybe/
|
||||
type Maybe<T> = null | undefined | T
|
||||
type Maybe<T> = null | undefined | T;
|
||||
|
||||
export default Maybe
|
||||
export default Maybe;
|
||||
|
||||
71
types/graphql/type/definition.d.ts
vendored
71
types/graphql/type/definition.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
import Maybe from "../tsutils/Maybe";
|
||||
import { MaybePromise } from "../jsutils/MaybePromise";
|
||||
import { PromiseOrValue } from "../jsutils/PromiseOrValue";
|
||||
import {
|
||||
ScalarTypeDefinitionNode,
|
||||
ObjectTypeDefinitionNode,
|
||||
@@ -161,7 +161,6 @@ interface GraphQLList<T extends GraphQLType> {
|
||||
inspect(): string;
|
||||
}
|
||||
|
||||
|
||||
interface _GraphQLList<T extends GraphQLType> {
|
||||
(type: T): GraphQLList<T>;
|
||||
new (type: T): GraphQLList<T>;
|
||||
@@ -280,6 +279,12 @@ export class GraphQLScalarType {
|
||||
extensionASTNodes: Maybe<ReadonlyArray<ScalarTypeExtensionNode>>;
|
||||
constructor(config: GraphQLScalarTypeConfig<any, any>);
|
||||
|
||||
toConfig(): GraphQLScalarTypeConfig<any, any> & {
|
||||
parseValue: GraphQLScalarValueParser<any>;
|
||||
parseLiteral: GraphQLScalarLiteralParser<any>;
|
||||
extensionASTNodes: ReadonlyArray<ScalarTypeExtensionNode>;
|
||||
};
|
||||
|
||||
toString(): string;
|
||||
toJSON(): string;
|
||||
inspect(): string;
|
||||
@@ -342,11 +347,7 @@ export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
|
||||
* });
|
||||
*
|
||||
*/
|
||||
export class GraphQLObjectType<
|
||||
TSource = any,
|
||||
TContext = any,
|
||||
TArgs = { [key: string]: any }
|
||||
> {
|
||||
export class GraphQLObjectType<TSource = any, TContext = any, TArgs = { [key: string]: any }> {
|
||||
name: string;
|
||||
description: Maybe<string>;
|
||||
astNode: Maybe<ObjectTypeDefinitionNode>;
|
||||
@@ -356,16 +357,19 @@ export class GraphQLObjectType<
|
||||
constructor(config: GraphQLObjectTypeConfig<TSource, TContext, TArgs>);
|
||||
getFields(): GraphQLFieldMap<any, TContext, TArgs>;
|
||||
getInterfaces(): GraphQLInterfaceType[];
|
||||
|
||||
toConfig(): GraphQLObjectTypeConfig<any, any> & {
|
||||
interfaces: GraphQLInterfaceType[];
|
||||
fields: GraphQLFieldConfigMap<any, any>;
|
||||
extensionASTNodes: ReadonlyArray<ObjectTypeExtensionNode>;
|
||||
};
|
||||
|
||||
toString(): string;
|
||||
toJSON(): string;
|
||||
inspect(): string;
|
||||
}
|
||||
|
||||
export interface GraphQLObjectTypeConfig<
|
||||
TSource,
|
||||
TContext,
|
||||
TArgs = { [key: string]: any }
|
||||
> {
|
||||
export interface GraphQLObjectTypeConfig<TSource, TContext, TArgs = { [key: string]: any }> {
|
||||
name: string;
|
||||
interfaces?: Thunk<Maybe<GraphQLInterfaceType[]>>;
|
||||
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext, TArgs>>;
|
||||
@@ -375,21 +379,17 @@ export interface GraphQLObjectTypeConfig<
|
||||
extensionASTNodes?: Maybe<ReadonlyArray<ObjectTypeExtensionNode>>;
|
||||
}
|
||||
|
||||
export type GraphQLTypeResolver<
|
||||
TSource,
|
||||
TContext,
|
||||
TArgs = { [key: string]: any }
|
||||
> = (
|
||||
export type GraphQLTypeResolver<TSource, TContext, TArgs = { [key: string]: any }> = (
|
||||
value: TSource,
|
||||
context: TContext,
|
||||
info: GraphQLResolveInfo
|
||||
) => MaybePromise<Maybe<GraphQLObjectType<TSource, TContext, TArgs> | string>>;
|
||||
) => PromiseOrValue<Maybe<GraphQLObjectType<TSource, TContext, TArgs> | string>>;
|
||||
|
||||
export type GraphQLIsTypeOfFn<TSource, TContext> = (
|
||||
source: TSource,
|
||||
context: TContext,
|
||||
info: GraphQLResolveInfo
|
||||
) => MaybePromise<boolean>;
|
||||
) => PromiseOrValue<boolean>;
|
||||
|
||||
export type GraphQLFieldResolver<TSource, TContext, TArgs = { [argName: string]: any }> = (
|
||||
source: TSource,
|
||||
@@ -461,11 +461,7 @@ export interface GraphQLArgument {
|
||||
|
||||
export function isRequiredArgument(arg: GraphQLArgument): boolean;
|
||||
|
||||
export type GraphQLFieldMap<
|
||||
TSource,
|
||||
TContext,
|
||||
TArgs = { [key: string]: any }
|
||||
> = {
|
||||
export type GraphQLFieldMap<TSource, TContext, TArgs = { [key: string]: any }> = {
|
||||
[key: string]: GraphQLField<TSource, TContext, TArgs>;
|
||||
};
|
||||
|
||||
@@ -498,16 +494,17 @@ export class GraphQLInterfaceType {
|
||||
|
||||
getFields(): GraphQLFieldMap<any, any>;
|
||||
|
||||
toConfig(): GraphQLInterfaceTypeConfig<any, any> & {
|
||||
fields: GraphQLFieldConfigMap<any, any>;
|
||||
extensionASTNodes: ReadonlyArray<InterfaceTypeExtensionNode>;
|
||||
};
|
||||
|
||||
toString(): string;
|
||||
toJSON(): string;
|
||||
inspect(): string;
|
||||
}
|
||||
|
||||
export interface GraphQLInterfaceTypeConfig<
|
||||
TSource,
|
||||
TContext,
|
||||
TArgs = { [key: string]: any }
|
||||
> {
|
||||
export interface GraphQLInterfaceTypeConfig<TSource, TContext, TArgs = { [key: string]: any }> {
|
||||
name: string;
|
||||
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext, TArgs>>;
|
||||
/**
|
||||
@@ -555,6 +552,11 @@ export class GraphQLUnionType {
|
||||
|
||||
getTypes(): GraphQLObjectType[];
|
||||
|
||||
toConfig(): GraphQLUnionTypeConfig<any, any> & {
|
||||
types: GraphQLObjectType[];
|
||||
extensionASTNodes: ReadonlyArray<UnionTypeExtensionNode>;
|
||||
};
|
||||
|
||||
toString(): string;
|
||||
toJSON(): string;
|
||||
inspect(): string;
|
||||
@@ -607,6 +609,11 @@ export class GraphQLEnumType {
|
||||
serialize(value: any): Maybe<string>;
|
||||
parseValue(value: any): Maybe<any>;
|
||||
parseLiteral(valueNode: ValueNode, _variables: Maybe<{ [key: string]: any }>): Maybe<any>;
|
||||
|
||||
toConfig(): GraphQLEnumTypeConfig & {
|
||||
extensionASTNodes: ReadonlyArray<EnumTypeExtensionNode>;
|
||||
};
|
||||
|
||||
toString(): string;
|
||||
toJSON(): string;
|
||||
inspect(): string;
|
||||
@@ -665,6 +672,12 @@ export class GraphQLInputObjectType {
|
||||
extensionASTNodes: Maybe<ReadonlyArray<InputObjectTypeExtensionNode>>;
|
||||
constructor(config: GraphQLInputObjectTypeConfig);
|
||||
getFields(): GraphQLInputFieldMap;
|
||||
|
||||
toConfig(): GraphQLInputObjectTypeConfig & {
|
||||
fields: GraphQLInputFieldConfigMap;
|
||||
extensionASTNodes: ReadonlyArray<InputObjectTypeExtensionNode>;
|
||||
};
|
||||
|
||||
toString(): string;
|
||||
toJSON(): string;
|
||||
inspect(): string;
|
||||
|
||||
4
types/graphql/type/directives.d.ts
vendored
4
types/graphql/type/directives.d.ts
vendored
@@ -20,6 +20,10 @@ export class GraphQLDirective {
|
||||
astNode: Maybe<DirectiveDefinitionNode>;
|
||||
|
||||
constructor(config: GraphQLDirectiveConfig);
|
||||
|
||||
toConfig(): GraphQLDirectiveConfig & {
|
||||
args: GraphQLFieldConfigArgumentMap;
|
||||
};
|
||||
}
|
||||
|
||||
export interface GraphQLDirectiveConfig {
|
||||
|
||||
6
types/graphql/type/schema.d.ts
vendored
6
types/graphql/type/schema.d.ts
vendored
@@ -52,6 +52,12 @@ export class GraphQLSchema {
|
||||
|
||||
getDirectives(): ReadonlyArray<GraphQLDirective>;
|
||||
getDirective(name: string): Maybe<GraphQLDirective>;
|
||||
|
||||
toConfig(): GraphQLSchemaConfig & {
|
||||
types: GraphQLNamedType[];
|
||||
directives: GraphQLDirective[];
|
||||
extensionASTNodes: ReadonlyArray<SchemaExtensionNode>;
|
||||
};
|
||||
}
|
||||
|
||||
type TypeMap = { [key: string]: GraphQLNamedType };
|
||||
|
||||
2
types/graphql/utilities/buildASTSchema.d.ts
vendored
2
types/graphql/utilities/buildASTSchema.d.ts
vendored
@@ -15,7 +15,7 @@ import { GraphQLDirective } from "../type/directives";
|
||||
import { Source } from "../language/source";
|
||||
import { GraphQLSchema, GraphQLSchemaValidationOptions } from "../type/schema";
|
||||
import { ParseOptions } from "../language/parser";
|
||||
import blockStringValue from "../language/blockStringValue";
|
||||
import { dedentBlockStringValue } from "../language/blockString";
|
||||
|
||||
interface BuildSchemaOptions extends GraphQLSchemaValidationOptions {
|
||||
/**
|
||||
|
||||
9
types/graphql/validation/validate.d.ts
vendored
9
types/graphql/validation/validate.d.ts
vendored
@@ -2,7 +2,7 @@ import { GraphQLError } from "../error";
|
||||
import { DocumentNode } from "../language/ast";
|
||||
import { GraphQLSchema } from "../type/schema";
|
||||
import { TypeInfo } from "../utilities/TypeInfo";
|
||||
import { ValidationRule } from "./ValidationContext";
|
||||
import { ValidationRule, SDLValidationRule } from "./ValidationContext";
|
||||
|
||||
/**
|
||||
* Implements the "Validation" section of the spec.
|
||||
@@ -27,6 +27,13 @@ export function validate(
|
||||
typeInfo?: TypeInfo
|
||||
): ReadonlyArray<GraphQLError>;
|
||||
|
||||
// @internal
|
||||
export function validateSDL(
|
||||
documentAST: DocumentNode,
|
||||
schemaToExtend?: GraphQLSchema | null,
|
||||
rules?: ReadonlyArray<SDLValidationRule>
|
||||
): GraphQLError[];
|
||||
|
||||
/**
|
||||
* Utility function which asserts a SDL document is valid by throwing an error
|
||||
* if it is invalid.
|
||||
|
||||
12
types/gtag.js/gtag.js-tests.ts
Normal file
12
types/gtag.js/gtag.js-tests.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
gtag('config', 'GA-TRACKING_ID');
|
||||
gtag('config', 'GA-TRACKING_ID', {send_page_view: false});
|
||||
|
||||
gtag('event', 'login', {
|
||||
method: 'Google'
|
||||
});
|
||||
|
||||
gtag('set', {currency: 'USD'});
|
||||
gtag('set', {
|
||||
country: 'US',
|
||||
currency: 'USD'
|
||||
});
|
||||
93
types/gtag.js/index.d.ts
vendored
Normal file
93
types/gtag.js/index.d.ts
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
// Type definitions for Google gtag.js API
|
||||
// Project: https://developers.google.com/gtagjs
|
||||
// Definitions by: Junyoung Choi <https://github.com/rokt33r>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var gtag: Gtag.Gtag;
|
||||
declare namespace Gtag {
|
||||
interface Gtag {
|
||||
(command: 'config', targetId: string, config?: ControlParams | EventParams | CustomParams): void;
|
||||
(command: 'set', config: CustomParams): void;
|
||||
(command: 'event', eventName: EventNames | string, eventParams?: ControlParams | EventParams | CustomParams): void;
|
||||
}
|
||||
|
||||
interface CustomParams {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface ControlParams {
|
||||
groups?: string | string[];
|
||||
send_to?: string | string[];
|
||||
event_callback?: () => void;
|
||||
event_timeout?: number;
|
||||
}
|
||||
|
||||
type EventNames = 'add_payment_info'
|
||||
| 'add_payment_info'
|
||||
| 'add_to_cart'
|
||||
| 'add_to_wishlist'
|
||||
| 'begin_checkout'
|
||||
| 'checkout_progress'
|
||||
| 'exception'
|
||||
| 'generate_lead'
|
||||
| 'login'
|
||||
| 'page_view'
|
||||
| 'purchase'
|
||||
| 'refund'
|
||||
| 'remove_from_cart'
|
||||
| 'screen_view'
|
||||
| 'search'
|
||||
| 'select_content'
|
||||
| 'set_checkout_option'
|
||||
| 'share'
|
||||
| 'sign_up'
|
||||
| 'timing_complete'
|
||||
| 'view_item'
|
||||
| 'view_item_list'
|
||||
| 'view_promotion'
|
||||
| 'view_search_results';
|
||||
|
||||
interface EventParams {
|
||||
checkout_option?: string;
|
||||
checkout_step?: number;
|
||||
content_id?: string;
|
||||
content_type?: string;
|
||||
coupon?: string;
|
||||
currency?: string;
|
||||
description?: string;
|
||||
fatal?: boolean;
|
||||
items?: Item[];
|
||||
method?: string;
|
||||
number?: string;
|
||||
promotions?: Promotion[];
|
||||
screen_name?: string;
|
||||
search_term?: string;
|
||||
shipping?: Currency;
|
||||
tax?: Currency;
|
||||
transaction_id?: string;
|
||||
value?: number;
|
||||
event_label?: string;
|
||||
event_category: string;
|
||||
}
|
||||
|
||||
type Currency = string | number;
|
||||
|
||||
interface Item {
|
||||
brand?: string;
|
||||
category?: string;
|
||||
creative_name?: string;
|
||||
creative_slot?: string;
|
||||
id?: string;
|
||||
location_id?: string;
|
||||
name?: string;
|
||||
price?: Currency;
|
||||
quantity?: number;
|
||||
}
|
||||
|
||||
interface Promotion {
|
||||
creative_name?: string;
|
||||
creative_slot?: string;
|
||||
id?: string;
|
||||
name?: string;
|
||||
}
|
||||
}
|
||||
24
types/gtag.js/tsconfig.json
Normal file
24
types/gtag.js/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gtag.js-tests.ts"
|
||||
]
|
||||
}
|
||||
6
types/gtag.js/tslint.json
Normal file
6
types/gtag.js/tslint.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"dt-header": false
|
||||
}
|
||||
}
|
||||
14
types/gulp-intercept/gulp-intercept-tests.ts
Normal file
14
types/gulp-intercept/gulp-intercept-tests.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import gulpIntercept = require('gulp-intercept');
|
||||
import gulp = require('gulp');
|
||||
import Vinyl = require('vinyl');
|
||||
|
||||
gulp.task('testTask', () => {
|
||||
return gulp.src(['src/*.html'])
|
||||
|
||||
.pipe(gulpIntercept((sourceFile: Vinyl) => {
|
||||
console.log(sourceFile.path);
|
||||
return sourceFile;
|
||||
}))
|
||||
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
22
types/gulp-intercept/index.d.ts
vendored
Normal file
22
types/gulp-intercept/index.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Type definitions for gulp-intercept 0.1
|
||||
// Project: https://github.com/khilnani/gulp-intercept
|
||||
// Definitions by: Takesi Tokugawa <https://github.com/TokugawaTakesi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import Vinyl = require('vinyl');
|
||||
|
||||
declare namespace intercept {
|
||||
interface Intercept {
|
||||
(interceptFunction: InterceptFunction): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface InterceptFunction {
|
||||
(file: Vinyl): Vinyl;
|
||||
}
|
||||
}
|
||||
|
||||
declare var intercept: intercept.Intercept;
|
||||
|
||||
export = intercept;
|
||||
23
types/gulp-intercept/tsconfig.json
Normal file
23
types/gulp-intercept/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gulp-intercept-tests.ts"
|
||||
]
|
||||
}
|
||||
9
types/html5-to-pdf/html5-to-pdf-tests.ts
Normal file
9
types/html5-to-pdf/html5-to-pdf-tests.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import * as HTML5ToPDF from "html5-to-pdf";
|
||||
|
||||
const options = { inputBody: "<html><body>Hello World</body></html>" };
|
||||
const converter = new HTML5ToPDF(options);
|
||||
converter.parseOptions(options); // $ExpectType ParsedOptions
|
||||
converter.build(); // $ExpectType Promise<Buffer>
|
||||
converter.includeAssets(); // $ExpectType Promise<void>
|
||||
converter.start(); // $ExpectType Promise<Page>
|
||||
converter.close(); // $ExpectType Promise<void>
|
||||
118
types/html5-to-pdf/index.d.ts
vendored
Normal file
118
types/html5-to-pdf/index.d.ts
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
// Type definitions for html5-to-pdf 3.1
|
||||
// Project: https://github.com/peterdemartini/html5-to-pdf
|
||||
// Definitions by: Sam Alexander <https://github.com/samalexander>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { LaunchOptions, PDFOptions, Page } from "puppeteer";
|
||||
|
||||
declare class HTML5ToPDF {
|
||||
constructor(options: HTML5ToPDF.Options);
|
||||
|
||||
build(): Promise<Buffer>;
|
||||
|
||||
close(): Promise<void>;
|
||||
|
||||
includeAssets(): Promise<void>;
|
||||
|
||||
parseOptions(options: HTML5ToPDF.Options): HTML5ToPDF.ParsedOptions;
|
||||
|
||||
start(): Promise<Page>;
|
||||
}
|
||||
|
||||
declare namespace HTML5ToPDF {
|
||||
interface FileDef {
|
||||
/**
|
||||
* File type
|
||||
*/
|
||||
type: "css" | "js";
|
||||
/**
|
||||
* File path
|
||||
*/
|
||||
filePath: string;
|
||||
}
|
||||
|
||||
interface ParsedOptions {
|
||||
body: string | Buffer;
|
||||
pdf: PDFOptions;
|
||||
templatePath: string;
|
||||
templateUrl: string;
|
||||
launchOptions: LaunchOptions;
|
||||
include: FileDef[];
|
||||
renderDelay: number;
|
||||
}
|
||||
|
||||
interface LegacyOptions {
|
||||
/**
|
||||
* [COMPATIBLE]\
|
||||
* Page size
|
||||
*/
|
||||
pageSize?: "A3" | "A4" | "Legal" | "Tabloid";
|
||||
/**
|
||||
* [COMPATIBLE]\
|
||||
* True for landscape, false for portrait.
|
||||
*/
|
||||
landscape?: boolean;
|
||||
/**
|
||||
* [NOT COMPATIBLE]\
|
||||
* 0 - default\
|
||||
* 1 - none\
|
||||
* 2 - minimum
|
||||
*/
|
||||
marginsType?: number;
|
||||
/**
|
||||
* [COMPATIBLE]\
|
||||
* Whether to print CSS backgrounds.
|
||||
*/
|
||||
printBackground?: boolean;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Path to the input HTML.
|
||||
*/
|
||||
inputPath?: string;
|
||||
/**
|
||||
* Path to the input html as a String, or Buffer. If specified this will override inputPath.
|
||||
*/
|
||||
inputBody?: string | Buffer;
|
||||
/**
|
||||
* Path to the output pdf file.
|
||||
*/
|
||||
outputPath?: string;
|
||||
/**
|
||||
* Delay in milliseconds before rendering the PDF (give HTML and CSS a chance to load).
|
||||
*/
|
||||
rendererDelay?: number;
|
||||
/**
|
||||
* A list of CSS or JS assets to include.
|
||||
*/
|
||||
include?: Array<string | FileDef>;
|
||||
/**
|
||||
* The template to use when rendering the html.
|
||||
*/
|
||||
template?: string;
|
||||
/**
|
||||
* The template to use for rendering the html. If this is set, it will use this instead of the template path.
|
||||
*/
|
||||
templateUrl?: string;
|
||||
/**
|
||||
* This object will be passed directly to `puppeteer`.
|
||||
*/
|
||||
pdf?: PDFOptions;
|
||||
/**
|
||||
* This object will be passed directly to `puppeteer`.
|
||||
*/
|
||||
launchOptions?: LaunchOptions;
|
||||
/**
|
||||
* @deprecated Legacy Options.
|
||||
* See `options.pdf` for pdf options. Since some of these options are converted over to work with `puppeteer`,
|
||||
* this is automatically done if `options.pdf` is left empty.
|
||||
*/
|
||||
options?: LegacyOptions;
|
||||
}
|
||||
}
|
||||
|
||||
export = HTML5ToPDF;
|
||||
|
||||
export as namespace HTML5ToPDF;
|
||||
26
types/html5-to-pdf/tsconfig.json
Normal file
26
types/html5-to-pdf/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom",
|
||||
"es2017"
|
||||
],
|
||||
"target": "es2017",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"html5-to-pdf-tests.ts"
|
||||
]
|
||||
}
|
||||
16
types/identicon.js/identicon.js-tests.ts
Normal file
16
types/identicon.js/identicon.js-tests.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import Identicon, { Svg } from "identicon.js";
|
||||
|
||||
// create an identicon with only a hash and a size
|
||||
new Identicon("d3b07384d113edec49eaa6238ad5ff00", 420).toString();
|
||||
|
||||
// create an identicon with a hash and other options and get the svg
|
||||
const svg = new Identicon("d3b07384d113edec49eaa6238ad5ff00", {
|
||||
background: [255, 255, 255, 255],
|
||||
foreground: [0, 0, 0, 0],
|
||||
margin: 0.05,
|
||||
size: 64,
|
||||
format: "svg",
|
||||
}).image() as Svg;
|
||||
svg.getDump();
|
||||
// or get the base64 encoded svg
|
||||
svg.getBase64();
|
||||
129
types/identicon.js/index.d.ts
vendored
Normal file
129
types/identicon.js/index.d.ts
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
// Type definitions for identicon.js 2.3
|
||||
// Project: https://github.com/stewartlord/identicon.js
|
||||
// Definitions by: D0miH <https://github.com/D0miH>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export type Color = [number, number, number, number];
|
||||
|
||||
export interface IdenticonOptions {
|
||||
background?: Color;
|
||||
foreground?: Color;
|
||||
margin?: number;
|
||||
size?: number;
|
||||
format?: "svg" | "png";
|
||||
}
|
||||
|
||||
export interface PNGlib {
|
||||
width: number;
|
||||
height: number;
|
||||
depth: number;
|
||||
|
||||
/**
|
||||
* Returns the index of a given pixel in the image data array.
|
||||
* @param x The given x coordinate of the pixel.
|
||||
* @param y The given y coordinate of the pixel.
|
||||
*/
|
||||
index(x: number, y: number): number;
|
||||
|
||||
/**
|
||||
* Returns the image as a base64 encoded string.
|
||||
*/
|
||||
getBase64(): string;
|
||||
|
||||
/**
|
||||
* Returns the png as a string.
|
||||
*/
|
||||
getDump(): string;
|
||||
}
|
||||
|
||||
export interface Svg {
|
||||
size: number;
|
||||
foreground: Color;
|
||||
background: Color;
|
||||
rectangles: [
|
||||
{
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
color: Color;
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns a string with the structure 'rgb(r, g, b, a)'.
|
||||
* @param red
|
||||
* @param green
|
||||
* @param blue
|
||||
* @param alpha
|
||||
*/
|
||||
color(red: number, green: number, blue: number, alpha: number): string;
|
||||
|
||||
/**
|
||||
* Returns the Svg as string.
|
||||
*/
|
||||
getDump(): string;
|
||||
|
||||
/**
|
||||
* Returns the Svg as a base64 encoded string.
|
||||
*/
|
||||
getBase64(): string;
|
||||
}
|
||||
|
||||
export default class Identicon {
|
||||
hash: string;
|
||||
foreground: Color;
|
||||
background: Color;
|
||||
size: number;
|
||||
format: "svg" | "png";
|
||||
margin: number;
|
||||
|
||||
constructor(hash: string, size?: number);
|
||||
constructor(hash: string, options: IdenticonOptions);
|
||||
|
||||
/**
|
||||
* Returns a new blank image as Svg or PNGlib.
|
||||
*/
|
||||
image(): Svg | PNGlib;
|
||||
|
||||
/**
|
||||
* Returns a new image as Svg or PNGlib with the identicon applied.
|
||||
*/
|
||||
render(): Svg | PNGlib;
|
||||
|
||||
/**
|
||||
* Places a rectangle at the given position with the given width, height and color in the image.
|
||||
* @param x The x coordinate.
|
||||
* @param y The y coordinate
|
||||
* @param w The width.
|
||||
* @param h The height.
|
||||
* @param color The color.
|
||||
* @param image The image.
|
||||
*/
|
||||
rectangle(
|
||||
x: number,
|
||||
y: number,
|
||||
w: number,
|
||||
h: number,
|
||||
color: Color,
|
||||
image: Svg | PNGlib
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Converts from hsl to rgb.
|
||||
* @param h hue
|
||||
* @param s saturation
|
||||
* @param b brightness
|
||||
*/
|
||||
hsl2rgb(h: number, s: number, b: number): [number, number, number];
|
||||
|
||||
/**
|
||||
* Returns the image data as a string.
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
/**
|
||||
* Returns true if the identicon is a Svg.
|
||||
*/
|
||||
isSvg(): boolean;
|
||||
}
|
||||
23
types/identicon.js/tsconfig.json
Normal file
23
types/identicon.js/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"identicon.js-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/identicon.js/tslint.json
Normal file
1
types/identicon.js/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
17
types/ink-select-input/index.d.ts
vendored
17
types/ink-select-input/index.d.ts
vendored
@@ -1,25 +1,28 @@
|
||||
// Type definitions for ink-select-input 2.0
|
||||
// Type definitions for ink-select-input 3.0
|
||||
// Project: https://github.com/vadimdemedes/ink-select-input#readme
|
||||
// Definitions by: Łukasz Ostrowski <https://github.com/lukostry>
|
||||
// Jakub Satnik <https://github.com/shatodj>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { Component, InkComponent } from 'ink';
|
||||
import { Component } from 'react';
|
||||
|
||||
interface ItemOfSelectInput {
|
||||
export interface ItemOfSelectInput {
|
||||
label: string;
|
||||
value: any;
|
||||
key?: string | number;
|
||||
}
|
||||
|
||||
interface SelectInputProps<T extends ItemOfSelectInput = ItemOfSelectInput> {
|
||||
export interface SelectInputProps<T extends ItemOfSelectInput = ItemOfSelectInput> {
|
||||
focus?: boolean;
|
||||
indicatorComponent?: InkComponent;
|
||||
itemComponent?: InkComponent;
|
||||
indicatorComponent?: Component;
|
||||
itemComponent?: Component;
|
||||
items?: ReadonlyArray<T>;
|
||||
limit?: number;
|
||||
initialIndex?: number;
|
||||
onSelect?: (item: T) => void;
|
||||
}
|
||||
|
||||
declare class SelectInput extends Component<SelectInputProps> { }
|
||||
|
||||
export = SelectInput;
|
||||
export default SelectInput;
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
/** @jsx h */
|
||||
import { h, InkComponent } from 'ink';
|
||||
import SelectInput from 'ink-select-input';
|
||||
import * as React from 'react';
|
||||
|
||||
// tslint:disable-next-line:import-name
|
||||
import SelectInput, { ItemOfSelectInput } from 'ink-select-input';
|
||||
// NOTE: `import SelectInput = require('ink-select-input');` will work as well.
|
||||
// If importing using ES6 default import as above,
|
||||
// `allowSyntheticDefaultImports` flag in compiler options needs to be set to `true`
|
||||
|
||||
interface DemoItem {
|
||||
label: string;
|
||||
value: string;
|
||||
const items: ReadonlyArray<ItemOfSelectInput> = [
|
||||
{
|
||||
label: 'First',
|
||||
value: 'first',
|
||||
key: 0,
|
||||
},
|
||||
{
|
||||
label: 'Second',
|
||||
value: 'second',
|
||||
},
|
||||
{
|
||||
label: 'Third',
|
||||
value: 'third',
|
||||
},
|
||||
];
|
||||
|
||||
class Demo extends React.PureComponent {
|
||||
handleSelect = (item: ItemOfSelectInput) => {};
|
||||
|
||||
render() {
|
||||
return <SelectInput items={items} onSelect={this.handleSelect} />;
|
||||
}
|
||||
}
|
||||
|
||||
const items: ReadonlyArray<DemoItem> = [{
|
||||
label: 'First',
|
||||
value: 'first'
|
||||
},
|
||||
{
|
||||
label: 'Second',
|
||||
value: 'second'
|
||||
},
|
||||
{
|
||||
label: 'Third',
|
||||
value: 'third'
|
||||
}];
|
||||
|
||||
const Demo: InkComponent = () => {
|
||||
const handleSelect = (item: DemoItem) => {
|
||||
console.log(item);
|
||||
};
|
||||
|
||||
return <SelectInput items={items} onSelect={handleSelect} />;
|
||||
};
|
||||
|
||||
2
types/is-glob/index.d.ts
vendored
2
types/is-glob/index.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
// Type definitions for is-glob 4.0
|
||||
// Project: https://github.com/jonschlinkert/is-glob
|
||||
// Project: https://github.com/micromatch/is-glob
|
||||
// Definitions by: mrmlnc <https://github.com/mrmlnc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
3
types/js-cookie/index.d.ts
vendored
3
types/js-cookie/index.d.ts
vendored
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Theodore Brown <https://github.com/theodorejb>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Antoine Lépée <https://github.com/alepee>
|
||||
// Yuto Doi <https://github.com/yutod>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -88,7 +89,7 @@ declare namespace Cookies {
|
||||
* will run the converter first for each cookie. The returned
|
||||
* string will be used as the cookie value.
|
||||
*/
|
||||
withConverter<TConv extends object>(converter: CookieReadConverter | { write: CookieWriteConverter<TConv>; read: CookieReadConverter; }): CookiesStatic<TConv>;
|
||||
withConverter<TConv extends object>(converter: CookieReadConverter | { write?: CookieWriteConverter<TConv>; read?: CookieReadConverter; }): CookiesStatic<TConv>;
|
||||
}
|
||||
|
||||
type CookieWriteConverter<T extends object> = (value: string | T, name: string) => string;
|
||||
|
||||
@@ -53,3 +53,15 @@ const PHPCookies = Cookies.withConverter<object>({
|
||||
.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
|
||||
}
|
||||
});
|
||||
|
||||
const BlankConverterCookies = Cookies.withConverter({
|
||||
read(value, name) {
|
||||
if (name === 'hoge') {
|
||||
return value.replace('hoge', 'fuga');
|
||||
}
|
||||
return value;
|
||||
}
|
||||
});
|
||||
|
||||
document.cookie = 'hoge=hogehoge';
|
||||
BlankConverterCookies.get('hoge');
|
||||
|
||||
16
types/license-checker-webpack-plugin/index.d.ts
vendored
16
types/license-checker-webpack-plugin/index.d.ts
vendored
@@ -7,7 +7,7 @@
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
declare class LicenseCheckerWebpackPlugin extends Plugin {
|
||||
constructor(options: LicenseCheckerWebpackPlugin.Options);
|
||||
constructor(options?: Partial<LicenseCheckerWebpackPlugin.Options>);
|
||||
}
|
||||
|
||||
declare namespace LicenseCheckerWebpackPlugin {
|
||||
@@ -23,14 +23,14 @@ declare namespace LicenseCheckerWebpackPlugin {
|
||||
/**
|
||||
* Regular expression that matches the file paths of dependencies to check.
|
||||
*/
|
||||
filter?: RegExp;
|
||||
filter: RegExp;
|
||||
|
||||
/**
|
||||
* SPDX expression with allowed licenses.
|
||||
*
|
||||
* Default: `"(Apache-2.0 OR BSD-2-Clause OR BSD-3-Clause OR MIT)"`
|
||||
*/
|
||||
allow?: string;
|
||||
allow: string;
|
||||
|
||||
/**
|
||||
* Array of dependencies to ignore, in the format `["<dependency name>@<version range>"]`.
|
||||
@@ -38,7 +38,7 @@ declare namespace LicenseCheckerWebpackPlugin {
|
||||
*
|
||||
* Default: `[]`
|
||||
*/
|
||||
ignore?: string[];
|
||||
ignore: string[];
|
||||
|
||||
/**
|
||||
* Object of dependencies to override, in the format `{"<dependency name>@<version range>": { ... }}`.
|
||||
@@ -46,27 +46,27 @@ declare namespace LicenseCheckerWebpackPlugin {
|
||||
*
|
||||
* Default: `{}`
|
||||
*/
|
||||
override?: Record<string, Partial<Dependency>>;
|
||||
override: Record<string, Partial<Dependency>>;
|
||||
|
||||
/**
|
||||
* Whether to emit errors instead of warnings.
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
emitError?: boolean;
|
||||
emitError: boolean;
|
||||
|
||||
/**
|
||||
* Path to a `.ejs` template, or function that will generate the contents
|
||||
* of the third-party notices file.
|
||||
*/
|
||||
outputWriter?: string | ((dependencies: Dependency[]) => string);
|
||||
outputWriter: string | ((dependencies: Dependency[]) => string);
|
||||
|
||||
/**
|
||||
* Name of the third-party notices file with all licensing information.
|
||||
*
|
||||
* Default: `"ThirdPartyNotices.txt"`
|
||||
*/
|
||||
outputFilename?: string;
|
||||
outputFilename: string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,3 +22,6 @@ new LicenseCheckerWebpackPlugin({
|
||||
return dependencies.map(d => `${d.name} ${d.licenseName}`).join('\n');
|
||||
},
|
||||
});
|
||||
|
||||
// $ExpectType LicenseCheckerWebpackPlugin
|
||||
new LicenseCheckerWebpackPlugin();
|
||||
|
||||
@@ -4989,7 +4989,7 @@ fp.now(); // $ExpectType number
|
||||
_.create(prototype, properties); // $ExpectType { a: number; } & { b: string; }
|
||||
_(prototype).create(properties); // $ExpectType LoDashImplicitWrapper<{ a: number; } & { b: string; }>
|
||||
_.chain(prototype).create(properties); // $ExpectType LoDashExplicitWrapper<{ a: number; } & { b: string; }>
|
||||
fp.create(prototype); // $ExpectType { a: number; }
|
||||
const combined: { a: number } & object = fp.create(prototype);
|
||||
}
|
||||
|
||||
// _.defaultsDeep
|
||||
|
||||
636
types/naver-whale/index.d.ts
vendored
Normal file
636
types/naver-whale/index.d.ts
vendored
Normal file
@@ -0,0 +1,636 @@
|
||||
// Type definitions for Naver Whale extension development
|
||||
// Project: https://developers.whale.naver.com/getting_started/
|
||||
// Definitions by: tbvjaos510 <https://github.com/tbvjaos510>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
/// <reference types="chrome" />
|
||||
|
||||
declare interface Window {
|
||||
whale: typeof whale;
|
||||
}
|
||||
declare namespace chrome.downloads {
|
||||
export interface StateType {
|
||||
readonly COMPLETE: string;
|
||||
readonly IN_PROGRESS: string;
|
||||
readonly INTERRUPTED: string;
|
||||
}
|
||||
export const State: StateType;
|
||||
}
|
||||
|
||||
declare namespace whale {
|
||||
/**
|
||||
* 지정한 주기 혹은 시간에 코드가 실행되도록 예약합니다
|
||||
* 권한: "alarms"
|
||||
* @since Chrome 22.
|
||||
*/
|
||||
export import alarms = chrome.alarms;
|
||||
|
||||
/**
|
||||
* 북마크의 생성, 삭제, 수정 및 폴더 변경 등 북마크에 관한 기능을 제공합니다. 이 API를 이용해 북마크 관리자를 만들 수 있습니다.
|
||||
* 권한: "bookmarks"
|
||||
* @since Chrome 5.
|
||||
*/
|
||||
export import bookmarks = chrome.bookmarks;
|
||||
|
||||
/**
|
||||
* 주소창 오른쪽 툴바 영역에 나타나는 버튼을 제어 할 수 있습니다. 아이콘을 변경하거나 뱃지를 표시할 수도 있고, 팝업이 나타나게 할 수도 있습니다.
|
||||
* Manifest: "browser_action": {...}
|
||||
* @since Chrome 5.
|
||||
*/
|
||||
export import browserAction = chrome.browserAction;
|
||||
|
||||
/**
|
||||
* 인터넷 사용 기록을 삭제할 수 있습니다. 설정 > 개인정보 보호 > 인터넷 사용 기록 삭제 영역의 각 항목별 삭제를 수행할 수 있습니다.
|
||||
* 권한: "browsingData"
|
||||
* @since Chrome 19.
|
||||
*/
|
||||
export import browsingData = chrome.browsingData;
|
||||
|
||||
/**
|
||||
* 확장앱에 단축키를 부여할 수 있습니다.
|
||||
* Manifest: "commands": {...}
|
||||
* @since Chrome 16.
|
||||
*/
|
||||
export import commands = chrome.commands;
|
||||
|
||||
/**
|
||||
* 쿠키, 자바스크립트, 마이크 등 웹 사이트에서 요청한 정보를 제공할 것인지 설정할 수 있습니다. 설정 > 개인정보 보호 > 콘텐츠 설정에서 확인할 수 있는 항목을 제어할 수 있습니다.
|
||||
* 권한: "contentSettings"
|
||||
* @since Chrome 16.
|
||||
*/
|
||||
export import contentSettings = chrome.contentSettings;
|
||||
|
||||
/**
|
||||
* 마우스 오른쪽 버튼을 클릭하면 나타나는 콘텍스트 메뉴를 만들 수 있습니다. 페이지, 링크, 이미지 등 클릭한 위치에 따라 서로 다른 메뉴를 표시할 수 있습니다
|
||||
* 권한: "contextMenus"
|
||||
* @since Chrome 6.
|
||||
*/
|
||||
export import contextMenus = chrome.contextMenus;
|
||||
|
||||
/**
|
||||
* 쿠키를 제어하거나 변경시 이벤트를 수신할 수 있습니다
|
||||
* 권한: "cookies", host 권한
|
||||
* @since Chrome 6.
|
||||
*/
|
||||
export import cookies = chrome.cookies;
|
||||
|
||||
/**
|
||||
* 특정 탭의 네트워크 통신, JavaScript 디버깅, DOM · CSS 변형 등 디버그를 위한 [원격 디버깅 프로토콜](https://chromedevtools.github.io/devtools-protocol/tot/Network)을 사용할 수 있습니다.
|
||||
* `sendCommand()` 메소드와 `onEvent` 핸들러 함수를 이용해 개발자도구에서 제공하는 개별 기능을 명령 단위로 수행할 수 있습니다.
|
||||
* 권한: "debugger"
|
||||
* @since Chrome 18.
|
||||
*/
|
||||
const _debugger: typeof chrome.debugger;
|
||||
export { _debugger as debugger };
|
||||
|
||||
/**
|
||||
* 웹 페이지에 대한 접근 권한 요청없이 특정 페이지의 콘텐트 혹은 상태에 의존적인 동작을 수행할 수 있습니다.
|
||||
* 권한: "declarativeContent"
|
||||
* @since Chrome 33.
|
||||
*/
|
||||
export import declarativeContent = chrome.declarativeContent;
|
||||
|
||||
/**
|
||||
* 화면, 윈도우 또는 탭의 콘텐츠를 캡쳐할 수 있습니다.
|
||||
* 권한: "desktopCapture"
|
||||
* @since Chrome 34.
|
||||
*/
|
||||
export import desktopCapture = chrome.desktopCapture;
|
||||
|
||||
export namespace devtools {
|
||||
/**
|
||||
* 개발자도구를 이용한 검사(Inspect)가 진행중인 윈도우에서 코드를 실행하거나 페이지를 새로고침 하는 등의 작업을 수행할 수 있습니다.
|
||||
* @since Chrome 18.
|
||||
*/
|
||||
|
||||
export import inspectedWindow = chrome.devtools.inspectedWindow;
|
||||
|
||||
/**
|
||||
* 개발자도구 > 네트워크 패널에서 수신하는 정보들을 수신할 수 있습니다.
|
||||
* @since Chrome 18.
|
||||
*/
|
||||
export import network = chrome.devtools.network;
|
||||
|
||||
/**
|
||||
* 개발자도구에 새로운 패널을 추가하거나 기존의 패널에 접근할 수 있습니다.
|
||||
* @since Chrome 18.
|
||||
*/
|
||||
export import panels = chrome.devtools.panels;
|
||||
}
|
||||
|
||||
/**
|
||||
* 지정한 URL의 파일 다운로드, 진행중인 다운로드의 제어 및 검색 등 파일 다운로드에 관련된 기능을 사용할 수 있습니다.
|
||||
* 권한: "downloads"
|
||||
* @since Chrome 31
|
||||
*/
|
||||
export import downloads = chrome.downloads;
|
||||
|
||||
/**
|
||||
* 웨일 브라우저 API에서 사용되는 공통 이벤트 자료형을 포함하는 네임스페이스입니다.
|
||||
* @since Chrome 21.
|
||||
*/
|
||||
export import events = chrome.events;
|
||||
|
||||
/**
|
||||
* 서로 다른 확장앱 사이에 메시지를 교환하거나, 현재 확장앱에 관한 정보를 얻을 수 있습니다.
|
||||
* @since Chrome 5.
|
||||
*/
|
||||
export import extension = chrome.extension;
|
||||
|
||||
/**
|
||||
* 글꼴 관련 설정을 제어할 수 있습니다.
|
||||
* 권한: "fontSettings"
|
||||
* @since Chrome 22.
|
||||
*/
|
||||
export import fontSettings = chrome.fontSettings;
|
||||
|
||||
/**
|
||||
* Google Cloud Messaging 서비스와 메시지를 주고받습니다.
|
||||
* 권한: "gcm"
|
||||
* @since Chrome 35.
|
||||
*/
|
||||
export import gcm = chrome.gcm;
|
||||
|
||||
/**
|
||||
* 방문 기록의 생성, 삭제 및 검색 등 방문 기록에 관한 기능을 제공합니다. 이 API를 이용해 방문 기록 페이지를 만들 수 있습니다.
|
||||
* 권한: "history"
|
||||
* @since Chrome 5.
|
||||
*/
|
||||
export import history = chrome.history;
|
||||
|
||||
/**
|
||||
* 다국어 지원을 위한 기능을 제공합니다.
|
||||
* @since Chrome 5.
|
||||
*/
|
||||
export import i18n = chrome.i18n;
|
||||
|
||||
/**
|
||||
* 시스템의 유휴 상태(Idle) 여부를 확인하거나 변화를 감지할 수 있습니다.
|
||||
* 권한: "idle"
|
||||
* @since Chrome 6.
|
||||
*/
|
||||
export import idle = chrome.idle;
|
||||
|
||||
/**
|
||||
* 설치되어 있는 확장앱 정보를 얻어 제어할 수 있습니다.
|
||||
* 권한: "management"
|
||||
* @since Chrome 8.
|
||||
*/
|
||||
export import management = chrome.management;
|
||||
|
||||
/**
|
||||
* 시스템 트레이에 알림창을 표시할 수 있습니다.
|
||||
* 권한: "notifications"
|
||||
* @since Chrome 28.
|
||||
*/
|
||||
export import notifications = chrome.notifications;
|
||||
|
||||
/**
|
||||
* 주소창에서 특정 키워드를 입력하면 확장앱이 주소창 영역에 관여하게 할 수 있습니다.
|
||||
* Manifest: "omnibox": {...}
|
||||
* @since Chrome 9.
|
||||
*/
|
||||
export import omnibox = chrome.omnibox;
|
||||
|
||||
/**
|
||||
* 주소창 오른쪽 툴바 영역에 나타나는 버튼을 제어 할 수 있습니다.
|
||||
* `browserAction`과 거의 동일하지만 현재 페이지에 대해서만 기능을 수행하기 위해 제공된다는 점이 다릅니다. 비활성 상태에서는 버튼이 회색으로 표시됩니다.
|
||||
* Manifest: "page_action": {...}
|
||||
* @since Chrome 5.
|
||||
*/
|
||||
export import pageAction = chrome.pageAction;
|
||||
|
||||
/**
|
||||
* 지정한 탭의 웹 페이지를 MHTML 형식으로 저장할 수 있습니다.
|
||||
* 권한: "pageCapture"
|
||||
* @since Chrome 18.
|
||||
*/
|
||||
export import pageCapture = chrome.pageCapture;
|
||||
|
||||
/**
|
||||
* 매니페스트에 optional_permissions로 정의한 추가 권한을 사용자에게 요청할 수 있습니다
|
||||
* @since Chrome 16.
|
||||
*/
|
||||
export import permissions = chrome.permissions;
|
||||
|
||||
/**
|
||||
* 전원 관리 기능을 제어할 수 있습니다.
|
||||
* 권한: "power"
|
||||
*/
|
||||
export import power = chrome.power;
|
||||
|
||||
/**
|
||||
* The chrome.printerProvider API exposes events used by print manager to query printers controlled by extensions, to query their capabilities and to submit print jobs to these printers.
|
||||
* 권한: "printerProvider"
|
||||
*/
|
||||
export import printerProvider = chrome.printerProvider;
|
||||
|
||||
/**
|
||||
* 개인정보 보호 관련 설정을 제어할 수 있습니다.
|
||||
* 권한: "privacy"
|
||||
*/
|
||||
export import privacy = chrome.privacy;
|
||||
|
||||
/**
|
||||
* 프록시 관련 설정을 제어할 수 있습니다.
|
||||
* 권한: "proxy"
|
||||
*/
|
||||
export import proxy = chrome.proxy;
|
||||
|
||||
/**
|
||||
* 백그라운드 페이지 검색, 매니페스트 확인 및 확장앱 수명주기에 관한 이벤트 수신, 메시지 교환 등의 기능을 제공합니다.
|
||||
*/
|
||||
export import runtime = chrome.runtime;
|
||||
|
||||
/**
|
||||
* 웨일 사이드바 API.
|
||||
* Manifest: "sidebar_action": {...}
|
||||
* @since whale
|
||||
*/
|
||||
export namespace sidebarAction {
|
||||
export interface SidebarShowDetail {
|
||||
/** Optional. 사이드바 영역에 표시할 페이지 URL. 지정하지 않으면 매니페스트에 정의한 default_page. */
|
||||
url?: string;
|
||||
/**
|
||||
* Optional. url 인자와 현재 URL이 같을 때에도 페이지를 새로고침 할 것인지 여부.
|
||||
* @default false
|
||||
*/
|
||||
reload?: boolean;
|
||||
}
|
||||
|
||||
export interface SidebarTitleDetail {
|
||||
title: string;
|
||||
}
|
||||
|
||||
export interface SidebarIconDetail {
|
||||
/**
|
||||
* 아이콘 이미지 데이터입니다. @see https://developer.chrome.com/extensions/pageAction#type-ImageDataType
|
||||
* */
|
||||
icon: ImageData;
|
||||
}
|
||||
|
||||
export interface SidebarPageDetail {
|
||||
/** html 파일의 리소스 경로. 빈 문자열(‘’)로 설정하면 사이드바에 빈화면이 보입니다. */
|
||||
page: string;
|
||||
}
|
||||
|
||||
export interface SidebarBadgeDetail {
|
||||
/** 설정할 badge 문자열 */
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface SidebarDockDetail {
|
||||
/** 부모 윈도우의 ID. 지정하지 않으면 마지막 사용된 윈도우에 도킹합니다. */
|
||||
targetWindowId?: number;
|
||||
}
|
||||
|
||||
export interface BadgeBackgroundColorDetails {
|
||||
/** 색상값 배열([255, 0, 0, 255]) 혹은 HEX 색상 표현 문자열(#FF0000). */
|
||||
color: string | ColorArray;
|
||||
}
|
||||
export type ColorArray = [number, number, number, number];
|
||||
|
||||
export interface BrowserClickedEvent
|
||||
extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> {}
|
||||
|
||||
/**
|
||||
* 지정한 윈도우에 사이드바 영역을 열고 포커스를 주는 메소드입니다. 이미 사이드바가 열려있다면 포커스만 옮겨줍니다.
|
||||
*
|
||||
* @param windowId Optional. 대상 윈도우의 ID.
|
||||
* @param details Optional. url 설정
|
||||
* @param callback Optional. 콜백 함수. 인자값으로 windowId가 넘어감
|
||||
*/
|
||||
export function show(
|
||||
windowId: number,
|
||||
details?: SidebarShowDetail,
|
||||
callback?: (windowId: number) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 현재 윈도우에 사이드바 영역을 열고 포커스를 주는 메소드입니다. 이미 사이드바가 열려있다면 포커스만 옮겨줍니다.
|
||||
*
|
||||
* @param details Optional. url 설정
|
||||
* @param callback Optional. 콜백 함수. 인자값으로 windowId가 넘어감
|
||||
*/
|
||||
export function show(
|
||||
details: SidebarShowDetail,
|
||||
callback?: (windowId: number) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 현재 윈도우에 사이드바 영역을 열고 포커스를 주는 메소드입니다. 이미 사이드바가 열려있다면 포커스만 옮겨줍니다.
|
||||
*
|
||||
* @param callback Optional. 콜백 함수. 인자값으로 windowId가 넘어감
|
||||
*/
|
||||
export function show(callback: (windowId: number) => void): void;
|
||||
|
||||
/**
|
||||
* 현재 윈도우에 사이드바 영역을 열고 포커스를 주는 메소드입니다. 이미 사이드바가 열려있다면 포커스만 옮겨줍니다.
|
||||
*
|
||||
*/
|
||||
export function show(): void;
|
||||
|
||||
/**
|
||||
* 지정된 윈도우의 사이드바를 닫습니다. 현재 확장앱에 포커스가 있는 상황에만 동작합니다.
|
||||
* @param windowId Optional. 대상 윈도우의 ID. 지정하지 않으면 현재 윈도우.
|
||||
* @param callback Optional. 콜백 함수. 인자값으로 windowId가 넘어감
|
||||
*/
|
||||
export function hide(
|
||||
windowId: number,
|
||||
callback?: (windowId: number) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 현재 윈도우의 사이드바를 닫습니다. 현재 확장앱에 포커스가 있는 상황에만 동작합니다.
|
||||
* @param callback Optional. 콜백 함수. 인자값으로 windowId가 넘어감
|
||||
*/
|
||||
export function hide(callback: (windowId: number) => void): void;
|
||||
|
||||
/**
|
||||
* 현재 윈도우의 사이드바를 닫습니다. 현재 확장앱에 포커스가 있는 상황에만 동작합니다.
|
||||
*/
|
||||
export function hide(): void;
|
||||
|
||||
/**
|
||||
* 확장앱 아이콘에 마우스를 올렸을 때 나타나는 툴팁 문자열을 변경합니다.
|
||||
* sidebar_action 에서 default_title 속성으로 지정하는 영역입니다.
|
||||
* 열려 있는 모든 윈도우에 동시 적용됩니다.
|
||||
* @param details 설정 할 데이터
|
||||
*/
|
||||
export function setTitle(details: SidebarTitleDetail): void;
|
||||
|
||||
/**
|
||||
* 확장앱 아이콘에 마우스를 올렸을 때 나타나는 툴팁 문자열을 반환합니다.
|
||||
* sidebar_action 에서 default_title 속성으로 지정한 영역입니다.
|
||||
* @param callback title을 담은 결과를 인자값으로 넣은 콜백 함수
|
||||
*/
|
||||
export function getTitle(callback: (result: string) => void): void;
|
||||
|
||||
/**
|
||||
* 확장앱 아이콘을 동적으로 변경합니다. 열려 있는 모든 윈도우에 동시 적용됩니다.
|
||||
* @param details 아이콘 데이터
|
||||
*/
|
||||
export function setIcon(details: SidebarIconDetail): void;
|
||||
|
||||
/**
|
||||
* 확장앱 아이콘이 클릭되었을 때, 로딩되는 페이지 리소스의 경로를 변경합니다.
|
||||
* @param details 페이지 상세 정보
|
||||
*/
|
||||
export function setPage(details: SidebarPageDetail): void;
|
||||
|
||||
/**
|
||||
* 사이드바 확장앱 아이콘이 클릭되었을 때, 로딩되는 페이지 리소스의 경로를 반환합니다.
|
||||
* @param callback 현재 page 경로를 인자값으로 넣은 콜백 함수
|
||||
*/
|
||||
export function getPage(callback: (result: string) => void): void;
|
||||
|
||||
/**
|
||||
* 확장앱 아이콘 위에 표시되는 뱃지의 문자열을 변경합니다. 열려 있는 모든 윈도우에 동시 적용됩니다.
|
||||
* @param details badge 정보
|
||||
*/
|
||||
export function setBadgeText(details: SidebarBadgeDetail): void;
|
||||
|
||||
/**
|
||||
* 사이드바 확장앱 아이콘 위에 표시되는 뱃지의 문자열을 반환합니다.
|
||||
* @param callback 현재 뱃지 텍스트를 인자값으로 넣은 콜백 함수.
|
||||
*/
|
||||
export function getBadgeText(callback: (result: string) => void): void;
|
||||
|
||||
/**
|
||||
* 확장앱 아이콘 위에 표시되는 뱃지의 배경 색상을 변경합니다. 열려 있는 모든 윈도우에 동시 적용됩니다.
|
||||
* @param details 뱃지 배경 색상을 담은 객체
|
||||
*/
|
||||
export function setBadgeBackgroundColor(
|
||||
details: BadgeBackgroundColorDetails
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 확장앱 아이콘 위에 표시되는 뱃지의 배경색상을 반환합니다.
|
||||
* @param callback 뱃지 배경 색상. RGBA 색상값 배열 [R, G, B, A]를 담은 인자값으로 넣은 콜백 함수.
|
||||
*/
|
||||
export function getBadgeBackgroundColor(
|
||||
callback: (color: ColorArray) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 팝업 윈도우를 사이드바에 도킹합니다. details를 통해 도킹하고자 하는 부모 윈도우를 지정할 수 있습니다.
|
||||
* 도킹 후에는 팝업 윈도우의 ID는 더 이상 유효하지 않습니다.
|
||||
* @param popupWindowId 팝업 윈도우의 ID.
|
||||
* @param details Optional. 부모 윈도우의 ID를 담은 객체
|
||||
* @param callback 도킹 된 windowId를 인자값으로 넣은 콜백 함수.
|
||||
*/
|
||||
export function dock(
|
||||
popupWindowId: number,
|
||||
details: SidebarDockDetail,
|
||||
callback: (windowId: number) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 팝업 윈도우를 사이드바에 도킹합니다. details를 통해 도킹하고자 하는 부모 윈도우를 지정할 수 있습니다.
|
||||
* 도킹 후에는 팝업 윈도우의 ID는 더 이상 유효하지 않습니다.
|
||||
* @param popupWindowId 팝업 윈도우의 ID.
|
||||
* @param callback 도킹 된 windowId를 인자값으로 넣은 콜백 함수.
|
||||
*/
|
||||
export function dock(
|
||||
popupWindowId: number,
|
||||
callback: (windowId: number) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 도킹된 윈도우를 부모 윈도우에서 떼어냅니다.
|
||||
* @param popupWindowId 부모 윈도우의 ID
|
||||
* @param callback 새로 부여된 윈도우 Id를 인자값으로 넣은 콜백 함수.
|
||||
* 여기서 windowId는 `whale.sidebarAction.dock()`으로 붙일 때 사용했던 윈도우 ID와는 다르다.
|
||||
*/
|
||||
export function undock(
|
||||
popupWindowId: number,
|
||||
callback: (windowId: number) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 사이드바 확장앱 아이콘이 클릭될 때 발생하는 이벤트 핸들러
|
||||
*/
|
||||
export var onClicked: BrowserClickedEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 데이터 저장소 기능을 제공합니다. 데이터 변경시 이벤트를 수신할 수 있습니다. 이 API를 이용해 저장한 데이터는 쿠키, 웹 스토리지 등 인터넷 사용 기록과는 별도로 관리됩니다.
|
||||
* 권한: "storage"
|
||||
* @since Chrome 20.
|
||||
*/
|
||||
export import storage = chrome.storage;
|
||||
|
||||
export namespace system {
|
||||
/**
|
||||
* 시스템 CPU 관련 정보를 얻을 수 있습니다.
|
||||
* 권한: "system.cpu"
|
||||
* @since Chrome 32.
|
||||
*/
|
||||
export import cpu = chrome.system.cpu;
|
||||
|
||||
/**
|
||||
* 시스템 메모리 관련 정보를 얻을 수 있습니다.
|
||||
* 권한: "system.memory"
|
||||
* @since Chrome 32.
|
||||
*/
|
||||
export import memory = chrome.system.memory;
|
||||
|
||||
/**
|
||||
* 시스템 연결된 이동식 저장매체에 대한 정보를 얻을 수 있습니다. 새로운 이동식 저장매체가 연결되거나, 이미 연결되어 있던 매체가 연결 해제되는 경우 이벤트를 수신할 수 있습니다.
|
||||
* Permissions: "system.storage"
|
||||
* @since Chrome 30.
|
||||
*/
|
||||
export import storage = chrome.system.storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 지정한 탭의 미디어 스트림을 캡쳐할 수 있습니다
|
||||
* 권한: "tabCapture"
|
||||
* @since Chrome 31.
|
||||
*/
|
||||
export import tabCapture = chrome.tabCapture;
|
||||
|
||||
/**
|
||||
* 새로운 탭을 생성하거나 이미 생성된 탭을 제어할 수 있습니다.
|
||||
* @since Chrome 5.
|
||||
*/
|
||||
export import tabs = chrome.tabs;
|
||||
|
||||
/**
|
||||
* 새 탭 페이지의 "자주 가는 사이트" 목록을 얻거나 수정, 검색 할 수 있습니다.
|
||||
* Whale에서 더 많은 기능을 지원합니다.
|
||||
* 권한: "topSites"
|
||||
* @since Chrome 19.
|
||||
*
|
||||
*/
|
||||
export namespace topSites {
|
||||
/** 많이 방문한 URL을 저장하는 Object입니다. get에서 사용됩니다. */
|
||||
export interface MostVisitedURL {
|
||||
/** 많이 방문한 url. */
|
||||
url: string;
|
||||
/** 페이지 제목 */
|
||||
title: string;
|
||||
/**
|
||||
* 방문기록에서 판단한 여부입니다.
|
||||
* api로 추가한 경우에는 false입니다.
|
||||
*/
|
||||
from_history: boolean;
|
||||
}
|
||||
|
||||
/** 많이 방문한 URL을 저장하는 Object입니다. search에서 사용됩니다. */
|
||||
export interface MostVisitedURL2 {
|
||||
/** 많이 방문한 url. */
|
||||
url: string;
|
||||
/** 페이지 제목 */
|
||||
title: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 자주 가는 사이트를 전부 리스트로 담아옵니다.
|
||||
* @param callback 결과를 콜백함수의 인자값으로 보냅니다.
|
||||
*/
|
||||
export function get(callback: (data: MostVisitedURL[]) => void): void;
|
||||
|
||||
/**
|
||||
* 자주 가는 사이트에 url과 title을 추가합니다.
|
||||
* @param url 추가할 url
|
||||
* @param title 제목
|
||||
* @param callback 상태를 콜백 함수의 인자값으로 보냅니다. 성공시 true, 실패시 false
|
||||
*/
|
||||
export function add(
|
||||
url: string,
|
||||
title: string,
|
||||
callback?: (status: boolean) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 자주 가는 사이트에서 해당 url을 삭제합니다.
|
||||
* @param url 삭제할 url
|
||||
*/
|
||||
var _delete: (url: string) => void;
|
||||
export { _delete as delete };
|
||||
|
||||
/**
|
||||
* 자주 가는 사이트에서 해당 url을 숨깁니다.
|
||||
* @param url block할 url
|
||||
*/
|
||||
export function block(url: string): void;
|
||||
|
||||
/**
|
||||
* 자주 가는 사이트에서 숨겨진 url을 보이게 합니다.
|
||||
* @param url block을 풀 url
|
||||
*/
|
||||
export function unblock(url: string): void;
|
||||
|
||||
/**
|
||||
* 자주 가는 사이트에 block당한 여부를 확인합니다.
|
||||
* @param url 확인할 uri
|
||||
* @param callback block 여부를 콜백함수의 인자값으로 보냅니다.
|
||||
*/
|
||||
export function isBlocked(
|
||||
url: string,
|
||||
callback: (status: boolean) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 방문기록에서 자주 가는 사이트 순으로 검색을 합니다.
|
||||
* @param term 검색할 키워드
|
||||
* @param count 검색할 개수.
|
||||
* @param callback 결과 리스트를 함수의 인자값으로 보냅니다.
|
||||
*/
|
||||
export function search(
|
||||
term: string,
|
||||
count: number,
|
||||
callback?: (result: MostVisitedURL2[]) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 자주 가는 사이트에 해당 배열을 추가합니다.
|
||||
* 만약 다시 update를 실행하면 기존에 update에 존재하는 배열은 삭제됩니다.
|
||||
* @param urls url, title로 구성된 Object Array
|
||||
*/
|
||||
export function update(urls: MostVisitedURL2[]);
|
||||
}
|
||||
|
||||
/**
|
||||
* text-to-speech를 사용할 수 있는 api입니다.
|
||||
* 권한: "tts"
|
||||
* @since Chrome 14.
|
||||
*/
|
||||
export import tts = chrome.tts;
|
||||
|
||||
/**
|
||||
* text-to-speech를 사용할 수 있는 api입니다.
|
||||
* 권한: "tts"
|
||||
* @since Chrome 14.
|
||||
*/
|
||||
export import ttsEngine = chrome.ttsEngine;
|
||||
|
||||
/**
|
||||
* Whale API의 type 정보를 얻을 수 있습니다.
|
||||
* @since Chrome 13.
|
||||
*/
|
||||
export import types = chrome.types;
|
||||
|
||||
/**
|
||||
* 웹 탐색 요청을 수신하여 제어할 수 있습니다.
|
||||
* 권한: "webNavigation"
|
||||
* @since Chrome 16.
|
||||
*/
|
||||
export import webNavigation = chrome.webNavigation;
|
||||
|
||||
/**
|
||||
* 웹 요청을 감지하여 차단, 수정 및 간섭할 수 있습니다.
|
||||
* 권한: "webRequest", host 권한
|
||||
* @since Chrome 17.
|
||||
*/
|
||||
export import webRequest = chrome.webRequest;
|
||||
|
||||
/**
|
||||
* 새로운 창을 생성하거나 이미 생성된 창을 제어할 수 있습니다.
|
||||
* 아무런 권한이 없어도 되지만, Tab권한이 있어야 favocon, uri, title의 정보를 불러올 수 있다.
|
||||
* @since Chrome 5.
|
||||
*/
|
||||
export import windows = chrome.windows;
|
||||
}
|
||||
258
types/naver-whale/test/index.ts
Normal file
258
types/naver-whale/test/index.ts
Normal file
@@ -0,0 +1,258 @@
|
||||
// https://developers.whale.naver.com/tutorials/browserAction/
|
||||
function ToolBarExample() {
|
||||
whale.browserAction.onClicked.addListener(() => {
|
||||
whale.tabs.create({
|
||||
url: `http://news.naver.com/`
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// https://developers.whale.naver.com/tutorials/messagePassing/
|
||||
function MessageExample() {
|
||||
// background
|
||||
whale.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
if (message === `How are you?`) {
|
||||
sendResponse(`I'm fine thank you and you?`);
|
||||
}
|
||||
});
|
||||
|
||||
// contentScript
|
||||
for (let i = 0; i < 100; i++) {
|
||||
console.log(`How are you?`);
|
||||
whale.runtime.sendMessage(`How are you?`, response => {
|
||||
console.log(response); // = I'm fine thank you and you?
|
||||
});
|
||||
}
|
||||
|
||||
// connect
|
||||
const port = whale.runtime.connect({ name: `greetings` });
|
||||
|
||||
port.onMessage.addListener(message => {
|
||||
console.log(message);
|
||||
});
|
||||
|
||||
for (let i = 0; i < 100; i++) {
|
||||
console.log(`How are you?`);
|
||||
port.postMessage(`How are you?`);
|
||||
}
|
||||
|
||||
whale.runtime.onConnect.addListener(port => {
|
||||
if (port.name === `greetings`) {
|
||||
port.onMessage.addListener(message => {
|
||||
if (message === `How are you?`) {
|
||||
port.postMessage(`I'm fine thank you and you?`);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
whale.sidebarAction.show(() => {
|
||||
whale.runtime.sendMessage(`Hello Sidebar!`);
|
||||
});
|
||||
|
||||
window.addEventListener(`DOMContentLoaded`, () => {
|
||||
// 이 구문이 실행되기 전 이미 contentScript.js 의 sendMessage() 가 끝난 상태.
|
||||
// 그러므로 sidebarAction.show() 의 콜백에서 보내는 메시지는 이곳에 도달하지 않습니다.
|
||||
whale.runtime.onMessage.addListener(message => {
|
||||
console.log(message);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function StorageExample() {
|
||||
window.addEventListener(`DOMContentLoaded`, () => {
|
||||
// 처음 로딩 될 때: 메시지가 있는지 확인하고 삭제
|
||||
whale.storage.local.get(`message`, storage => {
|
||||
console.log(storage.message); // = Hello
|
||||
whale.storage.local.remove(`message`);
|
||||
});
|
||||
|
||||
// 로딩 이후의 변화 대응
|
||||
whale.storage.onChanged.addListener((changes, areaName) => {
|
||||
if (areaName === `local` && changes.message) {
|
||||
console.log(changes.message.newValue);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// https://developers.whale.naver.com/tutorials/sidebarAction/
|
||||
function SidebarExample() {
|
||||
whale.sidebarAction.onClicked.addListener(result => {
|
||||
// result.opened: 사이드바가 열렸는지 닫혔는지를 알려주는 boolean 값. 열렸으면 true.
|
||||
});
|
||||
|
||||
whale.sidebarAction.setTitle({
|
||||
title: `새 제목`
|
||||
});
|
||||
|
||||
whale.sidebarAction.setBadgeText({
|
||||
text: `5`
|
||||
});
|
||||
|
||||
whale.sidebarAction.setBadgeBackgroundColor({
|
||||
color: `#ff0000` // RGBA 색상값 배열([255, 0, 0, 255]) 혹은 HEX 색상 표현 문자열(#FF0000).
|
||||
});
|
||||
}
|
||||
|
||||
// https://developers.whale.naver.com/tutorials/sidebarAdvance/
|
||||
function SidebarExample2() {
|
||||
whale.sidebarAction.show({ url: `http://MYWEBSITE.com` });
|
||||
whale.sidebarAction.show({
|
||||
url: whale.runtime.getURL(`index.html`)
|
||||
});
|
||||
}
|
||||
|
||||
// https://developers.whale.naver.com/tutorials/downloads/
|
||||
function DownloadExample() {
|
||||
whale.downloads.download({
|
||||
url: `http://example.org/example.zip`
|
||||
});
|
||||
|
||||
whale.downloads.download(
|
||||
{
|
||||
url: `http://example.org/example.zip`,
|
||||
filename: `download.zip`,
|
||||
saveAs: true
|
||||
},
|
||||
downloadId => {
|
||||
// 만약 'downloadId' 가 undefined 라면 오류가 발생했다는 뜻입니다.
|
||||
// 그러므로 이후의 과정을 진행하기 전에 오류 여부를 확인해야 합니다.
|
||||
if (typeof downloadId !== `undefined`) {
|
||||
console.log(`다운로드가 시작되었습니다. (ID: ${downloadId})`);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
whale.downloads.search(
|
||||
{
|
||||
orderBy: ["-startTime"],
|
||||
limit: 5
|
||||
},
|
||||
downloadedItems => {
|
||||
downloadedItems.forEach(item => {
|
||||
console.log(`
|
||||
id: ${item.id}
|
||||
filename: ${item.filename}
|
||||
startedAt: ${new Date(item.startTime).toLocaleString()}
|
||||
`);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
whale.downloads.onCreated.addListener(evt => {
|
||||
console.log(`
|
||||
다운로드가 시작되었습니다.
|
||||
- ID: ${evt.id}
|
||||
- URL: ${evt.url}
|
||||
- fileSize: ${evt.fileSize}
|
||||
`);
|
||||
});
|
||||
|
||||
whale.downloads.onChanged.addListener(({ id, state }) => {
|
||||
if (typeof state === `undefined`) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (state.current) {
|
||||
case whale.downloads.State.COMPLETE:
|
||||
console.log(`다운로드가 완료되었습니다. (ID: ${id})`);
|
||||
break;
|
||||
|
||||
case whale.downloads.State.INTERRUPTED:
|
||||
console.log(`다운로드가 중단되었습니다. (ID: ${id})`);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// https://developers.whale.naver.com/tutorials/bookmarks/
|
||||
function BookmarkExample() {
|
||||
whale.bookmarks.getTree(function(bmTree) {
|
||||
bmTree.forEach(function(node) {});
|
||||
});
|
||||
}
|
||||
whale.browserAction.onClicked.addListener(function() {
|
||||
whale.bookmarks.create(
|
||||
{
|
||||
title: `네이버 웨일`,
|
||||
parentId: `1`
|
||||
},
|
||||
function(newEntry) {
|
||||
whale.bookmarks.create({
|
||||
title: "웨일 홈",
|
||||
url: "http://whale.naver.com/",
|
||||
parentId: newEntry.id
|
||||
});
|
||||
|
||||
whale.bookmarks.create({
|
||||
title: "웨일 연구소",
|
||||
url: "http://lab.whale.naver.com",
|
||||
parentId: newEntry.id
|
||||
});
|
||||
|
||||
console.log("New Entry Added");
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// https://developers.whale.naver.com/tutorials/commands/
|
||||
whale.commands.onCommand.addListener(function(command) {
|
||||
if (command === `test`) {
|
||||
alert("컨트롤 쉬프트 제이를 누르셨군요!");
|
||||
}
|
||||
});
|
||||
|
||||
whale.commands.onCommand.addListener(function(command) {
|
||||
if (command === `open-popup`) {
|
||||
whale.browserAction.setPopup({
|
||||
popup: whale.runtime.getManifest().browser_action!.default_popup!
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// https://developers.whale.naver.com/tutorials/history/
|
||||
var count = 0;
|
||||
|
||||
whale.browserAction.onClicked.addListener(function(tab) {
|
||||
whale.history.getVisits(
|
||||
{
|
||||
url: tab.url!
|
||||
},
|
||||
function(visitItem) {
|
||||
count = visitItem.length;
|
||||
|
||||
whale.browserAction.setBadgeBackgroundColor({
|
||||
color: `#ff0000`
|
||||
});
|
||||
|
||||
whale.browserAction.setBadgeText({
|
||||
text: `${count}`
|
||||
});
|
||||
|
||||
console.log(`The user has visited ${tab.url} ${count} times`);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
whale.browserAction.onClicked.addListener(function(tab) {
|
||||
whale.history.deleteUrl({
|
||||
url: tab.url!
|
||||
});
|
||||
});
|
||||
|
||||
// https://developers.whale.naver.com/tutorials/contextMenu/
|
||||
whale.contextMenus.create({
|
||||
title: `%s 검색하기`,
|
||||
contexts: [`selection`],
|
||||
onclick: () => {}
|
||||
});
|
||||
|
||||
function searchText(info) {
|
||||
const myQuery = encodeURI(
|
||||
`https://search.naver.com/search.naver?query=${info.selectionText}`
|
||||
);
|
||||
|
||||
whale.tabs.create({
|
||||
url: myQuery
|
||||
});
|
||||
}
|
||||
16
types/naver-whale/tsconfig.json
Normal file
16
types/naver-whale/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "test/index.ts"]
|
||||
}
|
||||
81
types/naver-whale/tslint.json
Normal file
81
types/naver-whale/tslint.json
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": 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-angle-bracket-type-assertion": 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,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
54
types/node-downloader-helper/index.d.ts
vendored
Normal file
54
types/node-downloader-helper/index.d.ts
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
// Type definitions for node-downloader-helper 1.0
|
||||
// Project: https://github.com/hgouveia/node-downloader-helper
|
||||
// Definitions by: Rémy Jeancolas <https://github.com/RemyJeancolas>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
import { RequestOptions as HttpRequestOptions, OutgoingHttpHeaders } from 'http';
|
||||
import { RequestOptions as HttpsRequestOptions } from 'https';
|
||||
|
||||
export interface Options {
|
||||
method?: string; // Request Method Verb
|
||||
headers?: OutgoingHttpHeaders; // Custom HTTP Header ex: Authorization, User-Agent
|
||||
fileName?: string; // Custom filename when saved
|
||||
forceResume?: boolean; // If the server does not return the "accept-ranges" header, can be force if it does support it
|
||||
override?: boolean; // if true it will override the file, otherwise will append '(number)' to the end of file
|
||||
httpRequestOptions?: HttpRequestOptions; // Override the http request options
|
||||
httpsRequestOptions?: HttpsRequestOptions; // Override the https request options, ex: to add SSL Certs
|
||||
}
|
||||
|
||||
export interface Stats {
|
||||
total: number; // total size that needs to be downloaded in bytes
|
||||
downloaded: number; // downloaded size in bytes
|
||||
progress: number; // progress porcentage 0-100%
|
||||
speed: number; // download speed in bytes
|
||||
}
|
||||
|
||||
export enum DH_STATES {
|
||||
IDLE = 'IDLE',
|
||||
STARTED = 'STARTED',
|
||||
DOWNLOADING = 'DOWNLOADING',
|
||||
PAUSED = 'PAUSED',
|
||||
RESUMED = 'RESUMED',
|
||||
STOPPED = 'STOPPED',
|
||||
FINISHED = 'FINISHED',
|
||||
FAILED = 'FAILED'
|
||||
}
|
||||
|
||||
export interface DownloaderHelper {
|
||||
on(event: 'start' | 'download' | 'end' | 'pause' | 'resume' | 'stop' | string, callback: () => void): this;
|
||||
on(event: 'progress', callback: (stats: Stats) => void): this;
|
||||
on(event: 'error', callback: (error: Error) => void): this;
|
||||
on(event: 'stateChanged', callback: (state: DH_STATES) => void): this;
|
||||
}
|
||||
|
||||
export class DownloaderHelper extends EventEmitter {
|
||||
constructor(url: string, destFolder: string, options?: Options);
|
||||
start(): Promise<boolean>;
|
||||
pause(): Promise<boolean>;
|
||||
resume(): Promise<boolean>;
|
||||
stop(): Promise<boolean>;
|
||||
}
|
||||
41
types/node-downloader-helper/node-downloader-helper-tests.ts
Normal file
41
types/node-downloader-helper/node-downloader-helper-tests.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { DownloaderHelper } from 'node-downloader-helper';
|
||||
|
||||
let paused = false;
|
||||
const dl = new DownloaderHelper('http://example.com', __dirname);
|
||||
|
||||
dl.on('start', () => {
|
||||
console.log('Download started');
|
||||
|
||||
if (!paused) {
|
||||
paused = true;
|
||||
dl.pause();
|
||||
}
|
||||
});
|
||||
dl.on('download', () => {
|
||||
console.log('Downloading');
|
||||
});
|
||||
dl.on('progress', (stats) => {
|
||||
console.log(`${stats.progress}% downloaded`);
|
||||
});
|
||||
dl.on('end', () => {
|
||||
console.log('Download finished');
|
||||
});
|
||||
dl.on('error', (err) => {
|
||||
console.error(err);
|
||||
});
|
||||
dl.on('pause', () => {
|
||||
console.log('Download paused');
|
||||
dl.resume();
|
||||
});
|
||||
dl.on('resume', () => {
|
||||
console.log('Download resumed');
|
||||
dl.stop();
|
||||
});
|
||||
dl.on('stop', () => {
|
||||
console.log('Download stopped');
|
||||
});
|
||||
dl.on('stateChanged', (state) => {
|
||||
console.log(`State changed: ${state}`);
|
||||
});
|
||||
|
||||
dl.start().catch(e => console.error(e));
|
||||
23
types/node-downloader-helper/tsconfig.json
Normal file
23
types/node-downloader-helper/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-downloader-helper-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/node-downloader-helper/tslint.json
Normal file
1
types/node-downloader-helper/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
6
types/node/child_process.d.ts
vendored
6
types/node/child_process.d.ts
vendored
@@ -19,9 +19,9 @@ declare module "child_process" {
|
||||
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;
|
||||
send(message: any, callback?: (error: Error | null) => void): boolean;
|
||||
send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error | null) => void): boolean;
|
||||
send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error | null) => void): boolean;
|
||||
disconnect(): void;
|
||||
unref(): void;
|
||||
ref(): void;
|
||||
|
||||
2
types/node/cluster.d.ts
vendored
2
types/node/cluster.d.ts
vendored
@@ -24,7 +24,7 @@ declare module "cluster" {
|
||||
class Worker extends events.EventEmitter {
|
||||
id: number;
|
||||
process: child.ChildProcess;
|
||||
send(message: any, sendHandle?: any, callback?: (error: Error) => void): boolean;
|
||||
send(message: any, sendHandle?: any, callback?: (error: Error | null) => void): boolean;
|
||||
kill(signal?: string): void;
|
||||
destroy(signal?: string): void;
|
||||
disconnect(): void;
|
||||
|
||||
5
types/node/globals.d.ts
vendored
5
types/node/globals.d.ts
vendored
@@ -603,8 +603,7 @@ declare namespace NodeJS {
|
||||
isPaused(): boolean;
|
||||
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe(destination?: WritableStream): this;
|
||||
unshift(chunk: string): void;
|
||||
unshift(chunk: Buffer): void;
|
||||
unshift(chunk: string | Buffer | Uint8Array): void;
|
||||
wrap(oldStream: ReadableStream): this;
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
|
||||
}
|
||||
@@ -892,7 +891,7 @@ declare namespace NodeJS {
|
||||
domain: Domain;
|
||||
|
||||
// Worker
|
||||
send?(message: any, sendHandle?: any): void;
|
||||
send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean;
|
||||
disconnect(): void;
|
||||
connected: boolean;
|
||||
|
||||
|
||||
318
types/node/http2.d.ts
vendored
318
types/node/http2.d.ts
vendored
@@ -6,7 +6,7 @@ declare module "http2" {
|
||||
import * as tls from "tls";
|
||||
import * as url from "url";
|
||||
|
||||
import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders } from "http";
|
||||
import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders, IncomingMessage, ServerResponse } from "http";
|
||||
export { OutgoingHttpHeaders } from "http";
|
||||
|
||||
export interface IncomingHttpStatusHeader {
|
||||
@@ -32,8 +32,8 @@ declare module "http2" {
|
||||
export interface StreamState {
|
||||
localWindowSize?: number;
|
||||
state?: number;
|
||||
streamLocalClose?: number;
|
||||
streamRemoteClose?: number;
|
||||
localClose?: number;
|
||||
remoteClose?: number;
|
||||
sumDependencyWeight?: number;
|
||||
weight?: number;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ declare module "http2" {
|
||||
|
||||
export interface ServerStreamFileResponseOptions {
|
||||
statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void | boolean;
|
||||
getTrailers?: (trailers: OutgoingHttpHeaders) => void;
|
||||
waitForTrailers?: boolean;
|
||||
offset?: number;
|
||||
length?: number;
|
||||
}
|
||||
@@ -59,10 +59,18 @@ declare module "http2" {
|
||||
onError?: (err: NodeJS.ErrnoException) => void;
|
||||
}
|
||||
|
||||
export interface Http2Stream extends stream.Duplex {
|
||||
export class Http2Stream extends stream.Duplex {
|
||||
protected constructor();
|
||||
|
||||
readonly aborted: boolean;
|
||||
readonly bufferSize: number;
|
||||
readonly closed: boolean;
|
||||
readonly destroyed: boolean;
|
||||
/**
|
||||
* Set the true if the END_STREAM flag was set in the request or response HEADERS frame received,
|
||||
* indicating that no additional data should be received and the readable side of the Http2Stream will be closed.
|
||||
*/
|
||||
readonly endAfterHeaders: boolean;
|
||||
readonly pending: boolean;
|
||||
readonly rstCode: number;
|
||||
readonly sentHeaders: OutgoingHttpHeaders;
|
||||
@@ -70,16 +78,12 @@ declare module "http2" {
|
||||
readonly sentTrailers?: OutgoingHttpHeaders;
|
||||
readonly session: Http2Session;
|
||||
readonly state: StreamState;
|
||||
/**
|
||||
* Set the true if the END_STREAM flag was set in the request or response HEADERS frame received,
|
||||
* indicating that no additional data should be received and the readable side of the Http2Stream will be closed.
|
||||
*/
|
||||
readonly endAfterHeaders: boolean;
|
||||
|
||||
close(code?: number, callback?: () => void): void;
|
||||
priority(options: StreamPriorityOptions): void;
|
||||
setTimeout(msecs: number, callback?: () => void): void;
|
||||
sendTrailers(headers: OutgoingHttpHeaders): void;
|
||||
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "aborted", listener: () => void): this;
|
||||
addListener(event: "close", listener: () => void): this;
|
||||
addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
@@ -94,8 +98,8 @@ declare module "http2" {
|
||||
addListener(event: "timeout", listener: () => void): this;
|
||||
addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
addListener(event: "wantTrailers", listener: () => void): this;
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "aborted"): boolean;
|
||||
emit(event: "close"): boolean;
|
||||
emit(event: "data", chunk: Buffer | string): boolean;
|
||||
@@ -110,8 +114,8 @@ declare module "http2" {
|
||||
emit(event: "timeout"): boolean;
|
||||
emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean;
|
||||
emit(event: "wantTrailers"): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "aborted", listener: () => void): this;
|
||||
on(event: "close", listener: () => void): this;
|
||||
on(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
@@ -126,8 +130,8 @@ declare module "http2" {
|
||||
on(event: "timeout", listener: () => void): this;
|
||||
on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
on(event: "wantTrailers", listener: () => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "aborted", listener: () => void): this;
|
||||
once(event: "close", listener: () => void): this;
|
||||
once(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
@@ -142,8 +146,8 @@ declare module "http2" {
|
||||
once(event: "timeout", listener: () => void): this;
|
||||
once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
once(event: "wantTrailers", listener: () => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "aborted", listener: () => void): this;
|
||||
prependListener(event: "close", listener: () => void): this;
|
||||
prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
@@ -158,8 +162,8 @@ declare module "http2" {
|
||||
prependListener(event: "timeout", listener: () => void): this;
|
||||
prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
prependListener(event: "wantTrailers", listener: () => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "aborted", listener: () => void): this;
|
||||
prependOnceListener(event: "close", listener: () => void): this;
|
||||
prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
@@ -174,43 +178,52 @@ declare module "http2" {
|
||||
prependOnceListener(event: "timeout", listener: () => void): this;
|
||||
prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
prependOnceListener(event: "wantTrailers", listener: () => void): this;
|
||||
|
||||
sendTrailers(headers: OutgoingHttpHeaders): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
export interface ClientHttp2Stream extends Http2Stream {
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
export class ClientHttp2Stream extends Http2Stream {
|
||||
private constructor();
|
||||
|
||||
addListener(event: "continue", listener: () => {}): this;
|
||||
addListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
addListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "continue"): boolean;
|
||||
emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
|
||||
emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean;
|
||||
emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "continue", listener: () => {}): this;
|
||||
on(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
on(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "continue", listener: () => {}): this;
|
||||
once(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
once(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "continue", listener: () => {}): this;
|
||||
prependListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
prependListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "continue", listener: () => {}): this;
|
||||
prependOnceListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
prependOnceListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
export interface ServerHttp2Stream extends Http2Stream {
|
||||
export class ServerHttp2Stream extends Http2Stream {
|
||||
private constructor();
|
||||
|
||||
additionalHeaders(headers: OutgoingHttpHeaders): void;
|
||||
readonly headersSent: boolean;
|
||||
readonly pushAllowed: boolean;
|
||||
@@ -230,6 +243,7 @@ declare module "http2" {
|
||||
maxFrameSize?: number;
|
||||
maxConcurrentStreams?: number;
|
||||
maxHeaderListSize?: number;
|
||||
enableConnectProtocol?: boolean;
|
||||
}
|
||||
|
||||
export interface ClientSessionRequestOptions {
|
||||
@@ -237,7 +251,7 @@ declare module "http2" {
|
||||
exclusive?: boolean;
|
||||
parent?: number;
|
||||
weight?: number;
|
||||
getTrailers?: (trailers: OutgoingHttpHeaders, flags: number) => void;
|
||||
waitForTrailers?: boolean;
|
||||
}
|
||||
|
||||
export interface SessionState {
|
||||
@@ -252,7 +266,9 @@ declare module "http2" {
|
||||
inflateDynamicTableSize?: number;
|
||||
}
|
||||
|
||||
export interface Http2Session extends events.EventEmitter {
|
||||
export class Http2Session extends events.EventEmitter {
|
||||
protected constructor();
|
||||
|
||||
readonly alpnProtocol?: string;
|
||||
close(callback?: () => void): void;
|
||||
readonly closed: boolean;
|
||||
@@ -268,148 +284,159 @@ declare module "http2" {
|
||||
ping(payload: Buffer | DataView | NodeJS.TypedArray , callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean;
|
||||
ref(): void;
|
||||
readonly remoteSettings: Settings;
|
||||
rstStream(stream: Http2Stream, code?: number): void;
|
||||
setTimeout(msecs: number, callback?: () => void): void;
|
||||
readonly socket: net.Socket | tls.TLSSocket;
|
||||
readonly state: SessionState;
|
||||
priority(stream: Http2Stream, options: StreamPriorityOptions): void;
|
||||
settings(settings: Settings): void;
|
||||
readonly type: number;
|
||||
unref(): void;
|
||||
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "close", listener: () => void): this;
|
||||
addListener(event: "error", listener: (err: Error) => void): this;
|
||||
addListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
|
||||
addListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
|
||||
addListener(event: "localSettings", listener: (settings: Settings) => void): this;
|
||||
addListener(event: "ping", listener: () => void): this;
|
||||
addListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
||||
addListener(event: "timeout", listener: () => void): this;
|
||||
addListener(event: "ping", listener: () => void): this;
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "close"): boolean;
|
||||
emit(event: "error", err: Error): boolean;
|
||||
emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean;
|
||||
emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData: Buffer): boolean;
|
||||
emit(event: "localSettings", settings: Settings): boolean;
|
||||
emit(event: "ping"): boolean;
|
||||
emit(event: "remoteSettings", settings: Settings): boolean;
|
||||
emit(event: "timeout"): boolean;
|
||||
emit(event: "ping"): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "close", listener: () => void): this;
|
||||
on(event: "error", listener: (err: Error) => void): this;
|
||||
on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
|
||||
on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
|
||||
on(event: "localSettings", listener: (settings: Settings) => void): this;
|
||||
on(event: "ping", listener: () => void): this;
|
||||
on(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
||||
on(event: "timeout", listener: () => void): this;
|
||||
on(event: "ping", listener: () => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "close", listener: () => void): this;
|
||||
once(event: "error", listener: (err: Error) => void): this;
|
||||
once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
|
||||
once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
|
||||
once(event: "localSettings", listener: (settings: Settings) => void): this;
|
||||
once(event: "ping", listener: () => void): this;
|
||||
once(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
||||
once(event: "timeout", listener: () => void): this;
|
||||
once(event: "ping", listener: () => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "close", listener: () => void): this;
|
||||
prependListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
|
||||
prependListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
|
||||
prependListener(event: "localSettings", listener: (settings: Settings) => void): this;
|
||||
prependListener(event: "ping", listener: () => void): this;
|
||||
prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
||||
prependListener(event: "timeout", listener: () => void): this;
|
||||
prependListener(event: "ping", listener: () => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "close", listener: () => void): this;
|
||||
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
|
||||
prependOnceListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
|
||||
prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this;
|
||||
prependOnceListener(event: "ping", listener: () => void): this;
|
||||
prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
||||
prependOnceListener(event: "timeout", listener: () => void): this;
|
||||
prependOnceListener(event: "ping", listener: () => void): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
export interface ClientHttp2Session extends Http2Session {
|
||||
export class ClientHttp2Session extends Http2Session {
|
||||
private constructor();
|
||||
|
||||
request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream;
|
||||
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
||||
addListener(event: "origin", listener: (origins: string[]) => void): this;
|
||||
addListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
||||
addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "altsvc", alt: string, origin: string, stream: number): boolean;
|
||||
emit(event: "origin", origins: string[]): boolean;
|
||||
emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
|
||||
emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
||||
on(event: "origin", listener: (origins: string[]) => void): this;
|
||||
on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
||||
on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
||||
once(event: "origin", listener: (origins: string[]) => void): this;
|
||||
once(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
||||
once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
||||
prependListener(event: "origin", listener: (origins: string[]) => void): this;
|
||||
prependListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
||||
prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
||||
prependOnceListener(event: "origin", listener: (origins: string[]) => void): this;
|
||||
prependOnceListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
||||
prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
export interface AlternativeServiceOptions {
|
||||
origin: number | string | url.URL;
|
||||
}
|
||||
|
||||
export interface ServerHttp2Session extends Http2Session {
|
||||
export class ServerHttp2Session extends Http2Session {
|
||||
private constructor();
|
||||
|
||||
altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void;
|
||||
origin(...args: Array<string | url.URL | { origin: string }>): void;
|
||||
readonly server: Http2Server | Http2SecureServer;
|
||||
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
||||
addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
|
||||
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
||||
on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
||||
once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
||||
prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
||||
prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
// Http2Server
|
||||
|
||||
export interface SessionOptions {
|
||||
maxDeflateDynamicTableSize?: number;
|
||||
maxReservedRemoteStreams?: number;
|
||||
maxSessionMemory?: number;
|
||||
maxHeaderListPairs?: number;
|
||||
maxOutstandingPings?: number;
|
||||
maxSendHeaderBlockLength?: number;
|
||||
paddingStrategy?: number;
|
||||
peerMaxConcurrentStreams?: number;
|
||||
@@ -418,8 +445,17 @@ declare module "http2" {
|
||||
createConnection?: (authority: url.URL, option: SessionOptions) => stream.Duplex;
|
||||
}
|
||||
|
||||
export type ClientSessionOptions = SessionOptions;
|
||||
export type ServerSessionOptions = SessionOptions;
|
||||
export interface ClientSessionOptions extends SessionOptions {
|
||||
maxReservedRemoteStreams?: number;
|
||||
createConnection?: (authority: url.URL, option: SessionOptions) => stream.Duplex;
|
||||
}
|
||||
|
||||
export interface ServerSessionOptions extends SessionOptions {
|
||||
Http1IncomingMessage?: typeof IncomingMessage;
|
||||
Http1ServerResponse?: typeof ServerResponse;
|
||||
Http2ServerRequest?: typeof Http2ServerRequest;
|
||||
Http2ServerResponse?: typeof Http2ServerResponse;
|
||||
}
|
||||
|
||||
export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions { }
|
||||
export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions { }
|
||||
@@ -428,141 +464,199 @@ declare module "http2" {
|
||||
|
||||
export interface SecureServerOptions extends SecureServerSessionOptions {
|
||||
allowHTTP1?: boolean;
|
||||
origins?: string[];
|
||||
}
|
||||
|
||||
export interface Http2Server extends net.Server {
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
export class Http2Server extends net.Server {
|
||||
private constructor();
|
||||
|
||||
addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
||||
addListener(event: "sessionError", listener: (err: Error) => void): this;
|
||||
addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
addListener(event: "timeout", listener: () => void): this;
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
|
||||
emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
|
||||
emit(event: "session", session: ServerHttp2Session): boolean;
|
||||
emit(event: "sessionError", err: Error): boolean;
|
||||
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
|
||||
emit(event: "timeout"): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
on(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
||||
on(event: "sessionError", listener: (err: Error) => void): this;
|
||||
on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
on(event: "timeout", listener: () => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
once(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
||||
once(event: "sessionError", listener: (err: Error) => void): this;
|
||||
once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
once(event: "timeout", listener: () => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
||||
prependListener(event: "sessionError", listener: (err: Error) => void): this;
|
||||
prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
prependListener(event: "timeout", listener: () => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
||||
prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
|
||||
prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
prependOnceListener(event: "timeout", listener: () => void): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
setTimeout(msec?: number, callback?: () => void): this;
|
||||
}
|
||||
|
||||
export interface Http2SecureServer extends tls.Server {
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
export class Http2SecureServer extends tls.Server {
|
||||
private constructor();
|
||||
|
||||
addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
||||
addListener(event: "sessionError", listener: (err: Error) => void): this;
|
||||
addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
addListener(event: "timeout", listener: () => void): this;
|
||||
addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
|
||||
emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
|
||||
emit(event: "session", session: ServerHttp2Session): boolean;
|
||||
emit(event: "sessionError", err: Error): boolean;
|
||||
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
|
||||
emit(event: "timeout"): boolean;
|
||||
emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
on(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
||||
on(event: "sessionError", listener: (err: Error) => void): this;
|
||||
on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
on(event: "timeout", listener: () => void): this;
|
||||
on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
once(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
||||
once(event: "sessionError", listener: (err: Error) => void): this;
|
||||
once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
once(event: "timeout", listener: () => void): this;
|
||||
once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
||||
prependListener(event: "sessionError", listener: (err: Error) => void): this;
|
||||
prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
prependListener(event: "timeout", listener: () => void): this;
|
||||
prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
||||
prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
||||
prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
|
||||
prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
|
||||
prependOnceListener(event: "timeout", listener: () => void): this;
|
||||
prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
setTimeout(msec?: number, callback?: () => void): this;
|
||||
}
|
||||
|
||||
export class Http2ServerRequest extends stream.Readable {
|
||||
private constructor();
|
||||
headers: IncomingHttpHeaders;
|
||||
httpVersion: string;
|
||||
method: string;
|
||||
rawHeaders: string[];
|
||||
rawTrailers: string[];
|
||||
|
||||
readonly aborted: boolean;
|
||||
readonly authority: string;
|
||||
readonly headers: IncomingHttpHeaders;
|
||||
readonly httpVersion: string;
|
||||
readonly method: string;
|
||||
readonly rawHeaders: string[];
|
||||
readonly rawTrailers: string[];
|
||||
readonly scheme: string;
|
||||
setTimeout(msecs: number, callback?: () => void): void;
|
||||
socket: net.Socket | tls.TLSSocket;
|
||||
stream: ServerHttp2Stream;
|
||||
trailers: IncomingHttpHeaders;
|
||||
url: string;
|
||||
readonly socket: net.Socket | tls.TLSSocket;
|
||||
readonly stream: ServerHttp2Stream;
|
||||
readonly trailers: IncomingHttpHeaders;
|
||||
readonly url: string;
|
||||
|
||||
read(size?: number): Buffer | string | null;
|
||||
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
addListener(event: "close", listener: () => void): this;
|
||||
addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
addListener(event: "end", listener: () => void): this;
|
||||
addListener(event: "readable", listener: () => void): this;
|
||||
addListener(event: "error", listener: (err: Error) => void): this;
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "aborted", hadError: boolean, code: number): boolean;
|
||||
emit(event: "close"): boolean;
|
||||
emit(event: "data", chunk: Buffer | string): boolean;
|
||||
emit(event: "end"): boolean;
|
||||
emit(event: "readable"): boolean;
|
||||
emit(event: "error", err: Error): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
on(event: "close", listener: () => void): this;
|
||||
on(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
on(event: "end", listener: () => void): this;
|
||||
on(event: "readable", listener: () => void): this;
|
||||
on(event: "error", listener: (err: Error) => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
once(event: "close", listener: () => void): this;
|
||||
once(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
once(event: "end", listener: () => void): this;
|
||||
once(event: "readable", listener: () => void): this;
|
||||
once(event: "error", listener: (err: Error) => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
prependListener(event: "close", listener: () => void): this;
|
||||
prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
prependListener(event: "end", listener: () => void): this;
|
||||
prependListener(event: "readable", listener: () => void): this;
|
||||
prependListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
prependOnceListener(event: "close", listener: () => void): this;
|
||||
prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
||||
prependOnceListener(event: "end", listener: () => void): this;
|
||||
prependOnceListener(event: "readable", listener: () => void): this;
|
||||
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
export class Http2ServerResponse extends stream.Stream {
|
||||
private constructor();
|
||||
|
||||
addTrailers(trailers: OutgoingHttpHeaders): void;
|
||||
connection: net.Socket | tls.TLSSocket;
|
||||
readonly connection: net.Socket | tls.TLSSocket;
|
||||
end(callback?: () => void): void;
|
||||
end(data?: string | Buffer, callback?: () => void): void;
|
||||
end(data?: string | Buffer, encoding?: string, callback?: () => void): void;
|
||||
end(data: string | Buffer | Uint8Array, callback?: () => void): void;
|
||||
end(data: string | Buffer | Uint8Array, encoding: string, callback?: () => void): void;
|
||||
readonly finished: boolean;
|
||||
getHeader(name: string): string;
|
||||
getHeaderNames(): string[];
|
||||
@@ -573,58 +667,64 @@ declare module "http2" {
|
||||
sendDate: boolean;
|
||||
setHeader(name: string, value: number | string | string[]): void;
|
||||
setTimeout(msecs: number, callback?: () => void): void;
|
||||
socket: net.Socket | tls.TLSSocket;
|
||||
readonly socket: net.Socket | tls.TLSSocket;
|
||||
statusCode: number;
|
||||
statusMessage: '';
|
||||
stream: ServerHttp2Stream;
|
||||
write(chunk: string | Buffer, callback?: (err: Error) => void): boolean;
|
||||
write(chunk: string | Buffer, encoding?: string, callback?: (err: Error) => void): boolean;
|
||||
readonly stream: ServerHttp2Stream;
|
||||
write(chunk: string | Buffer | Uint8Array, callback?: (err: Error) => void): boolean;
|
||||
write(chunk: string | Buffer | Uint8Array, encoding: string, callback?: (err: Error) => void): boolean;
|
||||
writeContinue(): void;
|
||||
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
|
||||
writeHead(statusCode: number, statusMessage?: string, 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;
|
||||
addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
addListener(event: "close", listener: () => void): this;
|
||||
addListener(event: "drain", listener: () => void): this;
|
||||
addListener(event: "error", listener: (error: Error) => void): this;
|
||||
addListener(event: "finish", listener: () => void): this;
|
||||
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
||||
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
emit(event: "aborted", hadError: boolean, code: number): boolean;
|
||||
emit(event: "close"): boolean;
|
||||
emit(event: "drain"): boolean;
|
||||
emit(event: "error", error: Error): boolean;
|
||||
emit(event: "finish"): boolean;
|
||||
emit(event: "pipe", src: stream.Readable): boolean;
|
||||
emit(event: "unpipe", src: stream.Readable): boolean;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
on(event: "close", listener: () => void): this;
|
||||
on(event: "drain", listener: () => void): this;
|
||||
on(event: "error", listener: (error: Error) => void): this;
|
||||
on(event: "finish", listener: () => void): this;
|
||||
on(event: "pipe", listener: (src: stream.Readable) => void): this;
|
||||
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
once(event: "close", listener: () => void): this;
|
||||
once(event: "drain", listener: () => void): this;
|
||||
once(event: "error", listener: (error: Error) => void): this;
|
||||
once(event: "finish", listener: () => void): this;
|
||||
once(event: "pipe", listener: (src: stream.Readable) => void): this;
|
||||
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
prependListener(event: "close", listener: () => void): this;
|
||||
prependListener(event: "drain", listener: () => void): this;
|
||||
prependListener(event: "error", listener: (error: Error) => void): this;
|
||||
prependListener(event: "finish", listener: () => void): this;
|
||||
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
||||
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
|
||||
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
prependOnceListener(event: "close", listener: () => void): this;
|
||||
prependOnceListener(event: "drain", listener: () => void): this;
|
||||
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
||||
prependOnceListener(event: "finish", listener: () => void): this;
|
||||
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
||||
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
// Public API
|
||||
@@ -841,7 +941,7 @@ declare module "http2" {
|
||||
}
|
||||
|
||||
export function getDefaultSettings(): Settings;
|
||||
export function getPackedSettings(settings: Settings): Settings;
|
||||
export function getPackedSettings(settings: Settings): Buffer;
|
||||
export function getUnpackedSettings(buf: Buffer | Uint8Array): Settings;
|
||||
|
||||
export function createServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server;
|
||||
|
||||
4
types/node/stream.d.ts
vendored
4
types/node/stream.d.ts
vendored
@@ -119,11 +119,11 @@ declare module "stream" {
|
||||
_destroy(error: Error | null, callback: (error?: Error | null) => void): void;
|
||||
_final(callback: (error?: Error | null) => void): void;
|
||||
write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
|
||||
write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean;
|
||||
write(chunk: any, encoding: string, cb?: (error: Error | null | undefined) => void): boolean;
|
||||
setDefaultEncoding(encoding: string): this;
|
||||
end(cb?: () => void): void;
|
||||
end(chunk: any, cb?: () => void): void;
|
||||
end(chunk: any, encoding?: string, cb?: () => void): void;
|
||||
end(chunk: any, encoding: string, cb?: () => void): void;
|
||||
cork(): void;
|
||||
uncork(): void;
|
||||
destroy(error?: Error): void;
|
||||
|
||||
@@ -69,15 +69,15 @@ async function testPromisify() {
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
_boolean = cp.send('one', (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, _socket);
|
||||
@@ -87,15 +87,15 @@ async function testPromisify() {
|
||||
}, _socket);
|
||||
|
||||
_boolean = cp.send(1, _socket, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
_boolean = cp.send('one', _socket, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _socket, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, _socket, {
|
||||
@@ -113,19 +113,19 @@ async function testPromisify() {
|
||||
_boolean = cp.send(1, _socket, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
_boolean = cp.send('one', _socket, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _socket, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, _server);
|
||||
@@ -135,15 +135,15 @@ async function testPromisify() {
|
||||
}, _server);
|
||||
|
||||
_boolean = cp.send(1, _server, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
_boolean = cp.send('one', _server, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _server, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
|
||||
_boolean = cp.send(1, _server, {
|
||||
@@ -161,19 +161,19 @@ async function testPromisify() {
|
||||
_boolean = cp.send(1, _server, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
_boolean = cp.send('one', _server, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
_boolean = cp.send({
|
||||
type: 'test'
|
||||
}, _server, {
|
||||
keepOpen: true
|
||||
}, (error) => {
|
||||
const _err: Error = error;
|
||||
const _err: Error | null = error;
|
||||
});
|
||||
|
||||
const stdin: Writable | null = cp.stdio[0];
|
||||
|
||||
@@ -95,16 +95,13 @@ import { URL } from 'url';
|
||||
exclusive: true,
|
||||
parent: 0,
|
||||
weight: 0,
|
||||
getTrailers: (trailers: OutgoingHttpHeaders) => {}
|
||||
waitForTrailers: true
|
||||
};
|
||||
(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(() => {});
|
||||
|
||||
@@ -122,13 +119,6 @@ import { URL } from 'url';
|
||||
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) => {});
|
||||
@@ -150,6 +140,7 @@ import { URL } from 'url';
|
||||
http2Stream.on('wantTrailers', () => {});
|
||||
|
||||
const aborted: boolean = http2Stream.aborted;
|
||||
const bufferSize: number = http2Stream.bufferSize;
|
||||
const closed: boolean = http2Stream.closed;
|
||||
const destroyed: boolean = http2Stream.destroyed;
|
||||
const pending: boolean = http2Stream.pending;
|
||||
@@ -164,13 +155,15 @@ import { URL } from 'url';
|
||||
const sesh: Http2Session = http2Stream.session;
|
||||
|
||||
http2Stream.setTimeout(100, () => {});
|
||||
const trailers: OutgoingHttpHeaders = {};
|
||||
http2Stream.sendTrailers(trailers);
|
||||
|
||||
let state: StreamState = http2Stream.state;
|
||||
state = {
|
||||
localWindowSize: 0,
|
||||
state: 0,
|
||||
streamLocalClose: 0,
|
||||
streamRemoteClose: 0,
|
||||
localClose: 0,
|
||||
remoteClose: 0,
|
||||
sumDependencyWeight: 0,
|
||||
weight: 0
|
||||
};
|
||||
@@ -207,7 +200,7 @@ import { URL } from 'url';
|
||||
|
||||
const options2: ServerStreamFileResponseOptions = {
|
||||
statCheck: (stats: Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => {},
|
||||
getTrailers: (trailers: OutgoingHttpHeaders) => {},
|
||||
waitForTrailers: true,
|
||||
offset: 0,
|
||||
length: 0
|
||||
};
|
||||
@@ -218,7 +211,7 @@ import { URL } from 'url';
|
||||
const options3: ServerStreamFileResponseOptionsWithError = {
|
||||
onError: (err: NodeJS.ErrnoException) => {},
|
||||
statCheck: (stats: Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => {},
|
||||
getTrailers: (trailers: OutgoingHttpHeaders) => {},
|
||||
waitForTrailers: true,
|
||||
offset: 0,
|
||||
length: 0
|
||||
};
|
||||
@@ -236,10 +229,12 @@ import { URL } from 'url';
|
||||
const s2: Server = http2SecureServer;
|
||||
[http2Server, http2SecureServer].forEach((server) => {
|
||||
server.on('sessionError', (err: Error) => {});
|
||||
server.on('session', (session: ServerHttp2Session) => {});
|
||||
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', () => {});
|
||||
server.setTimeout().setTimeout(5).setTimeout(5, () => {});
|
||||
});
|
||||
|
||||
http2SecureServer.on('unknownProtocol', (socket: TLSSocket) => {});
|
||||
@@ -251,7 +246,6 @@ import { URL } from 'url';
|
||||
};
|
||||
const serverOptions: ServerOptions = {
|
||||
maxDeflateDynamicTableSize: 0,
|
||||
maxReservedRemoteStreams: 0,
|
||||
maxSendHeaderBlockLength: 0,
|
||||
paddingStrategy: 0,
|
||||
peerMaxConcurrentStreams: 0,
|
||||
@@ -265,12 +259,15 @@ import { URL } from 'url';
|
||||
// Http2ServerRequest
|
||||
|
||||
const readable: Readable = request;
|
||||
const aborted: boolean = request.aborted;
|
||||
const authority: string = request.authority;
|
||||
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;
|
||||
const scheme: string = request.scheme;
|
||||
let socket: Socket | TLSSocket = request.socket;
|
||||
let stream: ServerHttp2Stream = request.stream;
|
||||
const url: string = request.url;
|
||||
@@ -368,6 +365,7 @@ import { URL } from 'url';
|
||||
serverHttp2Session.altsvc('', { origin: '' });
|
||||
serverHttp2Session.altsvc('', { origin: 0 });
|
||||
serverHttp2Session.altsvc('', { origin: new URL('') });
|
||||
serverHttp2Session.origin('https://example.com', new URL(''), { origin: 'https://foo.com' });
|
||||
|
||||
let clientHttp2Session: ClientHttp2Session;
|
||||
|
||||
@@ -380,7 +378,7 @@ import { URL } from 'url';
|
||||
clientHttp2Session.on('altsvc', (alt: string, origin: string, number: number) => {});
|
||||
|
||||
settings = getDefaultSettings();
|
||||
settings = getPackedSettings(settings);
|
||||
const packet: Buffer = getPackedSettings(settings);
|
||||
settings = getUnpackedSettings(Buffer.from([]));
|
||||
settings = getUnpackedSettings(Uint8Array.from([]));
|
||||
}
|
||||
|
||||
@@ -56,3 +56,11 @@ import { EventEmitter } from "events";
|
||||
dest = report.writeReport('asdasd');
|
||||
dest = report.writeReport(new Error());
|
||||
}
|
||||
{
|
||||
if (process.send) {
|
||||
let r: boolean = process.send('aMessage');
|
||||
r = process.send({ msg: "foo"}, {});
|
||||
r = process.send({ msg: "foo"}, {}, { swallowErrors: true });
|
||||
r = process.send({ msg: "foo"}, {}, { swallowErrors: true }, (err: Error | null) => {});
|
||||
}
|
||||
}
|
||||
|
||||
9
types/nodegit/blob.d.ts
vendored
9
types/nodegit/blob.d.ts
vendored
@@ -10,21 +10,20 @@ export class Blob {
|
||||
* @param len - length of the data
|
||||
* @returns - return the id of the written blob
|
||||
*/
|
||||
static createFromBuffer(repo: Repository, buffer: Buffer, len: number): Oid;
|
||||
static createFromBuffer(repo: Repository, buffer: Buffer, len: number): Promise<Oid>;
|
||||
/**
|
||||
* @param id - return the id of the written blob
|
||||
* @param repo - repository where the blob will be written. this repository can be bare or not
|
||||
* @param path - file from which the blob will be created
|
||||
*/
|
||||
static createFromDisk(id: Oid, repo: Repository, path: string): number;
|
||||
static createFromDisk(repo: Repository, path: string): Promise<Oid>;
|
||||
static createFromStream(repo: Repository, hintPath: string): Promise<WriteStream>;
|
||||
/**
|
||||
* @param id - return the id of the written blob
|
||||
* @param repo - repository where the blob will be written. this repository cannot be bare
|
||||
* @param relativePath - file from which the blob will be created, relative to the repository's working dir
|
||||
* @returns - 0 or an error code
|
||||
*/
|
||||
static createFromWorkdir(id: Oid, repo: Repository, relativePath: string): number;
|
||||
static createFromWorkdir(repo: Repository, relativePath: string): Promise<Oid>;
|
||||
static filteredContent(blob: Blob, as_path: string, check_for_binary_data: number): Promise<Buffer>;
|
||||
static lookup(repo: Repository, id: string | Oid | Blob): Promise<Blob>;
|
||||
static lookupPrefix(repo: Repository, id: Oid, len: number): Promise<Blob>;
|
||||
|
||||
|
||||
2
types/nodegit/tree-builder.d.ts
vendored
2
types/nodegit/tree-builder.d.ts
vendored
@@ -11,5 +11,5 @@ export class Treebuilder {
|
||||
get(filename: string): TreeEntry;
|
||||
insert(filename: string, id: Oid, filemode: number): Promise<TreeEntry>;
|
||||
remove(filename: string): number;
|
||||
write(): Oid;
|
||||
write(): Promise<Oid>;
|
||||
}
|
||||
|
||||
25
types/nodejs-license-file/index.d.ts
vendored
Normal file
25
types/nodejs-license-file/index.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Type definitions for nodejs-license-file 4.0
|
||||
// Project: https://github.com/bushev/nodejs-license-file
|
||||
// Definitions by: Troy McKinnon <https://github.com/trodi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function parse(options: ParseOptions): License;
|
||||
export function generate(options: GenerateOptions): string;
|
||||
export interface License {
|
||||
valid: boolean;
|
||||
serial: string;
|
||||
data: any;
|
||||
}
|
||||
export interface ParseOptions {
|
||||
publicKeyPath?: string;
|
||||
publicKey?: string;
|
||||
licenseFilePath?: string;
|
||||
licenseFile?: string;
|
||||
template: string;
|
||||
}
|
||||
export interface GenerateOptions {
|
||||
privateKeyPath?: string;
|
||||
privateKey?: string;
|
||||
template: string;
|
||||
data: any;
|
||||
}
|
||||
32
types/nodejs-license-file/nodejs-license-file-tests.ts
Normal file
32
types/nodejs-license-file/nodejs-license-file-tests.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import * as LicenseFile from "nodejs-license-file";
|
||||
|
||||
const template: string = [
|
||||
"====BEGIN LICENSE====",
|
||||
"{{&name}}",
|
||||
"{{&id}}",
|
||||
"{{&serial}}",
|
||||
"=====END LICENSE=====",
|
||||
].join("\n");
|
||||
|
||||
const generateOpts: LicenseFile.GenerateOptions = {
|
||||
privateKeyPath: "private_key.pem",
|
||||
template,
|
||||
data: {
|
||||
name: "John Doe",
|
||||
id: "123456789",
|
||||
},
|
||||
};
|
||||
|
||||
/** License data you can write to file. */
|
||||
const licenseString: string = LicenseFile.generate(generateOpts);
|
||||
|
||||
const parseOpts: LicenseFile.ParseOptions = {
|
||||
publicKeyPath: "public_key.pem",
|
||||
licenseFilePath: "license",
|
||||
template,
|
||||
};
|
||||
/** Parsed license obj */
|
||||
const license: LicenseFile.License = LicenseFile.parse(parseOpts);
|
||||
|
||||
// Access license data (e.g., "name"):
|
||||
license.data.name;
|
||||
23
types/nodejs-license-file/tsconfig.json
Normal file
23
types/nodejs-license-file/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"nodejs-license-file-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/nodejs-license-file/tslint.json
Normal file
1
types/nodejs-license-file/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
12
types/omit-empty/index.d.ts
vendored
Normal file
12
types/omit-empty/index.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Type definitions for omit-empty 1.0
|
||||
// Project: https://github.com/jonschlinkert/omit-empty
|
||||
// Definitions by: Shubham Kanodia <https://github.com/pastelsky>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
interface OmitOptions {
|
||||
omitZero?: boolean;
|
||||
}
|
||||
|
||||
declare function omitEmpty(obj: object, options?: OmitOptions): object;
|
||||
export default omitEmpty;
|
||||
4
types/omit-empty/omit-empty-tests.ts
Normal file
4
types/omit-empty/omit-empty-tests.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import omitEmpty from 'omit-empty';
|
||||
|
||||
omitEmpty({ a: 1 }); // $ExpectType object
|
||||
omitEmpty({ a: 0}, { omitZero: true }); // $ExpectType object
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user