mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge remote-tracking branch 'dt/master'
This commit is contained in:
+389
-171
File diff suppressed because it is too large
Load Diff
+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:
|
||||
|
||||
@@ -540,6 +540,12 @@
|
||||
"sourceRepoURL": "https://github.com/code-chris/extended-listbox",
|
||||
"asOfVersion": "4.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "fast-diff",
|
||||
"typingsPackageName": "fast-diff",
|
||||
"sourceRepoURL": "https://github.com/jhchen/fast-diff",
|
||||
"asOfVersion": "1.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "JSON-Patch",
|
||||
"typingsPackageName": "fast-json-patch",
|
||||
@@ -978,6 +984,12 @@
|
||||
"sourceRepoURL": "https://github.com/mweststrate/mobservable-react",
|
||||
"asOfVersion": "1.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "Mobx Cookie",
|
||||
"typingsPackageName": "mobx-cookie",
|
||||
"sourceRepoURL": "https://github.com/will-stone/mobx-cookie",
|
||||
"asOfVersion": "1.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "Moment",
|
||||
"typingsPackageName": "moment",
|
||||
@@ -1206,6 +1218,12 @@
|
||||
"sourceRepoURL": "https://github.com/react-ga/react-ga",
|
||||
"asOfVersion": "2.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-i18next",
|
||||
"typingsPackageName": "react-i18next",
|
||||
"sourceRepoURL": "https://github.com/i18next/react-i18next",
|
||||
"asOfVersion": "8.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-monaco-editor",
|
||||
"typingsPackageName": "react-monaco-editor",
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -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,8 +174,38 @@ 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();
|
||||
index.browseAll('query');
|
||||
index.browseAll('', {
|
||||
filters: 'dog',
|
||||
});
|
||||
|
||||
let hits: Object[] = [];
|
||||
|
||||
browser.on('result', function onResult(content) {
|
||||
hits = hits.concat(content.hits);
|
||||
});
|
||||
|
||||
browser.on('end', function onEnd() {
|
||||
const _message = `We got ${hits.length} hits`
|
||||
});
|
||||
|
||||
browser.on('error', function onError(err) {
|
||||
throw err;
|
||||
});
|
||||
|
||||
browser.stop();
|
||||
|
||||
index.browse("", {
|
||||
advancedSyntax: false,
|
||||
attributesToRetrieve: ['dogs']
|
||||
});
|
||||
client.copyIndex('from', 'to', ['settings']).then(()=>{});
|
||||
client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {});
|
||||
|
||||
Vendored
+145
-101
@@ -1,11 +1,14 @@
|
||||
// Type definitions for algoliasearch-client-js 3.27.0
|
||||
// Type definitions for algoliasearch-client-js 3.30.0
|
||||
// Project: https://github.com/algolia/algoliasearch-client-js
|
||||
// Definitions by: Baptiste Coquelle <https://github.com/cbaptiste>
|
||||
// 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.2
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
|
||||
|
||||
declare namespace algoliasearch {
|
||||
/**
|
||||
@@ -611,6 +614,11 @@ declare namespace algoliasearch {
|
||||
options: SearchForFacetValues.Parameters,
|
||||
cb: (err: Error, res: SearchForFacetValues.Response) => void
|
||||
): void;
|
||||
/**
|
||||
* Browse an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
*/
|
||||
browse(query: string, parameters: BrowseParameters, cb: (err: Error, res: BrowseResponse) => void): void;
|
||||
/**
|
||||
* Browse an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
@@ -620,7 +628,7 @@ declare namespace algoliasearch {
|
||||
* Browse an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
*/
|
||||
browse(query: string): Promise<BrowseResponse>;
|
||||
browse(query: string, parameters?: BrowseParameters): Promise<BrowseResponse>;
|
||||
/**
|
||||
* Browse an index from a cursor
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
@@ -638,7 +646,7 @@ declare namespace algoliasearch {
|
||||
* Browse an entire index
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
*/
|
||||
browseAll(): Promise<Response>;
|
||||
browseAll(query?: string, parameters?: BrowseParameters): Browser;
|
||||
/**
|
||||
* Clear an index content
|
||||
* https://github.com/algolia/algoliasearch-client-js#clear-index---clearindex
|
||||
@@ -966,6 +974,22 @@ declare namespace algoliasearch {
|
||||
query: string;
|
||||
processingTimeMS: number;
|
||||
}
|
||||
type BrowseParameters = Omit<
|
||||
QueryParameters,
|
||||
| "typoTolerance"
|
||||
| "distinct"
|
||||
| "facets"
|
||||
| "getRankingInfo"
|
||||
| "attributesToHighlight"
|
||||
| "attributesToSnippet"
|
||||
>
|
||||
interface Browser {
|
||||
on(type: "error", cb: (err: Error) => void): void
|
||||
on(type: "end", cb: () => void): void
|
||||
on(type: "stop", cb: () => void): void
|
||||
on(type: "result", cb: (content: BrowseResponse) => void): void
|
||||
stop(): void
|
||||
}
|
||||
/**
|
||||
* Describes a synonym object
|
||||
*/
|
||||
@@ -1099,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;
|
||||
/**
|
||||
@@ -1222,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[][];
|
||||
/**
|
||||
@@ -1286,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[][];
|
||||
/**
|
||||
@@ -1302,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[];
|
||||
/**
|
||||
@@ -1322,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[];
|
||||
/**
|
||||
@@ -1337,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;
|
||||
|
||||
@@ -1464,7 +1498,7 @@ declare namespace algoliasearch {
|
||||
interface Task {
|
||||
taskID: number;
|
||||
createdAt: string;
|
||||
objectID?: string;
|
||||
objectID?: string;
|
||||
}
|
||||
|
||||
interface TaskStatus {
|
||||
@@ -1747,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?: {
|
||||
@@ -1796,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
+110
-75
@@ -1,12 +1,15 @@
|
||||
// Type definitions for algoliasearch-client-js 3.27.0
|
||||
// Type definitions for algoliasearch-client-js 3.30.0
|
||||
// Project: https://github.com/algolia/algoliasearch-client-js
|
||||
// Definitions by: Baptiste Coquelle <https://github.com/cbaptiste>
|
||||
// Haroen Viaene <https://github.com/haroenv>
|
||||
// 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.2
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
|
||||
|
||||
declare namespace algoliasearch {
|
||||
/**
|
||||
@@ -130,6 +133,11 @@ declare namespace algoliasearch {
|
||||
options: SearchForFacetValues.Parameters,
|
||||
cb: (err: Error, res: SearchForFacetValues.Response) => void
|
||||
): void;
|
||||
/**
|
||||
* Browse an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
*/
|
||||
browse(query: string, parameters: BrowseParameters, cb: (err: Error, res: BrowseResponse) => void): void;
|
||||
/**
|
||||
* Browse an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
@@ -139,7 +147,7 @@ declare namespace algoliasearch {
|
||||
* Browse an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
*/
|
||||
browse(query: string): Promise<BrowseResponse>;
|
||||
browse(query: string, parameters?: BrowseParameters): Promise<BrowseResponse>;
|
||||
/**
|
||||
* Browse an index from a cursor
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
@@ -194,114 +202,122 @@ declare namespace algoliasearch {
|
||||
query: string;
|
||||
processingTimeMS: number;
|
||||
}
|
||||
|
||||
type BrowseParameters = Omit<
|
||||
QueryParameters,
|
||||
| "typoTolerance"
|
||||
| "distinct"
|
||||
| "facets"
|
||||
| "getRankingInfo"
|
||||
| "attributesToHighlight"
|
||||
| "attributesToSnippet"
|
||||
>
|
||||
interface QueryParameters {
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
@@ -311,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[][];
|
||||
/**
|
||||
@@ -375,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[][];
|
||||
/**
|
||||
@@ -391,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[];
|
||||
/**
|
||||
@@ -411,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[];
|
||||
/**
|
||||
@@ -426,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;
|
||||
|
||||
@@ -530,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?: {
|
||||
@@ -579,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 {
|
||||
|
||||
Vendored
+3
-3
@@ -8,7 +8,7 @@
|
||||
|
||||
import * as Promise from 'bluebird';
|
||||
import * as events from 'events';
|
||||
import { Replies, Options, Message } from './properties';
|
||||
import { Replies, Options, Message, GetMessage, ConsumeMessage } from './properties';
|
||||
export * from './properties';
|
||||
|
||||
export interface Connection extends events.EventEmitter {
|
||||
@@ -40,10 +40,10 @@ export interface Channel extends events.EventEmitter {
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
|
||||
consume(queue: string, onMessage: (msg: Message | null) => any, options?: Options.Consume): Promise<Replies.Consume>;
|
||||
consume(queue: string, onMessage: (msg: ConsumeMessage | null) => any, options?: Options.Consume): Promise<Replies.Consume>;
|
||||
|
||||
cancel(consumerTag: string): Promise<Replies.Empty>;
|
||||
get(queue: string, options?: Options.Get): Promise<Message | false>;
|
||||
get(queue: string, options?: Options.Get): Promise<GetMessage | false>;
|
||||
|
||||
ack(message: Message, allUpTo?: boolean): void;
|
||||
ackAll(): void;
|
||||
|
||||
Vendored
+22
-2
@@ -145,12 +145,32 @@ export interface Message {
|
||||
properties: MessageProperties;
|
||||
}
|
||||
|
||||
export interface MessageFields {
|
||||
export interface GetMessage extends Message {
|
||||
fields: GetMessageFields;
|
||||
}
|
||||
|
||||
export interface ConsumeMessage extends Message {
|
||||
fields: ConsumeMessageFields;
|
||||
}
|
||||
|
||||
export interface CommonMessageFields {
|
||||
deliveryTag: number;
|
||||
redelivered: boolean;
|
||||
exchange: string;
|
||||
routingKey: string;
|
||||
messageCount: string;
|
||||
}
|
||||
|
||||
export interface MessageFields extends CommonMessageFields {
|
||||
messageCount?: number;
|
||||
consumerTag?: string;
|
||||
}
|
||||
|
||||
export interface GetMessageFields extends CommonMessageFields {
|
||||
messageCount: number;
|
||||
}
|
||||
|
||||
export interface ConsumeMessageFields extends CommonMessageFields {
|
||||
deliveryTag: number;
|
||||
}
|
||||
|
||||
export interface MessageProperties {
|
||||
|
||||
Vendored
+1
@@ -340,6 +340,7 @@ declare module 'angular' {
|
||||
|
||||
interface IMenuService {
|
||||
hide(response?: any, options?: any): IPromise<any>;
|
||||
open(event?: MouseEvent): void;
|
||||
}
|
||||
|
||||
interface IColorPalette {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker',
|
||||
($q: angular.IQService, promiseTracker: angular.promisetracker.PromiseTrackerService) => {
|
||||
angular.module('promise-tracker-tests', []).run(['$q', '$http', 'promiseTracker',
|
||||
($q: angular.IQService, $http: angular.IHttpService, promiseTracker: angular.promisetracker.PromiseTrackerService) => {
|
||||
const trackerWithoutOptions = promiseTracker();
|
||||
|
||||
const options = {
|
||||
@@ -19,4 +19,8 @@ angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker',
|
||||
const addedPromise: angular.IDeferred<void> = trackerWithOptions.addPromise(promiseToAdd);
|
||||
|
||||
const trackerWithSomeOptions = promiseTracker({activationDelay: 500});
|
||||
|
||||
$http.post('/foo', {}, { });
|
||||
$http.post('/foo', {}, { tracker: trackerWithOptions });
|
||||
$http.post('/foo', {}, { tracker: [trackerWithoutOptions, trackerWithOptions] });
|
||||
}]);
|
||||
|
||||
+4
@@ -28,4 +28,8 @@ declare module 'angular' {
|
||||
(options?: PromiseTrackerOptions): PromiseTracker;
|
||||
}
|
||||
}
|
||||
|
||||
interface IRequestShortcutConfig {
|
||||
tracker?: angular.promisetracker.PromiseTracker | angular.promisetracker.PromiseTracker[];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ angular
|
||||
closeButton: false,
|
||||
closeHtml: '<button>×</button>',
|
||||
extendedTimeOut: 1000,
|
||||
extraData: {
|
||||
txt: "sample text",
|
||||
action: () => {/* Do action */},
|
||||
},
|
||||
iconClasses: {
|
||||
error: 'toast-error',
|
||||
info: 'toast-info',
|
||||
@@ -29,7 +33,6 @@ angular
|
||||
progressBar: false,
|
||||
tapToDismiss: true,
|
||||
templates: {
|
||||
|
||||
toast: 'directives/toast/toast.html',
|
||||
progressbar: 'directives/progressbar/progressbar.html'
|
||||
},
|
||||
|
||||
Vendored
+1
@@ -24,6 +24,7 @@ declare module 'angular' {
|
||||
closeButton?: boolean;
|
||||
closeHtml?: string;
|
||||
extendedTimeOut?: number;
|
||||
extraData?: any,
|
||||
messageClass?: string;
|
||||
onHidden?: (wasClicked: boolean, toast: angular.toastr.IToast) => void;
|
||||
onShown?: (toast: angular.toastr.IToast) => void;
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/mgonto/angular-wizard
|
||||
// Definitions by: Marko Jurisic <https://github.com/mjurisic>, Ronald Wildenberg <https://github.com/rwwilden>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as angular from 'angular';
|
||||
|
||||
|
||||
Vendored
+6
-6
@@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
type FunctionBasedParamter = (element: HTMLElement, index: number, length: number) => number;
|
||||
type FunctionBasedParameter = (element: HTMLElement, index: number, length: number) => number;
|
||||
type AnimeCallbackFunction = (anim: anime.AnimeInstance) => void;
|
||||
// Allowing null is necessary because DOM queries may not return anything.
|
||||
type AnimeTarget = string | object | HTMLElement | SVGElement | NodeList | null;
|
||||
@@ -55,10 +55,10 @@ declare namespace anime {
|
||||
interface AnimeAnimParams {
|
||||
targets: AnimeTarget | ReadonlyArray<AnimeTarget>;
|
||||
|
||||
duration?: number | FunctionBasedParamter;
|
||||
delay?: number | FunctionBasedParamter;
|
||||
elasticity?: number | FunctionBasedParamter;
|
||||
round?: number | boolean | FunctionBasedParamter;
|
||||
duration?: number | FunctionBasedParameter;
|
||||
delay?: number | FunctionBasedParameter;
|
||||
elasticity?: number | FunctionBasedParameter;
|
||||
round?: number | boolean | FunctionBasedParameter;
|
||||
|
||||
easing?: EasingOptions | string | ReadonlyArray<number>;
|
||||
|
||||
@@ -106,7 +106,7 @@ declare namespace anime {
|
||||
}
|
||||
|
||||
interface AnimeTimelineAnimParams extends AnimeAnimParams {
|
||||
offset: number | string | FunctionBasedParamter;
|
||||
offset: number | string | FunctionBasedParameter;
|
||||
}
|
||||
|
||||
interface AnimeTimelineInstance extends AnimeInstance {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
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) => {
|
||||
const cname = color.replace(/([a-z])([A-Z])/g, (_: string, l: string, u: string): string => `${l} ${u.toLowerCase()}`);
|
||||
|
||||
((<(...anything: any[]) => ansi.Cursor> cursor[color])()
|
||||
.bold()
|
||||
.bg)[color === 'blue' || color === 'brightBlue' ? 'black' : 'blue']()
|
||||
.write(
|
||||
`Hello, bold ${cname} world!\n`
|
||||
)
|
||||
.reset();
|
||||
});
|
||||
Vendored
+181
@@ -0,0 +1,181 @@
|
||||
// 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
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/**
|
||||
* References:
|
||||
*
|
||||
* - http://en.wikipedia.org/wiki/ANSI_escape_code
|
||||
* - http://www.termsys.demon.co.uk/vtansi.htm
|
||||
*
|
||||
*/
|
||||
|
||||
/// <reference types="node" />
|
||||
import { Stream } from "stream";
|
||||
|
||||
interface CursorOptions {
|
||||
enabled: boolean;
|
||||
buffering: boolean;
|
||||
}
|
||||
|
||||
declare function ansi(stream: Stream, options?: CursorOptions): ansi.Cursor;
|
||||
|
||||
declare namespace ansi {
|
||||
class Cursor {
|
||||
bg: Colorer;
|
||||
fg: Colorer;
|
||||
|
||||
constructor(stream: Stream, options?: CursorOptions);
|
||||
|
||||
/**
|
||||
* 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) | Colorer;
|
||||
}
|
||||
|
||||
interface Colorer {
|
||||
[key: string]: (...anything: any[]) => (Cursor | Colorer);
|
||||
}
|
||||
}
|
||||
|
||||
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
+1
-1
@@ -12,7 +12,7 @@ type FontFamily =
|
||||
| BaseCSSProperties['fontFamily']
|
||||
| CSS.FontFace;
|
||||
|
||||
type Omit<T, K extends keyof T> = Pick<T, ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never, [x: number]: never })[keyof T]>;
|
||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
type CSSProperties = Omit<BaseCSSProperties, 'fontFamily' | 'transition' | 'animationName' > & {
|
||||
fontFamily?: FontFamily | FontFamily[];
|
||||
|
||||
Vendored
+3
@@ -145,6 +145,9 @@ declare namespace apostrophe {
|
||||
required?: boolean;
|
||||
options?: AposObject;
|
||||
choices?: SelectChoice[];
|
||||
widgetType?: string;
|
||||
titleField?: string;
|
||||
schema?: Field[];
|
||||
}
|
||||
|
||||
interface SelectChoice {
|
||||
|
||||
Vendored
+76
-1
@@ -1440,6 +1440,81 @@ declare module "@arangodb/foxx/router" {
|
||||
export = createRouter;
|
||||
}
|
||||
|
||||
declare module "@arangodb/foxx/queues" {
|
||||
interface QueueItem {
|
||||
name: string;
|
||||
mount: string;
|
||||
backOff?: ((failureCount: number) => number) | number;
|
||||
maxFailures?: number;
|
||||
schema?: Foxx.Schema;
|
||||
preprocess?: (data: any) => any;
|
||||
}
|
||||
|
||||
interface Script {
|
||||
name: string;
|
||||
mount: string;
|
||||
}
|
||||
|
||||
type JobCallback = (result: any, jobData: any, job: ArangoDB.Document<Job>) => void;
|
||||
|
||||
interface Job {
|
||||
status: string;
|
||||
queue: string;
|
||||
type: Script;
|
||||
failures: object[];
|
||||
runs: number;
|
||||
data: any;
|
||||
created: number;
|
||||
modified: number;
|
||||
delayUntil: number;
|
||||
maxFailures: number;
|
||||
repeatDelay: number;
|
||||
repeatTimes: number;
|
||||
repeatUntil: number;
|
||||
success?: string;
|
||||
failure?: string;
|
||||
runFailures: number;
|
||||
abort(): void;
|
||||
}
|
||||
|
||||
interface JobOptions {
|
||||
success?: JobCallback;
|
||||
failure?: JobCallback;
|
||||
delayUntil?: number | Date;
|
||||
backOff?: ((failureCount: number) => number) | number;
|
||||
maxFailures?: number;
|
||||
repeatTimes?: number;
|
||||
repeatUntil?: number | Date;
|
||||
repeatDelay?: number;
|
||||
}
|
||||
|
||||
interface Queue {
|
||||
push(item: QueueItem, data: any, opts?: JobOptions): void;
|
||||
get(jobId: string): ArangoDB.Document<Job>;
|
||||
delete(jobId: string): boolean;
|
||||
pending(script?: Script): string[];
|
||||
progress(script?: Script): string[];
|
||||
complete(script?: Script): string[];
|
||||
failed(script?: Script): string[];
|
||||
all(script?: Script): string[];
|
||||
}
|
||||
|
||||
function createQueue(name: string, maxWorkers?: number): Queue;
|
||||
function deleteQueue(name: string): boolean;
|
||||
function get(name: string): Queue;
|
||||
|
||||
export {
|
||||
createQueue as create,
|
||||
deleteQueue as delete,
|
||||
get,
|
||||
JobOptions,
|
||||
Job,
|
||||
Queue,
|
||||
QueueItem,
|
||||
Script,
|
||||
};
|
||||
}
|
||||
|
||||
declare module "@arangodb/foxx/graphql" {
|
||||
import { formatError, GraphQLSchema } from "graphql";
|
||||
type GraphQLModule = object;
|
||||
@@ -1698,7 +1773,7 @@ declare module "@arangodb/crypto" {
|
||||
key: string | null,
|
||||
token: string,
|
||||
noVerify?: boolean
|
||||
): string | null;
|
||||
): object | null;
|
||||
function md5(message: string): string;
|
||||
function sha1(message: string): string;
|
||||
function sha224(message: string): string;
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
import art from 'ascii-art';
|
||||
|
||||
art.font('test', 'doom').toPromise();
|
||||
|
||||
art.font('my text', 'Doom', (rendered: string) => {
|
||||
rendered.big();
|
||||
});
|
||||
|
||||
art.font('my text', 'Doom', '', (rendered) => {
|
||||
rendered.big();
|
||||
});
|
||||
|
||||
art.artwork({
|
||||
artwork: 'textfiles.com/art/st-char.asc'
|
||||
}).lines(31, 45, (rendered: string) => {
|
||||
// cleanup non-unix terminators
|
||||
rendered = rendered.replace(/\r/g, '');
|
||||
art.image({
|
||||
filepath : '~/Images/earth_in_space.jpg',
|
||||
alphabet : 'ultra-wide'
|
||||
}).overlay(rendered, {
|
||||
x: 0,
|
||||
y: -1,
|
||||
style: 'red+blink',
|
||||
transparent: '&'
|
||||
}, (_final: any) => {});
|
||||
});
|
||||
|
||||
art.font('Ghost Wire BBS', 'Doom', (logo) => {
|
||||
art.font('No place like home', 'rusted', (subtext) => {
|
||||
art.table({
|
||||
verticalBar : ' ',
|
||||
horizontalBar : ' ',
|
||||
intersection : ' ',
|
||||
data: [
|
||||
{name: art.style('current users', 'red'), value: '203'},
|
||||
{name: 'operator', value: 'vince.vega'},
|
||||
{name: 'dial-in', value: '(917)555-4202'},
|
||||
]
|
||||
}).lines(2, (table: any) => {
|
||||
art.image({
|
||||
filepath : '~/Images/starburst_red.jpg',
|
||||
alphabet : 'ultra-wide'
|
||||
}).lines(2, 30).overlay(logo, {
|
||||
x: 0,
|
||||
y: 0,
|
||||
style: 'blue',
|
||||
}).overlay(subtext, {
|
||||
x: 19,
|
||||
y: 8,
|
||||
style: 'yellow',
|
||||
}).overlay(table, {
|
||||
x: -1,
|
||||
y: -1,
|
||||
style: 'green',
|
||||
}, (_final: any) => {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
art.image({
|
||||
width : 40,
|
||||
filepath : '/Images/initech.png',
|
||||
alphabet : 'wide'
|
||||
}).font('INITECH', 'Doom', 'cyan', (_ascii) => {
|
||||
});
|
||||
|
||||
art.table({
|
||||
data: [
|
||||
{text: ' .\'ANDRE. '},
|
||||
{text: ' ..THE.GIANT\'. '},
|
||||
{text: '.With.Bobby."The.Brain"'},
|
||||
{text: '.Heenan.'}
|
||||
],
|
||||
verticalBar : ' ',
|
||||
horizontalBar : ' ',
|
||||
intersection : ' '
|
||||
}).lines(2, (table: any) => {
|
||||
art.strings([
|
||||
'ANDRE',
|
||||
'the',
|
||||
'GIANT',
|
||||
'POSSE',
|
||||
'7\'4"',
|
||||
'520 LB'
|
||||
], 'rusted', (andre: any, the: any, giant: any, posse: any, height: any, weight: any) => {
|
||||
art.strings([ 'has', 'a'], 'twopoint', (has: any, a: any) => {
|
||||
art.image({
|
||||
filepath : '/Images/andre_has_a_posse.jpeg',
|
||||
alphabet : 'ultra-wide'
|
||||
}).overlay(andre, {
|
||||
x: 8, y: 4,
|
||||
style: 'white'
|
||||
}).overlay(the, {
|
||||
x: 10, y: 7,
|
||||
style: 'white',
|
||||
transparent : true
|
||||
}).overlay(giant, {
|
||||
x: 8, y: 10,
|
||||
style: 'white',
|
||||
transparent : true
|
||||
}).overlay(has, {
|
||||
x: 10, y: 14,
|
||||
style: 'white'
|
||||
}).overlay(a, {
|
||||
x: 13, y: 17,
|
||||
style: 'white'
|
||||
}).overlay(posse, {
|
||||
x: 5, y: 20,
|
||||
style: 'bright_black',
|
||||
transparent: true
|
||||
}).overlay(height, {
|
||||
x: 59, y: 3,
|
||||
style: 'bright_black',
|
||||
transparent: true
|
||||
}).overlay(weight, {
|
||||
x: 59, y: 8,
|
||||
style: 'bright_black',
|
||||
transparent: true
|
||||
}).overlay(table, {
|
||||
x: 6, y: -6,
|
||||
style: 'bright_black',
|
||||
transparent: true
|
||||
}, (_final: any) => {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
art.Figlet.fontPath = 'Fonts';
|
||||
|
||||
const image = new art.Image({
|
||||
filepath: '~/Images/metropolis.jpg',
|
||||
alphabet: 'variant4'
|
||||
});
|
||||
image.write((_err: any, _rendered: string) => {
|
||||
});
|
||||
|
||||
art.font('Prompt', 'Basic', 'red').font('v1', 'Doom', 'magenta', (_rendered) => {
|
||||
});
|
||||
|
||||
art.image({
|
||||
width : 40,
|
||||
filepath : '/Images/initech.png',
|
||||
alphabet : 'wide'
|
||||
}).font('INITECH', 'Doom', 'cyan', (_ascii) => {
|
||||
});
|
||||
|
||||
art.style('my text', 'red+underline');
|
||||
|
||||
art.table({
|
||||
width : 80,
|
||||
data : [ /* ... */ ],
|
||||
verticalBar : ' ',
|
||||
horizontalBar : ' ',
|
||||
intersection : ' ',
|
||||
columns : [
|
||||
{
|
||||
value : 'Product',
|
||||
style : 'black+gray_bg'
|
||||
}, {
|
||||
value : 'Maker',
|
||||
style : 'white'
|
||||
}, {
|
||||
value : 'Location',
|
||||
style : 'white'
|
||||
}
|
||||
]
|
||||
}, (_rendered) => {
|
||||
// use rendered text
|
||||
});
|
||||
|
||||
art.table({
|
||||
width : 80,
|
||||
data : [ /* ... */ ],
|
||||
bars : {
|
||||
ul_corner: '┏',
|
||||
ur_corner: '┓',
|
||||
lr_corner: '┛',
|
||||
ll_corner: '┗',
|
||||
bottom_t: '┻',
|
||||
top_t: '┳',
|
||||
right_t: '┫',
|
||||
left_t: '┣',
|
||||
intersection: '╋',
|
||||
vertical: '┃',
|
||||
horizontal: '━',
|
||||
},
|
||||
borderColor : 'bright_white',
|
||||
}, (_rendered) => {
|
||||
// use rendered text
|
||||
});
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
// Type definitions for ascii-art 1.4
|
||||
// Project: https://github.com/khrome/ascii-art
|
||||
// Definitions by: Lukas Elmer <https://github.com/lukaselmer>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export type StyleType = (text: string, style?: string, close?: boolean) => Art;
|
||||
export type FontType = ((text: string, font?: string, styleOrCallback?: string | Cb, callback?: Cb) => Art);
|
||||
export type ImageType = (options: object, callback?: Cb) => Art;
|
||||
export type TableType = (options: object, callback?: Cb) => Art;
|
||||
export type ArtworkType = (options: object, callback?: Cb) => Art;
|
||||
export type LinesType = (...options: any[]) => Art;
|
||||
export type OverlayType = (...options: any[]) => Art;
|
||||
export type JoinType = (...options: any[]) => Art;
|
||||
export type StringsType = (...options: any[]) => Art;
|
||||
|
||||
export const style: StyleType;
|
||||
export const font: FontType;
|
||||
export const image: ImageType;
|
||||
export const table: TableType;
|
||||
export const artwork: ArtworkType;
|
||||
export const lines: LinesType;
|
||||
export const overlay: OverlayType;
|
||||
export const join: JoinType;
|
||||
export const strings: StringsType;
|
||||
export const Figlet: any;
|
||||
export const Image: any;
|
||||
|
||||
export interface Art {
|
||||
style: StyleType;
|
||||
font: FontType;
|
||||
image: ImageType;
|
||||
table: TableType;
|
||||
artwork: ArtworkType;
|
||||
lines: LinesType;
|
||||
overlay: OverlayType;
|
||||
join: JoinType;
|
||||
working: boolean;
|
||||
|
||||
toPromise: (() => Promise<string>);
|
||||
}
|
||||
|
||||
export type Cb = (result: string) => void;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ascii-art-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"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" />
|
||||
|
||||
|
||||
@@ -203,3 +203,26 @@ management.linkUsers('primaryId', { user_id: 'secondaryId' })
|
||||
management.linkUsers('primaryId', { user_id: 'secondaryId' },
|
||||
(err: Error, result: any) => {});
|
||||
|
||||
// Get all clients (with promise)
|
||||
management.getClients()
|
||||
.then((clients: auth0.Client[]) => {
|
||||
console.log(clients);
|
||||
})
|
||||
.catch((err) => {
|
||||
// Handle the error
|
||||
});
|
||||
|
||||
//Get all clients (with callback)
|
||||
management.getClients((err: Error, clients: auth0.Client[]) => {});
|
||||
|
||||
// Get all clients with params (with promise)
|
||||
management.getClients({fields:['name','client_metadata'], include_fields:true})
|
||||
.then((clients: auth0.Client[]) => {
|
||||
console.log(clients);
|
||||
})
|
||||
.catch((err) => {
|
||||
// Handle the error
|
||||
});
|
||||
|
||||
// Get all cients with params (with callback)
|
||||
management.getClients({fields:['name','client_metadata'], include_fields:true}, (err:Error, clients:auth0.Client[]) => {});
|
||||
|
||||
Vendored
+17
-4
@@ -1,6 +1,6 @@
|
||||
// Type definitions for auth0 2.9.2
|
||||
// Project: https://github.com/auth0/node-auth0
|
||||
// Definitions by: Wilson Hobbs <https://github.com/wbhob>, Seth Westphal <https://github.com/westy92>, Amiram Korach <https://github.com/amiram>
|
||||
// Definitions by: Seth Westphal <https://github.com/westy92>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -588,7 +588,19 @@ export interface ImpersonateSettingOptions {
|
||||
clientId?: string;
|
||||
}
|
||||
|
||||
|
||||
export type ClientAppType = 'native' | 'spa' | 'regular_web' | 'non_interactive' | 'rms' | 'box' |
|
||||
'cloudbees' | 'concur' | 'dropbox' | 'mscrm' | 'echosign' | 'egnyte' | 'newrelic' | 'office365' |
|
||||
'salesforce' | 'sentry' | 'sharepoint' | 'slack' | 'springcm' | 'zendesk' | 'zoom';
|
||||
export interface GetClientsOptions {
|
||||
fields?: string[];
|
||||
include_fields?: boolean;
|
||||
page?: number;
|
||||
per_page?: number;
|
||||
include_totals?: boolean;
|
||||
is_global?: boolean;
|
||||
is_first_party?: boolean;
|
||||
app_type?: ClientAppType[];
|
||||
}
|
||||
|
||||
export class AuthenticationClient {
|
||||
|
||||
@@ -661,8 +673,9 @@ export class ManagementClient {
|
||||
|
||||
|
||||
// Clients
|
||||
getClients(): Promise<Client[]>;
|
||||
getClients(cb: (err: Error, clients: Client[]) => void): void;
|
||||
getClients(params?: GetClientsOptions): Promise<Client[]>;
|
||||
getClients(cb: (err: Error, clients: Client[]) => void ): void;
|
||||
getClients(params: GetClientsOptions, cb: (err: Error, clients: Client[]) => void ): void;
|
||||
|
||||
getClient(params: ClientParams): Promise<Client>;
|
||||
getClient(params: ClientParams, cb: (err: Error, client: Client) => void): void;
|
||||
|
||||
Vendored
+2
@@ -190,6 +190,8 @@ declare namespace autobahn {
|
||||
export class Connection {
|
||||
constructor(options?: IConnectionOptions);
|
||||
|
||||
isOpen: boolean;
|
||||
|
||||
open(): void;
|
||||
|
||||
close(reason?: string, message?: string): void;
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/postcss/autoprefixer
|
||||
// Definitions by: Armando Meziat <https://github.com/odnamrataizem>, murt <https://github.com/murt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { Plugin } from "postcss";
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -46,6 +46,7 @@ export type PluginName =
|
||||
'estree' |
|
||||
'jsx' |
|
||||
'flow' |
|
||||
'typescript' |
|
||||
'classConstructorCall' |
|
||||
'doExpressions' |
|
||||
'objectRestSpread' |
|
||||
|
||||
Vendored
+41
@@ -1,6 +1,7 @@
|
||||
// Type definitions for better-scroll 1.12
|
||||
// Project: https://github.com/ustbhuangyi/better-scroll
|
||||
// Definitions by: cloudstone <https://github.com/stoneChen>
|
||||
// jack <https://github.com/cnjack>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.2
|
||||
@@ -42,6 +43,24 @@ export interface PullUpOption {
|
||||
threshold: number;
|
||||
}
|
||||
|
||||
export interface MouseWheelOption {
|
||||
speed: number;
|
||||
invert: boolean;
|
||||
easeTime: number;
|
||||
}
|
||||
|
||||
export interface ZoomOption {
|
||||
start: number;
|
||||
min: number;
|
||||
max: number;
|
||||
}
|
||||
|
||||
export interface InfinityOption {
|
||||
fetch: (count: number) => void;
|
||||
render: (item: any, div: Element) => Element;
|
||||
createTombstone: () => Element;
|
||||
}
|
||||
|
||||
export interface BounceObjectOption {
|
||||
top?: boolean;
|
||||
bottom?: boolean;
|
||||
@@ -49,6 +68,10 @@ export interface BounceObjectOption {
|
||||
right?: boolean;
|
||||
}
|
||||
|
||||
export interface DoubleClick {
|
||||
delay: number;
|
||||
}
|
||||
|
||||
export interface EaseOption {
|
||||
swipe?: {
|
||||
style: string;
|
||||
@@ -73,6 +96,7 @@ export interface BsOption {
|
||||
directionLockThreshold: number;
|
||||
eventPassthrough: string | boolean;
|
||||
click: boolean;
|
||||
dblclick: boolean | DoubleClick;
|
||||
tap: boolean;
|
||||
bounce: boolean | BounceObjectOption;
|
||||
bounceTime: number;
|
||||
@@ -140,6 +164,23 @@ export interface BsOption {
|
||||
* }
|
||||
*/
|
||||
pullUpLoad: Partial<PullUpOption> | boolean;
|
||||
|
||||
// mouseWheel: {
|
||||
// speed: 20,
|
||||
// invert: false,
|
||||
// easeTime: 300
|
||||
// }
|
||||
mouseWheel: Partial<MouseWheelOption> | boolean;
|
||||
|
||||
// zoom: {
|
||||
// start: 1,
|
||||
// min: 1,
|
||||
// max: 4
|
||||
// }
|
||||
zoom: Partial<ZoomOption> | boolean;
|
||||
|
||||
// https://ustbhuangyi.github.io/better-scroll/doc/zh-hans/options-advanced.html
|
||||
infinity: Partial<InfinityOption> | boolean;
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
|
||||
Vendored
+1
-1
@@ -45,7 +45,7 @@ interface ReductionContext {
|
||||
declare class BN {
|
||||
constructor(
|
||||
number: number | string | number[] | Buffer | BN,
|
||||
base?: number,
|
||||
base?: number | 'hex',
|
||||
endian?: Endianness
|
||||
);
|
||||
constructor(
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import 'bootstrap-toggle';
|
||||
|
||||
const $elem = $("#toggle");
|
||||
|
||||
// Test Initialise Cases
|
||||
$elem.bootstrapToggle();
|
||||
|
||||
$elem.bootstrapToggle({});
|
||||
|
||||
$elem.bootstrapToggle({
|
||||
// Defaults from source project
|
||||
on: 'On',
|
||||
off: 'Off',
|
||||
onstyle: 'primary',
|
||||
offstyle: 'default',
|
||||
size: 'normal',
|
||||
style: '',
|
||||
width: null,
|
||||
height: null
|
||||
});
|
||||
|
||||
$elem.bootstrapToggle({
|
||||
width: 100,
|
||||
height: 100
|
||||
});
|
||||
|
||||
$elem.bootstrapToggle({
|
||||
width: "100%",
|
||||
height: "100%"
|
||||
});
|
||||
|
||||
// Methods
|
||||
$elem.bootstrapToggle("destroy");
|
||||
$elem.bootstrapToggle("on");
|
||||
$elem.bootstrapToggle("off");
|
||||
$elem.bootstrapToggle("toggle");
|
||||
$elem.bootstrapToggle("enable");
|
||||
$elem.bootstrapToggle("disable");
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// Type definitions for bootstrap-toggle 2.2
|
||||
// Project: https://github.com/minhur/bootstrap-toggle
|
||||
// Definitions by: Mitchell Grice <https://github.com/gricey432>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery"/>
|
||||
|
||||
interface BootstrapToggleOptions {
|
||||
on?: string;
|
||||
off?: string;
|
||||
size?: string;
|
||||
onstyle?: string;
|
||||
offstyle?: string;
|
||||
style?: string;
|
||||
width?: number | string | null;
|
||||
height?: number | string | null;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
bootstrapToggle(options?: BootstrapToggleOptions): JQuery;
|
||||
bootstrapToggle(command: "destroy" | "on" | "off" | "toggle" | "enable" | "disable"): JQuery;
|
||||
}
|
||||
@@ -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",
|
||||
"bootstrap-toggle-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import * as caniuse from "caniuse-api";
|
||||
|
||||
caniuse.features; // $ExpectType string[]
|
||||
|
||||
caniuse.getSupport(""); // $ExpectType BrowserSupport
|
||||
|
||||
caniuse.isSupported("", ""); // $ExpectType boolean
|
||||
caniuse.isSupported("", [""]); // $ExpectType boolean
|
||||
|
||||
caniuse.find(""); // $ExpectType string[]
|
||||
|
||||
caniuse.getLatestStableBrowsers(); // $ExpectType string[]
|
||||
|
||||
caniuse.setBrowserScope(""); // $ExpectType void
|
||||
caniuse.setBrowserScope([""]); // $ExpectType void
|
||||
|
||||
caniuse.getBrowserScope(); // $ExpectType string[]
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
// Type definitions for caniuse-api 3.0
|
||||
// Project: https://github.com/nyalab/caniuse-api#readme
|
||||
// Definitions by: Dave Cardwell <https://github.com/davecardwell>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export const features: string[];
|
||||
|
||||
export interface BrowserSupport {
|
||||
[browser: string]: {
|
||||
y?: number;
|
||||
n?: number;
|
||||
a?: number;
|
||||
x?: number;
|
||||
};
|
||||
}
|
||||
|
||||
export function getSupport(feature: string): BrowserSupport;
|
||||
|
||||
export function isSupported(
|
||||
feature: string,
|
||||
browsers: string | ReadonlyArray<string>
|
||||
): boolean;
|
||||
|
||||
export function find(query: string): string[];
|
||||
|
||||
export function getLatestStableBrowsers(): string[];
|
||||
|
||||
export function setBrowserScope(
|
||||
browserscope: string | ReadonlyArray<string>
|
||||
): void;
|
||||
|
||||
export function getBrowserScope(): string[];
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "caniuse-api-tests.ts"]
|
||||
}
|
||||
@@ -67,6 +67,10 @@ function test_disabled() {
|
||||
expect($('#foo')).to.be.disabled;
|
||||
}
|
||||
|
||||
function test_enabled() {
|
||||
expect($('#foo')).to.be.enabled;
|
||||
}
|
||||
|
||||
function test_empty() {
|
||||
$('.empty').should.be.empty;
|
||||
expect($('body')).not.to.be.empty;
|
||||
|
||||
Vendored
+1
@@ -25,6 +25,7 @@ declare namespace Chai {
|
||||
selected(): Assertion;
|
||||
checked(): Assertion;
|
||||
disabled(): Assertion;
|
||||
enabled(): Assertion;
|
||||
(selector: string): Assertion;
|
||||
}
|
||||
|
||||
|
||||
@@ -808,6 +808,24 @@ function frozen() {
|
||||
expect(Object.freeze({})).to.be.frozen;
|
||||
({}).should.be.not.frozen;
|
||||
Object.freeze({}).should.be.frozen;
|
||||
|
||||
expect([1, 2, 3]).to.have.all.members([1, 2, 3]);
|
||||
expect([1, 2, 3]).to.have.all.members(Object.freeze([1, 2, 3]));
|
||||
|
||||
expect({1: "", 2: "", 3: ""}).to.have.all.keys([1, 2, 3]);
|
||||
expect({1: "", 2: "", 3: ""}).to.have.all.keys(Object.freeze([1, 2, 3]));
|
||||
|
||||
assert.notDeepInclude([1, 2, 3], 1);
|
||||
assert.notDeepInclude(Object.freeze([1, 2, 3]), 1);
|
||||
|
||||
assert.include([1, 2, 3], 1);
|
||||
assert.include(Object.freeze([1, 2, 3]), 1);
|
||||
|
||||
assert.notInclude([1, 2, 3], 1);
|
||||
assert.notInclude(Object.freeze([1, 2, 3]), 1);
|
||||
|
||||
expect([1, 2, 3]).to.have.oneOf([1, 2, 3]);
|
||||
expect([1, 2, 3]).to.have.oneOf(Object.freeze([1, 2, 3]));
|
||||
}
|
||||
|
||||
class PoorlyConstructedError {
|
||||
|
||||
Vendored
+6
-6
@@ -118,7 +118,7 @@ declare namespace Chai {
|
||||
extensible: Assertion;
|
||||
sealed: Assertion;
|
||||
frozen: Assertion;
|
||||
oneOf(list: any[], message?: string): Assertion;
|
||||
oneOf(list: ReadonlyArray<any>, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface LanguageChains {
|
||||
@@ -235,7 +235,7 @@ declare namespace Chai {
|
||||
|
||||
interface Keys {
|
||||
(...keys: string[]): Assertion;
|
||||
(keys: any[]|Object): Assertion;
|
||||
(keys: ReadonlyArray<any>|Object): Assertion;
|
||||
}
|
||||
|
||||
interface Throw {
|
||||
@@ -252,7 +252,7 @@ declare namespace Chai {
|
||||
}
|
||||
|
||||
interface Members {
|
||||
(set: any[], message?: string): Assertion;
|
||||
(set: ReadonlyArray<any>, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface PropertyChange {
|
||||
@@ -696,7 +696,7 @@ declare namespace Chai {
|
||||
* @param needle Potential value contained in haystack.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
include<T>(haystack: T[], needle: T, message?: string): void;
|
||||
include<T>(haystack: ReadonlyArray<T>, needle: T, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that haystack does not include needle.
|
||||
@@ -705,7 +705,7 @@ declare namespace Chai {
|
||||
* @param needle Potential expected substring of haystack.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
notInclude(haystack: string | any[], needle: any, message?: string): void;
|
||||
notInclude(haystack: string | ReadonlyArray<any>, needle: any, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that haystack includes needle. Can be used to assert the inclusion of a value in an array or a subset of properties in an object. Deep equality is used.
|
||||
@@ -732,7 +732,7 @@ declare namespace Chai {
|
||||
* @param needle Potential expected substring of haystack.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
notDeepInclude(haystack: string | any[], needle: any, message?: string): void;
|
||||
notDeepInclude(haystack: string | ReadonlyArray<any>, needle: any, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Song, HtmlTableFormatter } from 'chordsheetjs';
|
||||
|
||||
const song = new Song({ key: 'value' });
|
||||
const formatter = new HtmlTableFormatter();
|
||||
formatter.format(song);
|
||||
Vendored
+372
@@ -0,0 +1,372 @@
|
||||
// Type definitions for chordsheetjs 2.8
|
||||
// Project: https://github.com/martijnversluis/ChordSheetJS
|
||||
// Definitions by: Adam Bloom <https://github.com/adamsbloom>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/**
|
||||
* Represents a chord with the corresponding (partial) lyrics
|
||||
*/
|
||||
export class ChordLyricsPair {
|
||||
/**
|
||||
* Initialises a ChordLyricsPair
|
||||
* @param chords The chords
|
||||
* @param lyrics The lyrics
|
||||
*/
|
||||
constructor(chords: string, lyrics: string);
|
||||
|
||||
chords: string;
|
||||
lyrics: string;
|
||||
|
||||
/**
|
||||
* Indicates whether a ChordLyricsPair should be visible in a formatted chord sheet (except for ChordPro sheets)
|
||||
*/
|
||||
isRenderable: () => boolean;
|
||||
|
||||
/**
|
||||
* Returns a deep copy of the ChordLyricsPair, useful when programmatically transforming a song
|
||||
*/
|
||||
clone: () => ChordLyricsPair;
|
||||
|
||||
toString: () => string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a tag/directive. See https://www.chordpro.org/chordpro/ChordPro-Directives.html
|
||||
*/
|
||||
export class Tag {
|
||||
constructor(name: string, value: string | null);
|
||||
|
||||
/**
|
||||
* The tag full name. When the original tag used the short name, `name` will return the full name.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The tag value
|
||||
*/
|
||||
value: string | null;
|
||||
|
||||
static parse(tag: string): Tag | null;
|
||||
static parseWithRegex(tag: string, regex: string): Tag | null;
|
||||
|
||||
/**
|
||||
* The original tag name that was used to construct the tag.
|
||||
*/
|
||||
originalName: string;
|
||||
|
||||
/**
|
||||
* Checks whether the tag value is a non-empty string.
|
||||
*/
|
||||
hasValue(): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the tag is usually rendered inline. It currently only applies to comment tags.
|
||||
*/
|
||||
isRenderable(): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the tag is either a standard meta tag or a custom meta directive (`{x_some_name}`)
|
||||
*/
|
||||
isMetaTag(): boolean;
|
||||
|
||||
/**
|
||||
* Returns a clone of the tag.
|
||||
*/
|
||||
clone(): Tag;
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a line in a chord sheet, consisting of items of type ChordLyricsPair or Tag
|
||||
*/
|
||||
export class Line {
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* The items (ChordLyricsPair or Tag) of which the line consists
|
||||
*/
|
||||
items: Array<ChordLyricsPair | Tag>;
|
||||
|
||||
/**
|
||||
* The line type, This is set by the ChordProParser when it read tags like {start_of_chorus} or {start_of_verse}
|
||||
* Values can be 'verse', 'chorus' or 'none'
|
||||
*/
|
||||
type: 'verse' | 'chorus' | 'none';
|
||||
|
||||
/**
|
||||
* Indicates whether the line contains any items
|
||||
*/
|
||||
isEmpty(): boolean;
|
||||
|
||||
/**
|
||||
* Adds an item to the line
|
||||
* @param item The item to be added
|
||||
*/
|
||||
addItem(item: ChordLyricsPair | Tag): void;
|
||||
|
||||
/**
|
||||
* Indicates whether the line contains items that are renderable
|
||||
*/
|
||||
hasRenderableItems(): boolean;
|
||||
|
||||
/**
|
||||
* Returns a deep copy of the line and all of its items
|
||||
*/
|
||||
clone(): Line;
|
||||
|
||||
/**
|
||||
* Indicates whether the line type is 'verse'
|
||||
*/
|
||||
isVerse(): boolean;
|
||||
|
||||
/**
|
||||
* Indicates whether the line type is 'chorus'
|
||||
*/
|
||||
isChorus(): boolean;
|
||||
|
||||
/**
|
||||
* Indicates whether the line contains items that are renderable. Please use hasRenderableItems
|
||||
* @deprecated
|
||||
*/
|
||||
hasContent(): boolean;
|
||||
|
||||
addChordLyricsPair(
|
||||
chords: ChordLyricsPair | string,
|
||||
lyrics: string
|
||||
): ChordLyricsPair;
|
||||
ensureChordLyricsPair(): void;
|
||||
chords(chr: string): void;
|
||||
lyrics(chr: string): void;
|
||||
addTag(name: Tag | string, value: string | null): Tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a paragraph of lines in a chord sheet
|
||||
*/
|
||||
export class Paragraph {
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* The Line items of which the paragraph consists
|
||||
*/
|
||||
lines: Line[];
|
||||
|
||||
addLine(line: Line): void;
|
||||
|
||||
/**
|
||||
* Tries to determine the common type for all lines. If the types for all lines are equal, it returns that type.
|
||||
* If not, it returns 'indeterminate'.
|
||||
*/
|
||||
type: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a song in a chord sheet. Currently a chord sheet can only have one song.
|
||||
*/
|
||||
export class Song {
|
||||
constructor(metadata: object);
|
||||
|
||||
/**
|
||||
* The Line items of which the song consists
|
||||
*/
|
||||
lines: Line[];
|
||||
|
||||
/**
|
||||
* The Paragraph items of which the song consists
|
||||
*/
|
||||
paragraphs: Paragraph[];
|
||||
|
||||
currentLine: Line;
|
||||
currentParagraph: Paragraph;
|
||||
assignMetaData(metadata: object): void;
|
||||
|
||||
/**
|
||||
* Returns the song lines, skipping the leading empty lines (empty as in not rendering any content). This is useful
|
||||
* if you want to skip the "header lines": the lines that only contain meta data.
|
||||
*/
|
||||
bodyLines: Line[];
|
||||
|
||||
chords(chr: string): void;
|
||||
lyrics(chr: string): void;
|
||||
addLine(): Line;
|
||||
setCurrentLineType(type: string): void;
|
||||
flushLine(): void;
|
||||
finish(): void;
|
||||
addChordLyricsPair(): ChordLyricsPair;
|
||||
ensureLine(): void;
|
||||
addParagraph(): Paragraph;
|
||||
ensureParagraph(): void;
|
||||
addTag(tagContents: string): Tag;
|
||||
|
||||
/**
|
||||
* Returns a deep clone of the song
|
||||
*/
|
||||
clone(): Song;
|
||||
|
||||
setMetaData(name: string, value: string): void;
|
||||
metaData: object;
|
||||
optimizedMetaData: object;
|
||||
getOptimizedMetaData(): object;
|
||||
optimizeMetaDataValue(
|
||||
valueSet: string[] | undefined
|
||||
): string | string[] | null;
|
||||
getMetaData(name: string): string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a parser warning, currently only used by ChordProParser.
|
||||
*/
|
||||
export class ParserWarning {
|
||||
/**
|
||||
* The warning message
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
* The line number on which the warning occurred
|
||||
*/
|
||||
lineNumber: string;
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a ChordPro chord sheet
|
||||
*/
|
||||
export class ChordProParser {
|
||||
/**
|
||||
* Parses a ChordPro chord sheet into a song
|
||||
* @param chordProChordSheet The ChordPro chord sheet
|
||||
*/
|
||||
parse(chordProChordSheet: string): Song;
|
||||
|
||||
song: Song;
|
||||
lineNumber: number;
|
||||
sectionType: string;
|
||||
warnings: ParserWarning[];
|
||||
|
||||
parseDocument(document: string): void;
|
||||
readLyrics(chr: string): void;
|
||||
readChords(chr: string): void;
|
||||
readTag(chr: string): void;
|
||||
readComment(chr: string): void;
|
||||
finishTag(): void;
|
||||
resetTag(): void;
|
||||
applyTag(tag: Tag): void;
|
||||
startSection(sectionType: string, tag: Tag): void;
|
||||
endSection(sectionType: string, tag: Tag): void;
|
||||
checkCurrentSectionType(sectionType: string, tag: Tag): void;
|
||||
addWarning(message: string): void;
|
||||
}
|
||||
|
||||
export interface ChordSheetParserProps {
|
||||
preserveWhitespace: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a song into a plain text chord sheet
|
||||
*/
|
||||
export class ChordSheetParser {
|
||||
constructor(props: ChordSheetParserProps);
|
||||
|
||||
song: Song;
|
||||
lines: Line[];
|
||||
songLine: Line;
|
||||
chordLyricsPair: ChordLyricsPair;
|
||||
currentLine: number;
|
||||
lineCount: number;
|
||||
processingText: string;
|
||||
preserveWhitespace: boolean;
|
||||
|
||||
/**
|
||||
* Parses a chord sheet into a song
|
||||
* @param chordSheet The ChordPro chord sheet
|
||||
*/
|
||||
parse(chordSheet: string): Song;
|
||||
|
||||
parseLine(line: string): void;
|
||||
parseNonEmptyLine(line: string): void;
|
||||
initialize(document: string): void;
|
||||
readLine(): Line;
|
||||
hasNextLine(): boolean;
|
||||
parseLyricsWithChords(chordsLine: string, lyricsLine: string): void;
|
||||
processCharacters(chordsLine: string, lyricsLine: string): void;
|
||||
addCharacter(chr: string, nextChar: string): void;
|
||||
shouldAddCharacterToChords(nextChar: string): boolean;
|
||||
ensureChordLyricsPairInitialized(): void;
|
||||
}
|
||||
|
||||
export interface SongHeader {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
}
|
||||
|
||||
export class TextFormatter {
|
||||
constructor();
|
||||
/**
|
||||
* Formats a song into a plain text chord sheet
|
||||
* @param song The song to be formatted
|
||||
*/
|
||||
format(song: Song): string;
|
||||
formatHeader(header: SongHeader): string;
|
||||
formatParagraphs(song: Song): string;
|
||||
formatParagraph(paragraph: Paragraph): string;
|
||||
formatLine(line: Line): string;
|
||||
formatTitle(title: string): string;
|
||||
formatSubtitle(subtitle: string): string;
|
||||
formatTopLine(line: Line): string | null;
|
||||
chordLyricsPairLength(chordLyricsPair: ChordLyricsPair): number;
|
||||
formatItemTop(item: Tag | ChordLyricsPair | Line): string;
|
||||
formatLineBottom(line: Line): string;
|
||||
formatLineWithFormatter(
|
||||
line: Line,
|
||||
formatter: (x: string) => string
|
||||
): string;
|
||||
formatItemBottom(item: Tag | ChordLyricsPair | Line): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like
|
||||
* PDF conversion.
|
||||
*/
|
||||
export class HtmlTableFormatter {
|
||||
constructor();
|
||||
/**
|
||||
* Formats a song into HTML.
|
||||
* @param song The song to be formatted
|
||||
*/
|
||||
format(song: Song): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages.
|
||||
*/
|
||||
export class HtmlDivFormatter {
|
||||
constructor();
|
||||
/**
|
||||
* Formats a song into HTML.
|
||||
* @param song The song to be formatted
|
||||
*/
|
||||
format(song: Song): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a song into a ChordPro chord sheet
|
||||
*/
|
||||
export class ChordProFormatter {
|
||||
constructor();
|
||||
/**
|
||||
* Formats a song into a ChordPro chord sheet.
|
||||
* @param song The song to be formatted
|
||||
*/
|
||||
format(song: Song): string;
|
||||
|
||||
formatLine(line: Line): string;
|
||||
formatItem(item: Tag | ChordLyricsPair | Line): string;
|
||||
formatTag(tag: Tag): string;
|
||||
formatChordLyricsPair(chordLyricsPair: ChordLyricsPair): string;
|
||||
formatChordLyricsPairChords(chordLyricsPair: ChordLyricsPair): string;
|
||||
formatChordLyricsPairLyrics(chordLyricsPair: ChordLyricsPair): string;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "chordsheetjs-tests.ts"]
|
||||
}
|
||||
Vendored
+79
-40
@@ -612,7 +612,10 @@ declare namespace chrome {
|
||||
* @deprecated Deprecated since Chrome 36. Use innerBounds or outerBounds.
|
||||
*/
|
||||
maxHeight?: integer;
|
||||
/** Type of window to create */
|
||||
/**
|
||||
* @deprecated Deprecated since Chrome 69. All app windows use the 'shell' window type.
|
||||
* @description Type of window to create
|
||||
**/
|
||||
type?: 'shell';
|
||||
/**
|
||||
* If true, the window will have its own shelf icon.
|
||||
@@ -919,7 +922,8 @@ declare namespace chrome {
|
||||
level?: integer;
|
||||
}
|
||||
/**
|
||||
* Device properties by which to filter the list of returned audio devices. If the filter is not set or set to {}, returned device list will contain all available audio devices.
|
||||
* Device properties by which to filter the list of returned audio devices.
|
||||
* If the filter is not set or set to {}, returned device list will contain all available audio devices.
|
||||
*/
|
||||
interface Filter {
|
||||
/**
|
||||
@@ -1083,8 +1087,9 @@ declare namespace chrome {
|
||||
function getDevices(callback: (devices: Device[]) => void): void;
|
||||
|
||||
/**
|
||||
* Get a list of Bluetooth devices known to the system, including paired and recently discovered devices.
|
||||
* @param filter Since Chrome 67. Some criteria to filter the list of returned bluetooth devices. If the filter is not set or set to {}, returned device list will contain all bluetooth devices. Right now this is only supported in ChromeOS, for other platforms, a full list is returned.
|
||||
* @since Chrome 67.
|
||||
* @description Get a list of Bluetooth devices known to the system, including paired and recently discovered devices.
|
||||
* @param filter Some criteria to filter the list of returned bluetooth devices. If the filter is not set or set to {}, returned device list will contain all bluetooth devices. Right now this is only supported in ChromeOS, for other platforms, a full list is returned.
|
||||
* @param callback Called when the search is completed.
|
||||
*/
|
||||
function getDevices(filter: DeviceFilter, callback: (devices: Device[]) => void): void;
|
||||
@@ -2082,12 +2087,12 @@ declare namespace chrome {
|
||||
/**
|
||||
* **Dev channel only.**
|
||||
* Sets image data to clipboard
|
||||
* @param imageData The encoded image data. *Since Chrome 70. Warning: this is the current Beta channel.*
|
||||
* @param type The type of image being passed. *Since Chrome 70. Warning: this is the current Beta channel.*
|
||||
* @param imageData The encoded image data. *Since Chrome 71. Warning: this is the current Dev channel.*
|
||||
* @param type The type of image being passed. *Since Chrome 71. Warning: this is the current Dev channel.*
|
||||
* @param [additionalItems] Additional data items for describing image data.
|
||||
* The callback is called with chrome.runtime.lastError set to error code if there is an error.
|
||||
* Requires clipboard and clipboardWrite permissions.
|
||||
* *Since Chrome 70. Warning: this is the current Beta channel.*
|
||||
* *Since Chrome 71. Warning: this is the current Dev channel.*
|
||||
* @param [callback]
|
||||
*/
|
||||
function setImageData(imageData: ArrayBuffer, type: ImageType, additionalItems?: AdditionalItems, callback?: () => void): void;
|
||||
@@ -3078,7 +3083,8 @@ declare namespace chrome {
|
||||
'document_end' |
|
||||
'document_idle';
|
||||
/**
|
||||
* The origin of injected CSS.
|
||||
* @since Chrome 66.
|
||||
* @description The origin of injected CSS.
|
||||
**/
|
||||
type CSSOrigin =
|
||||
'author' |
|
||||
@@ -5968,6 +5974,11 @@ declare namespace chrome {
|
||||
SSID?: S;
|
||||
/** The network signal strength. */
|
||||
SignalStrength?: integer;
|
||||
/**
|
||||
* @since Chrome 70
|
||||
* @description The tethering state associated with the connection.
|
||||
*/
|
||||
TetheringState?: string;
|
||||
}
|
||||
interface WiFiProperties<M extends ManagedObject = 'unmanaged',
|
||||
OF extends _internal_.ObjectFunction = 'getter',
|
||||
@@ -6379,8 +6390,8 @@ declare namespace chrome {
|
||||
progress?: integer;
|
||||
|
||||
/**
|
||||
* Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification.
|
||||
* @since Chrome 32.
|
||||
* @deprecated Deprecated since Chrome 67. This UI hint is ignored as of Chrome 67
|
||||
* @description Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification.
|
||||
*/
|
||||
isClickable?: boolean;
|
||||
|
||||
@@ -6391,6 +6402,13 @@ declare namespace chrome {
|
||||
* @since Chrome 50
|
||||
*/
|
||||
requireInteraction?: boolean;
|
||||
|
||||
/**
|
||||
* @since Chrome 70.
|
||||
* @description Indicates that no sounds or vibrations should be made when the notification is being shown.
|
||||
* @default false
|
||||
*/
|
||||
silent?: boolean;
|
||||
}
|
||||
|
||||
/** The notification closed, either by the system or by user action. */
|
||||
@@ -6405,8 +6423,10 @@ declare namespace chrome {
|
||||
*/
|
||||
const onPermissionLevelChanged: chrome.events.Event<(level: string) => void>;
|
||||
/**
|
||||
* The user clicked on a link for the app's notification settings.
|
||||
* @since Chrome 32.
|
||||
* @deprecated Deprecated since Chrome 65. Custom notification settings button is no longer supported.
|
||||
* @description The user clicked on a link for the app's notification settings.
|
||||
* As of Chrome 47, only ChromeOS has UI that dispatches this event.
|
||||
* As of Chrome 65, that UI has been removed from ChromeOS, too.
|
||||
*/
|
||||
const onShowSettings: chrome.events.Event<() => void>;
|
||||
|
||||
@@ -9319,7 +9339,10 @@ declare namespace chrome {
|
||||
/** The display mode height in native pixels. */
|
||||
heightInNativePixels: integer;
|
||||
|
||||
/** The display mode UI scale factor. */
|
||||
/**
|
||||
* @deprecated Deprecated since Chrome 70. Use `displayZoomFactor`
|
||||
* @description The display mode UI scale factor.
|
||||
**/
|
||||
uiScale: integer;
|
||||
|
||||
/** The display mode device scale factor. */
|
||||
@@ -9380,15 +9403,16 @@ declare namespace chrome {
|
||||
* If set to true, changes the display mode to unified desktop.
|
||||
* If set to false, unified desktop mode will be disabled.
|
||||
* This is only valid for the primary display.
|
||||
* If provided, mirroringSourceId must not be provided and other properties may not apply. This is has no effect if not provided.
|
||||
* @see(See enableUnifiedDesktop for details).
|
||||
* If provided, mirroringSourceId must not be provided and other properties may not apply.
|
||||
* This is has no effect if not provided.
|
||||
* @see(See `enableUnifiedDesktop` for details).
|
||||
* @since Chrome 59
|
||||
* */
|
||||
isUnified?: boolean;
|
||||
|
||||
/**
|
||||
* @requires(CrOS) Chrome OS only.
|
||||
* @deprecated Deprecated since Chrome 68. Use *setMirrorMode*
|
||||
* @deprecated Deprecated since Chrome 68. Use ´setMirrorMode´
|
||||
* @see setMirrorMode
|
||||
* @description
|
||||
* If set and not empty, enables mirroring for this display.
|
||||
@@ -9416,7 +9440,7 @@ declare namespace chrome {
|
||||
* If set, updates the display's rotation.
|
||||
* Legal values are [0, 90, 180, 270].
|
||||
* The rotation is set clockwise, relative to the display's vertical position.
|
||||
* It's applied after overscan paramter.
|
||||
* It's applied after overscan parameter.
|
||||
*/
|
||||
rotation?: 0 | 90 | 180 | 270;
|
||||
|
||||
@@ -9912,10 +9936,10 @@ declare namespace chrome {
|
||||
/** The language that this voice supports, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */
|
||||
lang?: string;
|
||||
/**
|
||||
* This voice's gender.
|
||||
* One of: 'male', or 'female'
|
||||
* @deprecated Deprecated since Chrome 70. Gender is deprecated and will be ignored.
|
||||
* @description This voice's gender.
|
||||
*/
|
||||
gender?: string;
|
||||
gender?: 'male' | 'female';
|
||||
/** The name of the voice. */
|
||||
voiceName?: string;
|
||||
/** The ID of the extension providing this voice. */
|
||||
@@ -9959,10 +9983,10 @@ declare namespace chrome {
|
||||
/** The extension ID of the speech engine to use, if known. */
|
||||
extensionId?: string;
|
||||
/**
|
||||
* Gender of voice for synthesized speech.
|
||||
* One of: 'male', or 'female'
|
||||
* @deprecated Deprecated since Chrome 70. Gender is deprecated and will be ignored.
|
||||
* @description Gender of voice for synthesized speech.
|
||||
*/
|
||||
gender?: string;
|
||||
gender?: 'male' | 'female';
|
||||
/** The TTS event types the voice must support. */
|
||||
requiredEventTypes?: string[];
|
||||
/** The TTS event types that you are interested in listening to. If missing, all event types may be sent. */
|
||||
@@ -10983,7 +11007,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class RequestMatcher {
|
||||
protected readonly typeGuard: 'RequestMatcher';
|
||||
constructor (parameters?: RequestMatcherFields);
|
||||
constructor(parameters?: RequestMatcherFields);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11001,7 +11025,7 @@ declare namespace chrome {
|
||||
/** Declarative event action that redirects a network request. */
|
||||
class RedirectRequest {
|
||||
protected readonly typeGuard: 'RedirectRequest';
|
||||
constructor (parameters: RedirectRequestParams);
|
||||
constructor(parameters: RedirectRequestParams);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11036,7 +11060,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class RedirectByRegEx {
|
||||
protected readonly typeGuard: 'RedirectByRegEx';
|
||||
constructor (parameters: RedirectByRegExParams);
|
||||
constructor(parameters: RedirectByRegExParams);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11055,7 +11079,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class SetRequestHeader {
|
||||
protected readonly typeGuard: 'SetRequestHeader';
|
||||
constructor (parameters: SetRequestHeaderParams);
|
||||
constructor(parameters: SetRequestHeaderParams);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11072,7 +11096,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class RemoveRequestHeader {
|
||||
protected readonly typeGuard: 'RemoveRequestHeader';
|
||||
constructor (parameters: RemoveRequestHeaderParams);
|
||||
constructor(parameters: RemoveRequestHeaderParams);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11091,7 +11115,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class AddResponseHeader {
|
||||
protected readonly typeGuard: 'AddResponseHeader';
|
||||
constructor (parameters: AddResponseHeaderParams);
|
||||
constructor(parameters: AddResponseHeaderParams);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11107,7 +11131,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class RemoveResponseHeader {
|
||||
protected readonly typeGuard: 'RemoveResponseHeader';
|
||||
constructor (parameters: RemoveResponseHeaderParams);
|
||||
constructor(parameters: RemoveResponseHeaderParams);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11133,7 +11157,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class IgnoreRules {
|
||||
protected readonly typeGuard: 'IgnoreRules';
|
||||
constructor (parameters: IgnoreRulesParams);
|
||||
constructor(parameters: IgnoreRulesParams);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11150,7 +11174,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class SendMessageToExtension {
|
||||
protected readonly typeGuard: 'SendMessageToExtension';
|
||||
constructor (parameters: SendMessageParams);
|
||||
constructor(parameters: SendMessageParams);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11248,7 +11272,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class AddRequestCookie {
|
||||
protected readonly typeGuard: 'AddRequestCookie';
|
||||
constructor (parameters: AddCookie<RequestCookie>);
|
||||
constructor(parameters: AddCookie<RequestCookie>);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11259,7 +11283,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class AddResponseCookie {
|
||||
protected readonly typeGuard: 'AddResponseCookie';
|
||||
constructor (parameters: AddCookie<ResponseCookie>);
|
||||
constructor(parameters: AddCookie<ResponseCookie>);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11292,7 +11316,7 @@ declare namespace chrome {
|
||||
* @param modification Attributes that shall be overridden in cookies that machted the filter.
|
||||
* Attributes that are set to an empty string are removed.
|
||||
*/
|
||||
constructor (parameters: EditCookieParams<RequestCookie, RequestCookie>);
|
||||
constructor(parameters: EditCookieParams<RequestCookie, RequestCookie>);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11306,7 +11330,7 @@ declare namespace chrome {
|
||||
* @param filter Filter for cookies that will be modified.All empty entries are ignored.
|
||||
* @param modification
|
||||
*/
|
||||
constructor (parameter: EditCookieParams<FilterResponseCookie, ResponseCookie>);
|
||||
constructor(parameter: EditCookieParams<FilterResponseCookie, ResponseCookie>);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11316,7 +11340,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class RemoveRequestCookie {
|
||||
protected readonly typeGuard: 'RemoveRequestCookie';
|
||||
constructor (parameters: RemoveCookieParams<RequestCookie>);
|
||||
constructor(parameters: RemoveCookieParams<RequestCookie>);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11340,7 +11364,7 @@ declare namespace chrome {
|
||||
*/
|
||||
class RemoveResponseCookie {
|
||||
protected readonly typeGuard: 'RemoveResponseCookie';
|
||||
constructor (parameters: RemoveCookieParams<FilterResponseCookie>);
|
||||
constructor(parameters: RemoveCookieParams<FilterResponseCookie>);
|
||||
public readonly instanceType: string;
|
||||
}
|
||||
|
||||
@@ -11518,7 +11542,7 @@ declare namespace chrome {
|
||||
*/
|
||||
declare class HTMLAppViewElement extends HTMLElement {
|
||||
/** Create a new AppView tag */
|
||||
constructor ();
|
||||
constructor();
|
||||
/**
|
||||
* Requests another app to be embedded.
|
||||
* @param app The extension id of the app to be embedded.
|
||||
@@ -11626,7 +11650,7 @@ declare class HTMLWebViewElement extends HTMLElement {
|
||||
src: string;
|
||||
|
||||
/** Create a new element */
|
||||
constructor ();
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Queries audio state.
|
||||
@@ -11908,6 +11932,21 @@ declare class HTMLWebViewElement extends HTMLElement {
|
||||
*/
|
||||
loadDataWithBaseUrl(dataUrl: string, baseUrl: string, virtualUrl?: string): void;
|
||||
|
||||
/**
|
||||
* @since Chrome 71
|
||||
* @description Sets spatial navigation state of the webview.
|
||||
* @param enabled Spatial navigation state value.
|
||||
*/
|
||||
setSpatialNavigationEnabled(enabled: boolean): void;
|
||||
|
||||
/**
|
||||
* @since Chrome 71
|
||||
* @description Queries whether spatial navigation is enabled for the webview.
|
||||
* @param callback Callback that will provide the value of the spatial navigation state.
|
||||
*/
|
||||
isSpatialNavigationEnabled(callback: (enabled: boolean) => void): void;
|
||||
|
||||
|
||||
/**
|
||||
* Forcibly kills the guest web page's renderer process.
|
||||
* This may affect multiple webview tags in the current app if they share the same process,
|
||||
|
||||
@@ -1114,6 +1114,7 @@ chrome.networking.onc.getNetworks({ 'networkType': 'All' }, (networkList) => {
|
||||
if (networkObj.WiFi) {
|
||||
// WiFi active :)
|
||||
console.log('Wifi BSID: ' + networkObj.WiFi.BSSID);
|
||||
const state = networkObj.WiFi.TetheringState;
|
||||
}
|
||||
chrome.networking.onc.setProperties(networkObj.GUID || '', {
|
||||
WiFi: {
|
||||
@@ -1124,6 +1125,19 @@ chrome.networking.onc.getNetworks({ 'networkType': 'All' }, (networkList) => {
|
||||
chrome.networking.onc.getProperties(networkObj.GUID || '', (props) => {
|
||||
const WiFiResult = props.WiFi;
|
||||
});
|
||||
chrome.networking.onc.getState(networkObj.GUID || '', (state) => {
|
||||
const wifiState = state.WiFi || {};
|
||||
return wifiState.TetheringState;
|
||||
});
|
||||
chrome.networking.onc.getManagedProperties(networkObj.GUID || '', (result) => {
|
||||
const wifiResult = result.WiFi;
|
||||
if (wifiResult !== undefined) {
|
||||
const managed = wifiResult.HexSSID;
|
||||
if (managed !== undefined) {
|
||||
return managed.UserPolicy;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -4525,12 +4525,12 @@ declare namespace chrome.pageAction {
|
||||
* Shows the page action. The page action is shown whenever the tab is selected.
|
||||
* @param tabId The id of the tab for which you want to modify the page action.
|
||||
*/
|
||||
export function hide(tabId: number): void;
|
||||
export function hide(tabId: number, callback?: () => void): void;
|
||||
/**
|
||||
* Shows the page action. The page action is shown whenever the tab is selected.
|
||||
* @param tabId The id of the tab for which you want to modify the page action.
|
||||
*/
|
||||
export function show(tabId: number): void;
|
||||
export function show(tabId: number, callback?: () => void): void;
|
||||
/** Sets the title of the page action. This is displayed in a tooltip over the page action. */
|
||||
export function setTitle(details: TitleDetails): void;
|
||||
/** Sets the html document to be opened as a popup when the user clicks on the page action's icon. */
|
||||
|
||||
@@ -914,6 +914,9 @@ function test_skin() {
|
||||
CKEDITOR.skin.loadPart('part', () => console.log('load'));
|
||||
|
||||
var path2: string = CKEDITOR.skin.path();
|
||||
|
||||
CKEDITOR.skin.ua_dialog = 'ie,iequirks,ie8,gecko';
|
||||
CKEDITOR.skin.ua_editor = 'ie,gecko';
|
||||
}
|
||||
|
||||
function test_style() {
|
||||
|
||||
Vendored
+3
@@ -2,6 +2,7 @@
|
||||
// Project: https://ckeditor.com/ckeditor-4/
|
||||
// Definitions by: Thomas Wittwer <https://github.com/wittwert>
|
||||
// Stuart Long <https://github.com/stuartlong>
|
||||
// Viktor Pegy <https://github.com/viktorpegy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// WORK-IN-PROGRESS: Any contribution support welcomed.
|
||||
@@ -2168,6 +2169,8 @@ declare namespace CKEDITOR {
|
||||
// tslint:disable-next-line:no-duplicate-variable
|
||||
var name: string;
|
||||
var ua: { [name: string]: any };
|
||||
var ua_dialog: string;
|
||||
var ua_editor: string;
|
||||
|
||||
function addIcon(name: string, path: string, offset?: number, bgsize?: string): void;
|
||||
function chameleon(editor: string, part: string): void;
|
||||
|
||||
@@ -230,3 +230,24 @@ table26.push(
|
||||
// feel free to use colors in your content strings, column widths will be calculated correctly
|
||||
const table27 = new Table({ colWidths: [5], style: { head: [], border: [] } }) as Table.HorizontalTable;
|
||||
table27.push([/*colors.red(*/'hello'/*)*/]);
|
||||
|
||||
// Header as text
|
||||
const table28 = new Table({ head: ["Top Header 1", "Top Header 2"] }) as Table.HorizontalTable;
|
||||
table28.push(
|
||||
['Value Row 1 Col 1', 'Value Row 1 Col 2'],
|
||||
['Value Row 2 Col 1', 'Value Row 2 Col 2']
|
||||
);
|
||||
|
||||
// Header as Cells
|
||||
const table29 = new Table({ head: [{content: "Top Header 1"}, {content: "Top Header 2"}] }) as Table.HorizontalTable;
|
||||
table29.push(
|
||||
['Value Row 1 Col 1', 'Value Row 1 Col 2'],
|
||||
['Value Row 2 Col 1', 'Value Row 2 Col 2']
|
||||
);
|
||||
|
||||
// ColSpan in header
|
||||
const table30 = new Table({ head: [{content: "Top Header 1", colSpan: 2}, {content: "Top Header 3"}] }) as Table.HorizontalTable;
|
||||
table30.push(
|
||||
['Value Row 1 Col 1', 'Value Row 1 Col 2', 'Value Row 1 Col 3'],
|
||||
['Value Row 2 Col 1', 'Value Row 2 Col 2', 'Value Row 2 Col 3']
|
||||
);
|
||||
|
||||
Vendored
+1
-1
@@ -31,7 +31,7 @@ declare namespace CliTable2 {
|
||||
rowHeights: Array<number | null>;
|
||||
colAligns: HorizontalAlignment[];
|
||||
rowAligns: VerticalAlignment[];
|
||||
head: string[];
|
||||
head: Cell[];
|
||||
wordWrap: boolean;
|
||||
}
|
||||
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
// Type definitions for CodeMirror
|
||||
// Project: https://github.com/marijnh/CodeMirror
|
||||
// Definitions by: Nikolaj Kappler <https://github.com/nkappler>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// See docs https://codemirror.net/doc/manual.html#addon_comment
|
||||
|
||||
// Todo: add 'toggleComment' command, once command type definitions exist in main definitions
|
||||
|
||||
import * as CodeMirror from "codemirror";
|
||||
|
||||
declare module "codemirror" {
|
||||
|
||||
interface Editor {
|
||||
/** Tries to uncomment the current selection, and if that fails, line-comments it. */
|
||||
toggleComment(from: Position, to: Position, options?: CommentOptions): void;
|
||||
/** Set the lines in the given range to be line comments. Will fall back to `blockComment` when no line comment style is defined for the mode. */
|
||||
lineComment(from: Position, to: Position, options?: CommentOptions): void;
|
||||
/** Wrap the code in the given range in a block comment. Will fall back to `lineComment` when no block comment style is defined for the mode. */
|
||||
blockComment(from: Position, to: Position, options?: CommentOptions): void;
|
||||
/** Try to uncomment the given range. Returns `true` if a comment range was found and removed, `false` otherwise. */
|
||||
uncomment(from: Position, to: Position, options?: CommentOptions): boolean;
|
||||
}
|
||||
|
||||
interface CommentOptions {
|
||||
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
|
||||
blockCommentStart?: string;
|
||||
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
|
||||
blockCommentEnd?: string;
|
||||
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
|
||||
blockCommentLead?: string;
|
||||
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
|
||||
lineComment?: string;
|
||||
/** A string that will be inserted after opening and leading markers, and before closing comment markers. Defaults to a single space. */
|
||||
padding?: string;
|
||||
/** Whether, when adding line comments, to also comment lines that contain only whitespace. */
|
||||
commentBlankLines?: boolean;
|
||||
/** When adding line comments and this is turned on, it will align the comment block to the current indentation of the first line of the block. */
|
||||
indent?: boolean;
|
||||
/** When block commenting, this controls whether the whole lines are indented, or only the precise range that is given. Defaults to `true`. */
|
||||
fullLines?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "codemirror/addon/comment/comment" {
|
||||
export = CodeMirror;
|
||||
}
|
||||
Vendored
+20
@@ -4,6 +4,7 @@
|
||||
// nrbernard <https://github.com/nrbernard>
|
||||
// Pr1st0n <https://github.com/Pr1st0n>
|
||||
// rileymiller <https://github.com/rileymiller>
|
||||
// toddself <https://github.com/toddself>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = CodeMirror;
|
||||
@@ -706,8 +707,27 @@ declare namespace CodeMirror {
|
||||
or undefined if the marker is no longer in the document. */
|
||||
find(): {from: CodeMirror.Position, to: CodeMirror.Position};
|
||||
|
||||
/** Called when you've done something that might change the size of the marker and want to cheaply update the display*/
|
||||
changed(): void;
|
||||
|
||||
/** Returns an object representing the options for the marker. If copyWidget is given true, it will clone the value of the replacedWith option, if any. */
|
||||
getOptions(copyWidget: boolean): CodeMirror.TextMarkerOptions;
|
||||
|
||||
/** Fired when the cursor enters the marked range */
|
||||
on(eventName: 'beforeCursorEnter', handler: () => void) : void;
|
||||
off(eventName: 'beforeCursorEnter', handler: () => void) : void;
|
||||
|
||||
/** Fired when the range is cleared, either through cursor movement in combination with clearOnEnter or through a call to its clear() method */
|
||||
on(eventName: 'clear', handler: (from: Position, to: Position) => void) : void;
|
||||
off(eventName: 'clear', handler: () => void) : void;
|
||||
|
||||
/** Fired when the last part of the marker is removed from the document by editing operations */
|
||||
on(eventName: 'hide', handler: () => void) : void;
|
||||
off(eventname: 'hide', handler: () => void) : void;
|
||||
|
||||
/** Fired when, after the marker was removed by editing, a undo operation brough the marker back */
|
||||
on(eventName: 'unhide', handler: () => void) : void;
|
||||
off(eventname: 'unhide', handler: () => void) : void;
|
||||
}
|
||||
|
||||
interface LineWidget {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
const editor = CodeMirror(document.body);
|
||||
const position: CodeMirror.Position = { ch: 0, line: 0 };
|
||||
const opt: CodeMirror.CommentOptions = {
|
||||
blockCommentEnd: "*/",
|
||||
blockCommentStart: "/*",
|
||||
blockCommentLead: "*",
|
||||
commentBlankLines: true,
|
||||
fullLines: true,
|
||||
indent: true,
|
||||
lineComment: "//",
|
||||
padding: " "
|
||||
};
|
||||
editor.toggleComment(position, position, opt);
|
||||
editor.blockComment(position, position, opt);
|
||||
editor.lineComment(position, position, opt);
|
||||
const b: boolean = editor.uncomment(position, position, opt);
|
||||
@@ -23,12 +23,14 @@
|
||||
"codemirror-panel.d.ts",
|
||||
"codemirror-runmode.d.ts",
|
||||
"codemirror-showhint.d.ts",
|
||||
"codemirror-comment.d.ts",
|
||||
"searchcursor.d.ts",
|
||||
"test/index.ts",
|
||||
"test/matchbrackets.ts",
|
||||
"test/panel.ts",
|
||||
"test/runmode.ts",
|
||||
"test/searchcursor.ts",
|
||||
"test/showhint.ts"
|
||||
"test/showhint.ts",
|
||||
"test/comment.ts"
|
||||
]
|
||||
}
|
||||
@@ -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" }
|
||||
+12
-13
@@ -4,33 +4,33 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module commangular {
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Commangular Static
|
||||
// see http://commangular.org/docs/#commangular-namespace
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ICommAngularStatic {
|
||||
|
||||
|
||||
/**
|
||||
* Mock dispatch function for testing commands.
|
||||
*/
|
||||
dispatch( ec: ICommandCall, callback: Function ): void;
|
||||
}
|
||||
|
||||
|
||||
interface ICommandCall {
|
||||
/**
|
||||
* Name of the command that needs to
|
||||
* execute
|
||||
*/
|
||||
command: string;
|
||||
|
||||
|
||||
/**
|
||||
* Data that needs to be passed to the command
|
||||
*/
|
||||
data?: any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Object type expected to be passed into the callback function
|
||||
* of the dispatch() function
|
||||
@@ -41,25 +41,25 @@ declare module commangular {
|
||||
* @param key The property name that is in the object that was passed
|
||||
*/
|
||||
dataPassed( key : string ) : any;
|
||||
|
||||
|
||||
/**
|
||||
* The data that was returned by the command
|
||||
* @param key The result key that was defined in the command. If no result
|
||||
* was defined use 'lastResult' as the key
|
||||
*/
|
||||
resultKey( key: string ): any;
|
||||
|
||||
|
||||
/**
|
||||
* Indicates if the command execution was cancelled.
|
||||
*/
|
||||
canceled( ): boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Indicates if the command was executed????
|
||||
*/
|
||||
commandExecuted( ): boolean;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ declare module commangular {
|
||||
* Mock dispatch function for testing commands.
|
||||
* @param ec an ICommandCall object
|
||||
* @param callback The function that will be called upon the completion of the command
|
||||
* function should expecte an ICommandInfo paramter.
|
||||
* function should expecte an ICommandInfo parameter.
|
||||
*/
|
||||
declare function dispatch( ec: commangular.ICommandCall, callback: Function ): void;
|
||||
|
||||
declare function dispatch( ec: commangular.ICommandCall, callback: Function ): void;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import React = require('react');
|
||||
import enzyme = require('enzyme');
|
||||
import configureExtensions = require('@commercetools/enzyme-extensions');
|
||||
|
||||
configureExtensions(enzyme.ShallowWrapper);
|
||||
|
||||
function App() {
|
||||
return <Child cb={() => 'Hello world'} />;
|
||||
}
|
||||
|
||||
interface ChildProps {
|
||||
cb: () => string;
|
||||
}
|
||||
|
||||
function Child(props: ChildProps) {
|
||||
return <div>{props.cb()}</div>;
|
||||
}
|
||||
|
||||
enzyme.shallow(<App />)
|
||||
.find(App)
|
||||
.renderProp('render');
|
||||
enzyme.shallow(<App />)
|
||||
.find(Child)
|
||||
.renderProp('render', 1, 2);
|
||||
|
||||
enzyme.shallow(<App />)
|
||||
.find(Child)
|
||||
.drill(props => props.cb());
|
||||
|
||||
enzyme.shallow(<App />).until(Child);
|
||||
@@ -0,0 +1,22 @@
|
||||
// Type definitions for @commercetools/enzyme-extensions 3.0
|
||||
// Project: https://github.com/commercetools/enzyme-extensions
|
||||
// Definitions by: Christian Rackerseder <https://github.com/screendriver>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as enzyme from 'enzyme';
|
||||
|
||||
declare module 'enzyme' {
|
||||
interface UntilOptions {
|
||||
maxDepth: number;
|
||||
}
|
||||
interface ShallowWrapper<P = {}> {
|
||||
renderProp(propName: string, ...args: any[]): ShallowWrapper<P>;
|
||||
drill(expander: (props: any) => ShallowWrapper): ShallowWrapper<P>;
|
||||
until(selector: EnzymeSelector, options?: UntilOptions): ShallowWrapper<P>;
|
||||
}
|
||||
}
|
||||
|
||||
declare function monkeyPatchShallowWrapper(s: typeof enzyme.ShallowWrapper): void;
|
||||
|
||||
export = monkeyPatchShallowWrapper;
|
||||
+6
-12
@@ -2,8 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
@@ -17,17 +16,12 @@
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react",
|
||||
"experimentalDecorators": true
|
||||
"paths": {
|
||||
"@commercetools/enzyme-extensions": ["commercetools__enzyme-extensions"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"test/react-i18next-tests.tsx",
|
||||
"src/context.d.ts",
|
||||
"src/I18n.d.ts",
|
||||
"src/I18nextProvider.d.ts",
|
||||
"src/interpolate.d.ts",
|
||||
"src/loadNamespaces.d.ts",
|
||||
"src/trans.d.ts",
|
||||
"src/translate.d.ts"
|
||||
"commercetools__enzyme-extensions-tests.tsx"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+1
@@ -625,6 +625,7 @@ declare namespace Consul {
|
||||
dc?: string;
|
||||
tag?: string;
|
||||
passing?: boolean;
|
||||
near?: string;
|
||||
}
|
||||
|
||||
interface StateOptions extends CommonOptions {
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
let BluetoothClassicSerial: BluetoothClassicSerial =
|
||||
window.BluetoothClassicSerial;
|
||||
|
||||
BluetoothClassicSerial.connect(
|
||||
"",
|
||||
[""]
|
||||
);
|
||||
BluetoothClassicSerial.connect(
|
||||
"",
|
||||
[""],
|
||||
results => {}
|
||||
);
|
||||
BluetoothClassicSerial.connect(
|
||||
"",
|
||||
[""],
|
||||
results => {},
|
||||
error => {}
|
||||
);
|
||||
BluetoothClassicSerial.connectInsecure("", [""]);
|
||||
BluetoothClassicSerial.connectInsecure("", [""], results => {});
|
||||
BluetoothClassicSerial.connectInsecure("", [""], results => {}, error => {});
|
||||
BluetoothClassicSerial.register(() => {});
|
||||
BluetoothClassicSerial.disconnect(results => {});
|
||||
BluetoothClassicSerial.disconnect(results => {}, error => {});
|
||||
BluetoothClassicSerial.write("", "");
|
||||
BluetoothClassicSerial.write("", "", results => {});
|
||||
BluetoothClassicSerial.write("", "", results => {}, error => {});
|
||||
BluetoothClassicSerial.available("");
|
||||
BluetoothClassicSerial.available("", results => {});
|
||||
BluetoothClassicSerial.available("", results => {}, error => {});
|
||||
BluetoothClassicSerial.read("");
|
||||
BluetoothClassicSerial.read("", results => {});
|
||||
BluetoothClassicSerial.read("", results => {}, error => {});
|
||||
BluetoothClassicSerial.readUntil("", "");
|
||||
BluetoothClassicSerial.readUntil("", "", results => {});
|
||||
BluetoothClassicSerial.readUntil("", "", results => {}, error => {});
|
||||
BluetoothClassicSerial.subscribe("", "");
|
||||
BluetoothClassicSerial.subscribe("", "", results => {});
|
||||
BluetoothClassicSerial.subscribe("", "", results => {}, error => {});
|
||||
BluetoothClassicSerial.unsubscribe("");
|
||||
BluetoothClassicSerial.unsubscribe("", results => {});
|
||||
BluetoothClassicSerial.unsubscribe("", results => {}, error => {});
|
||||
BluetoothClassicSerial.subscribeRawData("");
|
||||
BluetoothClassicSerial.subscribeRawData("", results => {});
|
||||
BluetoothClassicSerial.subscribeRawData("", results => {}, error => {});
|
||||
BluetoothClassicSerial.unsubscribeRawData("");
|
||||
BluetoothClassicSerial.unsubscribeRawData("", results => {});
|
||||
BluetoothClassicSerial.unsubscribeRawData("", results => {}, error => {});
|
||||
BluetoothClassicSerial.clear("");
|
||||
BluetoothClassicSerial.clear("", results => {});
|
||||
BluetoothClassicSerial.clear("", results => {}, error => {});
|
||||
BluetoothClassicSerial.list(results => {});
|
||||
BluetoothClassicSerial.list(results => {}, error => {});
|
||||
BluetoothClassicSerial.isConnected(results => {});
|
||||
BluetoothClassicSerial.isConnected(results => {}, error => {});
|
||||
BluetoothClassicSerial.isEnabled(results => {});
|
||||
BluetoothClassicSerial.isEnabled(results => {}, error => {});
|
||||
BluetoothClassicSerial.showBluetoothSettings(results => {});
|
||||
BluetoothClassicSerial.showBluetoothSettings(results => {}, error => {});
|
||||
BluetoothClassicSerial.enable(results => {});
|
||||
BluetoothClassicSerial.enable(results => {}, error => {});
|
||||
BluetoothClassicSerial.discoverUnpaired(results => {});
|
||||
BluetoothClassicSerial.discoverUnpaired(results => {}, error => {});
|
||||
@@ -0,0 +1,105 @@
|
||||
// Type definitions for cordova-plugin-bluetoothClassic-serial 0.9
|
||||
// Project: https://github.com/soltius/BluetoothClassicSerial
|
||||
// Definitions by: Wouter Roosendaal <https://github.com/tuvokki>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Global object bluetoothClassicSerial.
|
||||
*/
|
||||
interface Window {
|
||||
BluetoothClassicSerial: BluetoothClassicSerial;
|
||||
}
|
||||
|
||||
interface BluetoothClassicSerial {
|
||||
connect: (
|
||||
deviceId: string,
|
||||
interfaceArray: [any],
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
connectInsecure: (
|
||||
deviceId: string,
|
||||
interfaceArray: [any],
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
register: (data_cb?: () => any) => void;
|
||||
disconnect: (
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
write: (
|
||||
interfaceId: string,
|
||||
data: string,
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
available: (
|
||||
interfaceId: string,
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
read: (
|
||||
interfaceId: string,
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
readUntil: (
|
||||
interfaceId: string,
|
||||
delimiter: string,
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
subscribe: (
|
||||
interfaceId: string,
|
||||
delimiter: string,
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
unsubscribe: (
|
||||
interfaceId: string,
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
subscribeRawData: (
|
||||
interfaceId: string,
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
unsubscribeRawData: (
|
||||
interfaceId: string,
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
clear: (
|
||||
interfaceId: string,
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
list: (
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
isConnected: (
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
isEnabled: (
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
showBluetoothSettings: (
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
enable: (
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
discoverUnpaired: (
|
||||
success_cb?: (results: any) => any,
|
||||
fail_cb?: (error: any) => any
|
||||
) => void;
|
||||
}
|
||||
|
||||
declare var bluetoothClassicSerial: BluetoothClassicSerial;
|
||||
@@ -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",
|
||||
"cordova-plugin-bluetoothclassic-serial-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -7,4 +7,8 @@ new Critters({
|
||||
preloadFonts: true,
|
||||
keyframes: 'critical',
|
||||
noscriptFallback: true,
|
||||
inlineThreshold: 0,
|
||||
mergeStylesheets: true,
|
||||
pruneSource: true,
|
||||
minimumExternalSize: 0,
|
||||
});
|
||||
|
||||
+21
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for critters-webpack-plugin 1.3
|
||||
// Type definitions for critters-webpack-plugin 2.0
|
||||
// Project: https://github.com/GoogleChromeLabs/critters
|
||||
// Definitions by: Juan José González Giraldo <https://github.com/JuanJoseGonGi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -18,6 +18,26 @@ declare namespace Critters {
|
||||
* @default true
|
||||
*/
|
||||
external?: boolean;
|
||||
/**
|
||||
* Inline external stylesheets smaller than a given size.
|
||||
* @default 0
|
||||
*/
|
||||
inlineThreshold?: number;
|
||||
/**
|
||||
* If the non-critical external stylesheet would be below this size, just inline it.
|
||||
* @default 0
|
||||
*/
|
||||
minimumExternalSize?: number;
|
||||
/**
|
||||
* Remove inlined rules from the external stylesheet.
|
||||
* @default true
|
||||
*/
|
||||
pruneSource?: boolean;
|
||||
/**
|
||||
* Merged inlined stylesheets into a single <style> tag.
|
||||
* @default true
|
||||
*/
|
||||
mergeStylesheets?: boolean;
|
||||
/**
|
||||
* The mechanism to use for lazy-loading stylesheets. [JS] indicates that a strategy requires JavaScript (falls back to <noscript>).
|
||||
* - default: Move stylesheet links to the end of the document and insert preload meta tags in their place.
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import crpc from 'crpc';
|
||||
|
||||
const client = crpc('https://example.com/');
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for crpc 0.2
|
||||
// Project: https://github.com/billinghamj/crpc
|
||||
// Definitions by: Alexander Forbes-Reed <https://github.com/0xdeafcafe>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
export type Client = <TRes>(path: string, body: any, options?: {} | null) => Promise<TRes>;
|
||||
|
||||
export default function crpc(baseUrl: string, options?: {}): Client;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"esModuleInterop": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"crpc-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -144,6 +144,13 @@ contDensCustom = contDensCustom.y((datum) => {
|
||||
// get
|
||||
const yAcc: (d: CustomDatum) => number = contDensCustom.y();
|
||||
|
||||
// weight(...) -----------------------------------------------------------------
|
||||
contDensCustom = contDensCustom.weight((datum) => {
|
||||
return 5;
|
||||
});
|
||||
|
||||
// get
|
||||
const weightAcc: (d: CustomDatum) => number = contDensCustom.weight();
|
||||
// size(...) -------------------------------------------------------------------
|
||||
|
||||
// set with chainability
|
||||
|
||||
Vendored
+14
-2
@@ -1,10 +1,10 @@
|
||||
// Type definitions for d3-contour 1.2
|
||||
// Type definitions for d3-contour 1.3
|
||||
// Project: https://d3js.org/d3-contour/
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Hugues Stefanski <https://github.com/Ledragon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// Last module patch version validated against: 1.2.0
|
||||
// Last module patch version validated against: 1.3.2
|
||||
|
||||
import { MultiPolygon } from 'geojson';
|
||||
import { ThresholdNumberArrayGenerator, ThresholdCountGenerator } from 'd3-array';
|
||||
@@ -169,6 +169,18 @@ export interface ContourDensity<Datum = [number, number]> {
|
||||
*/
|
||||
y(y: (d: Datum) => number): this;
|
||||
|
||||
/**
|
||||
* Returns the current point weight accessor.
|
||||
*/
|
||||
weight(): (d: Datum) => number;
|
||||
|
||||
/**
|
||||
* Sets the point weight accessor and returns the density contour estimator.
|
||||
*
|
||||
* @param weight A point weight accessor function.
|
||||
*/
|
||||
weight(weight: (d: Datum) => number): this;
|
||||
|
||||
/**
|
||||
* Returns the current size, which defaults to [960, 500].
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -407,7 +407,7 @@ export type Engine = 'circo' | 'dot' | 'fdp' | 'neato' | 'osage' | 'patchwork' |
|
||||
export type TypeNames = 'initEnd' | 'start' | 'layoutStart' | 'layoutEnd' | 'dataExtractEnd' |
|
||||
'dataProcessPass1End' | 'dataProcessPass2End' | 'dataProcessEnd' |
|
||||
'renderStart' | 'renderEnd' | 'transitionStart' | 'transitionEnd' |
|
||||
'resotreEnd' | 'end' | string; // string included to allow for optional addition of a name, e.g. initEnd.foo
|
||||
'restoreEnd' | 'end' | string; // string included to allow for optional addition of a name, e.g. initEnd.foo
|
||||
|
||||
/**
|
||||
* Enum defining the valid strings that can be passed as KeyModes
|
||||
|
||||
@@ -74,7 +74,8 @@ let body: d3Selection.Selection<HTMLBodyElement, BodyDatum, HTMLElement, any> =
|
||||
// with Group element of type BaseType and datum of type 'any' The parent element is of type 'null' with datum of type 'undefined'
|
||||
|
||||
const baseTypeEl2: d3Selection.Selection<d3Selection.BaseType, any, null, undefined> = d3Selection.select(baseTypeEl.node());
|
||||
// let body2: d3Selection.Selection<HTMLElement, any, null, undefined> = d3Selection.select(baseTypeEl.node()); // fails as baseTypeEl.node() is of type cannot be assigned to HTMLElement
|
||||
// $ExpectError
|
||||
const body2: d3Selection.Selection<HTMLElement, any, null, undefined> = d3Selection.select(baseTypeEl.node()); // fails as baseTypeEl.node() is of type cannot be assigned to HTMLElement
|
||||
|
||||
const body3: d3Selection.Selection<HTMLBodyElement, any, null, undefined> = d3Selection.select(body.node()!); // element types match, but datum is of type 'any' as it cannot be inferred from .node()
|
||||
|
||||
@@ -86,18 +87,21 @@ const body4: d3Selection.Selection<HTMLBodyElement, BodyDatum, null, undefined>
|
||||
// Explicitly cast body.node() to HTMLBodyElement to narrow selection definition.
|
||||
const body5: d3Selection.Selection<HTMLBodyElement, BodyDatum, null, undefined> = d3Selection.select<HTMLBodyElement, BodyDatum>(body.node()!);
|
||||
|
||||
// d3Selection.select<HTMLBodyElement, BodyDatum>(baseTypeEl.node()!); // fails as baseTypeEl.node() is not of type HTMLBodyElement
|
||||
// $ExpectError
|
||||
d3Selection.select<HTMLBodyElement, BodyDatum>(baseTypeEl.node()!); // fails as baseTypeEl.node() is not of type HTMLBodyElement
|
||||
|
||||
// test, when it is not certain, whether an element of the type to be selected exists
|
||||
let maybeSVG1: d3Selection.Selection<SVGSVGElement | null, any, HTMLElement, undefined>;
|
||||
maybeSVG1 = d3Selection.select<SVGSVGElement | null, any>('svg');
|
||||
|
||||
let maybeSVG2: d3Selection.Selection<SVGSVGElement | null, any, null, undefined>;
|
||||
// maybeSVG2 = d3Selection.select<SVGSVGElement, any>(maybeSVG1.node()); // fails with strict function types
|
||||
// $ExpectError
|
||||
maybeSVG2 = d3Selection.select<SVGSVGElement, any>(maybeSVG1.node()); // fails with strict function types
|
||||
maybeSVG2 = d3Selection.select<SVGSVGElement | null, any>(maybeSVG1.node());
|
||||
|
||||
// fails, as node type mismatches selection type
|
||||
// let body7: d3Selection.Selection<HTMLBodyElement | null, any, HTMLElement, undefined> = d3Selection.select<HTMLBodyElement | null, any>(maybeSVG1.node());
|
||||
// $ExpectError
|
||||
const body7: d3Selection.Selection<HTMLBodyElement | null, any, HTMLElement, undefined> = d3Selection.select<HTMLBodyElement | null, any>(maybeSVG1.node());
|
||||
|
||||
// test "special case DOM objects"
|
||||
|
||||
@@ -127,7 +131,8 @@ const divElements: d3Selection.Selection<HTMLDivElement, DivDatum, HTMLElement,
|
||||
|
||||
const baseTypeElements2: d3Selection.Selection<d3Selection.BaseType, any, null, undefined> = d3Selection.selectAll(baseTypeElements.nodes());
|
||||
// fails, group elements types not of compatible for baseTypeElements
|
||||
// let divElements2: d3Selection.Selection<HTMLDivElement, any, null, undefined> = d3Selection.selectAll(baseTypeElements.nodes());
|
||||
// $ExpectError
|
||||
const divElements2: d3Selection.Selection<HTMLDivElement, any, null, undefined> = d3Selection.selectAll(baseTypeElements.nodes());
|
||||
|
||||
// element types match, but datum is of type 'any' as it cannot be inferred from .nodes()
|
||||
const divElements3: d3Selection.Selection<HTMLDivElement, any, null, undefined> = d3Selection.selectAll(divElements.nodes());
|
||||
@@ -137,7 +142,8 @@ const divElements3: d3Selection.Selection<HTMLDivElement, any, null, undefined>
|
||||
|
||||
const divElements4: d3Selection.Selection<HTMLDivElement, DivDatum, null, undefined> = d3Selection.selectAll<HTMLDivElement, DivDatum>(divElements.nodes());
|
||||
|
||||
// d3Selection.selectAll<HTMLDivElement, DivDatum>(baseTypeElements.nodes()); // fails as baseTypeEl.node() is not of type HTMLBodyElement
|
||||
// $ExpectError
|
||||
d3Selection.selectAll<HTMLDivElement, DivDatum>(baseTypeElements.nodes()); // fails as baseTypeEl.node() is not of type HTMLBodyElement
|
||||
|
||||
// selectAll(...) accepts NodeListOf<...> argument
|
||||
|
||||
@@ -161,8 +167,8 @@ const documentLinks: d3Selection.Selection<HTMLAnchorElement | HTMLAreaElement,
|
||||
const svgEl: d3Selection.Selection<SVGSVGElement, SVGDatum, HTMLElement, any> = d3Selection.select<SVGSVGElement, SVGDatum>('svg');
|
||||
|
||||
let firstG: d3Selection.Selection<SVGGElement, SVGDatum, HTMLElement, any> = svgEl.select<SVGGElement>('g');
|
||||
// let firstG_2: d3Selection.Selection<SVGGElement, SVGDatum, SVGSVGElement, any> = svgEl.select<SVGGElement>('g'); // fails, parent element of selection does not change with .select(...)
|
||||
// firstG = svgEl.select('g'); // fails, element type defaults to 'BaseType', but SVGGElement expected on left-hand side
|
||||
// $ExpectError
|
||||
const firstG_2: d3Selection.Selection<SVGGElement, SVGDatum, SVGSVGElement, any> = svgEl.select<SVGGElement>('g'); // fails, parent element of selection does not change with .select(...)
|
||||
// firstG = svgEl.select<SVGSVGElement>('svg'); // fails, element type of SVGSVGElement provided, but SVGGElement expected on left-hand side (silly test to begin with)
|
||||
|
||||
// test, when it is not certain, whether an element of the type to be selected exists
|
||||
@@ -180,14 +186,16 @@ firstG = svgEl.select(svgGroupSelector);
|
||||
|
||||
firstG = svgEl.select(function() {
|
||||
const that: SVGSVGElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: HTMLElement = this; // fails, type mismatch
|
||||
console.log('Get <svg> Element width using "this": ', this.width.baseVal.value); // 'this' type is SVGSVGElement
|
||||
return this.querySelector('g')!; // this of type SVGSVGElement by type inference
|
||||
});
|
||||
|
||||
firstG = svgEl.select(function(d, i, g) {
|
||||
const that: SVGSVGElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: SVGDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGSVGElement[] | d3Selection.ArrayLike<SVGSVGElement> = g;
|
||||
@@ -199,9 +207,10 @@ firstG = svgEl.select(function(d, i, g) {
|
||||
return this.querySelector('g')!; // this of type SVGSVGElement by type inference
|
||||
});
|
||||
|
||||
// firstG = svgEl.select(function() {
|
||||
// return this.querySelector('a'); // fails, return type HTMLAnchorElement is not compatible with SVGGElement expected by firstG
|
||||
// });
|
||||
// $ExpectError
|
||||
firstG = svgEl.select(function() {
|
||||
return this.querySelector('a'); // fails, return type HTMLAnchorElement is not compatible with SVGGElement expected by firstG
|
||||
});
|
||||
|
||||
// selectAll(...) sub-selection --------------------------------------------------------------
|
||||
|
||||
@@ -219,7 +228,6 @@ emptySubSelection = svgEl.selectAll(undefined);
|
||||
let elementsUnknownData: d3Selection.Selection<SVGGElement, any, SVGSVGElement, SVGDatum> = svgEl.selectAll<SVGGElement, any>('g');
|
||||
// let elementsAndDataUnknown: d3Selection.Selection<d3Selection.BaseType, any, SVGSVGElement, SVGDatum> = svgEl.selectAll('g'); // fails with strictFunctionTypes
|
||||
let gElementsOldData: d3Selection.Selection<SVGGElement, CircleDatum, SVGSVGElement, SVGDatum> = svgEl.selectAll<SVGGElement, CircleDatum>('g');
|
||||
// gElementsOldData = svgEl.selectAll('g'); // fails default type parameters of selectAll for group element type and datum type do not match
|
||||
|
||||
// Using selectAll(...) sub-selection with a selector function argument.
|
||||
|
||||
@@ -232,18 +240,21 @@ gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(svgGroupSelectorAll
|
||||
function wrongSvgGroupSelectorAll(this: HTMLElement, d: SVGDatum, i: number, groups: HTMLElement[]): NodeListOf<SVGGElement> {
|
||||
return this.querySelectorAll('g');
|
||||
}
|
||||
// gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(wrongSvgGroupSelectorAll); // fails, wrong this context
|
||||
// $ExpectError
|
||||
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(wrongSvgGroupSelectorAll); // fails, wrong this context
|
||||
|
||||
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(function() {
|
||||
const that: SVGSVGElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: HTMLElement = this; // fails, type mismatch
|
||||
console.log('Get <svg> Element width using "this": ', this.width.baseVal.value); // 'this' type is SVGSVGElement
|
||||
return this.querySelectorAll('g'); // this of type SVGSVGElement by type inference
|
||||
});
|
||||
|
||||
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(function(d, i, g) {
|
||||
const that: SVGSVGElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: SVGDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGSVGElement[] | d3Selection.ArrayLike<SVGSVGElement> = g;
|
||||
@@ -255,31 +266,32 @@ gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(function(d, i, g) {
|
||||
return this.querySelectorAll('g');
|
||||
});
|
||||
|
||||
// gElementsOldData = svgEl.selectAll(function() { // fails, because Datum type is not compatible as selectAll defaults to 'any', but gElementsOldData expects CircleDatum
|
||||
// return this.querySelectorAll('g');
|
||||
// });
|
||||
|
||||
// gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(function() { // fails, return type HTMLAnchorElement is not compatible with SVGGElement expected by selectAll-typing
|
||||
// return this.querySelectorAll('a');
|
||||
// });
|
||||
// $ExpectError
|
||||
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(function() { // fails, return type HTMLAnchorElement is not compatible with SVGGElement expected by selectAll-typing
|
||||
return this.querySelectorAll('a');
|
||||
});
|
||||
|
||||
elementsUnknownData = svgEl.selectAll(svgGroupSelectorAll);
|
||||
|
||||
elementsUnknownData = svgEl.selectAll(function() {
|
||||
const that: SVGSVGElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: HTMLElement = this; // fails, type mismatch
|
||||
console.log('Get <svg> Element width using "this": ', this.width.baseVal.value); // 'this' type is SVGSVGElement
|
||||
return this.querySelectorAll('g'); // this of type SVGSVGElement by type inference
|
||||
});
|
||||
|
||||
// gElementsUnknownData = svgEl.selectAll(function() { // fails, return type HTMLAnchorElement is not compatible with SVGGElement
|
||||
// return this.querySelectorAll('a');
|
||||
// });
|
||||
// $ExpectError
|
||||
gElementsUnknownData = svgEl.selectAll(function() { // fails, return type HTMLAnchorElement is not compatible with SVGGElement
|
||||
return this.querySelectorAll('a');
|
||||
});
|
||||
|
||||
maybeG.selectAll(function(d, i, g) {
|
||||
const that: SVGGElement | null = this;
|
||||
// const that2: SVGGElement = this; // fails with strictNullChecks
|
||||
// const that3: HTMLElement | null = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: SVGGElement = this; // fails with strictNullChecks
|
||||
// $ExpectError
|
||||
const that3: HTMLElement | null = this; // fails, type mismatch
|
||||
const datum: SVGDatum = d;
|
||||
const index: number = i;
|
||||
const group: Array<SVGGElement | null> | d3Selection.ArrayLike<SVGGElement | null> = g;
|
||||
@@ -290,11 +302,13 @@ maybeG.selectAll(function(d, i, g) {
|
||||
|
||||
// selector(...) and selectorAll(...) ----------------------------------------------------
|
||||
|
||||
// d3Selection.select<SVGGElement>(d3Selection.selector<SVGGElement>('g')); // fails, selector as argument to top-level select not supported
|
||||
// $ExpectError
|
||||
d3Selection.select<SVGGElement>(d3Selection.selector<SVGGElement>('g')); // fails, selector as argument to top-level select not supported
|
||||
|
||||
// supported on sub-selection
|
||||
firstG = svgEl.select(d3Selection.selector<SVGGElement>('g')); // type parameter of select(...) inferred
|
||||
// firstG = svgEl.select<SVGGElement>(d3Selection.selector<HTMLDivElement>('div')); // fails, select and selector mismatch
|
||||
// $ExpectError
|
||||
firstG = svgEl.select<SVGGElement>(d3Selection.selector<HTMLDivElement>('div')); // fails, select and selector mismatch
|
||||
|
||||
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(d3Selection.selectorAll<SVGGElement>('g'));
|
||||
|
||||
@@ -308,7 +322,8 @@ filteredGElements = gElementsOldData.filter('.top-level');
|
||||
|
||||
filteredGElements = gElementsOldData.filter(function(d, i, g) {
|
||||
const that: SVGGElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGGElement[] | d3Selection.ArrayLike<SVGGElement> = g;
|
||||
@@ -325,16 +340,18 @@ filteredGElements = gElementsOldData.filter(function(d, i, g) {
|
||||
let filteredGElements2: d3Selection.Selection<SVGGElement, any, HTMLElement, any>;
|
||||
|
||||
filteredGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter<SVGGElement>('g');
|
||||
// filteredGElements2 = d3Selection.selectAll('.any-type').filter('g'); // fails without using narrowing generic on filter method
|
||||
// $ExpectError
|
||||
filteredGElements2 = d3Selection.selectAll('.any-type').filter('g'); // fails without using narrowing generic on filter method
|
||||
|
||||
filteredGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter<SVGGElement>(function() {
|
||||
const that: SVGElement = this;
|
||||
return that.tagName === 'g' || that.tagName === 'G';
|
||||
});
|
||||
// filteredGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter(function(){
|
||||
// const that: SVGElement = this;
|
||||
// return that.tagName === 'g'|| that.tagName === 'G';
|
||||
// }); // fails without using narrowing generic on filter method
|
||||
// $ExpectError
|
||||
filteredGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter(function() {
|
||||
const that: SVGElement = this;
|
||||
return that.tagName === 'g' || that.tagName === 'G';
|
||||
}); // fails without using narrowing generic on filter method
|
||||
|
||||
// matcher() -----------------------------------------------------------------------------
|
||||
|
||||
@@ -371,7 +388,8 @@ circles = d3Selection.selectAll<SVGCircleElement, CircleDatumAlternative>('circl
|
||||
circles = circles // re-assignment test chaining return-type
|
||||
.attr('cx', function(d, i, g) {
|
||||
const that: SVGGElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGGElement[] | d3Selection.ArrayLike<SVGGElement> = g;
|
||||
@@ -395,7 +413,8 @@ divs = divs
|
||||
divs = divs
|
||||
.classed('zero-px-padding', function(d, i, g) {
|
||||
const that: HTMLDivElement = this;
|
||||
// const that2: SVGElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: SVGElement = this; // fails, type mismatch
|
||||
const datum: DivDatum = d;
|
||||
const index: number = i;
|
||||
const group: HTMLDivElement[] | d3Selection.ArrayLike<HTMLDivElement> = g;
|
||||
@@ -411,13 +430,15 @@ divs = divs
|
||||
divs = divs
|
||||
.style('background-color', 'blue') // string
|
||||
.style('hidden', false) // boolean
|
||||
// .style('color', 'green', 'test') // fails, invalid priority value
|
||||
// $ExpectError
|
||||
.style('color', 'green', 'test') // fails, invalid priority value
|
||||
.style('color', 'green', 'important');
|
||||
|
||||
divs = divs
|
||||
.style('padding', function(d, i, g) {
|
||||
const that: HTMLDivElement = this;
|
||||
// const that2: SVGElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: SVGElement = this; // fails, type mismatch
|
||||
const datum: DivDatum = d;
|
||||
const index: number = i;
|
||||
const group: HTMLDivElement[] | d3Selection.ArrayLike<HTMLDivElement> = g;
|
||||
@@ -428,7 +449,8 @@ divs = divs
|
||||
return d.padding; // string return value
|
||||
})
|
||||
.style('hidden', () => true, null) // boolean return + test: priority = null
|
||||
// .style('color', function() { return 'green'; }, 'test') // fails, test: invalid priority value
|
||||
// $ExpectError
|
||||
.style('color', () => 'green', 'test') // fails, test: invalid priority value
|
||||
.style('color', () => 'green', 'important'); // boolean return + test: priority = 'important';
|
||||
|
||||
// property(...) Tests
|
||||
@@ -442,7 +464,8 @@ circles = circles
|
||||
circles = circles
|
||||
.property('__hitchhikersguide__', function(d, i, g) {
|
||||
const that: SVGCircleElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatumAlternative = d;
|
||||
const index: number = i;
|
||||
const group: SVGCircleElement[] | d3Selection.ArrayLike<SVGCircleElement> = g;
|
||||
@@ -466,7 +489,8 @@ body = body
|
||||
body = body
|
||||
.text(function(d, i, g) {
|
||||
const that: HTMLBodyElement = this;
|
||||
// const that2: SVGElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: SVGElement = this; // fails, type mismatch
|
||||
const datum: BodyDatum = d;
|
||||
const index: number = i;
|
||||
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
|
||||
@@ -482,7 +506,8 @@ body = body
|
||||
body = body
|
||||
.html(function(d, i, g) {
|
||||
const that: HTMLBodyElement = this;
|
||||
// const that2: SVGElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: SVGElement = this; // fails, type mismatch
|
||||
const datum: BodyDatum = d;
|
||||
const index: number = i;
|
||||
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
|
||||
@@ -521,13 +546,15 @@ let newBodyDatum: { newFoo: string };
|
||||
|
||||
newBodyDatum = body.datum({ newFoo: 'new foo' }).datum(); // inferred type
|
||||
|
||||
// body.datum<BodyDatum>({ newFoo: 'new foo' }); // fails, data type incompatible
|
||||
// $ExpectError
|
||||
body.datum<BodyDatum>({ newFoo: 'new foo' }); // fails, data type incompatible
|
||||
|
||||
// function-based
|
||||
|
||||
newBodyDatum = body.datum(function(d, i, g) {
|
||||
const that: HTMLBodyElement = this;
|
||||
// const that2: SVGElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: SVGElement = this; // fails, type mismatch
|
||||
const datum: BodyDatum = d;
|
||||
const index: number = i;
|
||||
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
|
||||
@@ -536,10 +563,11 @@ newBodyDatum = body.datum(function(d, i, g) {
|
||||
return { newFoo: 'new foo' };
|
||||
}).datum(); // inferred type
|
||||
|
||||
// newBodyDatum = body.datum<BodyDatum>(function(d) { // fails, data type incompatible with return value type
|
||||
// console.log('HTML5 Custom Data Attributes of body: ', this.dataset); // this typings HTMLBodyElement
|
||||
// return { newFoo: 'new foo' };
|
||||
// }).datum(); // inferred type
|
||||
// $ExpectError
|
||||
newBodyDatum = body.datum<BodyDatum>(function(d) { // fails, data type incompatible with return value type
|
||||
console.log('HTML5 Custom Data Attributes of body: ', this.dataset); // this typings HTMLBodyElement
|
||||
return { newFoo: 'new foo' };
|
||||
}).datum(); // inferred type
|
||||
|
||||
// SCENARIO 1: Fully type-parameterized
|
||||
|
||||
@@ -560,7 +588,8 @@ d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in la
|
||||
.datum(data2) // new data type inferred
|
||||
.classed('has-transform-property', function(d, i, g) {
|
||||
const that: SVGGElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatumAlternative[] = d;
|
||||
const index: number = i;
|
||||
const group: SVGGElement[] | d3Selection.ArrayLike<SVGGElement> = g;
|
||||
@@ -569,14 +598,14 @@ d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in la
|
||||
});
|
||||
|
||||
// below fails, as 'this' in .classed(...) will default to BaseType, which may be null and does not have 'transform' property
|
||||
|
||||
// d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in last step of chain
|
||||
// .select('g.circles-group') // missing typing of selected DOM element for use in .classed(...)
|
||||
// .datum(data2) // new data type inferred
|
||||
// .classed('has-transform-property', function(d) {
|
||||
// console.log('Color of first data element array', d.length > 0? d[0].color: 'Data array empty'); // CircleDatumAlternative type
|
||||
// return this.transform !== undefined;
|
||||
// });
|
||||
d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in last step of chain
|
||||
.select('g.circles-group') // missing typing of selected DOM element for use in .classed(...)
|
||||
.datum(data2) // new data type inferred
|
||||
.classed('has-transform-property', function(d) {
|
||||
console.log('Color of first data element array', d.length > 0 ? d[0].color : 'Data array empty'); // CircleDatumAlternative type
|
||||
// $ExpectError
|
||||
return this.transform !== undefined;
|
||||
});
|
||||
|
||||
// SCENARIO 3: Only inferred typing (To have datum-type in 'classed' method call, no need for DOM object access)
|
||||
|
||||
@@ -585,7 +614,8 @@ d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in la
|
||||
.datum(data2) // new data type inferred
|
||||
.classed('has-green-first-data-element', function(d, i, g) {
|
||||
const that: d3Selection.BaseType = this;
|
||||
// const that2: Element = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: Element = this; // fails, type mismatch
|
||||
const datum: CircleDatumAlternative[] = d;
|
||||
const index: number = i;
|
||||
const group: d3Selection.BaseType[] | d3Selection.ArrayLike<d3Selection.BaseType> = g;
|
||||
@@ -663,7 +693,8 @@ circles2 = d3Selection.select<SVGSVGElement, any>('#svg2')
|
||||
circles2 = circles2 // returned update selection has the same type parameters as original selection, if data type is unchanged
|
||||
.data<CircleDatumAlternative>(endCircleData, d => d.nodeId);
|
||||
|
||||
// circles2.data<DivDatum>(endCircleData, function(d) { return d.nodeId; }); // fails, forced data type parameter and data argument mismatch
|
||||
// $ExpectError
|
||||
circles2.data<DivDatum>(endCircleData, (d) => d.nodeId); // fails, forced data type parameter and data argument mismatch
|
||||
|
||||
// ENTER-selection -----------------------------------------------------------------
|
||||
|
||||
@@ -690,7 +721,8 @@ const exitCircles = circles2.exit<CircleDatumAlternative>(); // Note: need to re
|
||||
exitCircles
|
||||
.style('opacity', function(d, i, g) {
|
||||
const that: SVGCircleElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatumAlternative = d;
|
||||
const index: number = i;
|
||||
const group: SVGCircleElement[] | d3Selection.ArrayLike<SVGCircleElement> = g;
|
||||
@@ -702,12 +734,13 @@ exitCircles
|
||||
// Note: the alternative using only .exit() without typing, will fail, if access to datum properties is attempted.
|
||||
// If access to d is not required, the short-hand is acceptable e.g. circles2.exit().remove();
|
||||
|
||||
// let exitCircles2 = circles2.exit(); // Note: Without explicit re-typing to the old data type, the data type default to '{}'
|
||||
// exitCircles2
|
||||
// .style('opacity', function(d) {
|
||||
// console.log('Circle Radius exit node: ', this.r.baseVal.value);
|
||||
// return d.color === 'green' ? 1 : 0; // fails, as data type is defaulted to {}. If datum access is required, this should trigger the thought to type .exit<...>
|
||||
// });
|
||||
const exitCircles2 = circles2.exit(); // Note: Without explicit re-typing to the old data type, the data type default to '{}'
|
||||
exitCircles2
|
||||
.style('opacity', function(d) {
|
||||
console.log('Circle Radius exit node: ', this.r.baseVal.value);
|
||||
// $ExpectError
|
||||
return d.color === 'green' ? 1 : 0; // fails, as data type is defaulted to {}. If datum access is required, this should trigger the thought to type .exit<...>
|
||||
});
|
||||
|
||||
// MERGE ENTER + UPDATE ------------------------------------------------------------------
|
||||
|
||||
@@ -733,8 +766,8 @@ tr = d3Selection.select('body')
|
||||
.append<HTMLTableElement>('table')
|
||||
.selectAll()
|
||||
.data(matrix)
|
||||
// .data([{test: 1}, {test: 2}]) // fails, using this data statement instead, would fail assignment to tr due to the data type of tr Selection
|
||||
// .data<number[]>([{test: 1}, {test: 2}]) // fails, using this data statement instead, would fail because of its type parameter not being met by input
|
||||
// $ExpectError
|
||||
.data<number[]>([{test: 1}, {test: 2}]) // fails, using this data statement instead, would fail because of its type parameter not being met by input
|
||||
.enter().append<HTMLTableRowElement>('tr');
|
||||
|
||||
nMatrix = tr.data(); // i.e. matrix
|
||||
@@ -745,7 +778,6 @@ td = tr.selectAll()
|
||||
.enter().append<HTMLTableDataCellElement>('td')
|
||||
.text(function(d, i, g) {
|
||||
const that: HTMLTableDataCellElement = this;
|
||||
// const that2: Element = this; // fails, type mismatch
|
||||
const datum: number = d;
|
||||
const index: number = i;
|
||||
const group: HTMLTableDataCellElement[] | d3Selection.ArrayLike<HTMLTableDataCellElement> = g;
|
||||
@@ -787,11 +819,13 @@ newDiv2 = body.append<HTMLDivElement>('div');
|
||||
|
||||
// using creator
|
||||
newDiv2 = body.append(d3Selection.creator<HTMLDivElement>('div'));
|
||||
// newDiv2 = body.append(d3Selection.creator('div')); // fails, as creator returns BaseType element, but HTMLDivElement is expected.
|
||||
// $ExpectError
|
||||
newDiv2 = body.append(d3Selection.creator('div')); // fails, as creator returns BaseType element, but HTMLDivElement is expected.
|
||||
|
||||
newDiv2 = body.append(function(d, i, g) {
|
||||
const that: HTMLBodyElement = this;
|
||||
// const that2: SVGElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: SVGElement = this; // fails, type mismatch
|
||||
const datum: BodyDatum = d;
|
||||
const index: number = i;
|
||||
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
|
||||
@@ -799,13 +833,15 @@ newDiv2 = body.append(function(d, i, g) {
|
||||
return this.ownerDocument!.createElement('div'); // this-type HTMLBodyElement
|
||||
});
|
||||
|
||||
// newDiv2 = body.append<HTMLDivElement>(function(d) {
|
||||
// return this.ownerDocument.createElement('a'); // fails, HTMLDivElement expected by type parameter, HTMLAnchorElement returned
|
||||
// });
|
||||
// $ExpectError
|
||||
newDiv2 = body.append<HTMLDivElement>(function(d) {
|
||||
return this.ownerDocument!.createElement('a'); // fails, HTMLDivElement expected by type parameter, HTMLAnchorElement returned
|
||||
});
|
||||
|
||||
// newDiv2 = body.append(function(d) {
|
||||
// return this.ownerDocument.createElement('a'); // fails, HTMLDivElement expected by inference, HTMLAnchorElement returned
|
||||
// });
|
||||
// $ExpectError
|
||||
newDiv2 = body.append(function(d) {
|
||||
return this.ownerDocument!.createElement('a'); // fails, HTMLDivElement expected by inference, HTMLAnchorElement returned
|
||||
});
|
||||
|
||||
// create a detached element
|
||||
|
||||
@@ -909,7 +945,8 @@ const size: number = gElementsOldData.size();
|
||||
// returns 'this' selection
|
||||
circles = circles.each(function(d, i, g) { // check chaining return type by re-assigning
|
||||
const that: SVGCircleElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGCircleElement[] | d3Selection.ArrayLike<SVGCircleElement> = g;
|
||||
@@ -931,13 +968,15 @@ function enforceMinRadius(selection: d3Selection.Selection<SVGCircleElement, Cir
|
||||
// returns 'this' selection
|
||||
circles = circles.call(enforceMinRadius, 40); // check chaining return type by re-assigning
|
||||
|
||||
// circles.call(function(selection: d3Selection.Selection<HTMLDivElement, CircleDatum, any, any>):void {
|
||||
// // fails, group element types of selection not compatible: SVGCircleElement v HTMLDivElement
|
||||
// });
|
||||
// $ExpectError
|
||||
circles.call((selection: d3Selection.Selection<HTMLDivElement, CircleDatum, any, any>) => {
|
||||
// fails, group element types of selection not compatible: SVGCircleElement v HTMLDivElement
|
||||
});
|
||||
|
||||
// circles.call(function(selection: d3Selection.Selection<SVGCircleElement, DivDatum, any, any>):void {
|
||||
// // fails, group datum types of selection not compatible: CircleDatumAlternative v DivDatum
|
||||
// });
|
||||
// $ExpectError
|
||||
circles.call((selection: d3Selection.Selection<SVGCircleElement, DivDatum, any, any>) => {
|
||||
// fails, group datum types of selection not compatible: CircleDatumAlternative v DivDatum
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Tests of Event Handling
|
||||
@@ -949,7 +988,8 @@ let listener: undefined | ((this: HTMLBodyElement, datum: BodyDatum, index: numb
|
||||
|
||||
body = body.on('click', function(d, i, g) {
|
||||
const that: HTMLBodyElement = this;
|
||||
// const that2: SVGElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: SVGElement = this; // fails, type mismatch
|
||||
const datum: BodyDatum = d;
|
||||
const index: number = i;
|
||||
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
|
||||
@@ -981,7 +1021,8 @@ body = body.dispatch('fooEvent', fooEventParam); // re-assign for chaining test;
|
||||
|
||||
body = body.dispatch('fooEvent', function(d, i, g) { // re-assign for chaining test;
|
||||
const that: HTMLBodyElement = this;
|
||||
// const that2: SVGElement = this; // fails, type mismatch
|
||||
// $ExpectError
|
||||
const that2: SVGElement = this; // fails, type mismatch
|
||||
const datum: BodyDatum = d;
|
||||
const index: number = i;
|
||||
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
|
||||
@@ -1016,11 +1057,16 @@ function customListener(this: HTMLBodyElement | null, finalOpponent: string): st
|
||||
|
||||
const resultText: string = d3Selection.customEvent(successEvent, customListener, body.node(), 'Wales');
|
||||
|
||||
// let result = d3Selection.customEvent(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in call
|
||||
// let resultValue: number = d3Selection.customEvent(successEvent, customListener, body.node(), 'Wales'); // fails, incompatible return types
|
||||
// d3Selection.customEvent<SVGCircleElement, any>(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in type parameter and call
|
||||
// d3Selection.customEvent<HTMLBodyElement, any>(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in type parameter and call
|
||||
// d3Selection.customEvent<HTMLBodyElement, number>(successEvent, customListener, body.node(), 'Wales'); // fails, incompatible return types
|
||||
// $ExpectError
|
||||
const result = d3Selection.customEvent(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in call
|
||||
// $ExpectError
|
||||
const resultValue: number = d3Selection.customEvent(successEvent, customListener, body.node(), 'Wales'); // fails, incompatible return types
|
||||
// $ExpectError
|
||||
d3Selection.customEvent<SVGCircleElement, any>(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in type parameter and call
|
||||
// $ExpectError
|
||||
d3Selection.customEvent<HTMLBodyElement, any>(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in type parameter and call
|
||||
// $ExpectError
|
||||
d3Selection.customEvent<HTMLBodyElement, number>(successEvent, customListener, body.node(), 'Wales'); // fails, incompatible return types
|
||||
|
||||
// mouse() ---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Vendored
+4
-1
@@ -1,6 +1,9 @@
|
||||
// Type definitions for D3JS d3-selection module 1.3
|
||||
// Project: https://github.com/d3/d3-selection/
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
|
||||
// Alex Ford <https://github.com/gustavderdrache>
|
||||
// Boris Yankov <https://github.com/borisyankov>
|
||||
// denisname <https://github.com/denisname>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.3.0
|
||||
|
||||
Vendored
+4
@@ -7,6 +7,10 @@
|
||||
|
||||
import { Path } from 'd3-path';
|
||||
|
||||
declare global {
|
||||
interface CanvasRenderingContext2D {} // tslint:disable-line no-empty-interface
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Shared Types and Interfaces
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
||||
@@ -9,6 +9,7 @@ tracer.init({
|
||||
debug: msg => {},
|
||||
error: err => {},
|
||||
},
|
||||
tags: { tracerEnv: 'dev'}
|
||||
});
|
||||
|
||||
function useWebFrameworkPlugin(plugin: "express" | "hapi" | "koa" | "restify") {
|
||||
|
||||
Vendored
+5
@@ -110,6 +110,11 @@ interface TracerOptions {
|
||||
debug: (message: string) => void;
|
||||
error: (err: Error) => void;
|
||||
};
|
||||
|
||||
/**
|
||||
* Global tags that should be assigned to every span.
|
||||
*/
|
||||
tags?: { [key: string]: any };
|
||||
}
|
||||
|
||||
interface ExperimentalOptions {}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { diff, observableDiff, applyChange, Diff } from 'deep-diff';
|
||||
|
||||
|
||||
import _deepDiff = require('deep-diff');
|
||||
var diff = _deepDiff.diff;
|
||||
|
||||
var lhs = {
|
||||
let lhs = {
|
||||
name: 'my object',
|
||||
description: 'it\'s an object!',
|
||||
details: {
|
||||
@@ -13,7 +10,7 @@ var lhs = {
|
||||
}
|
||||
};
|
||||
|
||||
var rhs = {
|
||||
let rhs = {
|
||||
name: 'updated object',
|
||||
description: 'it\'s an object!',
|
||||
details: {
|
||||
@@ -23,17 +20,13 @@ var rhs = {
|
||||
}
|
||||
};
|
||||
|
||||
var differences: deepDiff.IDiff[] = diff(lhs, rhs);
|
||||
const differences: Array<Diff<any>> = diff(lhs, rhs);
|
||||
|
||||
console.log(differences);
|
||||
|
||||
|
||||
// --------------------------
|
||||
|
||||
var observableDiff = _deepDiff.observableDiff;
|
||||
var applyChange = _deepDiff.applyChange;
|
||||
|
||||
var lhs = {
|
||||
lhs = {
|
||||
name: 'my object',
|
||||
description: 'it\'s an object!',
|
||||
details: {
|
||||
@@ -43,7 +36,7 @@ var lhs = {
|
||||
}
|
||||
};
|
||||
|
||||
var rhs = {
|
||||
rhs = {
|
||||
name: 'updated object',
|
||||
description: 'it\'s an object!',
|
||||
details: {
|
||||
@@ -53,7 +46,7 @@ var rhs = {
|
||||
}
|
||||
};
|
||||
|
||||
observableDiff(lhs, rhs, function (d: deepDiff.IDiff) {
|
||||
observableDiff(lhs, rhs, d => {
|
||||
// Apply all changes except those to the 'name' property...
|
||||
if (d.path.length !== 1 || d.path.join('.') !== 'name') {
|
||||
applyChange(lhs, rhs, d);
|
||||
|
||||
Vendored
+53
-35
@@ -1,42 +1,60 @@
|
||||
// Type definitions for deep-diff
|
||||
// Type definitions for deep-diff 1.0
|
||||
// Project: https://github.com/flitbit/diff/
|
||||
// Definitions by: ZauberNerd <https://github.com/ZauberNerd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
declare namespace deepDiff {
|
||||
interface IDiff {
|
||||
kind: string;
|
||||
path: string[];
|
||||
lhs: any;
|
||||
rhs: any;
|
||||
index?: number;
|
||||
item?: IDiff;
|
||||
}
|
||||
|
||||
interface IAccumulator {
|
||||
push(diff: IDiff): void;
|
||||
length: number;
|
||||
}
|
||||
|
||||
interface IPrefilter {
|
||||
(path: string[], key: string): boolean;
|
||||
}
|
||||
|
||||
interface IDeepDiff {
|
||||
diff(lhs: Object, rhs: Object, prefilter?: IPrefilter, acc?: IAccumulator): IDiff[];
|
||||
diff(): IDiff;
|
||||
observableDiff(lhs: Object, rhs: Object, changes: Function, prefilter?: IPrefilter, path?: string[], key?: string, stack?: Object[]): void;
|
||||
applyDiff(target: Object, source: Object, filter: Function): void;
|
||||
applyChange(target: Object, source: Object, change: IDiff): void;
|
||||
revertChange(target: Object, source: Object, change: IDiff): void;
|
||||
isConflict(): boolean;
|
||||
noConflict(): IDeepDiff;
|
||||
}
|
||||
export interface DiffNew<RHS> {
|
||||
kind: 'N';
|
||||
path?: any[];
|
||||
rhs: RHS;
|
||||
}
|
||||
|
||||
declare var DeepDiff: deepDiff.IDeepDiff;
|
||||
|
||||
declare module "deep-diff" {
|
||||
var diff: deepDiff.IDeepDiff;
|
||||
export = diff;
|
||||
export interface DiffDeleted<LHS> {
|
||||
kind: 'D';
|
||||
path?: any[];
|
||||
lhs: LHS;
|
||||
}
|
||||
|
||||
export interface DiffEdit<LHS, RHS = LHS> {
|
||||
kind: 'E';
|
||||
path?: any[];
|
||||
lhs: LHS;
|
||||
rhs: RHS;
|
||||
}
|
||||
|
||||
export interface DiffArray<LHS, RHS = LHS> {
|
||||
kind: 'A';
|
||||
path?: any[];
|
||||
index: number;
|
||||
item: Diff<LHS, RHS>;
|
||||
}
|
||||
|
||||
export type Diff<LHS, RHS = LHS> = DiffNew<RHS> | DiffDeleted<LHS> | DiffEdit<LHS, RHS> | DiffArray<LHS, RHS>;
|
||||
|
||||
export type PreFilterFunction = (path: any[], key: any) => boolean;
|
||||
export interface PreFilterObject<LHS, RHS = LHS> {
|
||||
prefilter?(path: any[], key: any): boolean;
|
||||
normalize?(currentPath: any, key: any, lhs: LHS, rhs: RHS): [ LHS, RHS ] | undefined;
|
||||
}
|
||||
export type PreFilter<LHS, RHS = LHS> = PreFilterFunction | PreFilterObject<LHS, RHS>;
|
||||
|
||||
export interface Accumulator<LHS, RHS = LHS> {
|
||||
push(diff: Diff<LHS, RHS>): void;
|
||||
length: number;
|
||||
}
|
||||
|
||||
export type Observer<LHS, RHS = LHS> = (diff: Diff<LHS, RHS>) => void;
|
||||
|
||||
export type Filter<LHS, RHS = LHS> = (target: LHS, source: RHS, change: Diff<LHS, RHS>) => boolean;
|
||||
|
||||
export function diff<LHS, RHS = LHS>(lhs: LHS, rhs: RHS, prefilter?: PreFilter<LHS, RHS>): Array<Diff<LHS, RHS>> | undefined;
|
||||
export function diff<LHS, RHS = LHS>(lhs: LHS, rhs: RHS, prefilter?: PreFilter<LHS, RHS>, acc?: Accumulator<LHS, RHS>): Accumulator<LHS, RHS>;
|
||||
export function orderIndependentDiff<LHS, RHS = LHS>(lhs: LHS, rhs: RHS, prefilter?: PreFilter<LHS, RHS>): Array<Diff<LHS, RHS>> | undefined;
|
||||
export function orderIndependentDiff<LHS, RHS = LHS>(lhs: LHS, rhs: RHS, prefilter?: PreFilter<LHS, RHS>, acc?: Accumulator<LHS, RHS>): Accumulator<LHS, RHS>;
|
||||
export function observableDiff<LHS, RHS = LHS>(lhs: LHS, rhs: RHS, observer?: Observer<LHS, RHS>, prefilter?: PreFilter<LHS, RHS>, orderIndependent?: boolean): Array<Diff<LHS, RHS>>;
|
||||
export function orderIndependentDeepDiff<LHS, RHS = LHS>(lhs: LHS, rhs: RHS, changes: Array<Diff<LHS, RHS>>, prefilter: PreFilter<LHS, RHS>, path: any[], key: any, stack: any[]): void;
|
||||
export function orderIndepHash(object: any): number;
|
||||
export function applyDiff<LHS, RHS = LHS>(target: LHS, source: RHS, filter?: Filter<LHS, RHS>): void;
|
||||
export function applyChange<LHS>(target: LHS, source: any, change: Diff<LHS, any>): void;
|
||||
export function revertChange<LHS>(target: LHS, source: any, change: Diff<LHS, any>): void;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user