mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
+19
-19
@@ -22,15 +22,15 @@ Este es el método preferido. Solo está disponible para usuarios TypeScript 2.0
|
||||
npm install --save-dev @types/node
|
||||
```
|
||||
|
||||
Los types deberían ser incluidos automaticamente por el compilador.
|
||||
Los types deberían ser incluidos automáticamente por el compilador.
|
||||
Vea más en el [manual](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html).
|
||||
|
||||
Para un paquete NPM "foo", Estos `typings` estarán en "@types/foo".
|
||||
Para un paquete NPM "foo", estos `typings` estarán en "@types/foo".
|
||||
Si no puedes encontrar tu paquete, búscalo en [TypeSearch](https://microsoft.github.io/TypeSearch/).
|
||||
|
||||
Si aún no puedes encontrarlo, comprueba si el paquete ya [incluye](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) los typings.
|
||||
Esto es provisto usualmente en el campo `"types"` o `"typings"` en el `package.json`,
|
||||
o solo busca por cualquier archivo ".d.ts" en el paquete e incluyelo manualmente con un `/// <reference path="" />`.
|
||||
o solo busca por cualquier archivo ".d.ts" en el paquete e inclúyelo manualmente con un `/// <reference path="" />`.
|
||||
|
||||
|
||||
### Otros métodos
|
||||
@@ -39,7 +39,7 @@ Estos pueden ser utilizados por TypeScript 1.0.
|
||||
|
||||
* [Typings](https://github.com/typings/typings)
|
||||
* ~~[NuGet](http://nuget.org/packages?q=DefinitelyTyped)~~ (use las alternativas preferidas, la publicación DT type de nuget ha sido desactivada)
|
||||
* Descarguelo manualmente desde la `master` branch de este repositorio
|
||||
* Descárguelo manualmente desde la `master` branch de este repositorio
|
||||
|
||||
Tal vez debas añadir manualmente las [referencias](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html).
|
||||
|
||||
@@ -88,7 +88,7 @@ Primero, haz un [fork](https://guides.github.com/activities/forking/) en este re
|
||||
* `cd types/my-package-to-edit`
|
||||
* Haz cambios. Recuerda editar las pruebas.
|
||||
Si realiza cambios importantes, no olvide [actualizar una versión principal](#quiero-actualizar-un-paquete-a-una-nueva-versión-principal).
|
||||
* También puede que quieras añadirte la sección "Definitions by" en el encabezado del paquete.
|
||||
* También puede que quieras añadirle la sección "Definitions by" en el encabezado del paquete.
|
||||
- Esto hará que seas notificado (a través de tu nombre de usuario en GitHub) cada vez que alguien haga un pull request o issue sobre el paquete.
|
||||
- Haz esto añadiendo tu nombre al final de la línea, así como en `// Definitions by: Alice <https://github.com/alice>, Bob <https://github.com/bob>`.
|
||||
- O si hay más personas, puede ser multiline
|
||||
@@ -109,7 +109,7 @@ Si no lo hace, puedes hacerlo en el comentario asociado con el PR.
|
||||
Si eres el autor de la librería, o puedes hacer un pull request a la biblioteca, [bundle types](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) en vez de publicarlo en DefinitelyTyped.
|
||||
|
||||
Si estás agregando typings para un paquete NPM, crea un directorio con el mismo nombre.
|
||||
Si el paquete al que le estás agregando typings no es para NPM, asegurate de que el nombre que escojas no genere problemas con el nombre del paquete en NPM.
|
||||
Si el paquete al que le estás agregando typings no es para NPM, asegúrate de que el nombre que escojas no genere problemas con el nombre del paquete en NPM.
|
||||
(Puedes usar `npm info foo` para verificar la existencia del paquete `foo`.)
|
||||
|
||||
Tu paquete debería tener esta estructura:
|
||||
@@ -126,7 +126,7 @@ Ve todas las opciones en [dts-gen](https://github.com/Microsoft/dts-gen).
|
||||
|
||||
También puedes configurar el `tsconfig.json` para añadir nuevos archivos, para agregar un `"target": "es6"` (necesitado por las funciones asíncronas), para agregar a la `"lib"`, o para agregar la opción de compilación `"jsx"`.
|
||||
|
||||
Los miembros de DefinitelyTyped frecuentemente monitorean nuevos PRs, pero ten en mente que la cantidad de PRs podrian ralentizar el proceso.
|
||||
Los miembros de DefinitelyTyped frecuentemente monitorean nuevos PRs, pero ten en mente que la cantidad de PRs podrían ralentizar el proceso.
|
||||
|
||||
Para un buen paquete de ejemplo, vea [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/base64-js).
|
||||
|
||||
@@ -135,7 +135,7 @@ Para un buen paquete de ejemplo, vea [base64-js](https://github.com/DefinitelyTy
|
||||
|
||||
* Primero, sigue el consejo del [manual](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html).
|
||||
* Formatear: Ya sea utilizar todo en tabs, o siempre utiliza 4 espacios.
|
||||
* `function sum(nums: number[]): number`: Utiliza `ReadonlyArray` si una funcion no escribe a sus parámetros.
|
||||
* `function sum(nums: number[]): number`: Utiliza `ReadonlyArray` si una función no escribe a sus parámetros.
|
||||
* `interface Foo { new(): Foo; }`:
|
||||
Este define el tipo de objeto que esten nuevos. Probablemente quieras `declare class Foo { constructor(); }`.
|
||||
* `const Class: { new(): IClass; }`:
|
||||
@@ -146,7 +146,7 @@ Para un buen paquete de ejemplo, vea [base64-js](https://github.com/DefinitelyTy
|
||||
Un ejemplo donde un tipo de parámetro es aceptable: `function id<T>(value: T): T;`.
|
||||
Un ejemplo donde no es aceptable: `function parseJson<T>(json: string): T;`.
|
||||
Una excepción: `new Map<string, number>()` está bien.
|
||||
* Utilizando los tipos `Function` y `Object` casi nunca es una buena idea. En 99% de los casos es posible especificar un tipo más especifico. Los ejemplos son `(x: number) => number` para [funciones](http://www.typescriptlang.org/docs/handbook/functions.html#function-types) y `{ x: number, y: number }` para objetos. Si no hay certeza en lo absoluto del tipo, [`any`](http://www.typescriptlang.org/docs/handbook/basic-types.html#any) es la opción correcta, no `Object`. Si el único hecho conocido sobre el tipo es que es un objecto, usa el tipo [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type), no `Object` o `{ [key: string]: any }`.
|
||||
* Utilizando los tipos `Function` y `Object` casi nunca es una buena idea. En 99% de los casos es posible especificar un tipo más específico. Los ejemplos son `(x: number) => number` para [funciones](http://www.typescriptlang.org/docs/handbook/functions.html#function-types) y `{ x: number, y: number }` para objetos. Si no hay certeza en lo absoluto del tipo, [`any`](http://www.typescriptlang.org/docs/handbook/basic-types.html#any) es la opción correcta, no `Object`. Si el único hecho conocido sobre el tipo es que es un objecto, usa el tipo [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type), no `Object` o `{ [key: string]: any }`.
|
||||
* `var foo: string | any`:
|
||||
Cuando es usado `any` en un tipo de unión, el tipo resultante todavía es `any`. Así que mientras la porción `string` de este tipo de anotación puede _verse_ útil, de hecho, no ofrece ningún typechecking adicional más que un simple `any`.
|
||||
Dependiendo de la intención, una alternativa aceptable puede ser `any`, `string`, o `string | object`.
|
||||
@@ -204,11 +204,11 @@ Este script utiliza [dtslint](https://github.com/Microsoft/dtslint).
|
||||
|
||||
#### ¿Cuál es exactamente la relación entre este repositorio y los paquetes de `@types` en NPM?
|
||||
|
||||
La `master` branch es automaticamente publicada en el alcance de los `@types` en NPM gracias a los [types-publisher](https://github.com/Microsoft/types-publisher).
|
||||
La `master` branch es automáticamente publicada en el alcance de los `@types` en NPM gracias a los [types-publisher](https://github.com/Microsoft/types-publisher).
|
||||
|
||||
#### He enviado un pull request. ¿Cuánto tardará en ser merged?
|
||||
|
||||
Esto depende, pero la mayoría de los pull requests serán merged en alrededor de una semana. PRs que hayan sido aprovados por un autor listado en el encabezado de las definiciones usualmente son merged más rápidamente; PRs para nuevas definiciones tomarán más tiempo ya que requieren más revisiones de los mantenedores. Cada PR es revisado por un miembro de TypeScript o DefinitelyTyped antes de ser merged, por favor se paciente debido a que factores humanos pueden causar retrasos. Revisa el [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) para ver el progreso mientras los mantenedores trabajan on los PRs abiertos.
|
||||
Esto depende, pero la mayoría de los pull requests serán merged en alrededor de una semana. PRs que hayan sido aprobados por un autor listado en el encabezado de las definiciones usualmente son merged más rápidamente; PRs para nuevas definiciones tomarán más tiempo ya que requieren más revisiones de los mantenedores. Cada PR es revisado por un miembro de TypeScript o DefinitelyTyped antes de ser merged, por favor sé paciente debido a que factores humanos pueden causar retrasos. Revisa el [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) para ver el progreso mientras los mantenedores trabajan en los PRs abiertos.
|
||||
|
||||
#### Mi PR ha sido merged; ¿cuándo será actualizado el paquete de `@types` NPM?
|
||||
|
||||
@@ -216,12 +216,12 @@ Los paquetes NPM deberán ser actualizados en unas cuantas horas. Si ha pasado m
|
||||
|
||||
#### Estoy escribiendo una definición que depende de otra definición. Debería utilizar `<reference types="" />` o una import?
|
||||
|
||||
Si el modulo al cual te estás refiriendo es un módulo externo (utiliza `export`), utilice una import.
|
||||
Si el módulo al cual te estás refiriendo es un módulo externo (utiliza `export`), utilice una import.
|
||||
Si el módulo al cual te refieres es un módulo ambiente (utiliza `declare module`, o simplemente declara las globales), utilice `<reference types="" />`.
|
||||
|
||||
#### He notado que algunos paquetes aquí tienen `package.json`.
|
||||
|
||||
Normalmente no lo necesitaras. Cuando publicas un paquete normalmente nosotros automáticamente crearemos un `package.json` para eso.
|
||||
Normalmente no lo necesitarás. Cuando publicas un paquete normalmente nosotros automáticamente crearemos un `package.json` para eso.
|
||||
Un `package.json` puede ser incluido por el bien de especificar dependencias. Aquí tienen un [ejemplo](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pikaday/package.json).
|
||||
No aceptamos otros campos, tales como `"description"`, para que sean definidos manualmente.
|
||||
Además, si necesitas referencia a una versión anterior de typings, debes hacerlo añadiendo `"dependencies": { "@types/foo": "x.y.z" }` al package.json.
|
||||
@@ -260,7 +260,7 @@ Cuando ya no sea un borrador, lo podremos eliminar desde DefinitelyType y hacer
|
||||
Si planeas continuar actualizando la versión anterior del paquete, puedes crear una subcarpeta con la versión actual p.ej. `v2`, y copia los archivos existentes. Si es así, necesitarás:
|
||||
|
||||
1. Actualiza las rutas relativas en `tsconfig.json` al igual que `tslint.json`.
|
||||
2. Añadir reglas de mapeo de rutas para asegurart de que la prueba se está ejecutando contra la versión prevista.
|
||||
2. Añadir reglas de mapeo de rutas para asegurarte de que la prueba se está ejecutando contra la versión prevista.
|
||||
|
||||
Por ejemplo [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/history/v2/tsconfig.json) se ve así:
|
||||
|
||||
@@ -280,24 +280,24 @@ Por ejemplo [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/Defi
|
||||
}
|
||||
```
|
||||
|
||||
Si hay otros paquetes en DefinitelyTyped que son incompatibles con la nueva versión, necesitaras mapear las rutas a la versión anterior. También deberá hacer esto para los paquetes que dependen de paquetes que dependen de una version anterior.
|
||||
Si hay otros paquetes en DefinitelyTyped que son incompatibles con la nueva versión, necesitarás mapear las rutas a la versión anterior. También deberá hacer esto para los paquetes que dependen de paquetes que dependen de una version anterior.
|
||||
|
||||
Por ejemplo, `react-router` depende de `history@2`, así que [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) tiene una ruta mapeada a "history": `[ "history/v2" ]`;
|
||||
transitivo así mismo, `react-router-bootstrap` (que depende de `react-router`) también añade una ruta mapeada en su [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json).
|
||||
|
||||
Además, `/// <reference types=".." />` no trabajara con rutas mapeadas, así que las dependencias deberán utilizar `import`.
|
||||
Además, `/// <reference types=".." />` no trabajará con rutas mapeadas, así que las dependencias deberán utilizar `import`.
|
||||
|
||||
#### ¿Cómo escribo definitions para paquetes que pueden ser usados globalmente y como un módulo?
|
||||
|
||||
El manual de TypeScript contiene excelente [información general para escribir definiciones](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html), ademas [este archivo de definiciones de ejemplo](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-modifying-module-d-ts.html) el cual muestra como crear una definición utilizando la sintaxis de módulo en ES6, asi como también especificando objetos que son disponibles en el alcance global. Esta técnica es demostrada practicamente en la [definición para big.js](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/big.js/index.d.ts), el cual es una librería que puede ser cargada globalmente a travéz de una etiqueta script en una página web, o importada via require o imports estilo ES6.
|
||||
El manual de TypeScript contiene excelente [información general para escribir definiciones](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html), además [este archivo de definiciones de ejemplo](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-modifying-module-d-ts.html) el cual muestra como crear una definición utilizando la sintaxis de módulo en ES6, asi como también especificando objetos que son disponibles en el alcance global. Esta técnica es demostrada prácticamente en la [definición para big.js](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/big.js/index.d.ts), el cual es una librería que puede ser cargada globalmente a través de una etiqueta script en una página web, o importada vía require o imports estilo ES6.
|
||||
|
||||
Para probar como puede ser usada tu definición cuando se refieren globalmente o como un módulo importado, crea una carpeta `test`, y coloca dos archivos de prueba en él. nombra uno `YourLibraryName-global.test.ts` y el otro `YourLibraryName-module.test.ts`. El archivo de prueba _global_ debe ejercer la definición de acuerdo como va a ser usado en un script cargado en una página web donde la librería estará disponible en el alcance global - en este escenario no debes de especificar la sentencia de import. El archivo _módulo_ de prueba debe de ejercer la definición de acuerdo a como va a ser utilizado cuando sea importado (incluyendo las sentencias `import`). Si especificas un propiedad `files` en tu archivo tsconfig.json, asegurate de incluir ambos archivos de prueba. Un [ejemplo práctico de esto](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/big.js/test) es también disponible en la definición de big.js.
|
||||
Para probar como puede ser usada tu definición cuando se refieren globalmente o como un módulo importado, crea una carpeta `test`, y coloca dos archivos de prueba en él. nombra uno `YourLibraryName-global.test.ts` y el otro `YourLibraryName-module.test.ts`. El archivo de prueba _global_ debe ejercer la definición de acuerdo como va a ser usado en un script cargado en una página web donde la librería estará disponible en el alcance global - en este escenario no debes de especificar la sentencia de import. El archivo _módulo_ de prueba debe de ejercer la definición de acuerdo a como va a ser utilizado cuando sea importado (incluyendo las sentencias `import`). Si especificas una propiedad `files` en tu archivo tsconfig.json, asegurate de incluir ambos archivos de prueba. Un [ejemplo práctico de esto](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/big.js/test) es también disponible en la definición de big.js.
|
||||
|
||||
Por favor tenga en cuenta que no es necesario para ejercer plenamente la definición en cada archivo de prueba - Es suficiente con probar solo los elementos globalmente accesibles en la prueba de archivos globales y ejercer la definición en el módulo del archivo de prueba, o viceversa.
|
||||
|
||||
#### ¿Qué pasa con paquetes scoped?
|
||||
|
||||
Types para un paquete scoped `@foo/bar` deberán ir en `types/foo__bar`. tenga en cuenta el doble guion bajo.
|
||||
Types para un paquete scoped `@foo/bar` deberán ir en `types/foo__bar`. tenga en cuenta el doble guión bajo.
|
||||
|
||||
Cuando `dts-gen` es utilizado como scaffold en un paquete scoped, las propiedades `paths` deberán ser adaptadas manualmente en el paquete generado
|
||||
`tsconfig.json` para referenciar correctamente el paquete scoped:
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { parse, stringify } from 'ale-url-parser';
|
||||
|
||||
let url;
|
||||
let urlObject;
|
||||
|
||||
url = stringify({});
|
||||
console.log(url);
|
||||
|
||||
url = stringify({
|
||||
protocol: 'protocol',
|
||||
host: 'host',
|
||||
path: ['foo', 'bar', 'baz'],
|
||||
hash: 'hash',
|
||||
query: {
|
||||
foo: 1,
|
||||
bar: [2, '3']
|
||||
}
|
||||
});
|
||||
console.log(url);
|
||||
|
||||
urlObject = parse('//any.dom.ain.co.m/foo/bar?test=1&test=2#hash');
|
||||
console.log(urlObject);
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for ale-url-parser 0.10
|
||||
// Project: https://github.com/msn0/ale-url-parser#readme
|
||||
// Definitions by: Michał Jezierski <https://github.com/msn0>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export interface QueryParams {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface UrlObject {
|
||||
protocol?: string;
|
||||
host?: string;
|
||||
path?: string[];
|
||||
query?: QueryParams;
|
||||
hash?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse url string into url object.
|
||||
* @return UrlObject
|
||||
*/
|
||||
export function parse(url: string): UrlObject;
|
||||
|
||||
/**
|
||||
* Stringify url object into url string.
|
||||
* @return string
|
||||
*/
|
||||
export function stringify(urlObject: UrlObject): string;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ale-url-parser-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -21,6 +21,7 @@ let _algoliaResponse: Response = {
|
||||
processingTimeMS: 32,
|
||||
query: '',
|
||||
params: '',
|
||||
index: '',
|
||||
};
|
||||
|
||||
let _clientOptions: ClientOptions = {
|
||||
@@ -103,7 +104,7 @@ let _algoliaQueryParameters: QueryParameters = {
|
||||
filters: '',
|
||||
attributesToRetrieve: [''],
|
||||
restrictSearchableAttributes: [''],
|
||||
facets: '',
|
||||
facets: [''],
|
||||
facetingAfterDistinct: true,
|
||||
maxValuesPerFacet: 2,
|
||||
attributesToHighlight: [''],
|
||||
@@ -121,28 +122,29 @@ let _algoliaQueryParameters: QueryParameters = {
|
||||
typoTolerance: false,
|
||||
allowTyposOnNumericTokens: false,
|
||||
ignorePlurals: false,
|
||||
disableTypoToleranceOnAttributes: '',
|
||||
disableTypoToleranceOnAttributes: [''],
|
||||
aroundLatLng: '',
|
||||
aroundLatLngViaIP: '',
|
||||
aroundRadius: 0,
|
||||
aroundPrecision: 0,
|
||||
minimumAroundRadius: 0,
|
||||
insideBoundingBox: [[0]],
|
||||
queryType: '',
|
||||
queryType: 'prefixAll',
|
||||
insidePolygon: [[0]],
|
||||
removeWordsIfNoResults: '',
|
||||
removeWordsIfNoResults: 'firstWords',
|
||||
advancedSyntax: false,
|
||||
optionalWords: [''],
|
||||
removeStopWords: [''],
|
||||
disableExactOnAttributes: [''],
|
||||
exactOnSingleWordQuery: '',
|
||||
alternativesAsExact: true,
|
||||
exactOnSingleWordQuery: 'attribute',
|
||||
alternativesAsExact: ["ignorePlurals"],
|
||||
distinct: 0,
|
||||
getRankingInfo: false,
|
||||
numericAttributesToIndex: [''],
|
||||
numericAttributesForFiltering: [''],
|
||||
numericFilters: [''],
|
||||
tagFilters: '',
|
||||
facetFilters: '',
|
||||
tagFilters: [''],
|
||||
facetFilters: [''],
|
||||
analytics: false,
|
||||
analyticsTags: [''],
|
||||
synonyms: true,
|
||||
@@ -172,11 +174,11 @@ index.partialUpdateObjects([{}], false).then(() => {});
|
||||
let indexName : string = index.indexName;
|
||||
|
||||
// complete copy
|
||||
client.copyIndex('from', 'to').then(()=>{})
|
||||
client.copyIndex('from', 'to', ()=> {})
|
||||
client.copyIndex('from', 'to').then(()=>{});
|
||||
client.copyIndex('from', 'to', ()=> {});
|
||||
// with scope
|
||||
client.copyIndex('from', 'to', ['settings']).then(()=>{})
|
||||
client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {})
|
||||
client.copyIndex('from', 'to', ['settings']).then(()=>{});
|
||||
client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {});
|
||||
|
||||
// Browsing
|
||||
const browser = index.browseAll();
|
||||
@@ -199,9 +201,11 @@ browser.on('error', function onError(err) {
|
||||
throw err;
|
||||
});
|
||||
|
||||
browser.stop()
|
||||
browser.stop();
|
||||
|
||||
index.browse("", {
|
||||
advancedSyntax: false,
|
||||
attributesToRetrieve: ['dogs']
|
||||
})
|
||||
});
|
||||
client.copyIndex('from', 'to', ['settings']).then(()=>{});
|
||||
client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {});
|
||||
|
||||
Vendored
+118
-97
@@ -4,6 +4,7 @@
|
||||
// Haroen Viaene <https://github.com/haroenv>
|
||||
// Aurélien Hervé <https://github.com/aherve>
|
||||
// Samuel Vaillant <https://github.com/samouss>
|
||||
// Kai Eichinger <https://github.com/keichinger>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -1122,120 +1123,121 @@ declare namespace algoliasearch {
|
||||
userToken?: string;
|
||||
}
|
||||
interface QueryParameters {
|
||||
/**
|
||||
* Query string used to perform the search
|
||||
* default: ''
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/query/
|
||||
*/
|
||||
query?: string;
|
||||
/**
|
||||
* Filter the query with numeric, facet or/and tag filters
|
||||
* default: ""
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/filters/
|
||||
*/
|
||||
filters?: string;
|
||||
/**
|
||||
* A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer.
|
||||
* default: *
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/attributesToRetrieve/
|
||||
*/
|
||||
attributesToRetrieve?: string[];
|
||||
/**
|
||||
* List of attributes you want to use for textual search
|
||||
* default: attributeToIndex
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/restrictSearchableAttributes/
|
||||
*/
|
||||
restrictSearchableAttributes?: string[];
|
||||
/**
|
||||
* You can use facets to retrieve only a part of your attributes declared in attributesForFaceting attributes
|
||||
* default: []
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/facets/
|
||||
*/
|
||||
facets?: string[];
|
||||
/**
|
||||
* Query string used to perform the search
|
||||
* default: ''
|
||||
* https://github.com/algolia/algoliasearch-client-js#query
|
||||
*/
|
||||
query?: string;
|
||||
/**
|
||||
* Filter the query with numeric, facet or/and tag filters
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#filters
|
||||
*/
|
||||
filters?: string;
|
||||
/**
|
||||
* A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer.
|
||||
* default: *
|
||||
* https://github.com/algolia/algoliasearch-client-js#attributestoretrieve
|
||||
*/
|
||||
attributesToRetrieve?: string[];
|
||||
/**
|
||||
* List of attributes you want to use for textual search
|
||||
* default: attributeToIndex
|
||||
* https://github.com/algolia/algoliasearch-client-js#restrictsearchableattributes
|
||||
*/
|
||||
restrictSearchableAttributes?: string[];
|
||||
/**
|
||||
* You can use facets to retrieve only a part of your attributes declared in attributesForFaceting attributes
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#facets
|
||||
*/
|
||||
facets?: string | string[];
|
||||
/**
|
||||
* Force faceting to be applied after de-duplication (via the Distinct setting).
|
||||
* When using the distinct setting in combination with faceting, facet counts may be higher than expected.
|
||||
* This is because the engine, by default, computes faceting before applying de-duplication (distinct).
|
||||
* When using the distinct setting in combination with faceting, facet counts may be higher than expected.
|
||||
* This is because the engine, by default, computes faceting before applying de-duplication (distinct).
|
||||
* When facetingAfterDistinct is set to true, the engine calculates faceting after the de-duplication has been applied.
|
||||
* default ""
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/facetingAfterDistinct/
|
||||
*/
|
||||
facetingAfterDistinct?: boolean;
|
||||
/**
|
||||
* Limit the number of facet values returned for each facet.
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#maxvaluesperfacet
|
||||
* default: 100
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/maxValuesPerFacet/
|
||||
*/
|
||||
maxValuesPerFacet?: number;
|
||||
/**
|
||||
* Default list of attributes to highlight. If set to null, all indexed attributes are highlighted.
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#attributestohighlight
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/attributesToHighlight/
|
||||
*/
|
||||
attributesToHighlight?: string[];
|
||||
/**
|
||||
* Default list of attributes to snippet alongside the number of words to return
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#attributestosnippet
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/
|
||||
*/
|
||||
attributesToSnippet?: string[];
|
||||
/**
|
||||
* Specify the string that is inserted before the highlighted parts in the query result
|
||||
* default: <em>
|
||||
* https://github.com/algolia/algoliasearch-client-js#highlightpretag
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/highlightPreTag/
|
||||
*/
|
||||
highlightPreTag?: string;
|
||||
/**
|
||||
* Specify the string that is inserted after the highlighted parts in the query result
|
||||
* default: </em>
|
||||
* https://github.com/algolia/algoliasearch-client-js#highlightposttag
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/highlightPostTag/
|
||||
*/
|
||||
highlightPostTag?: string;
|
||||
/**
|
||||
* String used as an ellipsis indicator when a snippet is truncated.
|
||||
* default: …
|
||||
* https://github.com/algolia/algoliasearch-client-js#snippetellipsistext
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/snippetEllipsisText/
|
||||
*/
|
||||
snippetEllipsisText?: string;
|
||||
/**
|
||||
* If set to true, restrict arrays in highlights and snippets to items that matched the query at least partially else return all array items in highlights and snippets
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#restricthighlightandsnippetarrays
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/restrictHighlightAndSnippetArrays/
|
||||
*/
|
||||
restrictHighlightAndSnippetArrays?: boolean;
|
||||
/**
|
||||
* Pagination parameter used to select the number of hits per page
|
||||
* default: 20
|
||||
* https://github.com/algolia/algoliasearch-client-js#hitsperpage
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/hitsPerPage/
|
||||
*/
|
||||
hitsPerPage?: number;
|
||||
/**
|
||||
* Pagination parameter used to select the page to retrieve.
|
||||
* default: 0
|
||||
* https://github.com/algolia/algoliasearch-client-js#page
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/page/
|
||||
*/
|
||||
page?: number;
|
||||
/**
|
||||
* Offset of the first hit to return
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#offset
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/offset/
|
||||
*/
|
||||
offset?: number;
|
||||
/**
|
||||
* Number of hits to return.
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#length
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/length/
|
||||
*/
|
||||
length?: number;
|
||||
/**
|
||||
* The minimum number of characters needed to accept one typo.
|
||||
* default: 4
|
||||
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor1typo
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/minWordSizefor1Typo/
|
||||
*/
|
||||
minWordSizefor1Typo?: number;
|
||||
/**
|
||||
* The minimum number of characters needed to accept two typo.
|
||||
* fault: 8
|
||||
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/minWordSizefor2Typos/
|
||||
*/
|
||||
minWordSizefor2Typos?: number;
|
||||
/**
|
||||
@@ -1245,62 +1247,62 @@ declare namespace algoliasearch {
|
||||
* 'false' The typo tolerance is disabled. All results with typos will be hidden.
|
||||
* 'min' Only keep results with the minimum number of typos
|
||||
* 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos.
|
||||
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/typoTolerance/
|
||||
*/
|
||||
typoTolerance?: boolean;
|
||||
/**
|
||||
* If set to false, disables typo tolerance on numeric tokens (numbers).
|
||||
* default:
|
||||
* https://github.com/algolia/algoliasearch-client-js#allowtyposonnumerictokens
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/allowTyposOnNumericTokens/
|
||||
*/
|
||||
allowTyposOnNumericTokens?: boolean;
|
||||
/**
|
||||
* If set to true, plural won't be considered as a typo
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#ignoreplurals
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/ignorePlurals/
|
||||
*/
|
||||
ignorePlurals?: boolean;
|
||||
/**
|
||||
* List of attributes on which you want to disable typo tolerance
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#disabletypotoleranceonattributes
|
||||
* default: []
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/disableTypoToleranceOnAttributes/
|
||||
*/
|
||||
disableTypoToleranceOnAttributes?: string;
|
||||
disableTypoToleranceOnAttributes?: string[];
|
||||
/**
|
||||
* Search for entries around a given location
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundlatlng
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLng/
|
||||
*/
|
||||
aroundLatLng?: string;
|
||||
/**
|
||||
* Search for entries around a given latitude/longitude automatically computed from user IP address.
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundlatlngviaip
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLngViaIP/
|
||||
*/
|
||||
aroundLatLngViaIP?: string;
|
||||
/**
|
||||
* Control the radius associated with a geo search. Defined in meters.
|
||||
* default: null
|
||||
* You can specify aroundRadius=all if you want to compute the geo distance without filtering in a geo area
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundradius
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/aroundRadius/
|
||||
*/
|
||||
aroundRadius?: number | 'all';
|
||||
/**
|
||||
* Control the precision of a geo search
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundprecision
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/aroundPrecision/
|
||||
*/
|
||||
aroundPrecision?: number;
|
||||
/**
|
||||
* Define the minimum radius used for a geo search when aroundRadius is not set.
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#minimumaroundradius
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/minimumAroundRadius/
|
||||
*/
|
||||
minimumAroundRadius?: number;
|
||||
/**
|
||||
* Search entries inside a given area defined by the two extreme points of a rectangle
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#insideboundingbox
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/insideBoundingBox/
|
||||
*/
|
||||
insideBoundingBox?: number[][];
|
||||
/**
|
||||
@@ -1309,13 +1311,13 @@ declare namespace algoliasearch {
|
||||
* 'prefixAll' All query words are interpreted as prefixes. This option is not recommended.
|
||||
* 'prefixLast' Only the last word is interpreted as a prefix (default behavior).
|
||||
* 'prefixNone' No query word is interpreted as a prefix. This option is not recommended.
|
||||
* https://github.com/algolia/algoliasearch-client-js#querytype
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/queryType/
|
||||
*/
|
||||
queryType?: any;
|
||||
queryType?: "prefixAll"|"prefixLast"|"prefixNone";
|
||||
/**
|
||||
* Search entries inside a given area defined by a set of points
|
||||
* defauly: ''
|
||||
* https://github.com/algolia/algoliasearch-client-js#insidepolygon
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/insidePolygon/
|
||||
*/
|
||||
insidePolygon?: number[][];
|
||||
/**
|
||||
@@ -1325,19 +1327,19 @@ declare namespace algoliasearch {
|
||||
* 'firstWords' When a query does not return any results, the first word will be added as optional
|
||||
* 'allOptional' When a query does not return any results, a second trial will be made with all words as optional
|
||||
* 'none' No specific processing is done when a query does not return any results
|
||||
* https://github.com/algolia/algoliasearch-client-js#removewordsifnoresults
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/removeWordsIfNoResults/
|
||||
*/
|
||||
removeWordsIfNoResults?: string;
|
||||
removeWordsIfNoResults?: "none"|"lastWords"|"firstWords"|"allOptional";
|
||||
/**
|
||||
* Enables the advanced query syntax
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#advancedsyntax
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/advancedSyntax/
|
||||
*/
|
||||
advancedSyntax?: boolean;
|
||||
/**
|
||||
* A string that contains the comma separated list of words that should be considered as optional when found in the query
|
||||
* default: []
|
||||
* https://github.com/algolia/algoliasearch-client-js#optionalwords
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/optionalWords/
|
||||
*/
|
||||
optionalWords?: string[];
|
||||
/**
|
||||
@@ -1345,13 +1347,13 @@ declare namespace algoliasearch {
|
||||
* default: false
|
||||
* true|false: enable or disable stop words for all 41 supported languages; or
|
||||
* a list of language ISO codes (as a comma-separated string) for which stop words should be enable
|
||||
* https://github.com/algolia/algoliasearch-client-js#removestopwords
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/removeStopWords/
|
||||
*/
|
||||
removeStopWords?: string[];
|
||||
removeStopWords?: boolean|string[];
|
||||
/**
|
||||
* List of attributes on which you want to disable the computation of exact criteria
|
||||
* default: []
|
||||
* https://github.com/algolia/algoliasearch-client-js#disableexactonattributes
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/disableExactOnAttributes/
|
||||
*/
|
||||
disableExactOnAttributes?: string[];
|
||||
/**
|
||||
@@ -1360,81 +1362,90 @@ declare namespace algoliasearch {
|
||||
* 'none': no exact on single word query
|
||||
* 'word': exact set to 1 if the query word is found in the record
|
||||
* 'attribute': exact set to 1 if there is an attribute containing a string equals to the query
|
||||
* https://github.com/algolia/algoliasearch-client-js#exactonsinglewordquery
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/exactOnSingleWordQuery/
|
||||
*/
|
||||
exactOnSingleWordQuery?: string;
|
||||
exactOnSingleWordQuery?: "attribute"|"none"|"word";
|
||||
/**
|
||||
* Specify the list of approximation that should be considered as an exact match in the ranking formula
|
||||
* default: ['ignorePlurals', 'singleWordSynonym']
|
||||
* 'ignorePlurals': alternative words added by the ignorePlurals feature
|
||||
* 'singleWordSynonym': single-word synonym (For example "NY" = "NYC")
|
||||
* 'multiWordsSynonym': multiple-words synonym
|
||||
* https://github.com/algolia/algoliasearch-client-js#alternativesasexact
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/alternativesAsExact/
|
||||
*/
|
||||
alternativesAsExact?: any;
|
||||
alternativesAsExact?: Array<"ignorePlurals"|"singleWordSynonym"|"multiWordsSynonym">;
|
||||
/**
|
||||
* If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set.
|
||||
* https://github.com/algolia/algoliasearch-client-js#distinct
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/distinct/
|
||||
*/
|
||||
distinct?: any;
|
||||
distinct?: number|boolean;
|
||||
/**
|
||||
* If set to true, the result hits will contain ranking information in the _rankingInfo attribute.
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#getrankinginfo
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/getRankingInfo/
|
||||
*/
|
||||
getRankingInfo?: boolean;
|
||||
/**
|
||||
* @deprecated Use `numericAttributesForFiltering` instead
|
||||
* All numerical attributes are automatically indexed as numerical filters
|
||||
* default: ''
|
||||
* https://github.com/algolia/algoliasearch-client-js#numericattributestoindex
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/numericAttributesForFiltering/
|
||||
*/
|
||||
numericAttributesToIndex?: string[];
|
||||
/**
|
||||
* All numerical attributes are automatically indexed as numerical filters
|
||||
* default: ''
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/numericAttributesForFiltering/
|
||||
*/
|
||||
numericAttributesForFiltering?: string[];
|
||||
/**
|
||||
* @deprecated please use filters instead
|
||||
* A string that contains the comma separated list of numeric filters you want to apply.
|
||||
* https://github.com/algolia/algoliasearch-client-js#numericfilters-deprecated
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/numericFilters/
|
||||
*/
|
||||
numericFilters?: string[];
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* Filter the query by a set of tags.
|
||||
* https://github.com/algolia/algoliasearch-client-js#tagfilters-deprecated
|
||||
* Default: []
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/tagFilters/
|
||||
*/
|
||||
tagFilters?: string;
|
||||
tagFilters?: string[];
|
||||
/**
|
||||
* @deprecated
|
||||
* Filter the query by a set of facets.
|
||||
* https://github.com/algolia/algoliasearch-client-js#facetfilters-deprecated
|
||||
* Default: []
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/
|
||||
*/
|
||||
facetFilters?: string | string[]
|
||||
facetFilters?: string[]|string[][];
|
||||
/**
|
||||
* If set to false, this query will not be taken into account in the analytics feature.
|
||||
* default true
|
||||
* https://github.com/algolia/algoliasearch-client-js#analytics
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/analytics/
|
||||
*/
|
||||
analytics?: boolean;
|
||||
/**
|
||||
* If set, tag your query with the specified identifiers
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#analyticstags
|
||||
* default: []
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/
|
||||
*/
|
||||
analyticsTags?: string[];
|
||||
/**
|
||||
* If set to false, the search will not use the synonyms defined for the targeted index.
|
||||
* default: true
|
||||
* https://github.com/algolia/algoliasearch-client-js#synonyms
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/synonyms/
|
||||
*/
|
||||
synonyms?: boolean;
|
||||
/**
|
||||
* If set to false, words matched via synonym expansion will not be replaced by the matched synonym in the highlighted result.
|
||||
* default: true
|
||||
* https://github.com/algolia/algoliasearch-client-js#replacesynonymsinhighlight
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/replaceSynonymsInHighlight/
|
||||
*/
|
||||
replaceSynonymsInHighlight?: boolean;
|
||||
/**
|
||||
* Configure the precision of the proximity ranking criterion
|
||||
* default: 1
|
||||
* https://github.com/algolia/algoliasearch-client-js#minproximity
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/minProximity/
|
||||
*/
|
||||
minProximity?: number;
|
||||
|
||||
@@ -1487,7 +1498,7 @@ declare namespace algoliasearch {
|
||||
interface Task {
|
||||
taskID: number;
|
||||
createdAt: string;
|
||||
objectID?: string;
|
||||
objectID?: string;
|
||||
}
|
||||
|
||||
interface TaskStatus {
|
||||
@@ -1770,42 +1781,42 @@ declare namespace algoliasearch {
|
||||
interface Response {
|
||||
/**
|
||||
* Contains all the hits matching the query
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
hits: any[];
|
||||
/**
|
||||
* Current page
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
page: number;
|
||||
/**
|
||||
* Number of total hits matching the query
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
nbHits: number;
|
||||
/**
|
||||
* Number of pages
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
nbPages: number;
|
||||
/**
|
||||
* Number of hits per pages
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
hitsPerPage: number;
|
||||
/**
|
||||
* Engine processing time (excluding network transfer)
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
processingTimeMS: number;
|
||||
/**
|
||||
* Query used to perform the search
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
query: string;
|
||||
/**
|
||||
* GET parameters used to perform the search
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
params: string;
|
||||
facets?: {
|
||||
@@ -1819,6 +1830,16 @@ declare namespace algoliasearch {
|
||||
sum: number,
|
||||
};
|
||||
};
|
||||
/**
|
||||
* The index name is only set when searching multiple indices.
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/multiple-queries/?language=javascript#response
|
||||
*/
|
||||
index?: string;
|
||||
/**
|
||||
* The cursor is only set when browsing the index.
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/browse/
|
||||
*/
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
interface MultiResponse {
|
||||
|
||||
Vendored
+91
-71
@@ -5,6 +5,7 @@
|
||||
// Aurélien Hervé <https://github.com/aherve>
|
||||
// Samuel Vaillant <https://github.com/samouss>
|
||||
// Claas Brüggemann <https://github.com/ClaasBrueggemann>
|
||||
// Kai Eichinger <https://github.com/keichinger>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -214,109 +215,109 @@ declare namespace algoliasearch {
|
||||
/**
|
||||
* Query string used to perform the search
|
||||
* default: ''
|
||||
* https://github.com/algolia/algoliasearch-client-js#query
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/query/
|
||||
*/
|
||||
query?: string;
|
||||
/**
|
||||
* Filter the query with numeric, facet or/and tag filters
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#filters
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/filters/
|
||||
*/
|
||||
filters?: string;
|
||||
/**
|
||||
* A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer.
|
||||
* default: *
|
||||
* https://github.com/algolia/algoliasearch-client-js#attributestoretrieve
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/attributesToRetrieve/
|
||||
*/
|
||||
attributesToRetrieve?: string[];
|
||||
/**
|
||||
* List of attributes you want to use for textual search
|
||||
* default: attributeToIndex
|
||||
* https://github.com/algolia/algoliasearch-client-js#restrictsearchableattributes
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/restrictSearchableAttributes/
|
||||
*/
|
||||
restrictSearchableAttributes?: string[];
|
||||
/**
|
||||
* You can use facets to retrieve only a part of your attributes declared in attributesForFaceting attributes
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#facets
|
||||
* default: []
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/facets/
|
||||
*/
|
||||
facets?: string;
|
||||
facets?: string[];
|
||||
/**
|
||||
* Limit the number of facet values returned for each facet.
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#maxvaluesperfacet
|
||||
* default: 100
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/maxValuesPerFacet/
|
||||
*/
|
||||
maxValuesPerFacet?: number;
|
||||
/**
|
||||
* Default list of attributes to highlight. If set to null, all indexed attributes are highlighted.
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#attributestohighlight
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/attributesToHighlight/
|
||||
*/
|
||||
attributesToHighlight?: string[];
|
||||
/**
|
||||
* Default list of attributes to snippet alongside the number of words to return
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#attributestosnippet
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/
|
||||
*/
|
||||
attributesToSnippet?: string[];
|
||||
/**
|
||||
* Specify the string that is inserted before the highlighted parts in the query result
|
||||
* default: <em>
|
||||
* https://github.com/algolia/algoliasearch-client-js#highlightpretag
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/highlightPreTag/
|
||||
*/
|
||||
highlightPreTag?: string;
|
||||
/**
|
||||
* Specify the string that is inserted after the highlighted parts in the query result
|
||||
* default: </em>
|
||||
* https://github.com/algolia/algoliasearch-client-js#highlightposttag
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/highlightPostTag/
|
||||
*/
|
||||
highlightPostTag?: string;
|
||||
/**
|
||||
* String used as an ellipsis indicator when a snippet is truncated.
|
||||
* default: …
|
||||
* https://github.com/algolia/algoliasearch-client-js#snippetellipsistext
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/snippetEllipsisText/
|
||||
*/
|
||||
snippetEllipsisText?: string;
|
||||
/**
|
||||
* If set to true, restrict arrays in highlights and snippets to items that matched the query at least partially else return all array items in highlights and snippets
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#restricthighlightandsnippetarrays
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/restrictHighlightAndSnippetArrays/
|
||||
*/
|
||||
restrictHighlightAndSnippetArrays?: boolean;
|
||||
/**
|
||||
* Pagination parameter used to select the number of hits per page
|
||||
* default: 20
|
||||
* https://github.com/algolia/algoliasearch-client-js#hitsperpage
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/hitsPerPage/
|
||||
*/
|
||||
hitsPerPage?: number;
|
||||
/**
|
||||
* Pagination parameter used to select the page to retrieve.
|
||||
* default: 0
|
||||
* https://github.com/algolia/algoliasearch-client-js#page
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/page/
|
||||
*/
|
||||
page?: number;
|
||||
/**
|
||||
* Offset of the first hit to return
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#offset
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/offset/
|
||||
*/
|
||||
offset?: number;
|
||||
/**
|
||||
* Number of hits to return.
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#length
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/length/
|
||||
*/
|
||||
length?: number;
|
||||
/**
|
||||
* The minimum number of characters needed to accept one typo.
|
||||
* default: 4
|
||||
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor1typo
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/minWordSizefor1Typo/
|
||||
*/
|
||||
minWordSizefor1Typo?: number;
|
||||
/**
|
||||
* The minimum number of characters needed to accept two typo.
|
||||
* fault: 8
|
||||
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/minWordSizefor2Typos/
|
||||
*/
|
||||
minWordSizefor2Typos?: number;
|
||||
/**
|
||||
@@ -326,62 +327,62 @@ declare namespace algoliasearch {
|
||||
* 'false' The typo tolerance is disabled. All results with typos will be hidden.
|
||||
* 'min' Only keep results with the minimum number of typos
|
||||
* 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos.
|
||||
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/typoTolerance/
|
||||
*/
|
||||
typoTolerance?: boolean;
|
||||
/**
|
||||
* If set to false, disables typo tolerance on numeric tokens (numbers).
|
||||
* default:
|
||||
* https://github.com/algolia/algoliasearch-client-js#allowtyposonnumerictokens
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/allowTyposOnNumericTokens/
|
||||
*/
|
||||
allowTyposOnNumericTokens?: boolean;
|
||||
/**
|
||||
* If set to true, plural won't be considered as a typo
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#ignoreplurals
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/ignorePlurals/
|
||||
*/
|
||||
ignorePlurals?: boolean;
|
||||
/**
|
||||
* List of attributes on which you want to disable typo tolerance
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#disabletypotoleranceonattributes
|
||||
* default: []
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/disableTypoToleranceOnAttributes/
|
||||
*/
|
||||
disableTypoToleranceOnAttributes?: string;
|
||||
disableTypoToleranceOnAttributes?: string[];
|
||||
/**
|
||||
* Search for entries around a given location
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundlatlng
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLng/
|
||||
*/
|
||||
aroundLatLng?: string;
|
||||
/**
|
||||
* Search for entries around a given latitude/longitude automatically computed from user IP address.
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundlatlngviaip
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLngViaIP/
|
||||
*/
|
||||
aroundLatLngViaIP?: string;
|
||||
/**
|
||||
* Control the radius associated with a geo search. Defined in meters.
|
||||
* default: null
|
||||
* You can specify aroundRadius=all if you want to compute the geo distance without filtering in a geo area
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundradius
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/aroundRadius/
|
||||
*/
|
||||
aroundRadius?: number | 'all';
|
||||
/**
|
||||
* Control the precision of a geo search
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundprecision
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/aroundPrecision/
|
||||
*/
|
||||
aroundPrecision?: number;
|
||||
/**
|
||||
* Define the minimum radius used for a geo search when aroundRadius is not set.
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#minimumaroundradius
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/minimumAroundRadius/
|
||||
*/
|
||||
minimumAroundRadius?: number;
|
||||
/**
|
||||
* Search entries inside a given area defined by the two extreme points of a rectangle
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#insideboundingbox
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/insideBoundingBox/
|
||||
*/
|
||||
insideBoundingBox?: number[][];
|
||||
/**
|
||||
@@ -390,13 +391,13 @@ declare namespace algoliasearch {
|
||||
* 'prefixAll' All query words are interpreted as prefixes. This option is not recommended.
|
||||
* 'prefixLast' Only the last word is interpreted as a prefix (default behavior).
|
||||
* 'prefixNone' No query word is interpreted as a prefix. This option is not recommended.
|
||||
* https://github.com/algolia/algoliasearch-client-js#querytype
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/queryType/
|
||||
*/
|
||||
queryType?: any;
|
||||
queryType?: "prefixAll"|"prefixLast"|"prefixNone";
|
||||
/**
|
||||
* Search entries inside a given area defined by a set of points
|
||||
* defauly: ''
|
||||
* https://github.com/algolia/algoliasearch-client-js#insidepolygon
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/insidePolygon/
|
||||
*/
|
||||
insidePolygon?: number[][];
|
||||
/**
|
||||
@@ -406,19 +407,19 @@ declare namespace algoliasearch {
|
||||
* 'firstWords' When a query does not return any results, the first word will be added as optional
|
||||
* 'allOptional' When a query does not return any results, a second trial will be made with all words as optional
|
||||
* 'none' No specific processing is done when a query does not return any results
|
||||
* https://github.com/algolia/algoliasearch-client-js#removewordsifnoresults
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/removeWordsIfNoResults/
|
||||
*/
|
||||
removeWordsIfNoResults?: string;
|
||||
removeWordsIfNoResults?: "none"|"lastWords"|"firstWords"|"allOptional";
|
||||
/**
|
||||
* Enables the advanced query syntax
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#advancedsyntax
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/advancedSyntax/
|
||||
*/
|
||||
advancedSyntax?: boolean;
|
||||
/**
|
||||
* A string that contains the comma separated list of words that should be considered as optional when found in the query
|
||||
* default: []
|
||||
* https://github.com/algolia/algoliasearch-client-js#optionalwords
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/optionalWords/
|
||||
*/
|
||||
optionalWords?: string[];
|
||||
/**
|
||||
@@ -426,13 +427,13 @@ declare namespace algoliasearch {
|
||||
* default: false
|
||||
* true|false: enable or disable stop words for all 41 supported languages; or
|
||||
* a list of language ISO codes (as a comma-separated string) for which stop words should be enable
|
||||
* https://github.com/algolia/algoliasearch-client-js#removestopwords
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/removeStopWords/
|
||||
*/
|
||||
removeStopWords?: string[];
|
||||
removeStopWords?: boolean|string[];
|
||||
/**
|
||||
* List of attributes on which you want to disable the computation of exact criteria
|
||||
* default: []
|
||||
* https://github.com/algolia/algoliasearch-client-js#disableexactonattributes
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/disableExactOnAttributes/
|
||||
*/
|
||||
disableExactOnAttributes?: string[];
|
||||
/**
|
||||
@@ -441,81 +442,90 @@ declare namespace algoliasearch {
|
||||
* 'none': no exact on single word query
|
||||
* 'word': exact set to 1 if the query word is found in the record
|
||||
* 'attribute': exact set to 1 if there is an attribute containing a string equals to the query
|
||||
* https://github.com/algolia/algoliasearch-client-js#exactonsinglewordquery
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/exactOnSingleWordQuery/
|
||||
*/
|
||||
exactOnSingleWordQuery?: string;
|
||||
exactOnSingleWordQuery?: "attribute"|"none"|"word";
|
||||
/**
|
||||
* Specify the list of approximation that should be considered as an exact match in the ranking formula
|
||||
* default: ['ignorePlurals', 'singleWordSynonym']
|
||||
* 'ignorePlurals': alternative words added by the ignorePlurals feature
|
||||
* 'singleWordSynonym': single-word synonym (For example "NY" = "NYC")
|
||||
* 'multiWordsSynonym': multiple-words synonym
|
||||
* https://github.com/algolia/algoliasearch-client-js#alternativesasexact
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/alternativesAsExact/
|
||||
*/
|
||||
alternativesAsExact?: any;
|
||||
alternativesAsExact?: Array<"ignorePlurals"|"singleWordSynonym"|"multiWordsSynonym">;
|
||||
/**
|
||||
* If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set.
|
||||
* https://github.com/algolia/algoliasearch-client-js#distinct
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/distinct/
|
||||
*/
|
||||
distinct?: any;
|
||||
distinct?: number|boolean;
|
||||
/**
|
||||
* If set to true, the result hits will contain ranking information in the _rankingInfo attribute.
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#getrankinginfo
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/getRankingInfo/
|
||||
*/
|
||||
getRankingInfo?: boolean;
|
||||
/**
|
||||
* @deprecated Use `numericAttributesForFiltering` instead
|
||||
* All numerical attributes are automatically indexed as numerical filters
|
||||
* default: ''
|
||||
* https://github.com/algolia/algoliasearch-client-js#numericattributestoindex
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/numericAttributesForFiltering/
|
||||
*/
|
||||
numericAttributesToIndex?: string[];
|
||||
/**
|
||||
* All numerical attributes are automatically indexed as numerical filters
|
||||
* default: ''
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/numericAttributesForFiltering/
|
||||
*/
|
||||
numericAttributesForFiltering?: string[];
|
||||
/**
|
||||
* @deprecated please use filters instead
|
||||
* A string that contains the comma separated list of numeric filters you want to apply.
|
||||
* https://github.com/algolia/algoliasearch-client-js#numericfilters-deprecated
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/numericFilters/
|
||||
*/
|
||||
numericFilters?: string[];
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* Filter the query by a set of tags.
|
||||
* https://github.com/algolia/algoliasearch-client-js#tagfilters-deprecated
|
||||
* Default: []
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/tagFilters/
|
||||
*/
|
||||
tagFilters?: string;
|
||||
tagFilters?: string[];
|
||||
/**
|
||||
* @deprecated
|
||||
* Filter the query by a set of facets.
|
||||
* https://github.com/algolia/algoliasearch-client-js#facetfilters-deprecated
|
||||
* Default: []
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/
|
||||
*/
|
||||
facetFilters?: string;
|
||||
facetFilters?: string[]|string[][];
|
||||
/**
|
||||
* If set to false, this query will not be taken into account in the analytics feature.
|
||||
* default true
|
||||
* https://github.com/algolia/algoliasearch-client-js#analytics
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/analytics/
|
||||
*/
|
||||
analytics?: boolean;
|
||||
/**
|
||||
* If set, tag your query with the specified identifiers
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#analyticstags
|
||||
* default: []
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/
|
||||
*/
|
||||
analyticsTags?: string[];
|
||||
/**
|
||||
* If set to false, the search will not use the synonyms defined for the targeted index.
|
||||
* default: true
|
||||
* https://github.com/algolia/algoliasearch-client-js#synonyms
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/synonyms/
|
||||
*/
|
||||
synonyms?: boolean;
|
||||
/**
|
||||
* If set to false, words matched via synonym expansion will not be replaced by the matched synonym in the highlighted result.
|
||||
* default: true
|
||||
* https://github.com/algolia/algoliasearch-client-js#replacesynonymsinhighlight
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/replaceSynonymsInHighlight/
|
||||
*/
|
||||
replaceSynonymsInHighlight?: boolean;
|
||||
/**
|
||||
* Configure the precision of the proximity ranking criterion
|
||||
* default: 1
|
||||
* https://github.com/algolia/algoliasearch-client-js#minproximity
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/minProximity/
|
||||
*/
|
||||
minProximity?: number;
|
||||
|
||||
@@ -545,42 +555,42 @@ declare namespace algoliasearch {
|
||||
interface Response {
|
||||
/**
|
||||
* Contains all the hits matching the query
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
hits: any[];
|
||||
/**
|
||||
* Current page
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
page: number;
|
||||
/**
|
||||
* Number of total hits matching the query
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
nbHits: number;
|
||||
/**
|
||||
* Number of pages
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
nbPages: number;
|
||||
/**
|
||||
* Number of hits per pages
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
hitsPerPage: number;
|
||||
/**
|
||||
* Engine processing time (excluding network transfer)
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
processingTimeMS: number;
|
||||
/**
|
||||
* Query used to perform the search
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
query: string;
|
||||
/**
|
||||
* GET parameters used to perform the search
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
params: string;
|
||||
facets?: {
|
||||
@@ -594,6 +604,16 @@ declare namespace algoliasearch {
|
||||
sum: number,
|
||||
};
|
||||
};
|
||||
/**
|
||||
* The index name is only set when searching multiple indices.
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/multiple-queries/?language=javascript#response
|
||||
*/
|
||||
index?: string;
|
||||
/**
|
||||
* The cursor is only set when browsing the index.
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/browse/
|
||||
*/
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
interface MultiResponse {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import ansi = require('ansi');
|
||||
const cursor = ansi(process.stdout);
|
||||
|
||||
Object.keys({
|
||||
white: 37
|
||||
, black: 30
|
||||
, blue: 34
|
||||
, cyan: 36
|
||||
, green: 32
|
||||
, magenta: 35
|
||||
, red: 31
|
||||
, yellow: 33
|
||||
, grey: 90
|
||||
, brightBlack: 90
|
||||
, brightRed: 91
|
||||
, brightGreen: 92
|
||||
, brightYellow: 93
|
||||
, brightBlue: 94
|
||||
, brightMagenta: 95
|
||||
, brightCyan: 96
|
||||
, brightWhite: 97
|
||||
}).forEach((color) => {
|
||||
cursor[color]().bold().write(`Hello, bold ${color.replace(/([a-z])([A-Z])/g, (_: string, l: string, u: string): string => `${l} ${u.toLowerCase()}`)} world!\n`).reset();
|
||||
});
|
||||
Vendored
+168
@@ -0,0 +1,168 @@
|
||||
// Type definitions for ansi 0.3
|
||||
// Project: https://www.npmjs.com/package/ansi
|
||||
// Definitions by: Gustavo6046 <https://github.com/Gustavo6046>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* References:
|
||||
*
|
||||
* - http://en.wikipedia.org/wiki/ANSI_escape_code
|
||||
* - http://www.termsys.demon.co.uk/vtansi.htm
|
||||
*
|
||||
*/
|
||||
|
||||
/// <reference types="node" />
|
||||
import { Stream } from "stream";
|
||||
|
||||
declare function ansi(stream: Stream, options?: any): ansi.Cursor;
|
||||
|
||||
declare namespace ansi {
|
||||
class Cursor {
|
||||
constructor(stream: Stream, options?: any);
|
||||
|
||||
/**
|
||||
* Helper function that calls `write()` on the underlying Stream.
|
||||
* Returns `this` instead of the write() return value to keep
|
||||
* the chaining going.
|
||||
*/
|
||||
write(data: string): Cursor;
|
||||
|
||||
/**
|
||||
* Buffer `write()` calls into memory.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
buffer(): Cursor;
|
||||
|
||||
/**
|
||||
* Write out the in-memory buffer.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
flush(): Cursor;
|
||||
|
||||
/**
|
||||
* Makes a beep sound!
|
||||
*/
|
||||
beep(): Cursor;
|
||||
|
||||
/**
|
||||
* Moves cursor to specific position
|
||||
*/
|
||||
goto(x?: number, y?: number): Cursor;
|
||||
|
||||
/**
|
||||
* Resets all ANSI formatting on the stream.
|
||||
*/
|
||||
reset(): Cursor;
|
||||
|
||||
/**
|
||||
* Sets the foreground color with the given RGB values.
|
||||
* The closest match out of the 216 colors is picked.
|
||||
*/
|
||||
rgb(r: number, g: number, b: number): Cursor;
|
||||
|
||||
/**
|
||||
* Accepts CSS color codes for use with ANSI escape codes.
|
||||
* For example: `#FF000` would be bright red.
|
||||
*/
|
||||
hex(color: string): Cursor;
|
||||
|
||||
up(): Cursor;
|
||||
down(): Cursor;
|
||||
forward(): Cursor;
|
||||
back(): Cursor;
|
||||
nextLine(): Cursor;
|
||||
previousLine(): Cursor;
|
||||
horizontalAbsolute(): Cursor;
|
||||
eraseData(): Cursor;
|
||||
eraseLine(): Cursor;
|
||||
scrollUp(): Cursor;
|
||||
scrollDown(): Cursor;
|
||||
savePosition(): Cursor;
|
||||
restorePosition(): Cursor;
|
||||
queryPosition(): Cursor;
|
||||
hide(): Cursor;
|
||||
show(): Cursor;
|
||||
|
||||
bold(): Cursor;
|
||||
italic(): Cursor;
|
||||
underline(): Cursor;
|
||||
inverse(): Cursor;
|
||||
resetbold(): Cursor;
|
||||
resetitalic(): Cursor;
|
||||
resetunderline(): Cursor;
|
||||
resetinverse(): Cursor;
|
||||
|
||||
white(): Cursor;
|
||||
black(): Cursor;
|
||||
blue(): Cursor;
|
||||
cyan(): Cursor;
|
||||
green(): Cursor;
|
||||
magenta(): Cursor;
|
||||
red(): Cursor;
|
||||
yellow(): Cursor;
|
||||
grey(): Cursor;
|
||||
brightBlack(): Cursor;
|
||||
brightRed(): Cursor;
|
||||
brightGreen(): Cursor;
|
||||
brightYellow(): Cursor;
|
||||
brightBlue(): Cursor;
|
||||
brightMagenta(): Cursor;
|
||||
brightCyan(): Cursor;
|
||||
brightWhite(): Cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* The `Colorer` class manages both the background and foreground colors.
|
||||
*/
|
||||
class Colorer {
|
||||
constructor(cursor: Cursor, base: string);
|
||||
|
||||
/**
|
||||
* Write an ANSI color code, ensuring that the same code doesn't get rewritten.
|
||||
*/
|
||||
_setColorCode(code: string): Colorer;
|
||||
|
||||
/**
|
||||
* Resets the color.
|
||||
*/
|
||||
reset(): Cursor;
|
||||
|
||||
/**
|
||||
* Sets the foreground color with the given RGB values.
|
||||
* The closest match out of the 216 colors is picked.
|
||||
*/
|
||||
rgb(r: number, g: number, b: number): Cursor;
|
||||
|
||||
/**
|
||||
* Accepts CSS color codes for use with ANSI escape codes.
|
||||
* For example: `#FF000` would be bright red.
|
||||
*/
|
||||
hex(color: string): Cursor;
|
||||
|
||||
white(): Cursor;
|
||||
black(): Cursor;
|
||||
blue(): Cursor;
|
||||
cyan(): Cursor;
|
||||
green(): Cursor;
|
||||
magenta(): Cursor;
|
||||
red(): Cursor;
|
||||
yellow(): Cursor;
|
||||
grey(): Cursor;
|
||||
brightBlack(): Cursor;
|
||||
brightRed(): Cursor;
|
||||
brightGreen(): Cursor;
|
||||
brightYellow(): Cursor;
|
||||
brightBlue(): Cursor;
|
||||
brightMagenta(): Cursor;
|
||||
brightCyan(): Cursor;
|
||||
brightWhite(): Cursor;
|
||||
}
|
||||
|
||||
interface Cursor {
|
||||
[key: string]: (...anything: any[]) => Cursor;
|
||||
}
|
||||
}
|
||||
|
||||
export = ansi;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ansi-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"noEmit": true,
|
||||
"types": [],
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+46
-12
@@ -4,6 +4,7 @@
|
||||
// Matt Durrant <https://github.com/mdurrant>
|
||||
// Peter Blazejewicz <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export as namespace auth0;
|
||||
|
||||
@@ -172,7 +173,7 @@ export class WebAuth {
|
||||
*
|
||||
* @param callback: any(err, token_payload)
|
||||
*/
|
||||
parseHash(callback: Auth0Callback<Auth0DecodedHash>): void;
|
||||
parseHash(callback: Auth0Callback<Auth0DecodedHash | null, Auth0ParseHashError>): void;
|
||||
|
||||
/**
|
||||
* Parse the url hash and extract the returned tokens depending on the transaction.
|
||||
@@ -183,7 +184,7 @@ export class WebAuth {
|
||||
*
|
||||
* @param callback: any(err, token_payload)
|
||||
*/
|
||||
parseHash(options: ParseHashOptions, callback: Auth0Callback<Auth0DecodedHash>): void;
|
||||
parseHash(options: ParseHashOptions, callback: Auth0Callback<Auth0DecodedHash | null, Auth0ParseHashError>): void;
|
||||
|
||||
/**
|
||||
* Decodes the id_token and verifies the nonce.
|
||||
@@ -482,7 +483,7 @@ export class CrossOriginAuthentication {
|
||||
callback(): void;
|
||||
}
|
||||
|
||||
export type Auth0Callback<T> = (error: null | Auth0Error, result: T) => void;
|
||||
export type Auth0Callback<T, E = Auth0Error> = (error: null | E, result: T) => void;
|
||||
|
||||
export interface TokenProvider {
|
||||
enableCache?: boolean;
|
||||
@@ -522,18 +523,51 @@ export interface PasswordlessAuthOptions {
|
||||
email: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* These are error codes defined by the auth0-js lib.
|
||||
*/
|
||||
export type LibErrorCodes = 'timeout' | 'request_error' | 'invalid_token';
|
||||
|
||||
/**
|
||||
* The user was not logged in at Auth0, so silent authentication is not possible.
|
||||
*/
|
||||
export type LoginRequiredErrorCode = 'login_required';
|
||||
|
||||
/**
|
||||
* The user was logged in at Auth0 and has authorized the application, but needs to
|
||||
* be redirected elsewhere before authentication can be completed; for example, when
|
||||
* using a redirect rule.
|
||||
*/
|
||||
export type InteractionRequiredErrorCode = 'interaction_required';
|
||||
|
||||
/**
|
||||
* The user was logged in at Auth0, but needs to give consent to authorize the application.
|
||||
*/
|
||||
export type ConsentRequiredErrorCode = 'consent_required';
|
||||
|
||||
/**
|
||||
* These are error codes defined by the OpenID Connect specification.
|
||||
*/
|
||||
export type SpecErrorCodes =
|
||||
LoginRequiredErrorCode |
|
||||
InteractionRequiredErrorCode |
|
||||
ConsentRequiredErrorCode |
|
||||
'account_selection_required' |
|
||||
'invalid_request_uri' |
|
||||
'invalid_request_object' |
|
||||
'request_not_supported' |
|
||||
'request_uri_not_supported' |
|
||||
'registration_not_supported';
|
||||
|
||||
export interface Auth0Error {
|
||||
error?: any;
|
||||
errorDescription?: string;
|
||||
code?: string;
|
||||
description?: string;
|
||||
name?: string;
|
||||
policy?: string;
|
||||
original?: any;
|
||||
statusCode?: number;
|
||||
statusText?: string;
|
||||
error: LibErrorCodes | SpecErrorCodes | string;
|
||||
errorDescription: string;
|
||||
}
|
||||
|
||||
export type Auth0ParseHashError = Auth0Error & {
|
||||
state?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* The contents of the authResult object returned by {@link WebAuth#parseHash }
|
||||
*/
|
||||
|
||||
Vendored
+1
@@ -5,6 +5,7 @@
|
||||
// Larry Faudree <https://github.com/lfaudreejr>
|
||||
// Will Caulfield <https://github.com/willcaul>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
/// <reference types="auth0-js" />
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ declare let error: Error;
|
||||
declare let bool: boolean;
|
||||
declare let boolOrUndefined: boolean | undefined;
|
||||
declare let apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext;
|
||||
declare let apiGwEvtReqCtxOpt: AWSLambda.APIGatewayEventRequestContext | null | undefined;
|
||||
declare let apiGwEvt: AWSLambda.APIGatewayEvent;
|
||||
declare let customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent;
|
||||
declare let clientCtx: AWSLambda.ClientContext;
|
||||
@@ -102,11 +103,13 @@ str = apiGwEvtReqCtx.resourcePath;
|
||||
/* API Gateway Event */
|
||||
strOrNull = apiGwEvt.body;
|
||||
str = apiGwEvt.headers["example"];
|
||||
str = apiGwEvt.multiValueHeaders["example"][0];
|
||||
str = apiGwEvt.httpMethod;
|
||||
bool = apiGwEvt.isBase64Encoded;
|
||||
str = apiGwEvt.path;
|
||||
str = apiGwEvt.pathParameters!["example"];
|
||||
str = apiGwEvt.queryStringParameters!["example"];
|
||||
str = apiGwEvt.multiValueQueryStringParameters!["example"][0];
|
||||
str = apiGwEvt.stageVariables!["example"];
|
||||
apiGwEvtReqCtx = apiGwEvt.requestContext;
|
||||
str = apiGwEvt.resource;
|
||||
@@ -115,10 +118,12 @@ str = apiGwEvt.resource;
|
||||
str = customAuthorizerEvt.type;
|
||||
str = customAuthorizerEvt.methodArn;
|
||||
strOrUndefined = customAuthorizerEvt.authorizationToken;
|
||||
str = apiGwEvt.pathParameters!["example"];
|
||||
str = apiGwEvt.queryStringParameters!["example"];
|
||||
str = apiGwEvt.stageVariables!["example"];
|
||||
apiGwEvtReqCtx = apiGwEvt.requestContext;
|
||||
str = customAuthorizerEvt.headers!["example"];
|
||||
str = customAuthorizerEvt.multiValueHeaders!["example"][0];
|
||||
str = customAuthorizerEvt.pathParameters!["example"];
|
||||
str = customAuthorizerEvt.queryStringParameters!["example"];
|
||||
str = customAuthorizerEvt.multiValueQueryStringParameters!["example"][0];
|
||||
apiGwEvtReqCtxOpt = customAuthorizerEvt.requestContext;
|
||||
|
||||
/* DynamoDB Stream Event */
|
||||
const dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = {
|
||||
@@ -245,6 +250,9 @@ num = proxyResult.statusCode;
|
||||
proxyResult.headers!["example"] = str;
|
||||
proxyResult.headers!["example"] = bool;
|
||||
proxyResult.headers!["example"] = num;
|
||||
proxyResult.multiValueHeaders!["example"][0] = str;
|
||||
proxyResult.multiValueHeaders!["example"][0] = bool;
|
||||
proxyResult.multiValueHeaders!["example"][0] = num;
|
||||
boolOrUndefined = proxyResult.isBase64Encoded;
|
||||
str = proxyResult.body;
|
||||
|
||||
|
||||
Vendored
+8
@@ -22,6 +22,7 @@
|
||||
// Louis Larry <https://github.com/louislarry>
|
||||
// Daniel Papukchiev <https://github.com/dpapukchiev>
|
||||
// Oliver Hookins <https://github.com/ohookins>
|
||||
// Trevor Leach <https://github.com/trevor-leach>
|
||||
// James Gregory <https://github.com/jagregory>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
@@ -59,11 +60,13 @@ export interface APIGatewayEventRequestContext {
|
||||
export interface APIGatewayProxyEvent {
|
||||
body: string | null;
|
||||
headers: { [name: string]: string };
|
||||
multiValueHeaders: { [name: string]: string[] };
|
||||
httpMethod: string;
|
||||
isBase64Encoded: boolean;
|
||||
path: string;
|
||||
pathParameters: { [name: string]: string } | null;
|
||||
queryStringParameters: { [name: string]: string } | null;
|
||||
multiValueQueryStringParameters: { [name: string]: string[] } | null;
|
||||
stageVariables: { [name: string]: string } | null;
|
||||
requestContext: APIGatewayEventRequestContext;
|
||||
resource: string;
|
||||
@@ -76,8 +79,10 @@ export interface CustomAuthorizerEvent {
|
||||
methodArn: string;
|
||||
authorizationToken?: string;
|
||||
headers?: { [name: string]: string };
|
||||
multiValueHeaders?: { [name: string]: string[] };
|
||||
pathParameters?: { [name: string]: string } | null;
|
||||
queryStringParameters?: { [name: string]: string } | null;
|
||||
multiValueQueryStringParameters?: { [name: string]: string[] } | null;
|
||||
requestContext?: APIGatewayEventRequestContext;
|
||||
}
|
||||
|
||||
@@ -442,6 +447,9 @@ export interface APIGatewayProxyResult {
|
||||
headers?: {
|
||||
[header: string]: boolean | number | string;
|
||||
};
|
||||
multiValueHeaders?: {
|
||||
[header: string]: Array<boolean | number | string>;
|
||||
};
|
||||
body: string;
|
||||
isBase64Encoded?: boolean;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
$("#table").colResizable(); // $ExpectType JQuery<HTMLElement>
|
||||
|
||||
$("#table").colResizable({
|
||||
resizeMode: "fit",
|
||||
disable: false,
|
||||
disabledColumns: [1, 2, 3],
|
||||
liveDrag: true,
|
||||
postbackSafe: false,
|
||||
partialRefresh: true,
|
||||
headerOnly: false,
|
||||
gripInnerHtml: "",
|
||||
draggingClass: ".myClass",
|
||||
minWidth: 100,
|
||||
hoverCursor: 'pointer',
|
||||
dragCursor: 'e-resize',
|
||||
flush: false,
|
||||
marginLeft: "14px",
|
||||
marginRight: "auto",
|
||||
fixed: false,
|
||||
|
||||
onResize(evt) {
|
||||
evt.currentTarget; // $ExpectType Element
|
||||
},
|
||||
onDrag(evt) {
|
||||
evt.currentTarget; // $ExpectType Element
|
||||
}
|
||||
});
|
||||
|
||||
// Samples at http://www.bacubacu.com/colresizable
|
||||
function onSampleResized(e: JQueryMouseEventObject) {
|
||||
const table = $(e.currentTarget); // reference to the resized table
|
||||
}
|
||||
|
||||
$("#sample").colResizable({
|
||||
liveDrag: true,
|
||||
gripInnerHtml: "<div class='grip'></div>",
|
||||
draggingClass: "dragging",
|
||||
onResize: onSampleResized
|
||||
});
|
||||
|
||||
function postbackSample() {
|
||||
$("#updatePanelSample").colResizable({
|
||||
liveDrag: true,
|
||||
postbackSafe: true,
|
||||
partialRefresh: true
|
||||
});
|
||||
}
|
||||
|
||||
$("#flexSample").colResizable({resizeMode: 'flex'});
|
||||
|
||||
$("#overflowSample").colResizable({resizeMode: 'overflow'});
|
||||
|
||||
function onSlide() {}
|
||||
|
||||
$("#sample5").colResizable({
|
||||
liveDrag: true,
|
||||
draggingClass: "rangeDrag",
|
||||
gripInnerHtml: "<div class='rangeGrip'></div>",
|
||||
onResize: onSlide,
|
||||
minWidth: 8
|
||||
});
|
||||
Vendored
+149
@@ -0,0 +1,149 @@
|
||||
// Type definitions for colresizable 1.6
|
||||
// Project: http://bacubacu.com/colresizable/
|
||||
// Definitions by: Gilles Waeber <https://github.com/gilleswaeber>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
interface JQuery {
|
||||
colResizable(param?: colResizable.Settings): JQuery;
|
||||
}
|
||||
|
||||
declare namespace colResizable {
|
||||
interface Settings {
|
||||
/**
|
||||
* [default: 'fit'] It is used to set how the resize method works. Those are the possible values:
|
||||
* - 'fit': this is default resizing model, in which resizing a column does not alter table width, which means that when a column is expanded the next one shrinks.
|
||||
* - 'flex': in this mode tables can change its width and each column can shrink or expand independently if there is enough space in the parent container.
|
||||
* If there is not enough space, columns will share its width as they are resized. Table will never get bigger than its parent.
|
||||
* - 'overflow': allows to resize columns with overflow of parent container.
|
||||
* [version: 1.6]
|
||||
*/
|
||||
resizeMode?: 'fit' | 'flex' | 'overflow';
|
||||
|
||||
/**
|
||||
* [default: false] When set to true the table layout is updated while dragging column anchors.
|
||||
* liveDrag enabled is more CPU consuming so it is not recommended for slow computers, specially when dealing with huge or extremely complicated tables.
|
||||
* [version: 1.0]
|
||||
*/
|
||||
liveDrag?: boolean;
|
||||
|
||||
/**
|
||||
* @deprecated use resizeMode instead
|
||||
* [default: true] It is used to set how the resize method works.
|
||||
* In fixed mode resizing a column does not alter total table width, which means that when a column is expanded the next one shrinks.
|
||||
* If fixed is set to false then table can change its width and each column can shrink or expand independently.
|
||||
* [version: 1.5]
|
||||
*/
|
||||
fixed?: boolean;
|
||||
|
||||
/**
|
||||
* [default: false] This attribute can be used to specify that the manually selected column widths must remain unaltered after a postback or browser refresh.
|
||||
* This feature is mainly oriented to those pages created with server-side logic (codebehind), such as PHP or .NET, and it is only compatible with browsers
|
||||
* with sessionStorage support (all modern browsers).
|
||||
* However, if you are targeting older browsers (such as IE7 and IE8) you can still emulate sessionStorage using sessionStorage.js.
|
||||
* It is important to note that some browsers (IE and FF) doesn’t enable the sessionStorage object while running the website directly from the local file system,
|
||||
* so if you want to test this feature it is recommended to view the website through a web server or use browsers such as Chrome or Opera which doesn’t have this limitation.
|
||||
* Don't worry about compatibility issues, once your site is up on the internet, all browsers will act in exactly the same way.
|
||||
* [version: 1.3]
|
||||
*/
|
||||
postbackSafe?: boolean;
|
||||
|
||||
/**
|
||||
* [default: false] This attribute should be set to true if the table is inside of an updatePanel or any other kind of partial page refresh using ajax.
|
||||
* Table's ID should be same before and after the partial partial refresh.
|
||||
* [version: 1.5]
|
||||
*/
|
||||
partialRefresh?: boolean;
|
||||
|
||||
/**
|
||||
* [default: false] This attribute can be used to prevent vertical expansion of the column anchors to fit the table height.
|
||||
* If it is set to true, column handler's size will be bounded to the first row's vertical size.
|
||||
* [version: 1.2]
|
||||
*/
|
||||
headerOnly?: boolean;
|
||||
|
||||
/**
|
||||
* [default: ""] Its purpose is to allow column anchor customization by defining the HTML to be used in the column grips to provide some visual feedback.
|
||||
* It can be used in a wide range of ways to obtain very different outputs, and its flexibility can be increased by combining it with the draggingClass attribute.
|
||||
* [version: 1.0]
|
||||
*/
|
||||
gripInnerHtml?: string;
|
||||
|
||||
/**
|
||||
* [default: (internal class)] This attribute is used as the css class assigned to column anchors while being dragged. It can be used for visual feedback purposes.
|
||||
* [version: 1.0]
|
||||
*/
|
||||
draggingClass?: string;
|
||||
|
||||
/**
|
||||
* [default: false] When set to true it aims to remove all previously added enhancements such as events and additional DOM elements assigned by this plugin to
|
||||
* a single or collection of tables. It is required to disable a previously colResized table prior its removal from the document object tree.
|
||||
* [version: 1.0]
|
||||
*/
|
||||
disable?: boolean;
|
||||
|
||||
/**
|
||||
* [default: [ ] ] An array of column indexes to be excluded, so it will not be possible to drag them manually.
|
||||
* [version: 1.6]
|
||||
*/
|
||||
disabledColumns?: number[];
|
||||
|
||||
/**
|
||||
* [default: 15] This value specifies the minimum width (measured in pixels) that is allowed for the columns.
|
||||
* [version: 1.1]
|
||||
*/
|
||||
minWidth?: number;
|
||||
|
||||
/**
|
||||
* [default: "e-resize"] This attribute can be used to customize the cursor that will be displayed when the user is positioned on the column anchors.
|
||||
* [version: 1.3]
|
||||
*/
|
||||
hoverCursor?: string;
|
||||
|
||||
/**
|
||||
* [default: "e-resize"] Defines the cursor that will be used while the user is resizing a column.
|
||||
* [version: 1.3]
|
||||
*/
|
||||
dragCursor?: string;
|
||||
|
||||
/**
|
||||
* [default: false] Flush is only effective when postbackSafe is enabled.
|
||||
* Its purpose is to remove all previously stored data related to the current table layout to get it back to its original layout preventing width restoration after postback.
|
||||
* [version: ]
|
||||
*/
|
||||
flush?: boolean;
|
||||
|
||||
/**
|
||||
* [default: null] If the target table contains an explicit margin-left CSS rule, the same value must be used in this attribute (for example: "auto", "20%", "10px").
|
||||
* The reason why it is needed it is because most browsers (all except of IE) don’t allow direct access to the current CSS rule applied to an element in
|
||||
* its original units (such as "%", "em" or "auto" values).
|
||||
* If you know any workaround which doesn’t involve iteration through all the styles defined in the site and any other external dependencies, please let me know!
|
||||
* [version: 1.3]
|
||||
*/
|
||||
marginLeft?: string;
|
||||
|
||||
/**
|
||||
* [default: null] It behaves in exactly the same way than the marginLeft attribute but applied to the right margin.
|
||||
* [version: 1.3]
|
||||
*/
|
||||
marginRight?: string;
|
||||
|
||||
/**
|
||||
* If a callback function is supplied it will be fired when the user has ended dragging a column anchor altering the previous table layout.
|
||||
* The callback function can obtain a reference to the updated table through the currentTarget attribute of the event retrieved by parameters
|
||||
* [version: 1.0]
|
||||
*/
|
||||
onResize?: FunctionCallback;
|
||||
|
||||
/**
|
||||
* This event is fired while dragging a column anchor if liveDrag is enabled. It can be useful if the table is being used as a multiple range slider.
|
||||
* The callback function can obtain a reference to the updated table through the currentTarget attribute of the event retrieved by parameters
|
||||
* [version: 1.1]
|
||||
*/
|
||||
onDrag?: FunctionCallback;
|
||||
}
|
||||
|
||||
type FunctionCallback = (e: JQueryMouseEventObject) => void;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"colresizable-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -36,7 +36,8 @@ const showAllStyle: cytoscape.Stylesheet[] = [
|
||||
'text-halign': 'center',
|
||||
shape: 'rectangle',
|
||||
'min-zoomed-font-size': 20,
|
||||
opacity: 1
|
||||
opacity: 1,
|
||||
width: 'mapData(weight, 40, 80, 20, 60)'
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -125,7 +126,7 @@ cy.on('zoom', (event) => {
|
||||
cy.off('zoom');
|
||||
// events(cy); - TODO
|
||||
|
||||
cy.add({ data: { id: 'g' }, position: {x: 200, y: 150} });
|
||||
cy.add({ data: { id: 'g', someOtherKey: 'value' }, position: {x: 200, y: 150} });
|
||||
cy.add([
|
||||
{ data: { id: 'h' }, position: {x: 250, y: 100} }
|
||||
]);
|
||||
|
||||
Vendored
+9
-3
@@ -133,6 +133,8 @@ declare namespace cytoscape {
|
||||
}
|
||||
|
||||
interface EdgeDataDefinition extends ElementDataDefinition {
|
||||
id?: string;
|
||||
|
||||
/**
|
||||
* the source node id (edge comes from this node)
|
||||
*/
|
||||
@@ -141,6 +143,8 @@ declare namespace cytoscape {
|
||||
* the target node id (edge goes to this node)
|
||||
*/
|
||||
target: string;
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface NodeDefinition extends ElementDefinition {
|
||||
@@ -148,7 +152,9 @@ declare namespace cytoscape {
|
||||
}
|
||||
|
||||
interface NodeDataDefinition extends ElementDataDefinition {
|
||||
id?: string;
|
||||
parent?: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface CytoscapeOptions {
|
||||
@@ -3445,13 +3451,13 @@ declare namespace cytoscape {
|
||||
* This property can take on the special value label
|
||||
* so the width is automatically based on the node’s label.
|
||||
*/
|
||||
"width"?: number | "label";
|
||||
"width"?: number | string;
|
||||
/**
|
||||
* The height of the node’s body.
|
||||
* This property can take on the special value label
|
||||
* so the height is automatically based on the node’s label.
|
||||
*/
|
||||
"height"?: number | "label";
|
||||
"height"?: number | string;
|
||||
/**
|
||||
* The shape of the node’s body.
|
||||
*/
|
||||
@@ -3624,7 +3630,7 @@ declare namespace cytoscape {
|
||||
/**
|
||||
* The width of an edge’s line.
|
||||
*/
|
||||
"width"?: number | "label";
|
||||
"width"?: number | string;
|
||||
/**
|
||||
* The curving method used to separate two or more edges between two nodes;
|
||||
* may be
|
||||
|
||||
Vendored
+31
-2
@@ -823,6 +823,35 @@ declare namespace Dockerode {
|
||||
context: string;
|
||||
src: string[];
|
||||
}
|
||||
|
||||
interface DockerVersion {
|
||||
ApiVersion: string;
|
||||
Arch: string;
|
||||
BuildTime: Date;
|
||||
Components: Array<{
|
||||
Details: {
|
||||
ApiVersion: string;
|
||||
Arch: string;
|
||||
BuilTime: Date;
|
||||
Experimental: string;
|
||||
GitCommit: string;
|
||||
GoVersion: string;
|
||||
KernelVersion: string;
|
||||
Os: string;
|
||||
};
|
||||
Name: string;
|
||||
Version: string;
|
||||
}>;
|
||||
GitCommit: string;
|
||||
GoVersion: string;
|
||||
KernelVersion: string;
|
||||
MinAPIVersion: string;
|
||||
Os: string;
|
||||
Platform: {
|
||||
Name: string;
|
||||
};
|
||||
Version: string;
|
||||
}
|
||||
}
|
||||
|
||||
type Callback<T> = (error?: any, result?: T) => void;
|
||||
@@ -949,8 +978,8 @@ declare class Dockerode {
|
||||
df(callback: Callback<any>): void;
|
||||
df(): Promise<any>;
|
||||
|
||||
version(callback: Callback<any>): void;
|
||||
version(): Promise<any>;
|
||||
version(callback: Callback<Dockerode.DockerVersion>): void;
|
||||
version(): Promise<Dockerode.DockerVersion>;
|
||||
|
||||
ping(callback: Callback<any>): void;
|
||||
ping(): Promise<any>;
|
||||
|
||||
@@ -14,10 +14,15 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"got": [
|
||||
"got/v8"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"download-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import * as factory from "factory-girl";
|
||||
|
||||
interface User {
|
||||
username?: string;
|
||||
score?: number;
|
||||
email?: string;
|
||||
roles?: Role[];
|
||||
creditCard?: any;
|
||||
boss?: User;
|
||||
}
|
||||
|
||||
interface Role {
|
||||
id?: number;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface SuperUser extends User {
|
||||
superpower: string;
|
||||
}
|
||||
|
||||
// Testing setAdapter
|
||||
factory.setAdapter("my-adapter", "my-adapter-name");
|
||||
|
||||
// Testing define with seq, assoc, assocAttrs, assocMany
|
||||
factory.define<User>("user", {}, {
|
||||
username: "Bob",
|
||||
score: factory.seq<number>("User.score", score => score + 1),
|
||||
email: factory.seq<string>("User.email", num => `email-${1}@users.com`),
|
||||
roles: factory.assocMany("Role", 3, "id"),
|
||||
creditCard: factory.assocAttrs("CreditCard", "creditCard", { number: "1234" }),
|
||||
boss: factory.assoc("User", "boss")
|
||||
}, {
|
||||
afterBuild: (model, attrs, options) => {},
|
||||
afterCreate: (model, attrs, options) => {}
|
||||
});
|
||||
|
||||
// Testing extend, with and without options
|
||||
factory.extend("user", "superuser", { superpower: "flight" });
|
||||
|
||||
factory.extend("user", "superuser", { superpower: "flight" }, {
|
||||
afterBuild: (model, attrs, options) => {},
|
||||
afterCreate: (model, attrs, options) => {}
|
||||
});
|
||||
|
||||
// Testing attrs, with and without attributes
|
||||
factory.attrs<User>("user").then(attrs => null);
|
||||
factory.attrs<User>("user", { score: 10 }).then(attrs => null);
|
||||
|
||||
// Testing attrsMany, with and without attributes
|
||||
factory.attrsMany<User>("user", 2).then(attrs => null);
|
||||
factory.attrsMany<User>("user", 2, [{ score: 10 }]).then(attrs => null);
|
||||
|
||||
// Testing build, with and without attributes
|
||||
factory.build<User>("user").then(user => user.username);
|
||||
factory.build<User>("user", { score: 10 }).then(user => user.username);
|
||||
|
||||
// Testing buildMany, with and without attributes and options
|
||||
factory.buildMany<User>("user", 3)
|
||||
.then(users => users.map(user => user.username));
|
||||
|
||||
factory.buildMany<User>("user", 3, { username: "John McClane" })
|
||||
.then(users => users.map(user => user.username));
|
||||
|
||||
// Testing buildMany with a list of attributes
|
||||
factory.buildMany<User>("user", [
|
||||
{ username: "Jake Blues" },
|
||||
{ username: "Elwood Blues" }
|
||||
]).then(users => users.map(user => user.username));
|
||||
|
||||
// Testing create, with and without attributes
|
||||
factory.create<User>("user").then(user => user.username);
|
||||
factory.create<User>("user", { score: 10 }).then(user => user.username);
|
||||
|
||||
// Testing createMany, with and without attributes
|
||||
factory.createMany<User>("user", 3)
|
||||
.then(users => users.map(user => user.username));
|
||||
|
||||
factory.createMany<User>("user", 3, { username: "Rocky Balboa" })
|
||||
.then(users => users.map(user => user.username));
|
||||
|
||||
// Testing createMany with options
|
||||
factory.createMany<User>("user", 3, { username: "John Rambo" }, {
|
||||
afterBuild: (model, attrs, options) => {},
|
||||
afterCreate: (model, attrs, options) => {}
|
||||
}).then(users => users.map(user => user.username));
|
||||
|
||||
// Testing createMany with a list of attributes
|
||||
factory.createMany<User>("user", [
|
||||
{ username: "Emmett Brown" },
|
||||
{ username: "Marty McFly" }
|
||||
]).then(users => users.map(user => user.username));
|
||||
|
||||
// Testing cleanUp
|
||||
factory.cleanUp();
|
||||
Vendored
+95
@@ -0,0 +1,95 @@
|
||||
// Type definitions for factory-girl 5.0
|
||||
// Project: https://github.com/aexmachina/factory-girl#readme
|
||||
// Definitions by: Stack Builders <https://github.com/stackbuilders>
|
||||
// Sebastián Estrella <https://github.com/sestrella>
|
||||
// Luis Fernando Alvarez <https://github.com/elcuy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
declare const factory: factory.Static;
|
||||
|
||||
declare namespace factory {
|
||||
interface Static {
|
||||
/**
|
||||
* Associate the factory to other model
|
||||
*/
|
||||
assoc(model: string, attributes: string): any;
|
||||
|
||||
/**
|
||||
* Associate the factory to a model that's not persisted
|
||||
*/
|
||||
assocAttrs(name: string, key?: string, attributes?: any): any;
|
||||
|
||||
/**
|
||||
* Associate the factory to multiple other models
|
||||
*/
|
||||
assocMany(model: string, num: number, attributes: string): any[];
|
||||
|
||||
/**
|
||||
* Generates and returns model attributes as an object hash instead of the model instance
|
||||
*/
|
||||
attrs<T>(name: string, attrs?: Partial<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Generates and returns a collection of model attributes as an object hash instead of the model instance
|
||||
*/
|
||||
attrsMany<T>(name: string, num: number, attrs?: Array<Partial<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Builds a new model instance that is not persisted
|
||||
*/
|
||||
build<T>(name: string, attrs?: Partial<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Builds an array of model instances that are persisted
|
||||
*/
|
||||
buildMany<T>(name: string, num: number, attrs?: Partial<T>): Promise<T[]>;
|
||||
buildMany<T>(name: string, attrs?: Array<Partial<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Destroys all of the created models
|
||||
*/
|
||||
cleanUp(): void;
|
||||
|
||||
/**
|
||||
* Builds a new model instance that is persisted
|
||||
*/
|
||||
create<T>(name: string, attrs?: Partial<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Builds an array of model instances that are persisted
|
||||
*/
|
||||
createMany<T>(name: string, num: number, attrs?: Partial<T>, buildOptions?: Options<T>): Promise<T[]>;
|
||||
createMany<T>(name: string, attrs?: Array<Partial<T>>, buildOptions?: Options<T>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Define a new factory with a set of options
|
||||
*/
|
||||
define<T>(name: string, model: any, attrs: T, options?: Options<T>): void;
|
||||
|
||||
/**
|
||||
* Extends a factory
|
||||
*/
|
||||
extend(parent: string, name: string, initializer: any, options?: Options<any>): any;
|
||||
|
||||
/**
|
||||
* Generate values sequentially inside a factory
|
||||
*/
|
||||
seq<T>(name: string, fn: (sequence: number) => T): T;
|
||||
|
||||
/**
|
||||
* Register an adapter, either as default or tied to a specific model
|
||||
*/
|
||||
setAdapter(adapter: any, name?: string): void;
|
||||
}
|
||||
|
||||
interface Options<T> {
|
||||
afterBuild?: Hook<T>;
|
||||
afterCreate?: Hook<T>;
|
||||
}
|
||||
|
||||
type Hook<T> = (model: any, attrs: T[], options: any) => void;
|
||||
}
|
||||
|
||||
export = factory;
|
||||
export as namespace factory;
|
||||
@@ -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",
|
||||
"factory-girl-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -48,6 +48,7 @@ pool.use((conn: Connection) => 'test')
|
||||
|
||||
pool.acquire()
|
||||
.then((conn: Connection) => {
|
||||
console.log(pool.isBorrowedResource(conn)); // => true
|
||||
return pool.release(conn);
|
||||
}).then(() => {
|
||||
return pool.acquire(5);
|
||||
|
||||
Vendored
+1
@@ -24,6 +24,7 @@ export class Pool<T> extends EventEmitter {
|
||||
drain(): PromiseLike<void>;
|
||||
clear(): PromiseLike<void>;
|
||||
use<U>(cb: (resource: T) => U): PromiseLike<U>;
|
||||
isBorrowedResource(resource: T): boolean;
|
||||
}
|
||||
|
||||
export interface Factory<T> {
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import * as url from 'url';
|
||||
import QuickLRU = require('quick-lru');
|
||||
import tough = require('tough-cookie');
|
||||
|
||||
let str: string;
|
||||
let buf: Buffer;
|
||||
@@ -260,3 +261,11 @@ got(new url.URL('http://todomvc.com'));
|
||||
got(url.parse('http://todomvc.com'));
|
||||
|
||||
got('https://todomvc.com', { rejectUnauthorized: false });
|
||||
|
||||
got('/examples/angularjs', { baseUrl: 'http://todomvc.com' });
|
||||
got('http://todomvc.com', { headers: { foo: 'bar'} });
|
||||
got('http://todomvc.com', { cookieJar: new tough.CookieJar() });
|
||||
got('http://todomvc.com', { retry: 2 });
|
||||
got('http://todomvc.com', { retry: { retries: 2, methods: ['GET'], statusCodes: [408, 504], maxRetryAfter: 1 } });
|
||||
got('http://todomvc.com', { throwHttpErrors: false });
|
||||
got('http://todomvc.com', { hooks: { beforeRequest: [ () => 'foo']} });
|
||||
|
||||
Vendored
+23
-6
@@ -1,8 +1,9 @@
|
||||
// Type definitions for got 8.3
|
||||
// Type definitions for got 9.2
|
||||
// Project: https://github.com/sindresorhus/got#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Linus Unnebäck <https://github.com/LinusU>
|
||||
// Konstantin Ikonnikov <https://github.com/ikokostya>
|
||||
// Stijn Van Nieuwenhuyse <https://github.com/stijnvn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -12,6 +13,7 @@ import { Url, URL } from 'url';
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import * as nodeStream from 'stream';
|
||||
import { CookieJar } from 'tough-cookie';
|
||||
|
||||
export = got;
|
||||
|
||||
@@ -95,8 +97,12 @@ declare namespace got {
|
||||
|
||||
type GotUrl = string | https.RequestOptions | Url | URL;
|
||||
|
||||
type Hook<T> = (options: T) => any;
|
||||
type Hooks<T> = Record<'beforeRequest', Array<Hook<T>>>;
|
||||
|
||||
interface GotBodyOptions<E extends string | null> extends GotOptions<E> {
|
||||
body?: string | Buffer | nodeStream.Readable;
|
||||
hooks?: Hooks<GotBodyOptions<E>>;
|
||||
}
|
||||
|
||||
interface GotJSONOptions extends GotOptions<string | null> {
|
||||
@@ -104,25 +110,29 @@ declare namespace got {
|
||||
body?: object;
|
||||
form?: boolean;
|
||||
json: true;
|
||||
hooks?: Hooks<GotJSONOptions>;
|
||||
}
|
||||
|
||||
interface GotFormOptions<E extends string | null> extends GotOptions<E> {
|
||||
body?: {[key: string]: any};
|
||||
form: true;
|
||||
json?: boolean;
|
||||
hooks?: Hooks<GotFormOptions<E>>;
|
||||
}
|
||||
|
||||
interface GotOptions<E extends string | null> extends InternalRequestOptions {
|
||||
baseUrl?: string;
|
||||
cookieJar?: CookieJar;
|
||||
encoding?: E;
|
||||
query?: string | object;
|
||||
timeout?: number | TimeoutOptions;
|
||||
retries?: number | RetryFunction;
|
||||
retry?: number | RetryOptions;
|
||||
followRedirect?: boolean;
|
||||
decompress?: boolean;
|
||||
useElectronNet?: boolean;
|
||||
cache?: Cache;
|
||||
agent?: http.Agent | boolean | AgentOptions;
|
||||
throwHttpErrors?: boolean;
|
||||
agent?: http.Agent | boolean | AgentOptions;
|
||||
cache?: Cache;
|
||||
}
|
||||
|
||||
interface TimeoutOptions {
|
||||
@@ -131,13 +141,20 @@ declare namespace got {
|
||||
request?: number;
|
||||
}
|
||||
|
||||
type RetryFunction = (retry: number, error: any) => number;
|
||||
|
||||
interface RetryOptions {
|
||||
retries?: number | RetryFunction;
|
||||
methods?: Array<'GET' | 'PUT' | 'HEAD' | 'DELETE' | 'OPTIONS' | 'TRACE'>;
|
||||
statusCodes?: Array<408 | 413 | 429 | 500 | 502 | 503 | 504>;
|
||||
maxRetryAfter?: number;
|
||||
}
|
||||
|
||||
interface AgentOptions {
|
||||
http: http.Agent;
|
||||
https: https.Agent;
|
||||
}
|
||||
|
||||
type RetryFunction = (retry: number, error: any) => number;
|
||||
|
||||
interface Cache {
|
||||
set(key: string, value: any, ttl?: number): any;
|
||||
get(key: string): any;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
import got = require('got');
|
||||
import cookie = require('cookie');
|
||||
import FormData = require('form-data');
|
||||
import Keyv = require('keyv');
|
||||
import * as fs from 'fs';
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import * as url from 'url';
|
||||
import QuickLRU = require('quick-lru');
|
||||
|
||||
let str: string;
|
||||
let buf: Buffer;
|
||||
|
||||
got('todomvc.com')
|
||||
.then(response => {
|
||||
str = response.body;
|
||||
})
|
||||
.catch((error: got.GotError) => {
|
||||
console.log(error.response.body);
|
||||
});
|
||||
|
||||
got('todomvc.com').cancel();
|
||||
|
||||
got('todomvc.com', {json: true}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {json: true, body: {}}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {json: true, body: [{}]}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {json: true, form: true}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {json: true, form: true, encoding: null}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {json: true, form: true, encoding: null, hostname: 'todomvc'}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {form: true}).then(response => str = response.body);
|
||||
got('todomvc.com', {form: true, body: {}}).then(response => str = response.body);
|
||||
got('todomvc.com', {form: true, body: [{}]}).then(response => str = response.body);
|
||||
got('todomvc.com', {form: true, body: [{}], encoding: null}).then(response => buf = response.body);
|
||||
got('todomvc.com', {form: true, body: [{}], encoding: 'utf8'}).then(response => str = response.body);
|
||||
got('todomvc.com', {
|
||||
form: true,
|
||||
body: [{}],
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc'
|
||||
}).then(response => str = response.body);
|
||||
got('todomvc.com', {
|
||||
form: true,
|
||||
body: [{}],
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc',
|
||||
timeout: 2000
|
||||
}).then(response => str = response.body);
|
||||
got('todomvc.com', {
|
||||
form: true,
|
||||
body: [{}],
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc',
|
||||
timeout: {connect: 20, request: 20, socket: 20}
|
||||
}).then(response => str = response.body);
|
||||
// following must lead to type checking error: got('todomvc.com', {form: true, body: ''}).then(response => str = response.body);
|
||||
|
||||
got('todomvc.com', {encoding: null, hostname: 'todomvc'}).then(response => buf = response.body);
|
||||
got('todomvc.com', {encoding: 'utf8', hostname: 'todomvc'}).then(response => str = response.body);
|
||||
|
||||
got('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
|
||||
got.get('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
got.post('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
got.put('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
got.patch('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
got.head('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
got.delete('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
|
||||
got.stream('todomvc.com').pipe(fs.createWriteStream('index.html'));
|
||||
|
||||
fs.createReadStream('index.html').pipe(got.stream.get('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.post('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.put('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.patch('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.head('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.delete('todomvc.com'));
|
||||
|
||||
let req: http.ClientRequest;
|
||||
let res: http.IncomingMessage | undefined;
|
||||
let opts: got.GotOptions<string | null>;
|
||||
let err: got.GotError;
|
||||
let href: string | undefined;
|
||||
let progress: got.Progress;
|
||||
|
||||
const stream = got.stream('todomvc.com');
|
||||
stream.addListener('request', (r) => req = r);
|
||||
stream.addListener('response', (r) => res = r);
|
||||
stream.addListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.addListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.addListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.addListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.on('request', (r) => req = r);
|
||||
stream.on('response', (r) => res = r);
|
||||
stream.on('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.on('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.on('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.on('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.once('request', (r) => req = r);
|
||||
stream.once('response', (r) => res = r);
|
||||
stream.once('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.once('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.once('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.once('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.prependListener('request', (r) => req = r);
|
||||
stream.prependListener('response', (r) => res = r);
|
||||
stream.prependListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.prependListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.prependListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.prependListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.prependOnceListener('request', (r) => req = r);
|
||||
stream.prependOnceListener('response', (r) => res = r);
|
||||
stream.prependOnceListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.prependOnceListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.prependOnceListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.prependOnceListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.removeListener('request', (r) => req = r);
|
||||
stream.removeListener('response', (r) => res = r);
|
||||
stream.removeListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.removeListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.removeListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.removeListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
got('google.com', {
|
||||
headers: {
|
||||
cookie: cookie.serialize('foo', 'bar')
|
||||
}
|
||||
});
|
||||
|
||||
const form = new FormData();
|
||||
|
||||
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
|
||||
|
||||
got.post('google.com', {
|
||||
body: form
|
||||
});
|
||||
|
||||
got('todomvc.com', {
|
||||
headers: {
|
||||
'user-agent': `my-module/ (https://github.com/username/my-module)`
|
||||
}
|
||||
});
|
||||
|
||||
got('https://httpbin.org/404')
|
||||
.catch(err => err instanceof got.HTTPError && err.statusCode === 404);
|
||||
|
||||
got('todomvc', {
|
||||
throwHttpErrors: false
|
||||
});
|
||||
|
||||
got('todomvc', {
|
||||
agent: {
|
||||
http: new http.Agent(),
|
||||
https: new https.Agent()
|
||||
}
|
||||
});
|
||||
|
||||
got('todomvc', {
|
||||
cache: new Map(),
|
||||
}).then(res => res.fromCache);
|
||||
|
||||
got('todomvc', {
|
||||
cache: new Keyv(),
|
||||
}).then(res => res.fromCache);
|
||||
|
||||
got('todomvc', {
|
||||
cache: new QuickLRU(),
|
||||
}).then(res => res.fromCache);
|
||||
|
||||
got(new url.URL('http://todomvc.com'));
|
||||
|
||||
got(url.parse('http://todomvc.com'));
|
||||
|
||||
got('https://todomvc.com', { rejectUnauthorized: false });
|
||||
Vendored
+208
@@ -0,0 +1,208 @@
|
||||
// Type definitions for got 8.3
|
||||
// Project: https://github.com/sindresorhus/got#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Linus Unnebäck <https://github.com/LinusU>
|
||||
// Konstantin Ikonnikov <https://github.com/ikokostya>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
import { Url, URL } from 'url';
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import * as nodeStream from 'stream';
|
||||
|
||||
export = got;
|
||||
|
||||
declare class RequestError extends StdError {
|
||||
name: 'RequestError';
|
||||
}
|
||||
|
||||
declare class ReadError extends StdError {
|
||||
name: 'ReadError';
|
||||
}
|
||||
|
||||
declare class ParseError extends StdError {
|
||||
name: 'ParseError';
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
}
|
||||
|
||||
declare class HTTPError extends StdError {
|
||||
name: 'HTTPError';
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
headers: http.IncomingHttpHeaders;
|
||||
}
|
||||
|
||||
declare class MaxRedirectsError extends StdError {
|
||||
name: 'MaxRedirectsError';
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
redirectUrls: string[];
|
||||
}
|
||||
|
||||
declare class UnsupportedProtocolError extends StdError {
|
||||
name: 'UnsupportedProtocolError';
|
||||
}
|
||||
|
||||
declare class CancelError extends StdError {
|
||||
name: 'CancelError';
|
||||
}
|
||||
|
||||
declare class StdError extends Error {
|
||||
code?: string;
|
||||
host?: string;
|
||||
hostname?: string;
|
||||
method?: string;
|
||||
path?: string;
|
||||
protocol?: string;
|
||||
url?: string;
|
||||
response?: any;
|
||||
}
|
||||
|
||||
declare const got: got.GotFn &
|
||||
Record<'get' | 'post' | 'put' | 'patch' | 'head' | 'delete', got.GotFn> &
|
||||
{
|
||||
stream: got.GotStreamFn & Record<'get' | 'post' | 'put' | 'patch' | 'head' | 'delete', got.GotStreamFn>;
|
||||
RequestError: typeof RequestError;
|
||||
ReadError: typeof ReadError;
|
||||
ParseError: typeof ParseError;
|
||||
HTTPError: typeof HTTPError;
|
||||
MaxRedirectsError: typeof MaxRedirectsError;
|
||||
UnsupportedProtocolError: typeof UnsupportedProtocolError;
|
||||
CancelError: typeof CancelError;
|
||||
};
|
||||
|
||||
interface InternalRequestOptions extends https.RequestOptions {
|
||||
// Redeclare options with `any` type for allow specify types incompatible with http.RequestOptions.
|
||||
timeout?: any;
|
||||
agent?: any;
|
||||
}
|
||||
|
||||
declare namespace got {
|
||||
interface GotFn {
|
||||
(url: GotUrl): GotPromise<string>;
|
||||
(url: GotUrl, options: GotJSONOptions): GotPromise<any>;
|
||||
(url: GotUrl, options: GotFormOptions<string>): GotPromise<string>;
|
||||
(url: GotUrl, options: GotFormOptions<null>): GotPromise<Buffer>;
|
||||
(url: GotUrl, options: GotBodyOptions<string>): GotPromise<string>;
|
||||
(url: GotUrl, options: GotBodyOptions<null>): GotPromise<Buffer>;
|
||||
}
|
||||
|
||||
type GotStreamFn = (url: GotUrl, options?: GotOptions<string | null>) => GotEmitter & nodeStream.Duplex;
|
||||
|
||||
type GotUrl = string | https.RequestOptions | Url | URL;
|
||||
|
||||
interface GotBodyOptions<E extends string | null> extends GotOptions<E> {
|
||||
body?: string | Buffer | nodeStream.Readable;
|
||||
}
|
||||
|
||||
interface GotJSONOptions extends GotOptions<string | null> {
|
||||
// Body must be an object or array. See https://github.com/sindresorhus/got/issues/511
|
||||
body?: object;
|
||||
form?: boolean;
|
||||
json: true;
|
||||
}
|
||||
|
||||
interface GotFormOptions<E extends string | null> extends GotOptions<E> {
|
||||
body?: {[key: string]: any};
|
||||
form: true;
|
||||
json?: boolean;
|
||||
}
|
||||
|
||||
interface GotOptions<E extends string | null> extends InternalRequestOptions {
|
||||
encoding?: E;
|
||||
query?: string | object;
|
||||
timeout?: number | TimeoutOptions;
|
||||
retries?: number | RetryFunction;
|
||||
followRedirect?: boolean;
|
||||
decompress?: boolean;
|
||||
useElectronNet?: boolean;
|
||||
cache?: Cache;
|
||||
agent?: http.Agent | boolean | AgentOptions;
|
||||
throwHttpErrors?: boolean;
|
||||
}
|
||||
|
||||
interface TimeoutOptions {
|
||||
connect?: number;
|
||||
socket?: number;
|
||||
request?: number;
|
||||
}
|
||||
|
||||
interface AgentOptions {
|
||||
http: http.Agent;
|
||||
https: https.Agent;
|
||||
}
|
||||
|
||||
type RetryFunction = (retry: number, error: any) => number;
|
||||
|
||||
interface Cache {
|
||||
set(key: string, value: any, ttl?: number): any;
|
||||
get(key: string): any;
|
||||
delete(key: string): any;
|
||||
}
|
||||
|
||||
interface Response<B extends Buffer | string | object> extends http.IncomingMessage {
|
||||
body: B;
|
||||
url: string;
|
||||
requestUrl: string;
|
||||
fromCache: boolean;
|
||||
redirectUrls?: string[];
|
||||
}
|
||||
|
||||
type GotPromise<B extends Buffer | string | object> = Promise<Response<B>> & { cancel(): void };
|
||||
|
||||
interface GotEmitter {
|
||||
addListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
addListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
addListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
addListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
addListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
addListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
on(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
on(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
on(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
on(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
on(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
on(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
once(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
once(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
once(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
once(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
once(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
once(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
prependListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
prependListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
prependListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
prependListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
prependListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
prependListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
prependOnceListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
prependOnceListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
prependOnceListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
prependOnceListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
prependOnceListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
prependOnceListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
removeListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
removeListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
removeListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
removeListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
removeListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
removeListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
}
|
||||
|
||||
type GotError = RequestError | ReadError | ParseError | HTTPError | MaxRedirectsError | UnsupportedProtocolError | CancelError;
|
||||
|
||||
interface Progress {
|
||||
percent: number;
|
||||
transferred: number;
|
||||
total: number | null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"got": [
|
||||
"got/v8"
|
||||
]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"got-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
Vendored
+32
@@ -393,6 +393,36 @@ declare namespace jest {
|
||||
test(val: any): boolean;
|
||||
}
|
||||
|
||||
interface InverseAsymmetricMatchers {
|
||||
/**
|
||||
* `expect.not.arrayContaining(array)` matches a received array which
|
||||
* does not contain all of the elements in the expected array. That is,
|
||||
* the expected array is not a subset of the received array. It is the
|
||||
* inverse of `expect.arrayContaining`.
|
||||
*/
|
||||
arrayContaining(arr: any[]): any;
|
||||
/**
|
||||
* `expect.not.objectContaining(object)` matches any received object
|
||||
* that does not recursively match the expected properties. That is, the
|
||||
* expected object is not a subset of the received object. Therefore,
|
||||
* it matches a received object which contains properties that are not
|
||||
* in the expected object. It is the inverse of `expect.objectContaining`.
|
||||
*/
|
||||
objectContaining(obj: {}): any;
|
||||
/**
|
||||
* `expect.not.stringMatching(string | regexp)` matches the received
|
||||
* string that does not match the expected regexp. It is the inverse of
|
||||
* `expect.stringMatching`.
|
||||
*/
|
||||
stringMatching(str: string | RegExp): any;
|
||||
/**
|
||||
* `expect.not.stringContaining(string)` matches the received string
|
||||
* that does not contain the exact expected string. It is the inverse of
|
||||
* `expect.stringContaining`.
|
||||
*/
|
||||
stringContaining(str: string): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* The `expect` function is used every time you want to test a value.
|
||||
* You will rarely call `expect` by itself.
|
||||
@@ -475,6 +505,8 @@ declare namespace jest {
|
||||
* Matches any received string that contains the exact expected string
|
||||
*/
|
||||
stringContaining(str: string): any;
|
||||
|
||||
not: InverseAsymmetricMatchers;
|
||||
}
|
||||
|
||||
interface Matchers<R> {
|
||||
|
||||
@@ -746,6 +746,13 @@ describe("", () => {
|
||||
ghi: expect.stringMatching("foo"),
|
||||
}));
|
||||
|
||||
/* Inverse type matchers */
|
||||
|
||||
expect('How are you?').toEqual(expect.not.stringContaining('Hello world!'));
|
||||
expect('How are you?').toEqual(expect.not.stringMatching(/Hello world!/));
|
||||
expect({bar: 'baz'}).toEqual(expect.not.objectContaining({foo: 'bar'}));
|
||||
expect(['Alice', 'Bob', 'Eve']).toEqual(expect.not.arrayContaining(['Samantha']));
|
||||
|
||||
/* Miscellaneous */
|
||||
|
||||
expect.hasAssertions();
|
||||
|
||||
Vendored
+33
-50
@@ -1,4 +1,4 @@
|
||||
// Type definitions for joi 13.6
|
||||
// Type definitions for joi 14.0
|
||||
// Project: https://github.com/hapijs/joi
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Laurence Dougal Myers <https://github.com/laurence-myers>
|
||||
@@ -53,7 +53,6 @@ export interface ValidationOptions {
|
||||
* remove unknown elements from objects and arrays. Defaults to false
|
||||
* - when true, all unknown elements will be removed
|
||||
* - when an object:
|
||||
* - arrays - set to true to remove unknown items from arrays.
|
||||
* - objects - set to true to remove unknown keys from objects
|
||||
*/
|
||||
stripUnknown?: boolean | { arrays?: boolean; objects?: boolean };
|
||||
@@ -257,8 +256,7 @@ export interface AnySchema extends JoiObject {
|
||||
/**
|
||||
* Validates a value using the schema and options.
|
||||
*/
|
||||
validate<T>(value: T): ValidationResult<T>;
|
||||
validate<T>(value: T, options: ValidationOptions): ValidationResult<T>;
|
||||
validate<T>(value: T, options?: ValidationOptions): ValidationResult<T>;
|
||||
validate<T, R>(value: T, callback: (err: ValidationError, value: T) => R): R;
|
||||
validate<T, R>(value: T, options: ValidationOptions, callback: (err: ValidationError, value: T) => R): R;
|
||||
|
||||
@@ -317,14 +315,12 @@ export interface AnySchema extends JoiObject {
|
||||
/**
|
||||
* Annotates the key
|
||||
*/
|
||||
notes(notes: string): this;
|
||||
notes(notes: string[]): this;
|
||||
notes(notes: string | string[]): this;
|
||||
|
||||
/**
|
||||
* Annotates the key
|
||||
*/
|
||||
tags(notes: string): this;
|
||||
tags(notes: string[]): this;
|
||||
tags(notes: string | string[]): this;
|
||||
|
||||
/**
|
||||
* Attaches metadata to the key.
|
||||
@@ -369,8 +365,7 @@ export interface AnySchema extends JoiObject {
|
||||
* Additionally, when specifying a method you must either have a description property on your method or the
|
||||
* second parameter is required.
|
||||
*/
|
||||
default(value: any, description?: string): this;
|
||||
default(): this;
|
||||
default(value?: any, description?: string): this;
|
||||
|
||||
/**
|
||||
* Returns a new type that is the result of adding the rules of one type to another.
|
||||
@@ -380,8 +375,7 @@ export interface AnySchema extends JoiObject {
|
||||
/**
|
||||
* Converts the type into an alternatives type where the conditions are merged into the type definition where:
|
||||
*/
|
||||
when(ref: string, options: WhenOptions): AlternativesSchema;
|
||||
when(ref: Reference, options: WhenOptions): AlternativesSchema;
|
||||
when(ref: string | Reference, options: WhenOptions): AlternativesSchema;
|
||||
when(ref: Schema, options: WhenSchemaOptions): AlternativesSchema;
|
||||
|
||||
/**
|
||||
@@ -485,29 +479,25 @@ export interface NumberSchema extends AnySchema {
|
||||
* Specifies the minimum value.
|
||||
* It can also be a reference to another field.
|
||||
*/
|
||||
min(limit: number): this;
|
||||
min(limit: Reference): this;
|
||||
min(limit: number | Reference): this;
|
||||
|
||||
/**
|
||||
* Specifies the maximum value.
|
||||
* It can also be a reference to another field.
|
||||
*/
|
||||
max(limit: number): this;
|
||||
max(limit: Reference): this;
|
||||
max(limit: number | Reference): this;
|
||||
|
||||
/**
|
||||
* Specifies that the value must be greater than limit.
|
||||
* It can also be a reference to another field.
|
||||
*/
|
||||
greater(limit: number): this;
|
||||
greater(limit: Reference): this;
|
||||
greater(limit: number | Reference): this;
|
||||
|
||||
/**
|
||||
* Specifies that the value must be less than limit.
|
||||
* It can also be a reference to another field.
|
||||
*/
|
||||
less(limit: number): this;
|
||||
less(limit: Reference): this;
|
||||
less(limit: number | Reference): this;
|
||||
|
||||
/**
|
||||
* Requires the number to be an integer (no floating point).
|
||||
@@ -552,16 +542,14 @@ export interface StringSchema extends AnySchema {
|
||||
* @param limit - the minimum number of string characters required. It can also be a reference to another field.
|
||||
* @param encoding - if specified, the string length is calculated in bytes using the provided encoding.
|
||||
*/
|
||||
min(limit: number, encoding?: string): this;
|
||||
min(limit: Reference, encoding?: string): this;
|
||||
min(limit: number | Reference, encoding?: string): this;
|
||||
|
||||
/**
|
||||
* Specifies the maximum number of string characters.
|
||||
* @param limit - the maximum number of string characters allowed. It can also be a reference to another field.
|
||||
* @param encoding - if specified, the string length is calculated in bytes using the provided encoding.
|
||||
*/
|
||||
max(limit: number, encoding?: string): this;
|
||||
max(limit: Reference, encoding?: string): this;
|
||||
max(limit: number | Reference, encoding?: string): this;
|
||||
|
||||
/**
|
||||
* Specifies whether the string.max() limit should be used as a truncation.
|
||||
@@ -591,8 +579,7 @@ export interface StringSchema extends AnySchema {
|
||||
* @param limit - the required string length. It can also be a reference to another field.
|
||||
* @param encoding - if specified, the string length is calculated in bytes using the provided encoding.
|
||||
*/
|
||||
length(limit: number, encoding?: string): this;
|
||||
length(limit: Reference, encoding?: string): this;
|
||||
length(limit: number | Reference, encoding?: string): this;
|
||||
|
||||
/**
|
||||
* Defines a regular expression rule.
|
||||
@@ -610,8 +597,7 @@ export interface StringSchema extends AnySchema {
|
||||
* @param pattern - a regular expression object to match against, or a string of which all occurrences will be replaced.
|
||||
* @param replacement - the string that will replace the pattern.
|
||||
*/
|
||||
replace(pattern: RegExp, replacement: string): this;
|
||||
replace(pattern: string, replacement: string): this;
|
||||
replace(pattern: RegExp | string, replacement: string): this;
|
||||
|
||||
/**
|
||||
* Requires the string value to only contain a-z, A-Z, and 0-9.
|
||||
@@ -739,8 +725,7 @@ export interface ArraySchema extends AnySchema {
|
||||
/**
|
||||
* Specifies the exact number of items in the array.
|
||||
*/
|
||||
length(limit: number): this;
|
||||
length(limit: Reference): this;
|
||||
length(limit: number | Reference): this;
|
||||
|
||||
/**
|
||||
* Requires the array values to be unique.
|
||||
@@ -816,14 +801,12 @@ export interface ObjectSchema extends AnySchema {
|
||||
/**
|
||||
* Requires the presence of other keys whenever the specified key is present.
|
||||
*/
|
||||
with(key: string, peers: string): this;
|
||||
with(key: string, peers: string[]): this;
|
||||
with(key: string, peers: string | string[]): this;
|
||||
|
||||
/**
|
||||
* Forbids the presence of other keys whenever the specified is present.
|
||||
*/
|
||||
without(key: string, peers: string): this;
|
||||
without(key: string, peers: string[]): this;
|
||||
without(key: string, peers: string | string[]): this;
|
||||
|
||||
/**
|
||||
* Renames a key to another name (deletes the renamed key).
|
||||
@@ -833,8 +816,7 @@ export interface ObjectSchema extends AnySchema {
|
||||
/**
|
||||
* Verifies an assertion where.
|
||||
*/
|
||||
assert(ref: string, schema: SchemaLike, message?: string): this;
|
||||
assert(ref: Reference, schema: SchemaLike, message?: string): this;
|
||||
assert(ref: string | Reference, schema: SchemaLike, message?: string): this;
|
||||
|
||||
/**
|
||||
* Overrides the handling of unknown keys for the scope of the current object only (does not apply to children).
|
||||
@@ -847,6 +829,7 @@ export interface ObjectSchema extends AnySchema {
|
||||
* @param constructor - the constructor function that the object must be an instance of.
|
||||
* @param name - an alternate name to use in validation errors. This is useful when the constructor function does not have a name.
|
||||
*/
|
||||
// tslint:disable-next-line:ban-types
|
||||
type(constructor: Function, name?: string): this;
|
||||
|
||||
/**
|
||||
@@ -987,8 +970,7 @@ export interface FunctionSchema extends AnySchema {
|
||||
export interface AlternativesSchema extends AnySchema {
|
||||
try(types: SchemaLike[]): this;
|
||||
try(...types: SchemaLike[]): this;
|
||||
when(ref: string, options: WhenOptions): this;
|
||||
when(ref: Reference, options: WhenOptions): this;
|
||||
when(ref: string | Reference, options: WhenOptions): this;
|
||||
when(ref: Schema, options: WhenSchemaOptions): this;
|
||||
}
|
||||
|
||||
@@ -1037,6 +1019,13 @@ export interface Err extends JoiObject {
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export interface LazyOptions {
|
||||
/**
|
||||
* If true the schema generator will only be called once and the result will be cached.
|
||||
*/
|
||||
once?: boolean;
|
||||
}
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
/**
|
||||
@@ -1113,15 +1102,13 @@ export function alt(...types: SchemaLike[]): AlternativesSchema;
|
||||
* Supports the same methods of the any() type.
|
||||
* This is mostly useful for recursive schemas
|
||||
*/
|
||||
export function lazy(cb: () => Schema): LazySchema;
|
||||
export function lazy(cb: () => Schema, options?: LazyOptions): LazySchema;
|
||||
|
||||
/**
|
||||
* Validates a value using the given schema and options.
|
||||
*/
|
||||
export function validate<T>(value: T, schema: SchemaLike): ValidationResult<T>;
|
||||
export function validate<T>(value: T, schema: SchemaLike, options?: ValidationOptions): ValidationResult<T>;
|
||||
export function validate<T, R>(value: T, schema: SchemaLike, callback: (err: ValidationError, value: T) => R): R;
|
||||
|
||||
export function validate<T>(value: T, schema: SchemaLike, options: ValidationOptions): ValidationResult<T>;
|
||||
export function validate<T, R>(value: T, schema: SchemaLike, options: ValidationOptions, callback: (err: ValidationError, value: T) => R): R;
|
||||
|
||||
/**
|
||||
@@ -1161,8 +1148,7 @@ export function isRef(ref: any): ref is Reference;
|
||||
* Get a sub-schema of an existing schema based on a `path` that can be either a string or an array
|
||||
* of strings For string values path separator is a dot (`.`)
|
||||
*/
|
||||
export function reach(schema: ObjectSchema, path: string): Schema;
|
||||
export function reach(schema: ObjectSchema, path: string[]): Schema;
|
||||
export function reach(schema: ObjectSchema, path: string | string[]): Schema;
|
||||
|
||||
/**
|
||||
* Creates a new Joi instance customized with the extension(s) you provide included.
|
||||
@@ -1251,14 +1237,12 @@ export function description(desc: string): Schema;
|
||||
/**
|
||||
* Annotates the key
|
||||
*/
|
||||
export function notes(notes: string): Schema;
|
||||
export function notes(notes: string[]): Schema;
|
||||
export function notes(notes: string | string[]): Schema;
|
||||
|
||||
/**
|
||||
* Annotates the key
|
||||
*/
|
||||
export function tags(notes: string): Schema;
|
||||
export function tags(notes: string[]): Schema;
|
||||
export function tags(notes: string | string[]): Schema;
|
||||
|
||||
/**
|
||||
* Attaches metadata to the key.
|
||||
@@ -1293,8 +1277,7 @@ export function concat<T>(schema: T): T;
|
||||
/**
|
||||
* Converts the type into an alternatives type where the conditions are merged into the type definition where:
|
||||
*/
|
||||
export function when(ref: string, options: WhenOptions): AlternativesSchema;
|
||||
export function when(ref: Reference, options: WhenOptions): AlternativesSchema;
|
||||
export function when(ref: string | Reference, options: WhenOptions): AlternativesSchema;
|
||||
export function when(ref: Schema, options: WhenSchemaOptions): AlternativesSchema;
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ declare const exp: RegExp;
|
||||
declare const obj: object;
|
||||
declare const date: Date;
|
||||
declare const err: Error;
|
||||
declare const func: Function;
|
||||
declare const func: () => void;
|
||||
|
||||
declare const numArr: number[];
|
||||
declare const strArr: string[];
|
||||
@@ -906,7 +906,7 @@ schema = Joi.alt(schema, anySchema, boolSchema);
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.lazy(() => schema);
|
||||
schema = Joi.lazy(() => schema, { once: true });
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"joi-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// All are TODOs
|
||||
"ban-types": false,
|
||||
"no-empty-interface": false,
|
||||
"no-self-import": false,
|
||||
"unified-signatures": false
|
||||
"no-self-import": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1305
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"joi": [
|
||||
"joi/v13"
|
||||
]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"joi-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// All are TODOs
|
||||
"ban-types": false,
|
||||
"no-empty-interface": false,
|
||||
"no-self-import": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
// Type definitions for makeup-expander 0.4
|
||||
// Project: https://github.com/makeup-js/makeup-expander
|
||||
// Definitions by: Timur Manyanov <https://github.com/darkwebdev>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
declare namespace Expander {
|
||||
interface Options {
|
||||
autoCollapse?: boolean;
|
||||
collapseOnClickOut?: boolean;
|
||||
collapseOnFocusOut?: boolean;
|
||||
collapseOnMouseOut?: boolean;
|
||||
contentSelector?: string;
|
||||
expandOnClick?: boolean;
|
||||
expandOnFocus?: boolean;
|
||||
expandOnHover?: boolean;
|
||||
focusManagement?: string | null;
|
||||
hostSelector?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare class Expander {
|
||||
constructor(el: HTMLElement, selectedOptions?: Expander.Options);
|
||||
|
||||
collapseOnClickOut: boolean;
|
||||
|
||||
collapseOnFocusOut: boolean;
|
||||
|
||||
collapseOnMouseOut: boolean;
|
||||
|
||||
expandOnClick: boolean;
|
||||
|
||||
expandOnFocus: boolean;
|
||||
|
||||
expandOnHover: boolean;
|
||||
|
||||
collapse(): void;
|
||||
|
||||
expand(isKeyboard: boolean): void;
|
||||
|
||||
isExpanded(): boolean;
|
||||
|
||||
toggle(): void;
|
||||
}
|
||||
|
||||
export = Expander;
|
||||
@@ -0,0 +1,21 @@
|
||||
import Expander = require('makeup-expander');
|
||||
|
||||
const widgetEl: HTMLElement | null = document.querySelector('.expander');
|
||||
|
||||
const options: Expander.Options = {
|
||||
expandOnClick: true
|
||||
};
|
||||
|
||||
if (widgetEl) {
|
||||
// $ExpectType Expander
|
||||
new Expander(widgetEl);
|
||||
|
||||
// $ExpectType Expander
|
||||
const widget = new Expander(widgetEl, options);
|
||||
|
||||
// $ExpectType void
|
||||
widget.expand(true);
|
||||
|
||||
// $ExpectType boolean
|
||||
const expanded = widget.isExpanded();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"makeup-expander-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+82
-82
@@ -1121,7 +1121,7 @@ declare module "mongoose" {
|
||||
* Takes a populated field and returns it to its unpopulated state.
|
||||
* If the path was not populated, this is a no-op.
|
||||
*/
|
||||
depopulate(path: string): this;
|
||||
depopulate(path?: string): this;
|
||||
|
||||
/**
|
||||
* Returns true if the Document stores the same data as doc.
|
||||
@@ -1556,7 +1556,7 @@ declare module "mongoose" {
|
||||
* been using Query<T>, we set it as an alias of DocumentQuery.
|
||||
*/
|
||||
class Query<T> extends DocumentQuery<T, any> { }
|
||||
class DocumentQuery<T, DocType extends Document> extends mquery {
|
||||
class DocumentQuery<T, DocType extends Document, QueryHelpers = {}> extends mquery {
|
||||
/**
|
||||
* Specifies a javascript function or expression to pass to MongoDBs query system.
|
||||
* Only use $where when you have a condition that cannot be met using other MongoDB
|
||||
@@ -1636,8 +1636,8 @@ declare module "mongoose" {
|
||||
* Specifying this query as a count query. Passing a callback executes the query.
|
||||
* @param criteria mongodb selector
|
||||
*/
|
||||
count(callback?: (err: any, count: number) => void): Query<number>;
|
||||
count(criteria: any, callback?: (err: any, count: number) => void): Query<number>;
|
||||
count(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
|
||||
count(criteria: any, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Specifies this query as a `countDocuments()` query. Behaves like `count()`,
|
||||
@@ -1658,8 +1658,8 @@ declare module "mongoose" {
|
||||
* @param {Function} [callback] optional params are (error, count)
|
||||
* @return {Query} this
|
||||
*/
|
||||
countDocuments(callback?: (err: any, count: number) => void): Query<number>;
|
||||
countDocuments(criteria: any, callback?: (err: any, count: number) => void): Query<number>;
|
||||
countDocuments(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
|
||||
countDocuments(criteria: any, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Estimates the number of documents in the MongoDB collection. Faster than
|
||||
@@ -1671,8 +1671,8 @@ declare module "mongoose" {
|
||||
* @param {Function} [callback] optional params are (error, count)
|
||||
* @return {Query} this
|
||||
*/
|
||||
estimatedDocumentCount(callback?: (err: any, count: number) => void): Query<number>;
|
||||
estimatedDocumentCount(options: any, callback?: (err: any, count: number) => void): Query<number>;
|
||||
estimatedDocumentCount(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
|
||||
estimatedDocumentCount(options: any, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Returns a wrapper around a mongodb driver cursor. A Query<T>Cursor exposes a
|
||||
@@ -1681,10 +1681,10 @@ declare module "mongoose" {
|
||||
cursor(options?: any): QueryCursor<DocType>;
|
||||
|
||||
/** Declares or executes a distict() operation. Passing a callback executes the query. */
|
||||
distinct(callback?: (err: any, res: any[]) => void): Query<any[]>;
|
||||
distinct(field: string, callback?: (err: any, res: any[]) => void): Query<any[]>;
|
||||
distinct(callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
|
||||
distinct(field: string, callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
|
||||
distinct(field: string, criteria: any | Query<any>,
|
||||
callback?: (err: any, res: any[]) => void): Query<any[]>;
|
||||
callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
|
||||
|
||||
/** Specifies an $elemMatch condition */
|
||||
elemMatch(criteria: (elem: Query<any>) => void): this;
|
||||
@@ -1708,9 +1708,9 @@ declare module "mongoose" {
|
||||
* query is executed, the result will be an array of documents.
|
||||
* @param criteria mongodb selector
|
||||
*/
|
||||
find(callback?: (err: any, res: DocType[]) => void): DocumentQuery<DocType[], DocType>;
|
||||
find(callback?: (err: any, res: DocType[]) => void): DocumentQuery<DocType[], DocType> & QueryHelpers;
|
||||
find(criteria: any,
|
||||
callback?: (err: any, res: DocType[]) => void): DocumentQuery<DocType[], DocType>;
|
||||
callback?: (err: any, res: DocType[]) => void): DocumentQuery<DocType[], DocType> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Declares the query a findOne operation. When executed, the first found document is
|
||||
@@ -1719,36 +1719,36 @@ declare module "mongoose" {
|
||||
* @param criteria mongodb selector
|
||||
* @param projection optional fields to return
|
||||
*/
|
||||
findOne(callback?: (err: any, res: DocType | null) => void): DocumentQuery<DocType | null, DocType>;
|
||||
findOne(callback?: (err: any, res: DocType | null) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOne(criteria: any,
|
||||
callback?: (err: any, res: DocType | null) => void): DocumentQuery<DocType | null, DocType>;
|
||||
callback?: (err: any, res: DocType | null) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findAndModify remove command.
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the
|
||||
* callback. Executes immediately if callback is passed.
|
||||
*/
|
||||
findOneAndRemove(callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
findOneAndRemove(callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any,
|
||||
callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: QueryFindOneAndRemoveOptions,
|
||||
callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findAndModify update command.
|
||||
* Finds a matching document, updates it according to the update arg, passing any options, and returns
|
||||
* the found document (if any) to the callback. The query executes immediately if callback is passed.
|
||||
*/
|
||||
findOneAndUpdate(callback?: (err: any, doc: DocType | null) => void): DocumentQuery<DocType | null, DocType>;
|
||||
findOneAndUpdate(callback?: (err: any, doc: DocType | null) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndUpdate(update: any,
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndUpdate(query: any, update: any,
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndUpdate(query: any, update: any,
|
||||
options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType, res: any) => void): DocumentQuery<DocType, DocType>;
|
||||
callback?: (err: any, doc: DocType, res: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndUpdate(query: any, update: any, options: QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType>;
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Specifies a $geometry condition. geometry() must come after either intersects() or within().
|
||||
@@ -1806,7 +1806,7 @@ declare module "mongoose" {
|
||||
* getters/setters or other Mongoose magic applied.
|
||||
* @param bool defaults to true
|
||||
*/
|
||||
lean(bool?: boolean): Query<any>;
|
||||
lean(bool?: boolean): Query<any> & QueryHelpers;
|
||||
|
||||
/** Specifies the maximum number of documents the query will return. Cannot be used with distinct() */
|
||||
limit(val: number): this;
|
||||
@@ -1930,8 +1930,8 @@ declare module "mongoose" {
|
||||
* you must first call remove() and then execute it by using the exec() method.
|
||||
* @param criteria mongodb selector
|
||||
*/
|
||||
remove(callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']>;
|
||||
remove(criteria: any | Query<any>, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']>;
|
||||
remove(callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']> & QueryHelpers;
|
||||
remove(criteria: any | Query<any>, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']> & QueryHelpers;
|
||||
|
||||
/** Specifies which document fields to include or exclude (also known as the query "projection") */
|
||||
select(arg: string | any): this;
|
||||
@@ -2009,20 +2009,20 @@ declare module "mongoose" {
|
||||
* Converts this query to a customized, reusable query
|
||||
* constructor with all arguments and options retained.
|
||||
*/
|
||||
toConstructor<T>(): new (...args: any[]) => Query<T>;
|
||||
toConstructor<T, Doc extends Document>(): new (...args: any[]) => DocumentQuery<T, Doc>;
|
||||
toConstructor<T>(): new (...args: any[]) => Query<T> & QueryHelpers;
|
||||
toConstructor<T, Doc extends Document>(): new (...args: any[]) => DocumentQuery<T, Doc> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Declare and/or execute this query as an update() operation.
|
||||
* All paths passed that are not $atomic operations will become $set ops.
|
||||
* @param doc the update command
|
||||
*/
|
||||
update(callback?: (err: any, affectedRows: number) => void): Query<number>;
|
||||
update(doc: any, callback?: (err: any, affectedRows: number) => void): Query<number>;
|
||||
update(callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
|
||||
update(doc: any, callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
|
||||
update(criteria: any, doc: any,
|
||||
callback?: (err: any, affectedRows: number) => void): Query<number>;
|
||||
callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
|
||||
update(criteria: any, doc: any, options: QueryUpdateOptions,
|
||||
callback?: (err: any, affectedRows: number) => void): Query<number>;
|
||||
callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
|
||||
|
||||
/** Specifies a path for use with chaining. */
|
||||
where(path?: string | any, val?: any): this;
|
||||
@@ -2608,7 +2608,7 @@ declare module "mongoose" {
|
||||
* http://mongoosejs.com/docs/api.html#model-js
|
||||
*/
|
||||
export var Model: Model<any>;
|
||||
interface Model<T extends Document> extends NodeJS.EventEmitter, ModelProperties {
|
||||
interface Model<T extends Document, QueryHelpers = {}> extends NodeJS.EventEmitter, ModelProperties {
|
||||
/**
|
||||
* Model constructor
|
||||
* Provides the interface to MongoDB collections as well as creates document instances.
|
||||
@@ -2658,11 +2658,11 @@ declare module "mongoose" {
|
||||
* @param projection optional fields to return
|
||||
*/
|
||||
findById(id: any | string | number,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findById(id: any | string | number, projection: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findById(id: any | string | number, projection: any, options: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
model(name: string): Model<T>;
|
||||
|
||||
@@ -2670,7 +2670,7 @@ declare module "mongoose" {
|
||||
* Creates a Query and specifies a $where condition.
|
||||
* @param argument is a javascript string or anonymous function
|
||||
*/
|
||||
$where(argument: string | Function): DocumentQuery<T, T>;
|
||||
$where(argument: string | Function): DocumentQuery<T, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Performs aggregations on the models collection.
|
||||
@@ -2682,7 +2682,7 @@ declare module "mongoose" {
|
||||
aggregate(aggregations: any[], cb: Function): Promise<any[]>;
|
||||
|
||||
/** Counts number of matching documents in a database collection. */
|
||||
count(conditions: any, callback?: (err: any, count: number) => void): Query<number>;
|
||||
count(conditions: any, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Counts number of documents matching `criteria` in a database collection.
|
||||
@@ -2696,8 +2696,8 @@ declare module "mongoose" {
|
||||
* @param {Function} [callback]
|
||||
* @return {Query}
|
||||
*/
|
||||
countDocuments(callback?: (err: any, count: number) => void): Query<number>;
|
||||
countDocuments(criteria: any, callback?: (err: any, count: number) => void): Query<number>;
|
||||
countDocuments(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
|
||||
countDocuments(criteria: any, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Estimates the number of documents in the MongoDB collection. Faster than
|
||||
@@ -2709,8 +2709,8 @@ declare module "mongoose" {
|
||||
* @param {Function} [callback]
|
||||
* @return {Query}
|
||||
*/
|
||||
estimatedDocumentCount(callback?: (err: any, count: number) => void): Query<number>;
|
||||
estimatedDocumentCount(options: any, callback?: (err: any, count: number) => void): Query<number>;
|
||||
estimatedDocumentCount(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
|
||||
estimatedDocumentCount(options: any, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Shortcut for saving one or more documents to the database. MyModel.create(docs)
|
||||
@@ -2730,9 +2730,9 @@ declare module "mongoose" {
|
||||
discriminator<U extends Document>(name: string, schema: Schema): Model<U>;
|
||||
|
||||
/** Creates a Query for a distinct operation. Passing a callback immediately executes the query. */
|
||||
distinct(field: string, callback?: (err: any, res: any[]) => void): Query<any[]>;
|
||||
distinct(field: string, callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
|
||||
distinct(field: string, conditions: any,
|
||||
callback?: (err: any, res: any[]) => void): Query<any[]>;
|
||||
callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Sends ensureIndex commands to mongo for each index declared in the schema.
|
||||
@@ -2752,12 +2752,12 @@ declare module "mongoose" {
|
||||
* Finds documents.
|
||||
* @param projection optional fields to return
|
||||
*/
|
||||
find(callback?: (err: any, res: T[]) => void): DocumentQuery<T[], T>;
|
||||
find(conditions: any, callback?: (err: any, res: T[]) => void): DocumentQuery<T[], T>;
|
||||
find(callback?: (err: any, res: T[]) => void): DocumentQuery<T[], T> & QueryHelpers;
|
||||
find(conditions: any, callback?: (err: any, res: T[]) => void): DocumentQuery<T[], T> & QueryHelpers;
|
||||
find(conditions: any, projection?: any | null,
|
||||
callback?: (err: any, res: T[]) => void): DocumentQuery<T[], T>;
|
||||
callback?: (err: any, res: T[]) => void): DocumentQuery<T[], T> & QueryHelpers;
|
||||
find(conditions: any, projection?: any | null, options?: any | null,
|
||||
callback?: (err: any, res: T[]) => void): DocumentQuery<T[], T>;
|
||||
callback?: (err: any, res: T[]) => void): DocumentQuery<T[], T> & QueryHelpers;
|
||||
|
||||
|
||||
|
||||
@@ -2768,15 +2768,15 @@ declare module "mongoose" {
|
||||
* Executes immediately if callback is passed, else a Query object is returned.
|
||||
* @param id value of _id to query by
|
||||
*/
|
||||
findByIdAndRemove(): DocumentQuery<T | null, T>;
|
||||
findByIdAndRemove(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndRemove(id: any | number | string,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndRemove(id: any | number | string, options: {
|
||||
/** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */
|
||||
sort?: any;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
|
||||
/**
|
||||
@@ -2788,28 +2788,28 @@ declare module "mongoose" {
|
||||
*/
|
||||
findByIdAndDelete(): DocumentQuery<T | null, T>;
|
||||
findByIdAndDelete(id: any | number | string,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndDelete(id: any | number | string, options: {
|
||||
/** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */
|
||||
sort?: any;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...)
|
||||
* is equivalent to findOneAndUpdate({ _id: id }, ...).
|
||||
* @param id value of _id to query by
|
||||
*/
|
||||
findByIdAndUpdate(): DocumentQuery<T | null, T>;
|
||||
findByIdAndUpdate(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: { upsert: true, new: true } & ModelFindByIdAndUpdateOptions,
|
||||
callback?: (err: any, res: T) => void): DocumentQuery<T, T>;
|
||||
callback?: (err: any, res: T) => void): DocumentQuery<T, T> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: ModelFindByIdAndUpdateOptions,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Finds one document.
|
||||
@@ -2817,20 +2817,20 @@ declare module "mongoose" {
|
||||
* @param projection optional fields to return
|
||||
*/
|
||||
findOne(conditions?: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOne(conditions: any, projection: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOne(conditions: any, projection: any, options: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issue a mongodb findAndModify remove command.
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the callback.
|
||||
* Executes immediately if callback is passed else a Query object is returned.
|
||||
*/
|
||||
findOneAndRemove(): DocumentQuery<T | null, T>;
|
||||
findOneAndRemove(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: {
|
||||
/**
|
||||
* if multiple docs are found by the conditions, sets the sort order to choose
|
||||
@@ -2841,16 +2841,16 @@ declare module "mongoose" {
|
||||
maxTimeMS?: number;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findOneAndDelete command.
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the
|
||||
* callback. Executes immediately if callback is passed.
|
||||
*/
|
||||
findOneAndDelete(): DocumentQuery<T | null, T>;
|
||||
findOneAndDelete(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndDelete(conditions: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndDelete(conditions: any, options: {
|
||||
/**
|
||||
* if multiple docs are found by the conditions, sets the sort order to choose
|
||||
@@ -2867,7 +2867,7 @@ declare module "mongoose" {
|
||||
rawResult?: boolean;
|
||||
/** overwrites the schema's strict mode option for this update */
|
||||
strict?: boolean|string;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T>;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findAndModify update command.
|
||||
@@ -2875,15 +2875,15 @@ declare module "mongoose" {
|
||||
* and returns the found document (if any) to the callback. The query executes immediately
|
||||
* if callback is passed else a Query object is returned.
|
||||
*/
|
||||
findOneAndUpdate(): DocumentQuery<T | null, T>;
|
||||
findOneAndUpdate(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: { upsert: true, new: true } & ModelFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: T, res: any) => void): DocumentQuery<T, T>;
|
||||
callback?: (err: any, doc: T, res: any) => void): DocumentQuery<T, T> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: ModelFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T>;
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Implements $geoSearch functionality for Mongoose
|
||||
@@ -2900,7 +2900,7 @@ declare module "mongoose" {
|
||||
limit?: number;
|
||||
/** return the raw object instead of the Mongoose Model */
|
||||
lean?: boolean;
|
||||
}, callback?: (err: any, res: T[]) => void): DocumentQuery<T[], T>;
|
||||
}, callback?: (err: any, res: T[]) => void): DocumentQuery<T[], T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Shortcut for creating a new Document from existing raw data,
|
||||
@@ -2960,35 +2960,35 @@ declare module "mongoose" {
|
||||
callback?: (err: any, res: T) => void): Promise<T>;
|
||||
|
||||
/** Removes documents from the collection. */
|
||||
remove(conditions: any, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']>;
|
||||
deleteOne(conditions: any, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']>;
|
||||
deleteMany(conditions: any, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']>;
|
||||
remove(conditions: any, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']> & QueryHelpers;
|
||||
deleteOne(conditions: any, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']> & QueryHelpers;
|
||||
deleteMany(conditions: any, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Same as update(), except MongoDB replace the existing document with the given document (no atomic operators like $set).
|
||||
* This function triggers the following middleware: replaceOne
|
||||
*/
|
||||
replaceOne(conditions: any, replacement: any, callback?: (err: any, raw: any) => void): Query<any>;
|
||||
replaceOne(conditions: any, replacement: any, callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Updates documents in the database without returning them.
|
||||
* All update values are cast to their appropriate SchemaTypes before being sent.
|
||||
*/
|
||||
update(conditions: any, doc: any,
|
||||
callback?: (err: any, raw: any) => void): Query<any>;
|
||||
callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
|
||||
update(conditions: any, doc: any, options: ModelUpdateOptions,
|
||||
callback?: (err: any, raw: any) => void): Query<any>;
|
||||
callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
|
||||
updateOne(conditions: any, doc: any,
|
||||
callback?: (err: any, raw: any) => void): Query<any>;
|
||||
callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
|
||||
updateOne(conditions: any, doc: any, options: ModelUpdateOptions,
|
||||
callback?: (err: any, raw: any) => void): Query<any>;
|
||||
callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
|
||||
updateMany(conditions: any, doc: any,
|
||||
callback?: (err: any, raw: any) => void): Query<any>;
|
||||
callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
|
||||
updateMany(conditions: any, doc: any, options: ModelUpdateOptions,
|
||||
callback?: (err: any, raw: any) => void): Query<any>;
|
||||
callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
|
||||
|
||||
/** Creates a Query, applies the passed conditions, and returns the Query. */
|
||||
where(path: string, val?: any): Query<any>;
|
||||
where(path: string, val?: any): Query<any> & QueryHelpers;
|
||||
}
|
||||
|
||||
interface Document extends MongooseDocument, NodeJS.EventEmitter, ModelProperties {
|
||||
|
||||
@@ -2000,3 +2000,29 @@ new mongoose.Schema({ name: String }, {
|
||||
wtimeout: 1000
|
||||
}
|
||||
});
|
||||
|
||||
/* Query helpers: https://mongoosejs.com/docs/guide.html#query-helpers */
|
||||
|
||||
interface Animal2 extends mongoose.Document {
|
||||
name: string;
|
||||
type: string;
|
||||
tags: string[];
|
||||
}
|
||||
var animal2Schema = new mongoose.Schema({
|
||||
name: String,
|
||||
type: String,
|
||||
tags: { type: [String], index: true } // field level
|
||||
});
|
||||
let animal2QueryHelpers = {
|
||||
byName<Q extends mongoose.DocumentQuery<any, Animal2>>(this: Q, name: string) {
|
||||
return this.where({ name: new RegExp(name, 'i') });
|
||||
}
|
||||
};
|
||||
animal2Schema.query = animal2QueryHelpers;
|
||||
var Animal2 = mongoose.model<Animal2, mongoose.Model<Animal2, typeof animal2QueryHelpers>>('Animal', animal2Schema);
|
||||
Animal2.find().byName('fido').exec(function(err, animals) {
|
||||
console.log(animals);
|
||||
});
|
||||
Animal2.findOne().byName('fido').exec(function(err, animal) {
|
||||
console.log(animal);
|
||||
});
|
||||
|
||||
Vendored
+109
-80
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/RubenVerborgh/N3.js
|
||||
// Definitions by: Fred Eisele <https://github.com/phreed>
|
||||
// Ruben Taelman <https://github.com/rubensworks>
|
||||
// Laurens Rietveld <https://github.com/LaurensRietveld>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -16,91 +17,119 @@ export interface Prefixes<I = RDF.NamedNode> {
|
||||
[key: string]: I;
|
||||
}
|
||||
|
||||
export type Term = NamedNode | BlankNode | Literal | Variable | DefaultGraph;
|
||||
export type PrefixedToIri = (suffix: string) => RDF.NamedNode;
|
||||
|
||||
export class Term implements RDF.Term {
|
||||
termType: "NamedNode" | "BlankNode" | "Literal" | "Variable" | "DefaultGraph";
|
||||
id: string;
|
||||
export class NamedNode implements RDF.NamedNode {
|
||||
termType: "NamedNode";
|
||||
value: string;
|
||||
constructor(iri: string);
|
||||
toJSON(): string;
|
||||
id: string;
|
||||
toJSON(): {};
|
||||
equals(other: RDF.Term): boolean;
|
||||
static subclass(type: any): void;
|
||||
}
|
||||
|
||||
export class NamedNode extends Term implements RDF.NamedNode {
|
||||
termType: "NamedNode";
|
||||
value: string;
|
||||
constructor(iri: string);
|
||||
}
|
||||
|
||||
export class BlankNode extends Term implements RDF.BlankNode {
|
||||
export class BlankNode implements RDF.BlankNode {
|
||||
static nextId: number;
|
||||
termType: "BlankNode";
|
||||
value: string;
|
||||
constructor(name: string);
|
||||
id: string;
|
||||
toJSON(): {};
|
||||
equals(other: RDF.Term): boolean;
|
||||
static subclass(type: any): void;
|
||||
}
|
||||
|
||||
export class Variable extends Term implements RDF.Variable {
|
||||
export class Variable implements RDF.Variable {
|
||||
termType: "Variable";
|
||||
value: string;
|
||||
constructor(name: string);
|
||||
id: string;
|
||||
toJSON(): {};
|
||||
equals(other: RDF.Term): boolean;
|
||||
static subclass(type: any): void;
|
||||
}
|
||||
|
||||
export class Literal extends Term implements RDF.Literal {
|
||||
export class Literal implements RDF.Literal {
|
||||
static readonly langStringDatatype: NamedNode;
|
||||
termType: "Literal";
|
||||
value: string;
|
||||
id: string;
|
||||
toJSON(): {};
|
||||
equals(other: RDF.Term): boolean;
|
||||
static subclass(type: any): void;
|
||||
language: string;
|
||||
datatype: RDF.NamedNode;
|
||||
datatype: NamedNode;
|
||||
datatypeString: string;
|
||||
constructor(id: string);
|
||||
}
|
||||
|
||||
export class DefaultGraph extends Term implements RDF.DefaultGraph {
|
||||
export class DefaultGraph implements RDF.DefaultGraph {
|
||||
termType: "DefaultGraph";
|
||||
value: "";
|
||||
constructor();
|
||||
id: string;
|
||||
toJSON(): {};
|
||||
equals(other: RDF.Term): boolean;
|
||||
static subclass(type: any): void;
|
||||
}
|
||||
|
||||
export class Quad implements RDF.Quad {
|
||||
constructor(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term, graph?: RDF.Term);
|
||||
subject: RDF.Term;
|
||||
predicate: RDF.Term;
|
||||
object: RDF.Term;
|
||||
graph: RDF.Term;
|
||||
equals(other: RDF.Quad): boolean;
|
||||
export type Quad_Subject = NamedNode | BlankNode | Variable;
|
||||
export type Quad_Predicate = NamedNode | Variable;
|
||||
export type Quad_Object = NamedNode | Literal | BlankNode | Variable;
|
||||
export type Quad_Graph = DefaultGraph | NamedNode | BlankNode | Variable;
|
||||
|
||||
export class BaseQuad implements RDF.BaseQuad {
|
||||
constructor(subject: Term, predicate: Term, object: Term, graph?: Term);
|
||||
subject: Term;
|
||||
predicate: Term;
|
||||
object: Term;
|
||||
graph: Term;
|
||||
equals(other: RDF.BaseQuad): boolean;
|
||||
toJSON(): string;
|
||||
}
|
||||
|
||||
export class Quad extends BaseQuad implements RDF.Quad {
|
||||
constructor(subject: Term, predicate: Term, object: Term, graph?: Term);
|
||||
subject: Quad_Subject;
|
||||
predicate: Quad_Predicate;
|
||||
object: Quad_Object;
|
||||
graph: Quad_Graph;
|
||||
equals(other: RDF.BaseQuad): boolean;
|
||||
toJSON(): string;
|
||||
}
|
||||
|
||||
export class Triple extends Quad implements RDF.Triple {}
|
||||
|
||||
export namespace DataFactory {
|
||||
function namedNode(value: string): RDF.NamedNode;
|
||||
function blankNode(value?: string): RDF.BlankNode;
|
||||
function literal(value: string | number, languageOrDatatype?: string | RDF.NamedNode): RDF.Literal;
|
||||
function variable(value: string): RDF.Variable;
|
||||
function defaultGraph(): RDF.DefaultGraph;
|
||||
function triple(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term): RDF.Quad;
|
||||
function quad(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term, graph?: RDF.Term): RDF.Quad;
|
||||
function namedNode(value: string): NamedNode;
|
||||
function blankNode(value?: string): BlankNode;
|
||||
function literal(value: string | number, languageOrDatatype?: string | RDF.NamedNode): Literal;
|
||||
function variable(value: string): Variable;
|
||||
function defaultGraph(): DefaultGraph;
|
||||
function quad(subject: RDF.Quad_Subject, predicate: RDF.Quad_Predicate, object: RDF.Quad_Object, graph?: RDF.Quad_Graph): Quad;
|
||||
function quad<Q_In extends RDF.BaseQuad = RDF.Quad, Q_Out extends BaseQuad = Quad>(subject: Q_In['subject'], predicate: Q_In['predicate'], object: Q_In['object'], graph?: Q_In['graph']): Q_Out;
|
||||
function triple(subject: RDF.Quad_Subject, predicate: RDF.Quad_Predicate, object: RDF.Quad_Object): Quad;
|
||||
function triple<Q_In extends RDF.BaseQuad = RDF.Quad, Q_Out extends BaseQuad = Quad>(subject: Q_In['subject'], predicate: Q_In['predicate'], object: Q_In['object']): Q_Out;
|
||||
}
|
||||
|
||||
export type ErrorCallback = (err: Error, result: any) => void;
|
||||
export type QuadCallback = (result: Quad) => void;
|
||||
export type QuadPredicate = (result: Quad) => boolean;
|
||||
export type QuadCallback<Q extends BaseQuad = Quad> = (result: Q) => void;
|
||||
export type QuadPredicate<Q extends BaseQuad = Quad> = (result: Q) => boolean;
|
||||
|
||||
export type OTerm = RDF.Term | string | null;
|
||||
|
||||
export type Logger = (message?: any, ...optionalParams: any[]) => void;
|
||||
|
||||
export interface BlankTriple {
|
||||
predicate: RDF.Term;
|
||||
object: RDF.Term;
|
||||
export interface BlankTriple<Q extends RDF.BaseQuad = RDF.Quad> {
|
||||
predicate: Q['predicate'];
|
||||
object: Q['object'];
|
||||
}
|
||||
|
||||
export interface ParserConstructor {
|
||||
new (options?: ParserOptions): N3Parser;
|
||||
(options?: ParserOptions): N3Parser;
|
||||
new<Q extends BaseQuad = Quad> (options?: ParserOptions): N3Parser<Q>;
|
||||
<Q extends BaseQuad = Quad>(options?: ParserOptions): N3Parser<Q>;
|
||||
}
|
||||
export const Parser: ParserConstructor;
|
||||
|
||||
@@ -111,19 +140,19 @@ export interface ParserOptions {
|
||||
baseIRI?: string;
|
||||
}
|
||||
|
||||
export type ParseCallback = (error: Error, quad: Quad, prefixes: Prefixes) => void;
|
||||
export type ParseCallback<Q extends BaseQuad = Quad> = (error: Error, quad: Q, prefixes: Prefixes) => void;
|
||||
|
||||
export interface N3Parser {
|
||||
parse(input: string, callback: ParseCallback): void;
|
||||
export interface N3Parser<Q extends BaseQuad = Quad> {
|
||||
parse(input: string, callback: ParseCallback<Q>): void;
|
||||
}
|
||||
|
||||
export interface StreamParserConstructor {
|
||||
new (options?: ParserOptions): N3StreamParser;
|
||||
(options?: ParserOptions): N3StreamParser;
|
||||
new<Q extends BaseQuad = Quad> (options?: ParserOptions): N3StreamParser<Q>;
|
||||
<Q extends BaseQuad = Quad>(options?: ParserOptions): N3StreamParser<Q>;
|
||||
}
|
||||
export const StreamParser: StreamParserConstructor;
|
||||
|
||||
export interface N3StreamParser extends RDF.Stream, NodeJS.WritableStream, RDF.Sink {
|
||||
export interface N3StreamParser<Q extends BaseQuad = Quad> extends RDF.Stream<Q>, NodeJS.WritableStream, RDF.Sink<Q> {
|
||||
// Below are the NodeJS.ReadableStream methods,
|
||||
// we can not extend the interface directly,
|
||||
// as `read` clashes with RDF.Sink.
|
||||
@@ -133,10 +162,10 @@ export interface N3StreamParser extends RDF.Stream, NodeJS.WritableStream, RDF.S
|
||||
pause(): this;
|
||||
resume(): this;
|
||||
isPaused(): boolean;
|
||||
pipe<T extends NodeJS.WritableStream | RDF.Stream>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe(destination?: NodeJS.WritableStream | RDF.Stream): void;
|
||||
pipe<T extends NodeJS.WritableStream | RDF.Stream<Q>>(destination: T, options?: { end?: boolean; }): T;
|
||||
unpipe(destination?: NodeJS.WritableStream | RDF.Stream<Q>): void;
|
||||
unshift(chunk: string | Buffer): void;
|
||||
wrap(oldStream: NodeJS.ReadableStream | RDF.Stream): NodeJS.ReadableStream;
|
||||
wrap(oldStream: NodeJS.ReadableStream | RDF.Stream<Q>): NodeJS.ReadableStream;
|
||||
}
|
||||
|
||||
export interface WriterOptions {
|
||||
@@ -146,66 +175,66 @@ export interface WriterOptions {
|
||||
}
|
||||
|
||||
export interface WriterConstructor {
|
||||
new (options?: WriterOptions): N3Writer;
|
||||
new (fd: any, options?: WriterOptions): N3Writer;
|
||||
(options?: WriterOptions): N3Writer;
|
||||
(fd: any, options?: WriterOptions): N3Writer;
|
||||
new<Q extends RDF.BaseQuad = RDF.Quad> (options?: WriterOptions): N3Writer<Q>;
|
||||
new<Q extends RDF.BaseQuad = RDF.Quad> (fd: any, options?: WriterOptions): N3Writer<Q>;
|
||||
<Q extends RDF.BaseQuad = RDF.Quad>(options?: WriterOptions): N3Writer<Q>;
|
||||
<Q extends RDF.BaseQuad = RDF.Quad>(fd: any, options?: WriterOptions): N3Writer<Q>;
|
||||
}
|
||||
export const Writer: WriterConstructor;
|
||||
|
||||
export interface N3Writer {
|
||||
quadToString(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term, graph?: RDF.Term): string;
|
||||
export interface N3Writer<Q extends RDF.BaseQuad = RDF.Quad> {
|
||||
quadToString(subject: Q['subject'], predicate: Q['predicate'], object: Q['object'], graph?: Q['graph']): string;
|
||||
quadsToString(quads: RDF.Quad[]): string;
|
||||
addQuad(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term | RDF.Term[], graph?: RDF.Term, done?: () => void): void;
|
||||
addQuad(subject: Q['subject'], predicate: Q['predicate'], object: Q['object'] | Array<Q['object']>, graph?: Q['graph'], done?: () => void): void;
|
||||
addQuad(quad: RDF.Quad): void;
|
||||
addQuads(quads: RDF.Quad[]): void;
|
||||
addPrefix(prefix: string, iri: RDF.NamedNode | string , done?: () => void): void;
|
||||
addPrefixes(prefixes: Prefixes<RDF.NamedNode | string>, done?: () => void): void;
|
||||
end(err?: ErrorCallback, result?: string): void;
|
||||
blank(predicate: RDF.Term, object: RDF.Term): RDF.Term;
|
||||
blank(triple: BlankTriple | RDF.Quad | BlankTriple[] | RDF.Quad[]): RDF.Term;
|
||||
list(triple: RDF.Term[]): RDF.Term[];
|
||||
blank(predicate: Q['predicate'], object: Q['object']): BlankNode;
|
||||
blank(triple: BlankTriple | RDF.Quad | BlankTriple[] | RDF.Quad[]): BlankNode;
|
||||
list(triple: Array<Q['object']>): Quad_Object[];
|
||||
}
|
||||
|
||||
export interface StreamWriterConstructor {
|
||||
new (options?: WriterOptions): N3StreamWriter;
|
||||
new (fd: any, options?: WriterOptions): N3StreamWriter;
|
||||
(options?: WriterOptions): N3StreamWriter;
|
||||
(fd: any, options?: WriterOptions): N3StreamWriter;
|
||||
new<Q extends RDF.BaseQuad = RDF.Quad> (options?: WriterOptions): N3StreamWriter<Q>;
|
||||
new<Q extends RDF.BaseQuad = RDF.Quad> (fd: any, options?: WriterOptions): N3StreamWriter<Q>;
|
||||
<Q extends RDF.BaseQuad = RDF.Quad>(options?: WriterOptions): N3StreamWriter<Q>;
|
||||
<Q extends RDF.BaseQuad = RDF.Quad>(fd: any, options?: WriterOptions): N3StreamWriter<Q>;
|
||||
}
|
||||
export const StreamWriter: StreamWriterConstructor;
|
||||
|
||||
export interface N3StreamWriter extends NodeJS.ReadWriteStream, RDF.Source {}
|
||||
export interface N3StreamWriter<Q extends RDF.BaseQuad = Quad> extends NodeJS.ReadWriteStream, RDF.Source {}
|
||||
|
||||
export interface N3Store extends RDF.Sink {
|
||||
export interface N3Store<Q_RDF extends RDF.BaseQuad = RDF.Quad, Q_N3 extends BaseQuad = Quad> extends RDF.Sink {
|
||||
readonly size: number;
|
||||
addQuad(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term | RDF.Term[], graph?: RDF.Term, done?: () => void): void;
|
||||
addQuad(quad: RDF.Quad): void;
|
||||
addQuads(quads: RDF.Quad[]): void;
|
||||
removeQuad(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term | RDF.Term[], graph?: RDF.Term, done?: () => void): void;
|
||||
removeQuad(quad: RDF.Quad): void;
|
||||
removeQuads(quads: RDF.Quad[]): void;
|
||||
addQuad(subject: Q_RDF['subject'], predicate: Q_RDF['predicate'], object: Q_RDF['object'] | Array<Q_RDF['object']>, graph?: Q_RDF['graph'], done?: () => void): void;
|
||||
addQuad(quad: Q_RDF): void;
|
||||
addQuads(quads: Q_RDF[]): void;
|
||||
removeQuad(subject: Q_RDF['subject'], predicate: Q_RDF['predicate'], object: Q_RDF['object'] | Array<Q_RDF['object']>, graph?: Q_RDF['graph'], done?: () => void): void;
|
||||
removeQuad(quad: Q_RDF): void;
|
||||
removeQuads(quads: Q_RDF[]): void;
|
||||
getQuads(subject: OTerm, predicate: OTerm, object: OTerm | OTerm[], graph: OTerm): Quad[];
|
||||
countQuads(subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm): number;
|
||||
forEach(callback: QuadCallback, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm): void;
|
||||
every(callback: QuadPredicate, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm): boolean;
|
||||
some(callback: QuadPredicate, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm): boolean;
|
||||
getSubjects(predicate: OTerm, object: OTerm, graph: OTerm): RDF.Term[];
|
||||
forSubjects(callback: QuadCallback, predicate: OTerm, object: OTerm, graph: OTerm): void;
|
||||
getPredicates(subject: OTerm, object: OTerm, graph: OTerm): RDF.Term[];
|
||||
forPredicates(callback: QuadCallback, subject: OTerm, object: OTerm, graph: OTerm): void;
|
||||
getObjects(subject: OTerm, predicate: OTerm, graph: OTerm): RDF.Term[];
|
||||
forObjects(callback: QuadCallback, subject: OTerm, predicate: OTerm, graph: OTerm): void;
|
||||
getGraphs(subject: OTerm, predicate: OTerm, object: OTerm): RDF.Term[];
|
||||
forGraphs(callback: QuadCallback, subject: OTerm, predicate: OTerm, object: OTerm): void;
|
||||
forEach(callback: QuadCallback<Q_N3>, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm): void;
|
||||
every(callback: QuadPredicate<Q_N3>, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm): boolean;
|
||||
some(callback: QuadPredicate<Q_N3>, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm): boolean;
|
||||
getSubjects(predicate: OTerm, object: OTerm, graph: OTerm): Array<Q_N3['subject']>;
|
||||
forSubjects(callback: QuadCallback<Q_N3>, predicate: OTerm, object: OTerm, graph: OTerm): void;
|
||||
getPredicates(subject: OTerm, object: OTerm, graph: OTerm): Array<Q_N3['predicate']>;
|
||||
forPredicates(callback: QuadCallback<Q_N3>, subject: OTerm, object: OTerm, graph: OTerm): void;
|
||||
getObjects(subject: OTerm, predicate: OTerm, graph: OTerm): Array<Q_N3['object']>;
|
||||
forObjects(callback: QuadCallback<Q_N3>, subject: OTerm, predicate: OTerm, graph: OTerm): void;
|
||||
getGraphs(subject: OTerm, predicate: OTerm, object: OTerm): Array<Q_N3['graph']>;
|
||||
forGraphs(callback: QuadCallback<Q_N3>, subject: OTerm, predicate: OTerm, object: OTerm): void;
|
||||
createBlankNode(suggestedName?: string): BlankNode;
|
||||
|
||||
// match, removeMatches and deleteGraph are missing for full RDF.Store adherence
|
||||
remove(stream: stream.Stream): EventEmitter;
|
||||
}
|
||||
export interface StoreConstructor {
|
||||
new (triples?: RDF.Quad[], options?: StoreOptions): N3Store;
|
||||
(triples?: RDF.Quad[], options?: StoreOptions): N3Store;
|
||||
new<Q_RDF extends RDF.BaseQuad = RDF.Quad, Q_N3 extends BaseQuad = Quad> (triples?: Q_RDF[], options?: StoreOptions): N3Store<Q_RDF, Q_N3>;
|
||||
<Q_RDF extends RDF.BaseQuad = RDF.Quad, Q_N3 extends BaseQuad = Quad>(triples?: Q_RDF[], options?: StoreOptions): N3Store<Q_RDF, Q_N3>;
|
||||
}
|
||||
export const Store: StoreConstructor;
|
||||
|
||||
|
||||
+26
-1
@@ -77,7 +77,13 @@ function test_doc_rdf_to_triples_2() {
|
||||
}
|
||||
|
||||
function test_doc_rdf_stream_to_triples_1() {
|
||||
const parser: N3.N3Parser = new N3.Parser();
|
||||
interface QuadBnode extends N3.BaseQuad {
|
||||
subject: N3.BlankNode;
|
||||
predicate: N3.BlankNode;
|
||||
object: N3.BlankNode;
|
||||
graph: N3.BlankNode;
|
||||
}
|
||||
const parser: N3.N3Parser<QuadBnode> = new N3.Parser<QuadBnode>({factory: N3.DataFactory});
|
||||
parser.parse('abc', console.log);
|
||||
|
||||
const streamParser: N3.N3StreamParser = N3.StreamParser();
|
||||
@@ -178,7 +184,26 @@ function test_doc_storing() {
|
||||
const bnode2: RDF.BlankNode = store.createBlankNode('abc');
|
||||
|
||||
const mickey: RDF.Quad = store.getQuads(N3.DataFactory.namedNode('http://ex.org/Mickey'), null, null, null)[0];
|
||||
if (mickey.object.termType === "Literal") {
|
||||
console.log(mickey.object.datatype);
|
||||
}
|
||||
console.log(mickey.subject, mickey.predicate, mickey.object, '.');
|
||||
|
||||
interface N3QuadGeneralized extends N3.BaseQuad {
|
||||
subject: N3.Quad_Subject | N3.BlankNode | N3.Literal;
|
||||
predicate: N3.Quad_Predicate | N3.BlankNode | N3.Literal;
|
||||
object: N3.Quad_Object | N3.BlankNode | N3.Literal;
|
||||
graph: N3.Quad_Graph | N3.BlankNode | N3.Literal;
|
||||
}
|
||||
interface RDFQuadGeneralized extends RDF.BaseQuad {
|
||||
subject: RDF.Quad_Subject | RDF.BlankNode | RDF.Literal;
|
||||
predicate: RDF.Quad_Predicate | RDF.BlankNode | RDF.Literal;
|
||||
object: RDF.Quad_Object | RDF.BlankNode | RDF.Literal;
|
||||
graph: RDF.Quad_Graph | RDF.BlankNode | RDF.Literal;
|
||||
}
|
||||
const storeGeneralized = new N3.Store<RDFQuadGeneralized, N3QuadGeneralized>();
|
||||
// storeGeneralized.
|
||||
storeGeneralized.addQuad(N3.DataFactory.namedNode('http://ex.org/Pluto'), N3.DataFactory.blankNode(), N3.DataFactory.namedNode('http://ex.org/Dog'));
|
||||
}
|
||||
|
||||
function test_doc_utility() {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -30,6 +30,7 @@
|
||||
// Wilco Bakker <https://github.com/WilcoBakker>
|
||||
// wwwy3y3 <https://github.com/wwwy3y3>
|
||||
// Zane Hannan AU <https://github.com/ZaneHannanAU>
|
||||
// Jeremie Rodriguez <https://github.com/jeremiergz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/** inspector module types */
|
||||
@@ -6394,7 +6395,7 @@ declare module "crypto" {
|
||||
|
||||
interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
|
||||
format: T;
|
||||
ciper: string;
|
||||
cipher: string;
|
||||
passphrase: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -1513,7 +1513,7 @@ async function asyncStreamPipelineFinished() {
|
||||
type: 'pkcs1',
|
||||
},
|
||||
privateKeyEncoding: {
|
||||
ciper: 'some-cipher',
|
||||
cipher: 'some-cipher',
|
||||
format: 'pem',
|
||||
passphrase: 'secret',
|
||||
type: 'pkcs8',
|
||||
@@ -1531,7 +1531,7 @@ async function asyncStreamPipelineFinished() {
|
||||
type: 'spki',
|
||||
},
|
||||
privateKeyEncoding: {
|
||||
ciper: 'some-cipher',
|
||||
cipher: 'some-cipher',
|
||||
format: 'der',
|
||||
passphrase: 'secret',
|
||||
type: 'pkcs8',
|
||||
@@ -1548,7 +1548,7 @@ async function asyncStreamPipelineFinished() {
|
||||
type: 'pkcs1',
|
||||
},
|
||||
privateKeyEncoding: {
|
||||
ciper: 'some-cipher',
|
||||
cipher: 'some-cipher',
|
||||
format: 'pem',
|
||||
passphrase: 'secret',
|
||||
type: 'pkcs8',
|
||||
|
||||
Vendored
+3
-3
@@ -1070,9 +1070,9 @@ declare namespace Office {
|
||||
displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult<Dialog>) => void): void;
|
||||
/**
|
||||
* Delivers a message from the dialog box to its parent/opener page. The page calling this API must be on the same domain as the parent.
|
||||
* @param messageObject Accepts a message from the dialog to deliver to the add-in.
|
||||
* @param message Accepts a message from the dialog to deliver to the add-in. In addition to a boolean, anything that can serialized to a string including JSON and XML can be sent.
|
||||
*/
|
||||
messageParent(messageObject: any): void;
|
||||
messageParent(message: boolean | string): void;
|
||||
/**
|
||||
* Closes the UI container where the JavaScript is executing.
|
||||
*
|
||||
@@ -7351,7 +7351,7 @@ declare namespace Office {
|
||||
declare namespace Office {
|
||||
namespace MailboxEnums {
|
||||
/**
|
||||
* Specifies which string formatting to apply to an attachment's content.
|
||||
* Specifies the formatting that applies to an attachment's content.
|
||||
*
|
||||
* [Api set: Mailbox Preview]
|
||||
*
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@ declare class Pbf {
|
||||
type: number;
|
||||
length: number;
|
||||
|
||||
constructor(buffer?: Uint8Array);
|
||||
constructor(buffer?: Uint8Array|ArrayBuffer);
|
||||
|
||||
destroy(): void;
|
||||
readFields<T>(readField: (tag: number, result?: T, pbf?: Pbf) => void, result?: T, end?: number): T;
|
||||
|
||||
@@ -2,6 +2,7 @@ import Pbf = require('pbf');
|
||||
|
||||
const pbf = new Pbf(new Uint8Array(1));
|
||||
new Pbf();
|
||||
new Pbf(new ArrayBuffer(8));
|
||||
pbf.buf;
|
||||
pbf.pos;
|
||||
pbf.type;
|
||||
|
||||
Vendored
+17
-26
@@ -1,9 +1,10 @@
|
||||
// Type definitions for pino 5.6
|
||||
// Type definitions for pino 5.8
|
||||
// Project: https://github.com/pinojs/pino.git
|
||||
// Definitions by: Peter Snider <https://github.com/psnider>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Christian Rackerseder <https://github.com/screendriver>
|
||||
// GP <https://github.com/paambaati>
|
||||
// Alex Ferrando <https://github.com/alferpal>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -12,6 +13,7 @@
|
||||
import * as stream from 'stream';
|
||||
import * as http from 'http';
|
||||
import { EventEmitter } from 'events';
|
||||
import SonicBoom = require('sonic-boom');
|
||||
|
||||
export = P;
|
||||
|
||||
@@ -20,7 +22,7 @@ export = P;
|
||||
* relative protocol is enabled. Default: process.stdout
|
||||
* @returns a new logger instance.
|
||||
*/
|
||||
declare function P(optionsOrStream?: P.LoggerOptions | stream.Writable | stream.Duplex | stream.Transform | NodeJS.WritableStream): P.Logger;
|
||||
declare function P(optionsOrStream?: P.LoggerOptions | stream.Writable | stream.Duplex | stream.Transform | NodeJS.WritableStream | SonicBoom): P.Logger;
|
||||
|
||||
/**
|
||||
* @param [options]: an options object
|
||||
@@ -28,7 +30,7 @@ declare function P(optionsOrStream?: P.LoggerOptions | stream.Writable | stream.
|
||||
* relative protocol is enabled. Default: process.stdout
|
||||
* @returns a new logger instance.
|
||||
*/
|
||||
declare function P(options: P.LoggerOptions, stream: stream.Writable | stream.Duplex | stream.Transform | NodeJS.WritableStream): P.Logger;
|
||||
declare function P(options: P.LoggerOptions, stream: stream.Writable | stream.Duplex | stream.Transform | NodeJS.WritableStream | SonicBoom): P.Logger;
|
||||
|
||||
declare namespace P {
|
||||
/**
|
||||
@@ -75,11 +77,6 @@ declare namespace P {
|
||||
* The default time function for Pino. Returns a string like `,"time":1493426328206`.
|
||||
*/
|
||||
epochTime: TimeFn;
|
||||
/**
|
||||
* Returns an ISO formatted string like `,"time":"2017-04-29T004749.354Z"`. It is highly recommended that you avoid this function.
|
||||
* It incurs a significant performance penalty.
|
||||
*/
|
||||
slowTime: TimeFn;
|
||||
/**
|
||||
* Returns an empty string. This function is used when the `timestamp` option is set to `false`.
|
||||
*/
|
||||
@@ -87,12 +84,19 @@ declare namespace P {
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides access to the CLI log prettifier as an API.
|
||||
* This can also be enabled via the constructor by setting the `prettyPrint` option to either `true` or a configuration object described in this section.
|
||||
* @param [options]: an options object
|
||||
* @returns A transform stream to be used as input for the constructor.
|
||||
* Create a Pino Destination instance: a stream-like object with significantly more throughput (over 30%) than a standard Node.js stream.
|
||||
* @param [fileDescriptor]: File path or numerical file descriptor, by default 1
|
||||
* @returns A Sonic-Boom stream to be used as destination for the pino function
|
||||
*/
|
||||
function pretty(options?: PrettyOptions): stream.Transform;
|
||||
function destination(fileDescriptor?: string | number): SonicBoom;
|
||||
|
||||
/**
|
||||
* Create an extreme mode destination. This yields an additional 60% performance boost.
|
||||
* There are trade-offs that should be understood before usage.
|
||||
* @param [fileDescriptor]: File path or numerical file descriptor, by default 1
|
||||
* @returns A Sonic-Boom stream to be used as destination for the pino function
|
||||
*/
|
||||
function extreme(fileDescriptor?: string | number): SonicBoom;
|
||||
|
||||
interface LevelMapping {
|
||||
/**
|
||||
@@ -128,19 +132,6 @@ declare namespace P {
|
||||
* Caution: any sort of formatted time will significantly slow down Pino's performance.
|
||||
*/
|
||||
timestamp?: TimeFn | false;
|
||||
/**
|
||||
* @deprecated
|
||||
* This option is scheduled to be removed in Pino 5.0.0. Use `timestamp: pino.stdTimeFunctions.slowTime` instead.
|
||||
* Outputs ISO time stamps ('2016-03-09T15:18:53.889Z') instead of Epoch time stamps (1457536759176).
|
||||
* WARNING: This option carries a 25% performance drop, we recommend using default Epoch timestamps and transforming logs after if required.
|
||||
* The pino -t command will do this for you (see CLI). Default: `false`.
|
||||
*/
|
||||
slowtime?: boolean;
|
||||
/**
|
||||
* Enables extreme mode, yields an additional 60% performance (from 250ms down to 100ms per 10000 ops).
|
||||
* There are trade-off's should be understood before usage. See Extreme mode explained. Default: `false`.
|
||||
*/
|
||||
extreme?: boolean;
|
||||
/**
|
||||
* One of the supported levels or `silent` to disable logging. Any other value defines a custom level and
|
||||
* requires supplying a level value via `levelVal`. Default: 'info'.
|
||||
|
||||
@@ -22,15 +22,6 @@ const log2: pino.Logger = pino({
|
||||
}
|
||||
});
|
||||
|
||||
const pretty = pino.pretty();
|
||||
pretty.pipe(process.stdout);
|
||||
const log3 = pino({
|
||||
name: 'app',
|
||||
safe: true
|
||||
}, pretty);
|
||||
log3.child({widget: 'foo'}).info('hello');
|
||||
log3.child({widget: 'bar'}).warn('hello 2');
|
||||
|
||||
pino({
|
||||
browser: {
|
||||
write(o) {
|
||||
|
||||
Vendored
+2
-2
@@ -20,9 +20,9 @@ export type PlistValue =
|
||||
string | number | boolean |
|
||||
Date | Buffer | PlistObject | PlistArray;
|
||||
export interface PlistObject {
|
||||
[x: string]: PlistValue;
|
||||
readonly [x: string]: PlistValue;
|
||||
}
|
||||
export interface PlistArray extends Array<PlistValue> { }
|
||||
export interface PlistArray extends ReadonlyArray<PlistValue> { }
|
||||
|
||||
// PlistBuildOptions
|
||||
// The instance of this type is passed to 'xmlbuilder' module as it is.
|
||||
|
||||
@@ -79,3 +79,10 @@ console.log(plistString1);
|
||||
|
||||
const plistString2 = plist.build(plistValue2, {pretty: false});
|
||||
console.log(plistString2);
|
||||
|
||||
function f(a: ReadonlyArray<string>) {
|
||||
plist.build(a);
|
||||
}
|
||||
|
||||
// $ExpectError
|
||||
plist.build(() => 0);
|
||||
|
||||
Vendored
+76
@@ -0,0 +1,76 @@
|
||||
// Type definitions for prompts 1.1
|
||||
// Project: https://github.com/terkelg/prompts
|
||||
// Definitions by: Berkay GURSOY <https://github.com/Berkays>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export = prompts;
|
||||
|
||||
declare function prompts(questions: prompts.PromptObject | prompts.PromptObject[], options?: prompts.Options): any;
|
||||
|
||||
declare namespace prompts {
|
||||
// Circular reference from prompts
|
||||
const prompt: any;
|
||||
|
||||
function inject(obj: any): void;
|
||||
|
||||
namespace inject {
|
||||
const prototype: {
|
||||
};
|
||||
}
|
||||
|
||||
namespace prompts {
|
||||
function autocomplete(args: PromptObject): any;
|
||||
|
||||
function confirm(args: PromptObject): void;
|
||||
|
||||
function invisible(args: PromptObject): any;
|
||||
|
||||
function list(args: PromptObject): any;
|
||||
|
||||
function multiselect(args: PromptObject): any;
|
||||
|
||||
function number(args: PromptObject): void;
|
||||
|
||||
function password(args: PromptObject): any;
|
||||
|
||||
function select(args: PromptObject): void;
|
||||
|
||||
function text(args: PromptObject): void;
|
||||
|
||||
function toggle(args: PromptObject): void;
|
||||
}
|
||||
|
||||
interface Choice {
|
||||
title: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
onSubmit: (prompt: PromptObject, answer: any, answers: any[]) => void;
|
||||
onCancel: (prompt: PromptObject, answers: any) => void;
|
||||
}
|
||||
|
||||
interface PromptObject {
|
||||
type: string | ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
name: string | ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
message?: string | ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
initial?: string;
|
||||
style?: string;
|
||||
format?: ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
validate?: ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
onState?: ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
min?: number;
|
||||
max?: number;
|
||||
float?: boolean;
|
||||
round?: number;
|
||||
increment?: number;
|
||||
seperator?: string;
|
||||
active?: string;
|
||||
inactive?: string;
|
||||
choices?: Choice[];
|
||||
hint?: string;
|
||||
suggest?: ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
limit?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import prompts = require("prompts");
|
||||
|
||||
const response = prompts({
|
||||
type: 'number',
|
||||
name: 'value',
|
||||
message: 'Input value to double:',
|
||||
validate: (value: any) => value < 0 ? `Cant be less than zero` : true
|
||||
});
|
||||
@@ -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",
|
||||
"prompts-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Type definitions for puppeteer-core 1.9
|
||||
// Project: https://github.com/GoogleChrome/puppeteer#readme
|
||||
// Definitions by: Fumiaki Matsushima <https://github.com/mtsmfm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
export * from "puppeteer";
|
||||
@@ -0,0 +1,12 @@
|
||||
import * as puppeteer from "puppeteer-core";
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.connect();
|
||||
const page = await browser.newPage();
|
||||
await page.goto("https://example.com", {
|
||||
referer: 'http://google.com',
|
||||
});
|
||||
await page.screenshot({ path: "example.png" });
|
||||
|
||||
browser.close();
|
||||
})();
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom", "es2017"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "puppeteer-core-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/rdf-ext/rdf-data-model
|
||||
// Definitions by: Ruben Taelman <https://github.com/rubensworks>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as RDF from "rdf-js";
|
||||
|
||||
|
||||
Vendored
+105
-61
@@ -1,7 +1,9 @@
|
||||
// Type definitions for the RDFJS specification 1.0
|
||||
// Type definitions for the RDFJS specification 2.0
|
||||
// Project: https://github.com/rdfjs/representation-task-force
|
||||
// Definitions by: Ruben Taelman <https://github.com/rubensworks>
|
||||
// Laurens Rietveld <https://github.com/LaurensRietveld>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
@@ -12,32 +14,19 @@ import { EventEmitter } from "events";
|
||||
/* https://github.com/rdfjs/representation-task-force/blob/master/interface-spec.md#data-interfaces */
|
||||
|
||||
/**
|
||||
* Abstract interface for RDF terms (subject, predicate, object or graph).
|
||||
* Contains an Iri, RDF blank Node, RDF literal, variable name, or a default graph
|
||||
* @see NamedNode
|
||||
* @see BlankNode
|
||||
* @see Literal
|
||||
* @see Variable
|
||||
* @see DefaultGraph
|
||||
*/
|
||||
export interface Term {
|
||||
/**
|
||||
* Contains a value that identifies the concrete interface of the term,
|
||||
* since Term itself is not directly instantiated.
|
||||
*
|
||||
* Possible values include "NamedNode", "BlankNode", "Literal", "Variable" and "DefaultGraph".
|
||||
*/
|
||||
termType: "NamedNode" | "BlankNode" | "Literal" | "Variable" | "DefaultGraph";
|
||||
/**
|
||||
* Refined by each interface which extends Term
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/**
|
||||
* @param other The term to compare with.
|
||||
* @return If the termType is equal and the contents are equal (as defined by concrete subclasses).
|
||||
*/
|
||||
equals(other: Term): boolean;
|
||||
}
|
||||
export type Term = NamedNode | BlankNode | Literal | Variable | DefaultGraph;
|
||||
|
||||
/**
|
||||
* Contains an IRI.
|
||||
*/
|
||||
export interface NamedNode extends Term {
|
||||
export interface NamedNode {
|
||||
/**
|
||||
* Contains the constant "NamedNode".
|
||||
*/
|
||||
@@ -57,7 +46,7 @@ export interface NamedNode extends Term {
|
||||
/**
|
||||
* Contains an RDF blank node.
|
||||
*/
|
||||
export interface BlankNode extends Term {
|
||||
export interface BlankNode {
|
||||
/**
|
||||
* Contains the constant "BlankNode".
|
||||
*/
|
||||
@@ -80,7 +69,7 @@ export interface BlankNode extends Term {
|
||||
/**
|
||||
* An RDF literal, containing a string with an optional language tag and/or datatype.
|
||||
*/
|
||||
export interface Literal extends Term {
|
||||
export interface Literal {
|
||||
/**
|
||||
* Contains the constant "Literal".
|
||||
*/
|
||||
@@ -111,7 +100,7 @@ export interface Literal extends Term {
|
||||
/**
|
||||
* A variable name.
|
||||
*/
|
||||
export interface Variable extends Term {
|
||||
export interface Variable {
|
||||
/**
|
||||
* Contains the constant "Variable".
|
||||
*/
|
||||
@@ -132,7 +121,7 @@ export interface Variable extends Term {
|
||||
* An instance of DefaultGraph represents the default graph.
|
||||
* It's only allowed to assign a DefaultGraph to the .graph property of a Quad.
|
||||
*/
|
||||
export interface DefaultGraph extends Term {
|
||||
export interface DefaultGraph {
|
||||
/**
|
||||
* Contains the constant "DefaultGraph".
|
||||
*/
|
||||
@@ -149,45 +138,101 @@ export interface DefaultGraph extends Term {
|
||||
equals(other: Term): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The subject, which is a NamedNode, BlankNode or Variable.
|
||||
* @see NamedNode
|
||||
* @see BlankNode
|
||||
* @see Variable
|
||||
*/
|
||||
export type Quad_Subject = NamedNode | BlankNode | Variable;
|
||||
|
||||
/**
|
||||
* The predicate, which is a NamedNode or Variable.
|
||||
* @see NamedNode
|
||||
* @see Variable
|
||||
*/
|
||||
export type Quad_Predicate = NamedNode | Variable;
|
||||
|
||||
/**
|
||||
* The object, which is a NamedNode, Literal, BlankNode or Variable.
|
||||
* @see NamedNode
|
||||
* @see Literal
|
||||
* @see BlankNode
|
||||
* @see Variable
|
||||
*/
|
||||
export type Quad_Object = NamedNode | Literal | BlankNode | Variable;
|
||||
|
||||
/**
|
||||
* The named graph, which is a DefaultGraph, NamedNode, BlankNode or Variable.
|
||||
* @see DefaultGraph
|
||||
* @see NamedNode
|
||||
* @see BlankNode
|
||||
* @see Variable
|
||||
*/
|
||||
export type Quad_Graph = DefaultGraph | NamedNode | BlankNode | Variable;
|
||||
|
||||
/**
|
||||
* An RDF quad, taking any Term in its positions, containing the subject, predicate, object and graph terms.
|
||||
*/
|
||||
export interface BaseQuad {
|
||||
/**
|
||||
* The subject.
|
||||
* @see Quad_Subject
|
||||
*/
|
||||
subject: Term;
|
||||
/**
|
||||
* The predicate.
|
||||
* @see Quad_Predicate
|
||||
*/
|
||||
predicate: Term;
|
||||
/**
|
||||
* The object.
|
||||
* @see Quad_Object
|
||||
*/
|
||||
object: Term;
|
||||
/**
|
||||
* The named graph.
|
||||
* @see Quad_Graph
|
||||
*/
|
||||
graph: Term;
|
||||
|
||||
/**
|
||||
* @param other The term to compare with.
|
||||
* @return True if and only if the argument is a) of the same type b) has all components equal.
|
||||
*/
|
||||
equals(other: BaseQuad): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* An RDF quad, containing the subject, predicate, object and graph terms.
|
||||
*/
|
||||
export interface Quad {
|
||||
export interface Quad extends BaseQuad {
|
||||
/**
|
||||
* The subject, which is a NamedNode, BlankNode or Variable.
|
||||
* @see NamedNode
|
||||
* @see BlankNode
|
||||
* @see Variable
|
||||
* The subject.
|
||||
* @see Quad_Subject
|
||||
*/
|
||||
subject: Term;
|
||||
subject: Quad_Subject;
|
||||
/**
|
||||
* The predicate, which is a NamedNode or Variable.
|
||||
* @see NamedNode
|
||||
* @see Variable
|
||||
* The predicate.
|
||||
* @see Quad_Predicate
|
||||
*/
|
||||
predicate: Term;
|
||||
predicate: Quad_Predicate;
|
||||
/**
|
||||
* The object, which is a NamedNode, Literal, BlankNode or Variable.
|
||||
* @see NamedNode
|
||||
* @see Literal
|
||||
* @see BlankNode
|
||||
* @see Variable
|
||||
* The object.
|
||||
* @see Quad_Object
|
||||
*/
|
||||
object: Term;
|
||||
object: Quad_Object;
|
||||
/**
|
||||
* The named graph, which is a DefaultGraph, NamedNode, BlankNode or Variable.
|
||||
* @see DefaultGraph
|
||||
* @see NamedNode
|
||||
* @see BlankNode
|
||||
* @see Variable
|
||||
* The named graph.
|
||||
* @see Quad_Graph
|
||||
*/
|
||||
graph: Term;
|
||||
graph: Quad_Graph;
|
||||
|
||||
/**
|
||||
* @param other The term to compare with.
|
||||
* @return True if and only if the argument is a) of the same type b) has all components equal.
|
||||
*/
|
||||
equals(other: Quad): boolean;
|
||||
equals(other: BaseQuad): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,7 +297,7 @@ export interface DataFactory {
|
||||
* @see Triple
|
||||
* @see DefaultGraph
|
||||
*/
|
||||
triple(subject: Term, predicate: Term, object: Term): Quad;
|
||||
triple<Q_In extends BaseQuad = Quad, Q_Out extends BaseQuad = Quad>(subject: Q_In['subject'], predicate: Q_In['predicate'], object: Q_In['object']): Q_Out;
|
||||
|
||||
/**
|
||||
* @param subject The quad subject term.
|
||||
@@ -262,7 +307,7 @@ export interface DataFactory {
|
||||
* @return A new instance of Quad.
|
||||
* @see Quad
|
||||
*/
|
||||
quad(subject: Term, predicate: Term, object: Term, graph?: Term): Quad;
|
||||
quad<Q_In extends BaseQuad = Quad, Q_Out extends BaseQuad = Quad>(subject: Q_In['subject'], predicate: Q_In['predicate'], object: Q_In['object'], graph?: Q_In['graph']): Q_Out;
|
||||
}
|
||||
|
||||
/* Stream Interfaces */
|
||||
@@ -281,14 +326,14 @@ export interface DataFactory {
|
||||
* Optional events:
|
||||
* * prefix(prefix: string, iri: RDF.NamedNode): This event is emitted every time a prefix is mapped to some IRI.
|
||||
*/
|
||||
export interface Stream extends EventEmitter {
|
||||
export interface Stream<Q extends BaseQuad = Quad> extends EventEmitter {
|
||||
/**
|
||||
* This method pulls a quad out of the internal buffer and returns it.
|
||||
* If there is no quad available, then it will return null.
|
||||
*
|
||||
* @return A quad from the internal buffer, or null if none is available.
|
||||
*/
|
||||
read(): Quad;
|
||||
read(): Q;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,7 +343,7 @@ export interface Stream extends EventEmitter {
|
||||
*
|
||||
* For example, parsers and transformations which generate quads can implement the Source interface.
|
||||
*/
|
||||
export interface Source {
|
||||
export interface Source<Q extends BaseQuad = Quad> {
|
||||
/**
|
||||
* Returns a stream that processes all quads matching the pattern.
|
||||
*
|
||||
@@ -308,8 +353,7 @@ export interface Source {
|
||||
* @param graph The optional exact graph or graph regex to match.
|
||||
* @return The resulting quad stream.
|
||||
*/
|
||||
match(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp)
|
||||
: Stream;
|
||||
match(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp): Stream<Q>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,7 +363,7 @@ export interface Source {
|
||||
*
|
||||
* For example parsers, serializers, transformations and stores can implement the Sink interface.
|
||||
*/
|
||||
export interface Sink {
|
||||
export interface Sink<Q extends BaseQuad = Quad> {
|
||||
/**
|
||||
* Consumes the given stream.
|
||||
*
|
||||
@@ -330,7 +374,7 @@ export interface Sink {
|
||||
* @param stream The stream that will be consumed.
|
||||
* @return The resulting event emitter.
|
||||
*/
|
||||
import(stream: Stream): EventEmitter;
|
||||
import(stream: Stream<Q>): EventEmitter;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,7 +385,7 @@ export interface Sink {
|
||||
*
|
||||
* Access to stores LDP or SPARQL endpoints can be implemented with a Store inteface.
|
||||
*/
|
||||
export interface Store extends Source, Sink {
|
||||
export interface Store<Q extends BaseQuad = Quad> extends Source, Sink {
|
||||
/**
|
||||
* Removes all streamed quads.
|
||||
*
|
||||
@@ -351,7 +395,7 @@ export interface Store extends Source, Sink {
|
||||
* @param stream The stream that will be consumed.
|
||||
* @return The resulting event emitter.
|
||||
*/
|
||||
remove(stream: Stream): EventEmitter;
|
||||
remove(stream: Stream<Q>): EventEmitter;
|
||||
|
||||
/**
|
||||
* All quads matching the pattern will be removed.
|
||||
@@ -377,5 +421,5 @@ export interface Store extends Source, Sink {
|
||||
* @param graph The graph term or string to match.
|
||||
* @return The resulting event emitter.
|
||||
*/
|
||||
deleteGraph(graph: Term | string): EventEmitter;
|
||||
deleteGraph(graph: Q['graph'] | string): EventEmitter;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BlankNode, DataFactory, DefaultGraph, Literal, NamedNode, Quad, Sink, Source, Store, Stream, Triple, Term,
|
||||
Variable } from "rdf-js";
|
||||
import { BlankNode, DataFactory, DefaultGraph, Literal, NamedNode, Quad, BaseQuad, Sink, Source, Store, Stream, Triple, Term,
|
||||
Variable, Quad_Graph } from "rdf-js";
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
function test_terms() {
|
||||
@@ -7,6 +7,9 @@ function test_terms() {
|
||||
// so this does not have to be functional.
|
||||
const someTerm: Term = <any> {};
|
||||
|
||||
if (someTerm.termType === 'Literal') {
|
||||
console.log(someTerm.datatype);
|
||||
}
|
||||
const namedNode: NamedNode = <any> {};
|
||||
const termType1: string = namedNode.termType;
|
||||
const value1: string = namedNode.value;
|
||||
@@ -66,9 +69,16 @@ function test_datafactory() {
|
||||
|
||||
const variable: Variable = dataFactory.variable ? dataFactory.variable('v1') : <any> {};
|
||||
|
||||
const term: Term = <any> {};
|
||||
const term: NamedNode = <any> {};
|
||||
const triple: Quad = dataFactory.triple(term, term, term);
|
||||
const quad: Quad = dataFactory.quad(term, term, term, term);
|
||||
interface QuadBnode extends BaseQuad {
|
||||
subject: Term;
|
||||
predicate: Term;
|
||||
object: Term;
|
||||
graph: Term;
|
||||
}
|
||||
const quad = dataFactory.quad<QuadBnode, QuadBnode>(literal1, blankNode1, term, term);
|
||||
const hasBnode = quad.predicate.termType === "BlankNode";
|
||||
}
|
||||
|
||||
function test_stream() {
|
||||
@@ -88,6 +98,7 @@ function test_stream() {
|
||||
const matchStream9: Stream = source.match(term, term, term, /.*/);
|
||||
|
||||
const sink: Sink = <any> {};
|
||||
const graph: Quad_Graph = <any> {};
|
||||
const eventEmitter1: EventEmitter = sink.import(stream);
|
||||
|
||||
const store: Store = <any> {};
|
||||
@@ -103,6 +114,6 @@ function test_stream() {
|
||||
const eventEmitter9: EventEmitter = store.removeMatches(term, term, /.*/);
|
||||
const eventEmitter10: EventEmitter = store.removeMatches(term, term, term, term);
|
||||
const eventEmitter11: EventEmitter = store.removeMatches(term, term, term, /.*/);
|
||||
const eventEmitter12: EventEmitter = store.deleteGraph(term);
|
||||
const eventEmitter12: EventEmitter = store.deleteGraph(graph);
|
||||
const eventEmitter13: EventEmitter = store.deleteGraph('http://example.org');
|
||||
}
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+12
-4
@@ -8,16 +8,22 @@ import * as React from "react";
|
||||
import { Location as HLocation } from "history";
|
||||
export type WindowLocation = Window["location"] & HLocation;
|
||||
|
||||
export type HistoryActionType = "PUSH" | "POP";
|
||||
export type HistoryLocation = WindowLocation & { state?: any };
|
||||
export interface HistoryListenerParameter {
|
||||
location: HistoryLocation;
|
||||
action: HistoryActionType;
|
||||
}
|
||||
export type HistoryListener = (parameter: HistoryListenerParameter) => void;
|
||||
export type HistoryUnsubscribe = () => void;
|
||||
|
||||
export interface History {
|
||||
readonly location: string;
|
||||
readonly location: HistoryLocation;
|
||||
readonly transitioning: boolean;
|
||||
listen: (listener: HistoryListener) => HistoryUnsubscribe;
|
||||
navigate: NavigateFn;
|
||||
}
|
||||
|
||||
export type HistoryListener = () => void;
|
||||
export type HistoryUnsubscribe = () => void;
|
||||
|
||||
export class Router extends React.Component<RouterProps> { }
|
||||
|
||||
export interface RouterProps {
|
||||
@@ -147,3 +153,5 @@ export interface RedirectRequest {
|
||||
export function isRedirect(error: any): error is RedirectRequest;
|
||||
|
||||
export function redirectTo(uri: string): void;
|
||||
|
||||
export const globalHistory: History;
|
||||
|
||||
Vendored
+157
@@ -0,0 +1,157 @@
|
||||
// Type definitions for react-images 0.5
|
||||
// Project: http://jossmac.github.io/react-images
|
||||
// Definitions by: Konstantin Lukaschenko <https://github.com/KonstantinLukaschenko>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
declare class Lightbox extends React.Component<LightboxProps> {
|
||||
constructor(props: LightboxProps);
|
||||
}
|
||||
|
||||
export interface LightboxProps {
|
||||
/**
|
||||
* Array of image objects. Required.
|
||||
*/
|
||||
images: Image[];
|
||||
|
||||
/**
|
||||
* Allow users to exit the lightbox by clicking the backdrop. Default value: false.
|
||||
*/
|
||||
backdropClosesModal?: boolean;
|
||||
|
||||
/**
|
||||
* Supports keyboard input - esc, arrow left, and arrow right. Default value: true
|
||||
*/
|
||||
enableKeyboardInput?: boolean;
|
||||
|
||||
/**
|
||||
* The index of the image to display initially. Default value: 0
|
||||
*/
|
||||
currentImage?: number;
|
||||
|
||||
/**
|
||||
* An array of elements to display as custom controls on the top of lightbox. Default value: undefined
|
||||
*/
|
||||
customControls?: Array<React.ReactHTMLElement<any>>;
|
||||
|
||||
/**
|
||||
* Whether or not the lightbox is displayed. Default value: false;
|
||||
*/
|
||||
isOpen?: boolean;
|
||||
|
||||
/**
|
||||
* Based on the direction the user is navigating, preload the next available image. Default value: true
|
||||
*/
|
||||
preloadNextImage?: boolean;
|
||||
|
||||
/**
|
||||
* Optionally display a close "X" button in top right corner. Default value: true
|
||||
*/
|
||||
showCloseButton?: boolean;
|
||||
|
||||
/**
|
||||
* Optionally display image index, e.g., "3 of 20". Default value: true
|
||||
*/
|
||||
showImageCount?: boolean;
|
||||
|
||||
/**
|
||||
* Maximum width of the carousel; defaults to 1024px
|
||||
*/
|
||||
width?: number;
|
||||
|
||||
/**
|
||||
* Spinner component.
|
||||
*/
|
||||
spinner?: () => React.ReactElement<any>;
|
||||
|
||||
/**
|
||||
* Color of spinner. Default value: 'white'
|
||||
*/
|
||||
spinnerColor?: string;
|
||||
|
||||
/**
|
||||
* Size of spinner. Default value: 100
|
||||
*/
|
||||
spinnerSize?: number;
|
||||
|
||||
/**
|
||||
* Determines whether scrolling is prevented via react-scrolllock. Default value: true
|
||||
*/
|
||||
preventScroll?: boolean;
|
||||
|
||||
/**
|
||||
* Optionally display thumbnails beneath the Lightbox
|
||||
*/
|
||||
showThumbnails?: boolean;
|
||||
|
||||
/**
|
||||
* The image count separator. Default value: ' of '
|
||||
*/
|
||||
imageCountSeparator?: string;
|
||||
|
||||
/**
|
||||
* Customize right arrow title. Default value: ' Next (Right arrow key) '
|
||||
*/
|
||||
rightArrowTitle?: string;
|
||||
|
||||
/**
|
||||
* Custom of left arrow title. Default value: ' Previous (Left arrow key) '
|
||||
*/
|
||||
leftArrowTitle?: string;
|
||||
|
||||
/**
|
||||
* Custom close esc title. Default value: ' Close (Esc) '
|
||||
*/
|
||||
closeButtonTitle?: string;
|
||||
|
||||
/**
|
||||
* Handle closing of the lightbox. Required.
|
||||
*/
|
||||
onClose: () => void;
|
||||
|
||||
/**
|
||||
* Fired on request of the previous image.
|
||||
*/
|
||||
onClickPrev?: () => void;
|
||||
|
||||
/**
|
||||
* Fired on request of the next image.
|
||||
*/
|
||||
onClickNext?: () => void;
|
||||
|
||||
/**
|
||||
* Handle click on image.
|
||||
*/
|
||||
onClickImage?: (e: React.MouseEvent<HTMLImageElement>) => void;
|
||||
|
||||
/**
|
||||
* Handle click on thumbnail.
|
||||
*/
|
||||
onClickThumbnail?: (index: number) => void;
|
||||
}
|
||||
|
||||
export interface Image {
|
||||
/**
|
||||
* The source of the image. Required.
|
||||
*/
|
||||
src: string;
|
||||
|
||||
/**
|
||||
* array of strings or string
|
||||
*/
|
||||
srcSet?: string | string[];
|
||||
|
||||
/**
|
||||
* The image caption.
|
||||
*/
|
||||
caption?: string;
|
||||
|
||||
/**
|
||||
* The alt text for the image.
|
||||
*/
|
||||
alt?: string;
|
||||
}
|
||||
|
||||
export default Lightbox;
|
||||
@@ -0,0 +1,39 @@
|
||||
import * as React from 'react';
|
||||
import Lightbox, { Image } from 'react-images';
|
||||
|
||||
interface ImageGalerieState {
|
||||
selectedImage: number;
|
||||
showLightbox: boolean;
|
||||
}
|
||||
|
||||
class ImageGalerie extends React.Component<undefined, ImageGalerieState> {
|
||||
constructor(props: undefined) {
|
||||
super(props);
|
||||
this.state = {selectedImage: 0, showLightbox: true};
|
||||
}
|
||||
|
||||
render() {
|
||||
const images: Image[] = [
|
||||
{
|
||||
src: "http://localhost:8080/img1.jpg",
|
||||
alt: "Image 1",
|
||||
caption: "Image 1",
|
||||
},
|
||||
{
|
||||
src: "http://localhost:8080/img2.jpg",
|
||||
alt: "Image 2",
|
||||
caption: "Image 2",
|
||||
}];
|
||||
|
||||
return <Lightbox
|
||||
isOpen={this.state.showLightbox}
|
||||
images={images}
|
||||
onClose={() => this.setState({showLightbox: false})}
|
||||
onClickImage={e => {}}
|
||||
onClickNext={() => this.setState({selectedImage: (this.state.selectedImage + 1) % images.length})}
|
||||
onClickPrev={() => this.setState({selectedImage: this.state.selectedImage === 0 ? images.length : this.state.selectedImage - 1})}
|
||||
showThumbnails={true}
|
||||
onClickThumbnail={(index) => this.setState({selectedImage: index})}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"jsx": "react",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-images-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for react-navigation 2.0
|
||||
// Type definitions for react-navigation 2.13
|
||||
// Project: https://github.com/react-navigation/react-navigation
|
||||
// Definitions by: Huhuanming <https://github.com/huhuanming>
|
||||
// mhcgrq <https://github.com/mhcgrq>
|
||||
@@ -25,6 +25,7 @@
|
||||
// Denis Frezzato <https://github.com/DenisFrezzato>
|
||||
// Mickael Wegerich <https://github.com/mickaelw>
|
||||
// Max Davidson <https://github.com/maxdavidson>
|
||||
// Jason Killian <https://github.com/jkillian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -518,7 +519,7 @@ interface NavigationTabScreenOptionsBase {
|
||||
tabBarIcon?:
|
||||
| React.ReactElement<any>
|
||||
| ((
|
||||
options: { tintColor: string | null; focused: boolean }
|
||||
options: { tintColor: string | null; focused: boolean; horizontal: boolean }
|
||||
) => React.ReactElement<any> | null);
|
||||
tabBarLabel?:
|
||||
| string
|
||||
|
||||
@@ -179,7 +179,8 @@ const tabNavigatorConfig: TabNavigatorConfig = {
|
||||
tabBarComponent: TabBarTop,
|
||||
tabBarOptions: { activeBackgroundColor: "blue" },
|
||||
navigationOptions: () => ({
|
||||
tabBarOnPress: ({ scene, jumpToIndex }) => jumpToIndex(scene.index)
|
||||
tabBarOnPress: ({ scene, jumpToIndex }) => jumpToIndex(scene.index),
|
||||
tabBarIcon: ({ horizontal }) => <View />,
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
Vendored
+8
-4
@@ -1,10 +1,11 @@
|
||||
// Type definitions for redux-first-router 1.10
|
||||
// Type definitions for redux-first-router 2.1
|
||||
// Project: https://github.com/faceyspacey/redux-first-router#readme
|
||||
// Definitions by: Valbrand <https://github.com/Valbrand>
|
||||
// viggyfresh <https://github.com/viggyfresh>
|
||||
// janb87 <https://github.com/janb87>
|
||||
// corydeppen <https://github.com/corydeppen>
|
||||
// jscinoz <https://github.com/jscinoz>
|
||||
// surgeboris <https://github.com/surgeboris>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -64,8 +65,10 @@ export interface ReceivedActionMeta {
|
||||
};
|
||||
}
|
||||
|
||||
export type HistoryEntries = Array<{ pathname: string }>;
|
||||
|
||||
export interface HistoryData {
|
||||
entries: Array<{ pathname: string }>;
|
||||
entries: HistoryEntries;
|
||||
index: number;
|
||||
length: number;
|
||||
}
|
||||
@@ -203,6 +206,8 @@ export interface Options<TKeys = {}, TState = any> {
|
||||
initialDispatch?: boolean;
|
||||
querySerializer?: QuerySerializer;
|
||||
navigators?: NavigatorsConfig<TKeys, TState>;
|
||||
initialEntries?: HistoryEntries;
|
||||
createHistory?(): History;
|
||||
}
|
||||
|
||||
export type Params = object;
|
||||
@@ -227,9 +232,8 @@ export function canGoBack(): boolean;
|
||||
export function canGoForward(): boolean;
|
||||
|
||||
export function connectRoutes<TKeys = {}, TState = any>(
|
||||
history: History,
|
||||
routesMap: RoutesMap<TKeys, TState>,
|
||||
options?: Options<TKeys, TState>
|
||||
options?: Options<TKeys, TState>,
|
||||
): {
|
||||
reducer: Reducer<LocationState<TKeys, TState>>;
|
||||
middleware: Middleware;
|
||||
|
||||
@@ -58,7 +58,7 @@ const {
|
||||
enhancer,
|
||||
initialDispatch,
|
||||
thunk,
|
||||
} = connectRoutes(history, routesMap, {
|
||||
} = connectRoutes(routesMap, {
|
||||
initialDispatch: false,
|
||||
onBeforeChange: (dispatch, getState) => {
|
||||
dispatch; // $ExpectType Dispatch<any>
|
||||
@@ -71,7 +71,8 @@ const {
|
||||
title: state => {
|
||||
const title = state.location.pathname; // $ExpectType string
|
||||
return title;
|
||||
}
|
||||
},
|
||||
createHistory: () => history,
|
||||
});
|
||||
|
||||
const dumbMiddleware: Middleware = store => next => action => next(action);
|
||||
|
||||
Vendored
+2
-2
@@ -139,7 +139,7 @@ declare namespace sequelize {
|
||||
* @see http://docs.sequelizejs.com/en/latest/api/associations/belongs-to/
|
||||
* @see Instance
|
||||
*/
|
||||
interface BelongsToCreateAssociationMixin<TAttributes> {
|
||||
interface BelongsToCreateAssociationMixin<TAttributes, TInstance> {
|
||||
/**
|
||||
* Create a new instance of the associated model and associate it with this.
|
||||
* @param values The values used to create the association.
|
||||
@@ -148,7 +148,7 @@ declare namespace sequelize {
|
||||
(
|
||||
values?: TAttributes,
|
||||
options?: BelongsToCreateAssociationMixinOptions | CreateOptions | BelongsToSetAssociationMixinOptions
|
||||
): Promise<void>;
|
||||
): Promise<TInstance>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -220,7 +220,7 @@ barcode.setProduct(product, { save: true }).then(() => { });
|
||||
|
||||
barcode.createProduct();
|
||||
barcode.createProduct({ id: 1, name: 'Crowbar' });
|
||||
barcode.createProduct({ id: 1 }, { save: true, silent: true }).then((product) => { });
|
||||
barcode.createProduct({ id: 1 }, { save: true, silent: true }).then((product: ProductInstance) => { });
|
||||
|
||||
product.getWarehouse();
|
||||
product.getWarehouse({ scope: null }).then(w => w.capacity);
|
||||
@@ -365,7 +365,7 @@ interface ProductInstance extends Sequelize.Instance<ProductAttributes>, Product
|
||||
// belongsTo association mixins:
|
||||
getWarehouse: Sequelize.BelongsToGetAssociationMixin<WarehouseInstance>;
|
||||
setWarehouse: Sequelize.BelongsToSetAssociationMixin<WarehouseInstance, number>;
|
||||
createWarehouse: Sequelize.BelongsToCreateAssociationMixin<WarehouseAttributes>;
|
||||
createWarehouse: Sequelize.BelongsToCreateAssociationMixin<WarehouseAttributes, WarehouseInstance>;
|
||||
};
|
||||
|
||||
interface BarcodeAttributes {
|
||||
@@ -378,7 +378,7 @@ interface BarcodeInstance extends Sequelize.Instance<BarcodeAttributes>, Barcode
|
||||
// belongsTo association mixins:
|
||||
getProduct: Sequelize.BelongsToGetAssociationMixin<ProductInstance>;
|
||||
setProduct: Sequelize.BelongsToSetAssociationMixin<ProductInstance, number>;
|
||||
createProduct: Sequelize.BelongsToCreateAssociationMixin<ProductAttributes>;
|
||||
createProduct: Sequelize.BelongsToCreateAssociationMixin<ProductAttributes, ProductInstance>;
|
||||
};
|
||||
|
||||
interface WarehouseAttributes {
|
||||
|
||||
Vendored
+13
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for serialport 6.0
|
||||
// Type definitions for serialport 7.0
|
||||
// Project: https://github.com/EmergingTechnologyAdvisors/node-serialport
|
||||
// Definitions by: Jeremy Foster <https://github.com/codefoster>
|
||||
// Andrew Pearson <https://github.com/apearson>
|
||||
@@ -40,7 +40,7 @@ declare class SerialPort extends Stream.Duplex {
|
||||
|
||||
static Binding: SerialPort.BaseBinding;
|
||||
|
||||
static list(): Promise<any>;
|
||||
static list(callback?: SerialPort.ListCallback): Promise<SerialPort.PortInfo[]>;
|
||||
}
|
||||
|
||||
declare namespace SerialPort {
|
||||
@@ -77,6 +77,16 @@ declare namespace SerialPort {
|
||||
dsr?: boolean;
|
||||
dtr?: boolean;
|
||||
rts?: boolean;
|
||||
}
|
||||
|
||||
interface PortInfo {
|
||||
comName: string;
|
||||
manufacturer?: string;
|
||||
serialNumber?: string;
|
||||
pnpId?: string;
|
||||
locationId?: string;
|
||||
productId?: string;
|
||||
vendorId?: string;
|
||||
}
|
||||
|
||||
namespace parsers {
|
||||
@@ -119,7 +129,7 @@ declare namespace SerialPort {
|
||||
get(): Promise<any>;
|
||||
flush(): Promise<any>;
|
||||
drain(): Promise<any>;
|
||||
static list(): Promise<any>;
|
||||
static list(): Promise<PortInfo[]>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,3 +126,14 @@ function test_properties() {
|
||||
const isOpen: boolean = port.isOpen;
|
||||
const path: string = port.path;
|
||||
}
|
||||
|
||||
function test_list_ports_promise() {
|
||||
const ports = SerialPort
|
||||
.list()
|
||||
.then((ports: any) => {})
|
||||
.catch((err: Error) => {});
|
||||
}
|
||||
|
||||
function test_list_ports_callback() {
|
||||
const ports = SerialPort.list((error: Error, port: any[]) => {});
|
||||
}
|
||||
|
||||
Vendored
+126
@@ -0,0 +1,126 @@
|
||||
// Type definitions for serialport 6.0
|
||||
// Project: https://github.com/EmergingTechnologyAdvisors/node-serialport
|
||||
// Definitions by: Jeremy Foster <https://github.com/codefoster>
|
||||
// Andrew Pearson <https://github.com/apearson>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as Stream from 'stream';
|
||||
|
||||
declare class SerialPort extends Stream.Duplex {
|
||||
constructor(path: string, callback?: SerialPort.ErrorCallback);
|
||||
constructor(path: string, options?: SerialPort.OpenOptions, callback?: SerialPort.ErrorCallback);
|
||||
|
||||
readonly baudRate: number;
|
||||
readonly binding: SerialPort.BaseBinding;
|
||||
readonly isOpen: boolean;
|
||||
readonly path: string;
|
||||
|
||||
open(callback?: SerialPort.ErrorCallback): void;
|
||||
update(options: SerialPort.UpdateOptions, callback?: SerialPort.ErrorCallback): void;
|
||||
|
||||
write(data: string| number[] | Buffer, callback?: (error: any, bytesWritten: number) => void): boolean;
|
||||
write(buffer: string| number[] | Buffer, encoding?: 'ascii'|'utf8'|'utf16le'|'ucs2'|'base64'|'binary'|'hex', callback?: (error: any, bytesWritten: number) => void): boolean;
|
||||
|
||||
read(size?: number): string | Buffer | null;
|
||||
|
||||
close(callback?: (error: Error) => void): void;
|
||||
|
||||
set(options: SerialPort.SetOptions, callback?: SerialPort.ErrorCallback): void;
|
||||
get(callback?: SerialPort.ModemBitsCallback): void;
|
||||
|
||||
flush(callback?: SerialPort.ErrorCallback): void;
|
||||
drain(callback?: SerialPort.ErrorCallback): void;
|
||||
|
||||
pause(): this;
|
||||
resume(): this;
|
||||
|
||||
on(event: string, callback: (data?: any) => void): this;
|
||||
|
||||
static Binding: SerialPort.BaseBinding;
|
||||
|
||||
static list(): Promise<any>;
|
||||
}
|
||||
|
||||
declare namespace SerialPort {
|
||||
// Callbacks Type Defs
|
||||
type ErrorCallback = (error: Error) => void;
|
||||
type ModemBitsCallback = (error: Error, status: {cts: boolean, dsr: boolean, dcd: boolean }) => void;
|
||||
type ListCallback = (error: Error, port: any[]) => void;
|
||||
|
||||
// Options Type Defs
|
||||
interface OpenOptions {
|
||||
autoOpen?: boolean;
|
||||
baudRate?: 115200|57600|38400|19200|9600|4800|2400|1800|1200|600|300|200|150|134|110|75|50|number;
|
||||
dataBits?: 8|7|6|5;
|
||||
highWaterMark?: number;
|
||||
lock?: boolean;
|
||||
stopBits?: 1|2;
|
||||
parity?: 'none'|'even'|'mark'|'odd'|'space';
|
||||
rtscts?: boolean;
|
||||
xon?: boolean;
|
||||
xoff?: boolean;
|
||||
xany?: boolean;
|
||||
binding?: BaseBinding;
|
||||
bindingOptions?: {
|
||||
vmin?: number;
|
||||
vtime?: number;
|
||||
};
|
||||
}
|
||||
interface UpdateOptions {
|
||||
baudRate?: 115200|57600|38400|19200|9600|4800|2400|1800|1200|600|300|200|150|134|110|75|50|number;
|
||||
}
|
||||
interface SetOptions {
|
||||
brk?: boolean;
|
||||
cts?: boolean;
|
||||
dsr?: boolean;
|
||||
dtr?: boolean;
|
||||
rts?: boolean;
|
||||
}
|
||||
|
||||
namespace parsers {
|
||||
class ByteLength extends Stream.Transform {
|
||||
constructor(options: {length: number});
|
||||
}
|
||||
class CCTalk extends Stream.Transform {
|
||||
constructor();
|
||||
}
|
||||
class Delimiter extends Stream.Transform {
|
||||
constructor(options: {delimiter: string | Buffer | number[], includeDelimiter?: boolean});
|
||||
}
|
||||
class Readline extends Delimiter {
|
||||
constructor(options: {delimiter: string | Buffer | number[], encoding?: 'ascii'|'utf8'|'utf16le'|'ucs2'|'base64'|'binary'|'hex'});
|
||||
}
|
||||
class Ready extends Stream.Transform {
|
||||
constructor(options: {data: string | Buffer | number[]});
|
||||
}
|
||||
class Regex extends Stream.Transform {
|
||||
constructor(options: {regex: RegExp});
|
||||
}
|
||||
}
|
||||
|
||||
// Binding Type Defs
|
||||
type win32Binding = BaseBinding;
|
||||
type darwinBinding = BaseBinding;
|
||||
type linuxBinding = BaseBinding;
|
||||
|
||||
// Binding Type Def
|
||||
class BaseBinding {
|
||||
constructor(options: any);
|
||||
|
||||
open(path: string, options: OpenOptions): Promise<any>;
|
||||
close(): Promise<any>;
|
||||
|
||||
read(data: Buffer, offset: number, length: number): Promise<any>;
|
||||
write(data: Buffer): Promise<any>;
|
||||
update(options?: UpdateOptions): Promise<any>;
|
||||
set(options?: SetOptions): Promise<any>;
|
||||
get(): Promise<any>;
|
||||
flush(): Promise<any>;
|
||||
drain(): Promise<any>;
|
||||
static list(): Promise<any>;
|
||||
}
|
||||
}
|
||||
|
||||
export = SerialPort;
|
||||
@@ -0,0 +1,128 @@
|
||||
// Tests taken from documentation samples.
|
||||
|
||||
import SerialPort = require('serialport');
|
||||
|
||||
function test_basic_connect() {
|
||||
const port = new SerialPort('');
|
||||
}
|
||||
|
||||
function test_connect_config() {
|
||||
const port1 = new SerialPort('', {
|
||||
}, (error: Error) => {});
|
||||
|
||||
const port4 = new SerialPort('', {
|
||||
autoOpen: false,
|
||||
lock: false,
|
||||
baudRate: 115200,
|
||||
dataBits: 5,
|
||||
stopBits: 2,
|
||||
parity: 'odd',
|
||||
rtscts: true,
|
||||
xon: true,
|
||||
xoff: true,
|
||||
highWaterMark: 1024,
|
||||
bindingOptions: {
|
||||
vmin: 1,
|
||||
vtime: 1
|
||||
}
|
||||
}, (error: Error) => {});
|
||||
}
|
||||
|
||||
function test_open() {
|
||||
const port = new SerialPort('');
|
||||
port.open(() => {});
|
||||
}
|
||||
|
||||
function test_update() {
|
||||
const port = new SerialPort('');
|
||||
port.update({baudRate: 57600});
|
||||
}
|
||||
|
||||
function test_write() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
port.write('test', (error: Error) => {});
|
||||
port.write('test', 'utf8', (error: Error) => {});
|
||||
}
|
||||
|
||||
function test_read() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
const data = port.read(8);
|
||||
}
|
||||
|
||||
function test_close() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
port.close((error: Error) => {});
|
||||
}
|
||||
|
||||
function test_set() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
port.set({}, (error: Error) => {});
|
||||
}
|
||||
|
||||
function test_get() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
port.get((error, status) => {});
|
||||
}
|
||||
|
||||
function test_flush() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
port.flush((error: Error) => {});
|
||||
}
|
||||
|
||||
function test_drain() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
port.drain((error: Error) => {});
|
||||
}
|
||||
|
||||
function test_pause_resume() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
const pauseItem: SerialPort = port.pause();
|
||||
const resumeItem: SerialPort = port.resume();
|
||||
}
|
||||
|
||||
function test_on_events() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
const onItem: SerialPort = port.on('event', (data: any) => {});
|
||||
}
|
||||
|
||||
function test_binding() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
const bindingItem: SerialPort.BaseBinding = SerialPort.Binding;
|
||||
}
|
||||
|
||||
function test_parsers() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
const ByteLengthParser = new SerialPort.parsers.ByteLength({length: 8});
|
||||
const CCTalkParser = new SerialPort.parsers.CCTalk();
|
||||
const DelimiterParser = new SerialPort.parsers.Delimiter({ delimiter: Buffer.from('EOL') });
|
||||
const ReadlineParser = new SerialPort.parsers.Readline({ delimiter: '\r\n' });
|
||||
const ReadyParser = new SerialPort.parsers.Ready({ data: 'READY' });
|
||||
const RegexParser = new SerialPort.parsers.Regex({regex: /.*/});
|
||||
|
||||
port.pipe(ByteLengthParser);
|
||||
port.pipe(CCTalkParser);
|
||||
port.pipe(DelimiterParser);
|
||||
port.pipe(ReadlineParser);
|
||||
port.pipe(ReadyParser);
|
||||
port.pipe(RegexParser);
|
||||
}
|
||||
|
||||
function test_properties() {
|
||||
const port = new SerialPort('');
|
||||
|
||||
const baudRate: number = port.baudRate;
|
||||
const binding: SerialPort.BaseBinding = port.binding;
|
||||
const isOpen: boolean = port.isOpen;
|
||||
const path: string = port.path;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"serialport": [
|
||||
"serialport/v6"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"serialport-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -3,7 +3,7 @@ import { Value } from "slate";
|
||||
import * as React from "react";
|
||||
|
||||
class MyPlugin implements Plugin {
|
||||
renderNode(props: RenderNodeProps) {
|
||||
renderNode(props: RenderNodeProps, next: () => void) {
|
||||
const { node } = props;
|
||||
if (node) {
|
||||
switch (node.object) {
|
||||
|
||||
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
// Type definitions for sonic-boom 0.6
|
||||
// Project: https://github.com/mcollina/sonic-boom.git
|
||||
// Definitions by: Alex Ferrando <https://github.com/alferpal>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export = SonicBoom;
|
||||
|
||||
declare class SonicBoom extends EventEmitter {
|
||||
/**
|
||||
* @param [fileDescriptor] File path or numerical file descriptor
|
||||
* relative protocol is enabled. Default: process.stdout
|
||||
* @returns a new sonic-boom instance
|
||||
*/
|
||||
constructor(fileDescriptor: string | number)
|
||||
|
||||
/**
|
||||
* Writes the string to the file. It will return false to signal the producer to slow down.
|
||||
*/
|
||||
write(string: string): void;
|
||||
|
||||
/**
|
||||
* Writes the current buffer to the file if a write was not in progress.
|
||||
* Do nothing if minLength is zero or if it is already writing.
|
||||
*/
|
||||
flush(): void;
|
||||
|
||||
/**
|
||||
* Reopen the file in place, useful for log rotation.
|
||||
*/
|
||||
reopen(file: string): void;
|
||||
|
||||
/**
|
||||
* Flushes the buffered data synchronously. This is a costly operation.
|
||||
*/
|
||||
flushSync(): void;
|
||||
|
||||
/**
|
||||
* Closes the stream, the data will be flushed down asynchronously
|
||||
*/
|
||||
end(): void;
|
||||
|
||||
/**
|
||||
* Closes the stream immediately, the data is not flushed.
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import SonicBoom = require('sonic-boom');
|
||||
const sonic = new SonicBoom(1);
|
||||
|
||||
sonic.write('hello sonic\n');
|
||||
|
||||
sonic.flush();
|
||||
|
||||
sonic.flushSync();
|
||||
|
||||
sonic.end();
|
||||
|
||||
sonic.destroy();
|
||||
@@ -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",
|
||||
"sonic-boom-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for subtitle 2.0
|
||||
// Project: https://github.com/gsantiago/subtitle.js#readme
|
||||
// Definitions by: Low Jeng Lam <https://github.com/jenglamlow>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface subTitleType {
|
||||
start: number | string;
|
||||
end: number | string;
|
||||
text: string;
|
||||
setting?: string;
|
||||
}
|
||||
|
||||
export function parse(srtOrVtt: string): subTitleType[];
|
||||
export function stringify(captions: ReadonlyArray<subTitleType>): string;
|
||||
export function resync(captions: ReadonlyArray<subTitleType>, time: number): subTitleType[];
|
||||
export function toMs(timestamp: string): number;
|
||||
export function toSrtTime(timestamp: number): string;
|
||||
export function toVttTime(timestamp: number): string;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user