mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
+1
-1
@@ -5,5 +5,5 @@ indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[{*.json,*.yml}]
|
||||
[{*.json,*.yml,*.ts}]
|
||||
indent_style = space
|
||||
|
||||
+5346
-4670
File diff suppressed because it is too large
Load Diff
@@ -46,6 +46,7 @@ npm-debug.log
|
||||
.settings/launch.json
|
||||
.vs
|
||||
.vscode
|
||||
.history
|
||||
|
||||
# yarn
|
||||
yarn.lock
|
||||
|
||||
+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:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
Also see the [definitelytyped.org](http://definitelytyped.org) website, although information in this README is more up-to-date.
|
||||
|
||||
*You can also read this README in [Spanish](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md) and [Korean!](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md)*
|
||||
*You can also read this README in [Spanish](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md), [Korean](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md), and [Russian](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ru.md)!*
|
||||
|
||||
## What are declaration files?
|
||||
|
||||
@@ -169,8 +169,14 @@ If a package was never on DefinitelyTyped, it does not need to be added to `notN
|
||||
|
||||
#### Lint
|
||||
|
||||
To lint a package, just add a `tslint.json` to that package containing `{ "extends": "dtslint/dt.json" }`. All new packages must be linted.
|
||||
If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example:
|
||||
All new packages must be linted. To lint a package, add a `tslint.json` to that package containing
|
||||
```js
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
```
|
||||
|
||||
This should be the only content in a finished project's `tslint.json` file. If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example:
|
||||
|
||||
```js
|
||||
{
|
||||
@@ -336,3 +342,6 @@ This project is licensed under the MIT license.
|
||||
Copyrights on the definition files are respective of each contributor listed at the beginning of each definition file.
|
||||
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=13) Are packages being published to npm in less than 10,000 seconds on average?
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=14) Has typescript-bot been active on DefinitelyTyped in the last two hours?
|
||||
|
||||
+353
@@ -0,0 +1,353 @@
|
||||
<!-- markdownlint-disable MD001 MD012 MD026 -->
|
||||
|
||||
# DefinitelyTyped [](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped)
|
||||
|
||||
[](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
> Репозиторий для *высококачественных* определений типов TypeScript.
|
||||
|
||||
Также посетите веб-сайт [definitelytyped.org](http://definitelytyped.org), хотя информация в этом README более свежая.
|
||||
|
||||
*Вы также можете прочитать этот README на [английском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md), [испанском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md) и [корейском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md).*
|
||||
|
||||
## Что такое файлы декларации (файлы описания/объявления типов)?
|
||||
|
||||
Смотрите [руководство по TypeScript](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html).
|
||||
|
||||
## Как их получить?
|
||||
|
||||
### npm
|
||||
|
||||
Это предпочтительный метод. Это доступно только для пользователей TypeScript 2.0+. Например:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @types/node
|
||||
```
|
||||
|
||||
Затем типы должны автоматически включаться компилятором.
|
||||
Подробнее смотрите в [справочнике](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html).
|
||||
|
||||
Для пакета NPM "foo", описания будут находиться в "@types/foo".
|
||||
Если вы не можете найти свой пакет, ищите его в [TypeSearch](https://microsoft.github.io/TypeSearch/).
|
||||
|
||||
Если вы все еще не можете найти его, проверьте [включает](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) ли пакет собственную типизацию.
|
||||
Обычно это отражается в поле `"types"` или `"typings"` файла `package.json`, или просто ищите любые файлы ".d.ts" в пакете и вручную включайте их в `/// <reference path="" />`.
|
||||
|
||||
|
||||
### Другие методы
|
||||
|
||||
Эти методы могут быть использованы TypeScript 1.0.
|
||||
|
||||
* [Typings](https://github.com/typings/typings)
|
||||
* ~~[NuGet](http://nuget.org/packages?q=DefinitelyTyped)~~ (используйте предпочтительные альтернативы, публикация типа nuget DT отключена)
|
||||
* Вручную загрузите из ветки `master` этого репозитория
|
||||
|
||||
Возможно, вам придется добавить ручные [ссылки](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html).
|
||||
|
||||
|
||||
## Как я могу внести свой вклад?
|
||||
|
||||
DefinitelyTyped работает только благодаря вкладу таких пользователей, как вы!
|
||||
|
||||
### Тестирование
|
||||
|
||||
Прежде чем поделиться своим улучшением с миром, используйте его сами.
|
||||
|
||||
#### Тестирование редактирования существующего пакета
|
||||
|
||||
Для добавления новых функций вы можете использовать [разрешение модулей](http://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
|
||||
Вы также можете напрямую редактировать типы в `node_modules/@types/foo/index.d.ts`, или скопировать их оттуда и выполнить следующие шаги.
|
||||
|
||||
|
||||
#### Тестирование ногово пакета
|
||||
|
||||
Добавьте к вашему `tsconfig.json`:
|
||||
|
||||
```json
|
||||
"baseUrl": "types",
|
||||
"typeRoots": ["types"],
|
||||
```
|
||||
|
||||
(Вы также можете использовать `src/types`.)
|
||||
Создайте `types/foo/index.d.ts` содержащие объявления для модуля "foo".
|
||||
Теперь вы сможете импортировать из `"foo"` в свой код, и он будет направлен к новому определению типа.
|
||||
Затем запустите сборку (build) *и* запустите код, чтобы убедиться, что ваше определение типа действительно соответствует тому, что происходит во время выполнения.
|
||||
После того как вы проверили свои определения с реальным кодом, создайте [Запрос на принятие изменений (PR)](#make-a-pull-request)
|
||||
и следуйте инструкциям [чтобы отредактировать существующий](#edit-an-existing-package) или
|
||||
[создать новый пакет](#create-a-new-package).
|
||||
|
||||
|
||||
### Запрос на принятие изменений (PR)
|
||||
|
||||
После того, как вы проверили ваш пакет, вы можете поделиться им с DefinitelyTyped.
|
||||
|
||||
Во-первых, [разветвите](https://guides.github.com/activities/forking/) этот репозиторий, установите [node](https://nodejs.org/), и запустите `npm install`.
|
||||
|
||||
|
||||
#### Изменение существующего пакета
|
||||
|
||||
* `cd types/my-package-to-edit`
|
||||
* Внесите изменения. Не забудьте отредактировать тесты.
|
||||
Если вы вносите критические изменения, не забудьте [обновить основную версию](#i-want-to-update-a-package-to-a-new-major-version).
|
||||
* Вы также можете добавить себя в раздел "Definitions by" заголовка пакета.
|
||||
* Это приведет к тому, что вы будете уведомлены (через ваше имя пользователя GitHub) о том, что кто-то делает запрос на принятие изменений (PR) или проблему с пакетом.
|
||||
* Сделайте это, добавив свое имя в конец строки, например `// Definitions by: Alice <https://github.com/alice>, Bob <https://github.com/bob>`.
|
||||
* Или, если есть больше людей, это может быть многострочным
|
||||
|
||||
```typescript
|
||||
// Definitions by: Alice <https://github.com/alice>
|
||||
// Bob <https://github.com/bob>
|
||||
// Steve <https://github.com/steve>
|
||||
// John <https://github.com/john>
|
||||
```
|
||||
|
||||
* Если есть `tslint.json`, запустите `npm run lint package-name`. В противном случае запустите `tsc` в директории пакета.
|
||||
|
||||
Когда вы создаете PR для редактирования существующего пакета, `dt-bot` должен @-уведомить
|
||||
предыдущих авторов. Если этого не произойдет, вы можете сделать это самостоятельно в комментарии, связанном с PR.
|
||||
|
||||
|
||||
#### Созданое нового пакета
|
||||
|
||||
Если вы являетесь автором библиотеки и ваш пакет написан на TypeScript, [свяжите автоматически сгенерированные файлы объявлений](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) в вашем пакете, а не публикуйте в DefinitelyTyped.
|
||||
|
||||
Если вы добавляете типизацию для пакета NPM, создайте директорию с тем же именем.
|
||||
Если пакет, для которого вы добавляете типизацию, отсутствует в NPM, убедитесь, что выбранное вами имя не конфликтует с именем пакета в NPM.
|
||||
(Вы можете использовать `npm info foo` чтобы проверить наличие пакета `foo`.)
|
||||
|
||||
Ваш пакет должен иметь такую структуру:
|
||||
|
||||
| Файл | Назначение |
|
||||
| ------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| index.d.ts | Содержит типизацию для пакета. |
|
||||
| foo-tests.ts | Содержит пример кода, который проверяет типизацию. Этот код *не* запускается, но он проверен на тип. |
|
||||
| tsconfig.json | Позволяет вам запускать `tsc` внутри пакета. |
|
||||
| tslint.json | Включает linting. |
|
||||
|
||||
Создайте их, запустив `npx dts-gen --dt --name my-package-name --template module` если у вас npm ≥ 5.2.0, `npm install -g dts-gen` и `dts-gen --dt --name my-package-name --template module` в противном случае.
|
||||
Посмотреть все варианты на [dts-gen](https://github.com/Microsoft/dts-gen).
|
||||
|
||||
Вы можете отредактировать `tsconfig.json` чтобы добавить новые файлы, добавить `"target": "es6"` (необходимо для асинхронных функций), добавить в `"lib"`, или добавить опцию компилятора `"jsx"`.
|
||||
|
||||
Члены группы DefinitelyTyped регулярно следят за новыми PR, но имейте в виду, что количество других PR может замедлить ход событий.
|
||||
|
||||
Хороший пример пакета смотрите [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/base64-js).
|
||||
|
||||
|
||||
#### Распространенные ошибки
|
||||
|
||||
* Сначала следуйте советам из справочника [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html).
|
||||
* Форматирование: либо используйте все табы, либо всегда используйте 4 пробела.
|
||||
* `function sum(nums: number[]): number`: используйте `ReadonlyArray` если функция не записывает свои параметры.
|
||||
* `interface Foo { new(): Foo; }`:
|
||||
Это определяет тип объектов, с методом `new`. Вы, вероятно, хотите объявить `declare class Foo { constructor(); }`.
|
||||
* `const Class: { new(): IClass; }`:
|
||||
Предпочитайте использовать объявление класса `class Class { constructor(); }` вместо `new`.
|
||||
* `getMeAT<T>(): T`:
|
||||
Если параметр типа не отображается в типах каких-либо параметров, у вас нет универсальной функции, а просто замаскированное утверждение типа.
|
||||
Предпочитайте использовать утверждение реального типа, например, `getMeAT() as number`.
|
||||
Пример, где допустим параметр типа: `function id<T>(value: T): T;`.
|
||||
Пример, где это недопустимо: `function parseJson<T>(json: string): T;`.
|
||||
Исключение: `new Map<string, number>()` все ОК.
|
||||
* Использование типов `Function` and `Object` почти никогда не является хорошей идеей. В 99% случаев можно указать более конкретный тип. Примеры: `(x: number) => number` для [функций](http://www.typescriptlang.org/docs/handbook/functions.html#function-types) and `{ x: number, y: number }` для объектов. Если нет никакой уверенности в типе, [`any`](http://www.typescriptlang.org/docs/handbook/basic-types.html#any) является правильным выбором, а не `Object`. Если единственным известным фактом о типе является то, что это какой-то объект, используйте тип [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type), а не `Object` или `{ [key: string]: any }`.
|
||||
* `var foo: string | any`:
|
||||
когда `any` используется в типе объединения, результирующий тип все еще `any`. Таким образом, хотя `string` часть аннотации этого типа может _выглядеть_ полезной, на самом деле она не предлагает никакой дополнительной проверки типов по сравнению с простым использованием `any`.
|
||||
В зависимости от намерения, приемлемыми альтернативами могут быть `any`, `string`, или `string | object`.
|
||||
|
||||
|
||||
#### Удаление пакета
|
||||
|
||||
Когда пакет [объединяет](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) свои собственные типы, типы должны быть удалены из DefinitelyTyped чтобы избежать путаницы.
|
||||
|
||||
Вы можете удалить его, запустив `npm run not-needed -- typingsPackageName asOfVersion sourceRepoURL [libraryName]`.
|
||||
|
||||
* `typingsPackageName`: название директории, который нужно удалить.
|
||||
* `asOfVersion`: заглушка будет опубликована в `@types/foo` с этой версией. Должна быть выше, чем любая опубликованная на данный момент версия
|
||||
* `sourceRepoURL`: Это должно указывать на репозиторий, который содержит типизации.
|
||||
* `libraryName`: описательное имя библиотеки, например, "Angular 2" вместо "angular2". (Если опущено, будет идентично "typingsPackageName".)
|
||||
|
||||
Любые другие пакеты в DefinitelyTyped которые ссылаются на удаленный пакет, должны быть обновлены для ссылки на связанные типы. Для этого добавьте в `package.json` ссыклу `"dependencies": { "foo": "x.y.z" }`.
|
||||
|
||||
Если пакет никогда не был в DefinitelyTyped, его не нужно добавлять в `notNeededPackages.json`.
|
||||
|
||||
|
||||
#### Lint
|
||||
|
||||
Все новые пакеты должны быть проанализированы lint. Для этого добавьте `tslint.json` в этот пакет, содержащий
|
||||
|
||||
```js
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
```
|
||||
|
||||
Это должно быть единственным содержимым в файле `tslint.json` готового проекта. Если `tslint.json` отключает правила, это потому, что это еще не исправлено. Например:
|
||||
|
||||
```js
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// This package uses the Function type, and it will take effort to fix.
|
||||
"ban-types": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
(Чтобы указать, что правило lint действительно не применяется, используйте `// tslint:disable rule-name` или лучше, `//tslint:disable-next-line rule-name`.)
|
||||
|
||||
Чтобы проверить, что выражение имеет заданный тип, используйте `$ExpectType`. Чтобы проверить, что выражение вызывает ошибку компиляции, используйте `$ExpectError`.
|
||||
|
||||
```js
|
||||
// $ExpectType void
|
||||
f(1);
|
||||
|
||||
// $ExpectError
|
||||
f("one");
|
||||
```
|
||||
|
||||
Для получения дополнительной информации см. [dtslint](https://github.com/Microsoft/dtslint#write-tests) readme.
|
||||
|
||||
Протестируйте, запустив `npm run lint package-name` где `package-name` - это имя вашего пакета.
|
||||
Этот скрипт использует [dtslint](https://github.com/Microsoft/dtslint).
|
||||
|
||||
|
||||
## Часто задаваемые вопросы
|
||||
|
||||
#### Какая связь между этим репозиторием и пакетами `@types` в NPM?
|
||||
|
||||
Ветвь `master` автоматически публикуется в область `@types` на NPM благодаря [types-publisher](https://github.com/Microsoft/types-publisher).
|
||||
|
||||
#### Я отправил PR. Когда он сольется?
|
||||
|
||||
Это зависит, но большинство запросов на получение данных будут объединены в течение недели. PR, утвержденные автором, указанным в заголовке определения, обычно объединяются быстрее; PR для новых определений займет больше времени, так как они требуют большего количества проверок от сопровождающих. Каждый PR проверяется членом команды TypeScript или DefinitelyTyped перед объединением, поэтому будьте терпеливы, так как человеческий фактор может вызвать задержки. Посмотрите на [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) чтобы увидеть, как сопровождающие работают через открытые PR.
|
||||
|
||||
#### Мой PR слит; когда будет обновлен пакет `@types` NPM?
|
||||
|
||||
Пакеты NPM должны обновиться в течение нескольких часов. Если прошло более 24 часов, пингуйте @RyanCavanaugh и @andy-ms в PR, чтобы расследовать.
|
||||
|
||||
#### Я пишу определение, которое зависит от другого определения. Должен ли я использовать `<reference types="" />` или import?
|
||||
|
||||
Если модуль, на который вы ссылаетесь, является внешним модулем (использует `export`), используйте import.
|
||||
Если модуль, на который вы ссылаетесь, является окружающим модулем (использует `declare module`, или просто объявляет глобальные переменные), используйте `<reference types="" />`.
|
||||
|
||||
#### Я заметил, что у некоторых пакетов есть `package.json`.
|
||||
|
||||
Обычно вам это не нужно. При публикации пакета мы обычно автоматически создаем `package.json`.
|
||||
`package.json` может быть включен для определения зависимостей. Вот [пример](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pikaday/package.json).
|
||||
Мы не разрешаем определять другие поля, такие как "description", вручную.
|
||||
Кроме того, если вам нужно сослаться на более старую версию типизаций, вы должны сделать это, добавив в `package.json` строки `"dependencies": { "@types/foo": "x.y.z" }`.
|
||||
|
||||
#### В некоторых пакетах отсутствует `tslint.json`, а в некоторых `tsconfig.json` отсутствует `"noImplicitAny": true`, `"noImplicitThis": true`, или `"strictNullChecks": true`.
|
||||
|
||||
Тогда они не правы. Вы можете помочь, отправив PR, чтобы исправить их.
|
||||
|
||||
#### Могу ли я запросить определение?
|
||||
|
||||
Вот [текущие запрошенные определения](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest).
|
||||
|
||||
#### Как насчет определений типов для DOM?
|
||||
|
||||
Если типы являются частью веб-стандарта, они должны быть добавлены в [TSJS-lib-generator](https://github.com/Microsoft/TSJS-lib-generator) чтобы они могли стать частью `lib.dom.d.ts` по умолчанию.
|
||||
|
||||
#### Пакет использует export `export =`, но я предпочитаю использовать импорт по умолчанию. Могу ли я изменить `export =` на `export default`?
|
||||
|
||||
Если вы используете TypeScript 2.7 или более позднюю версию, используйте `--esModuleInterop` в вашем проекте.
|
||||
В противном случае, если импорт по умолчанию работает в вашей среде (например, Webpack, SystemJS, esm), рассмотрите возможность включения опции компилятора [`--allowSyntheticDefaultImports`](http://www.typescriptlang.org/docs/handbook/compiler-options.html).
|
||||
Не меняйте определение типа, если оно точное.
|
||||
Для пакета NPM, `export =` является точным, если `node -p 'require("foo")'` является экспортом, а `export default` является точным, если `node -p 'require("foo").default'` является экспортом.
|
||||
|
||||
#### Я хочу использовать функции из TypeScript 2.1 или выше.
|
||||
|
||||
В таком случае вам нужно будет добавить комментарий к последней строке заголовка вашего определения (после `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`): `// TypeScript Version: 2.1`.
|
||||
|
||||
#### Я хочу добавить DOM API, отсутствующий в TypeScript по умолчанию.
|
||||
|
||||
Это может принадлежать [TSJS-Lib-Generator](https://github.com/Microsoft/TSJS-lib-generator#readme). Смотрите инструкции там.
|
||||
Если стандарт все еще является черновиком, добавляйте сюда.
|
||||
Используйте имя, начинающееся с `dom-` и включите ссылку на стандарт в качестве ссылки "Project" в заголовке.
|
||||
Когда он завершает черновой режим, мы можем удалить его из DefinitelyTyped и объявить устаревшим связанный пакет `@types`.
|
||||
|
||||
#### Я хочу обновить пакет новой старшей версии
|
||||
|
||||
Если вы намерены продолжить обновление старой версии пакета, вы можете создать новую подпапку с текущей версией, например, `v2` и скопируйте в него существующие файлы. Если это так, вам необходимо:
|
||||
|
||||
1. Обновите относительные пути в `tsconfig.json` а также в `tslint.json`.
|
||||
2. Добавьте правила сопоставления путей, чтобы убедиться, что тесты выполняются для предполагаемой версии.
|
||||
|
||||
Например [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/history/v2/tsconfig.json) looks like:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": ["../../"],
|
||||
"paths": {
|
||||
"history": [ "history/v2" ]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"history-tests.ts"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Если в DefinitelyTyped есть другие пакеты, несовместимые с новой версией, вам нужно будет добавить сопоставления путей к старой версии. Вам также нужно будет сделать это для пакетов в зависимости от пакетов в зависимости от старой версии.
|
||||
|
||||
Например, `react-router` зависит от `history@2`, поэтому [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) есть сопоставление пути с `"history": [ "history/v2" ]`;
|
||||
транзитивно `react-router-bootstrap` (который зависит от `react-router`) также добавляет отображение пути в свой [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json).
|
||||
|
||||
Также, `/// <reference types=".." />` не будет работать с отображением пути, поэтому зависимости должны использовать `import`.
|
||||
|
||||
#### Как мне написать определения для пакетов, которые могут использоваться и глобально и в качестве модуля?
|
||||
|
||||
Руководство TypeScript содержит отличную [общую информацию о написании определений](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html), а также [этот пример файла определения](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-modifying-module-d-ts.html) , в котором показано, как создать определение с использованием синтаксиса модуля в стиле ES6, а также указаны объекты, доступные для глобальной области. Этот метод демонстрируется практически в определении для [definition for big.js](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/big.js/index.d.ts), библиотекой, которую можно загружать глобально с помощью тега скрипта на веб-странице или импортировать с помощью импорта по требованию или в стиле ES6.
|
||||
|
||||
Чтобы проверить, как ваше определение может использоваться как при глобальных ссылках, так и в качестве импортированного модуля, создайте тестовую папку `test`, и поместите туда два тестовых файла. Назовите один `YourLibraryName-global.test.ts` а другой `YourLibraryName-module.test.ts`. *Глобальный* тестовый файл должен использовать определение в соответствии с тем, как он будет использоваться в скрипте, загруженном на веб-страницу, где библиотека доступна в глобальной области видимости - в этом сценарии не следует указывать оператор импорта. Тестовый файл *модуля* должен использовать определение в соответствии с тем, как оно будет использоваться при импорте (включая оператор(ы) `import`). Если вы указали свойство `files` в файле `tsconfig.json`, обязательно включите оба тестовых файла. [Практический пример этого](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/big.js/test) также доступен в определении big.js.
|
||||
|
||||
Обратите внимание, что не требуется полностью использовать определение в каждом тестовом файле - достаточно протестировать только глобально доступные элементы в глобальном тестовом файле и полностью выполнить определение в тестовом файле модуля, или наоборот.
|
||||
|
||||
#### А как насчет областных пакетов?
|
||||
|
||||
Типы для пакета с областью `@foo/bar` должны указываться в `types/foo__bar`. Обратите внимание на двойное подчеркивание.
|
||||
|
||||
Когда `dts-gen` используется для компоновки пакета с областью действия, свойство `paths` должно быть вручную адаптировано в сгенерированном файле
|
||||
`tsconfig.json` для правильной ссылки на пакет с областью действия:
|
||||
|
||||
```json
|
||||
{
|
||||
"paths":{
|
||||
"@foo/bar": ["foo__bar"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### История файлов в GitHub выглядит неполной.
|
||||
|
||||
GitHub не [поддерживает](http://stackoverflow.com/questions/5646174/how-to-make-github-follow-directory-history-after-renames) историю файлов для переименованных файлов. Вместо этого используйте [`git log --follow`](https://www.git-scm.com/docs/git-log).
|
||||
|
||||
#### Должен ли я добавить пустой namespace в пакет, который не экспортирует модуль для использования импорта в стиле ES6?
|
||||
|
||||
Некоторые пакеты, такие как [chai-http](https://github.com/chaijs/chai-http), экспортируют функцию.
|
||||
|
||||
Импорт этого модуля с импортом в стиле ES6 в форме `import * as foo from "foo";` приводит к ошибке:
|
||||
|
||||
> error TS2497: Module 'foo' resolves to a non-module entity and cannot be imported using this construct
|
||||
|
||||
Эту ошибку можно устранить, объединив объявление функции с пустым namespace'ом с тем же именем, но это не рекомендуется.
|
||||
Это часто цитируемый [ответ с Stack Overflow](https://stackoverflow.com/questions/39415661/what-does-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this) по этому вопросу.
|
||||
|
||||
Более целесообразно импортировать модуль, используя `import foo = require("foo");` синтаксис или использовать импорт по умолчанию, такой как `import foo from "foo";` при использовании флага `--allowSyntheticDefaultImports`, если среда выполнения вашего модуля поддерживает схему взаимодействия для модулей не-ECMAScript как таковых.
|
||||
|
||||
## Лицензия
|
||||
|
||||
Этот проект лицензирован по лицензии MIT.
|
||||
|
||||
Авторские права на файлы определений принадлежат каждому участнику, указанному в начале каждого файла определения.
|
||||
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=13) В среднем пакеты публикуются на npm менее чем за 10000 секунд?
|
||||
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=14) Был ли typescript-bot активным на DefinitelyTyped в последние два часа?
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for node-gettext 2.0
|
||||
// Project: http://github.com/alexanderwallin/node-gettext
|
||||
// Definitions by: Sameer K.C. <https://github.com/sameercaresu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = GetText;
|
||||
declare class GetText {
|
||||
constructor(options?: { debug: boolean; });
|
||||
addTranslations(locale: string, domain: string, translations: object): void;
|
||||
dgettext(domain: string, msgid: string): string;
|
||||
dngettext(domain: string, msgid: string, msgidPlural: string, count: number): string;
|
||||
dnpgettext(domain: string, msgctxt: string, msgid: string, msgidPlural: string, count: number): string;
|
||||
dpgettext(domain: string, msgctxt: string, msgid: string): string;
|
||||
emit(eventName: string, eventData: any): void;
|
||||
getComment(domain: string, msgctxt: string, msgid: string): object | boolean;
|
||||
gettext(msgid: string): string;
|
||||
ngettext(msgid: string, msgidPlural: string, count: number): string;
|
||||
npgettext(msgctxt: string, msgid: string, msgidPlural: string, count: number): string;
|
||||
off(eventName: string, callback: (params: any) => void): string;
|
||||
on(eventName: string, callback: (params: any) => void): void;
|
||||
pgettext(msgctxt: string, msgid: string): string;
|
||||
setLocale(locale: string): void;
|
||||
setTextDomain(domain: string): void;
|
||||
static getLanguageCode(locale: string): string;
|
||||
textdomain(domain: string): void;
|
||||
warn(message: string): void;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// with tsc v 2.7 & esModuleInterop & allowSyntheticDefaultImports enabled in tsconfig.json
|
||||
import Gettext from 'node-gettext';
|
||||
// or without
|
||||
// import Gettext = require('node-getttext');
|
||||
|
||||
const translations = {};
|
||||
const gt = new Gettext({ debug: true });
|
||||
const msgid = 'Get translation';
|
||||
const msgidPlural = 'Get translations';
|
||||
const domain = 'domain';
|
||||
const msgctxt = 'context';
|
||||
const count = 2;
|
||||
|
||||
gt.addTranslations('en-US', 'messages', translations);
|
||||
gt.setTextDomain(domain);
|
||||
gt.textdomain(domain);
|
||||
gt.setLocale('en-US');
|
||||
gt.gettext(msgid);
|
||||
gt.dgettext('', msgid);
|
||||
gt.dngettext(domain, msgid, msgidPlural, count);
|
||||
gt.dnpgettext(domain, msgctxt, msgid, msgidPlural, count);
|
||||
gt.dpgettext(domain, msgctxt, msgid);
|
||||
gt.getComment(domain, msgctxt, msgid);
|
||||
gt.ngettext(msgid, msgidPlural, count);
|
||||
gt.npgettext(msgctxt, msgid, msgidPlural, count);
|
||||
gt.pgettext(msgctxt, msgid);
|
||||
Gettext.getLanguageCode('en-US');
|
||||
gt.warn('warning');
|
||||
const errorListener = (error: string) => {
|
||||
// do something;
|
||||
};
|
||||
gt.on('error', errorListener);
|
||||
gt.emit('error', 'Error occurred');
|
||||
gt.off('error', errorListener);
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-gettext-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -144,6 +144,12 @@
|
||||
"sourceRepoURL": "https://github.com/Azure/azure-mobile-apps-node/",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "@babel/parser",
|
||||
"typingsPackageName": "babel__parser",
|
||||
"sourceRepoURL": "https://github.com/babel/babel",
|
||||
"asOfVersion": "7.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "BabylonJS",
|
||||
"typingsPackageName": "babylonjs",
|
||||
@@ -174,6 +180,12 @@
|
||||
"sourceRepoURL": "https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions",
|
||||
"asOfVersion": "2.0.15"
|
||||
},
|
||||
{
|
||||
"libraryName": "bitwise",
|
||||
"typingsPackageName": "bitwise",
|
||||
"sourceRepoURL": "https://github.com/dodekeract/bitwise",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "botvs",
|
||||
"typingsPackageName": "botvs",
|
||||
@@ -390,6 +402,18 @@
|
||||
"sourceRepoURL": "https://github.com/MikeMcl/decimal.js",
|
||||
"asOfVersion": "7.4.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "deepmerge",
|
||||
"typingsPackageName": "deepmerge",
|
||||
"sourceRepoURL": "git@github.com:KyleAMathews/deepmerge.git",
|
||||
"asOfVersion": "2.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "delay",
|
||||
"typingsPackageName": "delay",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/delay",
|
||||
"asOfVersion": "3.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "DevExtreme",
|
||||
"typingsPackageName": "devextreme",
|
||||
@@ -522,6 +546,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",
|
||||
@@ -606,6 +636,18 @@
|
||||
"sourceRepoURL": "https://github.com/mikedeboer/node-github",
|
||||
"asOfVersion": "7.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "gitlab",
|
||||
"typingsPackageName": "gitlab",
|
||||
"sourceRepoURL": "https://github.com/jdalrymple/node-gitlab",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "Google Cloud Storage",
|
||||
"typingsPackageName": "google-cloud__storage",
|
||||
"sourceRepoURL": "https://github.com/googleapis/nodejs-storage",
|
||||
"asOfVersion": "2.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "graphene-pk11",
|
||||
"typingsPackageName": "graphene-pk11",
|
||||
@@ -642,6 +684,12 @@
|
||||
"sourceRepoURL": "https://handsontable.com/",
|
||||
"asOfVersion": "0.35.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "hibp",
|
||||
"typingsPackageName": "hibp",
|
||||
"sourceRepoURL": "https://github.com/wKovacs64/hibp",
|
||||
"asOfVersion": "7.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "homeworks",
|
||||
"typingsPackageName": "homeworks",
|
||||
@@ -912,12 +960,24 @@
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/lower-case-first",
|
||||
"asOfVersion": "1.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "mali",
|
||||
"typingsPackageName": "mali",
|
||||
"sourceRepoURL": "https://github.com/malijs/mali",
|
||||
"asOfVersion": "0.9.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "maquette",
|
||||
"typingsPackageName": "maquette",
|
||||
"sourceRepoURL": "http://maquettejs.org/",
|
||||
"asOfVersion": "2.1.6"
|
||||
},
|
||||
{
|
||||
"libraryName": "maxmind",
|
||||
"typingsPackageName": "maxmind",
|
||||
"sourceRepoURL": "https://github.com/runk/node-maxmind",
|
||||
"asOfVersion": "2.0.5"
|
||||
},
|
||||
{
|
||||
"libraryName": "mendixmodelsdk",
|
||||
"typingsPackageName": "mendixmodelsdk",
|
||||
@@ -954,6 +1014,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.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "Moment",
|
||||
"typingsPackageName": "moment",
|
||||
@@ -972,6 +1038,12 @@
|
||||
"sourceRepoURL": "https://github.com/mqttjs/MQTT.js",
|
||||
"asOfVersion": "2.5.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "nano",
|
||||
"typingsPackageName": "nano",
|
||||
"sourceRepoURL": "https://github.com/apache/couchdb-nano",
|
||||
"asOfVersion": "7.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "ng-table",
|
||||
"typingsPackageName": "ng-table",
|
||||
@@ -1176,6 +1248,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",
|
||||
@@ -1266,6 +1344,12 @@
|
||||
"sourceRepoURL": "https://github.com/zalmoxisus/redux-devtools-extension",
|
||||
"asOfVersion": "2.13.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "redux-little-router",
|
||||
"typingsPackageName": "redux-little-router",
|
||||
"sourceRepoURL": "https://github.com/FormidableLabs/redux-little-router",
|
||||
"asOfVersion": "15.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "redux-persist",
|
||||
"typingsPackageName": "redux-persist",
|
||||
@@ -1404,6 +1488,12 @@
|
||||
"sourceRepoURL": "https://github.com/zeh/simplesignal",
|
||||
"asOfVersion": "1.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "sip.js",
|
||||
"typingsPackageName": "sip.js",
|
||||
"sourceRepoURL": "https://github.com/onsip/SIP.js",
|
||||
"asOfVersion": "0.12.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "smooth-scrollbar",
|
||||
"typingsPackageName": "smooth-scrollbar",
|
||||
@@ -1434,6 +1524,12 @@
|
||||
"sourceRepoURL": "https://github.com/mozilla/source-map",
|
||||
"asOfVersion": "0.5.7"
|
||||
},
|
||||
{
|
||||
"libraryName": "Spectacle",
|
||||
"typingsPackageName": "spectacle",
|
||||
"sourceRepoURL": "http://github.com/FormidableLabs/spectacle/",
|
||||
"asOfVersion": "5.2.3"
|
||||
},
|
||||
{
|
||||
"libraryName": "Spin.js",
|
||||
"typingsPackageName": "spin.js",
|
||||
@@ -1584,6 +1680,12 @@
|
||||
"sourceRepoURL": "https://github.com/ansman/validate.js",
|
||||
"asOfVersion": "0.11.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "vega",
|
||||
"typingsPackageName": "vega",
|
||||
"sourceRepoURL": "https://github.com/vega/vega",
|
||||
"asOfVersion": "3.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "vso-node-api",
|
||||
"typingsPackageName": "vso-node-api",
|
||||
|
||||
+3
-2
@@ -22,6 +22,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"dtslint": "github:Microsoft/dtslint#production",
|
||||
"types-publisher": "Microsoft/types-publisher#production"
|
||||
}
|
||||
"types-publisher": "github:Microsoft/types-publisher#production"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import A11yDialog = require('a11y-dialog');
|
||||
|
||||
const dialogEl = new A11yDialog(document.getElementById("test"));
|
||||
const dialogElTwo = new A11yDialog(document.getElementById("test"), document.getElementById("testContainer"));
|
||||
const dialogElThree = new A11yDialog(document.getElementById("test"), "dummy-element");
|
||||
|
||||
dialogEl.show();
|
||||
dialogEl.hide();
|
||||
dialogElTwo.destroy();
|
||||
dialogElThree.create();
|
||||
|
||||
// Test out interfaces that extends Element.
|
||||
dialogEl.on("show", (el: HTMLElement) => {
|
||||
el.textContent;
|
||||
});
|
||||
|
||||
// Test out element and event.
|
||||
dialogEl.on("create", (el: HTMLElement, evt) => {
|
||||
el.textContent;
|
||||
|
||||
evt.target;
|
||||
});
|
||||
|
||||
dialogEl.on('hide', () => {
|
||||
const t = 5;
|
||||
});
|
||||
|
||||
dialogEl.off("show", (el: HTMLElement) => {
|
||||
el.textContent;
|
||||
});
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for a11y-dialog 5.2
|
||||
// Project: https://github.com/edenspiekermann/a11y-dialog
|
||||
// Definitions by: Yuto <https://github.com/Goyatuzo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
type DialogEvents = "show" | "hide" | "destroy" | "create";
|
||||
declare class A11yDialog {
|
||||
constructor(el: Element | null, containers?: NodeList | Element | string | null);
|
||||
/**
|
||||
* Shows the dialog.
|
||||
*/
|
||||
show(): void;
|
||||
/**
|
||||
* Hides the dialog.
|
||||
*/
|
||||
hide(): void;
|
||||
/**
|
||||
* Unbind click listeners from dialog openers and closers and remove all bound custom event listeners registered with `.on()`
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
* Bind click listeners to dialog openers and closers.
|
||||
*/
|
||||
create(el?: Element | null, containers?: NodeList | Element | string | null): void;
|
||||
|
||||
on(evt: DialogEvents, callback: (dialogElement: any, event: Event) => void): void;
|
||||
off(evt: DialogEvents, callback: (dialogElement: any, event: Event) => void): void;
|
||||
}
|
||||
|
||||
export = A11yDialog;
|
||||
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
@@ -20,6 +20,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"spectacle-tests.tsx"
|
||||
"a11y-dialog-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -11,3 +11,7 @@ const test = (levelDown: AbstractLevelDOWN<any, string>) => {
|
||||
test(new AbstractLevelDOWN('here'));
|
||||
// $ExpectType void
|
||||
test(AbstractLevelDOWN('there'));
|
||||
// $ExpectType void
|
||||
test(new AbstractLevelDOWN<any, string>('here'));
|
||||
// $ExpectType void
|
||||
test(AbstractLevelDOWN<any, string>('there'));
|
||||
|
||||
Vendored
+25
-14
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Meirion Hughes <https://github.com/MeirionHughes>
|
||||
// Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export interface AbstractOptions {
|
||||
readonly [k: string]: any;
|
||||
@@ -21,7 +22,7 @@ export interface AbstractGetOptions extends AbstractOptions {
|
||||
asBuffer?: boolean;
|
||||
}
|
||||
|
||||
export interface AbstractLevelDOWN<K, V> extends AbstractOptions {
|
||||
export interface AbstractLevelDOWN<K = any, V = any> extends AbstractOptions {
|
||||
open(cb: ErrorCallback): void;
|
||||
open(options: AbstractOpenOptions, cb: ErrorCallback): void;
|
||||
|
||||
@@ -38,17 +39,23 @@ export interface AbstractLevelDOWN<K, V> extends AbstractOptions {
|
||||
|
||||
batch(): AbstractChainedBatch<K, V>;
|
||||
batch(array: ReadonlyArray<AbstractBatch<K, V>>, cb: ErrorCallback): AbstractChainedBatch<K, V>;
|
||||
batch(array: ReadonlyArray<AbstractBatch<K, V>>, options: AbstractOptions, cb: ErrorCallback): AbstractChainedBatch<K, V>;
|
||||
batch(
|
||||
array: ReadonlyArray<AbstractBatch<K, V>>,
|
||||
options: AbstractOptions,
|
||||
cb: ErrorCallback,
|
||||
): AbstractChainedBatch<K, V>;
|
||||
|
||||
iterator(options?: AbstractIteratorOptions<K>): AbstractIterator<K, V>;
|
||||
}
|
||||
|
||||
export interface AbstractLevelDOWNConstructor {
|
||||
new (location: string): AbstractLevelDOWN<any, any>;
|
||||
(location: string): AbstractLevelDOWN<any, any>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
new <K = any, V = any>(location: string): AbstractLevelDOWN<K, V>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
<K = any, V = any>(location: string): AbstractLevelDOWN<K, V>;
|
||||
}
|
||||
|
||||
export interface AbstractIteratorOptions<K> extends AbstractOptions {
|
||||
export interface AbstractIteratorOptions<K = any> extends AbstractOptions {
|
||||
gt?: K;
|
||||
gte?: K;
|
||||
lt?: K;
|
||||
@@ -61,20 +68,20 @@ export interface AbstractIteratorOptions<K> extends AbstractOptions {
|
||||
valueAsBuffer?: boolean;
|
||||
}
|
||||
|
||||
export type AbstractBatch<K, V> = PutBatch<K, V> | DelBatch<K, V>;
|
||||
export type AbstractBatch<K = any, V = any> = PutBatch<K, V> | DelBatch<K, V>;
|
||||
|
||||
export interface PutBatch<K, V> {
|
||||
export interface PutBatch<K = any, V = any> {
|
||||
readonly type: 'put';
|
||||
readonly key: K;
|
||||
readonly value: V;
|
||||
}
|
||||
|
||||
export interface DelBatch<K, V> {
|
||||
export interface DelBatch<K = any, V = any> {
|
||||
readonly type: 'del';
|
||||
readonly key: K;
|
||||
}
|
||||
|
||||
export interface AbstractChainedBatch<K, V> extends AbstractChainedBatchConstructor, AbstractOptions {
|
||||
export interface AbstractChainedBatch<K = any, V = any> extends AbstractOptions {
|
||||
put: (key: K, value: V) => this;
|
||||
del: (key: K) => this;
|
||||
clear: () => this;
|
||||
@@ -83,19 +90,23 @@ export interface AbstractChainedBatch<K, V> extends AbstractChainedBatchConstruc
|
||||
}
|
||||
|
||||
export interface AbstractChainedBatchConstructor {
|
||||
new(db: any): AbstractChainedBatch<any, any>;
|
||||
(db: any): AbstractChainedBatch<any, any>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
new <K = any, V = any>(db: any): AbstractChainedBatch<K, V>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
<K = any, V = any>(db: any): AbstractChainedBatch<K, V>;
|
||||
}
|
||||
|
||||
export interface AbstractIterator<K, V> extends AbstractChainedBatchConstructor {
|
||||
export interface AbstractIterator<K, V> extends AbstractOptions {
|
||||
db: AbstractLevelDOWN<K, V>;
|
||||
next(cb: ErrorKeyValueCallback<K, V>): this;
|
||||
end(cb: ErrorCallback): void;
|
||||
}
|
||||
|
||||
export interface AbstractIteratorConstructor {
|
||||
new(db: any): AbstractIterator<any, any>;
|
||||
(db: any): AbstractIterator<any, any>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
new <K = any, V = any>(db: any): AbstractIterator<K, V>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
<K = any, V = any>(db: any): AbstractIterator<K, V>;
|
||||
}
|
||||
|
||||
export const AbstractLevelDOWN: AbstractLevelDOWNConstructor;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import * as accept from 'accept';
|
||||
|
||||
accept.charsets("iso-8859-5, unicode-1-1;q=0.8"); // charset === "iso-8859-5"
|
||||
accept.charset("iso-8859-5, unicode-1-1;q=0.8", ["unicode-1-1"]); // charset === "unicode-1-1"
|
||||
|
||||
accept.encoding("gzip, deflate, sdch"); // encoding === "gzip"
|
||||
accept.encoding("gzip, deflate, sdch", ["deflate", "identity"]);
|
||||
|
||||
const encodings = accept.encodings("compress;q=0.5, gzip;q=1.0"); // encodings === ["gzip", "compress", "identity"]
|
||||
encodings.lastIndexOf('');
|
||||
|
||||
accept.language("en;q=0.7, en-GB;q=0.8");
|
||||
accept.language("en;q=0.7, en-GB;q=0.8", ["en-gb"]); // language === "en-GB"
|
||||
const languages = accept.languages("da, en;q=0.7, en-GB;q=0.8"); // languages === ["da", "en-GB", "en"]
|
||||
languages.lastIndexOf('');
|
||||
|
||||
accept.mediaType("text/plain, application/json;q=0.5, text/html, */*;q=0.1");
|
||||
accept.mediaType("text/plain, application/json;q=0.5, text/html, */*;q=0.1", ["application/json", "text/html"]);
|
||||
const mediaTypes = accept.mediaTypes("text/plain, application/json;q=0.5, text/html, */*;q=0.1");
|
||||
// mediaTypes === ["text/plain", "text/html", "application/json", "*/*"]
|
||||
mediaTypes.lastIndexOf('');
|
||||
const headers = {
|
||||
accept: 'text/plain, application/json;q=0.5, text/html, */*;q=0.1',
|
||||
'accept-language': 'da, en;q=0.7, en-GB;q=0.8'
|
||||
};
|
||||
|
||||
const all = accept.parseAll(headers);
|
||||
all.charsets.length;
|
||||
all.encodings.length;
|
||||
all.languages.length;
|
||||
all.mediaTypes.length;
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for accept 3.1
|
||||
// Project: https://github.com/hapijs/accept#readme
|
||||
// Definitions by: feinoujc <https://github.com/feinoujc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export function charset(charsetHeader?: string, preferences?: string[]): string;
|
||||
export function charsets(charsetHeader?: string): string[];
|
||||
export function encoding(encodingHeader?: string, preferences?: string[]): string;
|
||||
export function encodings(encodingHeader?: string): string[];
|
||||
export function language(languageHeader?: string, preferences?: string[]): string;
|
||||
export function languages(languageHeader?: string): string[];
|
||||
export function mediaType(mediaTypeHeader?: string, preferences?: string[]): string;
|
||||
export function mediaTypes(mediaTypeHeader?: string): string[];
|
||||
export function parseAll(
|
||||
headers: Record<string, string | string[] | undefined>
|
||||
): {
|
||||
charsets: string[];
|
||||
encodings: string[];
|
||||
languages: string[];
|
||||
mediaTypes: string[];
|
||||
};
|
||||
@@ -18,6 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gitlab-tests.ts"
|
||||
"accept-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+11
-1
@@ -549,6 +549,16 @@ declare namespace AceAjax {
|
||||
getFoldsInRange(range: Range): any;
|
||||
|
||||
highlight(text: string): void;
|
||||
|
||||
|
||||
/**
|
||||
* Highlight lines from `startRow` to `EndRow`.
|
||||
* @param startRow Define the start line of the highlight
|
||||
* @param endRow Define the end line of the highlight
|
||||
* @param clazz Set the CSS class for the marker
|
||||
* @param inFront Set to `true` to establish a front marker
|
||||
**/
|
||||
highlightLines(startRow:number, endRow: number, clazz: string, inFront: boolean): Range;
|
||||
|
||||
/**
|
||||
* Sets the `EditSession` to point to a new `Document`. If a `BackgroundTokenizer` exists, it also points to `doc`.
|
||||
@@ -1223,7 +1233,7 @@ declare namespace AceAjax {
|
||||
/**
|
||||
* Returns `true` if the current `textInput` is in focus.
|
||||
**/
|
||||
isFocused(): void;
|
||||
isFocused(): boolean;
|
||||
|
||||
/**
|
||||
* Blurs the current `textInput`.
|
||||
|
||||
@@ -123,7 +123,7 @@ const aceSelectionTests = {
|
||||
},
|
||||
|
||||
"test: moveCursor word left with umlauts": function () {
|
||||
var session = new AceAjax.EditSession(" Fu� F��e");
|
||||
var session = new AceAjax.EditSession(" Fu¢ F¢¢e");
|
||||
|
||||
var selection = session.getSelection();
|
||||
selection.moveCursorTo(0, 9)
|
||||
|
||||
Vendored
+1
-3
@@ -246,9 +246,7 @@ declare namespace acorn {
|
||||
let LooseParser: ILooseParserClass | undefined;
|
||||
let pluginsLoose: PluginsObject | undefined;
|
||||
|
||||
interface ILooseParserClass {
|
||||
new (input: string, options?: Options): ILooseParser;
|
||||
}
|
||||
type ILooseParserClass = new (input: string, options?: Options) => ILooseParser;
|
||||
|
||||
interface ILooseParser {}
|
||||
|
||||
|
||||
Vendored
+10
-4
@@ -1,13 +1,15 @@
|
||||
// Type definitions for ActionCable
|
||||
// Project: https://github.com/rails/rails/tree/master/actioncable
|
||||
// Type definitions for ActionCable 5.2
|
||||
// Project: https://github.com/rails/rails/tree/master/actioncable/app/assets/javascripts
|
||||
// Definitions by: Vincent Zhu <https://github.com/zhu1230>
|
||||
// Jared Szechy <https://github.com/szechyjs>
|
||||
// Definitions: https://github.com/zhu1230/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
declare module ActionCable {
|
||||
interface Channel {
|
||||
unsubscribe(): void;
|
||||
perform(action: string, data: {}): void;
|
||||
send(data: Object): boolean;
|
||||
send(data: any): boolean;
|
||||
}
|
||||
|
||||
interface Subscriptions {
|
||||
@@ -16,12 +18,16 @@ declare module ActionCable {
|
||||
|
||||
interface Cable {
|
||||
subscriptions: Subscriptions;
|
||||
send(data: any): void;
|
||||
connect(): void;
|
||||
disconnect(): void;
|
||||
ensureActiveConnection(): void;
|
||||
}
|
||||
|
||||
interface CreateMixin {
|
||||
connected(): void;
|
||||
disconnected(): void;
|
||||
received(obj: Object): void;
|
||||
received(obj: any): void;
|
||||
[key: string]: Function;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import activeWin = require('active-win');
|
||||
|
||||
// $ExpectType Promise<Result>
|
||||
activeWin();
|
||||
// $ExpectType Result
|
||||
activeWin.sync();
|
||||
|
||||
let win = {
|
||||
title: 'Unicorns - Google Search',
|
||||
id: 5762,
|
||||
owner: {
|
||||
name: 'Google Chrome',
|
||||
processId: 310,
|
||||
},
|
||||
};
|
||||
|
||||
win = activeWin.sync();
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for active-win 4.0
|
||||
// Project: https://github.com/sindresorhus/active-win#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = activeWin;
|
||||
|
||||
declare function activeWin(): Promise<activeWin.Result>;
|
||||
|
||||
declare namespace activeWin {
|
||||
function sync(): Result;
|
||||
|
||||
interface Result {
|
||||
title: string;
|
||||
id: number;
|
||||
bounds?: {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
owner: {
|
||||
name: string;
|
||||
processId: number;
|
||||
bundleId?: number;
|
||||
path?: string;
|
||||
};
|
||||
memoryUsage?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"active-win-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+1
-1
@@ -451,7 +451,7 @@ declare namespace adone {
|
||||
| encoding.Multibyte;
|
||||
}
|
||||
|
||||
const defaultCharUnicode: "�";
|
||||
const defaultCharUnicode: string;
|
||||
|
||||
const defaultCharSingleByte: "?";
|
||||
|
||||
|
||||
Vendored
+453
-306
@@ -1,345 +1,492 @@
|
||||
// Type definitions for AFRAME 0.7
|
||||
// Type definitions for AFRAME 0.8
|
||||
// Project: https://aframe.io/
|
||||
// Definitions by: Paul Shannon <https://github.com/devpaul>
|
||||
// Roberto Ritger <https://github.com/bertoritger>
|
||||
// Trygve Wastvedt <https://github.com/twastvedt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/**
|
||||
* Extended tests available at https://github.com/devpaul/aframe-typings.git
|
||||
* Extended tests and examples available at https://github.com/devpaul/aframe-experiments.git
|
||||
*/
|
||||
|
||||
/// <reference types="three" />
|
||||
/// <reference types="tween.js" />
|
||||
|
||||
// Globals
|
||||
declare var AFRAME: AFrame.AFrameGlobal;
|
||||
declare var hasNativeWebVRImplementation: boolean;
|
||||
import * as three from 'three';
|
||||
import * as tween from '@tweenjs/tween.js';
|
||||
|
||||
interface Document {
|
||||
createElement(tagName: string): AFrame.Entity;
|
||||
querySelector(selectors: 'a-scene'): AFrame.Scene;
|
||||
querySelector(selectors: string): AFrame.Entity<any>;
|
||||
querySelectorAll(selectors: string): NodeListOf<AFrame.Entity<any> | Element>;
|
||||
export type ThreeLib = typeof three;
|
||||
export type TweenLib = typeof tween;
|
||||
|
||||
export interface ObjectMap<T = any> {
|
||||
[key: string]: T;
|
||||
}
|
||||
|
||||
// Interfaces
|
||||
declare namespace AFrame {
|
||||
interface ObjectMap<T = any> {
|
||||
[ key: string ]: T;
|
||||
}
|
||||
export interface Animation {
|
||||
attribute: string;
|
||||
begin: string | number;
|
||||
delay: number;
|
||||
direction: 'alternate' | 'alternateReverse' | 'normal' | 'reverse';
|
||||
dur: number;
|
||||
easing(): void;
|
||||
end: string;
|
||||
fill: 'backwards' | 'both' | 'forwards' | 'none';
|
||||
from: any; // TODO type
|
||||
repeat: number | 'indefinite';
|
||||
to: number;
|
||||
}
|
||||
|
||||
interface AFrameGlobal {
|
||||
AEntity: Entity;
|
||||
ANode: ANode;
|
||||
AScene: Scene;
|
||||
components: { [ key: string ]: ComponentDescriptor };
|
||||
geometries: { [ key: string ]: GeometryDescriptor };
|
||||
primitives: { [ key: string ]: Entity };
|
||||
registerComponent<T extends Component>(name: string, component: ComponentDefinition<T>): ComponentConstructor<T>;
|
||||
registerElement(name: string, element: ANode): void;
|
||||
registerGeometry<T extends Geometry>(name: string, geometry: GeometryDefinition<T>): GeometryConstructor<T>;
|
||||
registerPrimitive(name: string, primitive: PrimitiveDefinition): void;
|
||||
registerShader<T extends Shader>(name: string, shader: T): ShaderConstructor<T>;
|
||||
registerSystem<T extends System>(name: string, definition: SystemDefinition<T>): SystemConstructor<T>;
|
||||
schema: SchemaUtils;
|
||||
shaders: { [ key: string ]: ShaderDescriptor };
|
||||
systems: { [key: string]: SystemConstructor };
|
||||
THREE: typeof THREE;
|
||||
TWEEN: typeof TWEEN;
|
||||
utils: Utils;
|
||||
version: string;
|
||||
}
|
||||
export interface ANode extends HTMLElement {
|
||||
// Only public APIs added. Many methods intentionally left out.
|
||||
// createdCallback
|
||||
// attachedCallback
|
||||
// attributeChangedCallback
|
||||
closestScene(): Scene;
|
||||
closest(selector: string): ANode;
|
||||
// detachedCallback
|
||||
hasLoaded: boolean;
|
||||
load(cb?: () => void, childFilter?: (el: Element) => boolean): void;
|
||||
// updateMixins
|
||||
registerMixin(id: string): void;
|
||||
setAttribute(type: string, newValue: any): void;
|
||||
unregisterMixin(id: string): void;
|
||||
removeMixinListener(id: string): void;
|
||||
attachMixinListener(mixin: HTMLElement): void;
|
||||
emit(name: string, detail?: any, bubbles?: boolean): void;
|
||||
emitter(name: string, detail?: any, bubbles?: boolean): () => void;
|
||||
}
|
||||
|
||||
interface Animation {
|
||||
attribute: string;
|
||||
begin: string | number;
|
||||
delay: number;
|
||||
direction: 'alternate' | 'alternateReverse' | 'normal' | 'reverse';
|
||||
dur: number;
|
||||
easing(): void;
|
||||
end: string;
|
||||
fill: 'backwards' | 'both' | 'forwards' | 'none';
|
||||
from: any; // TODO type
|
||||
repeat: number | 'indefinite';
|
||||
to: number;
|
||||
}
|
||||
export interface Behavior {
|
||||
tick(): void;
|
||||
}
|
||||
|
||||
interface ANode extends HTMLElement {
|
||||
// Only public APIs added. Many methods intentionally left out.
|
||||
// createdCallback
|
||||
// attachedCallback
|
||||
// attributeChangedCallback
|
||||
closestScene(): Scene;
|
||||
closest(selector: string): ANode;
|
||||
// detachedCallback
|
||||
hasLoaded: boolean;
|
||||
load(cb?: () => void, childFilter?: (el: Element) => boolean): void;
|
||||
// updateMixins
|
||||
registerMixin(id: string): void;
|
||||
setAttribute(type: string, newValue: any): void;
|
||||
unregisterMixin(id: string): void;
|
||||
removeMixinListener(id: string): void;
|
||||
attachMixinListener(mixin: HTMLElement): void;
|
||||
emit(name: string, detail?: any, bubbles?: boolean): void;
|
||||
emitter(name: string, detail?: any, bubbles?: boolean): () => void;
|
||||
}
|
||||
export interface Component<T extends object = any, S extends System = System> {
|
||||
attrName?: string;
|
||||
data: T;
|
||||
dependencies?: string[];
|
||||
el: Entity;
|
||||
id: string;
|
||||
multiple?: boolean;
|
||||
name: string;
|
||||
schema: Schema<T>;
|
||||
system: S | undefined;
|
||||
|
||||
interface Behavior {
|
||||
tick(): void;
|
||||
}
|
||||
init(data?: T): void;
|
||||
pause(): void;
|
||||
play(): void;
|
||||
remove(): void;
|
||||
tick?(time: number, timeDelta: number): void;
|
||||
update(oldData: T): void;
|
||||
updateSchema?(): void;
|
||||
|
||||
interface Component<T extends { [key: string]: any } = any, S extends System = System> {
|
||||
attrName?: string;
|
||||
data: T;
|
||||
dependencies?: string[];
|
||||
el: Entity;
|
||||
id: string;
|
||||
multiple?: boolean;
|
||||
extendSchema(update: Schema): void;
|
||||
flushToDOM(): void;
|
||||
}
|
||||
|
||||
export interface ComponentConstructor<T extends object> {
|
||||
new (el: Entity, attrValue: string, id: string): T & Component;
|
||||
prototype: T & {
|
||||
name: string;
|
||||
schema: Schema<T>;
|
||||
system: S | undefined;
|
||||
|
||||
init(this: this, data?: T): void;
|
||||
pause(this: this): void;
|
||||
play(this: this): void;
|
||||
remove(this: this): void;
|
||||
tick?(this: this, time: number, timeDelta: number): void;
|
||||
update(this: this, oldData: T): void;
|
||||
updateSchema?(this: this): void;
|
||||
|
||||
extendSchema(this: this, update: Schema): void;
|
||||
flushToDOM(this: this): void;
|
||||
}
|
||||
|
||||
interface ComponentConstructor<T extends Component> {
|
||||
new (el: Entity, attrValue: string, id: string): T;
|
||||
}
|
||||
|
||||
type ComponentDefinition<T extends Component = Component> = Partial<T>;
|
||||
|
||||
interface ComponentDescriptor<T extends Component = Component> {
|
||||
Component: ComponentConstructor<T>;
|
||||
dependencies: string[] | undefined;
|
||||
multiple: boolean | undefined;
|
||||
|
||||
// internal APIs2
|
||||
// parse
|
||||
// parseAttrValueForCache
|
||||
// schema
|
||||
// stringify
|
||||
// type
|
||||
}
|
||||
|
||||
interface Coordinate {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
interface DefaultComponents {
|
||||
position: Component<Coordinate>;
|
||||
rotation: Component<Coordinate>;
|
||||
scale: Component<Coordinate>;
|
||||
}
|
||||
|
||||
interface Entity<C = ObjectMap<Component>> extends ANode {
|
||||
components: C & DefaultComponents;
|
||||
isPlaying: boolean;
|
||||
object3D: THREE.Object3D;
|
||||
object3DMap: ObjectMap<THREE.Object3D>;
|
||||
sceneEl?: Scene;
|
||||
|
||||
addState(name: string): void;
|
||||
flushToDOM(recursive?: boolean): void;
|
||||
/**
|
||||
* @deprecated since 0.4.0
|
||||
*/
|
||||
getComputedAttribute(attr: string): Component;
|
||||
getDOMAttribute(attr: string): any;
|
||||
getObject3D(type: string): THREE.Object3D;
|
||||
getOrCreateObject3D(type: string, construct: any): THREE.Object3D;
|
||||
is(stateName: string): boolean;
|
||||
pause(): void;
|
||||
system: System;
|
||||
play(): void;
|
||||
setObject3D(type: string, obj: THREE.Object3D): void;
|
||||
removeAttribute(attr: string, property?: string): void;
|
||||
removeObject3D(type: string): void;
|
||||
removeState(stateName: string): void;
|
||||
|
||||
// getAttribute specific usages
|
||||
getAttribute(type: string): any;
|
||||
getAttribute(type: 'position' | 'rotation' | 'scale'): Coordinate;
|
||||
|
||||
// setAttribute specific usages
|
||||
setAttribute(attr: string, value: any): void;
|
||||
setAttribute(attr: string, property: string, componentAttrValue?: any): void;
|
||||
setAttribute(type: 'position' | 'rotation' | 'scale', value: Coordinate): void;
|
||||
|
||||
// addEventListener specific usages
|
||||
addEventListener<K extends keyof EntityEventMap>(type: K, listener: (event: Event & EntityEventMap[K]) => void, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
type DetailEvent<D> = Event & {
|
||||
detail: D;
|
||||
target: EventTarget & Entity;
|
||||
pause(): void;
|
||||
};
|
||||
}
|
||||
|
||||
interface EntityEventMap {
|
||||
'child-attached': DetailEvent<{ el: Element | Entity }>;
|
||||
'child-detached': DetailEvent<{ el: Element | Entity }>;
|
||||
'componentchanged': DetailEvent<{
|
||||
name: string,
|
||||
id: string
|
||||
}>;
|
||||
'componentremoved': DetailEvent<{
|
||||
name: string,
|
||||
id: string,
|
||||
newData: any,
|
||||
oldData: any
|
||||
}>;
|
||||
'loaded': EventListener;
|
||||
'pause': EventListener;
|
||||
'play': EventListener;
|
||||
'stateadded': DetailEvent<{ state: string }>;
|
||||
'stateremoved': DetailEvent<{ state: string }>;
|
||||
'schemachanged': DetailEvent<{ componentName: string }>;
|
||||
}
|
||||
export interface ComponentDescriptor<T extends Component = Component> {
|
||||
Component: ComponentConstructor<T>;
|
||||
dependencies: string[] | undefined;
|
||||
multiple: boolean | undefined;
|
||||
|
||||
interface Geometry {
|
||||
// internal APIs2
|
||||
// parse
|
||||
// parseAttrValueForCache
|
||||
// schema
|
||||
// stringify
|
||||
// type
|
||||
}
|
||||
|
||||
export interface Coordinate {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
export interface DefaultComponents {
|
||||
position: Component<Coordinate>;
|
||||
rotation: Component<Coordinate>;
|
||||
scale: Component<Coordinate>;
|
||||
}
|
||||
|
||||
export interface Entity<C = ObjectMap<Component>> extends ANode {
|
||||
components: C & DefaultComponents;
|
||||
isPlaying: boolean;
|
||||
object3D: THREE.Object3D;
|
||||
object3DMap: ObjectMap<THREE.Object3D>;
|
||||
sceneEl?: Scene;
|
||||
|
||||
addState(name: string): void;
|
||||
flushToDOM(recursive?: boolean): void;
|
||||
/**
|
||||
* @deprecated since 0.4.0
|
||||
*/
|
||||
getComputedAttribute(attr: string): Component;
|
||||
getDOMAttribute(attr: string): any;
|
||||
getObject3D(type: string): THREE.Object3D;
|
||||
getOrCreateObject3D(type: string, construct: any): THREE.Object3D;
|
||||
is(stateName: string): boolean;
|
||||
pause(): void;
|
||||
play(): void;
|
||||
setObject3D(type: string, obj: THREE.Object3D): void;
|
||||
removeAttribute(attr: string, property?: string): void;
|
||||
removeObject3D(type: string): void;
|
||||
removeState(stateName: string): void;
|
||||
|
||||
// getAttribute specific usages
|
||||
getAttribute(type: string): any;
|
||||
getAttribute(type: 'position' | 'rotation' | 'scale'): Coordinate;
|
||||
|
||||
// setAttribute specific usages
|
||||
setAttribute(attr: string, value: any): void;
|
||||
setAttribute(attr: string, property: string, componentAttrValue?: any): void;
|
||||
setAttribute(type: 'position' | 'rotation' | 'scale', value: Coordinate): void;
|
||||
|
||||
// addEventListener specific usages
|
||||
addEventListener<K extends keyof EntityEventMap>(
|
||||
type: K,
|
||||
listener: (event: Event & EntityEventMap[K]) => void,
|
||||
useCapture?: boolean
|
||||
): void;
|
||||
addEventListener(
|
||||
type: string,
|
||||
listener: EventListenerOrEventListenerObject,
|
||||
useCapture?: boolean
|
||||
): void;
|
||||
}
|
||||
|
||||
export type DetailEvent<D> = Event & {
|
||||
detail: D;
|
||||
target: EventTarget & Entity;
|
||||
};
|
||||
|
||||
export interface EntityEventMap {
|
||||
'child-attached': DetailEvent<{ el: Element | Entity }>;
|
||||
'child-detached': DetailEvent<{ el: Element | Entity }>;
|
||||
componentchanged: DetailEvent<{
|
||||
name: string;
|
||||
geometry: THREE.Geometry;
|
||||
schema: Schema<any>;
|
||||
id: string;
|
||||
}>;
|
||||
componentremoved: DetailEvent<{
|
||||
name: string;
|
||||
id: string;
|
||||
newData: any;
|
||||
oldData: any;
|
||||
}>;
|
||||
loaded: EventListener;
|
||||
pause: EventListener;
|
||||
play: EventListener;
|
||||
stateadded: DetailEvent<{ state: string }>;
|
||||
stateremoved: DetailEvent<{ state: string }>;
|
||||
schemachanged: DetailEvent<{ componentName: string }>;
|
||||
}
|
||||
|
||||
init(this: this, data: { [P in keyof this['schema']]: any }): void;
|
||||
// Would like the above to be:
|
||||
// init?(this: this, data?: { [P in keyof T['schema']]: T['schema'][P]['default'] } ): void;
|
||||
// I think this is prevented by the following issue: https://github.com/Microsoft/TypeScript/issues/21760.
|
||||
}
|
||||
export interface Geometry<T = any> {
|
||||
data: T;
|
||||
name: string;
|
||||
geometry: THREE.Geometry;
|
||||
schema: Schema<any>;
|
||||
|
||||
interface GeometryConstructor<T extends Geometry> {
|
||||
new (): T;
|
||||
}
|
||||
init(data: any): void;
|
||||
}
|
||||
|
||||
type GeometryDefinition<T extends Geometry = Geometry> = Partial<T>;
|
||||
export interface GeometryConstructor<T extends object = object> {
|
||||
new (): T & Geometry;
|
||||
}
|
||||
|
||||
interface GeometryDescriptor<T extends Geometry = Geometry> {
|
||||
Geometry: GeometryConstructor<T>;
|
||||
schema: Schema;
|
||||
}
|
||||
export interface GeometryDescriptor<T extends Geometry = Geometry> {
|
||||
Geometry: GeometryConstructor<T>;
|
||||
schema: Schema;
|
||||
}
|
||||
|
||||
type MultiPropertySchema<T extends { [key: string ]: any }> = {
|
||||
[P in keyof T]: SinglePropertySchema<T[P]> | T[P];
|
||||
export type MultiPropertySchema<T extends object> = {
|
||||
[P in keyof T]: SinglePropertySchema<T[P]> | T[P]
|
||||
};
|
||||
|
||||
export type PropertyTypes =
|
||||
| 'array'
|
||||
| 'asset'
|
||||
| 'audio'
|
||||
| 'boolean'
|
||||
| 'color'
|
||||
| 'int'
|
||||
| 'map'
|
||||
| 'model'
|
||||
| 'number'
|
||||
| 'selector'
|
||||
| 'selectorAll'
|
||||
| 'string'
|
||||
| 'vec2'
|
||||
| 'vec3'
|
||||
| 'vec4';
|
||||
|
||||
export type SceneEvents = 'enter-vr' | 'exit-vr' | 'loaded' | 'renderstart';
|
||||
|
||||
export interface Scene extends Entity {
|
||||
behaviors: Behavior[];
|
||||
camera: THREE.Camera;
|
||||
canvas: HTMLCanvasElement;
|
||||
effect: THREE.VREffect;
|
||||
isMobile: boolean;
|
||||
object3D: THREE.Scene;
|
||||
renderer: THREE.WebGLRenderer;
|
||||
renderStarted: boolean;
|
||||
systems: ObjectMap<System>;
|
||||
time: number;
|
||||
|
||||
enterVR(): Promise<void> | void;
|
||||
exitVR(): Promise<void> | void;
|
||||
reload(): void;
|
||||
|
||||
addEventListener(
|
||||
type: string,
|
||||
listener: EventListenerOrEventListenerObject,
|
||||
useCapture?: boolean
|
||||
): void;
|
||||
addEventListener(type: SceneEvents, listener: EventListener, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
export type Schema<T extends object = object> = SinglePropertySchema<T> | MultiPropertySchema<T>;
|
||||
|
||||
export interface SchemaUtils {
|
||||
isSingleProperty(schema: Schema): boolean;
|
||||
process(schema: Schema): boolean;
|
||||
}
|
||||
|
||||
export interface Shader {
|
||||
name: string;
|
||||
data: object;
|
||||
schema: Schema<this['data']>;
|
||||
material: THREE.Material;
|
||||
vertexShader: string;
|
||||
fragmentShader: string;
|
||||
|
||||
init(data?: this['data']): void;
|
||||
tick?(time: number, timeDelta: number): void;
|
||||
update(oldData: this['data']): void;
|
||||
}
|
||||
|
||||
export interface ShaderConstructor<T extends object> {
|
||||
new (): T;
|
||||
}
|
||||
|
||||
export interface ShaderDescriptor<T extends Shader = Shader> {
|
||||
Shader: ShaderConstructor<T>;
|
||||
schema: Schema;
|
||||
}
|
||||
|
||||
export interface SinglePropertySchema<T> {
|
||||
type?: PropertyTypes;
|
||||
default?: T;
|
||||
parse?(value: string): T;
|
||||
stringify?(value: T): string;
|
||||
}
|
||||
|
||||
export interface System<T extends object = any> {
|
||||
data: T;
|
||||
schema: Schema<T>;
|
||||
init(): void;
|
||||
pause(): void;
|
||||
play(): void;
|
||||
tick?(t: number, dt: number): void;
|
||||
}
|
||||
|
||||
export interface SystemConstructor<T extends object = object> {
|
||||
new (scene: Scene): T & System;
|
||||
}
|
||||
|
||||
export interface Utils {
|
||||
coordinates: {
|
||||
isCoordinate(value: string): boolean;
|
||||
parse(value: string): Coordinate;
|
||||
stringify(coord: Coordinate): string;
|
||||
};
|
||||
entity: {
|
||||
getComponentProperty(entity: Entity, componentName: string, delimiter?: string): any;
|
||||
setComponentProperty(
|
||||
entity: Entity,
|
||||
componentName: string,
|
||||
value: any,
|
||||
delimiter?: string
|
||||
): void;
|
||||
};
|
||||
device: {
|
||||
isWebXRAvailable: boolean;
|
||||
getVRDisplay(): VRDisplay[];
|
||||
checkHeadsetConnected(): boolean;
|
||||
checkHasPositionalTracking(): boolean;
|
||||
isMobile(): boolean;
|
||||
isTablet(): boolean;
|
||||
isIOS(): boolean;
|
||||
isGearVR(): boolean;
|
||||
isOculusGo(): boolean;
|
||||
isR7(): boolean;
|
||||
isLandscape(): boolean;
|
||||
isBrowserEnvironment(): boolean;
|
||||
isNodeEnvironment(): boolean;
|
||||
PolyfillControls(object3D: THREE.Object3D): void;
|
||||
};
|
||||
styleParser: {
|
||||
parse(value: string): object;
|
||||
stringify(data: object): string;
|
||||
};
|
||||
deepEqual(a: any, b: any): boolean;
|
||||
diff(a: object, b: object): object;
|
||||
extend(target: object, ...source: object[]): object;
|
||||
extendDeep(target: object, ...source: object[]): object;
|
||||
|
||||
interface PrimitiveDefinition {
|
||||
defaultComponents?: any; // TODO cleanup type
|
||||
deprecated?: boolean;
|
||||
mappings?: any; // TODO cleanup type
|
||||
transforms?: any; // TODO cleanup type
|
||||
}
|
||||
throttle(
|
||||
tickFunction: () => void,
|
||||
minimumInterval: number,
|
||||
optionalContext?: {}
|
||||
): (t: number, dt: number) => void;
|
||||
throttleTick(
|
||||
tickFunction: (t: number, dt: number) => void,
|
||||
minimumInterval: number,
|
||||
optionalContext?: {}
|
||||
): (t: number, dt: number) => void;
|
||||
}
|
||||
|
||||
type PropertyTypes = 'array' | 'asset' | 'audio' | 'boolean' | 'color' |
|
||||
'int' | 'map' | 'model' | 'number' | 'selector' | 'selectorAll' |
|
||||
'string' | 'vec2' | 'vec3' | 'vec4';
|
||||
// Definitions
|
||||
// used as mixins to register functions to create classes (newable functions) in A-Frame
|
||||
export type ComponentDefinition<T extends object = object> = T & Partial<Component>;
|
||||
export type GeometryDefinition<T extends object = object, U = any> = T & Partial<Geometry<U>>;
|
||||
export type NodeDefinition<T extends object = object> = T & Partial<ANode>;
|
||||
export interface PrimitiveDefinition {
|
||||
defaultComponents?: any; // TODO cleanup type
|
||||
deprecated?: boolean;
|
||||
mappings?: any; // TODO cleanup type
|
||||
transforms?: any; // TODO cleanup type
|
||||
}
|
||||
export interface MinimalShaderDefinition {
|
||||
schema: Shader['schema'];
|
||||
}
|
||||
export type ShaderDefinition<T extends object = MinimalShaderDefinition & object> = T &
|
||||
Partial<Shader>;
|
||||
export type SystemDefinition<T extends object = object> = T & Partial<System>;
|
||||
|
||||
type SceneEvents = 'enter-vr' | 'exit-vr' | 'loaded' | 'renderstart';
|
||||
// root export
|
||||
export interface AFrame {
|
||||
AComponent: Component;
|
||||
AEntity: Entity;
|
||||
ANode: ANode;
|
||||
AScene: Scene;
|
||||
|
||||
interface Scene extends Entity {
|
||||
behaviors: Behavior[];
|
||||
camera: THREE.Camera;
|
||||
canvas: HTMLCanvasElement;
|
||||
effect: THREE.VREffect;
|
||||
isMobile: boolean;
|
||||
object3D: THREE.Scene;
|
||||
renderer: THREE.WebGLRenderer;
|
||||
renderStarted: boolean;
|
||||
systems: ObjectMap<System>;
|
||||
time: number;
|
||||
|
||||
enterVR(): Promise<void> | void;
|
||||
exitVR(): Promise<void> | void;
|
||||
reload(): void;
|
||||
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
addEventListener(type: SceneEvents, listener: EventListener, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
type Schema<T = { [key: string]: any }> = SinglePropertySchema<T> | MultiPropertySchema<T>;
|
||||
|
||||
interface SchemaUtils {
|
||||
isSingleProperty(schema: Schema): boolean;
|
||||
process(schema: Schema): boolean;
|
||||
}
|
||||
|
||||
interface Shader {
|
||||
name: string;
|
||||
data: { [key: string]: any };
|
||||
schema: Schema<this['data']>;
|
||||
material: THREE.Material;
|
||||
vertexShader: string;
|
||||
fragmentShader: string;
|
||||
|
||||
init(this: this, data?: this['data']): void;
|
||||
tick?(this: this, time: number, timeDelta: number): void;
|
||||
update(this: this, oldData: this['data']): void;
|
||||
}
|
||||
|
||||
interface ShaderConstructor<T extends Shader> {
|
||||
new (): T;
|
||||
}
|
||||
|
||||
type ShaderDefinition<T extends Shader = Shader> = Partial<T>;
|
||||
|
||||
interface ShaderDescriptor<T extends Shader = Shader> {
|
||||
Shader: ShaderConstructor<T>;
|
||||
schema: Schema;
|
||||
}
|
||||
|
||||
interface SinglePropertySchema<T> {
|
||||
type?: PropertyTypes;
|
||||
'default'?: T;
|
||||
parse?(value: string): T;
|
||||
stringify?(value: T): string;
|
||||
}
|
||||
|
||||
interface System {
|
||||
data: { [key: string]: any };
|
||||
schema: Schema<this['data']>;
|
||||
init(this: this): void;
|
||||
pause(this: this): void;
|
||||
play(this: this): void;
|
||||
tick?(this: this, t: number, dt: number): void;
|
||||
}
|
||||
|
||||
interface SystemConstructor<T extends System = System> {
|
||||
new (scene: Scene): T;
|
||||
}
|
||||
|
||||
type SystemDefinition<T extends System = System> = Partial<T>;
|
||||
|
||||
interface Utils {
|
||||
coordinates: {
|
||||
isCoordinate(value: string): boolean;
|
||||
parse(value: string): Coordinate;
|
||||
stringify(coord: Coordinate): string;
|
||||
components: ObjectMap<ComponentDescriptor>;
|
||||
geometries: ObjectMap<GeometryDescriptor>;
|
||||
primitives: {
|
||||
getMeshMixin(): {
|
||||
defaultComponents: { material: object };
|
||||
mappings: { [key: string]: any }; // TODO improve any type
|
||||
};
|
||||
entity: {
|
||||
getComponentProperty(entity: Entity, componentName: string, delimiter?: string): any;
|
||||
setComponentProperty(entity: Entity, componentName: string, value: any, delimiter?: string): void;
|
||||
};
|
||||
styleParser: {
|
||||
parse(value: string): object;
|
||||
stringify(data: object): string;
|
||||
};
|
||||
deepEqual(a: any, b: any): boolean;
|
||||
diff(a: object, b: object): object;
|
||||
extend(target: object, ... source: object[]): object;
|
||||
extendDeep(target: object, ... source: object[]): object;
|
||||
primitives: ObjectMap<Entity>;
|
||||
};
|
||||
scenes: Scene[];
|
||||
schema: SchemaUtils;
|
||||
shaders: ObjectMap<ShaderDescriptor>;
|
||||
systems: ObjectMap<SystemConstructor>;
|
||||
THREE: ThreeLib;
|
||||
TWEEN: TweenLib;
|
||||
utils: Utils;
|
||||
version: string;
|
||||
|
||||
throttle(tickFunction: () => void, minimumInterval: number, optionalContext?: {}): (t: number, dt: number) => void;
|
||||
throttleTick(tickFunction: (t: number, dt: number) => void, minimumInterval: number, optionalContext?: {}): (t: number, dt: number) => void;
|
||||
registerComponent<T extends object>(
|
||||
name: string,
|
||||
component: ComponentDefinition<T>
|
||||
): ComponentConstructor<T>;
|
||||
registerElement(name: string, element: object): void;
|
||||
registerGeometry<T extends object>(
|
||||
name: string,
|
||||
geometry: GeometryDefinition<T>
|
||||
): GeometryConstructor<T>;
|
||||
registerPrimitive(name: string, primitive: PrimitiveDefinition): void;
|
||||
registerShader<T extends MinimalShaderDefinition & object>(
|
||||
name: string,
|
||||
shader: ShaderDefinition<T>
|
||||
): ShaderConstructor<T>;
|
||||
registerSystem<T extends object>(
|
||||
name: string,
|
||||
definition: SystemDefinition<T>
|
||||
): SystemConstructor<T>;
|
||||
}
|
||||
|
||||
// module.exports
|
||||
export const AComponent: AFrame['AComponent'];
|
||||
export const AEntity: AFrame['AEntity'];
|
||||
export const ANode: AFrame['ANode'];
|
||||
export const AScene: AFrame['AScene'];
|
||||
export const components: AFrame['components'];
|
||||
export const geometries: AFrame['geometries'];
|
||||
export const primitives: AFrame['primitives'];
|
||||
export const scenes: AFrame['scenes'];
|
||||
export const schema: AFrame['schema'];
|
||||
export const shaders: AFrame['shaders'];
|
||||
export const systems: AFrame['systems'];
|
||||
export const THREE: AFrame['THREE'];
|
||||
export const TWEEN: AFrame['TWEEN'];
|
||||
export const utils: AFrame['utils'];
|
||||
export const version: AFrame['version'];
|
||||
export const registerComponent: AFrame['registerComponent'];
|
||||
export const registerElement: AFrame['registerElement'];
|
||||
export const registerGeometry: AFrame['registerGeometry'];
|
||||
export const registerPrimitive: AFrame['registerPrimitive'];
|
||||
export const registerShader: AFrame['registerShader'];
|
||||
export const registerSystem: AFrame['registerSystem'];
|
||||
|
||||
// global exports
|
||||
declare global {
|
||||
var hasNativeWebVRImplementation: boolean;
|
||||
|
||||
namespace AFRAME {
|
||||
const AComponent: AFrame['AComponent'];
|
||||
const AEntity: AFrame['AEntity'];
|
||||
const ANode: AFrame['ANode'];
|
||||
const AScene: AFrame['AScene'];
|
||||
const components: AFrame['components'];
|
||||
const geometries: AFrame['geometries'];
|
||||
const primitives: AFrame['primitives'];
|
||||
const scenes: AFrame['scenes'];
|
||||
const schema: AFrame['schema'];
|
||||
const shaders: AFrame['shaders'];
|
||||
const systems: AFrame['systems'];
|
||||
const THREE: AFrame['THREE'];
|
||||
const TWEEN: AFrame['TWEEN'];
|
||||
const utils: AFrame['utils'];
|
||||
const version: string;
|
||||
|
||||
const registerComponent: AFrame['registerComponent'];
|
||||
const registerElement: AFrame['registerElement'];
|
||||
const registerGeometry: AFrame['registerGeometry'];
|
||||
const registerPrimitive: AFrame['registerPrimitive'];
|
||||
const registerShader: AFrame['registerShader'];
|
||||
const registerSystem: AFrame['registerSystem'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom elements augment document methods to return custom HTML
|
||||
*/
|
||||
interface Document {
|
||||
createElement(tagName: string): Entity;
|
||||
querySelector(selectors: 'a-scene'): Scene;
|
||||
querySelector(selectors: string): Entity<any>;
|
||||
querySelectorAll(selectors: string): NodeListOf<Entity<any> | Element>;
|
||||
}
|
||||
|
||||
interface HTMLCollection extends HTMLCollectionBase {
|
||||
/**
|
||||
* Retrieves a select object or an object from an options collection.
|
||||
*/
|
||||
namedItem(name: string): Element | Entity | null;
|
||||
item(index: number): Element | Entity;
|
||||
[index: number]: Element | Entity;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,14 @@
|
||||
import {
|
||||
Component,
|
||||
Entity,
|
||||
MultiPropertySchema,
|
||||
System,
|
||||
SystemDefinition,
|
||||
THREE,
|
||||
Geometry,
|
||||
registerComponent
|
||||
} from 'aframe';
|
||||
|
||||
// Global
|
||||
const threeCamera = new AFRAME.THREE.Camera();
|
||||
AFRAME.TWEEN.Easing;
|
||||
@@ -16,7 +27,7 @@ entity.setAttribute('material', 'color', 'red');
|
||||
|
||||
entity.components['geometry'].data;
|
||||
|
||||
type MyEntity = AFrame.Entity<{
|
||||
type MyEntity = Entity<{
|
||||
camera: THREE.Camera;
|
||||
material: THREE.Material;
|
||||
sound: { pause(): void };
|
||||
@@ -33,29 +44,31 @@ entity.setAttribute('light', {
|
||||
intensity: 2.0
|
||||
});
|
||||
|
||||
entity.addEventListener('child-detached', (event) => {
|
||||
entity.addEventListener('child-detached', event => {
|
||||
event.detail;
|
||||
});
|
||||
|
||||
// Components
|
||||
|
||||
interface TestComponent extends AFrame.Component {
|
||||
multiply: (f: number) => number;
|
||||
// interface TestComponent extends Component {
|
||||
// multiply: (f: number) => number;
|
||||
//
|
||||
// data: {
|
||||
// myProperty: any[],
|
||||
// string: string,
|
||||
// num: number
|
||||
// };
|
||||
//
|
||||
// system: TestSystem;
|
||||
// }
|
||||
|
||||
data: {
|
||||
myProperty: any[],
|
||||
string: string,
|
||||
num: number
|
||||
};
|
||||
|
||||
system: TestSystem;
|
||||
}
|
||||
|
||||
const Component = AFRAME.registerComponent<TestComponent>('test-component', {
|
||||
const Component = registerComponent('test-component', {
|
||||
schema: {
|
||||
myProperty: {
|
||||
default: [],
|
||||
parse() { return [true]; },
|
||||
parse() {
|
||||
return [true];
|
||||
}
|
||||
},
|
||||
string: { type: 'string' },
|
||||
num: 0
|
||||
@@ -69,9 +82,9 @@ const Component = AFRAME.registerComponent<TestComponent>('test-component', {
|
||||
pause() {},
|
||||
play() {},
|
||||
|
||||
multiply(this: TestComponent, f: number) {
|
||||
multiply(f: number) {
|
||||
// Reference to system because both were registered with the same name.
|
||||
return f * this.data.num * this.system.data.counter;
|
||||
return f * this.data.num * this.system!.data.counter;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -81,13 +94,7 @@ scene.hasLoaded;
|
||||
|
||||
// System
|
||||
|
||||
interface TestSystem extends AFrame.System {
|
||||
data: {
|
||||
counter: number;
|
||||
};
|
||||
}
|
||||
|
||||
const testSystem: AFrame.SystemDefinition<TestSystem> = {
|
||||
const testSystem: SystemDefinition = {
|
||||
schema: {
|
||||
counter: 0
|
||||
},
|
||||
@@ -101,13 +108,7 @@ AFRAME.registerSystem('test-component', testSystem);
|
||||
|
||||
// Register Custom Geometry
|
||||
|
||||
interface TestGeometry extends AFrame.Geometry {
|
||||
schema: AFrame.MultiPropertySchema<{
|
||||
groupIndex: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
AFRAME.registerGeometry<TestGeometry>('a-test-geometry', {
|
||||
AFRAME.registerGeometry('a-test-geometry', {
|
||||
schema: {
|
||||
groupIndex: { default: 0 }
|
||||
},
|
||||
@@ -21,6 +21,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"aframe-tests.ts"
|
||||
"test/aframe-tests.ts",
|
||||
"test/aframe-io-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -64,7 +64,7 @@ declare class Agenda extends EventEmitter {
|
||||
defaultConcurrency(value: number): this;
|
||||
|
||||
/**
|
||||
* Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* Takes a number which specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* 0 for no max.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
@@ -189,7 +189,7 @@ declare namespace Agenda {
|
||||
defaultLockLimit?: number;
|
||||
|
||||
/**
|
||||
* Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* Takes a number which specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* 0 for no max.
|
||||
*/
|
||||
lockLimit?: number;
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/epoberezkin/ajv-errors
|
||||
// Definitions by: Afshawn Lotfi <https://github.com/afshawnlotfi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { Ajv } from "ajv";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"winston": "^3.0.0"
|
||||
"ajv": "*"
|
||||
}
|
||||
}
|
||||
@@ -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,8 @@ let _algoliaQueryParameters: QueryParameters = {
|
||||
filters: '',
|
||||
attributesToRetrieve: [''],
|
||||
restrictSearchableAttributes: [''],
|
||||
facets: '',
|
||||
facets: [''],
|
||||
facetingAfterDistinct: true,
|
||||
maxValuesPerFacet: 2,
|
||||
attributesToHighlight: [''],
|
||||
attributesToSnippet: [''],
|
||||
@@ -120,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,
|
||||
@@ -171,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
+154
-98
@@ -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,112 +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;
|
||||
* 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 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;
|
||||
/**
|
||||
@@ -1214,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[][];
|
||||
/**
|
||||
@@ -1278,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[][];
|
||||
/**
|
||||
@@ -1294,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[];
|
||||
/**
|
||||
@@ -1314,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[];
|
||||
/**
|
||||
@@ -1329,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;
|
||||
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;
|
||||
|
||||
@@ -1421,6 +1463,10 @@ declare namespace algoliasearch {
|
||||
* The query for the search in this facet
|
||||
*/
|
||||
facetQuery: string;
|
||||
/**
|
||||
* The maximum number of facets to fetch
|
||||
*/
|
||||
maxFacetHits?: number;
|
||||
}
|
||||
|
||||
interface Response {
|
||||
@@ -1452,7 +1498,7 @@ declare namespace algoliasearch {
|
||||
interface Task {
|
||||
taskID: number;
|
||||
createdAt: string;
|
||||
objectID?: string;
|
||||
objectID?: string;
|
||||
}
|
||||
|
||||
interface TaskStatus {
|
||||
@@ -1735,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?: {
|
||||
@@ -1784,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 {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
+3265
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ali-app-tests.ts"
|
||||
],
|
||||
"exclude": [
|
||||
".prettierrc"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-mergeable-namespace": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import * as OSS from 'ali-oss';
|
||||
|
||||
const ossOptions: OSS.Options = {
|
||||
accessKeyId: 'your access key',
|
||||
accessKeySecret: 'your access secret',
|
||||
bucket: 'your bucket name',
|
||||
region: 'oss-cn-hangzhou'
|
||||
};
|
||||
|
||||
const client = new OSS(ossOptions);
|
||||
|
||||
const clusterOptions: OSS.ClusterOptions = {
|
||||
clusters: [],
|
||||
};
|
||||
|
||||
const clusterClient = new OSS.Cluster(clusterOptions);
|
||||
|
||||
const imageOptions: OSS.ImageClientOptions = {
|
||||
imageHost: 'xxxx',
|
||||
accessKeyId: 'xxxx',
|
||||
accessKeySecret: 'xxxx',
|
||||
bucket: 'xxxx'
|
||||
};
|
||||
|
||||
const imageClient = new OSS.ImageClient(imageOptions);
|
||||
Vendored
+876
@@ -0,0 +1,876 @@
|
||||
// Type definitions for ali-oss 6.0
|
||||
// Project: https://github.com/ali-sdk/ali-oss
|
||||
// Definitions by: Ptrdu <https://github.com/ptrdu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export = OSS;
|
||||
|
||||
// basic OSS
|
||||
declare namespace OSS {
|
||||
interface Options {
|
||||
accessKeyId: string; // access secret you create
|
||||
accessKeySecret: string; // access secret you create
|
||||
stsToken?: string; // used by temporary authorization
|
||||
bucket?: string; // the default bucket you want to access If you don't have any bucket, please use putBucket() create one first.
|
||||
endpoint?: string; // oss region domain. It takes priority over region.
|
||||
region?: string; // the bucket data region location, please see Data Regions, default is oss-cn-hangzhou.
|
||||
internal?: boolean; // access OSS with aliyun internal network or not, default is false. If your servers are running on aliyun too, you can set true to save lot of money.
|
||||
secure?: boolean; // instruct OSS client to use HTTPS (secure: true) or HTTP (secure: false) protocol.
|
||||
timeout?: string | number; // instance level timeout for all operations, default is 60s
|
||||
cname?: boolean; // use custom domain name
|
||||
}
|
||||
|
||||
interface Bucket {
|
||||
name: string;
|
||||
region: string;
|
||||
creationDate: string;
|
||||
StorageClass: StorageType;
|
||||
}
|
||||
|
||||
type StorageType = "Standard" | "IA" | "Archive";
|
||||
|
||||
type ACLType = "public-read-write" | "public-read" | "private";
|
||||
|
||||
type HTTPMethods = "GET" | "POST" | "DELETE" | "PUT";
|
||||
|
||||
interface RequestOptions {
|
||||
// the operation timeout
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
type RuleStatusType = "Enabled" | "Disabled";
|
||||
|
||||
interface LifecycleRule {
|
||||
id?: string; // rule id, if not set, OSS will auto create it with random string.
|
||||
prefix: string; // store prefix
|
||||
status: RuleStatusType; // rule status, allow values: Enabled or Disabled
|
||||
days?: number | string; // expire after the days
|
||||
date: string; // expire date, e.g.: 2022-10-11T00:00:00.000Z date and days only set one.
|
||||
}
|
||||
|
||||
interface CORSRule {
|
||||
allowedOrigin: string | string[]; // configure for Access-Control-Allow-Origin header
|
||||
allowedMethod: string | string[]; // configure for Access-Control-Allow-Methods header
|
||||
allowedHeader?: string | string[]; // configure for Access-Control-Allow-Headers header
|
||||
exposeHeader?: string | string[]; // configure for Access-Control-Expose-Headers header
|
||||
maxAgeSeconds?: string | string[]; // configure for Access-Control-Max-Age header
|
||||
}
|
||||
|
||||
interface OwnerType {
|
||||
id: string;
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
interface ObjectMeta {
|
||||
name: string; // object name on oss
|
||||
lastModified: string; // object last modified GMT date, e.g.: 2015-02-19T08:39:44.000Z
|
||||
etag: string; // object etag contains ", e.g.: "5B3C1A2E053D763E1B002CC607C5A0FE"
|
||||
type: string; // object type, e.g.: Normal
|
||||
size: number; // object size, e.g.: 344606
|
||||
storageClass: StorageType;
|
||||
owner: OwnerType;
|
||||
}
|
||||
|
||||
interface NormalSuccessResponse {
|
||||
// response status
|
||||
status: number;
|
||||
// response headers
|
||||
headers: object; // todo the object in detail
|
||||
// response size
|
||||
size: number;
|
||||
// request total use time (ms)
|
||||
rt: number;
|
||||
}
|
||||
|
||||
interface UserMeta {
|
||||
uid: number;
|
||||
pid: number;
|
||||
}
|
||||
|
||||
interface ObjectCallback {
|
||||
url: string; // After a file is uploaded successfully, the OSS sends a callback request to this URL.
|
||||
host?: string; // The host header value for initiating callback requests.
|
||||
body: string; // The value of the request body when a callback is initiated, for example, key=$(key)&etag=$(etag)&my_var=$(x:my_var).
|
||||
contentType?: string; // The Content-Type of the callback requests initiatiated, It supports application/x-www-form-urlencoded and application/json, and the former is the default value.
|
||||
customValue?: object;
|
||||
headers?: object; // extra headers, detail see RFC 2616
|
||||
}
|
||||
|
||||
interface ModifyData {
|
||||
lastModified: string; // object last modified GMT string
|
||||
etag: string; // object etag contains ", e.g.: "5B3C1A2E053D763E1B002CC607C5A0FE"
|
||||
}
|
||||
|
||||
interface Checkpoint {
|
||||
file: any; // The file object selected by the user, if the browser is restarted, it needs the user to manually trigger the settings
|
||||
name: string; // object key
|
||||
fileSize: number;
|
||||
partSize: number;
|
||||
uploadId: string;
|
||||
doneParts: Array<{ number: number, etag: string }>;
|
||||
}
|
||||
|
||||
interface ObjectPart {
|
||||
PartNumber: number;
|
||||
LastModified: any; // {Date} Time when a part is uploaded.
|
||||
ETag: string;
|
||||
size: number;
|
||||
}
|
||||
|
||||
interface Upload {
|
||||
name: string;
|
||||
uploadId: string;
|
||||
initiated: any;
|
||||
}
|
||||
|
||||
interface Channel {
|
||||
Name: string;
|
||||
Description: string;
|
||||
Status: string;
|
||||
LastModified: string;
|
||||
PublishUrls: string[];
|
||||
PlayUrls: string[];
|
||||
}
|
||||
|
||||
interface ChannelHistory {
|
||||
StartTime: string; //
|
||||
EndTime: string;
|
||||
RemoteAddr: string; // the remote addr
|
||||
}
|
||||
// parameters type
|
||||
interface ListBucketsQueryType {
|
||||
prefix?: string; // search buckets using prefix key
|
||||
marker?: string; // search start from marker, including marker key
|
||||
'max-keys'?: string | number; // max buckets, default is 100, limit to 1000
|
||||
}
|
||||
|
||||
interface PutBucketOptions {
|
||||
timeout: number;
|
||||
storageClass: StorageType;
|
||||
}
|
||||
|
||||
interface PutBucketWebsiteConfig {
|
||||
index: string; // default page, e.g.: index.html
|
||||
error?: string; // error page, e.g.: 'error.html'
|
||||
}
|
||||
|
||||
interface ListObjectsQuery {
|
||||
prefix?: string; // search object using prefix key
|
||||
marker?: string; // search start from marker, including marker key
|
||||
delimiter?: string; // delimiter search scope e.g. / only search current dir, not including subdir
|
||||
'max-keys': string | number; // max objects, default is 100, limit to 1000
|
||||
}
|
||||
|
||||
interface ListObjectResult {
|
||||
objects: ObjectMeta[];
|
||||
prefixes: string[];
|
||||
isTruncated: boolean;
|
||||
nextMarker: string;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface PutObjectOptions {
|
||||
timeout?: number; // the operation timeout
|
||||
mime?: string; // custom mime, will send with Content-Type entity header
|
||||
meta?: UserMeta; // user meta, will send with x-oss-meta- prefix string e.g.: { uid: 123, pid: 110 }
|
||||
callback: ObjectCallback;
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
interface PutObjectResult {
|
||||
name: string;
|
||||
data: object;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface PutStreamOptions {
|
||||
contentLength?: number; // the stream length, chunked encoding will be used if absent
|
||||
timeout: number; // the operation timeout
|
||||
mime: string; // custom mime, will send with Content-Type entity header
|
||||
meta: UserMeta;
|
||||
callback: ObjectCallback;
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
interface AppendObjectOptions {
|
||||
position?: string; // specify the position which is the content length of the latest object
|
||||
timeout?: number; // the operation timeout
|
||||
mime?: string; // custom mime, will send with Content-Type entity header
|
||||
meta?: UserMeta;
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
interface AppendObjectResult {
|
||||
name: string;
|
||||
url: string; // the url of oss
|
||||
res: NormalSuccessResponse;
|
||||
nextAppendPosition: string; // the next position
|
||||
}
|
||||
|
||||
interface HeadObjectOptions {
|
||||
timeout?: number;
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
interface HeadObjectResult {
|
||||
status: number; // response status, maybe 200 or 304
|
||||
meta: UserMeta;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface GetObjectOptions {
|
||||
timeout?: number;
|
||||
process?: string; // image process params, will send with x-oss-process e.g.: {process: 'image/resize,w_200'}
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
interface GetObjectResult {
|
||||
content?: any; // file content buffer if file parameter is null or ignore
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface GetStreamOptions {
|
||||
timeout?: number;
|
||||
process?: string; // image process params, will send with x-oss-process e.g.: {process: 'image/resize,w_200'}
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
interface GetStreamResult {
|
||||
stream?: any; // readable stream instance if response status is not 200, stream will be null.
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface CopyObjectOptions {
|
||||
timeout?: number;
|
||||
meta?: UserMeta;
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
interface CopyAndPutMetaResult {
|
||||
data: ModifyData;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface DeleteMultiOptions {
|
||||
quite?: boolean; // quite mode or verbose mode, default is false
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
interface DeleteMultiResult {
|
||||
deleted?: string[]; // deleted object names list
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface ResponseHeaderType {
|
||||
'content-type'?: string;
|
||||
'content-disposition'?: string;
|
||||
'cache-control'?: string;
|
||||
}
|
||||
|
||||
interface SignatureUrlOptions {
|
||||
expires?: number; // after expires seconds, the url will become invalid, default is 1800
|
||||
method?: HTTPMethods; // the HTTP method, default is 'GET'
|
||||
'Content-Type'?: string; // set the request content type
|
||||
process?: string;
|
||||
response?: ResponseHeaderType; // set the response headers for download
|
||||
callback?: ObjectCallback;
|
||||
}
|
||||
|
||||
interface GetACLResult {
|
||||
acl: ACLType;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface InitMultipartUploadOptions {
|
||||
timeout?: number;
|
||||
mime?: string; // Mime file type
|
||||
meta?: UserMeta;
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
interface InitMultipartUploadResult {
|
||||
res: { status: number, headers: object, size: number, rt: number };
|
||||
bucket: string; // bucket name
|
||||
name: string; // object name store on OSS
|
||||
uploadId: string; // upload id, use for uploadPart, completeMultipart
|
||||
}
|
||||
|
||||
interface UploadPartResult {
|
||||
name: string;
|
||||
etag: string;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface CompleteMultipartUploadOptions {
|
||||
timeout?: number;
|
||||
callback?: ObjectCallback;
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
interface CompleteMultipartUploadResult {
|
||||
bucket: string;
|
||||
name: string;
|
||||
etag: string;
|
||||
data: object;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface MultipartUploadOptions {
|
||||
parallel?: number; // the number of parts to be uploaded in parallel
|
||||
partSize?: number; // the suggested size for each part
|
||||
progress?: (...args: any[]) => any; // the progress callback called after each successful upload of one part
|
||||
checkpoint?: Checkpoint; // the checkpoint to resume upload, if this is provided, it will continue the upload from where interrupted, otherwise a new multipart upload will be created.
|
||||
meta?: UserMeta;
|
||||
mime?: string;
|
||||
callback?: ObjectCallback;
|
||||
headers?: object;
|
||||
timeout?: number;
|
||||
copyheaders?: object; // {Object} only uploadPartCopy api used, detail
|
||||
}
|
||||
|
||||
interface MultipartUploadResult {
|
||||
bucket: string;
|
||||
name: string;
|
||||
etag: string;
|
||||
data: object;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface MultipartUploadCopyResult {
|
||||
bucket: string;
|
||||
name: string;
|
||||
etag: string;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface MultipartUploadCopySourceData {
|
||||
sourceKey: string; // the source object name
|
||||
sourceBucketName: string; // sourceData. the source bucket name
|
||||
startOffset: number; // data copy start byte offset, e.g: 0
|
||||
endOffset: number; // data copy end byte offset, e.g: 102400
|
||||
}
|
||||
|
||||
interface ListPartsQuery {
|
||||
'max-parts': number; // The maximum part number in the response of the OSS. default value: 1000.
|
||||
'part-number-marker': number; // Starting position of a specific list. A part is listed only when the part number is greater than the value of this parameter.
|
||||
'encoding-type': string; // Specify the encoding of the returned content and the encoding type. Optional value: url
|
||||
}
|
||||
|
||||
interface ListPartsResult {
|
||||
uploadId: string;
|
||||
bucket: string;
|
||||
name: string;
|
||||
PartNumberMarker: number;
|
||||
nextPartNumberMarker: number;
|
||||
maxParts: number;
|
||||
isTruncated: boolean;
|
||||
parts: ObjectPart[];
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface ListUploadsQuery {
|
||||
prefix?: string;
|
||||
'max-uploads'?: number;
|
||||
'key-marker'?: string;
|
||||
'upload-id-marker'?: string;
|
||||
}
|
||||
|
||||
interface ListUploadsResult {
|
||||
res: NormalSuccessResponse;
|
||||
bucket: string;
|
||||
nextKeyMarker: any;
|
||||
nextUploadIdMarker: any;
|
||||
isTruncated: boolean;
|
||||
uploads: Upload[];
|
||||
}
|
||||
|
||||
interface PutChannelConf {
|
||||
Description?: string;
|
||||
Status?: string;
|
||||
Target?: {
|
||||
Type: string,
|
||||
FragDuration: number,
|
||||
FragCount: number,
|
||||
PlaylistName: string
|
||||
};
|
||||
}
|
||||
|
||||
interface PutChannelResult {
|
||||
publishUrls: string[];
|
||||
playUrls: string[];
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface GetChannelResult {
|
||||
Status: string;
|
||||
ConnectedTime?: string;
|
||||
RemoteAddr?: string;
|
||||
Video?: object;
|
||||
Audio?: object;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface ListChannelsQuery {
|
||||
prefix: string; // the channel id prefix (returns channels with this prefix)
|
||||
marker: string; // the channel id marker (returns channels after this id)
|
||||
'max-keys ': number; // max number of channels to return
|
||||
}
|
||||
|
||||
interface ListChannelsResult {
|
||||
channels: Channel[];
|
||||
nextMarker: string | null;
|
||||
isTruncated: boolean;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface ChannelHistoryResult {
|
||||
records: ChannelHistory;
|
||||
res: NormalSuccessResponse;
|
||||
}
|
||||
|
||||
interface GetRtmpUrlOptions {
|
||||
expires?: number; // the expire time in seconds of the url
|
||||
params?: object; // the additional parameters for url, e.g.: {playlistName: 'play.m3u8'}
|
||||
timeout?: number; // the operation timeout
|
||||
}
|
||||
}
|
||||
|
||||
/// cluster
|
||||
declare namespace OSS {
|
||||
interface ClusterType {
|
||||
host: string;
|
||||
accessKeyId: string;
|
||||
accessKeySecret: string;
|
||||
}
|
||||
|
||||
interface ClusterOptions {
|
||||
clusters: ClusterType[];
|
||||
schedule?: string;
|
||||
}
|
||||
|
||||
class Cluster {
|
||||
constructor(options: ClusterOptions)
|
||||
|
||||
list(query: ListObjectsQuery | null, options: RequestOptions): Promise<ListObjectResult>;
|
||||
|
||||
put(name: string, file: any, options?: PutObjectOptions): Promise<PutObjectResult>;
|
||||
|
||||
putStream(name: string, stream: any, options?: PutStreamOptions): Promise<{ name: string, res: NormalSuccessResponse }>;
|
||||
|
||||
head(name: string, options?: HeadObjectOptions): Promise<HeadObjectResult>;
|
||||
|
||||
get(name: string, file?: any, options?: GetObjectOptions): Promise<GetObjectResult>;
|
||||
|
||||
getStream(name?: string, options?: GetStreamOptions): Promise<GetStreamResult>;
|
||||
|
||||
delete(name: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
|
||||
copy(name: string, sourceName: string, options?: CopyObjectOptions): Promise<CopyAndPutMetaResult>;
|
||||
|
||||
putMeta(name: string, meta: UserMeta, options: RequestOptions): Promise<CopyAndPutMetaResult>;
|
||||
|
||||
deleteMulti(names: string[], options?: DeleteMultiOptions): Promise<DeleteMultiResult>;
|
||||
|
||||
signatureUrl(name: string, options?: SignatureUrlOptions): string;
|
||||
|
||||
putACL(name: string, acl: ACLType, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
|
||||
restore(name: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
// image
|
||||
declare namespace OSS {
|
||||
interface ImageClientOptions {
|
||||
imageHost: string; // your image service domain that binding to a OSS bucket
|
||||
accessKeyId: string; // access key you create on aliyun console website
|
||||
accessKeySecret: string; // access secret you create
|
||||
bucket: string; // the default bucket you want to access If you don't have any bucket, please use putBucket() create one first.
|
||||
region?: string; // the bucket data region location, please see Data Regions, default is oss-cn-hangzhou
|
||||
internal?: boolean; // access OSS with aliyun internal network or not, default is false If your servers are running on aliyun too, you can set true to save lot of money.
|
||||
timeout?: string | number; // instance level timeout for all operations, default is 60s
|
||||
}
|
||||
|
||||
interface ImageGetOptions {
|
||||
timeout?: number;
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
interface StyleData {
|
||||
Name: string; // style name
|
||||
Content: string; // style content
|
||||
CreateTime: string; // style create time
|
||||
LastModifyTime: string; // style last modify time
|
||||
}
|
||||
|
||||
class ImageClient {
|
||||
constructor(options: ImageClientOptions)
|
||||
|
||||
/**
|
||||
* Get an image from the image channel.
|
||||
*/
|
||||
get(name: string, file?: any, options?: ImageGetOptions): Promise<{ content: any, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get an image read stream.
|
||||
*/
|
||||
getStream(name: string, options?: ImageGetOptions): Promise<{ stream: any, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get a image exif info by image object name from the image channel.
|
||||
*/
|
||||
getExif(name: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get a image info and exif info by image object name from the image channel.
|
||||
*/
|
||||
getInfo(name: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* todo
|
||||
*/
|
||||
putStyle(name: string, style: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get a style by name from the image channel.
|
||||
*/
|
||||
getStyle(name: string, options?: RequestOptions): Promise<{ data: StyleData, res: NormalSuccessResponse}>;
|
||||
|
||||
/**
|
||||
* Get all styles from the image channel.
|
||||
*/
|
||||
listStyle(options?: RequestOptions): Promise<StyleData[]>;
|
||||
|
||||
/**
|
||||
* todo
|
||||
*/
|
||||
deleteStyle(styleName: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Create a signature url for directly download.
|
||||
*/
|
||||
signatureUrl(name: string, options?: { expires?: string, timeout?: string }): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare class OSS {
|
||||
constructor(options: OSS.Options)
|
||||
|
||||
/******************************************* the bucket operations *************************************************/
|
||||
|
||||
// base operators
|
||||
/**
|
||||
* List buckets in this account.
|
||||
*/
|
||||
listBuckets(query: OSS.ListBucketsQueryType | null, options?: OSS.RequestOptions): Promise<OSS.Bucket[]>;
|
||||
|
||||
/**
|
||||
* Create a new bucket.
|
||||
*/
|
||||
putBucket(name: string, options?: OSS.PutBucketOptions): Promise<{ bucket: string, res: OSS.NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Use the bucket.
|
||||
*/
|
||||
useBucket(name: string): void;
|
||||
|
||||
/**
|
||||
* Delete an empty bucket.
|
||||
*/
|
||||
deleteBucket(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Get bucket information,include CreationDate、ExtranetEndpoint、IntranetEndpoint、Location、Name、StorageClass、 Owner、AccessControlList
|
||||
*/
|
||||
getBucketInfo(name: string): Promise<any>;
|
||||
|
||||
/**
|
||||
* Get bucket location
|
||||
*/
|
||||
getBucketLocation(name: string): Promise<any>;
|
||||
|
||||
// ACL operations
|
||||
/**
|
||||
* Update the bucket ACL.
|
||||
*/
|
||||
putBucketACL(name: string, acl: OSS.ACLType, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Get the bucket ACL.
|
||||
* acl - acl settings string
|
||||
*/
|
||||
getBucketACL(name: string, options?: OSS.RequestOptions): Promise<{ acl: string, res: OSS.NormalSuccessResponse }>;
|
||||
|
||||
// logging operations
|
||||
/**
|
||||
* Update the bucket logging settings. Log file will create every one hour and name format: <prefix><bucket>-YYYY-mm-DD-HH-MM-SS-UniqueString.
|
||||
*/
|
||||
putBucketLogging(name: string, prefix?: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Get the bucket logging settings.
|
||||
*/
|
||||
getBucketLogging(name: string, options?: OSS.RequestOptions): Promise<{ enable: boolean, prefix: string | null, res: OSS.NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Delete the bucket logging settings.
|
||||
*/
|
||||
deleteBucketLogging(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
// Website operations
|
||||
/**
|
||||
* Set the bucket as a static website.
|
||||
*/
|
||||
putBucketWebsite(name: string, config: OSS.PutBucketWebsiteConfig): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Get the bucket website config.
|
||||
*/
|
||||
getBucketWebsite(name: string, options?: OSS.RequestOptions): Promise<{ index: string, error: string, res: OSS.NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Delete the bucket website config.
|
||||
*/
|
||||
deleteBucketWebsite(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
// referer operations
|
||||
/**
|
||||
* Set the bucket request Referer white list.
|
||||
*/
|
||||
putBucketReferer(name: string, allowEmpty: boolean, referers: string[], options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Get the bucket request Referer white list.
|
||||
*/
|
||||
getBucketReferer(name: string, options?: OSS.RequestOptions): Promise<{ allowEmpty: boolean, referers: string[], res: OSS.NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Delete the bucket request Referer white list.
|
||||
*/
|
||||
deleteBucketReferer(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
// lifecycle operations
|
||||
/**
|
||||
* Set the bucket object lifecycle.
|
||||
*/
|
||||
putBucketLifecycle(name: string, rules: OSS.LifecycleRule[], options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Get the bucket object lifecycle.
|
||||
*/
|
||||
getBucketLifecycle(name: string, options?: OSS.RequestOptions): Promise<{ rules: OSS.LifecycleRule[], res: OSS.NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Delete the bucket object lifecycle.
|
||||
*/
|
||||
deleteBucketLifecycle(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
// CORS operations
|
||||
/**
|
||||
* Set CORS rules of the bucket object
|
||||
*/
|
||||
putBucketCORS(name: string, rules: OSS.CORSRule[], options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Get CORS rules of the bucket object.
|
||||
*/
|
||||
getBucketCORS(name: string): Promise<{ rules: OSS.CORSRule[], res: OSS.NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Delete CORS rules of the bucket object.
|
||||
*/
|
||||
deleteBucketCORS(name: string): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/********************************************************** Object operations ********************************************/
|
||||
/**
|
||||
* List objects in the bucket.
|
||||
*/
|
||||
list(query: OSS.ListObjectsQuery | null, options: OSS.RequestOptions): Promise<OSS.ListObjectResult>;
|
||||
|
||||
/**
|
||||
* Add an object to the bucket.
|
||||
*/
|
||||
put(name: string, file: any, options?: OSS.PutObjectOptions): Promise<OSS.PutObjectResult>;
|
||||
|
||||
/**
|
||||
* Add a stream object to the bucket.
|
||||
*/
|
||||
putStream(name: string, stream: any, options?: OSS.PutStreamOptions): Promise<{ name: string, res: OSS.NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Append an object to the bucket, it's almost same as put, but it can add content to existing object rather than override it.
|
||||
*/
|
||||
append(name: string, file: any, options?: OSS.AppendObjectOptions): Promise<OSS.AppendObjectResult>;
|
||||
|
||||
/**
|
||||
* Get the Object url. If provide baseUrl, will use baseUrl instead the default endpoint.
|
||||
*/
|
||||
getObjectUrl(name: string, baseUrl?: string): string;
|
||||
|
||||
/**
|
||||
* Get the Object url. If provide baseUrl, will use baseUrl instead the default bucket and endpoint. Suggest use generateObjectUrl instead of getObjectUrl.
|
||||
*/
|
||||
generateObjectUrl(name: string, baseUrl?: string): string;
|
||||
|
||||
/**
|
||||
* Head an object and get the meta info.
|
||||
*/
|
||||
head(name: string, options?: OSS.HeadObjectOptions): Promise<OSS.HeadObjectResult>;
|
||||
|
||||
/**
|
||||
* Get an object from the bucket.
|
||||
*/
|
||||
get(name: string, file?: any, options?: OSS.GetObjectOptions): Promise<OSS.GetObjectResult>;
|
||||
|
||||
/**
|
||||
* Get an object read stream.
|
||||
*/
|
||||
getStream(name?: string, options?: OSS.GetStreamOptions): Promise<OSS.GetStreamResult>;
|
||||
|
||||
/**
|
||||
* Delete an object from the bucket.
|
||||
*/
|
||||
delete(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Copy an object from sourceName to name.
|
||||
*/
|
||||
copy(name: string, sourceName: string, options?: OSS.CopyObjectOptions): Promise<OSS.CopyAndPutMetaResult>;
|
||||
|
||||
/**
|
||||
* Set an exists object meta.
|
||||
*/
|
||||
putMeta(name: string, meta: OSS.UserMeta, options: OSS.RequestOptions): Promise<OSS.CopyAndPutMetaResult>;
|
||||
|
||||
/**
|
||||
* Delete multi objects in one request.
|
||||
*/
|
||||
deleteMulti(names: string[], options?: OSS.DeleteMultiOptions): Promise<OSS.DeleteMultiResult>;
|
||||
|
||||
/**
|
||||
* Create a signature url for download or upload object. When you put object with signatureUrl ,you need to pass Content-Type.Please look at the example.
|
||||
*/
|
||||
signatureUrl(name: string, options?: OSS.SignatureUrlOptions): string;
|
||||
|
||||
/**
|
||||
* Set object's ACL.
|
||||
*/
|
||||
putACL(name: string, acl: OSS.ACLType, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Get object's ACL.
|
||||
*/
|
||||
getACL(name: string, options?: OSS.RequestOptions): Promise<OSS.GetACLResult>;
|
||||
|
||||
/**
|
||||
* Restore Object.
|
||||
*/
|
||||
restore(name: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* multi upload
|
||||
*/
|
||||
initMultipartUpload(name: string, options?: OSS.InitMultipartUploadOptions): Promise<OSS.InitMultipartUploadResult>;
|
||||
|
||||
/**
|
||||
* After initiating a Multipart Upload event, you can upload data in parts based on the specified object name and Upload ID.
|
||||
*/
|
||||
uploadPart(name: string, uploadId: string, partNo: number, file: any, start: number, end: number, options?: OSS.RequestOptions): Promise<OSS.UploadPartResult>;
|
||||
|
||||
/**
|
||||
* Using Upload Part Copy, you can copy data from an existing object and upload a part of the data.
|
||||
* When copying a file larger than 1 GB, you must use the Upload Part Copy method. If you want to copy a file smaller than 1 GB, see Copy Object.
|
||||
*/
|
||||
uploadPartCopy(
|
||||
name: string,
|
||||
uploadId: string,
|
||||
partNo: number,
|
||||
range: string,
|
||||
sourceData: { sourceKey: string, sourceBucketName: string },
|
||||
options: { timeout?: number, headers?: object }
|
||||
): Promise<OSS.UploadPartResult>;
|
||||
|
||||
/**
|
||||
* After uploading all data parts, you must call the Complete Multipart Upload API to complete Multipart Upload for the entire file.
|
||||
*/
|
||||
completeMultipartUpload(
|
||||
name: string,
|
||||
uploadId: string,
|
||||
parts: Array<{ number: number, etag: string }>,
|
||||
options?: OSS.CompleteMultipartUploadOptions
|
||||
): Promise<OSS.CompleteMultipartUploadResult>;
|
||||
|
||||
/**
|
||||
* Upload file with OSS multipart.
|
||||
*/
|
||||
multipartUpload(name: string, file: any, options: OSS.MultipartUploadOptions): Promise<OSS.MultipartUploadResult>;
|
||||
|
||||
/**
|
||||
* Copy file with OSS multipart.
|
||||
* this function contains head, initMultipartUpload, uploadPartCopy, completeMultipartUpload.
|
||||
* When copying a file larger than 1 GB, you should use the Upload Part Copy method. If you want to copy a file smaller than 1 GB, see Copy Object.
|
||||
*/
|
||||
multipartUploadCopy(name: string, sourceData: OSS.MultipartUploadCopySourceData, options?: OSS.MultipartUploadOptions): Promise<OSS.MultipartUploadCopyResult>;
|
||||
|
||||
/**
|
||||
* The ListParts command can be used to list all successfully uploaded parts mapped to a specific upload ID, i.e.: those not completed and not aborted.
|
||||
*/
|
||||
listParts(name: string, uploadId: string, query?: OSS.ListPartsQuery, options?: OSS.RequestOptions): Promise<OSS.ListPartsResult>;
|
||||
|
||||
/**
|
||||
* List on-going multipart uploads, i.e.: those not completed and not aborted.
|
||||
*/
|
||||
listUploads(query: OSS.ListUploadsQuery, options?: OSS.RequestOptions): Promise<OSS.ListUploadsResult>;
|
||||
|
||||
/**
|
||||
* Abort a multipart upload for object.
|
||||
*/
|
||||
abortMultipartUpload(name: string, uploadId: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/************************************************ RTMP Operations *************************************************************/
|
||||
/**
|
||||
* Create a live channel.
|
||||
*/
|
||||
putChannel(id: string, conf: OSS.PutChannelConf, options?: OSS.RequestOptions): Promise<OSS.PutChannelResult>;
|
||||
|
||||
/**
|
||||
* Get live channel info.
|
||||
*/
|
||||
getChannel(id: string, options?: OSS.RequestOptions): Promise<{ data: OSS.PutChannelConf, res: OSS.NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Delete a live channel.
|
||||
*/
|
||||
deleteChannel(id: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Change the live channel status.
|
||||
*/
|
||||
putChannelStatus(id: string, status?: string, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Get the live channel status.
|
||||
*/
|
||||
getChannelStatus(id: string, options?: OSS.RequestOptions): Promise<OSS.GetChannelResult>;
|
||||
|
||||
/**
|
||||
* List channels.
|
||||
*/
|
||||
listChannels(query: OSS.ListChannelsQuery, options?: OSS.RequestOptions): Promise<OSS.ListChannelsResult>;
|
||||
|
||||
/**
|
||||
* Get the live channel history.
|
||||
*/
|
||||
getChannelHistory(id: string, options?: OSS.RequestOptions): Promise<OSS.ChannelHistoryResult>;
|
||||
|
||||
/**
|
||||
* Create a VOD playlist for the channel.
|
||||
*/
|
||||
createVod(id: string, name: string, time: { startTime: number, endTime: number }, options?: OSS.RequestOptions): Promise<OSS.NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Get signatured rtmp url for publishing.
|
||||
*/
|
||||
getRtmpUrl(channelId?: string, options?: OSS.GetRtmpUrlOptions): string;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ali-oss-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-mergeable-namespace": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import allPropertyNames = require('all-property-names');
|
||||
|
||||
// $ExpectType Set<string>
|
||||
allPropertyNames(Symbol.prototype);
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for all-property-names 1.0
|
||||
// Project: https://github.com/sindresorhus/all-property-names#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export = allPropertyNames;
|
||||
|
||||
declare function allPropertyNames(input: object): Set<string>;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"all-property-names-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+3
-3
@@ -54,12 +54,12 @@ declare namespace AltJS {
|
||||
export type Source = {[name:string]: () => SourceModel<any>};
|
||||
|
||||
export interface SourceModel<S> {
|
||||
local(state:any, ...args: any[]):any;
|
||||
local?(state:any, ...args: any[]):any;
|
||||
remote(state:any, ...args: any[]):Promise<S>;
|
||||
shouldFetch?(fetchFn:(...args:Array<any>) => boolean):void;
|
||||
loading?:(args:any) => void;
|
||||
success?:(state:S) => void;
|
||||
error?:(args:any) => void;
|
||||
success:(state:S) => void;
|
||||
error:(args:any) => void;
|
||||
interceptResponse?(response:any, action:Action<any>, ...args:Array<any>):any;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-angle-bracket-type-assertion": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
|
||||
@@ -1,85 +1,110 @@
|
||||
// Tests for Amplitude SDK TypeScript definitions
|
||||
|
||||
module Amplitude.Tests {
|
||||
|
||||
function all() {
|
||||
amplitude.init('YOUR_API_KEY_HERE', null, {
|
||||
// optional configuration options
|
||||
var client: amplitude.AmplitudeClient = new amplitude.AmplitudeClient();
|
||||
var identify: amplitude.Identify = new amplitude.Identify();
|
||||
var revenue: amplitude.Revenue = new amplitude.Revenue();
|
||||
|
||||
client = amplitude.getInstance();
|
||||
client = amplitude.getInstance('some name');
|
||||
|
||||
amplitude.__VERSION__ === '1.2.3';
|
||||
amplitude.options.logLevel = 'WARN';
|
||||
|
||||
amplitude.init('API_KEY', 'USER_ID', {
|
||||
saveEvents: true,
|
||||
includeUtm: true,
|
||||
includeReferrer: true,
|
||||
batchEvents: true,
|
||||
eventUploadThreshold: 50
|
||||
});
|
||||
amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE', null, () => {});
|
||||
}, function () { });
|
||||
amplitude.init('API_KEY', 'USER_ID', { includeReferrer: true, includeUtm: true });
|
||||
amplitude.init('API_KEY', 'USER_ID');
|
||||
amplitude.init('API_KEY');
|
||||
|
||||
amplitude.logEvent('EVENT_IDENTIFIER_HERE');
|
||||
amplitude.setUserId('USER_ID_HERE');
|
||||
amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE');
|
||||
amplitude.setUserId(null); // not string 'null'
|
||||
amplitude.setVersionName('VERSION_NAME_HERE');
|
||||
|
||||
amplitude.regenerateDeviceId();
|
||||
amplitude.setDeviceId('CUSTOM_DEVICE_ID');
|
||||
|
||||
amplitude.logEvent('EVENT_IDENTIFIER_HERE', {
|
||||
'color': 'blue',
|
||||
'age': 20,
|
||||
'key': 'value'
|
||||
});
|
||||
amplitude.logEvent('Clicked Homepage Button', { 'finished_flow': false, 'clicks': 15 });
|
||||
amplitude.logEvent('EVENT_IDENTIFIER_HERE', { 'color': 'blue', 'age': 20, 'key': 'value' });
|
||||
amplitude.logEvent("EVENT_IDENTIFIER_HERE", null, (httpCode, response) => { });
|
||||
amplitude.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' });
|
||||
|
||||
amplitude.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0');
|
||||
amplitude.setDomain('.amplitude.com');
|
||||
amplitude.setGroup('orgId', '15');
|
||||
amplitude.setGroup('orgId', ['15', '16']);
|
||||
amplitude.setUserId('joe@gmail.com');
|
||||
amplitude.setUserProperties({ 'gender': 'female', 'sign_up_complete': true })
|
||||
amplitude.setVersionName('1.12.3');
|
||||
amplitude.isNewSession();
|
||||
amplitude.getSessionId() === 123;
|
||||
|
||||
let identify = new amplitude.Identify().set('gender', 'female').set('age', 20);
|
||||
amplitude.identify(identify);
|
||||
amplitude.logRevenue(3.99, 1, 'product_1234');
|
||||
amplitude.logRevenueV2(revenue);
|
||||
|
||||
identify = new amplitude.Identify().setOnce('sign_up_date', '08/24/2015');
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify().setOnce('sign_up_date', '09/14/2015');
|
||||
amplitude.identify(identify);
|
||||
client.init('API_KEY', 'USER_ID', {
|
||||
saveEvents: true,
|
||||
includeUtm: true,
|
||||
includeReferrer: true,
|
||||
batchEvents: true,
|
||||
eventUploadThreshold: 50
|
||||
}, function () { });
|
||||
client.init('API_KEY', 'USER_ID', { includeReferrer: true, includeUtm: true });
|
||||
client.init('API_KEY', 'USER_ID');
|
||||
client.init('API_KEY');
|
||||
|
||||
identify = new amplitude.Identify().unset('gender').unset('age');
|
||||
amplitude.identify(identify);
|
||||
client.logEvent('Clicked Homepage Button', { 'finished_flow': false, 'clicks': 15 });
|
||||
client.logEvent('EVENT_IDENTIFIER_HERE', { 'color': 'blue', 'age': 20, 'key': 'value' });
|
||||
client.logEvent("EVENT_IDENTIFIER_HERE", null, (httpCode, response) => { });
|
||||
client.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' });
|
||||
client.logEventWithTimestamp('EVENT_IDENTIFIER_HERE', { 'key': 'value' }, 1505430378000, (httpCode, response) => { });
|
||||
|
||||
|
||||
client.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0');
|
||||
client.setDomain('.amplitude.com');
|
||||
client.setUserId('joe@gmail.com');
|
||||
client.setOptOut(true);
|
||||
client.setGroup('type', 'name');
|
||||
client.setGroup('type', ['name', 'name2']);
|
||||
client.setUserProperties({ 'gender': 'female', 'sign_up_complete': true });
|
||||
client.setGlobalUserProperties({ 'gender': 'female', 'sign_up_complete': true });
|
||||
client.setVersionName('1.12.3');
|
||||
client.setSessionId(1505430378000);
|
||||
|
||||
client.options.logLevel = 'WARN';
|
||||
client.getSessionId() === 123;
|
||||
client.isNewSession() === true;
|
||||
client.regenerateDeviceId();
|
||||
client.clearUserProperties();
|
||||
|
||||
client.identify(identify);
|
||||
client.logRevenue(3.99, 1, 'product_1234');
|
||||
client.logRevenueV2(revenue);
|
||||
|
||||
|
||||
identify = new amplitude.Identify().set('colors', ['rose', 'gold']).add('karma', 1).setOnce('sign_up_date', '2016-03-31');
|
||||
identify = new amplitude.Identify().add('karma', 1).add('friends', 1);
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify().append('ab-tests', 'new-user-test').append('some_list', [1, 2, 3, 4, 'values']);
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify().prepend('ab-tests', 'new-user-test').prepend('some_list', [1, 2, 3, 4, 'values']);
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify()
|
||||
.set('karma', 10)
|
||||
.add('karma', 1)
|
||||
.unset('karma');
|
||||
amplitude.identify(identify);
|
||||
|
||||
identify = new amplitude.Identify().set('karma', 10).add('karma', 1).unset('karma');
|
||||
identify = new amplitude.Identify().append('ab-tests', 'new-user-tests');
|
||||
identify.append('some_list', [1, 2, 3, 4, 'values']);
|
||||
identify = new amplitude.Identify().prepend('ab-tests', 'new-user-tests');
|
||||
identify.prepend('some_list', [1, 2, 3, 4, 'values']);
|
||||
identify = new amplitude.Identify().set('user_type', 'beta');
|
||||
identify.set('name', { 'first': 'John', 'last': 'Doe' });
|
||||
identify = new amplitude.Identify().setOnce('sign_up_date', '2016-04-01');
|
||||
identify = new amplitude.Identify().unset('user_type').unset('age');
|
||||
identify = new amplitude.Identify()
|
||||
.set('colors', ['rose', 'gold'])
|
||||
.append('ab-tests', 'campaign_a')
|
||||
.append('existing_list', [4, 5]);
|
||||
amplitude.identify(identify);
|
||||
|
||||
amplitude.setUserProperties({
|
||||
gender: 'female',
|
||||
age: 20
|
||||
});
|
||||
|
||||
amplitude.clearUserProperties();
|
||||
|
||||
amplitude.setOptOut(true);
|
||||
amplitude.setOptOut(false);
|
||||
|
||||
amplitude.setGroup('orgId', '15');
|
||||
amplitude.setGroup('sport', ['soccer', 'tennis']);
|
||||
|
||||
// TODO: Implement those.
|
||||
/*
|
||||
var revenue = new amplitude.Revenue().setProductId('com.company.productId').setPrice(3.99).setQuantity(3);
|
||||
amplitude.logRevenueV2(revenue);
|
||||
|
||||
amplitude.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' });
|
||||
*/
|
||||
revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99);
|
||||
revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setEventProperties({ 'city': 'San Francisco' });
|
||||
revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setQuantity(5);
|
||||
revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setRevenueType('purchase');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vendored
+97
-12
@@ -1,61 +1,146 @@
|
||||
// Type definitions for Amplitude SDK 2.12.1
|
||||
// Type definitions for Amplitude SDK 4.4.0
|
||||
// Project: https://github.com/amplitude/Amplitude-Javascript
|
||||
// Definitions by: Arvydas Sidorenko <https://github.com/Asido>
|
||||
// Definitions: https://github.com/Asido/DefinitelyTyped
|
||||
// Dan Manastireanu <https://github.com/danmana>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module amplitude {
|
||||
|
||||
type Callback = (responseCode: number, responseBody: string, details?: { reason: string; }) => void;
|
||||
type LogReturn = number | void;
|
||||
|
||||
interface Config {
|
||||
apiEndpoint?: string;
|
||||
batchEvents?: boolean;
|
||||
cookieExpiration?: number;
|
||||
cookieName?: string;
|
||||
userId?: string;
|
||||
deviceId?: string;
|
||||
deviceIdFromUrlParam?: boolean;
|
||||
domain?: string;
|
||||
eventUploadPeriodMillis?: number;
|
||||
eventUploadThreshold?: number;
|
||||
forceHttps?: boolean;
|
||||
includeGclid?: boolean;
|
||||
includeReferrer?: boolean;
|
||||
includeUtm?: boolean;
|
||||
language?: string;
|
||||
logLevel?: 'DISABLE' | 'ERROR' | 'WARN' | 'INFO';
|
||||
optOut?: boolean;
|
||||
platform?: string;
|
||||
saveEvents?: boolean;
|
||||
savedMaxCount?: number;
|
||||
saveParamsReferrerOncePerSession?: boolean;
|
||||
sessionTimeout?: number;
|
||||
trackingOptions?: {
|
||||
city?: boolean;
|
||||
country?: boolean;
|
||||
device_model?: boolean;
|
||||
dma?: boolean;
|
||||
ip_address?: boolean;
|
||||
language?: boolean;
|
||||
os_name?: boolean;
|
||||
os_version?: boolean;
|
||||
platform?: boolean;
|
||||
region?: boolean;
|
||||
version_name?: boolean;
|
||||
},
|
||||
unsentKey?: string;
|
||||
unsentIdentifyKey?: string;
|
||||
uploadBatchSize?: number;
|
||||
}
|
||||
|
||||
export class Identify {
|
||||
set(key: string, value: any): Identify;
|
||||
setOnce(key: string, value: any): Identify;
|
||||
add(key: string, value: number): Identify;
|
||||
add(key: string, value: number | string): Identify;
|
||||
append(key: string, value: any): Identify;
|
||||
prepend(key: string, value: any): Identify;
|
||||
|
||||
unset(key: string): Identify;
|
||||
}
|
||||
|
||||
export function init(apiKey: string): void;
|
||||
export function init(apiKey: string, userId: string): void;
|
||||
export function init(apiKey: string, userId: string, options: Config): void;
|
||||
export function init(apiKey: string, userId: string, options: Config, callback: () => void): void;
|
||||
export class Revenue {
|
||||
|
||||
setProductId(productId: string): Revenue;
|
||||
setQuantity(quantity: number): Revenue;
|
||||
setPrice(price: number): Revenue;
|
||||
setRevenueType(revenueType: string): Revenue;
|
||||
setEventProperties(eventProperties: any): Revenue;
|
||||
}
|
||||
|
||||
export class AmplitudeClient {
|
||||
|
||||
constructor(instanceName?: string);
|
||||
|
||||
options: Config;
|
||||
|
||||
init(apiKey: string, userId?: string, config?: Config, callback?: (client: AmplitudeClient) => void): void;
|
||||
|
||||
setVersionName(versionName: string): void;
|
||||
|
||||
isNewSession(): boolean;
|
||||
setSessionId(sessionId: number): void;
|
||||
getSessionId(): number;
|
||||
|
||||
setDomain(domain: string): void;
|
||||
setUserId(userId: string): void;
|
||||
|
||||
setDeviceId(id: string): void;
|
||||
regenerateDeviceId(): void;
|
||||
|
||||
identify(identify_obj: Identify, opt_callback?: Callback): void;
|
||||
|
||||
setUserProperties(properties: any): void;
|
||||
setGlobalUserProperties(properties: any): void;
|
||||
clearUserProperties(): void;
|
||||
|
||||
setOptOut(enable: boolean): void;
|
||||
|
||||
setGroup(groupType: string, groupName: string | string[]): void;
|
||||
|
||||
logEvent(event: string, data?: any, callback?: Callback): LogReturn;
|
||||
logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn;
|
||||
logRevenueV2(revenue_obj: Revenue): LogReturn;
|
||||
logRevenue(pric: number, quantity: number, product: string): LogReturn;
|
||||
logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn;
|
||||
}
|
||||
|
||||
// Proxy methods that get executed on the default AmplitudeClient instance (not all client methods are proxied)
|
||||
|
||||
export function init(apiKey: string, userId?: string, options?: Config, callback?: (client: AmplitudeClient) => void): void;
|
||||
|
||||
export function setVersionName(version: string): void;
|
||||
|
||||
export function isNewSession(): boolean;
|
||||
export function getSessionId(): number;
|
||||
|
||||
export function setDomain(domain: string): void;
|
||||
|
||||
export function setUserId(userId: string): void;
|
||||
|
||||
export function setDeviceId(id: string): void;
|
||||
export function regenerateDeviceId(): void;
|
||||
|
||||
export function identify(identify: Identify): void;
|
||||
export function identify(identify: Identify, callback?: Callback): void;
|
||||
|
||||
export function setUserProperties(properties: Object): void;
|
||||
export function setUserProperties(properties: any): void;
|
||||
export function setGlobalUserProperties(properties: any): void;
|
||||
export function clearUserProperties(): void;
|
||||
|
||||
export function setOptOut(optOut: boolean): void;
|
||||
|
||||
export function setGroup(groupType: string, groupName: string | string[]): void;
|
||||
|
||||
export function logEvent(event: string): void;
|
||||
export function logEvent(event: string, data: Object): void;
|
||||
export function logEvent(event: string, data: Object, callback: (httpCode: number, response: any) => void): void;
|
||||
export function logEvent(event: string, data?: any, callback?: Callback): LogReturn;
|
||||
export function logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn;
|
||||
export function logRevenueV2(revenue_obj: Revenue): LogReturn;
|
||||
export function logRevenue(pric: number, quantity: number, product: string): LogReturn;
|
||||
export function logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn;
|
||||
|
||||
|
||||
|
||||
export function getInstance(instanceName?: string): AmplitudeClient;
|
||||
export const __VERSION__: string;
|
||||
export var options: Config;
|
||||
}
|
||||
|
||||
+10
-1
@@ -136,7 +136,16 @@ export interface ChannelWrapper extends EventEmitter {
|
||||
* Setup functions should, ideally, not throw errors, but if they do then the ChannelWrapper will emit an 'error' event.
|
||||
* @param func
|
||||
*/
|
||||
addSetup(func: SetupFunc): Promise<void>;
|
||||
addSetup(func: SetupFunc): Promise<void>;
|
||||
|
||||
/**
|
||||
* Remove a setup function added with `addSetup`. If there is currently a
|
||||
* connection, `teardown(channel, [cb])` will be run immediately, and the
|
||||
* returned Promise will not resolve until it completes.
|
||||
* @param func
|
||||
* @param [tearDown]
|
||||
*/
|
||||
removeSetup(func: SetupFunc, tearDown?: SetupFunc): Promise<void>;
|
||||
|
||||
/**
|
||||
* @see amqplib
|
||||
|
||||
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 {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// All are TODOs
|
||||
"no-any-union": false,
|
||||
"no-empty-interface": false,
|
||||
"prefer-const": false
|
||||
}
|
||||
|
||||
Vendored
+12
-8
@@ -22,8 +22,8 @@ declare namespace AnalyticsNode {
|
||||
},
|
||||
timestamp?: Date;
|
||||
messageId?: string;
|
||||
anonymousId: string | number;
|
||||
userId: string | number;
|
||||
anonymousId?: string | number;
|
||||
userId?: string | number;
|
||||
}
|
||||
|
||||
interface Data {
|
||||
@@ -47,7 +47,8 @@ declare namespace AnalyticsNode {
|
||||
/* The identify method lets you tie a user to their actions and record
|
||||
traits about them. */
|
||||
identify(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
traits?: Object;
|
||||
timestamp?: Date;
|
||||
context?: Object;
|
||||
@@ -56,7 +57,8 @@ declare namespace AnalyticsNode {
|
||||
|
||||
/* The track method lets you record the actions your users perform. */
|
||||
track(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
event: string;
|
||||
properties?: Object;
|
||||
timestamp?: Date;
|
||||
@@ -67,7 +69,8 @@ declare namespace AnalyticsNode {
|
||||
/* The page method lets you record page views on your website, along with
|
||||
optional extra information about the page being viewed. */
|
||||
page(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
category?: string;
|
||||
name?: string;
|
||||
properties?: Object;
|
||||
@@ -79,19 +82,20 @@ declare namespace AnalyticsNode {
|
||||
/* alias is how you associate one identity with another. */
|
||||
alias(message: {
|
||||
previousId: string | number;
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
integrations?: Integrations;
|
||||
}, callback?: (err: Error, data: Data) => void): Analytics;
|
||||
|
||||
/* Group calls can be used to associate individual users with shared
|
||||
accounts or companies. */
|
||||
group(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
groupId: string | number;
|
||||
traits?: Object;
|
||||
context?: Object;
|
||||
timestamp?: Date;
|
||||
anonymous_id?: string | number;
|
||||
integrations?: Integrations;
|
||||
}, callback?: (err: Error, data: Data) => void): Analytics;
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,13 @@ app.controller('Ctrl', ($scope: ng.IScope, blockUI: angular.blockUI.BlockUIServi
|
||||
blockUI.stop();
|
||||
blockUI.reset();
|
||||
blockUI.message("Hello Types");
|
||||
blockUI.done();
|
||||
blockUI.done(() => {
|
||||
console.log("blockUI stopped");
|
||||
});
|
||||
const b: boolean = blockUI.isBlocking();
|
||||
|
||||
const myBlockUI = blockUI.instances.get("myBlockUI");
|
||||
myBlockUI.start();
|
||||
myBlockUI.reset();
|
||||
myBlockUI.stop();
|
||||
});
|
||||
|
||||
Vendored
+35
-14
@@ -1,6 +1,8 @@
|
||||
// Type definitions for angular-block-ui 0.2
|
||||
// Project: https://github.com/McNull/angular-block-ui
|
||||
// Definitions by: Lasse Nørregaard <https://github.com/lassebn>, Stephan Classen <https://github.com/sclassen>
|
||||
// Definitions by: Lasse Nørregaard <https://github.com/lassebn>
|
||||
// Stephan Classen <https://github.com/sclassen>
|
||||
// Soner Köksal <https://github.com/renjfk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -48,6 +50,8 @@ declare module 'angular' {
|
||||
*
|
||||
* If you don't want this behaviour and want to do all the
|
||||
* blocking manually you can change this value to false.
|
||||
*
|
||||
* The default value is 'true'
|
||||
*/
|
||||
autoBlock?: boolean;
|
||||
|
||||
@@ -56,6 +60,8 @@ declare module 'angular' {
|
||||
* hide the overlay whenever an exception has occurred.
|
||||
*
|
||||
* You can set this value to false if you don't want this behaviour.
|
||||
*
|
||||
* The default value is 'true'
|
||||
*/
|
||||
resetOnException?: boolean;
|
||||
|
||||
@@ -74,33 +80,42 @@ declare module 'angular' {
|
||||
|
||||
/**
|
||||
* When the module is started it will inject the main block element
|
||||
* by adding the block-ui directive to the body element.
|
||||
* by adding the "block-ui" directive to the <body> element.
|
||||
*
|
||||
* Set this to false if there no need for any fullscreen blocking or if there's
|
||||
* more control required. For instance when your ng-app directive is a child
|
||||
* element of the body element it is impossible for the blockUI resolve the main
|
||||
* instance. In such a case the auto injection of the main block scope should
|
||||
* be disabled and the main block element should be relocated.
|
||||
*
|
||||
* The default value is 'true'
|
||||
*/
|
||||
autoInjectBodyBlock?: boolean;
|
||||
|
||||
/**
|
||||
* A string containing the default css classes, separated by spaces,
|
||||
* A string containing the default css classes (separated by spaces)
|
||||
* that should be applied to each block-ui element.
|
||||
*
|
||||
* The default value is `block-ui block-ui-anim-fade`
|
||||
* The default value is "block-ui block-ui-anim-fade"
|
||||
*/
|
||||
cssClass?: string;
|
||||
|
||||
/**
|
||||
* Whenever a user interface block is active, because the single page
|
||||
* application is still waiting for a response from the backend server,
|
||||
* the user can still navigate away using the back and forward buttons
|
||||
* of the browser.
|
||||
* While a user interface block is active the user can still navigate
|
||||
* away using the back and forward buttons of the browser.
|
||||
*
|
||||
* Callbacks registered to handle the responses from the server will
|
||||
* be executed even if a different view/controller is currently active.
|
||||
* By setting the blockBrowserNavigation property to true the
|
||||
* angular-block-ui module will prevent navigation while a fullscreen
|
||||
* Callbacks registered to handle responses from the server will
|
||||
* be executed even if a different view/controller is active at the
|
||||
* time the response arrives.
|
||||
*
|
||||
* You can set this value to true if you want to prevent navigation
|
||||
* with the browser back and forward buttons while a fullscreen
|
||||
* block is active.
|
||||
*
|
||||
* Programatic location changes via the $location service are still
|
||||
* allowed however.
|
||||
* The navigation block is disabled by default.
|
||||
*
|
||||
* The default value is 'false'
|
||||
*/
|
||||
blockBrowserNavigation?: boolean;
|
||||
}
|
||||
@@ -150,7 +165,7 @@ declare module 'angular' {
|
||||
* This can be useful whenever you wish to redirect the user
|
||||
* to a different location while there are still pending AJAX requests.
|
||||
*/
|
||||
done(): void;
|
||||
done(doneCallback: () => void): void;
|
||||
|
||||
/**
|
||||
* Allows the message shown in the overlay to be updated
|
||||
@@ -164,6 +179,12 @@ declare module 'angular' {
|
||||
* Returns whether currently a block is shown for the instance or not.
|
||||
*/
|
||||
isBlocking(): boolean;
|
||||
|
||||
instances: BlockUIInstances;
|
||||
}
|
||||
|
||||
interface BlockUIInstances {
|
||||
get(id: string): BlockUIService;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"angular-block-ui-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-angle-bracket-type-assertion": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+6
@@ -76,6 +76,7 @@ declare module 'angular' {
|
||||
|
||||
interface IConfirmDialog extends IPresetDialog<IConfirmDialog> {
|
||||
cancel(cancel: string): IConfirmDialog;
|
||||
multiple(multiple: boolean): IConfirmDialog;
|
||||
}
|
||||
|
||||
interface IPromptDialog extends IPresetDialog<IPromptDialog> {
|
||||
@@ -152,6 +153,10 @@ declare module 'angular' {
|
||||
defaultFontSet(name: string): IIconProvider;
|
||||
}
|
||||
|
||||
interface IInkRippleProvider {
|
||||
disableInkRipple(): void;
|
||||
}
|
||||
|
||||
type IMedia = (media: string) => boolean;
|
||||
|
||||
interface ISidenavObject {
|
||||
@@ -340,6 +345,7 @@ declare module 'angular' {
|
||||
|
||||
interface IMenuService {
|
||||
hide(response?: any, options?: any): IPromise<any>;
|
||||
open(event?: MouseEvent): void;
|
||||
}
|
||||
|
||||
interface IColorPalette {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-angle-bracket-type-assertion": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
|
||||
@@ -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[];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -16,6 +16,9 @@ interface SortLogInfo {
|
||||
Text: string;
|
||||
}
|
||||
|
||||
// Ensure that the jQuery-ui defined `sortable()` method is not overwritten
|
||||
jQuery().sortable(); // $ExpectType JQuery<HTMLElement>
|
||||
|
||||
myApp.controller('sortableController', function ($scope: MySortableControllerScope) {
|
||||
$scope.sortableOptions = {
|
||||
activate: function(e, ui) {
|
||||
@@ -84,6 +87,7 @@ myApp.controller('sortableController', function ($scope: MySortableControllerSco
|
||||
update: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
ui.item.sortable; // $ExpectType UISortableProperties<SortableModelInfo>
|
||||
var voidcanceled: void = ui.item.sortable.cancel();
|
||||
var isCanceled: Boolean = ui.item.sortable.isCanceled();
|
||||
var isCustomHelperUsed: Boolean =ui.item.sortable.isCustomHelperUsed();
|
||||
@@ -132,9 +136,8 @@ myApp.controller('sortableController', function ($scope: MySortableControllerSco
|
||||
$scope.sortableOptions.tolerance = 'pointer';
|
||||
$scope.sortableOptions.zIndex = 9999;
|
||||
|
||||
$scope.sortableOptions['ui-floating'] = undefined;
|
||||
$scope.sortableOptions['ui-floating'] = null;
|
||||
$scope.sortableOptions['ui-floating'] = false;
|
||||
$scope.sortableOptions['ui-floating'] = true;
|
||||
$scope.sortableOptions['ui-floating'] = "auto";
|
||||
const sortableFloatingOption0: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': undefined };
|
||||
const sortableFloatingOption1: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': false };
|
||||
const sortableFloatingOption2: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': true };
|
||||
const sortableFloatingOption3: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': 'auto' };
|
||||
});
|
||||
|
||||
Vendored
+8
-4
@@ -2,17 +2,21 @@
|
||||
// Project: https://github.com/angular-ui/ui-sortable
|
||||
// Definitions by: Thodoris Greasidis <https://github.com/thgreasi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="angular" />
|
||||
/// <reference types="jqueryui" />
|
||||
|
||||
import * as ng from 'angular';
|
||||
|
||||
// Diff / Omit taken from https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-311923766
|
||||
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]>;
|
||||
|
||||
declare module 'angular' {
|
||||
export namespace ui {
|
||||
|
||||
interface UISortableOptions<T> extends SortableOptions<T> {
|
||||
'ui-floating'?: string | boolean;
|
||||
'ui-floating'?: 'auto' | boolean;
|
||||
}
|
||||
|
||||
interface UISortableProperties<T> {
|
||||
@@ -79,11 +83,11 @@ declare module 'angular' {
|
||||
isCustomHelperUsed(): Boolean;
|
||||
}
|
||||
|
||||
interface UISortableUIItem<T> extends ng.IAugmentedJQuery {
|
||||
interface UISortableUIItem<T> extends Omit<ng.IAugmentedJQuery, 'sortable'> {
|
||||
sortable: UISortableProperties<T>;
|
||||
}
|
||||
|
||||
interface UISortableUIParams<T> extends SortableUIParams {
|
||||
interface UISortableUIParams<T> extends Omit<SortableUIParams, 'item'> {
|
||||
item: UISortableUIItem<T>;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
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';
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-angle-bracket-type-assertion": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
|
||||
@@ -1502,16 +1502,28 @@ interface MyScope extends ng.IScope {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
const directiveCompileFnWithGeneric: ng.IDirectiveCompileFn<MyScope> = (
|
||||
templateElement: JQLite,
|
||||
templateAttributes: ng.IAttributes,
|
||||
transclude: ng.ITranscludeFunction
|
||||
): ng.IDirectiveLinkFn<MyScope> => {
|
||||
return (
|
||||
scope: MyScope,
|
||||
instanceElement: JQLite,
|
||||
instanceAttributes: ng.IAttributes
|
||||
) => {
|
||||
return null;
|
||||
};
|
||||
};
|
||||
interface MyElement extends JQLite {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
interface MyAttributes extends ng.IAttributes {
|
||||
foo: string;
|
||||
}
|
||||
interface MyController extends ng.INgModelController {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
angular.module('WithGenerics', [])
|
||||
.directive('directiveUsingGenerics', () => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
link(scope: MyScope, element: MyElement, templateAttributes: MyAttributes, controller: MyController) {
|
||||
scope['name'] = 'Jeff';
|
||||
}
|
||||
};
|
||||
})
|
||||
.directive('linkFunctionUsingGenerics', () => {
|
||||
return (scope: MyScope, element: MyElement, templateAttributes: MyAttributes, controller: MyController) => {
|
||||
scope['name'] = 'Jeff';
|
||||
};
|
||||
});
|
||||
|
||||
Vendored
+26
-23
@@ -240,8 +240,9 @@ declare namespace angular {
|
||||
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
|
||||
* @param directiveFactory An injectable directive factory function.
|
||||
*/
|
||||
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): IModule;
|
||||
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): IModule;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>): IModule;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>}): IModule;
|
||||
|
||||
/**
|
||||
* Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
|
||||
*
|
||||
@@ -1316,7 +1317,7 @@ declare namespace angular {
|
||||
*
|
||||
* @param key the key of the data to be retrieved
|
||||
*/
|
||||
get<T>(key: string): T;
|
||||
get<T>(key: string): T | undefined;
|
||||
|
||||
/**
|
||||
* Removes an entry from the Cache object.
|
||||
@@ -1346,8 +1347,8 @@ declare namespace angular {
|
||||
}
|
||||
|
||||
interface ICompileProvider extends IServiceProvider {
|
||||
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>}): ICompileProvider;
|
||||
|
||||
component(name: string, options: IComponentOptions): ICompileProvider;
|
||||
component(object: {[componentName: string]: IComponentOptions}): ICompileProvider;
|
||||
@@ -2066,29 +2067,31 @@ declare namespace angular {
|
||||
// and http://docs.angularjs.org/guide/directive
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
interface IDirectiveFactory<TScope extends IScope = IScope> {
|
||||
(...args: any[]): IDirective<TScope> | IDirectiveLinkFn<TScope>;
|
||||
type IDirectiveController = IController | IController[] | {[key: string]: IController};
|
||||
|
||||
interface IDirectiveFactory<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
(...args: any[]): IDirective<TScope, TElement, TAttributes, TController> | IDirectiveLinkFn<TScope, TElement, TAttributes, TController>;
|
||||
}
|
||||
|
||||
interface IDirectiveLinkFn<TScope extends IScope = IScope> {
|
||||
interface IDirectiveLinkFn<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
(
|
||||
scope: TScope,
|
||||
instanceElement: JQLite,
|
||||
instanceAttributes: IAttributes,
|
||||
controller?: IController | IController[] | {[key: string]: IController},
|
||||
instanceElement: TElement,
|
||||
instanceAttributes: TAttributes,
|
||||
controller?: TController,
|
||||
transclude?: ITranscludeFunction
|
||||
): void;
|
||||
}
|
||||
|
||||
interface IDirectivePrePost<TScope extends IScope = IScope> {
|
||||
pre?: IDirectiveLinkFn<TScope>;
|
||||
post?: IDirectiveLinkFn<TScope>;
|
||||
interface IDirectivePrePost<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
pre?: IDirectiveLinkFn<TScope, TElement, TAttributes, TController>;
|
||||
post?: IDirectiveLinkFn<TScope, TElement, TAttributes, TController>;
|
||||
}
|
||||
|
||||
interface IDirectiveCompileFn<TScope extends IScope = IScope> {
|
||||
interface IDirectiveCompileFn<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
(
|
||||
templateElement: JQLite,
|
||||
templateAttributes: IAttributes,
|
||||
templateElement: TElement,
|
||||
templateAttributes: TAttributes,
|
||||
/**
|
||||
* @deprecated
|
||||
* Note: The transclude function that is passed to the compile function is deprecated,
|
||||
@@ -2096,11 +2099,11 @@ declare namespace angular {
|
||||
* that is passed to the link function instead.
|
||||
*/
|
||||
transclude: ITranscludeFunction
|
||||
): void | IDirectiveLinkFn<TScope> | IDirectivePrePost<TScope>;
|
||||
): void | IDirectiveLinkFn<TScope, TElement, TAttributes, TController> | IDirectivePrePost<TScope, TElement, TAttributes, TController>;
|
||||
}
|
||||
|
||||
interface IDirective<TScope extends IScope = IScope> {
|
||||
compile?: IDirectiveCompileFn<TScope>;
|
||||
interface IDirective<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
compile?: IDirectiveCompileFn<TScope, TElement, TAttributes, TController>;
|
||||
controller?: string | Injectable<IControllerConstructor>;
|
||||
controllerAs?: string;
|
||||
/**
|
||||
@@ -2109,7 +2112,7 @@ declare namespace angular {
|
||||
* relies upon bindings inside a $onInit method on the controller, instead.
|
||||
*/
|
||||
bindToController?: boolean | {[boundProperty: string]: string};
|
||||
link?: IDirectiveLinkFn<TScope> | IDirectivePrePost<TScope>;
|
||||
link?: IDirectiveLinkFn<TScope, TElement, TAttributes, TController> | IDirectivePrePost<TScope, TElement, TAttributes, TController>;
|
||||
multiElement?: boolean;
|
||||
priority?: number;
|
||||
/**
|
||||
@@ -2119,9 +2122,9 @@ declare namespace angular {
|
||||
require?: string | string[] | {[controller: string]: string};
|
||||
restrict?: string;
|
||||
scope?: boolean | {[boundProperty: string]: string};
|
||||
template?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
|
||||
template?: string | ((tElement: TElement, tAttrs: TAttributes) => string);
|
||||
templateNamespace?: string;
|
||||
templateUrl?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
|
||||
templateUrl?: string | ((tElement: TElement, tAttrs: TAttributes) => string);
|
||||
terminal?: boolean;
|
||||
transclude?: boolean | 'element' | {[slot: string]: string};
|
||||
}
|
||||
|
||||
Vendored
+6
-2
@@ -774,6 +774,7 @@ interface BaseJQueryEventObject extends Event {
|
||||
pageY: number;
|
||||
/**
|
||||
* For key or mouse events, this property indicates the specific key or button that was pressed.
|
||||
* @deprecated Use `key` for KeyEvents or `button` for MouseEvents instead.
|
||||
* @see {@link https://api.jquery.com/event.which/}
|
||||
*/
|
||||
which: number;
|
||||
@@ -804,9 +805,12 @@ interface JQueryMouseEventObject extends JQueryInputEventObject {
|
||||
}
|
||||
|
||||
interface JQueryKeyEventObject extends JQueryInputEventObject {
|
||||
char: any;
|
||||
/** @deprecated */
|
||||
char: string;
|
||||
/** @deprecated */
|
||||
charCode: number;
|
||||
key: any;
|
||||
key: string;
|
||||
/** @deprecated */
|
||||
keyCode: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,8 +94,6 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function bind() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -104,14 +102,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -120,14 +110,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', false);
|
||||
|
||||
@@ -139,12 +121,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -164,27 +140,15 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function off() {
|
||||
function defaultContext_defaultData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
function defaultData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
|
||||
function defaultContext_customData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
|
||||
function customContext_defaultData(this: I1, event: JQueryEventObject) { }
|
||||
|
||||
function customContext_customData(this: I1, event: JQueryEventObject) { }
|
||||
|
||||
interface I1 { kind: 'I1'; }
|
||||
function customData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', defaultContext_defaultData);
|
||||
$('table').off('myEvent', 'td', defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', defaultContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', customContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', customContext_customData);
|
||||
$('table').off('myEvent', 'td', customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', false);
|
||||
@@ -193,16 +157,10 @@ function JQuery() {
|
||||
$('table').off('myEvent', 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', defaultContext_defaultData);
|
||||
$('table').off('myEvent', defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', defaultContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', customContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', customContext_customData);
|
||||
$('table').off('myEvent', customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', false);
|
||||
@@ -213,19 +171,15 @@ function JQuery() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1: false,
|
||||
defaultContext_defaultData,
|
||||
defaultContext_customData,
|
||||
customContext_defaultData,
|
||||
customContext_customData
|
||||
defaultData,
|
||||
customData
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1: false,
|
||||
defaultContext_defaultData,
|
||||
defaultContext_customData,
|
||||
customContext_defaultData,
|
||||
customContext_customData
|
||||
defaultData,
|
||||
customData
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
@@ -236,8 +190,6 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function on() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -246,14 +198,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -262,14 +206,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -278,14 +214,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', false);
|
||||
|
||||
@@ -297,14 +225,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 3, function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -313,14 +233,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', false);
|
||||
|
||||
@@ -332,12 +244,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, 'td', 'myData');
|
||||
|
||||
@@ -349,12 +255,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, null, 'myData');
|
||||
|
||||
@@ -366,12 +266,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
}, 'td');
|
||||
|
||||
@@ -383,12 +277,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
}
|
||||
}, 3);
|
||||
|
||||
@@ -400,19 +288,11 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function one() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -421,14 +301,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', null, 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -437,14 +309,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', null, 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -453,14 +317,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', false);
|
||||
|
||||
@@ -472,14 +328,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 3, function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -488,14 +336,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', false);
|
||||
|
||||
@@ -507,12 +347,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, 'td', 'myData');
|
||||
|
||||
@@ -524,12 +358,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, null, 'myData');
|
||||
|
||||
@@ -541,12 +369,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
}, 'td');
|
||||
|
||||
@@ -558,12 +380,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
}
|
||||
}, 3);
|
||||
|
||||
@@ -575,12 +391,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@@ -1,30 +1,35 @@
|
||||
import * as colors from 'ansi-colors';
|
||||
import colors = require('ansi-colors');
|
||||
|
||||
let s: string;
|
||||
colors.red('This is a red string!'); // $ExpectType string
|
||||
colors.green('This is a red string!'); // $ExpectType string
|
||||
colors.cyan('This is a cyan string!'); // $ExpectType string
|
||||
colors.yellow('This is a yellow string!'); // $ExpectType string
|
||||
|
||||
s = colors.bgblack("hello");
|
||||
s = colors.bgblue("hello");
|
||||
s = colors.bgcyan("hello");
|
||||
s = colors.bggreen("hello");
|
||||
s = colors.bgmagenta("hello");
|
||||
s = colors.bgred("hello");
|
||||
s = colors.bgwhite("hello");
|
||||
s = colors.bgyellow("hello");
|
||||
s = colors.black("hello");
|
||||
s = colors.blue("hello");
|
||||
s = colors.bold("hello");
|
||||
s = colors.cyan("hello");
|
||||
s = colors.dim("hello");
|
||||
s = colors.gray("hello");
|
||||
s = colors.green("hello");
|
||||
s = colors.grey("hello");
|
||||
s = colors.hidden("hello");
|
||||
s = colors.inverse("hello");
|
||||
s = colors.italic("hello");
|
||||
s = colors.magenta("hello");
|
||||
s = colors.red("hello");
|
||||
s = colors.reset("hello");
|
||||
s = colors.strikethrough("hello");
|
||||
s = colors.underline("hello");
|
||||
s = colors.white("hello");
|
||||
s = colors.yellow("hello");
|
||||
colors.bold.red('this is a bold red message'); // $ExpectType string
|
||||
colors.bold.yellow.italic('this is a bold yellow italicized message'); // $ExpectType string
|
||||
colors.green.bold.underline('this is a bold green underlined message'); // $ExpectType string
|
||||
|
||||
colors.yellow(`foo ${colors.red.bold('red')} bar ${colors.cyan('cyan')} baz`); // $ExpectType string
|
||||
colors.bold(`foo ${colors.red.dim('bar')} baz`); // $ExpectType string
|
||||
|
||||
colors.enabled = false;
|
||||
colors.visible = false;
|
||||
|
||||
colors.hasAnsi(colors.blue('foo')); // $ExpectType boolean
|
||||
colors.hasColor(colors.blue('foo')); // $ExpectType boolean
|
||||
|
||||
colors.unstyle(colors.blue.bold('foo bar baz')); // $ExpectType string
|
||||
colors.stripColor(colors.blue.bold('foo bar baz')); // $ExpectType string
|
||||
|
||||
colors.none('foo'); // $ExpectType string
|
||||
colors.clear('foo'); // $ExpectType string
|
||||
colors.noop('foo'); // $ExpectType string
|
||||
|
||||
colors.define('reset', [0, 0], 'modifier');
|
||||
|
||||
colors.symbols.ballotCross; // $ExpectType string | undefined
|
||||
colors.symbols.windows.ballotCross; // $ExpectError
|
||||
colors.symbols.other.ballotCross; // $ExpectType string
|
||||
colors.symbols.cross; // $ExpectType string
|
||||
colors.symbols.windows.cross; // $ExpectType string
|
||||
colors.symbols.other.cross; // $ExpectType string
|
||||
|
||||
Vendored
+107
-27
@@ -1,31 +1,111 @@
|
||||
// Type definitions for ansi-colors 1.0
|
||||
// Type definitions for ansi-colors 3.2
|
||||
// Project: https://github.com/doowb/ansi-colors
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export function bgblack(s: string): string;
|
||||
export function bgblue(s: string): string;
|
||||
export function bgcyan(s: string): string;
|
||||
export function bggreen(s: string): string;
|
||||
export function bgmagenta(s: string): string;
|
||||
export function bgred(s: string): string;
|
||||
export function bgwhite(s: string): string;
|
||||
export function bgyellow(s: string): string;
|
||||
export function black(s: string): string;
|
||||
export function blue(s: string): string;
|
||||
export function bold(s: string): string;
|
||||
export function cyan(s: string): string;
|
||||
export function dim(s: string): string;
|
||||
export function gray(s: string): string;
|
||||
export function green(s: string): string;
|
||||
export function grey(s: string): string;
|
||||
export function hidden(s: string): string;
|
||||
export function inverse(s: string): string;
|
||||
export function italic(s: string): string;
|
||||
export function magenta(s: string): string;
|
||||
export function red(s: string): string;
|
||||
export function reset(s: string): string;
|
||||
export function strikethrough(s: string): string;
|
||||
export function underline(s: string): string;
|
||||
export function white(s: string): string;
|
||||
export function yellow(s: string): string;
|
||||
export = colors;
|
||||
|
||||
declare const colors: colors.Colors;
|
||||
|
||||
declare namespace colors {
|
||||
type ColorFn = ((text: string) => string) & Colors;
|
||||
|
||||
interface Colors {
|
||||
enabled: boolean;
|
||||
visible: boolean;
|
||||
|
||||
reset: ColorFn;
|
||||
bold: ColorFn;
|
||||
dim: ColorFn;
|
||||
italic: ColorFn;
|
||||
underline: ColorFn;
|
||||
inverse: ColorFn;
|
||||
hidden: ColorFn;
|
||||
strikethrough: ColorFn;
|
||||
|
||||
black: ColorFn;
|
||||
red: ColorFn;
|
||||
green: ColorFn;
|
||||
yellow: ColorFn;
|
||||
blue: ColorFn;
|
||||
magenta: ColorFn;
|
||||
cyan: ColorFn;
|
||||
white: ColorFn;
|
||||
gray: ColorFn;
|
||||
grey: ColorFn;
|
||||
|
||||
bgBlack: ColorFn;
|
||||
bgRed: ColorFn;
|
||||
bgGreen: ColorFn;
|
||||
bgYellow: ColorFn;
|
||||
bgBlue: ColorFn;
|
||||
bgMagenta: ColorFn;
|
||||
bgCyan: ColorFn;
|
||||
bgWhite: ColorFn;
|
||||
|
||||
blackBright: ColorFn;
|
||||
redBright: ColorFn;
|
||||
greenBright: ColorFn;
|
||||
yellowBright: ColorFn;
|
||||
blueBright: ColorFn;
|
||||
magentaBright: ColorFn;
|
||||
cyanBright: ColorFn;
|
||||
whiteBright: ColorFn;
|
||||
|
||||
bgBlackBright: ColorFn;
|
||||
bgRedBright: ColorFn;
|
||||
bgGreenBright: ColorFn;
|
||||
bgYellowBright: ColorFn;
|
||||
bgBlueBright: ColorFn;
|
||||
bgMagentaBright: ColorFn;
|
||||
bgCyanBright: ColorFn;
|
||||
bgWhiteBright: ColorFn;
|
||||
|
||||
hasColor(text: string): boolean;
|
||||
hasAnsi(text: string): boolean;
|
||||
unstyle(text: string): string;
|
||||
stripColor(text: string): string;
|
||||
none(text: string): string;
|
||||
clear(text: string): string;
|
||||
noop(text: string): string;
|
||||
|
||||
symbols: Symbols & {
|
||||
windows: WindowsSymbols;
|
||||
other: OtherPlatformsSymbols;
|
||||
};
|
||||
|
||||
define(
|
||||
name: string,
|
||||
codes: [number, number],
|
||||
type: 'modifier' | 'color' | 'bg' | 'bright' | 'bgBright'
|
||||
): void;
|
||||
}
|
||||
|
||||
interface WindowsSymbols {
|
||||
bullet: string;
|
||||
check: string;
|
||||
cross: string;
|
||||
ellipsis: string;
|
||||
heart: string;
|
||||
info: string;
|
||||
line: string;
|
||||
middot: string;
|
||||
minus: string;
|
||||
plus: string;
|
||||
question: string;
|
||||
questionSmall: string;
|
||||
pointer: string;
|
||||
pointerSmall: string;
|
||||
warning: string;
|
||||
}
|
||||
|
||||
interface ExtendedSymbols {
|
||||
ballotCross: string;
|
||||
questionFull: string;
|
||||
}
|
||||
|
||||
type Symbols = WindowsSymbols & Partial<ExtendedSymbols>;
|
||||
type OtherPlatformsSymbols = WindowsSymbols & ExtendedSymbols;
|
||||
}
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"ansi-colors-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import * as colors from 'ansi-colors';
|
||||
|
||||
let s: string;
|
||||
|
||||
s = colors.bgblack("hello");
|
||||
s = colors.bgblue("hello");
|
||||
s = colors.bgcyan("hello");
|
||||
s = colors.bggreen("hello");
|
||||
s = colors.bgmagenta("hello");
|
||||
s = colors.bgred("hello");
|
||||
s = colors.bgwhite("hello");
|
||||
s = colors.bgyellow("hello");
|
||||
s = colors.black("hello");
|
||||
s = colors.blue("hello");
|
||||
s = colors.bold("hello");
|
||||
s = colors.cyan("hello");
|
||||
s = colors.dim("hello");
|
||||
s = colors.gray("hello");
|
||||
s = colors.green("hello");
|
||||
s = colors.grey("hello");
|
||||
s = colors.hidden("hello");
|
||||
s = colors.inverse("hello");
|
||||
s = colors.italic("hello");
|
||||
s = colors.magenta("hello");
|
||||
s = colors.red("hello");
|
||||
s = colors.reset("hello");
|
||||
s = colors.strikethrough("hello");
|
||||
s = colors.underline("hello");
|
||||
s = colors.white("hello");
|
||||
s = colors.yellow("hello");
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for ansi-colors 1.0
|
||||
// Project: https://github.com/doowb/ansi-colors
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function bgblack(s: string): string;
|
||||
export function bgblue(s: string): string;
|
||||
export function bgcyan(s: string): string;
|
||||
export function bggreen(s: string): string;
|
||||
export function bgmagenta(s: string): string;
|
||||
export function bgred(s: string): string;
|
||||
export function bgwhite(s: string): string;
|
||||
export function bgyellow(s: string): string;
|
||||
export function black(s: string): string;
|
||||
export function blue(s: string): string;
|
||||
export function bold(s: string): string;
|
||||
export function cyan(s: string): string;
|
||||
export function dim(s: string): string;
|
||||
export function gray(s: string): string;
|
||||
export function green(s: string): string;
|
||||
export function grey(s: string): string;
|
||||
export function hidden(s: string): string;
|
||||
export function inverse(s: string): string;
|
||||
export function italic(s: string): string;
|
||||
export function magenta(s: string): string;
|
||||
export function red(s: string): string;
|
||||
export function reset(s: string): string;
|
||||
export function strikethrough(s: string): string;
|
||||
export function underline(s: string): string;
|
||||
export function white(s: string): string;
|
||||
export function yellow(s: string): string;
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"ansi-colors": [
|
||||
"ansi-colors/v1"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ansi-colors-tests.ts"
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user