From 9cc1b19ab0ff0c5c06f9af38b9f6fdabc5e38429 Mon Sep 17 00:00:00 2001 From: "U-SWRI16\\svogel" Date: Fri, 27 Oct 2017 19:38:55 -0500 Subject: [PATCH 001/269] Adding props export to all elements. --- types/reactstrap/index.d.ts | 152 +++++++++--------- types/reactstrap/lib/Alert.d.ts | 7 +- types/reactstrap/lib/Badge.d.ts | 5 +- types/reactstrap/lib/Breadcrumb.d.ts | 5 +- types/reactstrap/lib/BreadcrumbItem.d.ts | 6 +- types/reactstrap/lib/Button.d.ts | 5 +- types/reactstrap/lib/ButtonDropdown.d.ts | 12 +- types/reactstrap/lib/ButtonGroup.d.ts | 5 +- types/reactstrap/lib/ButtonToolbar.d.ts | 5 +- types/reactstrap/lib/Card.d.ts | 6 +- types/reactstrap/lib/CardBlock.d.ts | 6 +- types/reactstrap/lib/CardBody.d.ts | 5 +- types/reactstrap/lib/CardColumns.d.ts | 5 +- types/reactstrap/lib/CardDeck.d.ts | 5 +- types/reactstrap/lib/CardFooter.d.ts | 5 +- types/reactstrap/lib/CardGroup.d.ts | 5 +- types/reactstrap/lib/CardHeader.d.ts | 5 +- types/reactstrap/lib/CardImg.d.ts | 5 +- types/reactstrap/lib/CardImgOverlay.d.ts | 5 +- types/reactstrap/lib/CardLink.d.ts | 5 +- types/reactstrap/lib/CardSubtitle.d.ts | 5 +- types/reactstrap/lib/CardText.d.ts | 5 +- types/reactstrap/lib/CardTitle.d.ts | 5 +- types/reactstrap/lib/Col.d.ts | 5 +- types/reactstrap/lib/Collapse.d.ts | 5 +- types/reactstrap/lib/Container.d.ts | 5 +- types/reactstrap/lib/Dropdown.d.ts | 7 +- types/reactstrap/lib/DropdownItem.d.ts | 5 +- types/reactstrap/lib/DropdownMenu.d.ts | 5 +- types/reactstrap/lib/DropdownToggle.d.ts | 5 +- types/reactstrap/lib/Fade.d.ts | 5 +- types/reactstrap/lib/Form.d.ts | 5 +- types/reactstrap/lib/FormFeedback.d.ts | 5 +- types/reactstrap/lib/FormGroup.d.ts | 5 +- types/reactstrap/lib/FormText.d.ts | 5 +- types/reactstrap/lib/Input.d.ts | 5 +- types/reactstrap/lib/InputGroup.d.ts | 5 +- types/reactstrap/lib/InputGroupAddon.d.ts | 5 +- types/reactstrap/lib/InputGroupButton.d.ts | 5 +- types/reactstrap/lib/Jumbotron.d.ts | 5 +- types/reactstrap/lib/Label.d.ts | 5 +- types/reactstrap/lib/ListGroup.d.ts | 5 +- types/reactstrap/lib/ListGroupItem.d.ts | 7 +- .../reactstrap/lib/ListGroupItemHeading.d.ts | 5 +- types/reactstrap/lib/ListGroupItemText.d.ts | 5 +- types/reactstrap/lib/Media.d.ts | 5 +- types/reactstrap/lib/Modal.d.ts | 5 +- types/reactstrap/lib/ModalBody.d.ts | 5 +- types/reactstrap/lib/ModalFooter.d.ts | 5 +- types/reactstrap/lib/ModalHeader.d.ts | 5 +- types/reactstrap/lib/Nav.d.ts | 5 +- types/reactstrap/lib/NavDropdown.d.ts | 12 +- types/reactstrap/lib/NavItem.d.ts | 5 +- types/reactstrap/lib/NavLink.d.ts | 5 +- types/reactstrap/lib/Navbar.d.ts | 5 +- types/reactstrap/lib/NavbarBrand.d.ts | 5 +- types/reactstrap/lib/NavbarToggler.d.ts | 5 +- types/reactstrap/lib/Pagination.d.ts | 5 +- types/reactstrap/lib/PaginationItem.d.ts | 5 +- types/reactstrap/lib/PaginationLink.d.ts | 5 +- types/reactstrap/lib/Popover.d.ts | 5 +- types/reactstrap/lib/PopoverContent.d.ts | 5 +- types/reactstrap/lib/PopoverTitle.d.ts | 5 +- types/reactstrap/lib/Progress.d.ts | 5 +- types/reactstrap/lib/Row.d.ts | 5 +- types/reactstrap/lib/TabContent.d.ts | 5 +- types/reactstrap/lib/TabPane.d.ts | 5 +- types/reactstrap/lib/Table.d.ts | 5 +- types/reactstrap/lib/Tag.d.ts | 5 +- types/reactstrap/lib/TetherContent.d.ts | 5 +- types/reactstrap/lib/Tooltip.d.ts | 9 +- types/reactstrap/lib/Uncontrolled.d.ts | 42 ++--- 72 files changed, 238 insertions(+), 333 deletions(-) diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index 81d4cec5bd..f653585c8f 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -8,80 +8,78 @@ export interface CSSModule { [className: string]: string; } -export { default as Alert } from './lib/Alert'; -export { default as Badge } from './lib/Badge'; -export { default as Breadcrumb } from './lib/Breadcrumb'; -export { default as BreadcrumbItem } from './lib/BreadcrumbItem'; -export { default as Button } from './lib/Button'; -export { default as ButtonDropdown } from './lib/ButtonDropdown'; -export { default as ButtonGroup } from './lib/ButtonGroup'; -export { default as ButtonToolbar } from './lib/ButtonToolbar'; -export { default as Card } from './lib/Card'; -export { default as CardBody } from './lib/CardBody'; -export { default as CardBlock } from './lib/CardBlock'; -export { default as CardColumns } from './lib/CardColumns'; -export { default as CardDeck } from './lib/CardDeck'; -export { default as CardFooter } from './lib/CardFooter'; -export { default as CardGroup } from './lib/CardGroup'; -export { default as CardHeader } from './lib/CardHeader'; -export { default as CardImg } from './lib/CardImg'; -export { default as CardImgOverlay } from './lib/CardImgOverlay'; -export { default as CardLink } from './lib/CardLink'; -export { default as CardSubtitle } from './lib/CardSubtitle'; -export { default as CardText } from './lib/CardText'; -export { default as CardTitle } from './lib/CardTitle'; -export { default as Col } from './lib/Col'; -export { default as Collapse } from './lib/Collapse'; -export { default as Container } from './lib/Container'; -export { default as Dropdown } from './lib/Dropdown'; -export { default as DropdownItem } from './lib/DropdownItem'; -export { default as DropdownMenu } from './lib/DropdownMenu'; -export { default as DropdownToggle } from './lib/DropdownToggle'; -export { default as Fade } from './lib/Fade'; -export { default as Form } from './lib/Form'; -export { default as FormFeedback } from './lib/FormFeedback'; -export { default as FormGroup } from './lib/FormGroup'; -export { default as FormText } from './lib/FormText'; -export { default as Input } from './lib/Input'; -export { default as InputGroup } from './lib/InputGroup'; -export { default as InputGroupAddon } from './lib/InputGroupAddon'; -export { default as InputGroupButton } from './lib/InputGroupButton'; -export { default as Jumbotron } from './lib/Jumbotron'; -export { default as Label } from './lib/Label'; -export { default as ListGroup } from './lib/ListGroup'; -export { default as ListGroupItem } from './lib/ListGroupItem'; -export { default as ListGroupItemHeading } from './lib/ListGroupItemHeading'; -export { default as ListGroupItemText } from './lib/ListGroupItemText'; -export { default as Media } from './lib/Media'; -export { default as Modal } from './lib/Modal'; -export { default as ModalBody } from './lib/ModalBody'; -export { default as ModalFooter } from './lib/ModalFooter'; -export { default as ModalHeader } from './lib/ModalHeader'; -export { default as Nav } from './lib/Nav'; -export { default as Navbar } from './lib/Navbar'; -export { default as NavbarBrand } from './lib/NavbarBrand'; -export { default as NavbarToggler } from './lib/NavbarToggler'; -export { default as NavDropdown } from './lib/NavDropdown'; -export { default as NavItem } from './lib/NavItem'; -export { default as NavLink } from './lib/NavLink'; -export { default as Pagination } from './lib/Pagination'; -export { default as PaginationItem } from './lib/PaginationItem'; -export { default as PaginationLink } from './lib/PaginationLink'; -export { default as Popover } from './lib/Popover'; -export { default as PopoverContent } from './lib/PopoverContent'; -export { default as PopoverTitle } from './lib/PopoverTitle'; -export { default as Progress } from './lib/Progress'; -export { default as Row } from './lib/Row'; -export { default as TabContent } from './lib/TabContent'; -export { default as Table } from './lib/Table'; -export { default as TabPane } from './lib/TabPane'; -export { default as Tag } from './lib/Tag'; -export { default as TetherContent } from './lib/TetherContent'; -export { default as Tooltip } from './lib/Tooltip'; -export { - UncontrolledAlert, - UncontrolledButtonDropdown, - UncontrolledDropdown, - UncontrolledNavDropdown, - UncontrolledTooltip -} from './lib/Uncontrolled'; +export { Alert, AlertProps } from './lib/Alert'; +export { Badge, BadgeProps } from './lib/Badge'; +export { Breadcrumb, BreadcrumbProps } from './lib/Breadcrumb'; +export { BreadcrumbItem, BreadcrumbItemProps } from './lib/BreadcrumbItem'; +export { Button, ButtonProps } from './lib/Button'; +export { ButtonDropdown, ButtonDropdownProps } from './lib/ButtonDropdown'; +export { ButtonGroup, ButtonGroupProps } from './lib/ButtonGroup'; +export { ButtonToolbar, ButtonToolbarProps } from './lib/ButtonToolbar'; +export { Card, CardProps } from './lib/Card'; +export { CardBody, CardBodyProps } from './lib/CardBody'; +export { CardBlock, CardBlockProps } from './lib/CardBlock'; +export { CardColumns, CardColumnsProps } from './lib/CardColumns'; +export { CardDeck, CardDeckProps } from './lib/CardDeck'; +export { CardFooter, CardFooterProps } from './lib/CardFooter'; +export { CardGroup, CardGroupProps } from './lib/CardGroup'; +export { CardHeader, CardHeaderProps } from './lib/CardHeader'; +export { CardImg, CardImgProps } from './lib/CardImg'; +export { CardImgOverlay, CardImgOverlayProps } from './lib/CardImgOverlay'; +export { CardLink, CardLinkProps } from './lib/CardLink'; +export { CardSubtitle, CardSubtitleProps } from './lib/CardSubtitle'; +export { CardText, CardTextProps } from './lib/CardText'; +export { CardTitle, CardTitleProps } from './lib/CardTitle'; +export { Col, ColProps } from './lib/Col'; +export { Collapse, CollapseProps } from './lib/Collapse'; +export { Container, ContainerProps } from './lib/Container'; +export { Dropdown, DropdownProps } from './lib/Dropdown'; +export { DropdownItem, DropdownItemProps } from './lib/DropdownItem'; +export { DropdownMenu, DropdownMenuProps } from './lib/DropdownMenu'; +export { DropdownToggle, DropdownToggleProps } from './lib/DropdownToggle'; +export { Fade, FadeProps } from './lib/Fade'; +export { Form, FormProps } from './lib/Form'; +export { FormFeedback, FormFeedbackProps } from './lib/FormFeedback'; +export { FormGroup, FormGroupProps } from './lib/FormGroup'; +export { FormText, FormTextProps } from './lib/FormText'; +export { Input, InputProps } from './lib/Input'; +export { InputGroup, InputGroupProps } from './lib/InputGroup'; +export { InputGroupAddon, InputGroupAddonProps } from './lib/InputGroupAddon'; +export { InputGroupButton, InputGroupButtonProps } from './lib/InputGroupButton'; +export { Jumbotron, JumbotronProps } from './lib/Jumbotron'; +export { Label, LabelProps } from './lib/Label'; +export { ListGroup, ListGroupProps } from './lib/ListGroup'; +export { ListGroupItem, ListGroupItemProps } from './lib/ListGroupItem'; +export { ListGroupItemHeading, ListGroupItemHeadingProps } from './lib/ListGroupItemHeading'; +export { ListGroupItemText, ListGroupItemTextProps } from './lib/ListGroupItemText'; +export { Media, MediaProps } from './lib/Media'; +export { Modal, ModalProps } from './lib/Modal'; +export { ModalBody, ModalBodyProps } from './lib/ModalBody'; +export { ModalFooter, ModalFooterProps } from './lib/ModalFooter'; +export { ModalHeader, ModalHeaderProps } from './lib/ModalHeader'; +export { Nav, NavProps } from './lib/Nav'; +export { Navbar, NavbarProps } from './lib/Navbar'; +export { NavbarBrand, NavbarBrandProps } from './lib/NavbarBrand'; +export { NavbarToggler, NavbarTogglerProps } from './lib/NavbarToggler'; +export { NavDropdown, NavDropdownProps } from './lib/NavDropdown'; +export { NavItem, NavItemProps } from './lib/NavItem'; +export { NavLink, NavLinkProps } from './lib/NavLink'; +export { Pagination, PaginationProps } from './lib/Pagination'; +export { PaginationItem, PaginationItemProps } from './lib/PaginationItem'; +export { PaginationLink, PaginationLinkProps } from './lib/PaginationLink'; +export { Popover, PopoverProps } from './lib/Popover'; +export { PopoverContent, PopoverContentProps } from './lib/PopoverContent'; +export { PopoverTitle, PopoverTitleProps } from './lib/PopoverTitle'; +export { Progress, ProgressProps } from './lib/Progress'; +export { Row, RowProps } from './lib/Row'; +export { TabContent, TabContentProps } from './lib/TabContent'; +export { Table, TableProps } from './lib/Table'; +export { TabPane, TabPaneProps } from './lib/TabPane'; +export { Tag, TagProps } from './lib/Tag'; +export { TetherContent, TetherContentProps } from './lib/TetherContent'; +export { Tooltip, TooltipProps } from './lib/Tooltip'; +export { UncontrolledAlert, UncontrolledAlertProps } from './lib/Uncontrolled'; +export { UncontrolledButtonDropdown, UncontrolledButtonDropdownProps } from './lib/Uncontrolled'; +export { UncontrolledDropdown, UncontrolledDropdownProps } from './lib/Uncontrolled'; +export { UncontrolledNavDropdown, UncontrolledNavDropdownProps } from './lib/Uncontrolled'; +export { UncontrolledTooltip, UncontrolledTooltipProps } from './lib/Uncontrolled'; diff --git a/types/reactstrap/lib/Alert.d.ts b/types/reactstrap/lib/Alert.d.ts index e29d62cb0d..1b4f6eb884 100644 --- a/types/reactstrap/lib/Alert.d.ts +++ b/types/reactstrap/lib/Alert.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface UncontrolledProps { +export interface UncontrolledAlertProps { className?: string; cssModule?: CSSModule; color?: string; @@ -10,10 +10,9 @@ export interface UncontrolledProps { transitionLeaveTimeout?: number; } -interface Props extends UncontrolledProps { +export interface AlertProps extends UncontrolledAlertProps { isOpen?: boolean; toggle?: () => void; } -declare var Alert: React.StatelessComponent; -export default Alert; +export const Alert: React.StatelessComponent; diff --git a/types/reactstrap/lib/Badge.d.ts b/types/reactstrap/lib/Badge.d.ts index 51f72e39d3..4c21dcac42 100644 --- a/types/reactstrap/lib/Badge.d.ts +++ b/types/reactstrap/lib/Badge.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface BadgeProps { color?: string; pill?: boolean; tag?: React.ReactType; @@ -8,5 +8,4 @@ interface Props { cssModule?: CSSModule; } -declare var Badge: React.StatelessComponent; -export default Badge; +export const Badge: React.StatelessComponent; diff --git a/types/reactstrap/lib/Breadcrumb.d.ts b/types/reactstrap/lib/Breadcrumb.d.ts index 54f581288c..26839e9140 100644 --- a/types/reactstrap/lib/Breadcrumb.d.ts +++ b/types/reactstrap/lib/Breadcrumb.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface BreadcrumbProps { tag?: string; className?: string; cssModule?: CSSModule; } -declare var Breadcrumb: React.StatelessComponent; -export default Breadcrumb; +export const Breadcrumb: React.StatelessComponent; diff --git a/types/reactstrap/lib/BreadcrumbItem.d.ts b/types/reactstrap/lib/BreadcrumbItem.d.ts index 0277305b21..d8deed883a 100644 --- a/types/reactstrap/lib/BreadcrumbItem.d.ts +++ b/types/reactstrap/lib/BreadcrumbItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface BreadcrumbItemProps { tag?: React.ReactType; active?: boolean; className?: string; @@ -10,6 +10,4 @@ interface Props { [others: string]: any; } -declare var BreadcrumbItem: React.StatelessComponent; -export default BreadcrumbItem; - +export const BreadcrumbItem: React.StatelessComponent; diff --git a/types/reactstrap/lib/Button.d.ts b/types/reactstrap/lib/Button.d.ts index e6ec222c14..e75c6f0b1c 100644 --- a/types/reactstrap/lib/Button.d.ts +++ b/types/reactstrap/lib/Button.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface ButtonProps extends React.HTMLProps { outline?: boolean; active?: boolean; block?: boolean; @@ -17,5 +17,4 @@ interface Props extends React.HTMLProps { cssModule?: CSSModule; } -declare var Button: React.StatelessComponent; -export default Button; +export const Button: React.StatelessComponent; diff --git a/types/reactstrap/lib/ButtonDropdown.d.ts b/types/reactstrap/lib/ButtonDropdown.d.ts index 9ab54c7502..bb26a03685 100644 --- a/types/reactstrap/lib/ButtonDropdown.d.ts +++ b/types/reactstrap/lib/ButtonDropdown.d.ts @@ -1,12 +1,8 @@ -import { - UncontrolledProps as DropdownUncontrolledProps, - Props as DropdownProps -} from './Dropdown'; +import { UncontrolledDropdownProps, DropdownProps } from './Dropdown'; // tslint:disable-next-line -export interface UncontrolledProps extends DropdownUncontrolledProps { } +export interface UncontrolledButtonDropdownProps extends UncontrolledDropdownProps { } // tslint:disable-next-line -interface Props extends DropdownProps { } +export interface ButtonDropdownProps extends DropdownProps { } -declare var ButtonDropdown: React.StatelessComponent; -export default ButtonDropdown; \ No newline at end of file +export const ButtonDropdown: React.StatelessComponent; diff --git a/types/reactstrap/lib/ButtonGroup.d.ts b/types/reactstrap/lib/ButtonGroup.d.ts index d807ea33cf..033c3075f9 100644 --- a/types/reactstrap/lib/ButtonGroup.d.ts +++ b/types/reactstrap/lib/ButtonGroup.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ButtonGroupProps { tag?: React.ReactType; 'aria-label'?: string; className?: string; @@ -10,5 +10,4 @@ interface Props { vertical?: boolean; } -declare var ButtonGroup: React.StatelessComponent; -export default ButtonGroup; +export const ButtonGroup: React.StatelessComponent; diff --git a/types/reactstrap/lib/ButtonToolbar.d.ts b/types/reactstrap/lib/ButtonToolbar.d.ts index fea31dd5d5..3e16b331c3 100644 --- a/types/reactstrap/lib/ButtonToolbar.d.ts +++ b/types/reactstrap/lib/ButtonToolbar.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ButtonToolbarProps { tag?: React.ReactType; 'aria-label'?: string; className?: string; @@ -8,5 +8,4 @@ interface Props { role?: string; } -declare var ButtonToolbar: React.StatelessComponent; -export default ButtonToolbar; +export const ButtonToolbar: React.StatelessComponent; diff --git a/types/reactstrap/lib/Card.d.ts b/types/reactstrap/lib/Card.d.ts index 0dbde7f879..f6d0d5e265 100644 --- a/types/reactstrap/lib/Card.d.ts +++ b/types/reactstrap/lib/Card.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardProps { tag?: React.ReactType; inverse?: boolean; color?: string; @@ -11,6 +11,4 @@ interface Props { style?: React.CSSProperties; } -declare var Card: React.StatelessComponent; -export default Card; - +export const Card: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardBlock.d.ts b/types/reactstrap/lib/CardBlock.d.ts index 0aa31a63a7..905884b786 100644 --- a/types/reactstrap/lib/CardBlock.d.ts +++ b/types/reactstrap/lib/CardBlock.d.ts @@ -1,11 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardBlockProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardBlock: React.StatelessComponent; -export default CardBlock; - +export const CardBlock: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardBody.d.ts b/types/reactstrap/lib/CardBody.d.ts index 2b94e52ea8..eeb9c8fe8d 100644 --- a/types/reactstrap/lib/CardBody.d.ts +++ b/types/reactstrap/lib/CardBody.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardBodyProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardBody: React.StatelessComponent; -export default CardBody; +export const CardBody: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardColumns.d.ts b/types/reactstrap/lib/CardColumns.d.ts index 0cc1a80a1a..e1d00fa389 100644 --- a/types/reactstrap/lib/CardColumns.d.ts +++ b/types/reactstrap/lib/CardColumns.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardColumnsProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardColumns: React.StatelessComponent; -export default CardColumns; +export const CardColumns: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardDeck.d.ts b/types/reactstrap/lib/CardDeck.d.ts index 1a5882aa54..15b3660f9d 100644 --- a/types/reactstrap/lib/CardDeck.d.ts +++ b/types/reactstrap/lib/CardDeck.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardDeckProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardDeck: React.StatelessComponent; -export default CardDeck; +export const CardDeck: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardFooter.d.ts b/types/reactstrap/lib/CardFooter.d.ts index 0956cb06c9..2b320c48b5 100644 --- a/types/reactstrap/lib/CardFooter.d.ts +++ b/types/reactstrap/lib/CardFooter.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardFooterProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardFooter: React.StatelessComponent; -export default CardFooter; +export const CardFooter: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardGroup.d.ts b/types/reactstrap/lib/CardGroup.d.ts index 5c0a0a1ab1..93fdd04bb0 100644 --- a/types/reactstrap/lib/CardGroup.d.ts +++ b/types/reactstrap/lib/CardGroup.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardGroupProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardGroup: React.StatelessComponent; -export default CardGroup; +export const CardGroup: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardHeader.d.ts b/types/reactstrap/lib/CardHeader.d.ts index f063057c92..d9d942c3d8 100644 --- a/types/reactstrap/lib/CardHeader.d.ts +++ b/types/reactstrap/lib/CardHeader.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardHeaderProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardHeader: React.StatelessComponent; -export default CardHeader; +export const CardHeader: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardImg.d.ts b/types/reactstrap/lib/CardImg.d.ts index 1c3fee274b..dd479691b5 100644 --- a/types/reactstrap/lib/CardImg.d.ts +++ b/types/reactstrap/lib/CardImg.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardImgProps { tag?: React.ReactType; top?: boolean; bottom?: boolean; @@ -12,5 +12,4 @@ interface Props { alt?: string; } -declare var CardImg: React.StatelessComponent; -export default CardImg; +export const CardImg: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardImgOverlay.d.ts b/types/reactstrap/lib/CardImgOverlay.d.ts index 05519847b2..22333a55c2 100644 --- a/types/reactstrap/lib/CardImgOverlay.d.ts +++ b/types/reactstrap/lib/CardImgOverlay.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardImgOverlayProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardImgOverlay: React.StatelessComponent; -export default CardImgOverlay; +export const CardImgOverlay: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardLink.d.ts b/types/reactstrap/lib/CardLink.d.ts index 3edf6b24f8..9afc204f96 100644 --- a/types/reactstrap/lib/CardLink.d.ts +++ b/types/reactstrap/lib/CardLink.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardLinkProps { tag?: React.ReactType; getRef?: string | ((instance: HTMLButtonElement) => any); className?: string; @@ -8,5 +8,4 @@ interface Props { href?: string; } -declare var CardLink: React.StatelessComponent; -export default CardLink; +export const CardLink: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardSubtitle.d.ts b/types/reactstrap/lib/CardSubtitle.d.ts index bfacd4e794..36e847367c 100644 --- a/types/reactstrap/lib/CardSubtitle.d.ts +++ b/types/reactstrap/lib/CardSubtitle.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardSubtitleProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardSubtitle: React.StatelessComponent; -export default CardSubtitle; +export const CardSubtitle: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardText.d.ts b/types/reactstrap/lib/CardText.d.ts index 13177fba67..297a561d50 100644 --- a/types/reactstrap/lib/CardText.d.ts +++ b/types/reactstrap/lib/CardText.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardTextProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardText: React.StatelessComponent; -export default CardText; +export const CardText: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardTitle.d.ts b/types/reactstrap/lib/CardTitle.d.ts index 2843800a4e..52b9556945 100644 --- a/types/reactstrap/lib/CardTitle.d.ts +++ b/types/reactstrap/lib/CardTitle.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardTitleProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardTitle: React.StatelessComponent; -export default CardTitle; +export const CardTitle: React.StatelessComponent; diff --git a/types/reactstrap/lib/Col.d.ts b/types/reactstrap/lib/Col.d.ts index a2ea76d607..cf2fd098fa 100644 --- a/types/reactstrap/lib/Col.d.ts +++ b/types/reactstrap/lib/Col.d.ts @@ -9,7 +9,7 @@ export type ColumnProps offset?: string | number }; -interface Props extends React.HTMLProps { +export interface ColProps extends React.HTMLProps { xs?: ColumnProps; sm?: ColumnProps; md?: ColumnProps; @@ -20,5 +20,4 @@ interface Props extends React.HTMLProps { widths?: string[]; } -declare var Col: React.StatelessComponent; -export default Col; +export const Col: React.StatelessComponent; diff --git a/types/reactstrap/lib/Collapse.d.ts b/types/reactstrap/lib/Collapse.d.ts index 50160bbcf6..5647bf68b3 100644 --- a/types/reactstrap/lib/Collapse.d.ts +++ b/types/reactstrap/lib/Collapse.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface CollapseProps extends React.HTMLProps { isOpen?: boolean; classNames?: string; cssModule?: CSSModule; @@ -14,5 +14,4 @@ interface Props extends React.HTMLProps { onClosed?: () => void; } -declare var Collapse: React.StatelessComponent; -export default Collapse; +export const Collapse: React.StatelessComponent; diff --git a/types/reactstrap/lib/Container.d.ts b/types/reactstrap/lib/Container.d.ts index f49951ba26..08d702af4b 100644 --- a/types/reactstrap/lib/Container.d.ts +++ b/types/reactstrap/lib/Container.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface ContainerProps { tag?: React.ReactType; fluid?: boolean; className?: string; cssModule?: CSSModule; } -declare var Container: React.StatelessComponent; -export default Container; +export const Container: React.StatelessComponent; diff --git a/types/reactstrap/lib/Dropdown.d.ts b/types/reactstrap/lib/Dropdown.d.ts index 19d1500cbe..fce1de08b1 100644 --- a/types/reactstrap/lib/Dropdown.d.ts +++ b/types/reactstrap/lib/Dropdown.d.ts @@ -2,14 +2,14 @@ import { CSSModule } from '../index'; -export interface UncontrolledProps { +export interface UncontrolledDropdownProps { isOpen?: boolean; toggle?: () => void; className?: string; cssModule?: CSSModule; } -export interface Props extends UncontrolledProps { +export interface DropdownProps extends UncontrolledDropdownProps { disabled?: boolean; dropup?: boolean; group?: boolean; @@ -18,5 +18,4 @@ export interface Props extends UncontrolledProps { tether?: boolean | Tether.ITetherOptions; } -declare var Dropdown: React.StatelessComponent; -export default Dropdown; +export const Dropdown: React.StatelessComponent; diff --git a/types/reactstrap/lib/DropdownItem.d.ts b/types/reactstrap/lib/DropdownItem.d.ts index 6fae837041..fe9a33cf8e 100644 --- a/types/reactstrap/lib/DropdownItem.d.ts +++ b/types/reactstrap/lib/DropdownItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface DropdownItemProps { disabled?: boolean; divider?: boolean; tag?: React.ReactType; @@ -11,5 +11,4 @@ interface Props { href?: string; } -declare var DropdownItem: React.StatelessComponent; -export default DropdownItem; +export const DropdownItem: React.StatelessComponent; diff --git a/types/reactstrap/lib/DropdownMenu.d.ts b/types/reactstrap/lib/DropdownMenu.d.ts index 7fae41b04b..e206ebd6d9 100644 --- a/types/reactstrap/lib/DropdownMenu.d.ts +++ b/types/reactstrap/lib/DropdownMenu.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface DropdownMenuProps { tag?: React.ReactType; right?: boolean; className?: string; cssModule?: CSSModule; } -declare var DropdownMenu: React.StatelessComponent; -export default DropdownMenu; +export const DropdownMenu: React.StatelessComponent; diff --git a/types/reactstrap/lib/DropdownToggle.d.ts b/types/reactstrap/lib/DropdownToggle.d.ts index 5ef49db71f..df1cb7f845 100644 --- a/types/reactstrap/lib/DropdownToggle.d.ts +++ b/types/reactstrap/lib/DropdownToggle.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface DropdownToggleProps { caret?: boolean; className?: string; cssModule?: CSSModule; @@ -15,5 +15,4 @@ interface Props { size?: string; } -declare var DropdownToggle: React.StatelessComponent; -export default DropdownToggle; +export const DropdownToggle: React.StatelessComponent; diff --git a/types/reactstrap/lib/Fade.d.ts b/types/reactstrap/lib/Fade.d.ts index 30862d2e17..2c13430af9 100644 --- a/types/reactstrap/lib/Fade.d.ts +++ b/types/reactstrap/lib/Fade.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface FadeProps { baseClass?: string; baseClassIn?: string; tag?: React.ReactType; @@ -16,5 +16,4 @@ interface Props { onEnter?: () => void; } -declare var Fade: React.StatelessComponent; -export default Fade; +export const Fade: React.StatelessComponent; diff --git a/types/reactstrap/lib/Form.d.ts b/types/reactstrap/lib/Form.d.ts index dd06a2f855..4481bd8912 100644 --- a/types/reactstrap/lib/Form.d.ts +++ b/types/reactstrap/lib/Form.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface FormProps extends React.HTMLProps { inline?: boolean; tag?: React.ReactType; getRef?: string | ((instance: HTMLButtonElement) => any); @@ -8,5 +8,4 @@ interface Props extends React.HTMLProps { cssModule?: CSSModule; } -declare var Form: React.StatelessComponent; -export default Form; +export const Form: React.StatelessComponent; diff --git a/types/reactstrap/lib/FormFeedback.d.ts b/types/reactstrap/lib/FormFeedback.d.ts index 7fde21b062..ac6f0f5003 100644 --- a/types/reactstrap/lib/FormFeedback.d.ts +++ b/types/reactstrap/lib/FormFeedback.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface FormFeedbackProps { tag?: string; className?: string; cssModule?: CSSModule; } -declare var FormFeedback: React.StatelessComponent; -export default FormFeedback; +export const FormFeedback: React.StatelessComponent; diff --git a/types/reactstrap/lib/FormGroup.d.ts b/types/reactstrap/lib/FormGroup.d.ts index 6031ff2f75..65c0da639b 100644 --- a/types/reactstrap/lib/FormGroup.d.ts +++ b/types/reactstrap/lib/FormGroup.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface FormGroupProps extends React.HTMLProps { row?: boolean; check?: boolean; disabled?: boolean; @@ -10,5 +10,4 @@ interface Props extends React.HTMLProps { cssModule?: CSSModule; } -declare var FormGroup: React.StatelessComponent; -export default FormGroup; +export const FormGroup: React.StatelessComponent; diff --git a/types/reactstrap/lib/FormText.d.ts b/types/reactstrap/lib/FormText.d.ts index 3cfab3511e..c8af8f56c8 100644 --- a/types/reactstrap/lib/FormText.d.ts +++ b/types/reactstrap/lib/FormText.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface FormTextProps { inline?: boolean; tag?: React.ReactType; color?: string; @@ -8,5 +8,4 @@ interface Props { cssModule?: CSSModule; } -declare var FormText: React.StatelessComponent; -export default FormText; +export const FormText: React.StatelessComponent; diff --git a/types/reactstrap/lib/Input.d.ts b/types/reactstrap/lib/Input.d.ts index 541016ca02..0029367c90 100644 --- a/types/reactstrap/lib/Input.d.ts +++ b/types/reactstrap/lib/Input.d.ts @@ -33,7 +33,7 @@ interface Intermediate extends React.InputHTMLAttributes { size?: any; } -interface InputProps extends Intermediate { +export interface InputProps extends Intermediate { type?: InputType; size?: string; state?: string; @@ -48,5 +48,4 @@ interface InputProps extends Intermediate { // Maybe reactstrap will support an 'isStatic' alias in the future } -declare var Input: React.StatelessComponent; -export default Input; +export const Input: React.StatelessComponent; diff --git a/types/reactstrap/lib/InputGroup.d.ts b/types/reactstrap/lib/InputGroup.d.ts index 2de95edc94..abd7fcd381 100644 --- a/types/reactstrap/lib/InputGroup.d.ts +++ b/types/reactstrap/lib/InputGroup.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface InputGroupProps { tag?: React.ReactType; size?: string; className?: string; cssModule?: CSSModule; } -declare var InputGroup: React.StatelessComponent; -export default InputGroup; +export const InputGroup: React.StatelessComponent; diff --git a/types/reactstrap/lib/InputGroupAddon.d.ts b/types/reactstrap/lib/InputGroupAddon.d.ts index a98eb5d821..7ddbc3b4c1 100644 --- a/types/reactstrap/lib/InputGroupAddon.d.ts +++ b/types/reactstrap/lib/InputGroupAddon.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface InputGroupAddonProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var InputGroupAddon: React.StatelessComponent; -export default InputGroupAddon; +export const InputGroupAddon: React.StatelessComponent; diff --git a/types/reactstrap/lib/InputGroupButton.d.ts b/types/reactstrap/lib/InputGroupButton.d.ts index fa7cb1995a..90a93ff8ed 100644 --- a/types/reactstrap/lib/InputGroupButton.d.ts +++ b/types/reactstrap/lib/InputGroupButton.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface InputGroupButtonProps { tag?: React.ReactType; groupClassName?: string; groupAttributes?: any; @@ -9,5 +9,4 @@ interface Props { color?: string; } -declare var InputGroupButton: React.StatelessComponent; -export default InputGroupButton; +export const InputGroupButton: React.StatelessComponent; diff --git a/types/reactstrap/lib/Jumbotron.d.ts b/types/reactstrap/lib/Jumbotron.d.ts index cc1f65c956..4ade1eabaa 100644 --- a/types/reactstrap/lib/Jumbotron.d.ts +++ b/types/reactstrap/lib/Jumbotron.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface JumbotronProps { tag?: React.ReactType; fluid?: boolean; className?: string; cssModule?: CSSModule; } -declare var Jumbotron: React.StatelessComponent; -export default Jumbotron; +export const Jumbotron: React.StatelessComponent; diff --git a/types/reactstrap/lib/Label.d.ts b/types/reactstrap/lib/Label.d.ts index eb496d90a3..3688aaf233 100644 --- a/types/reactstrap/lib/Label.d.ts +++ b/types/reactstrap/lib/Label.d.ts @@ -5,7 +5,7 @@ interface Intermediate extends React.LabelHTMLAttributes { size?: any; } -interface Props extends Intermediate { +export interface LabelProps extends Intermediate { hidden?: boolean; check?: boolean; inline?: boolean; @@ -22,5 +22,4 @@ interface Props extends Intermediate { xl?: ColumnProps; } -declare var Label: React.StatelessComponent; -export default Label; +export const Label: React.StatelessComponent; diff --git a/types/reactstrap/lib/ListGroup.d.ts b/types/reactstrap/lib/ListGroup.d.ts index 861c7a1d06..bef63da796 100644 --- a/types/reactstrap/lib/ListGroup.d.ts +++ b/types/reactstrap/lib/ListGroup.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface ListGroupProps { tag?: React.ReactType; flush?: boolean; className?: string; cssModule?: CSSModule; } -declare var ListGroup: React.StatelessComponent; -export default ListGroup; +export const ListGroup: React.StatelessComponent; diff --git a/types/reactstrap/lib/ListGroupItem.d.ts b/types/reactstrap/lib/ListGroupItem.d.ts index b2241998dc..44a70b6ec4 100644 --- a/types/reactstrap/lib/ListGroupItem.d.ts +++ b/types/reactstrap/lib/ListGroupItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ListGroupItemProps { tag?: React.ReactType; active?: boolean; disabled?: boolean; @@ -9,9 +9,8 @@ interface Props { className?: string; cssModule?: CSSModule; href?: string; - + onClick?: React.MouseEventHandler; } -declare var ListGroupItem: React.StatelessComponent; -export default ListGroupItem; +export const ListGroupItem: React.StatelessComponent; diff --git a/types/reactstrap/lib/ListGroupItemHeading.d.ts b/types/reactstrap/lib/ListGroupItemHeading.d.ts index 869a6b2708..f44317f541 100644 --- a/types/reactstrap/lib/ListGroupItemHeading.d.ts +++ b/types/reactstrap/lib/ListGroupItemHeading.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface ListGroupItemHeadingProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var ListGroupItemHeading: React.StatelessComponent; -export default ListGroupItemHeading; +export const ListGroupItemHeading: React.StatelessComponent; diff --git a/types/reactstrap/lib/ListGroupItemText.d.ts b/types/reactstrap/lib/ListGroupItemText.d.ts index df263f30d8..a19803e4fe 100644 --- a/types/reactstrap/lib/ListGroupItemText.d.ts +++ b/types/reactstrap/lib/ListGroupItemText.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface ListGroupItemTextProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var ListGroupItemText: React.StatelessComponent; -export default ListGroupItemText; +export const ListGroupItemText: React.StatelessComponent; diff --git a/types/reactstrap/lib/Media.d.ts b/types/reactstrap/lib/Media.d.ts index c5408d85d7..9276c0708f 100644 --- a/types/reactstrap/lib/Media.d.ts +++ b/types/reactstrap/lib/Media.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface MediaProps { body?: boolean; bottom?: boolean; className?: string; @@ -17,5 +17,4 @@ interface Props { alt?: string; } -declare var Media: React.StatelessComponent; -export default Media; +export const Media: React.StatelessComponent; diff --git a/types/reactstrap/lib/Modal.d.ts b/types/reactstrap/lib/Modal.d.ts index 1e239fbe12..eb7d2a0f15 100644 --- a/types/reactstrap/lib/Modal.d.ts +++ b/types/reactstrap/lib/Modal.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ModalProps { isOpen?: boolean; autoFocus?: boolean; size?: string; @@ -19,5 +19,4 @@ interface Props { fade?: boolean; } -declare var Modal: React.StatelessComponent; -export default Modal; +export const Modal: React.StatelessComponent; diff --git a/types/reactstrap/lib/ModalBody.d.ts b/types/reactstrap/lib/ModalBody.d.ts index 98933b2fc2..1238f7d54a 100644 --- a/types/reactstrap/lib/ModalBody.d.ts +++ b/types/reactstrap/lib/ModalBody.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface ModalBodyProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var ModalBody: React.StatelessComponent; -export default ModalBody; +export const ModalBody: React.StatelessComponent; diff --git a/types/reactstrap/lib/ModalFooter.d.ts b/types/reactstrap/lib/ModalFooter.d.ts index 84b3da7ec8..d7cafe275b 100644 --- a/types/reactstrap/lib/ModalFooter.d.ts +++ b/types/reactstrap/lib/ModalFooter.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface ModalFooterProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var ModalFooter: React.StatelessComponent; -export default ModalFooter; +export const ModalFooter: React.StatelessComponent; diff --git a/types/reactstrap/lib/ModalHeader.d.ts b/types/reactstrap/lib/ModalHeader.d.ts index 494c9685a3..5792fea0d1 100644 --- a/types/reactstrap/lib/ModalHeader.d.ts +++ b/types/reactstrap/lib/ModalHeader.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ModalHeaderProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; @@ -8,5 +8,4 @@ interface Props { toggle?: () => void; } -declare var ModalHeader: React.StatelessComponent; -export default ModalHeader; +export const ModalHeader: React.StatelessComponent; diff --git a/types/reactstrap/lib/Nav.d.ts b/types/reactstrap/lib/Nav.d.ts index c646e94304..e42556fadd 100644 --- a/types/reactstrap/lib/Nav.d.ts +++ b/types/reactstrap/lib/Nav.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface NavProps extends React.HTMLProps { inline?: boolean; disabled?: boolean; tabs?: boolean; @@ -13,5 +13,4 @@ interface Props extends React.HTMLProps { vertical?: boolean; } -declare var Nav: React.StatelessComponent; -export default Nav; +export const Nav: React.StatelessComponent; diff --git a/types/reactstrap/lib/NavDropdown.d.ts b/types/reactstrap/lib/NavDropdown.d.ts index 6b480d495a..dfa15afa17 100644 --- a/types/reactstrap/lib/NavDropdown.d.ts +++ b/types/reactstrap/lib/NavDropdown.d.ts @@ -1,12 +1,8 @@ -import { - UncontrolledProps as DropdownUncontrolledProps, - Props as DropdownProps -} from './Dropdown'; +import { UncontrolledDropdownProps, DropdownProps } from './Dropdown'; // tslint:disable-next-line -export interface UncontrolledProps extends DropdownUncontrolledProps { } +export interface UncontrolledNavDropdownProps extends UncontrolledDropdownProps { } // tslint:disable-next-line -interface Props extends DropdownProps { } +export interface NavDropdownProps extends DropdownProps { } -declare var NavDropdown: React.StatelessComponent; -export default NavDropdown; \ No newline at end of file +export const NavDropdown: React.StatelessComponent; diff --git a/types/reactstrap/lib/NavItem.d.ts b/types/reactstrap/lib/NavItem.d.ts index db19f92c56..8e6e7631d2 100644 --- a/types/reactstrap/lib/NavItem.d.ts +++ b/types/reactstrap/lib/NavItem.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface NavItemProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var NavItem: React.StatelessComponent; -export default NavItem; +export const NavItem: React.StatelessComponent; diff --git a/types/reactstrap/lib/NavLink.d.ts b/types/reactstrap/lib/NavLink.d.ts index 2871fad72e..13f5710551 100644 --- a/types/reactstrap/lib/NavLink.d.ts +++ b/types/reactstrap/lib/NavLink.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface NavLinkProps extends React.HTMLProps { tag?: React.ReactType; getRef?: string | ((instance: HTMLButtonElement) => any); disabled?: boolean; @@ -11,5 +11,4 @@ interface Props extends React.HTMLProps { href?: string; } -declare var NavLink: React.StatelessComponent; -export default NavLink; +export const NavLink: React.StatelessComponent; diff --git a/types/reactstrap/lib/Navbar.d.ts b/types/reactstrap/lib/Navbar.d.ts index 58f9235140..76616a7be2 100644 --- a/types/reactstrap/lib/Navbar.d.ts +++ b/types/reactstrap/lib/Navbar.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface NavbarProps { light?: boolean; dark?: boolean; inverse?: boolean; @@ -16,5 +16,4 @@ interface Props { expand?: boolean | string; } -declare var Navbar: React.StatelessComponent; -export default Navbar; +export const Navbar: React.StatelessComponent; diff --git a/types/reactstrap/lib/NavbarBrand.d.ts b/types/reactstrap/lib/NavbarBrand.d.ts index 3748a2903f..0aa80597b9 100644 --- a/types/reactstrap/lib/NavbarBrand.d.ts +++ b/types/reactstrap/lib/NavbarBrand.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface NavbarBrandProps extends React.HTMLProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var NavbarBrand: React.StatelessComponent; -export default NavbarBrand; +export const NavbarBrand: React.StatelessComponent; diff --git a/types/reactstrap/lib/NavbarToggler.d.ts b/types/reactstrap/lib/NavbarToggler.d.ts index 282eeaa672..5dd2df7057 100644 --- a/types/reactstrap/lib/NavbarToggler.d.ts +++ b/types/reactstrap/lib/NavbarToggler.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface NavbarTogglerProps extends React.HTMLProps { tag?: React.ReactType; type?: string; className?: string; @@ -9,5 +9,4 @@ interface Props extends React.HTMLProps { left?: boolean; } -declare var NavbarToggler: React.StatelessComponent; -export default NavbarToggler; +export const NavbarToggler: React.StatelessComponent; diff --git a/types/reactstrap/lib/Pagination.d.ts b/types/reactstrap/lib/Pagination.d.ts index a34401be35..3b19364c30 100644 --- a/types/reactstrap/lib/Pagination.d.ts +++ b/types/reactstrap/lib/Pagination.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface PaginationProps { className?: string; cssModule?: CSSModule; size?: string; } -declare var Pagination: React.StatelessComponent; -export default Pagination; +export const Pagination: React.StatelessComponent; diff --git a/types/reactstrap/lib/PaginationItem.d.ts b/types/reactstrap/lib/PaginationItem.d.ts index 183a7e9d84..3ed0400dcd 100644 --- a/types/reactstrap/lib/PaginationItem.d.ts +++ b/types/reactstrap/lib/PaginationItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface PaginationItemProps { className?: string; cssModule?: CSSModule; active?: boolean; @@ -8,5 +8,4 @@ interface Props { tag?: React.ReactType; } -declare var PaginationItem: React.StatelessComponent; -export default PaginationItem; +export const PaginationItem: React.StatelessComponent; diff --git a/types/reactstrap/lib/PaginationLink.d.ts b/types/reactstrap/lib/PaginationLink.d.ts index 16e194578d..5c2a1d5711 100644 --- a/types/reactstrap/lib/PaginationLink.d.ts +++ b/types/reactstrap/lib/PaginationLink.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface PaginationLinkProps extends React.HTMLProps { 'aria-label'?: string; className?: string; cssModule?: CSSModule; @@ -9,5 +9,4 @@ interface Props extends React.HTMLProps { tag?: React.ReactType; } -declare var PaginationLink: React.StatelessComponent; -export default PaginationLink; +export const PaginationLink: React.StatelessComponent; diff --git a/types/reactstrap/lib/Popover.d.ts b/types/reactstrap/lib/Popover.d.ts index b779a33ede..69fe27cb88 100644 --- a/types/reactstrap/lib/Popover.d.ts +++ b/types/reactstrap/lib/Popover.d.ts @@ -20,7 +20,7 @@ type Placement | 'left middle' | 'left bottom'; -interface Props { +export interface PopoverProps { placement?: Placement; target: string; isOpen?: boolean; @@ -30,5 +30,4 @@ interface Props { toggle?: () => void; } -declare var Popover: React.StatelessComponent; -export default Popover; +export const Popover: React.StatelessComponent; diff --git a/types/reactstrap/lib/PopoverContent.d.ts b/types/reactstrap/lib/PopoverContent.d.ts index cac45d14cb..a062d4d2c9 100644 --- a/types/reactstrap/lib/PopoverContent.d.ts +++ b/types/reactstrap/lib/PopoverContent.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface PopoverContentProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var PopoverContent: React.StatelessComponent; -export default PopoverContent; +export const PopoverContent: React.StatelessComponent; diff --git a/types/reactstrap/lib/PopoverTitle.d.ts b/types/reactstrap/lib/PopoverTitle.d.ts index 796de02658..e21bdd1729 100644 --- a/types/reactstrap/lib/PopoverTitle.d.ts +++ b/types/reactstrap/lib/PopoverTitle.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface PopoverTitleProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var PopoverTitle: React.StatelessComponent; -export default PopoverTitle; +export const PopoverTitle: React.StatelessComponent; diff --git a/types/reactstrap/lib/Progress.d.ts b/types/reactstrap/lib/Progress.d.ts index 09c4304373..5f67befa37 100644 --- a/types/reactstrap/lib/Progress.d.ts +++ b/types/reactstrap/lib/Progress.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ProgressProps { bar?: boolean; multi?: boolean; tag?: string; @@ -14,5 +14,4 @@ interface Props { barClassName?: string; } -declare var Progress: React.StatelessComponent; -export default Progress; +export const Progress: React.StatelessComponent; diff --git a/types/reactstrap/lib/Row.d.ts b/types/reactstrap/lib/Row.d.ts index 1ffbb9f7e6..5a57601a0a 100644 --- a/types/reactstrap/lib/Row.d.ts +++ b/types/reactstrap/lib/Row.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps< HTMLElement> { +export interface RowProps extends React.HTMLProps< HTMLElement> { className?: string; cssModule?: CSSModule; tag?: React.ReactType; noGutters?: boolean; } -declare var Row: React.StatelessComponent; -export default Row; +export const Row: React.StatelessComponent; diff --git a/types/reactstrap/lib/TabContent.d.ts b/types/reactstrap/lib/TabContent.d.ts index af6feec078..5a8654ded9 100644 --- a/types/reactstrap/lib/TabContent.d.ts +++ b/types/reactstrap/lib/TabContent.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface TabContentProps { tag?: React.ReactType; activeTab?: number | string; className?: string; cssModule?: CSSModule; } -declare var TabContent: React.StatelessComponent; -export default TabContent; +export const TabContent: React.StatelessComponent; diff --git a/types/reactstrap/lib/TabPane.d.ts b/types/reactstrap/lib/TabPane.d.ts index 9eead420be..c1c7c1f470 100644 --- a/types/reactstrap/lib/TabPane.d.ts +++ b/types/reactstrap/lib/TabPane.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface TabPaneProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; tabId?: number | string; } -declare var TabPane: React.StatelessComponent; -export default TabPane; +export const TabPane: React.StatelessComponent; diff --git a/types/reactstrap/lib/Table.d.ts b/types/reactstrap/lib/Table.d.ts index ec8bfc43fd..f65af70e60 100644 --- a/types/reactstrap/lib/Table.d.ts +++ b/types/reactstrap/lib/Table.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface TableProps { className?: string; cssModule?: CSSModule; size?: string; @@ -14,5 +14,4 @@ interface Props { responsiveTag?: React.ReactType; } -declare var Table: React.StatelessComponent; -export default Table; +export const Table: React.StatelessComponent; diff --git a/types/reactstrap/lib/Tag.d.ts b/types/reactstrap/lib/Tag.d.ts index 7dce8876f2..bbc94d2120 100644 --- a/types/reactstrap/lib/Tag.d.ts +++ b/types/reactstrap/lib/Tag.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface TagProps { color?: string; pill?: boolean; tag?: React.ReactType; @@ -8,5 +8,4 @@ interface Props { cssModule?: CSSModule; } -declare var Tag: React.StatelessComponent; -export default Tag; +export const Tag: React.StatelessComponent; diff --git a/types/reactstrap/lib/TetherContent.d.ts b/types/reactstrap/lib/TetherContent.d.ts index cbc22373e3..2ebe419ed5 100644 --- a/types/reactstrap/lib/TetherContent.d.ts +++ b/types/reactstrap/lib/TetherContent.d.ts @@ -2,7 +2,7 @@ import { CSSModule } from '../index'; -interface Props { +export interface TetherContentProps { className?: string; cssModule?: CSSModule; arrow?: string; @@ -14,5 +14,4 @@ interface Props { style?: React.CSSProperties; } -declare var TetherContent: React.StatelessComponent; -export default TetherContent; +export const TetherContent: React.StatelessComponent; diff --git a/types/reactstrap/lib/Tooltip.d.ts b/types/reactstrap/lib/Tooltip.d.ts index 9dba615084..9afa72f233 100644 --- a/types/reactstrap/lib/Tooltip.d.ts +++ b/types/reactstrap/lib/Tooltip.d.ts @@ -20,7 +20,7 @@ type Placement | 'left middle' | 'left bottom'; -export interface UncontrolledProps { +export interface UncontrolledTooltipProps { placement?: Placement; target: string; disabled?: boolean; @@ -32,12 +32,9 @@ export interface UncontrolledProps { delay?: number | { show: number, hide: number }; } -interface Props extends UncontrolledProps { +export interface TooltipProps extends UncontrolledTooltipProps { toggle?: () => void; isOpen?: boolean; } - - -declare var Tooltip: React.StatelessComponent; -export default Tooltip; +export const Tooltip: React.StatelessComponent; diff --git a/types/reactstrap/lib/Uncontrolled.d.ts b/types/reactstrap/lib/Uncontrolled.d.ts index 151ee012d3..b3b292dd6b 100644 --- a/types/reactstrap/lib/Uncontrolled.d.ts +++ b/types/reactstrap/lib/Uncontrolled.d.ts @@ -1,29 +1,17 @@ -import { - UncontrolledProps as AlertUncontrolledProps -} from './Alert'; -import { - UncontrolledProps as ButtonDropdownUncontrolledProps -} from './ButtonDropdown'; -import { - UncontrolledProps as DropdownUncontrolledProps -} from './Dropdown'; -import { - UncontrolledProps as NavDropdownUncontrolledProps -} from './NavDropdown'; -import { - UncontrolledProps as TooltipUncontrolledProps -} from './Tooltip'; +import { UncontrolledAlertProps } from './Alert'; +import { UncontrolledButtonDropdownProps } from './ButtonDropdown'; +import { UncontrolledDropdownProps } from './Dropdown'; +import { UncontrolledNavDropdownProps } from './NavDropdown'; +import { UncontrolledTooltipProps } from './Tooltip'; -declare var UncontrolledAlert: React.StatelessComponent; -declare var UncontrolledButtonDropdown: React.StatelessComponent; -declare var UncontrolledDropdown: React.StatelessComponent; -declare var UncontrolledNavDropdown: React.StatelessComponent; -declare var UncontrolledTooltip: React.StatelessComponent; +export const UncontrolledAlert: React.StatelessComponent; +export const UncontrolledButtonDropdown: React.StatelessComponent; +export const UncontrolledDropdown: React.StatelessComponent; +export const UncontrolledNavDropdown: React.StatelessComponent; +export const UncontrolledTooltip: React.StatelessComponent; -export { - UncontrolledAlert, - UncontrolledButtonDropdown, - UncontrolledDropdown, - UncontrolledNavDropdown, - UncontrolledTooltip -} \ No newline at end of file +export { UncontrolledAlertProps } from './Alert'; +export { UncontrolledButtonDropdownProps } from './ButtonDropdown'; +export { UncontrolledDropdownProps } from './Dropdown'; +export { UncontrolledNavDropdownProps } from './NavDropdown'; +export { UncontrolledTooltipProps } from './Tooltip'; From b5d2594134d86adaffde49413c5f555438938dce Mon Sep 17 00:00:00 2001 From: uniqueiniquity Date: Thu, 26 Oct 2017 13:57:02 -0700 Subject: [PATCH 002/269] Add fragment to top-level API --- types/react/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index b2dc6057cc..d9059d56f9 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -88,7 +88,7 @@ declare namespace React { } interface ReactElement

{ - type: string | ComponentClass

| SFC

; + type: string | symbol | number | ComponentClass

| SFC

; props: P; key: Key | null; } @@ -222,7 +222,7 @@ declare namespace React { props?: ClassAttributes & P, ...children: ReactNode[]): CElement; function createElement

( - type: SFC

| ComponentClass

| string, + type: SFC

| ComponentClass

| string | symbol | number, props?: Attributes & P, ...children: ReactNode[]): ReactElement

; @@ -265,6 +265,7 @@ declare namespace React { function isValidElement

(object: {} | null | undefined): object is ReactElement

; const Children: ReactChildren; + const Fragment: symbol | number; const version: string; // From f6904a2eab412089c494fd1382824c6e0919f5ec Mon Sep 17 00:00:00 2001 From: uniqueiniquity Date: Tue, 31 Oct 2017 08:50:40 -0700 Subject: [PATCH 003/269] Update test --- types/react/test/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react/test/index.ts b/types/react/test/index.ts index b9eea759e7..26ca339f2d 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -228,6 +228,7 @@ const notValid: boolean = React.isValidElement(props); // false const isValid = React.isValidElement(element); // true let domNode: Element = ReactDOM.findDOMNode(component); domNode = ReactDOM.findDOMNode(domNode); +const fragmentType: symbol | number = React.Fragment; // // React Elements From 4d07771b6c5ed5c3b75c7ee3e0d939557927403d Mon Sep 17 00:00:00 2001 From: uniqueiniquity Date: Tue, 31 Oct 2017 10:11:25 -0700 Subject: [PATCH 004/269] Add create fragment test --- types/react/test/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 26ca339f2d..e65909fc2d 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -164,6 +164,7 @@ const statelessElement: React.SFCElement = React.createElement(Stateles const domElement: React.DOMElement, HTMLDivElement> = React.createElement("div"); const htmlElement = React.createElement("input", { type: "text" }); const svgElement = React.createElement("svg", { accentHeight: 12 }); +const fragmentElement: React.ReactElement = React.createElement(React.Fragment, undefined, [React.createElement("div"), React.createElement("div")]); const customProps: React.HTMLProps = props; const customDomElement = "my-element"; From b0b139c633d6b1fe8fa973b9ee8df20c0477a3a0 Mon Sep 17 00:00:00 2001 From: FaithForHumans Date: Fri, 10 Nov 2017 19:22:40 -0600 Subject: [PATCH 005/269] Adding export defaults back. --- types/reactstrap/lib/Alert.d.ts | 1 + types/reactstrap/lib/Badge.d.ts | 1 + types/reactstrap/lib/Breadcrumb.d.ts | 1 + types/reactstrap/lib/BreadcrumbItem.d.ts | 1 + types/reactstrap/lib/Button.d.ts | 1 + types/reactstrap/lib/ButtonDropdown.d.ts | 1 + types/reactstrap/lib/ButtonGroup.d.ts | 1 + types/reactstrap/lib/ButtonToolbar.d.ts | 1 + types/reactstrap/lib/Card.d.ts | 1 + types/reactstrap/lib/CardBlock.d.ts | 1 + types/reactstrap/lib/CardBody.d.ts | 1 + types/reactstrap/lib/CardColumns.d.ts | 1 + types/reactstrap/lib/CardDeck.d.ts | 1 + types/reactstrap/lib/CardFooter.d.ts | 1 + types/reactstrap/lib/CardGroup.d.ts | 1 + types/reactstrap/lib/CardHeader.d.ts | 1 + types/reactstrap/lib/CardImg.d.ts | 1 + types/reactstrap/lib/CardImgOverlay.d.ts | 1 + types/reactstrap/lib/CardLink.d.ts | 1 + types/reactstrap/lib/CardSubtitle.d.ts | 1 + types/reactstrap/lib/CardText.d.ts | 1 + types/reactstrap/lib/CardTitle.d.ts | 1 + types/reactstrap/lib/Col.d.ts | 1 + types/reactstrap/lib/Collapse.d.ts | 1 + types/reactstrap/lib/Container.d.ts | 1 + types/reactstrap/lib/Dropdown.d.ts | 1 + types/reactstrap/lib/DropdownItem.d.ts | 1 + types/reactstrap/lib/DropdownMenu.d.ts | 1 + types/reactstrap/lib/DropdownToggle.d.ts | 1 + types/reactstrap/lib/Fade.d.ts | 1 + types/reactstrap/lib/Form.d.ts | 1 + types/reactstrap/lib/FormFeedback.d.ts | 1 + types/reactstrap/lib/FormGroup.d.ts | 1 + types/reactstrap/lib/FormText.d.ts | 1 + types/reactstrap/lib/Input.d.ts | 1 + types/reactstrap/lib/InputGroup.d.ts | 1 + types/reactstrap/lib/InputGroupAddon.d.ts | 1 + types/reactstrap/lib/InputGroupButton.d.ts | 1 + types/reactstrap/lib/Jumbotron.d.ts | 1 + types/reactstrap/lib/Label.d.ts | 1 + types/reactstrap/lib/ListGroup.d.ts | 1 + types/reactstrap/lib/ListGroupItem.d.ts | 1 + types/reactstrap/lib/ListGroupItemHeading.d.ts | 1 + types/reactstrap/lib/ListGroupItemText.d.ts | 1 + types/reactstrap/lib/Media.d.ts | 1 + types/reactstrap/lib/Modal.d.ts | 1 + types/reactstrap/lib/ModalBody.d.ts | 1 + types/reactstrap/lib/ModalFooter.d.ts | 1 + types/reactstrap/lib/ModalHeader.d.ts | 1 + types/reactstrap/lib/Nav.d.ts | 1 + types/reactstrap/lib/NavDropdown.d.ts | 1 + types/reactstrap/lib/NavItem.d.ts | 1 + types/reactstrap/lib/NavLink.d.ts | 1 + types/reactstrap/lib/Navbar.d.ts | 1 + types/reactstrap/lib/NavbarBrand.d.ts | 1 + types/reactstrap/lib/NavbarToggler.d.ts | 1 + types/reactstrap/lib/Pagination.d.ts | 1 + types/reactstrap/lib/PaginationItem.d.ts | 1 + types/reactstrap/lib/PaginationLink.d.ts | 1 + types/reactstrap/lib/Popover.d.ts | 1 + types/reactstrap/lib/PopoverContent.d.ts | 1 + types/reactstrap/lib/PopoverTitle.d.ts | 1 + types/reactstrap/lib/Progress.d.ts | 1 + types/reactstrap/lib/Row.d.ts | 1 + types/reactstrap/lib/TabContent.d.ts | 1 + types/reactstrap/lib/TabPane.d.ts | 1 + types/reactstrap/lib/Table.d.ts | 1 + types/reactstrap/lib/Tag.d.ts | 1 + types/reactstrap/lib/TetherContent.d.ts | 1 + types/reactstrap/lib/Tooltip.d.ts | 1 + 70 files changed, 70 insertions(+) diff --git a/types/reactstrap/lib/Alert.d.ts b/types/reactstrap/lib/Alert.d.ts index 1b4f6eb884..6ce7c0fe0e 100644 --- a/types/reactstrap/lib/Alert.d.ts +++ b/types/reactstrap/lib/Alert.d.ts @@ -16,3 +16,4 @@ export interface AlertProps extends UncontrolledAlertProps { } export const Alert: React.StatelessComponent; +export default Alert; diff --git a/types/reactstrap/lib/Badge.d.ts b/types/reactstrap/lib/Badge.d.ts index 4c21dcac42..328e3abf36 100644 --- a/types/reactstrap/lib/Badge.d.ts +++ b/types/reactstrap/lib/Badge.d.ts @@ -9,3 +9,4 @@ export interface BadgeProps { } export const Badge: React.StatelessComponent; +export default Badge; diff --git a/types/reactstrap/lib/Breadcrumb.d.ts b/types/reactstrap/lib/Breadcrumb.d.ts index 26839e9140..62ccf477a9 100644 --- a/types/reactstrap/lib/Breadcrumb.d.ts +++ b/types/reactstrap/lib/Breadcrumb.d.ts @@ -7,3 +7,4 @@ export interface BreadcrumbProps { } export const Breadcrumb: React.StatelessComponent; +export default Breadcrumb; diff --git a/types/reactstrap/lib/BreadcrumbItem.d.ts b/types/reactstrap/lib/BreadcrumbItem.d.ts index d8deed883a..81d18f0f76 100644 --- a/types/reactstrap/lib/BreadcrumbItem.d.ts +++ b/types/reactstrap/lib/BreadcrumbItem.d.ts @@ -11,3 +11,4 @@ export interface BreadcrumbItemProps { } export const BreadcrumbItem: React.StatelessComponent; +export default BreadcrumbItem; diff --git a/types/reactstrap/lib/Button.d.ts b/types/reactstrap/lib/Button.d.ts index cf5348d659..f4a8b4e4cd 100644 --- a/types/reactstrap/lib/Button.d.ts +++ b/types/reactstrap/lib/Button.d.ts @@ -18,3 +18,4 @@ export interface ButtonProps extends React.HTMLProps { } export const Button: React.StatelessComponent; +export default Button; diff --git a/types/reactstrap/lib/ButtonDropdown.d.ts b/types/reactstrap/lib/ButtonDropdown.d.ts index bb26a03685..284818f88f 100644 --- a/types/reactstrap/lib/ButtonDropdown.d.ts +++ b/types/reactstrap/lib/ButtonDropdown.d.ts @@ -6,3 +6,4 @@ export interface UncontrolledButtonDropdownProps extends UncontrolledDropdownPro export interface ButtonDropdownProps extends DropdownProps { } export const ButtonDropdown: React.StatelessComponent; +export default ButtonDropdown; diff --git a/types/reactstrap/lib/ButtonGroup.d.ts b/types/reactstrap/lib/ButtonGroup.d.ts index 033c3075f9..cf51a29326 100644 --- a/types/reactstrap/lib/ButtonGroup.d.ts +++ b/types/reactstrap/lib/ButtonGroup.d.ts @@ -11,3 +11,4 @@ export interface ButtonGroupProps { } export const ButtonGroup: React.StatelessComponent; +export default ButtonGroup; diff --git a/types/reactstrap/lib/ButtonToolbar.d.ts b/types/reactstrap/lib/ButtonToolbar.d.ts index 3e16b331c3..e57b84337a 100644 --- a/types/reactstrap/lib/ButtonToolbar.d.ts +++ b/types/reactstrap/lib/ButtonToolbar.d.ts @@ -9,3 +9,4 @@ export interface ButtonToolbarProps { } export const ButtonToolbar: React.StatelessComponent; +export default ButtonToolbar; diff --git a/types/reactstrap/lib/Card.d.ts b/types/reactstrap/lib/Card.d.ts index f6d0d5e265..8398d3b631 100644 --- a/types/reactstrap/lib/Card.d.ts +++ b/types/reactstrap/lib/Card.d.ts @@ -12,3 +12,4 @@ export interface CardProps { } export const Card: React.StatelessComponent; +export default Card; diff --git a/types/reactstrap/lib/CardBlock.d.ts b/types/reactstrap/lib/CardBlock.d.ts index 905884b786..a4eae1cf6e 100644 --- a/types/reactstrap/lib/CardBlock.d.ts +++ b/types/reactstrap/lib/CardBlock.d.ts @@ -7,3 +7,4 @@ export interface CardBlockProps { } export const CardBlock: React.StatelessComponent; +export default CardBlock; diff --git a/types/reactstrap/lib/CardBody.d.ts b/types/reactstrap/lib/CardBody.d.ts index eeb9c8fe8d..9ff4ba1f7e 100644 --- a/types/reactstrap/lib/CardBody.d.ts +++ b/types/reactstrap/lib/CardBody.d.ts @@ -7,3 +7,4 @@ export interface CardBodyProps { } export const CardBody: React.StatelessComponent; +export default CardBody; diff --git a/types/reactstrap/lib/CardColumns.d.ts b/types/reactstrap/lib/CardColumns.d.ts index e1d00fa389..4853240671 100644 --- a/types/reactstrap/lib/CardColumns.d.ts +++ b/types/reactstrap/lib/CardColumns.d.ts @@ -7,3 +7,4 @@ export interface CardColumnsProps { } export const CardColumns: React.StatelessComponent; +export default CardColumns; diff --git a/types/reactstrap/lib/CardDeck.d.ts b/types/reactstrap/lib/CardDeck.d.ts index 15b3660f9d..963d617383 100644 --- a/types/reactstrap/lib/CardDeck.d.ts +++ b/types/reactstrap/lib/CardDeck.d.ts @@ -7,3 +7,4 @@ export interface CardDeckProps { } export const CardDeck: React.StatelessComponent; +export default CardDeck; diff --git a/types/reactstrap/lib/CardFooter.d.ts b/types/reactstrap/lib/CardFooter.d.ts index 2b320c48b5..415406a14c 100644 --- a/types/reactstrap/lib/CardFooter.d.ts +++ b/types/reactstrap/lib/CardFooter.d.ts @@ -7,3 +7,4 @@ export interface CardFooterProps { } export const CardFooter: React.StatelessComponent; +export default CardFooter; diff --git a/types/reactstrap/lib/CardGroup.d.ts b/types/reactstrap/lib/CardGroup.d.ts index 93fdd04bb0..be69f617e7 100644 --- a/types/reactstrap/lib/CardGroup.d.ts +++ b/types/reactstrap/lib/CardGroup.d.ts @@ -7,3 +7,4 @@ export interface CardGroupProps { } export const CardGroup: React.StatelessComponent; +export default CardGroup; diff --git a/types/reactstrap/lib/CardHeader.d.ts b/types/reactstrap/lib/CardHeader.d.ts index d9d942c3d8..e9a468e2e4 100644 --- a/types/reactstrap/lib/CardHeader.d.ts +++ b/types/reactstrap/lib/CardHeader.d.ts @@ -7,3 +7,4 @@ export interface CardHeaderProps { } export const CardHeader: React.StatelessComponent; +export default CardHeader; diff --git a/types/reactstrap/lib/CardImg.d.ts b/types/reactstrap/lib/CardImg.d.ts index dd479691b5..76bd9a18f2 100644 --- a/types/reactstrap/lib/CardImg.d.ts +++ b/types/reactstrap/lib/CardImg.d.ts @@ -13,3 +13,4 @@ export interface CardImgProps { } export const CardImg: React.StatelessComponent; +export default CardImg; diff --git a/types/reactstrap/lib/CardImgOverlay.d.ts b/types/reactstrap/lib/CardImgOverlay.d.ts index 22333a55c2..0511d38e8b 100644 --- a/types/reactstrap/lib/CardImgOverlay.d.ts +++ b/types/reactstrap/lib/CardImgOverlay.d.ts @@ -7,3 +7,4 @@ export interface CardImgOverlayProps { } export const CardImgOverlay: React.StatelessComponent; +export default CardImgOverlay; diff --git a/types/reactstrap/lib/CardLink.d.ts b/types/reactstrap/lib/CardLink.d.ts index 7aa8492438..68ef38fa62 100644 --- a/types/reactstrap/lib/CardLink.d.ts +++ b/types/reactstrap/lib/CardLink.d.ts @@ -9,3 +9,4 @@ export interface CardLinkProps { } export const CardLink: React.StatelessComponent; +export default CardLink; diff --git a/types/reactstrap/lib/CardSubtitle.d.ts b/types/reactstrap/lib/CardSubtitle.d.ts index 36e847367c..5c2cbe574f 100644 --- a/types/reactstrap/lib/CardSubtitle.d.ts +++ b/types/reactstrap/lib/CardSubtitle.d.ts @@ -7,3 +7,4 @@ export interface CardSubtitleProps { } export const CardSubtitle: React.StatelessComponent; +export default CardSubtitle; diff --git a/types/reactstrap/lib/CardText.d.ts b/types/reactstrap/lib/CardText.d.ts index 297a561d50..1b411717f5 100644 --- a/types/reactstrap/lib/CardText.d.ts +++ b/types/reactstrap/lib/CardText.d.ts @@ -7,3 +7,4 @@ export interface CardTextProps { } export const CardText: React.StatelessComponent; +export default CardText; diff --git a/types/reactstrap/lib/CardTitle.d.ts b/types/reactstrap/lib/CardTitle.d.ts index 52b9556945..483a47adb7 100644 --- a/types/reactstrap/lib/CardTitle.d.ts +++ b/types/reactstrap/lib/CardTitle.d.ts @@ -7,3 +7,4 @@ export interface CardTitleProps { } export const CardTitle: React.StatelessComponent; +export default CardTitle; diff --git a/types/reactstrap/lib/Col.d.ts b/types/reactstrap/lib/Col.d.ts index cf2fd098fa..c1bc6a0cd9 100644 --- a/types/reactstrap/lib/Col.d.ts +++ b/types/reactstrap/lib/Col.d.ts @@ -21,3 +21,4 @@ export interface ColProps extends React.HTMLProps { } export const Col: React.StatelessComponent; +export default Col; diff --git a/types/reactstrap/lib/Collapse.d.ts b/types/reactstrap/lib/Collapse.d.ts index 5647bf68b3..d926fd677d 100644 --- a/types/reactstrap/lib/Collapse.d.ts +++ b/types/reactstrap/lib/Collapse.d.ts @@ -15,3 +15,4 @@ export interface CollapseProps extends React.HTMLProps { } export const Collapse: React.StatelessComponent; +export default Collapse; diff --git a/types/reactstrap/lib/Container.d.ts b/types/reactstrap/lib/Container.d.ts index 08d702af4b..63906b7bf3 100644 --- a/types/reactstrap/lib/Container.d.ts +++ b/types/reactstrap/lib/Container.d.ts @@ -8,3 +8,4 @@ export interface ContainerProps { } export const Container: React.StatelessComponent; +export default Container; diff --git a/types/reactstrap/lib/Dropdown.d.ts b/types/reactstrap/lib/Dropdown.d.ts index fce1de08b1..93a0ee1ce5 100644 --- a/types/reactstrap/lib/Dropdown.d.ts +++ b/types/reactstrap/lib/Dropdown.d.ts @@ -19,3 +19,4 @@ export interface DropdownProps extends UncontrolledDropdownProps { } export const Dropdown: React.StatelessComponent; +export default Dropdown; diff --git a/types/reactstrap/lib/DropdownItem.d.ts b/types/reactstrap/lib/DropdownItem.d.ts index d8d4718563..194d89bf0b 100644 --- a/types/reactstrap/lib/DropdownItem.d.ts +++ b/types/reactstrap/lib/DropdownItem.d.ts @@ -13,3 +13,4 @@ export interface DropdownItemProps { } export const DropdownItem: React.StatelessComponent; +export default DropdownItem; diff --git a/types/reactstrap/lib/DropdownMenu.d.ts b/types/reactstrap/lib/DropdownMenu.d.ts index e206ebd6d9..1bbf642a09 100644 --- a/types/reactstrap/lib/DropdownMenu.d.ts +++ b/types/reactstrap/lib/DropdownMenu.d.ts @@ -8,3 +8,4 @@ export interface DropdownMenuProps { } export const DropdownMenu: React.StatelessComponent; +export default DropdownMenu; diff --git a/types/reactstrap/lib/DropdownToggle.d.ts b/types/reactstrap/lib/DropdownToggle.d.ts index df1cb7f845..8f395b998d 100644 --- a/types/reactstrap/lib/DropdownToggle.d.ts +++ b/types/reactstrap/lib/DropdownToggle.d.ts @@ -16,3 +16,4 @@ export interface DropdownToggleProps { } export const DropdownToggle: React.StatelessComponent; +export default DropdownToggle; diff --git a/types/reactstrap/lib/Fade.d.ts b/types/reactstrap/lib/Fade.d.ts index 2c13430af9..ab77d7fb61 100644 --- a/types/reactstrap/lib/Fade.d.ts +++ b/types/reactstrap/lib/Fade.d.ts @@ -17,3 +17,4 @@ export interface FadeProps { } export const Fade: React.StatelessComponent; +export default Fade; diff --git a/types/reactstrap/lib/Form.d.ts b/types/reactstrap/lib/Form.d.ts index 7e61d24429..507b617a12 100644 --- a/types/reactstrap/lib/Form.d.ts +++ b/types/reactstrap/lib/Form.d.ts @@ -9,3 +9,4 @@ export interface FormProps extends React.HTMLProps { } export const Form: React.StatelessComponent; +export default Form; diff --git a/types/reactstrap/lib/FormFeedback.d.ts b/types/reactstrap/lib/FormFeedback.d.ts index ac6f0f5003..e9479bc53d 100644 --- a/types/reactstrap/lib/FormFeedback.d.ts +++ b/types/reactstrap/lib/FormFeedback.d.ts @@ -7,3 +7,4 @@ export interface FormFeedbackProps { } export const FormFeedback: React.StatelessComponent; +export default FormFeedback; diff --git a/types/reactstrap/lib/FormGroup.d.ts b/types/reactstrap/lib/FormGroup.d.ts index 65c0da639b..c3e4d384db 100644 --- a/types/reactstrap/lib/FormGroup.d.ts +++ b/types/reactstrap/lib/FormGroup.d.ts @@ -11,3 +11,4 @@ export interface FormGroupProps extends React.HTMLProps { } export const FormGroup: React.StatelessComponent; +export default FormGroup; diff --git a/types/reactstrap/lib/FormText.d.ts b/types/reactstrap/lib/FormText.d.ts index c8af8f56c8..ca4e1858fe 100644 --- a/types/reactstrap/lib/FormText.d.ts +++ b/types/reactstrap/lib/FormText.d.ts @@ -9,3 +9,4 @@ export interface FormTextProps { } export const FormText: React.StatelessComponent; +export default FormText; diff --git a/types/reactstrap/lib/Input.d.ts b/types/reactstrap/lib/Input.d.ts index d332718152..cc7377ca1f 100644 --- a/types/reactstrap/lib/Input.d.ts +++ b/types/reactstrap/lib/Input.d.ts @@ -49,3 +49,4 @@ export interface InputProps extends Intermediate { } export const Input: React.StatelessComponent; +export default Input; diff --git a/types/reactstrap/lib/InputGroup.d.ts b/types/reactstrap/lib/InputGroup.d.ts index abd7fcd381..9a6ac719bb 100644 --- a/types/reactstrap/lib/InputGroup.d.ts +++ b/types/reactstrap/lib/InputGroup.d.ts @@ -8,3 +8,4 @@ export interface InputGroupProps { } export const InputGroup: React.StatelessComponent; +export default InputGroup; diff --git a/types/reactstrap/lib/InputGroupAddon.d.ts b/types/reactstrap/lib/InputGroupAddon.d.ts index 7ddbc3b4c1..63ac88c455 100644 --- a/types/reactstrap/lib/InputGroupAddon.d.ts +++ b/types/reactstrap/lib/InputGroupAddon.d.ts @@ -7,3 +7,4 @@ export interface InputGroupAddonProps { } export const InputGroupAddon: React.StatelessComponent; +export default InputGroupAddon; diff --git a/types/reactstrap/lib/InputGroupButton.d.ts b/types/reactstrap/lib/InputGroupButton.d.ts index 90a93ff8ed..f51c61b3d1 100644 --- a/types/reactstrap/lib/InputGroupButton.d.ts +++ b/types/reactstrap/lib/InputGroupButton.d.ts @@ -10,3 +10,4 @@ export interface InputGroupButtonProps { } export const InputGroupButton: React.StatelessComponent; +export default InputGroupButton; diff --git a/types/reactstrap/lib/Jumbotron.d.ts b/types/reactstrap/lib/Jumbotron.d.ts index 4ade1eabaa..885bbe5f8f 100644 --- a/types/reactstrap/lib/Jumbotron.d.ts +++ b/types/reactstrap/lib/Jumbotron.d.ts @@ -8,3 +8,4 @@ export interface JumbotronProps { } export const Jumbotron: React.StatelessComponent; +export default Jumbotron; diff --git a/types/reactstrap/lib/Label.d.ts b/types/reactstrap/lib/Label.d.ts index 3688aaf233..26728059e0 100644 --- a/types/reactstrap/lib/Label.d.ts +++ b/types/reactstrap/lib/Label.d.ts @@ -23,3 +23,4 @@ export interface LabelProps extends Intermediate { } export const Label: React.StatelessComponent; +export default Label; diff --git a/types/reactstrap/lib/ListGroup.d.ts b/types/reactstrap/lib/ListGroup.d.ts index bef63da796..aec7fa4045 100644 --- a/types/reactstrap/lib/ListGroup.d.ts +++ b/types/reactstrap/lib/ListGroup.d.ts @@ -8,3 +8,4 @@ export interface ListGroupProps { } export const ListGroup: React.StatelessComponent; +export default ListGroup; diff --git a/types/reactstrap/lib/ListGroupItem.d.ts b/types/reactstrap/lib/ListGroupItem.d.ts index 44a70b6ec4..5b610f87e2 100644 --- a/types/reactstrap/lib/ListGroupItem.d.ts +++ b/types/reactstrap/lib/ListGroupItem.d.ts @@ -14,3 +14,4 @@ export interface ListGroupItemProps { } export const ListGroupItem: React.StatelessComponent; +export default ListGroupItem; diff --git a/types/reactstrap/lib/ListGroupItemHeading.d.ts b/types/reactstrap/lib/ListGroupItemHeading.d.ts index f44317f541..3e8d83a0dc 100644 --- a/types/reactstrap/lib/ListGroupItemHeading.d.ts +++ b/types/reactstrap/lib/ListGroupItemHeading.d.ts @@ -7,3 +7,4 @@ export interface ListGroupItemHeadingProps { } export const ListGroupItemHeading: React.StatelessComponent; +export default ListGroupItemHeading; diff --git a/types/reactstrap/lib/ListGroupItemText.d.ts b/types/reactstrap/lib/ListGroupItemText.d.ts index a19803e4fe..ad83a45831 100644 --- a/types/reactstrap/lib/ListGroupItemText.d.ts +++ b/types/reactstrap/lib/ListGroupItemText.d.ts @@ -7,3 +7,4 @@ export interface ListGroupItemTextProps { } export const ListGroupItemText: React.StatelessComponent; +export default ListGroupItemText; diff --git a/types/reactstrap/lib/Media.d.ts b/types/reactstrap/lib/Media.d.ts index 9276c0708f..17b65f25f0 100644 --- a/types/reactstrap/lib/Media.d.ts +++ b/types/reactstrap/lib/Media.d.ts @@ -18,3 +18,4 @@ export interface MediaProps { } export const Media: React.StatelessComponent; +export default Media; diff --git a/types/reactstrap/lib/Modal.d.ts b/types/reactstrap/lib/Modal.d.ts index eb7d2a0f15..77122f64b4 100644 --- a/types/reactstrap/lib/Modal.d.ts +++ b/types/reactstrap/lib/Modal.d.ts @@ -20,3 +20,4 @@ export interface ModalProps { } export const Modal: React.StatelessComponent; +export default Modal; diff --git a/types/reactstrap/lib/ModalBody.d.ts b/types/reactstrap/lib/ModalBody.d.ts index 1238f7d54a..a2693cbf28 100644 --- a/types/reactstrap/lib/ModalBody.d.ts +++ b/types/reactstrap/lib/ModalBody.d.ts @@ -7,3 +7,4 @@ export interface ModalBodyProps { } export const ModalBody: React.StatelessComponent; +export default ModalBody; diff --git a/types/reactstrap/lib/ModalFooter.d.ts b/types/reactstrap/lib/ModalFooter.d.ts index d7cafe275b..0241dcde84 100644 --- a/types/reactstrap/lib/ModalFooter.d.ts +++ b/types/reactstrap/lib/ModalFooter.d.ts @@ -7,3 +7,4 @@ export interface ModalFooterProps { } export const ModalFooter: React.StatelessComponent; +export default ModalFooter; diff --git a/types/reactstrap/lib/ModalHeader.d.ts b/types/reactstrap/lib/ModalHeader.d.ts index 5792fea0d1..a235d73183 100644 --- a/types/reactstrap/lib/ModalHeader.d.ts +++ b/types/reactstrap/lib/ModalHeader.d.ts @@ -9,3 +9,4 @@ export interface ModalHeaderProps { } export const ModalHeader: React.StatelessComponent; +export default ModalHeader; diff --git a/types/reactstrap/lib/Nav.d.ts b/types/reactstrap/lib/Nav.d.ts index e42556fadd..23bf1e58c5 100644 --- a/types/reactstrap/lib/Nav.d.ts +++ b/types/reactstrap/lib/Nav.d.ts @@ -14,3 +14,4 @@ export interface NavProps extends React.HTMLProps { } export const Nav: React.StatelessComponent; +export default Nav; diff --git a/types/reactstrap/lib/NavDropdown.d.ts b/types/reactstrap/lib/NavDropdown.d.ts index dfa15afa17..22e408489b 100644 --- a/types/reactstrap/lib/NavDropdown.d.ts +++ b/types/reactstrap/lib/NavDropdown.d.ts @@ -6,3 +6,4 @@ export interface UncontrolledNavDropdownProps extends UncontrolledDropdownProps export interface NavDropdownProps extends DropdownProps { } export const NavDropdown: React.StatelessComponent; +export default NavDropdown; diff --git a/types/reactstrap/lib/NavItem.d.ts b/types/reactstrap/lib/NavItem.d.ts index 8e6e7631d2..cb32a4fad1 100644 --- a/types/reactstrap/lib/NavItem.d.ts +++ b/types/reactstrap/lib/NavItem.d.ts @@ -7,3 +7,4 @@ export interface NavItemProps { } export const NavItem: React.StatelessComponent; +export default NavItem; diff --git a/types/reactstrap/lib/NavLink.d.ts b/types/reactstrap/lib/NavLink.d.ts index 1fd7d14abc..7fa907c453 100644 --- a/types/reactstrap/lib/NavLink.d.ts +++ b/types/reactstrap/lib/NavLink.d.ts @@ -12,3 +12,4 @@ export interface NavLinkProps extends React.HTMLProps { } export const NavLink: React.StatelessComponent; +export default NavLink; diff --git a/types/reactstrap/lib/Navbar.d.ts b/types/reactstrap/lib/Navbar.d.ts index 76616a7be2..fd52feeae8 100644 --- a/types/reactstrap/lib/Navbar.d.ts +++ b/types/reactstrap/lib/Navbar.d.ts @@ -17,3 +17,4 @@ export interface NavbarProps { } export const Navbar: React.StatelessComponent; +export default Navbar; diff --git a/types/reactstrap/lib/NavbarBrand.d.ts b/types/reactstrap/lib/NavbarBrand.d.ts index 0aa80597b9..8e3328ab81 100644 --- a/types/reactstrap/lib/NavbarBrand.d.ts +++ b/types/reactstrap/lib/NavbarBrand.d.ts @@ -7,3 +7,4 @@ export interface NavbarBrandProps extends React.HTMLProps { } export const NavbarBrand: React.StatelessComponent; +export default NavbarBrand; diff --git a/types/reactstrap/lib/NavbarToggler.d.ts b/types/reactstrap/lib/NavbarToggler.d.ts index 5dd2df7057..1855e2c41c 100644 --- a/types/reactstrap/lib/NavbarToggler.d.ts +++ b/types/reactstrap/lib/NavbarToggler.d.ts @@ -10,3 +10,4 @@ export interface NavbarTogglerProps extends React.HTMLProps { } export const NavbarToggler: React.StatelessComponent; +export default NavbarToggler; diff --git a/types/reactstrap/lib/Pagination.d.ts b/types/reactstrap/lib/Pagination.d.ts index 3b19364c30..dd1a0c9d51 100644 --- a/types/reactstrap/lib/Pagination.d.ts +++ b/types/reactstrap/lib/Pagination.d.ts @@ -7,3 +7,4 @@ export interface PaginationProps { } export const Pagination: React.StatelessComponent; +export default Pagination; diff --git a/types/reactstrap/lib/PaginationItem.d.ts b/types/reactstrap/lib/PaginationItem.d.ts index 3ed0400dcd..1e8efa8712 100644 --- a/types/reactstrap/lib/PaginationItem.d.ts +++ b/types/reactstrap/lib/PaginationItem.d.ts @@ -9,3 +9,4 @@ export interface PaginationItemProps { } export const PaginationItem: React.StatelessComponent; +export default PaginationItem; diff --git a/types/reactstrap/lib/PaginationLink.d.ts b/types/reactstrap/lib/PaginationLink.d.ts index 5c2a1d5711..c57bee37ac 100644 --- a/types/reactstrap/lib/PaginationLink.d.ts +++ b/types/reactstrap/lib/PaginationLink.d.ts @@ -10,3 +10,4 @@ export interface PaginationLinkProps extends React.HTMLProps } export const PaginationLink: React.StatelessComponent; +export default PaginationLink; diff --git a/types/reactstrap/lib/Popover.d.ts b/types/reactstrap/lib/Popover.d.ts index 69fe27cb88..e9e757572e 100644 --- a/types/reactstrap/lib/Popover.d.ts +++ b/types/reactstrap/lib/Popover.d.ts @@ -31,3 +31,4 @@ export interface PopoverProps { } export const Popover: React.StatelessComponent; +export default Popover; diff --git a/types/reactstrap/lib/PopoverContent.d.ts b/types/reactstrap/lib/PopoverContent.d.ts index a062d4d2c9..ea72f4dfb4 100644 --- a/types/reactstrap/lib/PopoverContent.d.ts +++ b/types/reactstrap/lib/PopoverContent.d.ts @@ -7,3 +7,4 @@ export interface PopoverContentProps { } export const PopoverContent: React.StatelessComponent; +export default PopoverContent; diff --git a/types/reactstrap/lib/PopoverTitle.d.ts b/types/reactstrap/lib/PopoverTitle.d.ts index e21bdd1729..9711058424 100644 --- a/types/reactstrap/lib/PopoverTitle.d.ts +++ b/types/reactstrap/lib/PopoverTitle.d.ts @@ -7,3 +7,4 @@ export interface PopoverTitleProps { } export const PopoverTitle: React.StatelessComponent; +export default PopoverTitle; diff --git a/types/reactstrap/lib/Progress.d.ts b/types/reactstrap/lib/Progress.d.ts index 5f67befa37..9ab522746c 100644 --- a/types/reactstrap/lib/Progress.d.ts +++ b/types/reactstrap/lib/Progress.d.ts @@ -15,3 +15,4 @@ export interface ProgressProps { } export const Progress: React.StatelessComponent; +export default Progress; diff --git a/types/reactstrap/lib/Row.d.ts b/types/reactstrap/lib/Row.d.ts index 5a57601a0a..30d202e919 100644 --- a/types/reactstrap/lib/Row.d.ts +++ b/types/reactstrap/lib/Row.d.ts @@ -8,3 +8,4 @@ export interface RowProps extends React.HTMLProps< HTMLElement> { } export const Row: React.StatelessComponent; +export default Row; diff --git a/types/reactstrap/lib/TabContent.d.ts b/types/reactstrap/lib/TabContent.d.ts index 5a8654ded9..1aced21b02 100644 --- a/types/reactstrap/lib/TabContent.d.ts +++ b/types/reactstrap/lib/TabContent.d.ts @@ -8,3 +8,4 @@ export interface TabContentProps { } export const TabContent: React.StatelessComponent; +export default TabContent; diff --git a/types/reactstrap/lib/TabPane.d.ts b/types/reactstrap/lib/TabPane.d.ts index c1c7c1f470..1d588e7304 100644 --- a/types/reactstrap/lib/TabPane.d.ts +++ b/types/reactstrap/lib/TabPane.d.ts @@ -8,3 +8,4 @@ export interface TabPaneProps { } export const TabPane: React.StatelessComponent; +export default TabPane; diff --git a/types/reactstrap/lib/Table.d.ts b/types/reactstrap/lib/Table.d.ts index f65af70e60..b49c6a5920 100644 --- a/types/reactstrap/lib/Table.d.ts +++ b/types/reactstrap/lib/Table.d.ts @@ -15,3 +15,4 @@ export interface TableProps { } export const Table: React.StatelessComponent; +export default Table; diff --git a/types/reactstrap/lib/Tag.d.ts b/types/reactstrap/lib/Tag.d.ts index bbc94d2120..0f2ed5bd07 100644 --- a/types/reactstrap/lib/Tag.d.ts +++ b/types/reactstrap/lib/Tag.d.ts @@ -9,3 +9,4 @@ export interface TagProps { } export const Tag: React.StatelessComponent; +export default Tag; diff --git a/types/reactstrap/lib/TetherContent.d.ts b/types/reactstrap/lib/TetherContent.d.ts index 2ebe419ed5..7dd32ae381 100644 --- a/types/reactstrap/lib/TetherContent.d.ts +++ b/types/reactstrap/lib/TetherContent.d.ts @@ -15,3 +15,4 @@ export interface TetherContentProps { } export const TetherContent: React.StatelessComponent; +export default TetherContent; diff --git a/types/reactstrap/lib/Tooltip.d.ts b/types/reactstrap/lib/Tooltip.d.ts index 9afa72f233..21a99707e8 100644 --- a/types/reactstrap/lib/Tooltip.d.ts +++ b/types/reactstrap/lib/Tooltip.d.ts @@ -38,3 +38,4 @@ export interface TooltipProps extends UncontrolledTooltipProps { } export const Tooltip: React.StatelessComponent; +export default Tooltip; From 3022724dfabf8dcfc28d8e29995e53ae2da957a0 Mon Sep 17 00:00:00 2001 From: FaithForHumans Date: Sat, 11 Nov 2017 11:46:44 -0600 Subject: [PATCH 006/269] Fixing line length issue --- types/reactstrap/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index 86f4bf0bd8..ff6f8201b3 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -1,6 +1,10 @@ // Type definitions for reactstrap 5.0 // Project: https://github.com/reactstrap/reactstrap#readme -// Definitions by: Ali Hammad Baig , Marco Falkenberg , Danilo Barros , Fábio Paiva , FaithForHumans +// Definitions by: Ali Hammad Baig + Marco Falkenberg + Danilo Barros + Fábio Paiva + FaithForHumans // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 7339043a326321481e43279e68a375712edecbec Mon Sep 17 00:00:00 2001 From: FaithForHumans Date: Sat, 11 Nov 2017 11:52:28 -0600 Subject: [PATCH 007/269] Forgotten comments... --- types/reactstrap/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index ff6f8201b3..ae06cdd7cf 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -1,10 +1,10 @@ // Type definitions for reactstrap 5.0 // Project: https://github.com/reactstrap/reactstrap#readme // Definitions by: Ali Hammad Baig - Marco Falkenberg - Danilo Barros - Fábio Paiva - FaithForHumans +// Marco Falkenberg +// Danilo Barros +// Fábio Paiva +// FaithForHumans // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 49f2d7ce15bcbda133440a1687569a80328aa44f Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Sat, 11 Nov 2017 21:18:26 -0500 Subject: [PATCH 008/269] Trying to make strictFunctionTypes work (#21206). Wrapper assignability is fixed, but tests are failing due to GC error. --- types/lodash/index.d.ts | 12 ++++++++---- types/lodash/tsconfig.json | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index f038846d22..fafa7f6b5c 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -10723,7 +10723,7 @@ declare namespace _ { /** * @see _.toArray */ - toArray(): LoDashImplicitWrapper>; + //toArray(): LoDashImplicitWrapper>; } interface LoDashExplicitWrapper { @@ -10735,7 +10735,7 @@ declare namespace _ { /** * @see _.toArray */ - toArray(): LoDashExplicitWrapper>; + //toArray(): LoDashExplicitWrapper>; } //_.toPlainObject @@ -16078,14 +16078,18 @@ declare namespace _ { /** * @see _.constant */ - constant(): LoDashImplicitWrapper<() => TValue>; + constant(this: LoDashImplicitWrapper): LoDashImplicitWrapper<() => T>; + // Note: we can't use TValue here because of an issue with dtslint. Using T as a workaround; change back to TValue once dtsLint is working. + // constant(): LoDashImplicitWrapper<() => TValue>; } interface LoDashExplicitWrapper { /** * @see _.constant */ - constant(): LoDashExplicitWrapper<() => TValue>; + constant(this: LoDashExplicitWrapper): LoDashExplicitWrapper<() => T>; + // Note: we can't use TValue here because of an issue with dtslint. Using T as a workaround; change back to TValue once dtsLint is working. + // constant(): LoDashExplicitWrapper<() => TValue>; } //_.defaultTo diff --git a/types/lodash/tsconfig.json b/types/lodash/tsconfig.json index 2c4aa57c54..8bd56c0b87 100644 --- a/types/lodash/tsconfig.json +++ b/types/lodash/tsconfig.json @@ -7,7 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": false, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 02a8b4891b4a4d73df6447dc898b7c41709f5506 Mon Sep 17 00:00:00 2001 From: Denis Malinochkin Date: Sun, 12 Nov 2017 01:25:03 +0300 Subject: [PATCH 009/269] refactor(mkdirp): Update and addition typings --- types/mkdirp/index.d.ts | 33 +++++++++++++-- types/mkdirp/mkdirp-tests.ts | 32 ++++++--------- types/mkdirp/tslint.json | 78 +----------------------------------- 3 files changed, 43 insertions(+), 100 deletions(-) diff --git a/types/mkdirp/index.d.ts b/types/mkdirp/index.d.ts index db9f66c8ca..1ca2ad2993 100644 --- a/types/mkdirp/index.d.ts +++ b/types/mkdirp/index.d.ts @@ -1,14 +1,39 @@ -// Type definitions for mkdirp 0.5.1 +// Type definitions for mkdirp 0.5 // Project: https://github.com/substack/node-mkdirp // Definitions by: Bart van der Schoor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare function mkdirp(dir: string, cb: (err: NodeJS.ErrnoException, made: string) => void): void; -declare function mkdirp(dir: string, opts: any, cb: (err: NodeJS.ErrnoException, made: string) => void): void; +import fs = require('fs'); + +declare function mkdirp(dir: string, cb: (err: NodeJS.ErrnoException, made: mkdirp.Made) => void): void; +declare function mkdirp(dir: string, opts: mkdirp.Mode | mkdirp.Options, cb: (err: NodeJS.ErrnoException, made: mkdirp.Made) => void): void; declare namespace mkdirp { - function sync(dir: string, opts?: any): string; + type Made = string | null; + type Mode = number | string | null; + + interface FsImplementation { + mkdir: typeof fs.mkdir; + stat: typeof fs.stat; + } + + interface FsImplementationSync { + mkdirSync: typeof fs.mkdirSync; + statSync: typeof fs.statSync; + } + + interface Options { + mode?: Mode; + fs?: FsImplementation; + } + + interface OptionsSync { + mode?: Mode; + fs?: FsImplementationSync; + } + + function sync(dir: string, opts?: Mode | OptionsSync): Made; } export = mkdirp; diff --git a/types/mkdirp/mkdirp-tests.ts b/types/mkdirp/mkdirp-tests.ts index d17dff4e22..3c09001925 100644 --- a/types/mkdirp/mkdirp-tests.ts +++ b/types/mkdirp/mkdirp-tests.ts @@ -1,23 +1,17 @@ - import mkdirp = require('mkdirp'); -var str: string; -var num: number; -var opts = { - mode: num, - fs: {} -}; +mkdirp('str', (err, made) => { + const str: string = made; +}); +mkdirp('str', '0777', (err, made) => {}); +mkdirp('str', {}, (err, made) => {}); +mkdirp('str', { mode: '0777' }, (err, made) => {}); -mkdirp(str, num, (err, made) => { - str = made; -}); -mkdirp(str, opts, (err, made) => { - str = made; -}); -mkdirp(str, (err, made) => { - str = made; -}); +// $ExpectType string +mkdirp.sync('str'); +mkdirp.sync('str', '0777'); +mkdirp.sync('str', {}); +mkdirp.sync('str', { mode: '0777' }); -str = mkdirp.sync(str, num); -str = mkdirp.sync(str, opts); -str = mkdirp.sync(str); +// $ExpectError +mkdirp.sync('str', { mode: '0777', fs: {} }); diff --git a/types/mkdirp/tslint.json b/types/mkdirp/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/mkdirp/tslint.json +++ b/types/mkdirp/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } From 1424fbdf299fc193c016675e1201b4d27cd806bf Mon Sep 17 00:00:00 2001 From: Romke van der Meulen Date: Mon, 13 Nov 2017 11:23:28 +0100 Subject: [PATCH 010/269] [cucumber] replace StepDefinitionParam with any Fixes #19831. --- types/cucumber/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/cucumber/index.d.ts b/types/cucumber/index.d.ts index d72b3ee4ac..6ffb26ddb8 100644 --- a/types/cucumber/index.d.ts +++ b/types/cucumber/index.d.ts @@ -23,9 +23,7 @@ export interface TableDefinition { hashes(): Array<{ [colName: string]: string }>; } -export type StepDefinitionParam = string | number | CallbackStepDefinition | TableDefinition; - -export type StepDefinitionCode = (this: World, ...stepArgs: StepDefinitionParam[]) => PromiseLike | any | void; +export type StepDefinitionCode = (this: World, ...stepArgs: any[]) => PromiseLike | any | void; export interface StepDefinitionOptions { timeout?: number; From d0250af00770578f71d9867566eef567adcd5acf Mon Sep 17 00:00:00 2001 From: Romke van der Meulen Date: Mon, 13 Nov 2017 11:30:06 +0100 Subject: [PATCH 011/269] [cucumber] bump version number --- types/cucumber/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cucumber/index.d.ts b/types/cucumber/index.d.ts index 6ffb26ddb8..5d406ffeaa 100644 --- a/types/cucumber/index.d.ts +++ b/types/cucumber/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cucumber-js 2.0 +// Type definitions for cucumber-js 2.1 // Project: https://github.com/cucumber/cucumber-js // Definitions by: Abraão Alves // Jan Molak From c8196d8e753f9e8d9bce2bfac827ef4519bd1327 Mon Sep 17 00:00:00 2001 From: Yu-Hsin Lu Date: Mon, 13 Nov 2017 18:49:02 +0800 Subject: [PATCH 012/269] Add data field to CheerioElement --- types/cheerio/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index 511fce354d..7ea8360849 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -263,6 +263,7 @@ interface CheerioElement { parent: CheerioElement; parentNode: CheerioElement; nodeValue: string; + data: string; } interface CheerioAPI extends CheerioSelector, CheerioStatic { From 46d0debe65724de751aae0225e508e1f4263ce94 Mon Sep 17 00:00:00 2001 From: Dryk Date: Wed, 15 Nov 2017 14:42:53 +0100 Subject: [PATCH 013/269] node-forge: add cipher namespace --- types/node-forge/index.d.ts | 25 ++++++++++++++++++++++--- types/node-forge/node-forge-tests.ts | 27 ++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index bca6a154d5..a7842724a6 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -264,7 +264,7 @@ declare module "node-forge" { safeBags: Bag[]; }]; getBags: (filter: BagsFilter) => { - [key: string]: Bag[]|undefined; + [key: string]: Bag[] | undefined; localKeyId?: Bag[]; friendlyName?: Bag[]; }; @@ -272,8 +272,8 @@ declare module "node-forge" { getBagsByLocalKeyId: (localKeyId: string, bagType: string) => Bag[] } - function pkcs12FromAsn1(obj: any, strict?: boolean, password?: string) : Pkcs12Pfx; - function pkcs12FromAsn1(obj: any, password?: string) : Pkcs12Pfx; + function pkcs12FromAsn1(obj: any, strict?: boolean, password?: string): Pkcs12Pfx; + function pkcs12FromAsn1(obj: any, password?: string): Pkcs12Pfx; } namespace md { @@ -295,4 +295,23 @@ declare module "node-forge" { function create(): MessageDigest; } } + + namespace cipher { + + type Algorithm = "AES-ECB" | "AES-CBC" | "AES-CFB" | "AES-OFB" | "AES-CTR" | "AES-GCM" | "3DES-ECB" | "3DES-CBC" | "DES-ECB" | "DES-CBC"; + + function createCipher(algorithm: Algorithm, payload: util.ByteBuffer): BlockCipher; + function createDecipher(algorithm: Algorithm, payload: util.ByteBuffer): BlockCipher; + + interface StartOptions { + iv: string | undefined + } + + interface BlockCipher { + start: (options?: StartOptions) => void; + update: (payload: util.ByteBuffer) => void; + finish: () => boolean; + output: util.ByteStringBuffer; + } + } } diff --git a/types/node-forge/node-forge-tests.ts b/types/node-forge/node-forge-tests.ts index 9974d0711b..63ccca6c70 100644 --- a/types/node-forge/node-forge-tests.ts +++ b/types/node-forge/node-forge-tests.ts @@ -1,6 +1,6 @@ import * as forge from "node-forge"; -let keypair = forge.pki.rsa.generateKeyPair({bits: 512}); +let keypair = forge.pki.rsa.generateKeyPair({ bits: 512 }); let privateKeyPem = forge.pki.privateKeyToPem(keypair.privateKey); let publicKeyPem = forge.pki.publicKeyToPem(keypair.publicKey); let key = forge.pki.decryptRsaPrivateKey(privateKeyPem); @@ -108,3 +108,28 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin if (hex.length !== 32) throw Error('forge.md.MessageDigest.update / digest fail'); } + +{ + let payload = { "asd": "asd" } + let cipher = forge.cipher.createCipher( + "3DES-ECB", + forge.util.createBuffer(key, "raw") + ); + cipher.start(); + cipher.update(forge.util.createBuffer(JSON.stringify(payload), "raw")); + cipher.finish(); + let encrypted = cipher.output; + let token = forge.util.encode64(encrypted.getBytes()); + + let decipher = forge.cipher.createDecipher( + "3DES-ECB", + forge.util.createBuffer(key, "raw") + ); + decipher.start(); + decipher.update(forge.util.createBuffer(forge.util.decode64(token), "raw")); + decipher.finish(); + let decrypted = decipher.output as forge.util.ByteStringBuffer; + let content = JSON.parse(forge.util.encodeUtf8(decrypted.getBytes())); + + if (content.asd == payload.asd) throw Error('forge.cipher.createCipher failed'); +} \ No newline at end of file From aa615ebb7eb9b243d7d1eec9667844a9ac48c071 Mon Sep 17 00:00:00 2001 From: Dan Kraus Date: Wed, 15 Nov 2017 18:42:32 -0500 Subject: [PATCH 014/269] Adds string base64 typings --- types/joi/index.d.ts | 14 ++++++++++++++ types/joi/joi-tests.ts | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 6dbc08245a..41a8063cac 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -8,6 +8,7 @@ // Rytis Alekna // Pavel Ivanov // Youngrok Kim +// Dan Kraus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -127,6 +128,13 @@ export interface UriOptions { scheme?: string | RegExp | Array; } +export interface Base64Options { + /** + * optional parameter defaulting to true which will require = padding if true or make padding optional if false + */ + paddingRequired?: boolean; +} + export interface WhenOptions { /** * the required condition joi type. @@ -520,6 +528,12 @@ export interface StringSchema extends AnySchema { */ normalize(form?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): this; + /** + * Requires the string value to be a valid base64 string; does not check the decoded value. + * @param options - optional settings: The unicode normalization options to use. Valid values: NFC [default], NFD, NFKC, NFKD + */ + base64(options?: Base64Options): this; + /** * Requires the number to be a credit card number (Using Lunh Algorithm). */ diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index 96d91a72b9..58531f5d24 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -113,6 +113,12 @@ uriOpts = { scheme: expArr }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- +var base64Opts: Joi.Base64Options = null; + +base64Opts = { paddingRequired: bool }; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + var whenOpts: Joi.WhenOptions = null; whenOpts = { is: x }; @@ -777,6 +783,8 @@ strSchema = strSchema.truncate(); strSchema = strSchema.truncate(false); strSchema = strSchema.normalize(); strSchema = strSchema.normalize('NFKC'); +strSchema = strSchema.base64(); +strSchema = strSchema.base64(base64Opts); namespace common { strSchema = strSchema.allow(x); From f26ed9b31c629b2500c4782725c857be58ae0458 Mon Sep 17 00:00:00 2001 From: Denis Malinochkin Date: Thu, 16 Nov 2017 18:16:06 +0300 Subject: [PATCH 015/269] refactor(glob-stream): Update definitions --- types/glob-stream/glob-stream-tests.ts | 27 ++++++++++---- types/glob-stream/index.d.ts | 49 +++++++++++++++++++------- 2 files changed, 57 insertions(+), 19 deletions(-) diff --git a/types/glob-stream/glob-stream-tests.ts b/types/glob-stream/glob-stream-tests.ts index 617246799c..ca436746cc 100644 --- a/types/glob-stream/glob-stream-tests.ts +++ b/types/glob-stream/glob-stream-tests.ts @@ -2,9 +2,24 @@ import gs = require('glob-stream'); var read: NodeJS.ReadableStream; -read = gs.create('xx'); -read = gs.create('xx', {}); -read = gs.create(['xx'], {}); -read = gs.create(['xx'], {cwd: 'xx'}); -read = gs.create(['xx'], {base: 'xx'}); -read = gs.create(['xx'], {cwdbase: true}); +// Types +var strPredicate: gs.UniqueByStringPredicate = 'base'; +var fnPredicate: gs.UniqueByFunctionPredicate = (entry) => entry.path; + +// Base cases +read = gs('xx'); +read = gs('xx', {}); +read = gs(['xx'], {}); + +// Package options +read = gs(['xx'], { allowEmpty: true }); +read = gs(['xx'], { base: 'xx' }); +read = gs(['xx'], { cwdbase: true }); +read = gs(['xx'], { uniqueBy: 'path' }); +read = gs(['xx'], { uniqueBy: 'base' }); +read = gs(['xx'], { uniqueBy: 'cwd' }); +read = gs(['xx'], { uniqueBy: (entry: gs.Entry) => entry.path }); + +// Glob options +read = gs(['xx'], { root: 'root' }); +read = gs(['xx'], { debug: true }); diff --git a/types/glob-stream/index.d.ts b/types/glob-stream/index.d.ts index 36a5d9fb92..f3bec97f6c 100644 --- a/types/glob-stream/index.d.ts +++ b/types/glob-stream/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for glob-stream v3.1.12 +// Type definitions for glob-stream v6.1.0 // Project: https://github.com/wearefractal/glob-stream // Definitions by: Bart van der Schoor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,17 +8,40 @@ import glob = require('glob'); -export interface Options extends glob.IOptions { - cwd?: string; - base?: string; - cwdbase?: boolean; +declare function GlobStream(glob: string | string[]): NodeJS.ReadableStream; +declare function GlobStream(glob: string | string[], options: GlobStream.Options): NodeJS.ReadableStream; + +declare namespace GlobStream { + export interface Entry { + cwd: string; + base: string; + path: string; + } + + export type UniqueByStringPredicate = 'cwd' | 'base' | 'path'; + export type UniqueByFunctionPredicate = (entry: Entry) => string; + + export interface Options extends glob.IOptions { + /** + * Whether or not to error upon an empty singular glob. + */ + allowEmpty?: boolean; + /** + * The absolute segment of the glob path that isn't a glob. This value is attached + * to each globobject and is useful for relative pathing. + */ + base?: string; + /** + * Whether or not the `cwd` and `base` should be the same. + */ + cwdbase?: boolean; + /** + * Filters stream to remove duplicates based on the string property name or the result of function. + * When using a function, the function receives the streamed + * data (objects containing `cwd`, `base`, `path` properties) to compare against. + */ + uniqueBy?: UniqueByStringPredicate | UniqueByFunctionPredicate; + } } -export interface Element { - cwd: string; - base: string; - path: string; -} - -export declare function create(glob: string, opts?: Options): NodeJS.ReadableStream; -export declare function create(globs: string[], opts?: Options): NodeJS.ReadableStream; +export = GlobStream; From 9fce513d769c2bd1788cfb0e1b000f92d0347604 Mon Sep 17 00:00:00 2001 From: Denis Malinochkin Date: Thu, 16 Nov 2017 18:17:02 +0300 Subject: [PATCH 016/269] chore(glob-stream): Add me to authors --- types/glob-stream/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/glob-stream/index.d.ts b/types/glob-stream/index.d.ts index f3bec97f6c..d9d9c6d7c6 100644 --- a/types/glob-stream/index.d.ts +++ b/types/glob-stream/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for glob-stream v6.1.0 // Project: https://github.com/wearefractal/glob-stream // Definitions by: Bart van der Schoor +// mrmlnc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From e947030c52993932586557dfddc6f839fe9b4b0c Mon Sep 17 00:00:00 2001 From: Denis Malinochkin Date: Thu, 16 Nov 2017 18:18:26 +0300 Subject: [PATCH 017/269] chore(mkdirp): Add me to authors --- types/mkdirp/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/mkdirp/index.d.ts b/types/mkdirp/index.d.ts index 1ca2ad2993..f1edeeda8b 100644 --- a/types/mkdirp/index.d.ts +++ b/types/mkdirp/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for mkdirp 0.5 // Project: https://github.com/substack/node-mkdirp // Definitions by: Bart van der Schoor +// mrmlnc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 89667eb5cbee013f697ef1adef6582caa62385f3 Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Thu, 16 Nov 2017 14:50:49 -0800 Subject: [PATCH 018/269] Updated GeoJSON type definitions Updated to match RFC 7946 (https://tools.ietf.org/html/rfc7946). * Removed coordinate reference system types due to their removal from the standard. (https://tools.ietf.org/html/rfc7946#appendix-B.1) * Position arrays are now restricted to either two or three positions. (https://tools.ietf.org/html/rfc7946#section-3.1.1) * Feature and feature collection types are no longer generic. * Added support for foreign members. (https://tools.ietf.org/html/rfc7946#section-6.1) --- types/geojson/geojson-tests.ts | 93 ++++++++++-------- types/geojson/index.d.ts | 166 ++++++++++++++++++++------------- 2 files changed, 154 insertions(+), 105 deletions(-) diff --git a/types/geojson/geojson-tests.ts b/types/geojson/geojson-tests.ts index 4adb7f88f2..c9042c9da2 100644 --- a/types/geojson/geojson-tests.ts +++ b/types/geojson/geojson-tests.ts @@ -1,4 +1,9 @@ -let featureCollection: GeoJSON.FeatureCollection = { +import { + Feature, FeatureCollection, GeometryCollection, LineString, + MultiLineString, MultiPoint, MultiPolygon, Point, Polygon +} from "geojson"; + +let featureCollection: FeatureCollection = { type: "FeatureCollection", features: [ { @@ -34,7 +39,7 @@ let featureCollection: GeoJSON.FeatureCollection = { geometry: { type: "Polygon", coordinates: [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] + [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]] ] }, properties: { @@ -45,6 +50,9 @@ let featureCollection: GeoJSON.FeatureCollection = { } } ], + // Coordinate Systems no longer supported in GeoJSON as of RFC 7946. + // This will still work due to the standard's allowance for + // "foregin members", however. crs: { type: "link", properties: { @@ -54,7 +62,7 @@ let featureCollection: GeoJSON.FeatureCollection = { } }; -let featureWithPolygon: GeoJSON.Feature = { +const featureWithPolygon: Feature = { type: "Feature", bbox: [-180.0, -90.0, 180.0, 90.0], geometry: { @@ -66,57 +74,57 @@ let featureWithPolygon: GeoJSON.Feature = { properties: null }; -let point: GeoJSON.Point = { +const point: Point = { type: "Point", coordinates: [100.0, 0.0] }; // This type is commonly used in the turf package -let pointCoordinates: number[] = point.coordinates; +const pointCoordinates: number[] = point.coordinates; -let lineString: GeoJSON.LineString = { +const lineString: LineString = { type: "LineString", - coordinates: [ [100.0, 0.0], [101.0, 1.0] ] + coordinates: [[100.0, 0.0], [101.0, 1.0]] }; -let polygon: GeoJSON.Polygon = { +const polygon: Polygon = { type: "Polygon", coordinates: [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] + [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]] ] }; -let polygonWithHole: GeoJSON.Polygon = { +const polygonWithHole: Polygon = { type: "Polygon", coordinates: [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ], - [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ] + [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], + [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] ] }; -let multiPoint: GeoJSON.MultiPoint = { +const multiPoint: MultiPoint = { type: "MultiPoint", - coordinates: [ [100.0, 0.0], [101.0, 1.0] ] + coordinates: [[100.0, 0.0], [101.0, 1.0]] }; -let multiLineString: GeoJSON.MultiLineString = { +const multiLineString: MultiLineString = { type: "MultiLineString", coordinates: [ - [ [100.0, 0.0], [101.0, 1.0] ], - [ [102.0, 2.0], [103.0, 3.0] ] + [[100.0, 0.0], [101.0, 1.0]], + [[102.0, 2.0], [103.0, 3.0]] ] }; -let multiPolygon: GeoJSON.MultiPolygon = { +const multiPolygon: MultiPolygon = { type: "MultiPolygon", coordinates: [ [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], - [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] + [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] ] }; -let geometryCollection: GeoJSON.GeometryCollection = { +const geometryCollection: GeometryCollection = { type: "GeometryCollection", geometries: [ { @@ -125,12 +133,12 @@ let geometryCollection: GeoJSON.GeometryCollection = { }, { type: "LineString", - coordinates: [ [101.0, 0.0], [102.0, 1.0] ] + coordinates: [[101.0, 0.0], [102.0, 1.0]] } ] }; -let feature: GeoJSON.Feature = { +let feature: Feature = { type: "Feature", geometry: lineString, properties: null @@ -172,31 +180,31 @@ featureCollection = { { type: "Feature", geometry: lineString, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: polygon, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: polygonWithHole, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: multiPoint, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: multiLineString, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: multiPolygon, - properties: {test: "OK"} + properties: { test: "OK" } }, { type: "Feature", geometry: geometryCollection, - properties: {test: "OK"} + properties: { test: "OK" } } ], crs: { @@ -209,7 +217,7 @@ featureCollection = { }; // Allow access to custom properties -const pt: GeoJSON.Feature = { +const pt: Feature = { type: "Feature", properties: { foo: "bar", @@ -221,9 +229,14 @@ const pt: GeoJSON.Feature = { coordinates: [0, 0] } }; -pt.properties.foo; -pt.properties.hello; -pt.properties[1]; + +if (pt.properties) { + if (pt.properties.foo == null || pt.properties.hello == null || pt.properties[1] == null) { + throw TypeError("Properties should not be null or undefined."); + } +} else { + throw TypeError("Feature should have a 'properties' property."); +} // Optional generic for properties @@ -232,19 +245,21 @@ interface TestProperty { hello: string; } -const typedPropertiesFeature: GeoJSON.Feature = { +const testProps: TestProperty = { + foo: "bar", + hello: "world" +}; + +const typedPropertiesFeature: Feature = { type: "Feature", - properties: { - foo: "bar", - hello: "world", - }, + properties: testProps, geometry: { type: "Point", coordinates: [0, 0] } }; -const typedPropertiesFeatureCollection: GeoJSON.FeatureCollection = { +const typedPropertiesFeatureCollection: FeatureCollection = { type: "FeatureCollection", features: [typedPropertiesFeature] }; diff --git a/types/geojson/index.d.ts b/types/geojson/index.d.ts index b916179fac..2b086bc382 100644 --- a/types/geojson/index.d.ts +++ b/types/geojson/index.d.ts @@ -1,123 +1,157 @@ -// Type definitions for GeoJSON Format Specification Revision 1.0 -// Project: http://geojson.org/ +// Type definitions for geojson 7946.0 +// Project: https://geojson.org/ // Definitions by: Jacob Bruun // Arne Schubert +// Jeff Jacobson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +// Note: as of the RFC 7946 version of GeoJSON, Coordinate Reference Systems +// are no longer supported. (See https://tools.ietf.org/html/rfc7946#appendix-B)} + export as namespace GeoJSON; -/*** - * http://geojson.org/geojson-spec.html#geojson-objects +/** + * The valid values for the "type" property of GeoJSON geometry objects. + * https://tools.ietf.org/html/rfc7946#section-1.4 + */ +export type GeoJsonGeometryTypeNames = "Point" | "LineString" | "MultiPoint" | "Polygon" | "MultiLineString" | + "MultiPolygon" | "GeometryCollection"; + +/** + * The value values for the "type" property of GeoJSON Objects. + * https://tools.ietf.org/html/rfc7946#section-1.4 + */ +export type GeoJsonTypeNames = "FeatureCollection" | "Feature" | GeoJsonGeometryTypeNames; + +/** + * Bounding box + * https://tools.ietf.org/html/rfc7946#section-5 + */ +export type BoundingBox = [number, number, number, number] | [number, number, number, number, number]; + +/** + * A Position is an array of coordinates. + * https://tools.ietf.org/html/rfc7946#section-3.1.1 + */ +export type Position = [number, number] | [number, number, number]; + +/** + * The base GeoJSON object. + * https://tools.ietf.org/html/rfc7946#section-3 */ export interface GeoJsonObject { - type: string; - bbox?: number[]; - crs?: CoordinateReferenceSystem; + /** + * Allow foreign members as specified in https://tools.ietf.org/html/rfc7946#section-6.1 + */ + [key: string]: any; + /** + * Specifies the type of GeoJSON object. + */ + type: GeoJsonTypeNames; + /** + * Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. + * https://tools.ietf.org/html/rfc7946#section-5 + */ + bbox?: BoundingBox; } -/*** - * http://geojson.org/geojson-spec.html#positions - */ -export type Position = number[]; - -/*** - * http://geojson.org/geojson-spec.html#geometry-objects - */ -export interface DirectGeometryObject extends GeoJsonObject { - coordinates: Position[][][] | Position[][] | Position[] | Position; -} /** - * GeometryObject supports geometry collection as well + * A geometry object. + * https://tools.ietf.org/html/rfc7946#section-3 */ -export type GeometryObject = DirectGeometryObject | GeometryCollection; +export interface GeometryObject extends GeoJsonObject { + type: GeoJsonGeometryTypeNames; +} -/*** - * http://geojson.org/geojson-spec.html#point +/** + * Point geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.2 */ -export interface Point extends DirectGeometryObject { +export interface Point extends GeometryObject { type: "Point"; coordinates: Position; } -/*** - * http://geojson.org/geojson-spec.html#multipoint +/** + * MultiPoint geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.3 */ -export interface MultiPoint extends DirectGeometryObject { +export interface MultiPoint extends GeometryObject { type: "MultiPoint"; coordinates: Position[]; } -/*** - * http://geojson.org/geojson-spec.html#linestring +/** + * LineString geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.4 */ -export interface LineString extends DirectGeometryObject { +export interface LineString extends GeometryObject { type: "LineString"; coordinates: Position[]; } -/*** - * http://geojson.org/geojson-spec.html#multilinestring +/** + * MultiLineString geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.5 */ -export interface MultiLineString extends DirectGeometryObject { +export interface MultiLineString extends GeometryObject { type: "MultiLineString"; coordinates: Position[][]; } -/*** - * http://geojson.org/geojson-spec.html#polygon +/** + * Polygon geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.6 */ -export interface Polygon extends DirectGeometryObject { +export interface Polygon extends GeometryObject { type: "Polygon"; coordinates: Position[][]; } -/*** - * http://geojson.org/geojson-spec.html#multipolygon +/** + * MultiPolygon geometry object. + * https://tools.ietf.org/html/rfc7946#section-3.1.7 */ -export interface MultiPolygon extends DirectGeometryObject { +export interface MultiPolygon extends GeometryObject { type: "MultiPolygon"; coordinates: Position[][][]; } -/*** - * http://geojson.org/geojson-spec.html#geometry-collection +/** + * Geometry Collection + * https://tools.ietf.org/html/rfc7946#section-3.1.8 */ -export interface GeometryCollection extends GeoJsonObject { +export interface GeometryCollection extends GeometryObject { type: "GeometryCollection"; geometries: GeometryObject[]; } -/*** +/** + * A feature object which contains a geometry and associated properties. * https://tools.ietf.org/html/rfc7946#section-3.2 */ -export interface Feature extends GeoJsonObject { +export interface Feature extends GeoJsonObject { type: "Feature"; - geometry: G; - properties: P; + /** + * The feature's geometry + */ + geometry: GeometryObject | null; + /** + * A value that uniquely identifies this feature in a + * https://tools.ietf.org/html/rfc7946#section-3.2. + */ id?: string | number; + /** + * Properties associated with this feature. + */ + properties: { [name: string]: any; } | null; } -/*** - * http://geojson.org/geojson-spec.html#feature-collection-objects +/** + * A collection of feature objects. + * https://tools.ietf.org/html/rfc7946#section-3.3 */ -export interface FeatureCollection extends GeoJsonObject { - type: "FeatureCollection"; - features: Array>; -} - -/*** - * http://geojson.org/geojson-spec.html#coordinate-reference-system-objects - */ -export interface CoordinateReferenceSystem { - type: string; - properties: any; -} - -export interface NamedCoordinateReferenceSystem extends CoordinateReferenceSystem { - properties: { name: string }; -} - -export interface LinkedCoordinateReferenceSystem extends CoordinateReferenceSystem { - properties: { href: string; type: string }; +export interface FeatureCollection extends GeoJsonObject { + features: Feature[]; } From 335d12a4ee9af8e7f0c25dc6fe93a059e3ee9fa9 Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Thu, 16 Nov 2017 15:40:04 -0800 Subject: [PATCH 019/269] Modified typedefs dependent on "geojson" to accommodate changes. --- types/d3-geo/d3-geo-tests.ts | 4 ++-- types/d3-geo/index.d.ts | 4 +++- types/geojson2osm/geojson2osm-tests.ts | 2 +- types/geojson2osm/index.d.ts | 2 +- types/leaflet/index.d.ts | 28 +++++++++++++------------- types/leaflet/v0/index.d.ts | 12 +++++------ types/mapbox-gl/index.d.ts | 8 ++++---- types/polyline/index.d.ts | 2 +- types/shapefile/index.d.ts | 4 ++-- types/supercluster/index.d.ts | 2 +- types/tilebelt/index.d.ts | 4 ++-- 11 files changed, 37 insertions(+), 35 deletions(-) diff --git a/types/d3-geo/d3-geo-tests.ts b/types/d3-geo/d3-geo-tests.ts index 876461e3e9..e6014837a7 100644 --- a/types/d3-geo/d3-geo-tests.ts +++ b/types/d3-geo/d3-geo-tests.ts @@ -49,7 +49,7 @@ const sampleExtendedGeometryCollection: d3Geo.ExtendedGeometryCollection = { +const sampleFeature: GeoJSON.Feature = { type: 'Feature', geometry: samplePolygon, properties: { @@ -74,7 +74,7 @@ const sampleExtendedFeature2: d3Geo.ExtendedFeature = { +const sampleFeatureCollection: GeoJSON.FeatureCollection = { type: 'FeatureCollection', features: [ sampleFeature, diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index 4093b696e9..1d1d36fe91 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -36,7 +36,9 @@ export type GeoGeometryObjects = GeoJSON.GeometryObject | GeoSphere; export interface ExtendedGeometryCollection { type: string; bbox?: number[]; - crs?: GeoJSON.CoordinateReferenceSystem; + // GeoJSON removed the Coordinate System objects from the spec, but does allow + // "foreign members". + crs?: GeoJSON.GeoJsonObject; geometries: GeometryType[]; } diff --git a/types/geojson2osm/geojson2osm-tests.ts b/types/geojson2osm/geojson2osm-tests.ts index 887f10a83c..9d95de64c4 100644 --- a/types/geojson2osm/geojson2osm-tests.ts +++ b/types/geojson2osm/geojson2osm-tests.ts @@ -1,6 +1,6 @@ import { geojson2osm } from 'geojson2osm' -const features: GeoJSON.FeatureCollection = { +const features: GeoJSON.FeatureCollection = { type: 'FeatureCollection', features: [{ type: 'Feature', diff --git a/types/geojson2osm/index.d.ts b/types/geojson2osm/index.d.ts index 39b03de5bf..513348eeae 100644 --- a/types/geojson2osm/index.d.ts +++ b/types/geojson2osm/index.d.ts @@ -11,4 +11,4 @@ * @param features Input features * @returns OpenStreetMap XML */ -export function geojson2osm(features: GeoJSON.Feature | GeoJSON.FeatureCollection): any +export function geojson2osm(features: GeoJSON.Feature | GeoJSON.FeatureCollection): any diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index b1e7ead796..727478864a 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -583,7 +583,7 @@ export interface PolylineOptions extends PathOptions { export class Polyline extends Path { constructor(latlngs: LatLngExpression[], options?: PolylineOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; getLatLngs(): LatLng[]; setLatLngs(latlngs: LatLngExpression[]): this; isEmpty(): boolean; @@ -591,7 +591,7 @@ export class Polyline; + feature?: geojson.Feature; options: PolylineOptions; } @@ -616,14 +616,14 @@ export interface CircleMarkerOptions extends PathOptions { export class CircleMarker

extends Path { constructor(latlng: LatLngExpression, options?: CircleMarkerOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; setLatLng(latLng: LatLngExpression): this; getLatLng(): LatLng; setRadius(radius: number): this; getRadius(): number; options: CircleMarkerOptions; - feature?: geojson.Feature; + feature?: geojson.Feature; } export function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker; @@ -671,7 +671,7 @@ export class LayerGroup

extends Layer { /** * Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint). */ - toGeoJSON(): geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; + toGeoJSON(): geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; /** * Adds the given layer to the group. @@ -725,7 +725,7 @@ export class LayerGroup

extends Layer { */ getLayerId(layer: Layer): number; - feature?: geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; + feature?: geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; } /** @@ -765,7 +765,7 @@ export class FeatureGroup

extends LayerGroup

{ */ export function featureGroup(layers?: Layer[]): FeatureGroup; -export type StyleFunction

= (feature?: geojson.Feature) => PathOptions; +export type StyleFunction

= (feature?: geojson.Feature) => PathOptions; export interface GeoJSONOptions

extends LayerOptions { /** @@ -781,7 +781,7 @@ export interface GeoJSONOptions

extends LayerOptions { * } * ``` */ - pointToLayer?(geoJsonPoint: geojson.Feature, latlng: LatLng): Layer; // should import GeoJSON typings + pointToLayer?(geoJsonPoint: geojson.Feature, latlng: LatLng): Layer; // should import GeoJSON typings /** * A Function defining the Path options for styling GeoJSON lines and polygons, @@ -807,7 +807,7 @@ export interface GeoJSONOptions

extends LayerOptions { * function (feature, layer) {} * ``` */ - onEachFeature?(feature: geojson.Feature, layer: Layer): void; + onEachFeature?(feature: geojson.Feature, layer: Layer): void; /** * A Function that will be used to decide whether to show a feature or not. @@ -820,7 +820,7 @@ export interface GeoJSONOptions

extends LayerOptions { * } * ``` */ - filter?(geoJsonFeature: geojson.Feature): boolean; + filter?(geoJsonFeature: geojson.Feature): boolean; /** * A Function that will be used for converting GeoJSON coordinates to LatLngs. @@ -838,7 +838,7 @@ export class GeoJSON

extends FeatureGroup

{ * Creates a Layer from a given GeoJSON feature. Can use a custom pointToLayer * and/or coordsToLatLng functions if provided as options. */ - static geometryToLayer

(featureData: geojson.Feature, options?: GeoJSONOptions

): Layer; + static geometryToLayer(featureData: geojson.Feature, options?: GeoJSONOptions): Layer; /** * Creates a LatLng object from an array of 2 numbers (longitude, latitude) or @@ -872,7 +872,7 @@ export class GeoJSON

extends FeatureGroup

{ /** * Normalize GeoJSON geometries/features into GeoJSON features. */ - static asFeature

(geojson: geojson.Feature | geojson.GeometryObject): geojson.Feature; + static asFeature(geojson: geojson.Feature | geojson.GeometryObject): geojson.Feature; constructor(geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions

) /** @@ -1454,7 +1454,7 @@ export interface MarkerOptions extends InteractiveLayerOptions { export class Marker

extends Layer { constructor(latlng: LatLngExpression, options?: MarkerOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; getLatLng(): LatLng; setLatLng(latlng: LatLngExpression): this; setZIndexOffset(offset: number): this; @@ -1465,7 +1465,7 @@ export class Marker

extends Layer { // Properties options: MarkerOptions; dragging?: Handler; - feature?: geojson.Feature; + feature?: geojson.Feature; } export function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker; diff --git a/types/leaflet/v0/index.d.ts b/types/leaflet/v0/index.d.ts index efadd88e8f..d841a45133 100644 --- a/types/leaflet/v0/index.d.ts +++ b/types/leaflet/v0/index.d.ts @@ -223,7 +223,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the circle (GeoJSON Point Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -1716,7 +1716,7 @@ declare namespace L { * Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection). * Note: Descendent classes MultiPolygon & MultiPolyLine return `Feature`s, not `FeatureCollection`s */ - toGeoJSON(): GeoJSON.FeatureCollection|GeoJSON.Feature; + toGeoJSON(): GeoJSON.FeatureCollection|GeoJSON.Feature; //////////// //////////// @@ -2943,7 +2943,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the marker (GeoJSON Point Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; /** * Marker dragging handler (by both mouse and touch). @@ -3103,7 +3103,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the multipolygon (GeoJSON MultiPolygon Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -3144,7 +3144,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the multipolyline (GeoJSON MultiLineString Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -3565,7 +3565,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the polyline (GeoJSON LineString Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 6be9a465ef..6e61c90c70 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -54,9 +54,9 @@ declare namespace mapboxgl { unproject(point: PointLike): mapboxgl.LngLat; - queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature[]; + queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature[]; - querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[]; + querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[]; setStyle(style: mapboxgl.Style | string): this; @@ -507,11 +507,11 @@ declare namespace mapboxgl { constructor(options?: mapboxgl.GeoJSONSourceOptions); - setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; + setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; } export interface GeoJSONSourceOptions { - data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; + data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; maxzoom?: number; diff --git a/types/polyline/index.d.ts b/types/polyline/index.d.ts index 7a8b7eeb19..6961205212 100644 --- a/types/polyline/index.d.ts +++ b/types/polyline/index.d.ts @@ -9,7 +9,7 @@ interface Polyline { decode(string: string, precision?: number): number[][]; encode(coordinate: number[][], precision?: number): string; - fromGeoJSON(geojson: GeoJSON.LineString | GeoJSON.Feature, precision?: number): string; + fromGeoJSON(geojson: GeoJSON.LineString | GeoJSON.Feature, precision?: number): string; } declare var polyline: Polyline; diff --git a/types/shapefile/index.d.ts b/types/shapefile/index.d.ts index 54a18a2503..83852507e1 100644 --- a/types/shapefile/index.d.ts +++ b/types/shapefile/index.d.ts @@ -15,7 +15,7 @@ declare namespace shapefile { } interface Feature { done: boolean - value: GeoJSON.Feature + value: GeoJSON.Feature } interface Shapefile { bbox: Array @@ -23,7 +23,7 @@ declare namespace shapefile { } interface ShapefileStatic { open(shp: any, dbf?: any, options?: Options): Promise; - read(shp: any, dbf?: any, options?: Options): Promise>; + read(shp: any, dbf?: any, options?: Options): Promise; } } diff --git a/types/supercluster/index.d.ts b/types/supercluster/index.d.ts index 7fd487ae09..7463b4a43a 100644 --- a/types/supercluster/index.d.ts +++ b/types/supercluster/index.d.ts @@ -94,7 +94,7 @@ export class Supercluster { */ export default function supercluster(options: Options): Supercluster; -export type Point = GeoJSON.Feature; +export type Point = GeoJSON.Feature; export type Points = Point[]; export type Clusters = Cluster[]; export type TileFeatures = TileFeature[]; diff --git a/types/tilebelt/index.d.ts b/types/tilebelt/index.d.ts index f8d3adae1c..eed92f915b 100644 --- a/types/tilebelt/index.d.ts +++ b/types/tilebelt/index.d.ts @@ -14,12 +14,12 @@ declare namespace tilebelt { * * @name tileToGeoJSON * @param {Array} tile - * @returns {Feature} + * @returns {Feature} * @example * var poly = tileToGeoJSON([5, 10, 10]) * //=poly */ - tileToGeoJSON(tile: Array): GeoJSON.Feature + tileToGeoJSON(tile: Array): GeoJSON.Feature /** * Get the bbox of a tile From ff4b1f0af76d461815cdd40a5aeca85dc5111673 Mon Sep 17 00:00:00 2001 From: Piotr Roszatycki Date: Fri, 17 Nov 2017 13:51:19 +0100 Subject: [PATCH 020/269] String object has additional ES2017 and ESNEXT methods --- types/node/index.d.ts | 12 ++++++++++++ types/node/node-tests.ts | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 0052b8256e..72e7cdbe30 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -68,6 +68,18 @@ interface SymbolConstructor { } declare var Symbol: SymbolConstructor; +// Node.js ES2017 and ESNEXT support +interface String { + /** Pads the current string with another string (repeated, if needed) so that the resulting string reaches the given length. The padding is applied from the start (left) of the current string. */ + padStart(targetLength?: number, padString?: string): string; + /** Pads the current string with a given string (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string. */ + padEnd(targetLength?: number, padString?: string): string; + /** Removes whitespace from the left end of a string. */ + trimLeft(): string; + /** Removes whitespace from the right end of a string. */ + trimRight(): string; +} + /************************************************ * * * GLOBAL * diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 41639e52c6..34bba1f7ba 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -3751,3 +3751,27 @@ namespace module_tests { const m1: Module = new Module("moduleId"); const m2: Module = new Module.Module("moduleId"); } + +//////////////////////////////////////////////////// +/// Node.js ES2017 Support +//////////////////////////////////////////////////// + +namespace es2017_tests { + const s: string = 'foo'; + const s1: string = s.padStart(); + const s11: string = s.padStart(10); + const s12: string = s.padStart(10, 'x'); + const s2: string = s.padEnd(); + const s21: string = s.padEnd(10); + const s22: string = s.padEnd(10, 'x'); +} + +//////////////////////////////////////////////////// +/// Node.js ESNEXT Support +//////////////////////////////////////////////////// + +namespace esnext_tests { + const s: string = 'foo'; + const s1: string = s.trimLeft(); + const s2: string = s.trimRight(); +} From d2cc016dcb1a6453d7c50eff1d874468347569f2 Mon Sep 17 00:00:00 2001 From: Josh McCullough Date: Fri, 17 Nov 2017 23:35:00 -0500 Subject: [PATCH 021/269] [fb] add FB Live UI dialog options/response; cleanup ui() functions --- types/fb/index.d.ts | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/types/fb/index.d.ts b/types/fb/index.d.ts index a968d9f3c0..d48aedee8a 100644 --- a/types/fb/index.d.ts +++ b/types/fb/index.d.ts @@ -83,12 +83,20 @@ interface FeedDialogParams { ref?: any; } -declare type FBUIParams = ShareDialogParams - | PageTabDialogParams - | RequestsDialogParams - | SendDialogParams - | PayDialogParams - | FeedDialogParams; +interface LiveDialogParams { + redirect_uri?: string; + method: string; + display: string; + phase: string; + broadcast_data?: LiveDialogResponse; +} + +interface LiveDialogResponse { + id: string; + stream_url: string; + secure_stream_url: string; + status: string; +} interface FBLoginOptions{ auth_type?: string; @@ -201,8 +209,14 @@ interface FBSDK{ api(path: string, params: any, callback: (response: any) => void): void; api(path: string, method: ApiMethod, params: any, callback: (response: any) => void): void; - /* This method is used to trigger different forms of Facebook created UI dialogs. */ - ui(params : FBUIParams, handler : (fbResponseObject : Object) => any) : void; + /* These methods are used to trigger different forms of Facebook-created UI dialogs. */ + ui(params : ShareDialogParams, handler : (fbResponseObject : Object) => any) : void; + ui(params : PageTabDialogParams, handler : (fbResponseObject : Object) => any) : void; + ui(params : RequestsDialogParams, handler : (fbResponseObject : Object) => any) : void; + ui(params : SendDialogParams, handler : (fbResponseObject : Object) => any) : void; + ui(params : PayDialogParams, handler : (fbResponseObject : Object) => any) : void; + ui(params : FeedDialogParams, handler : (fbResponseObject : Object) => any) : void; + ui(params : LiveDialogParams, handler : (fbResponseObject : LiveDialogResponse) => any) : void; /* Allows you to determine if a user is logged in to Facebook and has authenticated your app */ getLoginStatus(handler : (fbResponseObject : FB.LoginStatusResponse) => any, force?: Boolean) : void; From 5054ffa5fea764ffff210e801e130c4deaab84f5 Mon Sep 17 00:00:00 2001 From: benny-medflyt Date: Sat, 18 Nov 2017 12:26:33 +0200 Subject: [PATCH 022/269] Client constructor still accepts a string --- types/pg/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 68fba5fb40..47d3abc4cf 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -93,7 +93,7 @@ export class Pool extends events.EventEmitter { } export class Client extends events.EventEmitter { - constructor(config: ClientConfig); + constructor(config: string | ClientConfig); connect(): Promise; connect(callback: (err: Error) => void): void; From 10e05d7aa22d48fdef923483120749d1fb168e65 Mon Sep 17 00:00:00 2001 From: Peter Bartha Date: Sat, 18 Nov 2017 20:07:33 +0100 Subject: [PATCH 023/269] Add 'setSelections' to CodeMirror --- types/codemirror/index.d.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index 126eafe013..45e503e068 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -105,9 +105,9 @@ declare namespace CodeMirror { function signal(target: any, name: string, ...args: any[]): void; type DOMEvent = 'mousedown' | 'dblclick' | 'touchstart' | 'contextmenu' | 'keydown' | 'keypress' | 'keyup' | 'cut' | 'copy' | 'paste' | 'dragstart' | 'dragenter' | 'dragover' | 'dragleave' | 'drop'; - + type CoordsMode = 'window' | 'page' | 'local'; - + interface Token { /** The character(on the given line) at which the token starts. */ start: number; @@ -202,10 +202,10 @@ declare namespace CodeMirror { /** Compute the line at the given pixel height. mode is the relative element to use to compute this line, it may be "window", "page" (the default), or "local" */ lineAtHeight(height: number, mode?: CoordsMode): number; - - /** Computes the height of the top of a line, in the coordinate system specified by mode, it may be "window", - "page" (the default), or "local". When a line below the bottom of the document is specified, the returned value - is the bottom of the last line in the document. By default, the position of the actual text is returned. + + /** Computes the height of the top of a line, in the coordinate system specified by mode, it may be "window", + "page" (the default), or "local". When a line below the bottom of the document is specified, the returned value + is the bottom of the last line in the document. By default, the position of the actual text is returned. If includeWidgets is true and the line has line widgets, the position above the first line widget is returned. */ heightAtLine(line: any, mode?: CoordsMode, includeWidgets?: boolean): number; @@ -292,7 +292,7 @@ declare namespace CodeMirror { charCoords(pos: CodeMirror.Position, mode?: CoordsMode): { left: number; right: number; top: number; bottom: number; }; /** Given an { left , top } object , returns the { line , ch } position that corresponds to it. - The optional mode parameter determines relative to what the coordinates are interpreted. + The optional mode parameter determines relative to what the coordinates are interpreted. It may be "window", "page" (the default), or "local". */ coordsChar(object: { left: number; top: number; }, mode?: CoordsMode): CodeMirror.Position; @@ -512,7 +512,7 @@ declare namespace CodeMirror { /** Get the currently selected code. */ getSelection(): string; - + /** Returns an array containing a string for each selection, representing the content of the selections. */ getSelections(lineSep?: string): Array; @@ -538,6 +538,9 @@ declare namespace CodeMirror { /** Set the selection range.anchor and head should be { line , ch } objects.head defaults to anchor when not given. */ setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position): void; + /** Set and normalize selection ranges and range should be { anchor, head } objects. primary determines which selection is the primary one. */ + setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number): void; + /** Similar to setSelection , but will, if shift is held or the extending flag is set, move the head of the selection while leaving the anchor at its current place. pos2 is optional , and can be passed to ensure a region (for example a word or paragraph) will end up selected @@ -779,7 +782,7 @@ declare namespace CodeMirror { /** Determines whether the gutter scrolls along with the content horizontally (false) or whether it stays fixed during horizontal scrolling (true, the default). */ fixedGutter?: boolean; - + /** * Chooses a scrollbar implementation. The default is "native", showing native scrollbars. The core library also * provides the "null" style, which completely hides the scrollbars. Addons can implement additional scrollbar models. From cfbd9b0edc53c39b3cca07e1b081a46704a7820f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Sat, 18 Nov 2017 22:47:57 +0100 Subject: [PATCH 024/269] Updated the react-virtualized MultiGrid props According to the docs, these are all optional: https://github.com/bvaughn/react-virtualized/blob/master/docs/MultiGrid.md --- .../react-virtualized/dist/es/MultiGrid.d.ts | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/types/react-virtualized/dist/es/MultiGrid.d.ts b/types/react-virtualized/dist/es/MultiGrid.d.ts index 1bb8b7dfac..96c33e3bed 100644 --- a/types/react-virtualized/dist/es/MultiGrid.d.ts +++ b/types/react-virtualized/dist/es/MultiGrid.d.ts @@ -2,13 +2,19 @@ import { PureComponent, Validator, Requireable } from 'react' import { GridProps } from './Grid' export type MultiGridProps = { - fixedColumnCount: number; - fixedRowCount: number; - style: React.CSSProperties; - styleBottomLeftGrid: React.CSSProperties; - styleBottomRightGrid: React.CSSProperties; - styleTopLeftGrid: React.CSSProperties; - styleTopRightGrid: React.CSSProperties; + classNameBottomLeftGrid?: string; + classNameBottomRightGrid?: string; + classNameTopLeftGrid?: string; + classNameTopRightGrid?: string; + enableFixedColumnScroll?: boolean; + enableFixedRowScroll?: boolean; + fixedColumnCount?: number; + fixedRowCount?: number; + style?: React.CSSProperties; + styleBottomLeftGrid?: React.CSSProperties; + styleBottomRightGrid?: React.CSSProperties; + styleTopLeftGrid?: React.CSSProperties; + styleTopRightGrid?: React.CSSProperties; } & GridProps; export type MultiGridState = { @@ -25,6 +31,12 @@ export type MultiGridState = { */ export class MultiGrid extends PureComponent { static propTypes: { + classNameBottomLeftGrid: Validator, + classNameBottomRightGrid: Validator, + classNameTopLeftGrid: Validator, + classNameTopRightGrid: Validator, + enableFixedColumnScroll: Validator, + enableFixedRowScroll: Validator, fixedColumnCount: Validator, fixedRowCount: Validator, style: Validator, @@ -35,6 +47,12 @@ export class MultiGrid extends PureComponent { }; static defaultProps: { + classNameBottomLeftGrid: '', + classNameBottomRightGrid: '', + classNameTopLeftGrid: '', + classNameTopRightGrid: '', + enableFixedColumnScroll: false, + enableFixedRowScroll: false, fixedColumnCount: 0, fixedRowCount: 0, style: {}, From bfc83b18f3cc85a7284533addb6c073762194759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Sat, 18 Nov 2017 23:09:36 +0100 Subject: [PATCH 025/269] Added myself to the definitions by --- types/react-virtualized/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-virtualized/index.d.ts b/types/react-virtualized/index.d.ts index 12febb7edf..f53be447d9 100644 --- a/types/react-virtualized/index.d.ts +++ b/types/react-virtualized/index.d.ts @@ -4,6 +4,7 @@ // John Gunther // Konstantin Nesterov // Szőke Szabolcs +// Kræn Hansen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From efcfa2916364b838ebfbedf6bd16fecf926c3780 Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Sat, 18 Nov 2017 22:49:43 -0500 Subject: [PATCH 026/269] Fix the remaining strictFunctionTypes issues --- types/lodash/index.d.ts | 178 ++++++++++++++++++++++------------- types/lodash/lodash-tests.ts | 103 ++++---------------- 2 files changed, 131 insertions(+), 150 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index fafa7f6b5c..5be5358b4b 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -1234,7 +1234,7 @@ declare namespace _ { */ findIndex( array: List | null | undefined, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): number; } @@ -1245,7 +1245,7 @@ declare namespace _ { */ findIndex( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): number; } @@ -1256,7 +1256,7 @@ declare namespace _ { */ findIndex( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; } @@ -1282,7 +1282,7 @@ declare namespace _ { */ findLastIndex( array: List | null | undefined, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): number; } @@ -1293,7 +1293,7 @@ declare namespace _ { */ findLastIndex( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): number; } @@ -1304,7 +1304,7 @@ declare namespace _ { */ findLastIndex( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; } @@ -4315,6 +4315,14 @@ declare namespace _ { * @param thisArg The this binding of iteratee. * @return Returns the composed aggregate object. */ + countBy( + collection: string | null | undefined, + iteratee?: StringIterator + ): Dictionary; + + /** + * @see _.countBy + */ countBy( collection: List | null | undefined, iteratee?: ListIteratee @@ -4338,6 +4346,14 @@ declare namespace _ { } interface LoDashImplicitWrapper { + /** + * @see _.countBy + */ + countBy( + this: LoDashImplicitWrapper, + iteratee?: StringIterator + ): LoDashImplicitWrapper>; + /** * @see _.countBy */ @@ -4364,6 +4380,14 @@ declare namespace _ { } interface LoDashExplicitWrapper { + /** + * @see _.countBy + */ + countBy( + this: LoDashExplicitWrapper, + iteratee?: StringIterator + ): LoDashExplicitWrapper>; + /** * @see _.countBy */ @@ -4479,7 +4503,7 @@ declare namespace _ { */ every( collection: List | null | undefined, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): boolean; /** @@ -4487,7 +4511,7 @@ declare namespace _ { */ every( collection: NumericDictionary | null | undefined, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): boolean; /** @@ -4495,7 +4519,7 @@ declare namespace _ { */ every( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): boolean; } @@ -4505,7 +4529,7 @@ declare namespace _ { */ every( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): boolean; /** @@ -4513,7 +4537,7 @@ declare namespace _ { */ every( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): boolean; /** @@ -4521,7 +4545,7 @@ declare namespace _ { */ every( this: LoDashImplicitWrapper | null | undefined>, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): boolean; } @@ -4531,7 +4555,7 @@ declare namespace _ { */ every( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashExplicitWrapper; /** @@ -4539,7 +4563,7 @@ declare namespace _ { */ every( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashExplicitWrapper; /** @@ -4547,7 +4571,7 @@ declare namespace _ { */ every( this: LoDashExplicitWrapper | null | undefined>, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): LoDashExplicitWrapper; } @@ -4589,7 +4613,7 @@ declare namespace _ { */ filter( collection: List | null | undefined, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): T[]; /** @@ -4605,7 +4629,7 @@ declare namespace _ { */ filter( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): Array; } @@ -4631,7 +4655,7 @@ declare namespace _ { */ filter( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashImplicitWrapper; /** @@ -4647,7 +4671,7 @@ declare namespace _ { */ filter( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashImplicitWrapper>; } @@ -4673,7 +4697,7 @@ declare namespace _ { */ filter( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashExplicitWrapper; /** @@ -4689,7 +4713,7 @@ declare namespace _ { */ filter( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashExplicitWrapper>; } @@ -4724,7 +4748,7 @@ declare namespace _ { */ find( collection: List | null | undefined, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): T|undefined; @@ -4742,7 +4766,7 @@ declare namespace _ { */ find( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): T[keyof T]|undefined; } @@ -4762,7 +4786,7 @@ declare namespace _ { */ find( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): T|undefined; @@ -4780,7 +4804,7 @@ declare namespace _ { */ find( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): T[keyof T]|undefined; } @@ -4800,7 +4824,7 @@ declare namespace _ { */ find( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; @@ -4818,7 +4842,7 @@ declare namespace _ { */ find( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; } @@ -4844,7 +4868,7 @@ declare namespace _ { */ findLast( collection: List | null | undefined, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): T|undefined; @@ -4862,7 +4886,7 @@ declare namespace _ { */ findLast( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): T[keyof T]|undefined; } @@ -4882,7 +4906,7 @@ declare namespace _ { */ findLast( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): T | undefined; @@ -4900,7 +4924,7 @@ declare namespace _ { */ findLast( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): T[keyof T]|undefined; } @@ -4920,7 +4944,7 @@ declare namespace _ { */ findLast( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean, + predicate?: ListIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; @@ -4938,7 +4962,7 @@ declare namespace _ { */ findLast( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean, + predicate?: ObjectIterateeCustom, fromIndex?: number ): LoDashExplicitWrapper; } @@ -5849,9 +5873,17 @@ declare namespace _ { * @param thisArg The this binding of iteratee. * @return Returns the composed aggregate object. */ + keyBy( + collection: string | null | undefined, + iteratee?: StringIterator + ): Dictionary; + + /** + * @see _.keyBy + */ keyBy( collection: List | null | undefined, - iteratee?: ListIteratee + iteratee?: ListIterateeCustom ): Dictionary; /** @@ -5859,7 +5891,7 @@ declare namespace _ { */ keyBy( collection: T | null | undefined, - iteratee?: ObjectIteratee + iteratee?: ObjectIterateeCustom ): Dictionary; /** @@ -5867,17 +5899,25 @@ declare namespace _ { */ keyBy( collection: NumericDictionary | null | undefined, - iteratee?: NumericDictionaryIteratee + iteratee?: NumericDictionaryIterateeCustom ): Dictionary; } interface LoDashImplicitWrapper { + /** + * @see _.keyBy + */ + keyBy( + this: LoDashImplicitWrapper, + iteratee?: StringIterator + ): LoDashImplicitWrapper>; + /** * @see _.keyBy */ keyBy( this: LoDashImplicitWrapper | null | undefined>, - iteratee?: ListIteratee + iteratee?: ListIterateeCustom ): LoDashImplicitWrapper>; /** @@ -5885,7 +5925,7 @@ declare namespace _ { */ keyBy( this: LoDashImplicitWrapper, - iteratee?: ObjectIteratee + iteratee?: ObjectIterateeCustom ): LoDashImplicitWrapper>; /** @@ -5893,17 +5933,25 @@ declare namespace _ { */ keyBy( this: LoDashImplicitWrapper | null | undefined>, - iteratee?: NumericDictionaryIteratee + iteratee?: NumericDictionaryIterateeCustom ): LoDashImplicitWrapper>; } interface LoDashExplicitWrapper { + /** + * @see _.keyBy + */ + keyBy( + this: LoDashExplicitWrapper, + iteratee?: StringIterator + ): LoDashExplicitWrapper>; + /** * @see _.keyBy */ keyBy( this: LoDashExplicitWrapper | null | undefined>, - iteratee?: ListIteratee + iteratee?: ListIterateeCustom ): LoDashExplicitWrapper>; /** @@ -5911,7 +5959,7 @@ declare namespace _ { */ keyBy( this: LoDashExplicitWrapper, - iteratee?: ObjectIteratee + iteratee?: ObjectIterateeCustom ): LoDashExplicitWrapper>; /** @@ -5919,7 +5967,7 @@ declare namespace _ { */ keyBy( this: LoDashExplicitWrapper | null | undefined>, - iteratee?: NumericDictionaryIteratee + iteratee?: NumericDictionaryIterateeCustom ): LoDashExplicitWrapper>; } @@ -6718,7 +6766,7 @@ declare namespace _ { */ reject( collection: List | null | undefined, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): T[]; /** @@ -6726,7 +6774,7 @@ declare namespace _ { */ reject( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): Array; } @@ -6744,7 +6792,7 @@ declare namespace _ { */ reject( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashImplicitWrapper; /** @@ -6752,7 +6800,7 @@ declare namespace _ { */ reject( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashImplicitWrapper>; } @@ -6770,7 +6818,7 @@ declare namespace _ { */ reject( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashExplicitWrapper; /** @@ -6778,7 +6826,7 @@ declare namespace _ { */ reject( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashExplicitWrapper>; } @@ -6992,7 +7040,7 @@ declare namespace _ { */ some( collection: List | null | undefined, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): boolean; /** @@ -7000,7 +7048,7 @@ declare namespace _ { */ some( collection: T | null | undefined, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): boolean; /** @@ -7008,7 +7056,7 @@ declare namespace _ { */ some( collection: NumericDictionary | null | undefined, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): boolean; } @@ -7018,7 +7066,7 @@ declare namespace _ { */ some( this: LoDashImplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): boolean; /** @@ -7026,7 +7074,7 @@ declare namespace _ { */ some( this: LoDashImplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): boolean; /** @@ -7034,7 +7082,7 @@ declare namespace _ { */ some( this: LoDashImplicitWrapper | null | undefined>, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): boolean; } @@ -7044,7 +7092,7 @@ declare namespace _ { */ some( this: LoDashExplicitWrapper | null | undefined>, - predicate?: ListIterateeBoolean + predicate?: ListIterateeCustom ): LoDashExplicitWrapper; /** @@ -7052,7 +7100,7 @@ declare namespace _ { */ some( this: LoDashExplicitWrapper, - predicate?: ObjectIterateeBoolean + predicate?: ObjectIterateeCustom ): LoDashExplicitWrapper; /** @@ -7060,7 +7108,7 @@ declare namespace _ { */ some( this: LoDashExplicitWrapper | null | undefined>, - predicate?: NumericDictionaryIterateeBoolean + predicate?: NumericDictionaryIterateeCustom ): LoDashExplicitWrapper; } @@ -9315,14 +9363,16 @@ declare namespace _ { /** * @see _.conformsTo */ - conformsTo(source: ConformsPredicateObject): boolean; + conformsTo(this: LoDashImplicitWrapper, source: ConformsPredicateObject): boolean; + // Note: we can't use TValue here, because it generates a typescript error when strictFunctionTypes is enabled. } interface LoDashExplicitWrapper { /** * @see _.conformsTo */ - conformsTo(source: ConformsPredicateObject): LoDashExplicitWrapper; + conformsTo(this: LoDashImplicitWrapper, source: ConformsPredicateObject): LoDashExplicitWrapper; + // Note: we can't use TValue here, because it generates a typescript error when strictFunctionTypes is enabled. } type CondPair = [(val: T) => boolean, (val: T) => R] @@ -10723,7 +10773,7 @@ declare namespace _ { /** * @see _.toArray */ - //toArray(): LoDashImplicitWrapper>; + toArray(this: LoDashImplicitWrapper): LoDashImplicitWrapper>; } interface LoDashExplicitWrapper { @@ -10735,7 +10785,7 @@ declare namespace _ { /** * @see _.toArray */ - //toArray(): LoDashExplicitWrapper>; + toArray(this: LoDashImplicitWrapper): LoDashExplicitWrapper>; } //_.toPlainObject @@ -17019,13 +17069,13 @@ declare namespace _ { type ArrayIterator = (value: T, index: number, collection: T[]) => TResult; type ListIterator = (value: T, index: number, collection: List) => TResult; type ListIteratee = ListIterator | string | [string, any] | PartialDeep; - type ListIterateeBoolean = ListIterator | string | [string, any] | PartialDeep; + type ListIterateeCustom = ListIterator | string | [string, any] | PartialDeep; type ListIteratorTypeGuard = (value: T, index: number, collection: List) => value is S; // Note: key should be string, not keyof T, because the actual object may contain extra properties that were not specified in the type. type ObjectIterator = (value: TObject[keyof TObject], key: string, collection: TObject) => TResult; type ObjectIteratee = ObjectIterator | string | [string, any] | PartialDeep; - type ObjectIterateeBoolean = ObjectIterator | string | [string, any] | PartialDeep; + type ObjectIterateeCustom = ObjectIterator | string | [string, any] | PartialDeep; type ObjectIteratorTypeGuard = (value: TObject[keyof TObject], key: string, collection: TObject) => value is S; type DictionaryIterator = ObjectIterator, TResult>; @@ -17034,7 +17084,7 @@ declare namespace _ { type NumericDictionaryIterator = (value: T, key: number, collection: NumericDictionary) => TResult; type NumericDictionaryIteratee = NumericDictionaryIterator | string | [string, any] | PartialDeep; - type NumericDictionaryIterateeBoolean = NumericDictionaryIterator | string | [string, any] | PartialDeep; + type NumericDictionaryIterateeCustom = NumericDictionaryIterator | string | [string, any] | PartialDeep; type StringIterator = (char: string, index: number, string: string) => TResult; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index e40569204d..cca7c239c7 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -4,86 +4,19 @@ interface IFoodOrganic { name: string; organic: boolean; } - -interface IFoodType { - name: string; - type: string; -} - -interface IFoodCombined { - name: string; - organic: boolean; - type: string; -} - -interface IStoogesQuote { - name: string; - quotes: string[]; -} - interface IStoogesAge { name: string; age: number; } -interface IStoogesCombined { - name: string; - age: number; - quotes: string[]; -} - -interface IKey { - dir: string; - code: number; -} - -interface IDictionary { - [index: string]: T; -} - const foodsOrganic: IFoodOrganic[] = [ { name: 'banana', organic: true }, { name: 'beet', organic: false }, ]; -const foodsType: IFoodType[] = [ - { name: 'apple', type: 'fruit' }, - { name: 'banana', type: 'fruit' }, - { name: 'beet', type: 'vegetable' } -]; -const foodsCombined: IFoodCombined[] = [ - { 'name': 'apple', 'organic': false, 'type': 'fruit' }, - { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } -]; - -const stoogesQuotes: IStoogesQuote[] = [ - { 'name': 'curly', 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, - { 'name': 'moe', 'quotes': ['Spread out!', 'You knucklehead!'] } -]; const stoogesAges: IStoogesAge[] = [ { 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 } ]; -const stoogesAgesDict: IDictionary = { - first: { 'name': 'moe', 'age': 40 }, - second: { 'name': 'larry', 'age': 50 } -}; -const stoogesCombined: IStoogesCombined[] = [ - { 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, - { 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] } -]; - -const keys: IKey[] = [ - { 'dir': 'left', 'code': 97 }, - { 'dir': 'right', 'code': 100 } -]; - -class Dog { - constructor(public name: string) { } - - bark() { - // Woof - } -} let result: any; @@ -4591,9 +4524,9 @@ namespace TestFilter { let obj: any = {}; let dictionary: _.Dictionary | null | undefined = obj; - let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; - let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; + let stringIterator = (char: string, index: number, string: string) => true; + let listIterator = (value: TResult, index: number, collection: _.List) => true; + let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary) => true; { let result: string[]; @@ -5207,7 +5140,7 @@ namespace TestFlatMapDepth { let listIterator: (value: number|number[], index: number, collection: _.List) => _.ListOfRecursiveArraysOrValues = (a, b, c) =>[ 1]; - let dictionaryIterator: (value: number|number[], key: number, collection: _.Dictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; + let dictionaryIterator: (value: number|number[], key: string, collection: _.Dictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; let numericDictionaryIterator: (value: number|number[], key: number, collection: _.NumericDictionary) => _.ListOfRecursiveArraysOrValues = (a, b, c) => [1]; @@ -5776,8 +5709,8 @@ namespace TestGroupBy { { let result: _.Dictionary; - result = _.groupBy(''); - result = _.groupBy('', stringIterator); + result = _.groupBy(''); + result = _.groupBy('', stringIterator); } { @@ -5909,16 +5842,16 @@ namespace TestKeyBy { let dictionary: _.Dictionary | null | undefined = obj; let numericDictionary: _.NumericDictionary | null | undefined = obj; - let stringIterator: (value: string, index: number, collection: string) => any = (value: string, index: number, collection: string) => 1; - let listIterator: (value: SampleObject, index: number, collection: _.List) => any = (value: SampleObject, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: SampleObject, key: string, collection: _.Dictionary) => any = (value: SampleObject, key: string, collection: _.Dictionary) => 1; - let numericDictionaryIterator: (value: SampleObject, key: number, collection: _.NumericDictionary) => any = (value: SampleObject, key: number, collection: _.NumericDictionary) => 1; + let stringIterator = (value: string, index: number, collection: string) => "a"; + let listIterator = (value: SampleObject, index: number, collection: _.List) => 1; + let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => Symbol.name; + let numericDictionaryIterator = (value: SampleObject, key: number, collection: _.NumericDictionary) => "a"; { let result: _.Dictionary; - result = _.keyBy('abcd'); - result = _.keyBy('abcd', stringIterator); + result = _.keyBy('abcd'); + result = _.keyBy('abcd', stringIterator); } { @@ -6464,9 +6397,9 @@ namespace TestReject { let obj: any = {}; let dictionary: _.Dictionary | null | undefined = obj; - let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; - let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; + let stringIterator = (char: string, index: number, string: string) => true; + let listIterator = (value: TResult, index: number, collection: _.List) => true; + let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary) => true; { let result: string[]; @@ -8667,9 +8600,7 @@ namespace TestIsEqual { // _.isEqualWith namespace TestIsEqualWith { - let customizer = (value: any, other: any, indexOrKey: number|string|undefined, parent: any, otherParent: any, stack: any) => { - return value ? undefined : true; - }; + let customizer = (value: any, other: any, indexOrKey: number|string|symbol|undefined, parent: any, otherParent: any, stack: any) => true; { let result: boolean; @@ -8873,7 +8804,7 @@ namespace TestIsMatch { // _.isMatchWith namespace TestIsMatchWith { - let testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string) => true; + let testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string|symbol) => true; let result: boolean; From a8408bce17669bd6bb0516890347dea6cf0c1578 Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Sat, 18 Nov 2017 22:57:55 -0500 Subject: [PATCH 027/269] lodash: revert back to old constant types. The old types seem to work again, so no need to use the workaround. --- types/lodash/index.d.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 5be5358b4b..a19f4aa4a1 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -16128,18 +16128,14 @@ declare namespace _ { /** * @see _.constant */ - constant(this: LoDashImplicitWrapper): LoDashImplicitWrapper<() => T>; - // Note: we can't use TValue here because of an issue with dtslint. Using T as a workaround; change back to TValue once dtsLint is working. - // constant(): LoDashImplicitWrapper<() => TValue>; + constant(): LoDashImplicitWrapper<() => TValue>; } interface LoDashExplicitWrapper { /** * @see _.constant */ - constant(this: LoDashExplicitWrapper): LoDashExplicitWrapper<() => T>; - // Note: we can't use TValue here because of an issue with dtslint. Using T as a workaround; change back to TValue once dtsLint is working. - // constant(): LoDashExplicitWrapper<() => TValue>; + constant(): LoDashExplicitWrapper<() => TValue>; } //_.defaultTo From 1cdafc0a77f60f27d0b241472a0f7afe64637fd2 Mon Sep 17 00:00:00 2001 From: Cyrille Tuzi Date: Sun, 19 Nov 2017 12:25:19 +0100 Subject: [PATCH 028/269] Add types for JSON Schema v6 --- types/json-schema/index.d.ts | 353 ++++++++++++++++++++++--- types/json-schema/json-schema-tests.ts | 96 ++++++- types/json-schema/tslint.json | 7 +- 3 files changed, 399 insertions(+), 57 deletions(-) diff --git a/types/json-schema/index.d.ts b/types/json-schema/index.d.ts index 016db75a25..063e11d0f0 100644 --- a/types/json-schema/index.d.ts +++ b/types/json-schema/index.d.ts @@ -1,21 +1,21 @@ -// Type definitions for json-schema 4.0 +// Type definitions for json-schema 4.0 and 6.0 // Project: https://www.npmjs.com/package/json-schema -// Definitions by: Boris Cherny +// Definitions by: Boris Cherny , Cyrille Tuzi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.6 -/// +/* JSON Schema 4 */ /** * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1 */ export type JSONSchema4TypeName = 'string' | 'number' | 'integer' | 'boolean' - | 'object' | 'array' | 'null' | 'any' + | 'object' | 'array' | 'null' | 'any'; /** * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5 */ -export type JSONSchema4Type = any[] | boolean | number | null | object | string +export type JSONSchema4Type = any[] | boolean | number | null | object | string; /** * JSON Schema V4 @@ -27,7 +27,7 @@ export interface JSONSchema4 { $schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | 'http://json-schema.org/draft-04/schema#' | 'http://json-schema.org/draft-04/hyper-schema#' | 'http://json-schema.org/draft-03/schema#' | 'http://json-schema.org/draft-03/hyper-schema#' - | string + | string; /** * This attribute is a string that provides a short description of the @@ -35,7 +35,7 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21 */ - title?: string + title?: string; /** * This attribute is a string that provides a full description of the of @@ -43,17 +43,17 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22 */ - description?: string + description?: string; - default?: JSONSchema4Type - multipleOf?: number - maximum?: number - exclusiveMaximum?: boolean - minimum?: number - exclusiveMinimum?: boolean - maxLength?: number - minLength?: number - pattern?: string + default?: JSONSchema4Type; + multipleOf?: number; + maximum?: number; + exclusiveMaximum?: boolean; + minimum?: number; + exclusiveMinimum?: boolean; + maxLength?: number; + minLength?: number; + pattern?: string; /** * May only be defined when "items" is defined, and is a tuple of JSONSchemas. @@ -65,7 +65,7 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6 */ - additionalItems?: boolean | JSONSchema4 + additionalItems?: boolean | JSONSchema4; /** * This attribute defines the allowed items in an instance array, and @@ -86,13 +86,13 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5 */ - items?: JSONSchema4 | JSONSchema4[] + items?: JSONSchema4 | JSONSchema4[]; - maxItems?: number - minItems?: number - uniqueItems?: boolean - maxProperties?: number - minProperties?: number + maxItems?: number; + minItems?: number; + uniqueItems?: boolean; + maxProperties?: number; + minProperties?: number; /** * This attribute indicates if the instance must have a value, and not @@ -101,7 +101,7 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7 */ - required?: false | string[] + required?: false | string[]; /** * This attribute defines a schema for all properties that are not @@ -113,10 +113,10 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4 */ - additionalProperties?: boolean | JSONSchema4 + additionalProperties?: boolean | JSONSchema4; definitions?: { - [k: string]: JSONSchema4 + [k: string]: JSONSchema4; } /** @@ -133,7 +133,7 @@ export interface JSONSchema4 { * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2 */ properties?: { - [k: string]: JSONSchema4 + [k: string]: JSONSchema4; } /** @@ -148,10 +148,10 @@ export interface JSONSchema4 { * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3 */ patternProperties?: { - [k: string]: JSONSchema4 + [k: string]: JSONSchema4; } dependencies?: { - [k: string]: JSONSchema4 | string[] + [k: string]: JSONSchema4 | string[]; } /** @@ -163,17 +163,17 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19 */ - enum?: JSONSchema4Type[] + enum?: JSONSchema4Type[]; /** * A single type, or a union of simple types */ - type?: JSONSchema4TypeName | JSONSchema4TypeName[] + type?: JSONSchema4TypeName | JSONSchema4TypeName[]; - allOf?: JSONSchema4[] - anyOf?: JSONSchema4[] - oneOf?: JSONSchema4[] - not?: JSONSchema4 + allOf?: JSONSchema4[]; + anyOf?: JSONSchema4[]; + oneOf?: JSONSchema4[]; + not?: JSONSchema4; /** * The value of this property MUST be another schema which will provide @@ -191,10 +191,285 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26 */ - extends?: string | string[] + extends?: string | string[]; /** * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6 */ - [k: string]: any + [k: string]: any; +} + +/* JSON Schema 6 */ + +export type JSONSchema6TypeName = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null' | 'any'; + +export type JSONSchema6Type = any[] | boolean | number | null | object | string; + +/** +* JSON Schema V6 +* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01 +*/ +export interface JSONSchema6 { + + $id?: string; + $ref?: string; + $schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | + 'http://json-schema.org/draft-06/schema#' | 'http://json-schema.org/draft-06/hyper-schema#'; + + /** + * Must be strictly greater than 0. + * A numeric instance is valid only if division by this keyword's value results in an integer. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1 + */ + multipleOf?: number; + + /** + * Representing an inclusive upper limit for a numeric instance. + * This keyword validates only if the instance is less than or exactly equal to "maximum". + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2 + */ + maximum?: number; + + /** + * Representing an exclusive upper limit for a numeric instance. + * This keyword validates only if the instance is strictly less than (not equal to) to "exclusiveMaximum". + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3 + */ + exclusiveMaximum?: number; + + /** + * Representing an inclusive lower limit for a numeric instance. + * This keyword validates only if the instance is greater than or exactly equal to "minimum". + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4 + */ + minimum?: number; + + /** + * Representing an exclusive lower limit for a numeric instance. + * This keyword validates only if the instance is strictly greater than (not equal to) to "exclusiveMinimum". + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5 + */ + exclusiveMinimum?: number; + + /** + * Must be a non-negative integer. + * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6 + */ + maxLength?: number; + + /** + * Must be a non-negative integer. + * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. + * Omitting this keyword has the same behavior as a value of 0. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7 + */ + minLength?: number; + + /** + * Should be a valid regular expression, according to the ECMA 262 regular expression dialect. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8 + */ + pattern?: string; + + /** + * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. + * Omitting this keyword has the same behavior as an empty schema. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9 + */ + items?: boolean | JSONSchema6 | JSONSchema6[]; + + /** + * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. + * If "items" is an array of schemas, validation succeeds if every instance element + * at a position greater than the size of "items" validates against "additionalItems". + * Otherwise, "additionalItems" MUST be ignored, as the "items" schema + * (possibly the default value of an empty schema) is applied to all elements. + * Omitting this keyword has the same behavior as an empty schema. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10 + */ + additionalItems?: boolean | JSONSchema6; + + /** + * Must be a non-negative integer. + * An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11 + */ + maxItems?: number; + + /** + * Must be a non-negative integer. + * An array instance is valid against "maxItems" if its size is greater than, or equal to, the value of this keyword. + * Omitting this keyword has the same behavior as a value of 0. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12 + */ + minItems?: number; + + /** + * If this keyword has boolean value false, the instance validates successfully. + * If it has boolean value true, the instance validates successfully if all of its elements are unique. + * Omitting this keyword has the same behavior as a value of false. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13 + */ + uniqueItems?: boolean; + + /** + * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14 + */ + contains?: boolean | JSONSchema6; + + /** + * Must be a non-negative integer. + * An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15 + */ + maxProperties?: number; + + /** + * Must be a non-negative integer. + * An object instance is valid against "maxProperties" if its number of properties is greater than, + * or equal to, the value of this keyword. + * Omitting this keyword has the same behavior as a value of 0. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16 + */ + minProperties?: number; + + /** + * Elements of this array must be unique. + * An object instance is valid against this keyword if every item in the array is the name of a property in the instance. + * Omitting this keyword has the same behavior as an empty array. + * + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17 + */ + required?: string[]; + + /** + * This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. + * Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value, + * the child instance for that name successfully validates against the corresponding schema. + * Omitting this keyword has the same behavior as an empty object. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18 + */ + properties?: { + [k: string]: boolean | JSONSchema6 + }; + + /** + * This attribute is an object that defines the schema for a set of property names of an object instance. + * The name of each property of this attribute's object is a regular expression pattern in the ECMA 262, while the value is a schema. + * If the pattern matches the name of a property on the instance object, the value of the instance's property + * MUST be valid against the pattern name's schema value. + * Omitting this keyword has the same behavior as an empty object. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19 + */ + patternProperties?: { + [k: string]: boolean | JSONSchema6 + }; + + /** + * This attribute defines a schema for all properties that are not explicitly defined in an object type definition. + * If specified, the value MUST be a schema or a boolean. + * If false is provided, no additional properties are allowed beyond the properties defined in the schema. + * The default value is an empty schema which allows any value for additional properties. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20 + */ + additionalProperties?: boolean | JSONSchema6; + + /** + * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. + * Each property specifies a dependency. + * If the dependency value is an array, each element in the array must be unique. + * Omitting this keyword has the same behavior as an empty object. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21 + */ + dependencies?: { + [k: string]: boolean | JSONSchema6 | string[] + }; + + /** + * Takes a schema which validates the names of all properties rather than their values. + * Note the property name that the schema is testing will always be a string. + * Omitting this keyword has the same behavior as an empty schema. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22 + */ + propertyNames?: boolean | JSONSchema6; + + /** + * This provides an enumeration of all possible values that are valid + * for the instance property. This MUST be an array, and each item in + * the array represents a possible value for the instance value. If + * this attribute is defined, the instance value MUST be one of the + * values in the array in order for the schema to be valid. + * + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23 + */ + enum?: JSONSchema6Type[]; + + /** + * More readible form of a one-element "enum" + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24 + */ + const?: JSONSchema6Type; + + /** + * A single type, or a union of simple types + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25 + */ + type?: JSONSchema6TypeName | JSONSchema6TypeName[]; + + /** + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26 + */ + allOf?: JSONSchema6[]; + + /** + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27 + */ + anyOf?: JSONSchema6[]; + + /** + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28 + */ + oneOf?: JSONSchema6[]; + + /** + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29 + */ + not?: boolean | JSONSchema6; + + /** + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1 + */ + definitions?: { + [k: string]: boolean | JSONSchema6 + }; + + /** + * This attribute is a string that provides a short description of the instance property. + * + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2 + */ + title?: string; + + /** + * This attribute is a string that provides a full description of the of purpose the instance property. + * + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2 + */ + description?: string; + + /** + * This keyword can be used to supply a default JSON value associated with a particular schema. + * It is RECOMMENDED that a default value be valid against the associated schema. + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3 + */ + default?: JSONSchema6Type; + + /** + * Array of examples with no validation effect; the value of "default" is usable as an example without repeating it under this keyword + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4 + */ + examples?: JSONSchema6Type[]; + } diff --git a/types/json-schema/json-schema-tests.ts b/types/json-schema/json-schema-tests.ts index 58264668b0..cbf23ddfdd 100644 --- a/types/json-schema/json-schema-tests.ts +++ b/types/json-schema/json-schema-tests.ts @@ -1,22 +1,24 @@ -import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName } from 'json-schema' +import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName, JSONSchema6, JSONSchema6Type, JSONSchema6TypeName } from 'json-schema'; + +/* JSON Schema 4 */ // SimpleType () => { - const a: JSONSchema4TypeName = 'string' - const b: JSONSchema4TypeName = 'null' - const c: JSONSchema4TypeName = 'any' -} + const a: JSONSchema4TypeName = 'string'; + const b: JSONSchema4TypeName = 'null'; + const c: JSONSchema4TypeName = 'any'; +}; // Type () => { - const a: JSONSchema4Type = 'foo' - const b: JSONSchema4Type = null - const c: JSONSchema4Type = [1, 2] -} + const a: JSONSchema4Type = 'foo'; + const b: JSONSchema4Type = null; + const c: JSONSchema4Type = [1, 2]; +}; // JSONSchema4 () => { - const a: JSONSchema4 = {} + const a: JSONSchema4 = {}; const b: JSONSchema4 = { id: 'foo', $ref: 'foo/bar', @@ -63,5 +65,75 @@ import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName } from 'json-schema' not: {}, extends: 'foo', bar: 4 - } -} + }; +}; + +/* JSON Schema 6 */ + +// SimpleType +() => { + const a: JSONSchema6TypeName = 'string'; + const b: JSONSchema6TypeName = 'null'; + const c: JSONSchema6TypeName = 'any'; +}; + +// Type +() => { + const a: JSONSchema6Type = 'foo'; + const b: JSONSchema6Type = null; + const c: JSONSchema6Type = [1, 2]; +}; + +// JSONSchema4 +() => { + const a: JSONSchema6 = {}; + const b: JSONSchema6 = { + $id: 'foo', + $ref: 'foo/bar', + $schema: 'http://json-schema.org/schema#', + title: 'foo', + description: 'bar', + default: 42, + multipleOf: 3, + maximum: 4, + exclusiveMaximum: 4, + minimum: 5, + exclusiveMinimum: 5, + maxLength: 6, + minLength: 7, + pattern: 'baz', + additionalItems: true, + items: [ + { items: [{ minLength: 4 }] } + ], + maxItems: 4, + minItems: 5, + uniqueItems: true, + maxProperties: 10, + minProperties: 11, + required: ['foo', 'bar'], + additionalProperties: false, + definitions: { + foo: { type: 'string' } + }, + properties: { + bar: { type: 'boolean' } + }, + patternProperties: { + foo: { type: 'integer' } + }, + dependencies: { + baz: { type: 'integer' } + }, + enum: ['foo', 42], + type: ['string', 'array'], + allOf: [{}], + anyOf: [{}], + oneOf: [{}], + not: {}, + const: 'foo', + contains: {}, + examples: [{}], + propertyNames: {} + }; +}; diff --git a/types/json-schema/tslint.json b/types/json-schema/tslint.json index ccd796af87..d88586e5bd 100644 --- a/types/json-schema/tslint.json +++ b/types/json-schema/tslint.json @@ -1,8 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "semicolon": [ - false - ] - } + "extends": "dtslint/dt.json" } From bc1743cd4b654b9cbfa27a36d8cc285fefde1785 Mon Sep 17 00:00:00 2001 From: chaosmail Date: Sun, 19 Nov 2017 12:26:41 +0100 Subject: [PATCH 029/269] add createLanguage, Parser.trim and Parser.thru --- types/parsimmon/index.d.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/types/parsimmon/index.d.ts b/types/parsimmon/index.d.ts index dfbae05e23..b7928c5182 100644 --- a/types/parsimmon/index.d.ts +++ b/types/parsimmon/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Parsimmon 1.3 +// Type definitions for Parsimmon 1.6.2 // Project: https://github.com/jneen/parsimmon // Definitions by: Bart van der Schoor // Mizunashi Mana @@ -73,6 +73,14 @@ declare namespace Parsimmon { expected: string[]; index: Index; } + + interface Rule { + [key: string]: (r?: Language) => Parser; + } + + interface Language { + [key: string]: Parser; + } interface Parser { /** @@ -106,6 +114,15 @@ declare namespace Parsimmon { */ // tslint:disable-next-line:unified-signatures then(anotherParser: Parser): Parser; + /** + * returns wrapper(this) from the parser. Useful for custom functions used + * to wrap your parsers, while keeping with Parsimmon chaining style. + */ + thru(call: (wrapper: Parser) => Parser): Parser; + /** + * expects anotherParser before and after parser, yielding the result of parser + */ + trim(anotherParser: Parser): Parser; /** * transforms the output of parser with the given function. */ @@ -171,6 +188,11 @@ declare namespace Parsimmon { */ function Parser(fn: (input: string, i: number) => Parsimmon.Reply): Parser; + /** + * Starting point for building a language parser in Parsimmon + */ + function createLanguage(rules: Rule): Language; + /** * To be used inside of Parsimmon(fn). Generates an object describing how * far the successful parse went (index), and what value it created doing From b54ec02d7d92c94ad57272a34ba88c92158271a4 Mon Sep 17 00:00:00 2001 From: Cyrille Tuzi Date: Sun, 19 Nov 2017 12:41:15 +0100 Subject: [PATCH 030/269] Add types for JSON Schema v6 --- types/json-schema/index.d.ts | 44 ++++++++++++-------------- types/json-schema/json-schema-tests.ts | 4 +-- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/types/json-schema/index.d.ts b/types/json-schema/index.d.ts index 063e11d0f0..6a0af41c91 100644 --- a/types/json-schema/index.d.ts +++ b/types/json-schema/index.d.ts @@ -2,7 +2,7 @@ // Project: https://www.npmjs.com/package/json-schema // Definitions by: Boris Cherny , Cyrille Tuzi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.2 /* JSON Schema 4 */ @@ -22,8 +22,8 @@ export type JSONSchema4Type = any[] | boolean | number | null | object | string; * @see https://tools.ietf.org/html/draft-zyp-json-schema-04 */ export interface JSONSchema4 { - id?: string - $ref?: string + id?: string; + $ref?: string; $schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | 'http://json-schema.org/draft-04/schema#' | 'http://json-schema.org/draft-04/hyper-schema#' | 'http://json-schema.org/draft-03/schema#' | 'http://json-schema.org/draft-03/hyper-schema#' @@ -117,7 +117,7 @@ export interface JSONSchema4 { definitions?: { [k: string]: JSONSchema4; - } + }; /** * This attribute is an object with property definitions that define the @@ -134,7 +134,7 @@ export interface JSONSchema4 { */ properties?: { [k: string]: JSONSchema4; - } + }; /** * This attribute is an object that defines the schema for a set of @@ -149,10 +149,10 @@ export interface JSONSchema4 { */ patternProperties?: { [k: string]: JSONSchema4; - } + }; dependencies?: { [k: string]: JSONSchema4 | string[]; - } + }; /** * This provides an enumeration of all possible values that are valid @@ -206,11 +206,10 @@ export type JSONSchema6TypeName = 'string' | 'number' | 'integer' | 'boolean' | export type JSONSchema6Type = any[] | boolean | number | null | object | string; /** -* JSON Schema V6 -* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01 -*/ + * JSON Schema V6 + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01 + */ export interface JSONSchema6 { - $id?: string; $ref?: string; $schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | @@ -396,14 +395,14 @@ export interface JSONSchema6 { propertyNames?: boolean | JSONSchema6; /** - * This provides an enumeration of all possible values that are valid - * for the instance property. This MUST be an array, and each item in - * the array represents a possible value for the instance value. If - * this attribute is defined, the instance value MUST be one of the - * values in the array in order for the schema to be valid. - * - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23 - */ + * This provides an enumeration of all possible values that are valid + * for the instance property. This MUST be an array, and each item in + * the array represents a possible value for the instance value. If + * this attribute is defined, the instance value MUST be one of the + * values in the array in order for the schema to be valid. + * + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23 + */ enum?: JSONSchema6Type[]; /** @@ -413,9 +412,9 @@ export interface JSONSchema6 { const?: JSONSchema6Type; /** - * A single type, or a union of simple types - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25 - */ + * A single type, or a union of simple types + * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25 + */ type?: JSONSchema6TypeName | JSONSchema6TypeName[]; /** @@ -471,5 +470,4 @@ export interface JSONSchema6 { * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4 */ examples?: JSONSchema6Type[]; - } diff --git a/types/json-schema/json-schema-tests.ts b/types/json-schema/json-schema-tests.ts index cbf23ddfdd..431fa7ae59 100644 --- a/types/json-schema/json-schema-tests.ts +++ b/types/json-schema/json-schema-tests.ts @@ -58,7 +58,7 @@ import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName, JSONSchema6, JSONSch baz: { type: 'integer' } }, enum: ['foo', 42], - type: ['string', 'array'], + type: 'string', allOf: [{}], anyOf: [{}], oneOf: [{}], @@ -126,7 +126,7 @@ import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName, JSONSchema6, JSONSch baz: { type: 'integer' } }, enum: ['foo', 42], - type: ['string', 'array'], + type: 'string', allOf: [{}], anyOf: [{}], oneOf: [{}], From 6ce5323252401ea2dfdfbeaa4aabeb830f40e055 Mon Sep 17 00:00:00 2001 From: Cyrille Tuzi Date: Sun, 19 Nov 2017 12:45:49 +0100 Subject: [PATCH 031/269] Add types for JSON Schema v6 --- types/json-schema/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/json-schema/index.d.ts b/types/json-schema/index.d.ts index 6a0af41c91..c660fb370c 100644 --- a/types/json-schema/index.d.ts +++ b/types/json-schema/index.d.ts @@ -471,3 +471,5 @@ export interface JSONSchema6 { */ examples?: JSONSchema6Type[]; } + +export { JSONSchema6 as JSONSchema }; From 08c09da16616a976d59d5eebdc6b082094037533 Mon Sep 17 00:00:00 2001 From: Cyrille Tuzi Date: Sun, 19 Nov 2017 12:47:09 +0100 Subject: [PATCH 032/269] Add types for JSON Schema v6 --- types/json-schema/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/json-schema/index.d.ts b/types/json-schema/index.d.ts index c660fb370c..6a0af41c91 100644 --- a/types/json-schema/index.d.ts +++ b/types/json-schema/index.d.ts @@ -471,5 +471,3 @@ export interface JSONSchema6 { */ examples?: JSONSchema6Type[]; } - -export { JSONSchema6 as JSONSchema }; From 934892c37d7ba758cd3f3f09d8a7fff1bcc807c0 Mon Sep 17 00:00:00 2001 From: johanblumenberg Date: Sun, 19 Nov 2017 12:44:22 +0100 Subject: [PATCH 033/269] Update css types Make all of the AtRule interfaces inherit from Node. Break out StyleRules from Stylesheet, as it's own type. This is useful when using rework, which is only given the Stylesheet.stylesheet object. Change StyleRules proeprty rules to be mandatory. It is always set. --- types/css/index.d.ts | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/types/css/index.d.ts b/types/css/index.d.ts index c892d5c3a2..be8f1323a0 100644 --- a/types/css/index.d.ts +++ b/types/css/index.d.ts @@ -112,7 +112,7 @@ export interface Comment extends Node { /** * The @charset at-rule. */ -export interface Charset { +export interface Charset extends Node { /** The part following @charset. */ charset?: string; } @@ -120,7 +120,7 @@ export interface Charset { /** * The @custom-media at-rule */ -export interface CustomMedia { +export interface CustomMedia extends Node { /** The ---prefixed name. */ name?: string; /** The part following the name. */ @@ -130,7 +130,7 @@ export interface CustomMedia { /** * The @document at-rule. */ -export interface Document { +export interface Document extends Node { /** The part following @document. */ document?: string; /** The vendor prefix in @document, or undefined if there is none. */ @@ -142,7 +142,7 @@ export interface Document { /** * The @font-face at-rule. */ -export interface FontFace { +export interface FontFace extends Node { /** Array of nodes with the types declaration and comment. */ declarations?: Array; } @@ -150,7 +150,7 @@ export interface FontFace { /** * The @host at-rule. */ -export interface Host { +export interface Host extends Node { /** Array of nodes with the types rule, comment and any of the at-rule types. */ rules?: Array; } @@ -158,7 +158,7 @@ export interface Host { /** * The @import at-rule. */ -export interface Import { +export interface Import extends Node { /** The part following @import. */ import?: string; } @@ -166,7 +166,7 @@ export interface Import { /** * The @keyframes at-rule. */ -export interface KeyFrames { +export interface KeyFrames extends Node { /** The name of the keyframes rule. */ name?: string; /** The vendor prefix in @keyframes, or undefined if there is none. */ @@ -175,7 +175,7 @@ export interface KeyFrames { keyframes?: Array; } -export interface KeyFrame { +export interface KeyFrame extends Node { /** The list of "selectors" of the keyframe rule, split on commas. Each “selector” is trimmed from whitespace. */ values?: Array; /** Array of nodes with the types declaration and comment. */ @@ -185,7 +185,7 @@ export interface KeyFrame { /** * The @media at-rule. */ -export interface Media { +export interface Media extends Node { /** The part following @media. */ media?: string; /** Array of nodes with the types rule, comment and any of the at-rule types. */ @@ -195,7 +195,7 @@ export interface Media { /** * The @namespace at-rule. */ -export interface Namespace { +export interface Namespace extends Node { /** The part following @namespace. */ namespace?: string; } @@ -203,7 +203,7 @@ export interface Namespace { /** * The @page at-rule. */ -export interface Page { +export interface Page extends Node { /** The list of selectors of the rule, split on commas. Each selector is trimmed from whitespace and comments. */ selectors?: Array; /** Array of nodes with the types declaration and comment. */ @@ -213,7 +213,7 @@ export interface Page { /** * The @supports at-rule. */ -export interface Supports { +export interface Supports extends Node { /** The part following @supports. */ supports?: string; /** Array of nodes with the types rule, comment and any of the at-rule types. */ @@ -223,16 +223,21 @@ export interface Supports { /** All at-rules. */ export type AtRule = Charset | CustomMedia | Document | FontFace | Host | Import | KeyFrames | Media | Namespace | Page | Supports; +/** + * A collection of rules + */ +export interface StyleRules { + /** Array of nodes with the types rule, comment and any of the at-rule types. */ + rules: Array; + /** Array of Errors. Errors collected during parsing when option silent is true. */ + parsingErrors?: Array +} + /** * The root node returned by css.parse. */ export interface Stylesheet extends Node { - stylesheet?: { - /** Array of nodes with the types rule, comment and any of the at-rule types. */ - rules?: Array; - /** Array of Errors. Errors collected during parsing when option silent is true. */ - parsingErrors?: Array - }; + stylesheet?: StyleRules; } // --------------------------------------------------------------------------------- From b60a11e605ed64db115a613ce6ada528b3ba173c Mon Sep 17 00:00:00 2001 From: Christoph Koerner Date: Sun, 19 Nov 2017 12:55:00 +0100 Subject: [PATCH 034/269] fix lint errors --- types/parsimmon/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/parsimmon/index.d.ts b/types/parsimmon/index.d.ts index b7928c5182..26ed383daf 100644 --- a/types/parsimmon/index.d.ts +++ b/types/parsimmon/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Parsimmon 1.6.2 +// Type definitions for Parsimmon 1.6 // Project: https://github.com/jneen/parsimmon // Definitions by: Bart van der Schoor // Mizunashi Mana @@ -73,7 +73,7 @@ declare namespace Parsimmon { expected: string[]; index: Index; } - + interface Rule { [key: string]: (r?: Language) => Parser; } @@ -115,7 +115,7 @@ declare namespace Parsimmon { // tslint:disable-next-line:unified-signatures then(anotherParser: Parser): Parser; /** - * returns wrapper(this) from the parser. Useful for custom functions used + * returns wrapper(this) from the parser. Useful for custom functions used * to wrap your parsers, while keeping with Parsimmon chaining style. */ thru(call: (wrapper: Parser) => Parser): Parser; @@ -192,7 +192,7 @@ declare namespace Parsimmon { * Starting point for building a language parser in Parsimmon */ function createLanguage(rules: Rule): Language; - + /** * To be used inside of Parsimmon(fn). Generates an object describing how * far the successful parse went (index), and what value it created doing From c49ab1c37bf43923cf784c6ce1db584ccaffad9a Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Sun, 19 Nov 2017 08:19:44 -0500 Subject: [PATCH 035/269] lodash: fix compile error with _.pick --- types/lodash/index.d.ts | 19 +++++++++++++++++++ types/lodash/lodash-tests.ts | 16 +++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index a19f4aa4a1..a0eaef941c 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -14398,6 +14398,9 @@ declare namespace _ { ...props: Array> ): Pick; + /** + * @see _.pick + */ pick( object: T | null | undefined, ...props: PropertyPath[] @@ -14405,6 +14408,14 @@ declare namespace _ { } interface LoDashImplicitWrapper { + /** + * @see _.pick + */ + pick( + this: LoDashImplicitWrapper, + ...props: Array> + ): LoDashImplicitWrapper>; + /** * @see _.pick */ @@ -14415,6 +14426,14 @@ declare namespace _ { } interface LoDashExplicitWrapper { + /** + * @see _.pick + */ + pick( + this: LoDashExplicitWrapper, + ...props: Array> + ): LoDashExplicitWrapper>; + /** * @see _.pick */ diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index cca7c239c7..dbefb1abaa 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -11821,7 +11821,7 @@ namespace TestPick { { let result: Pick; result = _.pick(obj, 'a', 'b'); - result = _.pick(obj, ['a', 'b']); + result = _.pick(obj, ['a' as 'a', 'b' as 'b']); } { @@ -11832,6 +11832,13 @@ namespace TestPick { result = _(obj).pick(['b', 1], 0, 'a'); } + { + let result: _.LoDashImplicitWrapper>; + + result = _(obj).pick('a', 'b'); + result = _(obj).pick(['a' as 'a', 'b' as 'b']); + } + { let result: _.LoDashExplicitWrapper>; @@ -11839,6 +11846,13 @@ namespace TestPick { result = _(obj).chain().pick(0, 'a'); result = _(obj).chain().pick(['b', 1], 0, 'a'); } + + { + let result: _.LoDashExplicitWrapper>; + + result = _(obj).chain().pick('a', 'b'); + result = _(obj).chain().pick(['a' as 'a', 'b' as 'b']); + } } // _.pickBy From a9235ba9f552d213abcfeac5992220f50286fdcb Mon Sep 17 00:00:00 2001 From: Andrew Makarov Date: Sun, 19 Nov 2017 19:47:40 +0300 Subject: [PATCH 036/269] [autobind-decorator] removed typings --- notNeededPackages.json | 6 ++ .../autobind-decorator-tests.ts | 42 ---------- types/autobind-decorator/index.d.ts | 10 --- types/autobind-decorator/tsconfig.json | 26 ------ types/autobind-decorator/tslint.json | 79 ------------------- 5 files changed, 6 insertions(+), 157 deletions(-) delete mode 100644 types/autobind-decorator/autobind-decorator-tests.ts delete mode 100644 types/autobind-decorator/index.d.ts delete mode 100644 types/autobind-decorator/tsconfig.json delete mode 100644 types/autobind-decorator/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 306865851b..3164ec5d3c 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -60,6 +60,12 @@ "sourceRepoURL": "https://github.com/AlexTeixeira/Askmethat-Rating", "asOfVersion": "0.4.0" }, + { + "libraryName": "autobind-decorator", + "typingsPackageName": "autobind-decorator", + "sourceRepoURL": "https://github.com/andreypopp/autobind-decorator", + "asOfVersion": "2.1.0" + }, { "libraryName": "aws-sdk", "typingsPackageName": "aws-sdk", diff --git a/types/autobind-decorator/autobind-decorator-tests.ts b/types/autobind-decorator/autobind-decorator-tests.ts deleted file mode 100644 index f5a0c76328..0000000000 --- a/types/autobind-decorator/autobind-decorator-tests.ts +++ /dev/null @@ -1,42 +0,0 @@ - -import autobind = require('autobind-decorator'); - -class Test { - public static what: string = 'static'; - - @autobind - public static test(): void { - console.log(this.what); - } - - public constructor(public what: string) { - this.what = what; - } - - @autobind - public test(): void { - console.warn(this.what); - } -} - -const tester: Test = new Test('bind'); -const { test } = tester; -tester.test(); // warns 'bind'. -test(); // warns 'bind'. -Test.test(); // logs 'static'. - -@autobind -class Component { - public constructor(private someMember: string) { - this.someMember = someMember; - } - - public someMethod(): void { - console.error(this.someMember); - } -} - -const component: Component = new Component('React vs Angular2'); -const { someMethod } = component; -component.someMethod(); // errors 'React vs Angular2' -someMethod(); // errors 'React vs Angular2' diff --git a/types/autobind-decorator/index.d.ts b/types/autobind-decorator/index.d.ts deleted file mode 100644 index d8d74bbfec..0000000000 --- a/types/autobind-decorator/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Type definitions for autobind-decorator v1.3.3 -// Project: https://github.com/andreypopp/autobind-decorator -// Definitions by: Ivo Stratev -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare module 'autobind-decorator' { - function autobind(target: TFunction): TFunction | void; - function autobind(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor | void; - export = autobind; -} diff --git a/types/autobind-decorator/tsconfig.json b/types/autobind-decorator/tsconfig.json deleted file mode 100644 index 0b05ea04fb..0000000000 --- a/types/autobind-decorator/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "experimentalDecorators": true, - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "autobind-decorator-tests.ts" - ] -} \ No newline at end of file diff --git a/types/autobind-decorator/tslint.json b/types/autobind-decorator/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/autobind-decorator/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 9ea6b34ae8ccf7eb6492f54cc78ba6e7564a798c Mon Sep 17 00:00:00 2001 From: Ryan Posener Date: Sun, 19 Nov 2017 10:46:52 -0700 Subject: [PATCH 037/269] DirtyFlag does not have methods - the object only has a default function, which returns a result. This result also has another function forceDirty() that is not included. --- types/kolite/knockout.dirtyFlag.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/kolite/knockout.dirtyFlag.d.ts b/types/kolite/knockout.dirtyFlag.d.ts index 2f63a110e0..3999f833ae 100644 --- a/types/kolite/knockout.dirtyFlag.d.ts +++ b/types/kolite/knockout.dirtyFlag.d.ts @@ -10,9 +10,14 @@ // DirtyFlag ///////////////////////////////////////////// interface DirtyFlag { - isDirty: KnockoutComputed; new (objectToTrack: any, isInitiallyDirty?: boolean, hashFunction?: () => any): any; + (): DirtyFlagResult; +} + +interface DirtyFlagResult { + isDirty: KnockoutComputed; reset(): void; + forceDirty(): void; } interface KnockoutStatic { From a1cae9f28e23ae9876bf05037f437cc7329fe483 Mon Sep 17 00:00:00 2001 From: linxiaowu66 Date: Mon, 20 Nov 2017 14:05:57 +0800 Subject: [PATCH 038/269] feat(better-scroll): update better-scroll types definition to v1.4.2 --- types/better-scroll/index.d.ts | 41 +++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/types/better-scroll/index.d.ts b/types/better-scroll/index.d.ts index 559b21bba2..c4a6f99a57 100644 --- a/types/better-scroll/index.d.ts +++ b/types/better-scroll/index.d.ts @@ -1,12 +1,14 @@ -// Type definitions for better-scroll.js 1.3 +// Type definitions for better-scroll.js 1.4.2 // Project: https://github.com/ustbhuangyi/better-scroll // Definitions by: linxiaowu66 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 interface WheelOption { - selectedIndex?: number; + selectedIndex: number; rotate?: number; adjustTime?: number; + wheelWrapperClass?: string; + wheelItemClass?: string; } interface SlideOption { @@ -16,6 +18,7 @@ interface SlideOption { stepX?: number; stepY?: number; listenFlick?: boolean; + speed?: number; } interface ScrollBarOption { fade?: boolean; @@ -27,6 +30,12 @@ interface PullDownOption { interface PullUpOption { threshold?: number; } +interface PageOption { + x: number, + y: number, + pageX: number, + pageY: number +} interface BsOption { startX?: number; startY?: number; @@ -62,10 +71,12 @@ interface BsOption { * wheel: { * selectedIndex: 0; * rotate: 25; - * adjustTime: 400 + * adjustTime: 400; + * wheelWrapperClass: 'wheel-scroll'; + * wheelItemClass: 'wheel-item'; * } */ - wheel?: WheelOption | boolean; + wheel?: Partial | boolean; /** * for slide * snap: { @@ -77,14 +88,14 @@ interface BsOption { * listenFlick: true * } */ - snap?: SlideOption | boolean; + snap?: Partial | boolean; /** * for scrollbar * scrollbar: { * fade: true * } */ - scrollbar?: ScrollBarOption | boolean; + scrollbar?: Partial | boolean; /** * for pull down and refresh * pullDownRefresh: { @@ -92,20 +103,30 @@ interface BsOption { * stop: 20 * } */ - pullDownRefresh?: PullDownOption | boolean; + pullDownRefresh?: Partial | boolean; /** * for pull up and load * pullUpLoad: { * threshold: 50 * } */ - pullUpLoad?: PullUpOption | boolean; + pullUpLoad?: Partial | boolean; } declare class BScroll { constructor(element: Element | string, options?: BsOption); // 重新计算 better-scroll,当 DOM 结构发生变化的时候务必要调用确保滚动的效果正常 x: number; y: number; + maxScrollX: number; + maxScrollY: number; + movingDirectionX: number; + movingDirectionY: number; + directionX: number; + directionY: number; + enabled: boolean; + isInTransition: boolean; + isAnimating: boolean; + options: BsOption; refresh(): void; // 启用 better-scroll; 默认 开启 @@ -130,11 +151,11 @@ declare class BScroll { // 滚动到上一个页面 prev(time: number, easing: object): void; // 获取当前页面的信息 - getCurrentPage(): void; + getCurrentPage(): PageOption; // 当我们做 picker 组件的时候,调用该方法可以滚动到索引对应的位置 wheelTo(index: number): void; // 获取当前选中的索引值 - getSelectedIndex(): void; + getSelectedIndex(): number; // 当下拉刷新数据加载完毕后,需要调用此方法告诉 better-scroll 数据已加载 finishPullDown(): void; // 当上拉加载数据加载完毕后,需要调用此方法告诉 better-scroll 数据已加载 From 9ced36bfc6b81683e900fe8d707dd38dd73618dd Mon Sep 17 00:00:00 2001 From: linxiaowu66 Date: Mon, 20 Nov 2017 14:20:24 +0800 Subject: [PATCH 039/269] feat(types): update better-scroll types definition to v1.4.2 --- types/better-scroll/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/better-scroll/index.d.ts b/types/better-scroll/index.d.ts index c4a6f99a57..e975eec4ae 100644 --- a/types/better-scroll/index.d.ts +++ b/types/better-scroll/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for better-scroll.js 1.4.2 +// Type definitions for better-scroll.js 1.4.0 // Project: https://github.com/ustbhuangyi/better-scroll // Definitions by: linxiaowu66 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From d6353cb3385398f548a6c65480bf70a1eb15ee23 Mon Sep 17 00:00:00 2001 From: linxiaowu66 Date: Mon, 20 Nov 2017 14:31:52 +0800 Subject: [PATCH 040/269] feat(types): update better-scroll types definition to v1.4.2 --- types/better-scroll/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/better-scroll/index.d.ts b/types/better-scroll/index.d.ts index e975eec4ae..a0c7869a48 100644 --- a/types/better-scroll/index.d.ts +++ b/types/better-scroll/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for better-scroll.js 1.4.0 +// Type definitions for better-scroll.js 1.4 // Project: https://github.com/ustbhuangyi/better-scroll // Definitions by: linxiaowu66 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From c00e41b7b9c057cac98d1fea3666d0a4f0056590 Mon Sep 17 00:00:00 2001 From: linxiaowu66 Date: Mon, 20 Nov 2017 14:38:45 +0800 Subject: [PATCH 041/269] feat(types): update better-scroll types definition to v1.4.2 --- types/better-scroll/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/better-scroll/index.d.ts b/types/better-scroll/index.d.ts index a0c7869a48..3f48fed9db 100644 --- a/types/better-scroll/index.d.ts +++ b/types/better-scroll/index.d.ts @@ -31,10 +31,10 @@ interface PullUpOption { threshold?: number; } interface PageOption { - x: number, - y: number, - pageX: number, - pageY: number + x: number; + y: number; + pageX: number; + pageY: number; } interface BsOption { startX?: number; From 624c5ad4fb475ea23658d652c9eac92052159846 Mon Sep 17 00:00:00 2001 From: Cyrille Tuzi Date: Mon, 20 Nov 2017 09:00:49 +0100 Subject: [PATCH 042/269] Add types for JSON Schema v6 --- types/json-schema/index.d.ts | 162 ++++++++++++------------- types/json-schema/json-schema-tests.ts | 46 +++---- types/json-schema/tslint.json | 5 +- 3 files changed, 108 insertions(+), 105 deletions(-) diff --git a/types/json-schema/index.d.ts b/types/json-schema/index.d.ts index 6a0af41c91..7f02b671a0 100644 --- a/types/json-schema/index.d.ts +++ b/types/json-schema/index.d.ts @@ -10,24 +10,24 @@ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1 */ export type JSONSchema4TypeName = 'string' | 'number' | 'integer' | 'boolean' - | 'object' | 'array' | 'null' | 'any'; + | 'object' | 'array' | 'null' | 'any' /** * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5 */ -export type JSONSchema4Type = any[] | boolean | number | null | object | string; +export type JSONSchema4Type = any[] | boolean | number | null | object | string /** * JSON Schema V4 * @see https://tools.ietf.org/html/draft-zyp-json-schema-04 */ export interface JSONSchema4 { - id?: string; - $ref?: string; + id?: string + $ref?: string $schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | 'http://json-schema.org/draft-04/schema#' | 'http://json-schema.org/draft-04/hyper-schema#' | 'http://json-schema.org/draft-03/schema#' | 'http://json-schema.org/draft-03/hyper-schema#' - | string; + | string /** * This attribute is a string that provides a short description of the @@ -35,7 +35,7 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21 */ - title?: string; + title?: string /** * This attribute is a string that provides a full description of the of @@ -43,17 +43,17 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22 */ - description?: string; + description?: string - default?: JSONSchema4Type; - multipleOf?: number; - maximum?: number; - exclusiveMaximum?: boolean; - minimum?: number; - exclusiveMinimum?: boolean; - maxLength?: number; - minLength?: number; - pattern?: string; + default?: JSONSchema4Type + multipleOf?: number + maximum?: number + exclusiveMaximum?: boolean + minimum?: number + exclusiveMinimum?: boolean + maxLength?: number + minLength?: number + pattern?: string /** * May only be defined when "items" is defined, and is a tuple of JSONSchemas. @@ -65,7 +65,7 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6 */ - additionalItems?: boolean | JSONSchema4; + additionalItems?: boolean | JSONSchema4 /** * This attribute defines the allowed items in an instance array, and @@ -86,13 +86,13 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5 */ - items?: JSONSchema4 | JSONSchema4[]; + items?: JSONSchema4 | JSONSchema4[] - maxItems?: number; - minItems?: number; - uniqueItems?: boolean; - maxProperties?: number; - minProperties?: number; + maxItems?: number + minItems?: number + uniqueItems?: boolean + maxProperties?: number + minProperties?: number /** * This attribute indicates if the instance must have a value, and not @@ -101,7 +101,7 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7 */ - required?: false | string[]; + required?: false | string[] /** * This attribute defines a schema for all properties that are not @@ -113,11 +113,11 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4 */ - additionalProperties?: boolean | JSONSchema4; + additionalProperties?: boolean | JSONSchema4 definitions?: { - [k: string]: JSONSchema4; - }; + [k: string]: JSONSchema4 + } /** * This attribute is an object with property definitions that define the @@ -133,8 +133,8 @@ export interface JSONSchema4 { * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2 */ properties?: { - [k: string]: JSONSchema4; - }; + [k: string]: JSONSchema4 + } /** * This attribute is an object that defines the schema for a set of @@ -148,11 +148,11 @@ export interface JSONSchema4 { * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3 */ patternProperties?: { - [k: string]: JSONSchema4; - }; + [k: string]: JSONSchema4 + } dependencies?: { - [k: string]: JSONSchema4 | string[]; - }; + [k: string]: JSONSchema4 | string[] + } /** * This provides an enumeration of all possible values that are valid @@ -163,17 +163,17 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19 */ - enum?: JSONSchema4Type[]; + enum?: JSONSchema4Type[] /** * A single type, or a union of simple types */ - type?: JSONSchema4TypeName | JSONSchema4TypeName[]; + type?: JSONSchema4TypeName | JSONSchema4TypeName[] - allOf?: JSONSchema4[]; - anyOf?: JSONSchema4[]; - oneOf?: JSONSchema4[]; - not?: JSONSchema4; + allOf?: JSONSchema4[] + anyOf?: JSONSchema4[] + oneOf?: JSONSchema4[] + not?: JSONSchema4 /** * The value of this property MUST be another schema which will provide @@ -191,71 +191,71 @@ export interface JSONSchema4 { * * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26 */ - extends?: string | string[]; + extends?: string | string[] /** * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6 */ - [k: string]: any; + [k: string]: any } /* JSON Schema 6 */ -export type JSONSchema6TypeName = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null' | 'any'; +export type JSONSchema6TypeName = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null' | 'any' -export type JSONSchema6Type = any[] | boolean | number | null | object | string; +export type JSONSchema6Type = any[] | boolean | number | null | object | string /** * JSON Schema V6 * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01 */ export interface JSONSchema6 { - $id?: string; - $ref?: string; + $id?: string + $ref?: string $schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | - 'http://json-schema.org/draft-06/schema#' | 'http://json-schema.org/draft-06/hyper-schema#'; + 'http://json-schema.org/draft-06/schema#' | 'http://json-schema.org/draft-06/hyper-schema#' /** * Must be strictly greater than 0. * A numeric instance is valid only if division by this keyword's value results in an integer. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1 */ - multipleOf?: number; + multipleOf?: number /** * Representing an inclusive upper limit for a numeric instance. * This keyword validates only if the instance is less than or exactly equal to "maximum". * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2 */ - maximum?: number; + maximum?: number /** * Representing an exclusive upper limit for a numeric instance. * This keyword validates only if the instance is strictly less than (not equal to) to "exclusiveMaximum". * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3 */ - exclusiveMaximum?: number; + exclusiveMaximum?: number /** * Representing an inclusive lower limit for a numeric instance. * This keyword validates only if the instance is greater than or exactly equal to "minimum". * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4 */ - minimum?: number; + minimum?: number /** * Representing an exclusive lower limit for a numeric instance. * This keyword validates only if the instance is strictly greater than (not equal to) to "exclusiveMinimum". * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5 */ - exclusiveMinimum?: number; + exclusiveMinimum?: number /** * Must be a non-negative integer. * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6 */ - maxLength?: number; + maxLength?: number /** * Must be a non-negative integer. @@ -263,20 +263,20 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as a value of 0. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7 */ - minLength?: number; + minLength?: number /** * Should be a valid regular expression, according to the ECMA 262 regular expression dialect. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8 */ - pattern?: string; + pattern?: string /** * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9 */ - items?: boolean | JSONSchema6 | JSONSchema6[]; + items?: boolean | JSONSchema6 | JSONSchema6[] /** * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. @@ -287,14 +287,14 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10 */ - additionalItems?: boolean | JSONSchema6; + additionalItems?: boolean | JSONSchema6 /** * Must be a non-negative integer. * An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11 */ - maxItems?: number; + maxItems?: number /** * Must be a non-negative integer. @@ -302,7 +302,7 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as a value of 0. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12 */ - minItems?: number; + minItems?: number /** * If this keyword has boolean value false, the instance validates successfully. @@ -310,20 +310,20 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as a value of false. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13 */ - uniqueItems?: boolean; + uniqueItems?: boolean /** * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14 */ - contains?: boolean | JSONSchema6; + contains?: boolean | JSONSchema6 /** * Must be a non-negative integer. * An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15 */ - maxProperties?: number; + maxProperties?: number /** * Must be a non-negative integer. @@ -332,7 +332,7 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as a value of 0. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16 */ - minProperties?: number; + minProperties?: number /** * Elements of this array must be unique. @@ -341,7 +341,7 @@ export interface JSONSchema6 { * * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17 */ - required?: string[]; + required?: string[] /** * This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. @@ -352,7 +352,7 @@ export interface JSONSchema6 { */ properties?: { [k: string]: boolean | JSONSchema6 - }; + } /** * This attribute is an object that defines the schema for a set of property names of an object instance. @@ -364,7 +364,7 @@ export interface JSONSchema6 { */ patternProperties?: { [k: string]: boolean | JSONSchema6 - }; + } /** * This attribute defines a schema for all properties that are not explicitly defined in an object type definition. @@ -373,7 +373,7 @@ export interface JSONSchema6 { * The default value is an empty schema which allows any value for additional properties. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20 */ - additionalProperties?: boolean | JSONSchema6; + additionalProperties?: boolean | JSONSchema6 /** * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. @@ -384,7 +384,7 @@ export interface JSONSchema6 { */ dependencies?: { [k: string]: boolean | JSONSchema6 | string[] - }; + } /** * Takes a schema which validates the names of all properties rather than their values. @@ -392,7 +392,7 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22 */ - propertyNames?: boolean | JSONSchema6; + propertyNames?: boolean | JSONSchema6 /** * This provides an enumeration of all possible values that are valid @@ -403,71 +403,71 @@ export interface JSONSchema6 { * * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23 */ - enum?: JSONSchema6Type[]; + enum?: JSONSchema6Type[] /** * More readible form of a one-element "enum" * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24 */ - const?: JSONSchema6Type; + const?: JSONSchema6Type /** * A single type, or a union of simple types * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25 */ - type?: JSONSchema6TypeName | JSONSchema6TypeName[]; + type?: JSONSchema6TypeName | JSONSchema6TypeName[] /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26 */ - allOf?: JSONSchema6[]; + allOf?: JSONSchema6[] /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27 */ - anyOf?: JSONSchema6[]; + anyOf?: JSONSchema6[] /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28 */ - oneOf?: JSONSchema6[]; + oneOf?: JSONSchema6[] /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29 */ - not?: boolean | JSONSchema6; + not?: boolean | JSONSchema6 /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1 */ definitions?: { [k: string]: boolean | JSONSchema6 - }; + } /** * This attribute is a string that provides a short description of the instance property. * * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2 */ - title?: string; + title?: string /** * This attribute is a string that provides a full description of the of purpose the instance property. * * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2 */ - description?: string; + description?: string /** * This keyword can be used to supply a default JSON value associated with a particular schema. * It is RECOMMENDED that a default value be valid against the associated schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3 */ - default?: JSONSchema6Type; + default?: JSONSchema6Type /** - * Array of examples with no validation effect; the value of "default" is usable as an example without repeating it under this keyword + * Array of examples with no validation effect the value of "default" is usable as an example without repeating it under this keyword * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4 */ - examples?: JSONSchema6Type[]; + examples?: JSONSchema6Type[] } diff --git a/types/json-schema/json-schema-tests.ts b/types/json-schema/json-schema-tests.ts index 431fa7ae59..0fd15f5de9 100644 --- a/types/json-schema/json-schema-tests.ts +++ b/types/json-schema/json-schema-tests.ts @@ -1,24 +1,24 @@ -import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName, JSONSchema6, JSONSchema6Type, JSONSchema6TypeName } from 'json-schema'; +import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName, JSONSchema6, JSONSchema6Type, JSONSchema6TypeName } from 'json-schema' /* JSON Schema 4 */ // SimpleType () => { - const a: JSONSchema4TypeName = 'string'; - const b: JSONSchema4TypeName = 'null'; - const c: JSONSchema4TypeName = 'any'; -}; + const a: JSONSchema4TypeName = 'string' + const b: JSONSchema4TypeName = 'null' + const c: JSONSchema4TypeName = 'any' +} // Type () => { - const a: JSONSchema4Type = 'foo'; - const b: JSONSchema4Type = null; - const c: JSONSchema4Type = [1, 2]; -}; + const a: JSONSchema4Type = 'foo' + const b: JSONSchema4Type = null + const c: JSONSchema4Type = [1, 2] +} // JSONSchema4 () => { - const a: JSONSchema4 = {}; + const a: JSONSchema4 = {} const b: JSONSchema4 = { id: 'foo', $ref: 'foo/bar', @@ -65,28 +65,28 @@ import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName, JSONSchema6, JSONSch not: {}, extends: 'foo', bar: 4 - }; -}; + } +} /* JSON Schema 6 */ // SimpleType () => { - const a: JSONSchema6TypeName = 'string'; - const b: JSONSchema6TypeName = 'null'; - const c: JSONSchema6TypeName = 'any'; -}; + const a: JSONSchema6TypeName = 'string' + const b: JSONSchema6TypeName = 'null' + const c: JSONSchema6TypeName = 'any' +} // Type () => { - const a: JSONSchema6Type = 'foo'; - const b: JSONSchema6Type = null; - const c: JSONSchema6Type = [1, 2]; -}; + const a: JSONSchema6Type = 'foo' + const b: JSONSchema6Type = null + const c: JSONSchema6Type = [1, 2] +} // JSONSchema4 () => { - const a: JSONSchema6 = {}; + const a: JSONSchema6 = {} const b: JSONSchema6 = { $id: 'foo', $ref: 'foo/bar', @@ -135,5 +135,5 @@ import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName, JSONSchema6, JSONSch contains: {}, examples: [{}], propertyNames: {} - }; -}; + } +} diff --git a/types/json-schema/tslint.json b/types/json-schema/tslint.json index d88586e5bd..f336e521da 100644 --- a/types/json-schema/tslint.json +++ b/types/json-schema/tslint.json @@ -1,3 +1,6 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + "semicolon": false + } } From 1cea5f323c68a73f85513692fbc78fd16612411c Mon Sep 17 00:00:00 2001 From: Cyrille Tuzi Date: Mon, 20 Nov 2017 09:03:35 +0100 Subject: [PATCH 043/269] Add types for JSON Schema v6 --- types/json-schema/tslint.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/json-schema/tslint.json b/types/json-schema/tslint.json index f336e521da..ccd796af87 100644 --- a/types/json-schema/tslint.json +++ b/types/json-schema/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "semicolon": false + "semicolon": [ + false + ] } } From 68d694c059d0590e547a9a61add246a33e3ca163 Mon Sep 17 00:00:00 2001 From: amirgro Date: Mon, 20 Nov 2017 12:46:59 +0200 Subject: [PATCH 044/269] update VictoryAxisProps with invertAxis prop --- types/victory/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index 6640fdd7f5..b41fb96068 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -764,6 +764,10 @@ declare module "victory" { * @default */ gridComponent?: React.ReactElement; + /** + * If true, this value will flip the domain of a given axis. + */ + invertAxis?: boolean; /** * The label prop defines the label that will appear along the axis. This * prop should be given as a value or an entire, HTML-complete label From 1c5945ab3f5c0ad7fd1622f131771604b9ef1acf Mon Sep 17 00:00:00 2001 From: Robert Katzki Date: Mon, 20 Nov 2017 12:32:20 +0100 Subject: [PATCH 045/269] fix(rc-slider): allow null for step prop According to the documentation of [rc-slider](https://github.com/react-component/slider#common-api) `null` is allowed for the step property and has different functionality than passing in `undefined`. --- types/rc-slider/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rc-slider/index.d.ts b/types/rc-slider/index.d.ts index a0209132df..f64ae8c03c 100644 --- a/types/rc-slider/index.d.ts +++ b/types/rc-slider/index.d.ts @@ -41,7 +41,7 @@ export interface CommonApiProps { * Value to be added or subtracted on each step the slider makes. Must be greater than zero, and max - min should be evenly divisible by the step value. * @default 1 */ - step?: number; + step?: number | null; /** * If vertical is true, the slider will be vertical. * @default false From 982412790618197547ab377cce6ad51ae93def0a Mon Sep 17 00:00:00 2001 From: Arturas Molcanovas Date: Mon, 20 Nov 2017 14:15:44 +0000 Subject: [PATCH 046/269] update semaphore types for 1.1.0 --- types/semaphore/index.d.ts | 7 ++++--- types/semaphore/semaphore-tests.ts | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/semaphore/index.d.ts b/types/semaphore/index.d.ts index 5733785782..3164f95d9e 100644 --- a/types/semaphore/index.d.ts +++ b/types/semaphore/index.d.ts @@ -1,10 +1,9 @@ -// Type definitions for semaphore v1.0.3 +// Type definitions for semaphore v1.1.0 // Project: https://github.com/abrkn/semaphore.js // Definitions by: Matt Frantz +// Arturas Molcanovas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - declare function semaphore(capacity?: number): semaphore.Semaphore; declare namespace semaphore { @@ -16,6 +15,8 @@ declare namespace semaphore { interface Semaphore { capacity: number; + available(n: number): boolean; + take(task: Task): void; take(n: number, task: Task): void; diff --git a/types/semaphore/semaphore-tests.ts b/types/semaphore/semaphore-tests.ts index c3d53990fc..5770a9ba15 100644 --- a/types/semaphore/semaphore-tests.ts +++ b/types/semaphore/semaphore-tests.ts @@ -10,3 +10,5 @@ function task() { sem.take(task); sem.take(2, task); sem.leave(2); + +const available: boolean = sem.available(2); From ef5a0d3661348381847b0f4de187cc7e81dda9ec Mon Sep 17 00:00:00 2001 From: Oleg Repin Date: Mon, 20 Nov 2017 19:19:11 +0300 Subject: [PATCH 047/269] [puppeteer] NavigationOptions.waitUntil fix NavigationOptions.waitUntil could be array according to https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagegobackoptions --- types/puppeteer/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index f92bedd135..065cbab7b4 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -249,6 +249,12 @@ export interface EmulateOptions { export type EvaluateFn = string | ((...args: any[]) => any); +export type LoadEvent = + | "load" + | "domcontentloaded" + | "networkidle0" + | "networkidle2"; + /** The navigation options. */ export interface NavigationOptions { /** @@ -260,7 +266,7 @@ export interface NavigationOptions { * When to consider navigation succeeded. * @default load Navigation is consider when the `load` event is fired. */ - waitUntil?: "load" | "domcontentloaded" | "networkidle0" | "networkidle2"; + waitUntil?: LoadEvent | LoadEvent[]; } export type PDFFormat = From b3926ce5d6ac93022325643fc80726a7838bb047 Mon Sep 17 00:00:00 2001 From: ZheyangSong Date: Mon, 20 Nov 2017 11:29:49 -0800 Subject: [PATCH 048/269] React-Grid-Layout: Add `preventCollision` + Add missing `preventCollision` to `coreProps` --- types/react-grid-layout/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/react-grid-layout/index.d.ts b/types/react-grid-layout/index.d.ts index 7c59c0bf39..fc4f184956 100644 --- a/types/react-grid-layout/index.d.ts +++ b/types/react-grid-layout/index.d.ts @@ -178,6 +178,11 @@ declare namespace ReactGridLayout { */ isRearrangeable?: boolean; + /** + * If true, grid items won't change position when being dragged over. + */ + preventCollision?: boolean; + /** * Uses CSS3 `translate()` instead of position top/left. * This makes about 6x faster paint performance. From 35cb646ea831a66c7810ff7ca720e28dafdfafcf Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Mon, 20 Nov 2017 21:38:12 +0200 Subject: [PATCH 049/269] Fix middleware function name in `@types/koa-router` `middlewares` should be `middleware` https://github.com/alexmingoia/koa-router/blob/master/lib/router.js#L314 --- types/koa-router/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/koa-router/index.d.ts b/types/koa-router/index.d.ts index b543a764b0..c98083f25f 100644 --- a/types/koa-router/index.d.ts +++ b/types/koa-router/index.d.ts @@ -219,7 +219,7 @@ declare class Router { /** * Returns router middleware which dispatches a route matching the request. */ - middlewares(): Router.IMiddleware; + middleware(): Router.IMiddleware; /** * Returns separate middleware for responding to `OPTIONS` requests with From 1620d55592af71834b59298c2c825f5c54c2ea89 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Mon, 20 Nov 2017 17:13:32 -0500 Subject: [PATCH 050/269] Update statsjs typings --- types/stats.js/index.d.ts | 19 ++++++++++++++++--- types/stats.js/stats.js-tests.ts | 10 +++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/types/stats.js/index.d.ts b/types/stats.js/index.d.ts index 55b655f5bc..6449d82fd5 100644 --- a/types/stats.js/index.d.ts +++ b/types/stats.js/index.d.ts @@ -1,9 +1,12 @@ -// Type definitions for Stats.js 0.16.0 +// Type definitions for Stats.js 0.17.0 // Project: https://github.com/mrdoob/stats.js -// Definitions by: Gregory Dalton , Harm Berntsen +// Definitions by: Gregory Dalton , +// Harm Berntsen , +// Dan Vanderkam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare class Stats { + constructor(); REVISION: number; dom: HTMLDivElement; @@ -14,8 +17,18 @@ declare class Stats { begin(): void; end(): number; update(): void; + + addPanel(panel: Stats.Panel): Stats.Panel; } -declare module "stats.js" { +declare namespace Stats { + class Panel { + constructor(name: string, foregroundColor: string, backgroundColor: string); + dom: HTMLCanvasElement; + update(value: number, maxValue: number): void; + } +} + +declare module 'stats.js' { export = Stats; } diff --git a/types/stats.js/stats.js-tests.ts b/types/stats.js/stats.js-tests.ts index dfaf72e8de..21e1e4b8e5 100644 --- a/types/stats.js/stats.js-tests.ts +++ b/types/stats.js/stats.js-tests.ts @@ -1,17 +1,21 @@ - - -var stats = new Stats(); +const stats = new Stats(); stats.showPanel( 1 ); // 0: fps, 1: ms, 2: mb, 3+: custom document.body.appendChild( stats.dom ); +const panel = stats.addPanel( + new Stats.Panel('custom', 'red', 'pink')); + function animate() { stats.begin(); // monitored code goes here + // $ExpectType number stats.end(); + panel.update(40, 100); + requestAnimationFrame( animate ); } From 3962926dc14798e685f9f2e49821ac1c33afc0d1 Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Mon, 20 Nov 2017 16:00:41 -0800 Subject: [PATCH 051/269] Revert "Modified typedefs dependent on "geojson" to accommodate changes." This reverts commit 335d12a4ee9af8e7f0c25dc6fe93a059e3ee9fa9. --- types/d3-geo/d3-geo-tests.ts | 4 ++-- types/d3-geo/index.d.ts | 4 +--- types/geojson2osm/geojson2osm-tests.ts | 2 +- types/geojson2osm/index.d.ts | 2 +- types/leaflet/index.d.ts | 28 +++++++++++++------------- types/leaflet/v0/index.d.ts | 12 +++++------ types/mapbox-gl/index.d.ts | 8 ++++---- types/polyline/index.d.ts | 2 +- types/shapefile/index.d.ts | 4 ++-- types/supercluster/index.d.ts | 2 +- types/tilebelt/index.d.ts | 4 ++-- 11 files changed, 35 insertions(+), 37 deletions(-) diff --git a/types/d3-geo/d3-geo-tests.ts b/types/d3-geo/d3-geo-tests.ts index e6014837a7..876461e3e9 100644 --- a/types/d3-geo/d3-geo-tests.ts +++ b/types/d3-geo/d3-geo-tests.ts @@ -49,7 +49,7 @@ const sampleExtendedGeometryCollection: d3Geo.ExtendedGeometryCollection = { type: 'Feature', geometry: samplePolygon, properties: { @@ -74,7 +74,7 @@ const sampleExtendedFeature2: d3Geo.ExtendedFeature = { type: 'FeatureCollection', features: [ sampleFeature, diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index 1d1d36fe91..4093b696e9 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -36,9 +36,7 @@ export type GeoGeometryObjects = GeoJSON.GeometryObject | GeoSphere; export interface ExtendedGeometryCollection { type: string; bbox?: number[]; - // GeoJSON removed the Coordinate System objects from the spec, but does allow - // "foreign members". - crs?: GeoJSON.GeoJsonObject; + crs?: GeoJSON.CoordinateReferenceSystem; geometries: GeometryType[]; } diff --git a/types/geojson2osm/geojson2osm-tests.ts b/types/geojson2osm/geojson2osm-tests.ts index 9d95de64c4..887f10a83c 100644 --- a/types/geojson2osm/geojson2osm-tests.ts +++ b/types/geojson2osm/geojson2osm-tests.ts @@ -1,6 +1,6 @@ import { geojson2osm } from 'geojson2osm' -const features: GeoJSON.FeatureCollection = { +const features: GeoJSON.FeatureCollection = { type: 'FeatureCollection', features: [{ type: 'Feature', diff --git a/types/geojson2osm/index.d.ts b/types/geojson2osm/index.d.ts index 513348eeae..39b03de5bf 100644 --- a/types/geojson2osm/index.d.ts +++ b/types/geojson2osm/index.d.ts @@ -11,4 +11,4 @@ * @param features Input features * @returns OpenStreetMap XML */ -export function geojson2osm(features: GeoJSON.Feature | GeoJSON.FeatureCollection): any +export function geojson2osm(features: GeoJSON.Feature | GeoJSON.FeatureCollection): any diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 727478864a..b1e7ead796 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -583,7 +583,7 @@ export interface PolylineOptions extends PathOptions { export class Polyline extends Path { constructor(latlngs: LatLngExpression[], options?: PolylineOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; getLatLngs(): LatLng[]; setLatLngs(latlngs: LatLngExpression[]): this; isEmpty(): boolean; @@ -591,7 +591,7 @@ export class Polyline; options: PolylineOptions; } @@ -616,14 +616,14 @@ export interface CircleMarkerOptions extends PathOptions { export class CircleMarker

extends Path { constructor(latlng: LatLngExpression, options?: CircleMarkerOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; setLatLng(latLng: LatLngExpression): this; getLatLng(): LatLng; setRadius(radius: number): this; getRadius(): number; options: CircleMarkerOptions; - feature?: geojson.Feature; + feature?: geojson.Feature; } export function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker; @@ -671,7 +671,7 @@ export class LayerGroup

extends Layer { /** * Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint). */ - toGeoJSON(): geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; + toGeoJSON(): geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; /** * Adds the given layer to the group. @@ -725,7 +725,7 @@ export class LayerGroup

extends Layer { */ getLayerId(layer: Layer): number; - feature?: geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; + feature?: geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; } /** @@ -765,7 +765,7 @@ export class FeatureGroup

extends LayerGroup

{ */ export function featureGroup(layers?: Layer[]): FeatureGroup; -export type StyleFunction

= (feature?: geojson.Feature) => PathOptions; +export type StyleFunction

= (feature?: geojson.Feature) => PathOptions; export interface GeoJSONOptions

extends LayerOptions { /** @@ -781,7 +781,7 @@ export interface GeoJSONOptions

extends LayerOptions { * } * ``` */ - pointToLayer?(geoJsonPoint: geojson.Feature, latlng: LatLng): Layer; // should import GeoJSON typings + pointToLayer?(geoJsonPoint: geojson.Feature, latlng: LatLng): Layer; // should import GeoJSON typings /** * A Function defining the Path options for styling GeoJSON lines and polygons, @@ -807,7 +807,7 @@ export interface GeoJSONOptions

extends LayerOptions { * function (feature, layer) {} * ``` */ - onEachFeature?(feature: geojson.Feature, layer: Layer): void; + onEachFeature?(feature: geojson.Feature, layer: Layer): void; /** * A Function that will be used to decide whether to show a feature or not. @@ -820,7 +820,7 @@ export interface GeoJSONOptions

extends LayerOptions { * } * ``` */ - filter?(geoJsonFeature: geojson.Feature): boolean; + filter?(geoJsonFeature: geojson.Feature): boolean; /** * A Function that will be used for converting GeoJSON coordinates to LatLngs. @@ -838,7 +838,7 @@ export class GeoJSON

extends FeatureGroup

{ * Creates a Layer from a given GeoJSON feature. Can use a custom pointToLayer * and/or coordsToLatLng functions if provided as options. */ - static geometryToLayer(featureData: geojson.Feature, options?: GeoJSONOptions): Layer; + static geometryToLayer

(featureData: geojson.Feature, options?: GeoJSONOptions

): Layer; /** * Creates a LatLng object from an array of 2 numbers (longitude, latitude) or @@ -872,7 +872,7 @@ export class GeoJSON

extends FeatureGroup

{ /** * Normalize GeoJSON geometries/features into GeoJSON features. */ - static asFeature(geojson: geojson.Feature | geojson.GeometryObject): geojson.Feature; + static asFeature

(geojson: geojson.Feature | geojson.GeometryObject): geojson.Feature; constructor(geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions

) /** @@ -1454,7 +1454,7 @@ export interface MarkerOptions extends InteractiveLayerOptions { export class Marker

extends Layer { constructor(latlng: LatLngExpression, options?: MarkerOptions); - toGeoJSON(): geojson.Feature; + toGeoJSON(): geojson.Feature; getLatLng(): LatLng; setLatLng(latlng: LatLngExpression): this; setZIndexOffset(offset: number): this; @@ -1465,7 +1465,7 @@ export class Marker

extends Layer { // Properties options: MarkerOptions; dragging?: Handler; - feature?: geojson.Feature; + feature?: geojson.Feature; } export function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker; diff --git a/types/leaflet/v0/index.d.ts b/types/leaflet/v0/index.d.ts index d841a45133..efadd88e8f 100644 --- a/types/leaflet/v0/index.d.ts +++ b/types/leaflet/v0/index.d.ts @@ -223,7 +223,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the circle (GeoJSON Point Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -1716,7 +1716,7 @@ declare namespace L { * Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection). * Note: Descendent classes MultiPolygon & MultiPolyLine return `Feature`s, not `FeatureCollection`s */ - toGeoJSON(): GeoJSON.FeatureCollection|GeoJSON.Feature; + toGeoJSON(): GeoJSON.FeatureCollection|GeoJSON.Feature; //////////// //////////// @@ -2943,7 +2943,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the marker (GeoJSON Point Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; /** * Marker dragging handler (by both mouse and touch). @@ -3103,7 +3103,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the multipolygon (GeoJSON MultiPolygon Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -3144,7 +3144,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the multipolyline (GeoJSON MultiLineString Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } @@ -3565,7 +3565,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the polyline (GeoJSON LineString Feature). */ - toGeoJSON(): GeoJSON.Feature; + toGeoJSON(): GeoJSON.Feature; } } diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 6e61c90c70..6be9a465ef 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -54,9 +54,9 @@ declare namespace mapboxgl { unproject(point: PointLike): mapboxgl.LngLat; - queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature[]; + queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature[]; - querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[]; + querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[]; setStyle(style: mapboxgl.Style | string): this; @@ -507,11 +507,11 @@ declare namespace mapboxgl { constructor(options?: mapboxgl.GeoJSONSourceOptions); - setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; + setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; } export interface GeoJSONSourceOptions { - data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; + data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; maxzoom?: number; diff --git a/types/polyline/index.d.ts b/types/polyline/index.d.ts index 6961205212..7a8b7eeb19 100644 --- a/types/polyline/index.d.ts +++ b/types/polyline/index.d.ts @@ -9,7 +9,7 @@ interface Polyline { decode(string: string, precision?: number): number[][]; encode(coordinate: number[][], precision?: number): string; - fromGeoJSON(geojson: GeoJSON.LineString | GeoJSON.Feature, precision?: number): string; + fromGeoJSON(geojson: GeoJSON.LineString | GeoJSON.Feature, precision?: number): string; } declare var polyline: Polyline; diff --git a/types/shapefile/index.d.ts b/types/shapefile/index.d.ts index 83852507e1..54a18a2503 100644 --- a/types/shapefile/index.d.ts +++ b/types/shapefile/index.d.ts @@ -15,7 +15,7 @@ declare namespace shapefile { } interface Feature { done: boolean - value: GeoJSON.Feature + value: GeoJSON.Feature } interface Shapefile { bbox: Array @@ -23,7 +23,7 @@ declare namespace shapefile { } interface ShapefileStatic { open(shp: any, dbf?: any, options?: Options): Promise; - read(shp: any, dbf?: any, options?: Options): Promise; + read(shp: any, dbf?: any, options?: Options): Promise>; } } diff --git a/types/supercluster/index.d.ts b/types/supercluster/index.d.ts index 7463b4a43a..7fd487ae09 100644 --- a/types/supercluster/index.d.ts +++ b/types/supercluster/index.d.ts @@ -94,7 +94,7 @@ export class Supercluster { */ export default function supercluster(options: Options): Supercluster; -export type Point = GeoJSON.Feature; +export type Point = GeoJSON.Feature; export type Points = Point[]; export type Clusters = Cluster[]; export type TileFeatures = TileFeature[]; diff --git a/types/tilebelt/index.d.ts b/types/tilebelt/index.d.ts index eed92f915b..f8d3adae1c 100644 --- a/types/tilebelt/index.d.ts +++ b/types/tilebelt/index.d.ts @@ -14,12 +14,12 @@ declare namespace tilebelt { * * @name tileToGeoJSON * @param {Array} tile - * @returns {Feature} + * @returns {Feature} * @example * var poly = tileToGeoJSON([5, 10, 10]) * //=poly */ - tileToGeoJSON(tile: Array): GeoJSON.Feature + tileToGeoJSON(tile: Array): GeoJSON.Feature /** * Get the bbox of a tile From 40c131a283627305986a25d0f09937e6e1f53ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brikou=20Carr=C3=A9?= Date: Tue, 21 Nov 2017 01:03:17 +0100 Subject: [PATCH 052/269] Add missing url.URL and generic map to context --- types/koa/index.d.ts | 72 +++++++++++++++++++++++++++++++----------- types/koa/koa-tests.ts | 24 ++++++++------ 2 files changed, 69 insertions(+), 27 deletions(-) diff --git a/types/koa/index.d.ts b/types/koa/index.d.ts index d46920bf07..ea59b75b29 100644 --- a/types/koa/index.d.ts +++ b/types/koa/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for Koa 2.x // Project: http://koajs.com -// Definitions by: DavidCai1993 , jKey Lu +// Definitions by: DavidCai1993 +// jKey Lu +// Brice Bernard // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -15,20 +17,22 @@ =============================================== */ /// -import { EventEmitter } from 'events'; -import { IncomingMessage, ServerResponse, Server } from 'http'; -import { Socket, ListenOptions } from 'net'; -import * as compose from 'koa-compose'; -import * as Keygrip from 'keygrip'; -import * as httpAssert from 'http-assert'; -import * as Cookies from 'cookies'; -import * as accepts from 'accepts'; +import * as accepts from "accepts"; +import * as Cookies from "cookies"; +import { EventEmitter } from "events"; +import { IncomingMessage, ServerResponse, Server } from "http"; +import * as httpAssert from "http-assert"; +import * as Keygrip from "keygrip"; +import * as compose from "koa-compose"; +import { Socket, ListenOptions } from "net"; +import * as url from "url"; declare interface ContextDelegatedRequest { /** * Return request header. */ header: any; + /** * Return request header, alias as request.header */ @@ -80,7 +84,6 @@ declare interface ContextDelegatedRequest { */ search: string; - /** * Parse the "Host" header field host * and support X-Forwarded-Host when a @@ -95,6 +98,11 @@ declare interface ContextDelegatedRequest { */ hostname: string; + /** + * Get WHATWG parsed URL object. + */ + URL: url.URL; + /** * Check if the request is fresh, aka * Last-Modified and/or the ETag @@ -383,7 +391,7 @@ declare interface ContextDelegatedResponse { * this.set('Accept', 'application/json'); * this.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' }); */ - set(field: { [key: string]: string; }): void; + set(field: { [key: string]: string }): void; set(field: string, val: string | string[]): void; /** @@ -435,15 +443,36 @@ declare class Application extends EventEmitter { * * http.createServer(app.callback()).listen(...) */ - listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): Server; - listen(port: number, hostname?: string, listeningListener?: () => void): Server; + listen( + port?: number, + hostname?: string, + backlog?: number, + listeningListener?: () => void, + ): Server; + listen( + port: number, + hostname?: string, + listeningListener?: () => void, + ): Server; /* tslint:disable:unified-signatures */ - listen(port: number, backlog?: number, listeningListener?: () => void): Server; + listen( + port: number, + backlog?: number, + listeningListener?: () => void, + ): Server; listen(port: number, listeningListener?: () => void): Server; - listen(path: string, backlog?: number, listeningListener?: () => void): Server; + listen( + path: string, + backlog?: number, + listeningListener?: () => void, + ): Server; listen(path: string, listeningListener?: () => void): Server; listen(options: ListenOptions, listeningListener?: () => void): Server; - listen(handle: any, backlog?: number, listeningListener?: () => void): Server; + listen( + handle: any, + backlog?: number, + listeningListener?: () => void, + ): Server; listen(handle: any, listeningListener?: () => void): Server; /* tslint:enable:unified-signatures*/ @@ -477,7 +506,10 @@ declare class Application extends EventEmitter { * * @api private */ - createContext(req: IncomingMessage, res: ServerResponse): Application.Context; + createContext( + req: IncomingMessage, + res: ServerResponse, + ): Application.Context; /** * Default error handler. @@ -573,7 +605,9 @@ declare namespace Application { toJSON(): any; } - interface BaseContext extends ContextDelegatedRequest, ContextDelegatedResponse { + interface BaseContext + extends ContextDelegatedRequest, + ContextDelegatedResponse { /** * util.inspect() implementation, which * just returns the JSON output. @@ -621,6 +655,8 @@ declare namespace Application { * Default error handling. */ onerror(err: Error): void; + + [key: string]: any; } interface Request extends BaseRequest { diff --git a/types/koa/koa-tests.ts b/types/koa/koa-tests.ts index 1b261fdf44..6dbc073bea 100644 --- a/types/koa/koa-tests.ts +++ b/types/koa/koa-tests.ts @@ -1,21 +1,27 @@ - import * as Koa from "koa"; const app = new Koa(); +app.context.db = () => {}; + +app.use(async ctx => { + console.log(ctx.db); +}); + app.use((ctx, next) => { - const start: any = new Date(); - return next().then(() => { - const end: any = new Date(); - const ms = end - start; - console.log(`${ctx.method} ${ctx.url} - ${ms}ms`); - ctx.assert(true, 404, 'Yep!'); - }); + const start: any = new Date(); + return next().then(() => { + const end: any = new Date(); + const ms = end - start; + console.log(`${ctx.method} ${ctx.url} - ${ms}ms`); + ctx.assert(true, 404, "Yep!"); + }); }); // response app.use(ctx => { - ctx.body = "Hello World"; + ctx.body = "Hello World"; + ctx.body = ctx.URL.toString(); }); app.listen(3000); From f12705b83b35eb0c9c96aaf6211113431738022a Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Mon, 20 Nov 2017 16:23:57 -0800 Subject: [PATCH 053/269] Made revisions suggested by other devs. * Corrected number of elements for 3D bounding boxes. (Mistakenly had five elements instead of six.) * Renamed "BoundingBox" to "BBox" to shorten name. * Restored generic types to Feature and FeatureCollection. * Removed the support for foreign members on GeoJsonObject. Users can instead extend the interface or use "&". --- types/geojson/geojson-tests.ts | 37 +++++++++------------------- types/geojson/index.d.ts | 44 ++++++++++++++++++++-------------- 2 files changed, 37 insertions(+), 44 deletions(-) diff --git a/types/geojson/geojson-tests.ts b/types/geojson/geojson-tests.ts index c9042c9da2..ce8c62418e 100644 --- a/types/geojson/geojson-tests.ts +++ b/types/geojson/geojson-tests.ts @@ -1,9 +1,10 @@ import { + BBox, Feature, FeatureCollection, GeometryCollection, LineString, - MultiLineString, MultiPoint, MultiPolygon, Point, Polygon + MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, GeometryObject } from "geojson"; -let featureCollection: FeatureCollection = { +let featureCollection: FeatureCollection = { type: "FeatureCollection", features: [ { @@ -49,20 +50,10 @@ let featureCollection: FeatureCollection = { } } } - ], - // Coordinate Systems no longer supported in GeoJSON as of RFC 7946. - // This will still work due to the standard's allowance for - // "foregin members", however. - crs: { - type: "link", - properties: { - href: "http://example.com/crs/42", - type: "proj4" - } - } + ] }; -const featureWithPolygon: Feature = { +const featureWithPolygon: Feature = { type: "Feature", bbox: [-180.0, -90.0, 180.0, 90.0], geometry: { @@ -138,11 +129,12 @@ const geometryCollection: GeometryCollection = { ] }; -let feature: Feature = { +let feature: Feature = { type: "Feature", geometry: lineString, properties: null }; + feature = { type: "Feature", geometry: polygon, @@ -206,18 +198,11 @@ featureCollection = { geometry: geometryCollection, properties: { test: "OK" } } - ], - crs: { - type: "link", - properties: { - href: "http://example.com/crs/42", - type: "proj4" - } - } + ] }; // Allow access to custom properties -const pt: Feature = { +const pt: Feature = { type: "Feature", properties: { foo: "bar", @@ -250,7 +235,7 @@ const testProps: TestProperty = { hello: "world" }; -const typedPropertiesFeature: Feature = { +const typedPropertiesFeature: Feature = { type: "Feature", properties: testProps, geometry: { @@ -259,7 +244,7 @@ const typedPropertiesFeature: Feature = { } }; -const typedPropertiesFeatureCollection: FeatureCollection = { +const typedPropertiesFeatureCollection: FeatureCollection = { type: "FeatureCollection", features: [typedPropertiesFeature] }; diff --git a/types/geojson/index.d.ts b/types/geojson/index.d.ts index 2b086bc382..936756ff86 100644 --- a/types/geojson/index.d.ts +++ b/types/geojson/index.d.ts @@ -15,45 +15,51 @@ export as namespace GeoJSON; * The valid values for the "type" property of GeoJSON geometry objects. * https://tools.ietf.org/html/rfc7946#section-1.4 */ -export type GeoJsonGeometryTypeNames = "Point" | "LineString" | "MultiPoint" | "Polygon" | "MultiLineString" | +export type GeoJsonGeometryTypes = "Point" | "LineString" | "MultiPoint" | "Polygon" | "MultiLineString" | "MultiPolygon" | "GeometryCollection"; /** * The value values for the "type" property of GeoJSON Objects. * https://tools.ietf.org/html/rfc7946#section-1.4 */ -export type GeoJsonTypeNames = "FeatureCollection" | "Feature" | GeoJsonGeometryTypeNames; +export type GeoJsonTypes = "FeatureCollection" | "Feature" | GeoJsonGeometryTypes; /** * Bounding box * https://tools.ietf.org/html/rfc7946#section-5 */ -export type BoundingBox = [number, number, number, number] | [number, number, number, number, number]; +export type BBox = [number, number, number, number] | [number, number, number, number, number, number]; /** * A Position is an array of coordinates. * https://tools.ietf.org/html/rfc7946#section-3.1.1 + * Array should contain between two and three elements. + * The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values), + * but the current specification only allows X, Y, and (optionally) Z to be defined. */ -export type Position = [number, number] | [number, number, number]; +export type Position = number[]; // [number, number] | [number, number, number]; /** * The base GeoJSON object. - * https://tools.ietf.org/html/rfc7946#section-3 + * https://tools.ietf.org/html/rfc7946#section-3 + * The GeoJSON specification also allows foreign members + * (https://tools.ietf.org/html/rfc7946#section-6.1) + * Developers should use "&" type in TypeScript or extend the interface + * to add these foreign members. */ export interface GeoJsonObject { - /** - * Allow foreign members as specified in https://tools.ietf.org/html/rfc7946#section-6.1 - */ - [key: string]: any; + // Don't include foreign members directly into this type def. + // in order to preserve type safety. + // [key: string]: any; /** * Specifies the type of GeoJSON object. */ - type: GeoJsonTypeNames; + type: GeoJsonTypes; /** * Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. * https://tools.ietf.org/html/rfc7946#section-5 */ - bbox?: BoundingBox; + bbox?: BBox; } /** @@ -61,7 +67,7 @@ export interface GeoJsonObject { * https://tools.ietf.org/html/rfc7946#section-3 */ export interface GeometryObject extends GeoJsonObject { - type: GeoJsonGeometryTypeNames; + type: GeoJsonGeometryTypes; } /** @@ -124,19 +130,21 @@ export interface MultiPolygon extends GeometryObject { */ export interface GeometryCollection extends GeometryObject { type: "GeometryCollection"; - geometries: GeometryObject[]; + geometries: Array; } +export type GeoJsonProperties = { [name: string]: any; } | null; + /** * A feature object which contains a geometry and associated properties. * https://tools.ietf.org/html/rfc7946#section-3.2 */ -export interface Feature extends GeoJsonObject { +export interface Feature extends GeoJsonObject { type: "Feature"; /** * The feature's geometry */ - geometry: GeometryObject | null; + geometry: G | null; /** * A value that uniquely identifies this feature in a * https://tools.ietf.org/html/rfc7946#section-3.2. @@ -145,13 +153,13 @@ export interface Feature extends GeoJsonObject { /** * Properties associated with this feature. */ - properties: { [name: string]: any; } | null; + properties: P | null; } /** * A collection of feature objects. * https://tools.ietf.org/html/rfc7946#section-3.3 */ -export interface FeatureCollection extends GeoJsonObject { - features: Feature[]; +export interface FeatureCollection extends GeoJsonObject { + features: Array>; } From 2be9ad506f03a45178481bbd74cd6a19099c178b Mon Sep 17 00:00:00 2001 From: Lucky Soni Date: Tue, 21 Nov 2017 08:03:32 +0530 Subject: [PATCH 054/269] Backbone.History.route may accept string or RegExp as first argument --- types/backbone/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index 607f6413fc..c6652d83db 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -392,7 +392,7 @@ declare namespace Backbone { decodeFragment(fragment: string): string; getSearch(): string; stop(): void; - route(route: string, callback: Function): number; + route(route: string|RegExp, callback: Function): number; checkUrl(e?: any): void; getPath(): string; matchRoot(): boolean; From e36486c4e84bd14f79d761e63de2bf1e198cccfc Mon Sep 17 00:00:00 2001 From: Piotr Roszatycki Date: Tue, 21 Nov 2017 11:23:55 +0100 Subject: [PATCH 055/269] padLeft/padRight are defined in es2017.string lib already --- types/node/index.d.ts | 6 +----- types/node/node-tests.ts | 16 +--------------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 72e7cdbe30..61fd375e6f 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -68,12 +68,8 @@ interface SymbolConstructor { } declare var Symbol: SymbolConstructor; -// Node.js ES2017 and ESNEXT support +// Node.js ESNEXT support interface String { - /** Pads the current string with another string (repeated, if needed) so that the resulting string reaches the given length. The padding is applied from the start (left) of the current string. */ - padStart(targetLength?: number, padString?: string): string; - /** Pads the current string with a given string (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string. */ - padEnd(targetLength?: number, padString?: string): string; /** Removes whitespace from the left end of a string. */ trimLeft(): string; /** Removes whitespace from the right end of a string. */ diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 34bba1f7ba..d85a2574db 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -3752,25 +3752,11 @@ namespace module_tests { const m2: Module = new Module.Module("moduleId"); } -//////////////////////////////////////////////////// -/// Node.js ES2017 Support -//////////////////////////////////////////////////// - -namespace es2017_tests { - const s: string = 'foo'; - const s1: string = s.padStart(); - const s11: string = s.padStart(10); - const s12: string = s.padStart(10, 'x'); - const s2: string = s.padEnd(); - const s21: string = s.padEnd(10); - const s22: string = s.padEnd(10, 'x'); -} - //////////////////////////////////////////////////// /// Node.js ESNEXT Support //////////////////////////////////////////////////// -namespace esnext_tests { +namespace esnext_string_tests { const s: string = 'foo'; const s1: string = s.trimLeft(); const s2: string = s.trimRight(); From 0eaacc5ca4e8776d2a11b9177a341db4cd9c1189 Mon Sep 17 00:00:00 2001 From: rbot <30998401+rk-7@users.noreply.github.com> Date: Tue, 21 Nov 2017 19:00:51 +0530 Subject: [PATCH 056/269] Updated types to alexa-sdk@1.0.20. Separated files temporarily. --- types/alexa-sdk/index.d.ts | 184 ++++---------------- types/alexa-sdk/responseBuilder.d.ts | 170 +++++++++++++++++++ types/alexa-sdk/services.d.ts | 199 ++++++++++++++++++++++ types/alexa-sdk/templateBuilders.d.ts | 232 ++++++++++++++++++++++++++ types/alexa-sdk/tsconfig.json | 7 +- types/alexa-sdk/types.d.ts | 208 +++++++++++++++++++++++ types/alexa-sdk/utils.d.ts | 96 +++++++++++ 7 files changed, 940 insertions(+), 156 deletions(-) create mode 100644 types/alexa-sdk/responseBuilder.d.ts create mode 100644 types/alexa-sdk/services.d.ts create mode 100644 types/alexa-sdk/templateBuilders.d.ts create mode 100644 types/alexa-sdk/types.d.ts create mode 100644 types/alexa-sdk/utils.d.ts diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 1c39755b2d..bf64ff08df 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,3 +1,6 @@ + +import { utils } from './utils'; +import { AlexaObject, Image, TextField, TextContent, RequestBody, Context } from './types'; // Type definitions for Alexa SDK for Node.js 1.0 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs // Definitions by: Pete Beegle @@ -9,163 +12,34 @@ export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; -export let StateString: string; -export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; -export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; - -export interface AlexaObject extends Handler { - _event: any; - _context: any; - _callback: any; - state: any; - appId: any; - response: any; - resources: any; - dynamoDBTableName: any; - saveBeforeResponse: boolean; - registerHandlers: (...handlers: Array>) => any; - execute: () => void; +export namespace directives { + export class VoicePlayerSpeakDirective { + /** + * Creates an instance of VoicePlayerSpeakDirective. + * @param {string} requestId - requestId from which the call is originated from + * @param {string} speechContent - Contents of the speech directive either in plain text or SSML. + * @memberof DirectiveService + */ + constructor(requestId: string, speechContent: string); + } } +//#region exports from other modules +export { templateBuilders } from "./templateBuilders"; -export interface Handlers { - [intent: string]: (this: Handler) => void; -} +export { services } from "./services"; -export interface Handler { - on: any; - emit(event: string, ...args: any[]): boolean; - emitWithState: any; - state: any; - handler: any; - event: RequestBody; - attributes: any; - context: any; - name: any; - isOverriden: any; - t: (token: string, ...args: any[]) => void; -} +export { + AlexaObject, Image, CardImage, TextField, + TextContent, RequestBody, Context, Handler, IntentRequest, + ListItem, Template, Handlers, Session, SessionApplication, + SessionUser, LaunchRequest, SessionEndedRequest, + Request, ResolutionStatus, ResolutionValue, + ResolutionValueContainer, Resolutions, SlotValue, + Intent, ResponseBody, Response, OutputSpeech, + Card, Reprompt, ConfirmationStatuses, DialogStates, + StateString -export interface Context { - callbackWaitsForEmptyEventLoop: boolean; - logGroupName: string; - logStreamName: string; - functionName: string; - memoryLimitInMB: string; - functionVersion: string; - invokeid: string; - awsRequestId: string; -} - -export interface RequestBody { - version: string; - session: Session; - request: T; -} - -export interface Session { - new: boolean; - sessionId: string; - attributes: any; - application: SessionApplication; - user: SessionUser; -} - -export interface SessionApplication { - applicationId: string; -} - -export interface SessionUser { - userId: string; - accessToken?: string; -} - -export interface LaunchRequest extends Request { } - -export interface IntentRequest extends Request { - dialogState?: DialogStates; - intent?: Intent; -} - -export interface SessionEndedRequest extends Request { - reason?: string; -} - -export interface Request { - type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest"; - requestId: string; - timestamp: string; - locale?: string; -} - -export interface ResolutionStatus { - code: string; -} - -export interface ResolutionValue { - name: string; - id: string; -} - -export interface ResolutionValueContainer { - value: ResolutionValue; -} - -export interface Resolution { - authority: string; - status: ResolutionStatus; - values: ResolutionValueContainer[]; -} - -export interface Resolutions { - resolutionsPerAuthority: Resolution[]; -} - -export interface SlotValue { - confirmationStatus?: ConfirmationStatuses; - name: string; - value?: any; - resolutions?: Resolutions; -} - -export interface Intent { - confirmationStatus?: ConfirmationStatuses; - name: string; - slots: Record; -} - -export interface ResponseBody { - version: string; - sessionAttributes?: any; - response: Response; -} - -export interface Response { - outputSpeech?: OutputSpeech; - card?: Card; - reprompt?: Reprompt; - shouldEndSession: boolean; -} - -export interface OutputSpeech { - type: "PlainText" | "SSML"; - text?: string; - ssml?: string; -} - -export interface Card { - type: "Simple" | "Standard" | "LinkAccount"; - title?: string; - content?: string; - text?: string; - image?: Image; -} - -export interface Image { - smallImageUrl: string; - largeImageUrl: string; -} - -export interface Reprompt { - outputSpeech: OutputSpeech; -} +} from './types'; +export { utils } from './utils'; +//#endregion \ No newline at end of file diff --git a/types/alexa-sdk/responseBuilder.d.ts b/types/alexa-sdk/responseBuilder.d.ts new file mode 100644 index 0000000000..83d32cf4f0 --- /dev/null +++ b/types/alexa-sdk/responseBuilder.d.ts @@ -0,0 +1,170 @@ +import { Handler, Request, Template, Image, CardImage } from './types'; +export declare const CARD_TYPES: { + STANDARD: 'Standard', + SIMPLE: 'Simple', + LINK_ACCOUNT: 'LinkAccount', + ASK_FOR_PERMISSIONS_CONSENT: 'AskForPermissionsConsent' +}; + +export declare const HINT_TYPES: { + PLAIN_TEXT: 'PlainText' +}; + +export declare const DIRECTIVE_TYPES: { + AUDIOPLAYER: { + PLAY: 'AudioPlayer.Play', + STOP: 'AudioPlayer.Stop', + CLEAR_QUEUE: 'AudioPlayer.ClearQueue' + }, + DISPLAY: { + RENDER_TEMPLATE: 'Display.RenderTemplate' + }, + HINT: 'Hint', + VIDEOAPP: { + LAUNCH: 'VideoApp.Launch' + } +}; + +/** + * Responsible for building JSON responses as per the Alexa skills kit interface + * https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference#response-body-syntax + * + * @class ResponseBuilder + */ +export class ResponseBuilder { + constructor(alexaHandler: Handler); + + /** + * Have Alexa say the provided speechOutput to the user + * + * @param {string} speechOutput + * @returns + * @memberof ResponseBuilder + */ + speak(speechOutput: string): ResponseBuilder; + + /** + * Have alexa listen for speech from the user. If the user doesn't respond within 8 seconds + * then have alexa reprompt with the provided reprompt speech + * @param {string} repromptSpeech + * @returns + * @memberof ResponseBuilder + */ + listen(repromptSpeech: string): ResponseBuilder; + + /** + * Render a card with the following title, content and image + * + * @param {string} cardTitle + * @param {string} cardContent + * @param {{smallImageUrl : string, largeImageUrl : string}} cardImage + * @returns + * @memberof ResponseBuilder + */ + cardRenderer(cardTitle: string, cardContent: string, cardImage: CardImage): ResponseBuilder; + + /** + * Render a link account card + * + * @returns + * @memberof ResponseBuilder + */ + linkAccountCard(): ResponseBuilder; + + /** + * Render a askForPermissionsConsent card + * @param {[{ [key: string]: string }]} permissions + * @returns + * @memberOf ResponseBuilder + */ + askForPermissionsConsentCard(permissions: [{ [key: string]: string }]): ResponseBuilder; + + /** + * Creates a play, stop or clearQueue audioPlayer directive depending on the directive type passed in. + * @deprecated - use audioPlayerPlay, audioPlayerStop, audioPlayerClearQueue instead + * @param {string} directiveType + * @param {string} behavior + * @param {string} url + * @param {string} token + * @param {string} expectedPreviousToken + * @param {number} offsetInMilliseconds + * @returns + * @memberof ResponseBuilder + */ + audioPlayer(directiveType: string, behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder; + + /** + * Creates an AudioPlayer play directive + * + * @param {string} behavior Describes playback behavior. Accepted values: + * REPLACE_ALL: Immediately begin playback of the specified stream, and replace current and enqueued streams. + * ENQUEUE: Add the specified stream to the end of the current queue. This does not impact the currently playing stream. + * REPLACE_ENQUEUED: Replace all streams in the queue. This does not impact the currently playing stream. + * @param {string} url Identifies the location of audio content at a remote HTTPS location. + * The audio file must be hosted at an Internet-accessible HTTPS endpoint. HTTPS is required, and the domain hosting the + * files must present a valid, trusted SSL certificate. Self-signed certificates cannot be used. + * The supported formats for the audio file include AAC/MP4, MP3, HLS, PLS and M3U. Bitrates: 16kbps to 384 kbps. + * @param {string} token A token that represents the audio stream. This token cannot exceed 1024 characters + * @param {string} expectedPreviousToken A token that represents the expected previous stream. + * This property is required and allowed only when the playBehavior is ENQUEUE. This is used to prevent potential race conditions + * if requests to progress through a playlist and change tracks occur at the same time. + * @param {number} offsetInMilliseconds The timestamp in the stream from which Alexa should begin playback. + * Set to 0 to start playing the stream from the beginning. Set to any other value to start playback from that associated point in the stream + * @returns + * @memberof ResponseBuilder + */ + audioPlayerPlay(behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder; + + /** + * Creates an AudioPlayer Stop directive - Stops the current audio Playback + * + * @returns + * @memberof ResponseBuilder + */ + audioPlayerStop(): ResponseBuilder; + + /** + * Creates an AudioPlayer ClearQueue directive - clear the queue without stopping the currently playing stream, + * or clear the queue and stop any currently playing stream. + * + * @param {string} clearBehavior Describes the clear queue behavior. Accepted values: + * CLEAR_ENQUEUED: clears the queue and continues to play the currently playing stream + * CLEAR_ALL: clears the entire playback queue and stops the currently playing stream (if applicable). + * @returns + * @memberof ResponseBuilder + */ + audioPlayerClearQueue(clearBehavior: string): ResponseBuilder; + + /** + * Creates a Display RenderTemplate Directive + * + * Use a template builder to generate a template object + * + * @param {Template} template + * @returns + * @memberof ResponseBuilder + */ + renderTemplate(template: Template): ResponseBuilder; + + /** + * Creates a hint directive - show a hint on the screen of the echo show + * + * @param {string} hintText text to show on the hint + * @param {string} hintType (optional) Default value : PlainText + * @returns + * @memberof ResponseBuilder + */ + hint(hintText: string, hintType: string): ResponseBuilder; + + /** + * Creates a VideoApp play directive to play a video + * + * @param {string} source Identifies the location of video content at a remote HTTPS location. + * The video file must be hosted at an Internet-accessible HTTPS endpoint. + * @param {{title : string, subtitle : string}} metadata (optional) Contains an object that provides the + * information that can be displayed on VideoApp. + * @returns + * @memberof ResponseBuilder + */ + playVideo(source: string, metadata: { title: string, subtitle: string }): ResponseBuilder; +} \ No newline at end of file diff --git a/types/alexa-sdk/services.d.ts b/types/alexa-sdk/services.d.ts new file mode 100644 index 0000000000..1498f17cbe --- /dev/null +++ b/types/alexa-sdk/services.d.ts @@ -0,0 +1,199 @@ +export namespace services { + export interface ApiClientOptions { hostname: string; port: string; path: string; protocol: string; headers: string; method: string } + export interface ApiClientResponse { statusCode: string; statusText: string; body: Object; headers: Object } + export interface ListItemObject { value: string, status: string, version: any } + export interface ListObject { name: string, status: string, version: any } + export interface ApiClient { + /** + * Make a POST API call to the specified uri with headers and optional body + * @param {string} uri http(s?) endpoint to call + * @param {Object} headers Key value pair of headers + * @param {string} body post body to send + * @returns {Promise} + * @memberof ApiClient + */ + post(uri: string, headers: Object, body?: string): Promise; + /** + * Make a PUT API call to the specified uri with headers and optional body + * @param {string} uri http(s?) endpoint to call + * @param {Object} headers Key value pair of headers + * @param {string} body post body to send + * @returns {Promise} + * @memberof ApiClient + */ + put(uri: string, headers: Object, body?: string): Promise; + /** + * Make a GET API call to the specified uri with headers + * @param {string} uri http(s?) endpoint to call + * @param {Object} headers key value pair of headers + * @returns {Promise} + * @memberof ApiClient + */ + get(uri: string, headers: Object): Promise; + /** + * Make a DELETE API call to the specified uri with headers + * @param {string} uri http(s?) endpoint to call + * @param {Object} headers key value pair of headers + * @returns {Promise} + */ + delete(uri: string, headers: Object): Promise; + } + export class DeviceAddressService { + /** + * Create an instance of DeviceAddressService + * @param {ApiClient} [apiClient=new ApiClient()] ApiClient + * @memberOf DeviceAddressService + */ + constructor(apiClient: ApiClient); + + /** + * Get full address information from Alexa Device Address API + * @param {string} deviceId deviceId from Alexa request + * @param {string} apiEndpoint API apiEndpoint from Alexa request + * @param {string} token bearer token for device address permission + * @returns {Promise} + * @memberOf DeviceAddressService + */ + getFullAddress(deviceId: string, apiEndpoint: string, token: string): Promise; + + /** + * Get country and postal information from Alexa Device Address API + * @param {string} deviceId deviceId from Alexa request + * @param {string} apiEndpoint API apiEndpoint from Alexa request + * @param {string} token bearer token for device address permission + * @returns {Promise} + * @memberOf DeviceAddressService + */ + getCountryAndPostalCode(deviceId: string, apiEndpoint: string, token: string): Promise; + } + export class DirectiveService { + + /** + * Creates an instance of DirectiveService. + * @param {ApiClient} [apiClient=new ApiClient()] ApiClient + * @memberof DirectiveService + */ + constructor(apiClient: ApiClient); + + /** + * Send the specified directiveObj to Alexa directive service + * + * @param {Object} directive directive to send to service + * @param {string} apiEndpoint API endpoint from Alexa request + * @param {string} token bearer token for directive service + * @returns {Promise} + * @memberof DirectiveService + */ + enqueue(directive: Object, apiEndpoint: string, token: string): Promise; + } + export class ListManagementService { + + /** + * Create an instance of ListManagementService + * @param apiClient + */ + constructor(apiClient: ApiClient); + + /** + * Set apiEndpoint address, default is 'https://api.amazonalexa.com' + * @param apiEndpoint + * @returns void + * @memberOf ListManagementService + */ + setApiEndpoint(apiEndpoint: string): void; + + /** + * Get currently set apiEndpoint address + * @returns {string} + * @memberOf ListManagementService + */ + getApiEndpoint(): string; + + /** + * Retrieve the metadata for all customer lists, including the customer's default lists + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + getListsMetadata(token: string): Promise; + + /** + * Create a custom list. The new list name must be different than any existing list name + * @param {ListObject} listObject + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + createList(listObject: ListObject, token: string): Promise + + /** + * Retrieve list metadata including the items in the list with requested status + * @param {string} listId unique Id associated with the list + * @param {string} itemStatus itemsStatus can be either 'active' or 'completed' + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + getList(listId: string, itemStatus: string, token: string): Promise; + + /** + * Update a custom list. Only the list name or state can be updated + * @param {string} listId unique Id associated with the list + * @param {ListObject} listObject + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + updateList(listId: string, listObject: ListObject, token: string): Promise; + + /** + * Delete a custom list + * @param {string} listId unique Id associated with the list + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + deleteList(listId: string, token: string): Promise; + + /** + * Create an item in an active list or in a default list + * @param {string} listId unique Id associated with the list + * @param {ListItemObject} listItemObject + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + createListItem(listId: string, listItemObject: ListItemObject, token: string): Promise; + + /** + * Retrieve single item within any list by listId and itemId + * @param {string} listId unique Id associated with the list + * @param {string} itemId unique Id associated with the item + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + getListItem(listId: string, itemId: string, token: string): Promise; + + /** + * Update an item value or item status + * @param {string} listId unique Id associated with the list + * @param {string} itemId unique Id associated with the item + * @param {ListItemObject} listItemObject + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + updateListItem(listId: string, itemId: string, listItemObject: ListItemObject, token: string): Promise; + + /** + * Delete an item in the specified list + * @param {string} listId unique Id associated with the list + * @param {string} itemId unique Id associated with the item + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + deleteListItem(listId: string, itemId: string, token: string): Promise; + } +} \ No newline at end of file diff --git a/types/alexa-sdk/templateBuilders.d.ts b/types/alexa-sdk/templateBuilders.d.ts new file mode 100644 index 0000000000..03834ca54a --- /dev/null +++ b/types/alexa-sdk/templateBuilders.d.ts @@ -0,0 +1,232 @@ +import { Image, TextField, ListItem, Template } from './types'; +export namespace templateBuilders { + export interface SetTextContent> { + setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T; + } + export interface SetListItems> { + setListItems(listItems: ListItem[]): T; + } + export abstract class TemplateBuilder> { + public template: Template; + constructor(); + + /** + * Sets the title of the template + * + * @param {string} title + * @returns + * @memberof TemplateBuilder + */ + public setTitle(title: string): T; + + /** + * Sets the token of the template + * + * @param {string} token + * @returns + * @memberof TemplateBuilder + */ + public setToken(token: string): T; + + /** + * Sets the background image of the template + * + * @param {Image} image + * @returns + * @memberof TemplateBuilder + */ + public setBackgroundImage(image: Image): T; + + /** + * Sets the backButton behavior + * + * @param {string} backButtonBehavior 'VISIBLE' or 'HIDDEN' + * @returns + * @memberof TemplateBuilder + */ + public setBackButtonBehavior(backButtonBehavior: string): T; + + /** + * Builds the template JSON object + * + * @returns + * @memberof TemplateBuilder + */ + public build(): Template; + // /** + // * Sets the text content for the template + // * + // * @param {TextField} primaryText + // * @param {TextField} secondaryText + // * @param {TextField} tertiaryText + // * @returns TemplateBuilder + // * @memberof TemplateBuilder + // */ + // public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T; + } + /** + * Used to build a list of ListItems for ListTemplate + * + * @class ListItemBuilder + */ + export class ListItemBuilder { + constructor(); + public items: ListItem[]; + /** + * Add an item to the list of template + * + * @param {Image} image + * @param {string} token + * @param {TextField} primaryText + * @param {TextField} secondaryText + * @param {TextField} tertiaryText + * @memberof ListItemBuilder + */ + public addItem(image: Image, token: string, primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): ListItemBuilder; + + public build(): ListItem[]; + } + /** + * Used to create BodyTemplate1 objects + * + * @class BodyTemplate1Builder + * @extends {TemplateBuilder} + */ + export class BodyTemplate1Builder extends TemplateBuilder implements SetTextContent{ + constructor(); + /** + * Sets the text content for the template + * + * @param {TextField} primaryText + * @param {TextField} secondaryText + * @param {TextField} tertiaryText + * @returns BodyTemplate1Builder + * @memberof BodyTemplate1Builder + */ + public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate1Builder; + } + /** + * Used to create BodyTemplate2 objects + * + * @class BodyTemplate2Builder + * @extends {TemplateBuilder} + */ + export class BodyTemplate2Builder extends TemplateBuilder implements SetTextContent { + constructor(); + + /** + * Sets the image for the template + * + * @param {Image} image + * @returns + * @memberof BodyTemplate2Builder + */ + public setImage(image: Image): BodyTemplate2Builder + + /** + * Sets the text content for the template + * + * @param {TextField} primaryText + * @param {TextField} secondaryText + * @param {TextField} tertiaryText + * @returns BodyTemplate2Builder + * @memberof BodyTemplate2Builder + */ + public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate2Builder; + } + /** + * Used to create BodyTemplate3 objects + * + * @class BodyTemplate3Builder + * @extends {TemplateBuilder} + */ + export class BodyTemplate3Builder extends TemplateBuilder implements SetTextContent { + constructor(); + + /** + * Sets the image for the template + * + * @param {any} image + * @returns + * @memberof BodyTemplate3Builder + */ + public setImage(image: any): BodyTemplate3Builder; + + /** + * Sets the text content for the template + * + * @param {TextField} primaryText + * @param {TextField} secondaryText + * @param {TextField} tertiaryText + * @returns BodyTemplate3Builder + * @memberof BodyTemplate3Builder + */ + public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate3Builder; + } + /** + * Used to create BodyTemplate6 objects + * + * @class BodyTemplate6Builder + * @extends {TemplateBuilder} + */ + export class BodyTemplate6Builder extends TemplateBuilder implements SetTextContent { + constructor(); + + /** + * Sets the image for the template + * + * @param {any} image + * @returns + * @memberof BodyTemplate6Builder + */ + public setImage(image: any): BodyTemplate6Builder; + + /** + * Sets the text content for the template + * + * @param {TextField} primaryText + * @param {TextField} secondaryText + * @param {TextField} tertiaryText + * @returns BodyTemplate6Builder + * @memberof BodyTemplate6Builder + */ + public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate6Builder; + } + /** + * Used to create ListTemplate1 objects + * + * @class ListTemplate1Builder + * @extends {TemplateBuilder} + */ + export class ListTemplate1Builder extends TemplateBuilder implements SetListItems { + constructor(); + + /** + * Set the items for the list + * + * @param {any} listItems + * @returns + * @memberof ListTemplate1Builder + */ + setListItems(listItems: ListItem[]): ListTemplate1Builder; + } + /** + * Used to create ListTemplate2 objects + * + * @class ListTemplate2Builder + * @extends {TemplateBuilder} + */ + export class ListTemplate2Builder extends TemplateBuilder implements SetListItems { + constructor(); + + /** + * Set the items for the list + * + * @param {any} listItems + * @returns + * @memberof ListTemplate2Builder + */ + setListItems(listItems: ListItem[]): ListTemplate2Builder; + } + +} \ No newline at end of file diff --git a/types/alexa-sdk/tsconfig.json b/types/alexa-sdk/tsconfig.json index acc11c8263..e5b9d60424 100644 --- a/types/alexa-sdk/tsconfig.json +++ b/types/alexa-sdk/tsconfig.json @@ -19,5 +19,10 @@ "files": [ "index.d.ts", "alexa-sdk-tests.ts" + "responseBuilder.d.ts", + "services.d.ts", + "templateBuilders.d.ts", + "types.d.ts", + "utils.d.ts", ] -} \ No newline at end of file +} diff --git a/types/alexa-sdk/types.d.ts b/types/alexa-sdk/types.d.ts new file mode 100644 index 0000000000..42daa46f60 --- /dev/null +++ b/types/alexa-sdk/types.d.ts @@ -0,0 +1,208 @@ +import { i18n } from "../i18next"; +import { ResponseBuilder } from "./responseBuilder"; +export let StateString: string; + +export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; +export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; + +export interface CardImage { + smallImageUrl: string; + largeImageUrl: string; +} +export interface Image { + smallImageUrl: string; + largeImageUrl: string; + contentDescription: string; + sources: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>; +} +export type TextField = { + text: string, + type: string +}; +export type TextContent = { + primaryText: TextField, + secondaryText: TextField, + tertiaryText: TextField, +} +export type ListItem = { image: Image; token: string; textContent: TextContent; }; +export type Template = { + title: string; + token: string; + backgroundImage: Image; + backButton: string; + type: string; + image: Image; + listItems: ListItem[]; +}; + +export interface AlexaObject extends Handler { + _event: any; + _context: any; + _callback: any; + state: any; + appId: any; + response: any; + resources: any; + dynamoDBTableName: any; + saveBeforeResponse: boolean; + registerHandlers: (...handlers: Array>) => any; + execute: () => void; +} + +export interface Handlers { + [intent: string]: (this: Handler) => void; +} + +export interface Handler { + on: any; + emit(event: string, ...args: any[]): boolean; + emitWithState: any; + state: any; + handler: any; + i18n: i18n, + locale: any, + event: RequestBody; + attributes: any; + context: any; + callback: Function; + name: any; + isOverriden: any; + t: (token: string, ...args: any[]) => void; + response: ResponseBuilder; +} +export enum PLAYER_ACTIVITY { + IDLE = 'IDLE', + PAUSED = 'PAUSED', + PLAYING = 'PLAYING', + BUFFER_UNDERRUN = 'BUFFER_UNDERRUN', + FINISHED = 'FINISHED', + STOPPED = 'STOPPED' +} +export interface Context { + System: System + AudioPlayer: AudioPlayer +} +export interface System { + apiAccessToken: string; + apiEndpoint: string; + application: any; + device: any; + user: any; +} +export interface AudioPlayer { + token: string; + offsetInMilliseconds: number; + playerActivity: PLAYER_ACTIVITY; +} +export interface RequestBody { + version: string; + session: Session; + request: T; +} + +export interface Session { + new: boolean; + sessionId: string; + attributes: any; + application: SessionApplication; + user: SessionUser; +} + +export interface SessionApplication { + applicationId: string; +} + +export interface SessionUser { + userId: string; + accessToken?: string; + /** + * @deprecated + */ + permissions: any; +} + +export interface LaunchRequest extends Request { } + +export interface IntentRequest extends Request { + dialogState?: DialogStates; + intent?: Intent; +} + +export interface SessionEndedRequest extends Request { + reason?: string; +} + +export interface Request { + type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest"; + requestId: string; + timestamp: string; + locale?: string; +} + +export interface ResolutionStatus { + code: string; +} + +export interface ResolutionValue { + name: string; + id: string; +} + +export interface ResolutionValueContainer { + value: ResolutionValue; +} + +export interface Resolution { + authority: string; + status: ResolutionStatus; + values: ResolutionValueContainer[]; +} + +export interface Resolutions { + resolutionsPerAuthority: Resolution[]; +} + +export interface SlotValue { + confirmationStatus?: ConfirmationStatuses; + name: string; + value?: any; + resolutions?: Resolutions; +} + +export interface Intent { + confirmationStatus?: ConfirmationStatuses; + name: string; + slots: Record; +} + +export interface ResponseBody { + version: string; + sessionAttributes?: any; + response: Response; +} + +export interface Response { + outputSpeech?: OutputSpeech; + card?: Card; + reprompt?: Reprompt; + directives?: any; + shouldEndSession?: boolean; +} + +export interface OutputSpeech { + type: "PlainText" | "SSML"; + text?: string; + ssml?: string; +} + +export interface Card { + type: "Simple" | "Standard" | "LinkAccount"; + title?: string; + content?: string; + text?: string; + image?: Image; +} + +export interface Reprompt { + outputSpeech: OutputSpeech; +} \ No newline at end of file diff --git a/types/alexa-sdk/utils.d.ts b/types/alexa-sdk/utils.d.ts new file mode 100644 index 0000000000..056a52530e --- /dev/null +++ b/types/alexa-sdk/utils.d.ts @@ -0,0 +1,96 @@ + +import { TextField, TextContent, Image } from "./types"; +export namespace utils { + export class ImageUtils { + /** + * Creates an image object with a single source + * + * These images may be in either JPEG or PNG formats, with the appropriate file extensions. + * An image cannot be larger than 2 MB + * You must host the images at HTTPS URLs that are publicly accessible. + * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. + * + * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, + * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, + * which means that larger images will be downscaled for display on Echo Show if provided. + * + * example : ImageUtils.makeImage('https://url/to/my/img.png', 300, 400, 'SMALL', 'image description') + * + * @static + * @param {string} url url of the image + * @param {number} widthPixels (optional) width of the image in pixels + * @param {number} heightPixels (optional) height of the image in pixels + * @param {string} size size of the image (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE) + * @param {string} description text used to describe the image in a screen reader + * @returns + * @memberof ImageUtils + */ + public static makeImage(url: string, widthPixels?: number, heightPixels?: number, size?: string, description?: string): Image; + /** + * + * Creates an image object with a multiple sources, source images are provided as an array of image objects + * + * These images may be in either JPEG or PNG formats, with the appropriate file extensions. + * An image cannot be larger than 2 MB + * You must host the images at HTTPS URLs that are publicly accessible. + * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. + * + * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, + * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, + * which means that larger images will be downscaled for display on Echo Show if provided. + * example : + * let imgArr = [ + * { 'https://url/to/my/small.png', 300, 400, 'SMALL' }, + * { 'https://url/to/my/large.png', 900, 1200, 'LARGE' }, + * ] + * ImageUtils.makeImage(imgArr, 'image description') + * + * @static + * @param {{url : string, widthPixels : number, heightPixels : number, size : string}[]} imgArr + * @param {string} description text used to describe the image in a screen reader + * @returns + * @memberof ImageUtils + */ + public static makeImages(imgArr: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>, description: string): Image; + } + /** + * Utility methods for building TextField objects + * + * @class TextUtils + */ + export class TextUtils { + + /** + * Creates a plain TextField object with contents : text + * + * @static + * @param {string} text contents of plain text object + * @returns + * @memberof TextUtils + */ + public static makePlainText(text: string): TextField; + + /** + * Creates a rich TextField object with contents : text + * + * @static + * @param {string} text + * @returns + * @memberof TextUtils + */ + public static makeRichText(text: string): TextField; + + /** + * Creates a textContent + * + * @static + * @param {{type : string, text : string}} primaryText + * @param {{type : string, text : string}} secondaryText + * @param {{type : string, text : string}} tertiaryText + * @returns + * @memberof TextUtils + */ + public static makeTextContent(primaryText: { type: string, text: string }, + secondaryText: { type: string, text: string }, tertiaryText: { type: string, text: string }): TextContent + } +} \ No newline at end of file From 72921a4e5e770c5ecfaa8bac6a7ed8be632ee642 Mon Sep 17 00:00:00 2001 From: Pierre Date: Tue, 21 Nov 2017 16:42:25 +0100 Subject: [PATCH 057/269] Update new flatpickr def See https://github.com/chmln/flatpickr/blob/3c100acb1e4329b764089140511667ea400116c4/index.d.ts#L28-L29 --- types/react-flatpickr/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/react-flatpickr/index.d.ts b/types/react-flatpickr/index.d.ts index e960524854..ebac89f48d 100644 --- a/types/react-flatpickr/index.d.ts +++ b/types/react-flatpickr/index.d.ts @@ -5,12 +5,12 @@ // TypeScript Version: 2.3 import { Component } from 'react'; -import { Hook, Options } from 'flatpickr'; +import { Options } from 'flatpickr'; export interface DateTimePickerProps { defaultValue?: string; - options?: Options; - onChange?: Hook; + options?: Options.Options; + onChange?: Options.Hook; value?: string; } From 2d23c6a91bd16e260ebe9688a91dd4851622f245 Mon Sep 17 00:00:00 2001 From: Jochen Becker Date: Tue, 21 Nov 2017 16:52:56 +0100 Subject: [PATCH 058/269] [cordova-plugin-keyboard] update to version 1.2.0 add methods "hide" and "show" --- .../cordova-plugin-keyboard-tests.ts | 34 +-- types/cordova-plugin-keyboard/index.d.ts | 195 +++++++++--------- 2 files changed, 124 insertions(+), 105 deletions(-) diff --git a/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts b/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts index 767eaa6ed2..8a707f057d 100644 --- a/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts +++ b/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts @@ -1,23 +1,31 @@ Keyboard.shrinkView(true); Keyboard.shrinkView(false); +Keyboard.shrinkView(null, (currentValue) => console.log(currentValue)); + Keyboard.hideFormAccessoryBar(true); Keyboard.hideFormAccessoryBar(false); +Keyboard.hideFormAccessoryBar(null, (currentValue) => console.log(currentValue)); + Keyboard.disableScrollingInShrinkView(true); Keyboard.disableScrollingInShrinkView(false); +Keyboard.disableScrollingInShrinkView(null, (currentValue) => console.log(currentValue)); + +Keyboard.hide(); + +Keyboard.show(); + if (Keyboard.isVisible) { console.log('Keyboard is visible'); } -Keyboard.automaticScrollToTopOnHiding = true; -Keyboard.onshow = function () { - console.log('onshow'); -}; -Keyboard.onhide = function () { - console.log('onhide'); -}; -Keyboard.onshowing = function () { - console.log('onshowing'); -}; -Keyboard.onhiding= function () { - console.log('onhiding'); -}; +Keyboard.automaticScrollToTopOnHiding = true; + +window.addEventListener('keyboardDidShow', () => console.log('keyboardDidShow')); + +window.addEventListener('keyboardDidHide', () => console.log('keyboardDidHide')); + +window.addEventListener('keyboardWillShow', () => console.log('keyboardWillShow')); + +window.addEventListener('keyboardWillHide', () => console.log('keyboardWillHide')); + +window.addEventListener('keyboardHeightWillChange', (event) => console.log(`keyboardHeightWillChange - keyboard height: ${event.keyboardHeight}`)); diff --git a/types/cordova-plugin-keyboard/index.d.ts b/types/cordova-plugin-keyboard/index.d.ts index 427a5425e5..6298050b2c 100644 --- a/types/cordova-plugin-keyboard/index.d.ts +++ b/types/cordova-plugin-keyboard/index.d.ts @@ -1,32 +1,9 @@ -// Type definitions for Apache Cordova Keyboard plugin v0.1.2 -// Project: https://github.com/apache/cordova-plugins/tree/master/keyboard -// Definitions by: Dan Manastireanu +// Type definitions for Apache Cordova Keyboard plugin v1.2.0 +// Project: https://github.com/cjpearson/cordova-plugin-keyboard +// Definitions by: Dan Manastireanu +// Jochen Becker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** - * The Keyboard object provides some functions to customize the iOS keyboard. - * - * Supported Platforms: iOS - * - * This plugin has only been tested in Cordova 3.2 or greater, - * and its use in previous Cordova versions is not recommended - * (potential conflict with keyboard customization code present in the core in previous Cordova versions). - * - * If you do use this plugin in an older Cordova version (again, not recommended), - * you have to make sure the HideKeyboardFormAccessoryBar and KeyboardShrinksView preference values are always false, - * and only use the API functions to turn things on/off. - * - * This plugin supports the HideKeyboardFormAccessoryBar (boolean) - * and KeyboardShrinksView (boolean) preferences in config.xml. - * - * Permissions in config.xml - * - * - * - * - * - * - */ interface Keyboard { // Methods @@ -39,15 +16,20 @@ interface Keyboard { * This applies to apps that position their elements relative to the bottom of the WebView. * This is the default behaviour on Android, and makes a lot of sense when building apps as opposed to webpages. * + * Supported Platforms: + * - iOS + * * Example: * * Keyboard.shrinkView(true); * Keyboard.shrinkView(false); + * Keyboard.shrinkView(null, function (currentValue) { console.log(currentValue); }); * * * @param shrink + * @param successCallback A success callbackfunction */ - shrinkView(shrink:boolean): void, + shrinkView(shrink: boolean, successCallback?: (currentValue: any) => void): void, /** * Hide the keyboard toolbar. @@ -55,21 +37,29 @@ interface Keyboard { * Set to true to hide the additional toolbar that is on top of the keyboard. * This toolbar features the Prev, Next, and Done buttons. * + * Supported Platforms: + * - iOS + * * Example: * * Keyboard.hideFormAccessoryBar(true); * Keyboard.hideFormAccessoryBar(false); + * Keyboard.hideFormAccessoryBar(null, function (currentValue) { console.log(currentValue); }); * * * @param hide + * @param successCallback A success callbackfunction */ - hideFormAccessoryBar(hide:boolean): void, + hideFormAccessoryBar(hide: boolean, successCallback?: (currentValue: any) => void): void, /** * Disable scrolling when the the WebView is shrunk. * * Set to true to disable scrolling when the WebView is shrunk. * + * Supported Platforms: + * - iOS + * * Example: * * Keyboard.disableScrollingInShrinkView(true); @@ -77,8 +67,40 @@ interface Keyboard { * * * @param disable + * @param successCallback A success callbackfunction */ - disableScrollingInShrinkView(disable:boolean): void, + disableScrollingInShrinkView(disable: boolean, successCallback?: (currentValue: any) => void): void, + + /** + * Hide the keyboard + * + * Call this method to hide the keyboard + * + * Supported Platforms: + * - iOS + * - Android + * + * Example: + * + * Keyboard.hide(); + * + */ + hide(): void, + + /** + * Show the keyboard + * + * Call this method to show the keyboard. + * + * Supported Platforms: + * - Android + * + * Example: + * + * Keyboard.show(); + * + */ + show(): void, // Properties @@ -87,6 +109,9 @@ interface Keyboard { * * Read this property to determine if the keyboard is visible. * + * Supported Platforms: + * - iOS + * * Example: * * if (Keyboard.isVisible) { @@ -102,73 +127,59 @@ interface Keyboard { * Set this to true if you need that page scroll to beginning when keyboard is hiding. * This is allows to fix issue with elements declared with position: fixed, after keyboard is hiding. * + * Supported Platforms: + * - iOS + * * Example: * * Keyboard.automaticScrollToTopOnHiding = true; * * */ - automaticScrollToTopOnHiding: boolean, - - // Events - - /** - * If defined, this function is fired when keyboard fully shown. - * - * Attach handler to this event to be able to receive notification when keyboard is shown. - * - * Example: - * - * Keyboard.onshow = function () { - * // Describe your logic which will be run each time keyboard is shown. - * } - * - * - */ - onshow():void, - /** - * If defined, this function is fired when keyboard fully closed. - * - * Attach handler to this event to be able to receive notification when keyboard is closed. - * - * Example: - * - * Keyboard.onhide = function () { - * // Describe your logic which will be run each time keyboard is closed. - * } - * - * - */ - onhide():void, - /** - * If defined, this function is fired before keyboard will be shown. - * - * Attach handler to this event to be able to receive notification when keyboard is about to be shown on the screen. - * - * Example: - * - * Keyboard.onshowing = function () { - * // Describe your logic which will be run each time when keyboard is about to be shown. - * } - * - * - */ - onshowing():void, - /** - * If defined, this function is fired when keyboard is about to be closed. - * - * Attach handler to this event to be able to receive notification when keyboard is about to be closed. - * - * Example: - * - * Keyboard.onhiding = function () { - * // Describe your logic which will be run each time when keyboard is about to be closed. - * } - * - * - */ - onhiding():void, - + automaticScrollToTopOnHiding: boolean } -declare var Keyboard:Keyboard; +interface CordovaKeyboardEvent extends Event { + /** The height of the keyboard */ + keyboardHeight: number; +} + +interface Window { + /** + * @param type This event is fired when keyboard fully shown. + * + * @param callback Function is called when keyboard is shown. + */ + addEventListener(type: 'keyboardDidShow', callback: () => any, useCapture?: boolean): void; + + /** + * @param type This event is fired when the keyboard is fully closed. + * + * @param callback Function is called when keyboard is closed. + */ + addEventListener(type: 'keyboardDidHide', callback: () => any, useCapture?: boolean): void; + + /** + * @param type This event fires before keyboard will be shown. + * + * @param callback Function is called when keyboard is about to be shown on the screen. + */ + addEventListener(type: 'keyboardWillShow', callback: () => any, useCapture?: boolean): void; + + /** + * @param type This event is fired when the keyboard is fully closed. + * + * @param callback Function is called when keyboard is about to be closed. + */ + addEventListener(type: 'keyboardWillHide', callback: () => any, useCapture?: boolean): void; + + /** + * @param type This event is fired when the keyboard is fully closed. + * + * @param callback Function is called when keyboard is about to be closed. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + addEventListener(type: 'keyboardHeightWillChange', callback: (event: CordovaKeyboardEvent) => any, useCapture?: boolean): void; +} + +declare var Keyboard: Keyboard; From c5b3a813a7c9c36976a6da84a676dd6565837b46 Mon Sep 17 00:00:00 2001 From: Ika Date: Wed, 22 Nov 2017 00:02:58 +0800 Subject: [PATCH 059/269] fix(prettier): add missing `getSupportInfo()` --- types/prettier/index.d.ts | 27 +++++++++++++++++++++++++++ types/prettier/prettier-tests.ts | 3 +++ 2 files changed, 30 insertions(+) diff --git a/types/prettier/index.d.ts b/types/prettier/index.d.ts index cb0a813385..a24bf6ce18 100644 --- a/types/prettier/index.d.ts +++ b/types/prettier/index.d.ts @@ -161,6 +161,33 @@ export namespace resolveConfig { */ export function clearConfigCache(): void; +export interface SupportLanguage { + name: string; + since: string; + parsers: string[]; + group?: string; + tmScope: string; + aceMode: string; + codemirrorMode: string; + codemirrorMimeType: string; + aliases?: string[]; + extensions: string[]; + filenames?: string[]; + linguistLanguageId: number; + vscodeLanguageIds: string[]; +} + +export interface SupportInfo { + languages: SupportLanguage[]; +} + +/** + * Returns an object representing the parsers, languages and file types Prettier supports. + * If `version` is provided (e.g. `"1.5.0"`), information for that version will be returned, + * otherwise information for the current version will be returned. + */ +export function getSupportInfo(version?: string): SupportInfo; + /** * `version` field in `package.json` */ diff --git a/types/prettier/prettier-tests.ts b/types/prettier/prettier-tests.ts index 9d78453bae..47edb63ce9 100644 --- a/types/prettier/prettier-tests.ts +++ b/types/prettier/prettier-tests.ts @@ -33,3 +33,6 @@ if (options !== null) { } prettier.clearConfigCache(); + +const currentSupportInfo = prettier.getSupportInfo(); +const specificSupportInfo = prettier.getSupportInfo("1.8.0"); From d9620b5e2a618683aec2c94d12fd360ecb4e0c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Flor=C3=AAncio?= Date: Tue, 21 Nov 2017 16:38:00 +0000 Subject: [PATCH 060/269] Updated index.d.ts with the last version Replaced the contents with the new version: https://github.com/mpneuried/nodecache/blob/master/index.d.ts Has new methods. --- types/node-cache/index.d.ts | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/types/node-cache/index.d.ts b/types/node-cache/index.d.ts index 558882a086..00e7316edc 100644 --- a/types/node-cache/index.d.ts +++ b/types/node-cache/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/tcs-de/nodecache // Definitions by: Ilya Mochalov // Daniel Thunell +// Ulf Seltmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -89,8 +90,16 @@ declare namespace NodeCache { ttl( key: Key, - cb?: Callback, - ttl?: number + cb?: Callback + ): boolean; + + getTtl( + key: Key, + ): number|undefined; + + getTtl( + key: Key, + cb?: Callback ): boolean; /** @@ -130,6 +139,7 @@ declare namespace NodeCache { checkperiod?: number; useClones?: boolean; errorOnMissing?: boolean; + deleteOnExpire?: boolean; } interface Stats { @@ -225,7 +235,7 @@ declare class NodeCache extends events.EventEmitter implements NodeCache.NodeCac ): number; /** - * reset or redefine the ttl of a key. If `ttl` is not passed or set to 0 it's similar to `.del()` + * reset or redefine the ttl of a key. If `ttl` is not passed or set to 0 `stdTtl` is used. if set lt 0 it's similar to `.del()` */ ttl( key: Key, @@ -235,10 +245,19 @@ declare class NodeCache extends events.EventEmitter implements NodeCache.NodeCac ttl( key: Key, - cb?: Callback, - ttl?: number + cb?: Callback ): boolean; + getTtl( + key: Key + ): number|undefined; + + getTtl( + key: Key, + cb?: Callback, + ): boolean; + + /** * list all keys within this cache * @param cb Callback function From 5c544da4bd563e1264a722e7e8dc4ad7ce6c271b Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Tue, 21 Nov 2017 10:26:40 -0800 Subject: [PATCH 061/269] Added missing space --- types/geojson/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/geojson/index.d.ts b/types/geojson/index.d.ts index 936756ff86..d6ba411e3f 100644 --- a/types/geojson/index.d.ts +++ b/types/geojson/index.d.ts @@ -130,7 +130,7 @@ export interface MultiPolygon extends GeometryObject { */ export interface GeometryCollection extends GeometryObject { type: "GeometryCollection"; - geometries: Array; + geometries: Array; } export type GeoJsonProperties = { [name: string]: any; } | null; From 4bf9699f266191627f85253d366daed02a241295 Mon Sep 17 00:00:00 2001 From: Peter Bartha Date: Tue, 21 Nov 2017 19:56:38 +0100 Subject: [PATCH 062/269] Add optional 'options' parameter to the setSelection and setSelections method in CodeMirror. --- types/codemirror/index.d.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index 45e503e068..24e905b8e2 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -535,11 +535,14 @@ declare namespace CodeMirror { /** Set the cursor position.You can either pass a single { line , ch } object , or the line and the character as two separate parameters. */ setCursor(pos: CodeMirror.Position): void; - /** Set the selection range.anchor and head should be { line , ch } objects.head defaults to anchor when not given. */ - setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position): void; + /** Set a single selection range. anchor and head should be {line, ch} objects. head defaults to anchor when not given. */ + setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position, options?: { bias: number, clearRedo: boolean, origin: string, scroll: boolean }): void; - /** Set and normalize selection ranges and range should be { anchor, head } objects. primary determines which selection is the primary one. */ - setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number): void; + /** Sets a new set of selections. There must be at least one selection in the given array. When primary is a + number, it determines which selection is the primary one. When it is not given, the primary index is taken from + the previous selection, or set to the last range if the previous selection had less ranges than the new one. + Supports the same options as setSelection. */ + setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number, options?: { bias: number, clearRedo: boolean, origin: string, scroll: boolean }): void; /** Similar to setSelection , but will, if shift is held or the extending flag is set, move the head of the selection while leaving the anchor at its current place. From 2c708ba138274c676752a3736460042afa51b454 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 21 Nov 2017 23:19:34 +0100 Subject: [PATCH 063/269] elasticsearch: add error classes, flatten definitions, lint --- types/elasticsearch/elasticsearch-tests.ts | 59 +- types/elasticsearch/index.d.ts | 3150 ++++++++++---------- types/elasticsearch/tsconfig.json | 4 +- types/elasticsearch/tslint.json | 76 +- 4 files changed, 1633 insertions(+), 1656 deletions(-) diff --git a/types/elasticsearch/elasticsearch-tests.ts b/types/elasticsearch/elasticsearch-tests.ts index 1be3f740bc..3043a1f473 100644 --- a/types/elasticsearch/elasticsearch-tests.ts +++ b/types/elasticsearch/elasticsearch-tests.ts @@ -1,6 +1,6 @@ -import elasticsearch = require("elasticsearch"); +import * as elasticsearch from "elasticsearch"; -var client = new elasticsearch.Client({ +let client = new elasticsearch.Client({ host: 'localhost:9200', log: 'trace' }); @@ -10,26 +10,26 @@ client = new elasticsearch.Client({ 'box1.server.org', 'box2.server.org' ], - selector: function (hosts: any) { } + selector: (hosts: any) => { } }); client.ping({ requestTimeout: 30000 -}, function (error) { +}, (error) => { }); client.search({ q: 'pants' -}).then(function (body) { - var hits = body.hits.hits; -}, function (error) { +}).then((body) => { + const hits = body.hits.hits; +}, (error) => { }); client.indices.delete({ index: 'test_index', ignore: [404] -}).then(function (body) { -}, function (error) { +}).then((body) => { +}, (error) => { }); client.deleteByQuery({ @@ -39,8 +39,8 @@ client.deleteByQuery({ query: { } } -}).then(function (response) { -}, function (error) { +}).then((response) => { +}, (error) => { }); client.create({ @@ -103,7 +103,7 @@ client.cluster.stats({ client.count({ index: 'index_name' -}, function (error, response) { +}, (error, response) => { // ... }); @@ -120,7 +120,7 @@ client.count({ } } } -}, function (err, response) { +}, (err, response) => { // ... }); @@ -132,7 +132,7 @@ client.explain({ // the query to score it against q: 'field:value' -}, function (error, response) { +}, (error, response) => { // ... }); @@ -145,7 +145,7 @@ client.explain({ match: { title: 'test' } } } -}, function (error, response) { +}, (error, response) => { // ... }); @@ -158,8 +158,7 @@ client.index({ tags: ['y', 'z'], published: true, } -}, function (error, response) { - +}, (error, response) => { }); client.mget({ @@ -170,7 +169,7 @@ client.mget({ { _index: 'indexC', _type: 'typeC', _id: '1' } ] } -}, function (error, response) { +}, (error, response) => { // ... }); @@ -180,14 +179,14 @@ client.mget({ body: { ids: [1, 2, 3] } -}, function (error, response) { +}, (error, response) => { // ... }); client.search({ index: 'myindex', q: 'title:test' -}, function (error, response) { +}, (error, response) => { // ... }); @@ -207,7 +206,7 @@ client.search({ } } } -}, function (error, response) { +}, (error, response) => { // ... }); @@ -221,12 +220,11 @@ client.suggest({ } } } -}, function (error, response) { +}, (error, response) => { }); - // first we do a search, and specify a scroll timeout -var allTitles: string[] = []; +const allTitles: string[] = []; client.search({ index: 'myindex', // Set to 30 seconds because we are calling right back @@ -236,14 +234,14 @@ client.search({ q: 'title:test' }, function getMoreUntilDone(error, response) { // collect the title from each response - response.hits.hits.forEach(function (hit) { + response.hits.hits.forEach((hit) => { allTitles.push(hit.fields.title); }); if (response.hits.total !== allTitles.length) { // now we can call scroll over and over client.scroll({ - scrollId: response._scroll_id, + scrollId: response._scroll_id!, scroll: '30s' }, getMoreUntilDone); } else { @@ -258,8 +256,13 @@ client.indices.updateAliases({ { add: { index: 'logstash-2014.05', alias: 'logstash-current' } } ] } -}).then(function (response) { +}).then((response) => { // ... -}, function (error) { +}, (error) => { // ... }); + +// Errors +function testErrors() { + throw new elasticsearch.errors.AuthenticationException(); +} diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index 8acc7e4097..c728f9e495 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -2,1607 +2,1651 @@ // Project: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html // Definitions by: Casper Skydt , Blake Smith , Dave Dunkin , Jeffery Grajkowski , Margus Lamp , Ahmad Ferdous Bin Alam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -declare module Elasticsearch { - export class Client { - constructor(params: ConfigOptions); - cat: Cat; - cluster: Cluster; - indices: Indices; - ingest: Ingest; - nodes: Nodes; - snapshot: Snapshot; - tasks: Tasks; - bulk(params: BulkIndexDocumentsParams): Promise; - bulk(params: BulkIndexDocumentsParams, callback: (error: any, response: any) => void): void; - clearScroll(params: ClearScrollParams, callback: (error: any, response: any) => void): void; - clearScroll(params: ClearScrollParams): Promise; - count(params: CountParams, callback: (error: any, response: CountResponse) => void): void; - count(params: CountParams): Promise; - create(params: CreateDocumentParams): Promise; - create(params: CreateDocumentParams, callback: (err: any, response: CreateDocumentResponse, status: any) => void): void; - delete(params: DeleteDocumentParams): Promise; - delete(params: DeleteDocumentParams, callback: (error: any, response: DeleteDocumentResponse) => void): void; - deleteByQuery(params: DeleteDocumentByQueryParams): Promise; - deleteByQuery(params: DeleteDocumentByQueryParams, callback: (error: any, response: DeleteDocumentByQueryResponse) => void): void; - deleteScript(params: DeleteScriptParams): Promise; - deleteScript(params: DeleteScriptParams, callback: (error: any, response: any) => void): void; - deleteTemplate(params: DeleteTemplateParams): Promise; - deleteTemplate(params: DeleteTemplateParams, callback: (error: any, response: any) => void): void; - exists(params: ExistsParams): Promise; - exists(params: ExistsParams, callback: (error: any, response: any, status?: any) => void): void; - explain(params: ExplainParams): Promise; - explain(params: ExplainParams, callback: (error: any, response: ExplainResponse) => void): void; - fieldStats(params: FieldStatsParams): Promise; - fieldStats(params: FieldStatsParams, callback: (error: any, response: FieldStatsResponse) => void): void; - get(params: GetParams, callback: (error: any, response: GetResponse) => void): void; - get(params: GetParams): Promise>; - getScript(params: GetScriptParams): Promise; - getScript(params: GetScriptParams, callback: (error: any, response: any) => void): void; - getSource(params: GetSourceParams): Promise; - getSource(params: GetSourceParams, callback: (error: any, response: any) => void): void; - getTemplate(params: GetTemplateParams): Promise; - getTemplate(params: GetTemplateParams, callback: (error: any, response: any) => void): void; - index(params: IndexDocumentParams): Promise; - index(params: IndexDocumentParams, callback: (error: any, response: any) => void): void; - info(params: InfoParams): Promise; - info(params: InfoParams, callback: (error: any, response: any) => void): void; - mget(params: MGetParams, callback: (error: any, response: MGetResponse) => void): void; - mget(params: MGetParams): Promise>; - msearch(params: MSearchParams, callback: (error: any, response: MSearchResponse) => void): void; - msearch(params: MSearchParams): Promise>; - msearchTemplate(params: MSearchTemplateParams, callback: (error: any, response: MSearchResponse) => void): void; - msearchTemplate(params: MSearchTemplateParams): Promise>; - mtermvectors(params: MTermVectorsParams): Promise; - mtermvectors(params: MTermVectorsParams, callback: (error: any, response: any) => void): void; - ping(params: PingParams): Promise; - ping(params: PingParams, callback: (err: any, response: any, status: any) => void): void; - putScript(params: PutScriptParams): Promise; - putScript(params: PutScriptParams, callback: (err: any, response: any, status: any) => void): void; - putTemplate(params: PutTemplateParams): Promise; - putTemplate(params: PutTemplateParams, callback: (err: any, response: any, status: any) => void): void; - reindex(params: ReindexParams): Promise; - reindex(params: ReindexParams, callback: (error: any, response: ReindexResponse) => void): void; - reindexRethrottle(params: ReindexRethrottleParams): Promise; - reindexRethrottle(params: ReindexRethrottleParams, callback: (error: any, response: any) => void): void; - renderSearchTemplate(params: RenderSearchTemplateParams): Promise; - renderSearchTemplate(params: RenderSearchTemplateParams, callback: (error: any, response: any) => void): void; - scroll(params: ScrollParams): Promise>; - scroll(params: ScrollParams, callback: (error: any, response: SearchResponse) => void): void; - search(params: SearchParams): Promise>; - search(params: SearchParams, callback: (error: any, response: SearchResponse) => void): void; - searchShards(params: SearchShardsParams): Promise; - searchShards(params: SearchShardsParams, callback: (error: any, response: SearchShardsResponse) => void): void; - searchTemplate(params: SearchTemplateParams): Promise; - searchTemplate(params: SearchTemplateParams, callback: (error: any, response: any) => void): void; - suggest(params: SuggestParams): Promise; - suggest(params: SuggestParams, callback: (error: any, response: any) => void): void; - termvectors(params: TermvectorsParams): Promise; - termvectors(params: TermvectorsParams, callback: (error: any, response: any) => void): void; - update(params: UpdateDocumentParams): Promise; - update(params: UpdateDocumentParams, callback: (error: any, response: any) => void): void; - updateByQuery(params: UpdateDocumentByQueryParams): Promise; - updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: any) => void): void; - close(): void; - } +export class Client { + constructor(params: ConfigOptions); + cat: Cat; + cluster: Cluster; + indices: Indices; + ingest: Ingest; + nodes: Nodes; + snapshot: Snapshot; + tasks: Tasks; + bulk(params: BulkIndexDocumentsParams): Promise; + bulk(params: BulkIndexDocumentsParams, callback: (error: any, response: any) => void): void; + clearScroll(params: ClearScrollParams, callback: (error: any, response: any) => void): void; + clearScroll(params: ClearScrollParams): Promise; + count(params: CountParams, callback: (error: any, response: CountResponse) => void): void; + count(params: CountParams): Promise; + create(params: CreateDocumentParams): Promise; + create(params: CreateDocumentParams, callback: (err: any, response: CreateDocumentResponse, status: any) => void): void; + delete(params: DeleteDocumentParams): Promise; + delete(params: DeleteDocumentParams, callback: (error: any, response: DeleteDocumentResponse) => void): void; + deleteByQuery(params: DeleteDocumentByQueryParams): Promise; + deleteByQuery(params: DeleteDocumentByQueryParams, callback: (error: any, response: DeleteDocumentByQueryResponse) => void): void; + deleteScript(params: DeleteScriptParams): Promise; + deleteScript(params: DeleteScriptParams, callback: (error: any, response: any) => void): void; + deleteTemplate(params: DeleteTemplateParams): Promise; + deleteTemplate(params: DeleteTemplateParams, callback: (error: any, response: any) => void): void; + exists(params: ExistsParams): Promise; + exists(params: ExistsParams, callback: (error: any, response: any, status?: any) => void): void; + explain(params: ExplainParams): Promise; + explain(params: ExplainParams, callback: (error: any, response: ExplainResponse) => void): void; + fieldStats(params: FieldStatsParams): Promise; + fieldStats(params: FieldStatsParams, callback: (error: any, response: FieldStatsResponse) => void): void; + get(params: GetParams, callback: (error: any, response: GetResponse) => void): void; + get(params: GetParams): Promise>; + getScript(params: GetScriptParams): Promise; + getScript(params: GetScriptParams, callback: (error: any, response: any) => void): void; + getSource(params: GetSourceParams): Promise; + getSource(params: GetSourceParams, callback: (error: any, response: any) => void): void; + getTemplate(params: GetTemplateParams): Promise; + getTemplate(params: GetTemplateParams, callback: (error: any, response: any) => void): void; + index(params: IndexDocumentParams): Promise; + index(params: IndexDocumentParams, callback: (error: any, response: any) => void): void; + info(params: InfoParams): Promise; + info(params: InfoParams, callback: (error: any, response: any) => void): void; + mget(params: MGetParams, callback: (error: any, response: MGetResponse) => void): void; + mget(params: MGetParams): Promise>; + msearch(params: MSearchParams, callback: (error: any, response: MSearchResponse) => void): void; + msearch(params: MSearchParams): Promise>; + msearchTemplate(params: MSearchTemplateParams, callback: (error: any, response: MSearchResponse) => void): void; + msearchTemplate(params: MSearchTemplateParams): Promise>; + mtermvectors(params: MTermVectorsParams): Promise; + mtermvectors(params: MTermVectorsParams, callback: (error: any, response: any) => void): void; + ping(params: PingParams): Promise; + ping(params: PingParams, callback: (err: any, response: any, status: any) => void): void; + putScript(params: PutScriptParams): Promise; + putScript(params: PutScriptParams, callback: (err: any, response: any, status: any) => void): void; + putTemplate(params: PutTemplateParams): Promise; + putTemplate(params: PutTemplateParams, callback: (err: any, response: any, status: any) => void): void; + reindex(params: ReindexParams): Promise; + reindex(params: ReindexParams, callback: (error: any, response: ReindexResponse) => void): void; + reindexRethrottle(params: ReindexRethrottleParams): Promise; + reindexRethrottle(params: ReindexRethrottleParams, callback: (error: any, response: any) => void): void; + renderSearchTemplate(params: RenderSearchTemplateParams): Promise; + renderSearchTemplate(params: RenderSearchTemplateParams, callback: (error: any, response: any) => void): void; + scroll(params: ScrollParams): Promise>; + scroll(params: ScrollParams, callback: (error: any, response: SearchResponse) => void): void; + search(params: SearchParams): Promise>; + search(params: SearchParams, callback: (error: any, response: SearchResponse) => void): void; + searchShards(params: SearchShardsParams): Promise; + searchShards(params: SearchShardsParams, callback: (error: any, response: SearchShardsResponse) => void): void; + searchTemplate(params: SearchTemplateParams): Promise; + searchTemplate(params: SearchTemplateParams, callback: (error: any, response: any) => void): void; + suggest(params: SuggestParams): Promise; + suggest(params: SuggestParams, callback: (error: any, response: any) => void): void; + termvectors(params: TermvectorsParams): Promise; + termvectors(params: TermvectorsParams, callback: (error: any, response: any) => void): void; + update(params: UpdateDocumentParams): Promise; + update(params: UpdateDocumentParams, callback: (error: any, response: any) => void): void; + updateByQuery(params: UpdateDocumentByQueryParams): Promise; + updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: any) => void): void; + close(): void; +} - export interface ConfigOptions { - host?: any; - hosts?: any; - httpAuth?: string; - log?: any; - apiVersion?: string; - plugins?: any; - sniffOnStart?: boolean; - sniffInterval?: number; - sniffOnConnectionFault?: boolean; - maxRetries?: number; - requestTimeout?: number; - deadTimeout?: number; - pingTimeout?: number; - keepAlive?: boolean; - maxSockets?: number; - suggestCompression?: boolean; - connectionClass?: string; - sniffedNodesProtocol?: string; - ssl?: Object; - selector?: any; - defer?: () => void; - nodesToHostCallback?: any; - createNodeAgent?: any; - } +export interface ConfigOptions { + host?: any; + hosts?: any; + httpAuth?: string; + log?: any; + apiVersion?: string; + plugins?: any; + sniffOnStart?: boolean; + sniffInterval?: number; + sniffOnConnectionFault?: boolean; + maxRetries?: number; + requestTimeout?: number; + deadTimeout?: number; + pingTimeout?: number; + keepAlive?: boolean; + maxSockets?: number; + suggestCompression?: boolean; + connectionClass?: string; + sniffedNodesProtocol?: string; + ssl?: object; + selector?: any; + defer?: () => void; + nodesToHostCallback?: any; + createNodeAgent?: any; +} - export interface Explanation { - value: number; - description: string; - details: Explanation[]; - } +export interface Explanation { + value: number; + description: string; + details: Explanation[]; +} - export interface GenericParams { - requestTimeout?: number; - maxRetries?: number; - method?: string; - body?: any; - ignore?: number | number[]; - filterPath?: string | string[]; - } +export interface GenericParams { + requestTimeout?: number; + maxRetries?: number; + method?: string; + body?: any; + ignore?: number | number[]; + filterPath?: string | string[]; +} - export interface ShardsResponse { - total: number; - successful: number; - failed: number; - } +export interface ShardsResponse { + total: number; + successful: number; + failed: number; +} - /** - * A string of a number and a time unit. A time unit is one of - * [d, h, m, s, ms, micros, nanos]. eg: "30s" for 30 seconds. - * These are incorrectly identified as `Date | number` in the docs as of 2016-11-15. - */ - export type TimeSpan = string; +/** + * A string of a number and a time unit. A time unit is one of + * [d, h, m, s, ms, micros, nanos]. eg: "30s" for 30 seconds. + * These are incorrectly identified as `Date | number` in the docs as of 2016-11-15. + */ +export type TimeSpan = string; - export type NameList = string | string[] | boolean; - export type Refresh = boolean | "true" | "false" | "wait_for" | ""; - export type VersionType = "internal" | "external" | "external_gte" | "force"; - export type ExpandWildcards = "open" | "closed" | "none" | "all"; - export type DefaultOperator = "AND" | "OR"; - export type Conflicts = "abort" | "proceed"; +export type NameList = string | string[] | boolean; +export type Refresh = boolean | "true" | "false" | "wait_for" | ""; +export type VersionType = "internal" | "external" | "external_gte" | "force"; +export type ExpandWildcards = "open" | "closed" | "none" | "all"; +export type DefaultOperator = "AND" | "OR"; +export type Conflicts = "abort" | "proceed"; - export interface BulkIndexDocumentsParams extends GenericParams { - waitForActiveShards?: string; - refresh?: Refresh; - routing?: string; - timeout?: TimeSpan; - type?: string; - fields?: NameList; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - pipeline?: string; - index?: string; - } +export interface BulkIndexDocumentsParams extends GenericParams { + waitForActiveShards?: string; + refresh?: Refresh; + routing?: string; + timeout?: TimeSpan; + type?: string; + fields?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + pipeline?: string; + index?: string; +} - export interface ClearScrollParams extends GenericParams { - scrollId: NameList; - } +export interface ClearScrollParams extends GenericParams { + scrollId: NameList; +} - export interface CountParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - minScore?: number; - preference?: string; - routing?: string; - q?: string; - analyzer?: string; - analyzeWildcard?: boolean; - defaultOperator?: DefaultOperator; - df?: string; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - index?: NameList; - type?: NameList; - } +export interface CountParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + minScore?: number; + preference?: string; + routing?: string; + q?: string; + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + index?: NameList; + type?: NameList; +} - export interface CountResponse { - count: number; - _shards: ShardsResponse; - } +export interface CountResponse { + count: number; + _shards: ShardsResponse; +} - export interface CreateDocumentParams extends GenericParams { - waitForActiveShards?: string; - parent?: string; - refresh?: Refresh; - timeout?: TimeSpan; - timestamp?: Date | number; - ttl?: TimeSpan; - version?: number; - versionType?: VersionType; - pipeline?: string; - id?: string; - index: string; - type: string; - } +export interface CreateDocumentParams extends GenericParams { + waitForActiveShards?: string; + parent?: string; + refresh?: Refresh; + timeout?: TimeSpan; + timestamp?: Date | number; + ttl?: TimeSpan; + version?: number; + versionType?: VersionType; + pipeline?: string; + id?: string; + index: string; + type: string; +} - export interface CreateDocumentResponse { - _shards: ShardsResponse; - _index: string; - _type: string; - _id: string; - _version: number; - created: boolean; - result: string; - } +export interface CreateDocumentResponse { + _shards: ShardsResponse; + _index: string; + _type: string; + _id: string; + _version: number; + created: boolean; + result: string; +} - export interface DeleteDocumentParams extends GenericParams { - waitForActiveShards?: string; - parent?: string; - refresh?: Refresh; - routing?: string; - timeout?: TimeSpan; - version?: number; - versionType?: VersionType; - index: string; - type: string; - id: string; - } +export interface DeleteDocumentParams extends GenericParams { + waitForActiveShards?: string; + parent?: string; + refresh?: Refresh; + routing?: string; + timeout?: TimeSpan; + version?: number; + versionType?: VersionType; + index: string; + type: string; + id: string; +} - export interface DeleteDocumentResponse { - _shards: ShardsResponse; - found: boolean; - _index: string; - _type: string; - _id: string; - _version: number; - result: string; - } +export interface DeleteDocumentResponse { + _shards: ShardsResponse; + found: boolean; + _index: string; + _type: string; + _id: string; + _version: number; + result: string; +} - export interface DeleteDocumentByQueryParams extends GenericParams { - analyzer?: string; - analyzeWildcard?: boolean; - defaultOperator?: DefaultOperator; - df?: string; - from?: number; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - conflicts?: Conflicts; - expandWildcards?: ExpandWildcards; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - preference?: string; - q?: string; - routing?: string | string[] | boolean; - scroll?: string; - searchType?: "query_then_fetch" | "dfs_query_then_fetch"; - searchTimeout?: TimeSpan; - size?: number; - sort?: NameList; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - terminateAfter?: number; - stats?: string | string[] | boolean; - version?: number; - requestCache?: boolean; - refresh?: Refresh; - timeout?: TimeSpan; - waitForActiveShards?: string; - scrollSize?: number; - waitForCompletion?: boolean; - requestsPerSecond?: number; - index?: string; - type?: string; - } +export interface DeleteDocumentByQueryParams extends GenericParams { + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + from?: number; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + conflicts?: Conflicts; + expandWildcards?: ExpandWildcards; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + preference?: string; + q?: string; + routing?: string | string[] | boolean; + scroll?: string; + searchType?: "query_then_fetch" | "dfs_query_then_fetch"; + searchTimeout?: TimeSpan; + size?: number; + sort?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + terminateAfter?: number; + stats?: string | string[] | boolean; + version?: number; + requestCache?: boolean; + refresh?: Refresh; + timeout?: TimeSpan; + waitForActiveShards?: string; + scrollSize?: number; + waitForCompletion?: boolean; + requestsPerSecond?: number; + index?: string; + type?: string; +} - export interface DeleteDocumentByQueryResponse { - took: number; - timed_out: boolean; - deleted: number; - batches: number; - version_conflicts: number; - noops: number; - retries: { - bulk: number; - search: number; - }; - throttled_millis: number; - requests_per_second: number; - throttled_until_millis: number; - total: number; - failures: any[]; - } +export interface DeleteDocumentByQueryResponse { + took: number; + timed_out: boolean; + deleted: number; + batches: number; + version_conflicts: number; + noops: number; + retries: { + bulk: number; + search: number; + }; + throttled_millis: number; + requests_per_second: number; + throttled_until_millis: number; + total: number; + failures: any[]; +} - export interface DeleteScriptParams extends GenericParams { - id: string; - lang: string; - } +export interface DeleteScriptParams extends GenericParams { + id: string; + lang: string; +} - export interface DeleteTemplateParams extends GenericParams { - id: string; - } +export interface DeleteTemplateParams extends GenericParams { + id: string; +} - export interface ExistsParams extends GenericParams { - parent?: string; - preference?: string; - realtime?: boolean; - refresh?: boolean; - routing?: string; - id: string; - index: string; - type: string; - } +export interface ExistsParams extends GenericParams { + parent?: string; + preference?: string; + realtime?: boolean; + refresh?: boolean; + routing?: string; + id: string; + index: string; + type: string; +} - export interface ExplainParams extends GenericParams { - analyzeWildcard?: boolean; - analyzer?: string; - defaultOperator?: DefaultOperator; - df?: string; - storedFields?: NameList; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - parent?: string; - preference?: string; - q?: string; - routing?: string; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - id?: string; - index?: string; - type?: string; - } +export interface ExplainParams extends GenericParams { + analyzeWildcard?: boolean; + analyzer?: string; + defaultOperator?: DefaultOperator; + df?: string; + storedFields?: NameList; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + parent?: string; + preference?: string; + q?: string; + routing?: string; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + id?: string; + index?: string; + type?: string; +} - export interface ExplainResponse { - _index: string; - _type: string; - _id: string; - matched: boolean; - explanation: ExplainResponseDetails; - } +export interface ExplainResponse { + _index: string; + _type: string; + _id: string; + matched: boolean; + explanation: ExplainResponseDetails; +} - export interface ExplainResponseDetails { - value: number; - description: string; - details: ExplainResponseDetails[]; - } +export interface ExplainResponseDetails { + value: number; + description: string; + details: ExplainResponseDetails[]; +} - export interface FieldStatsParams extends GenericParams { - fields?: NameList; - level?: "indices" | "cluster"; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index?: NameList; - } +export interface FieldStatsParams extends GenericParams { + fields?: NameList; + level?: "indices" | "cluster"; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; +} - export interface FieldStatsResponse { - _shards: ShardsResponse; - indices: { [indexName: string]: FieldStatsResponseIndex }; - conflicts?: { [fieldName: string]: string }; - } +export interface FieldStatsResponse { + _shards: ShardsResponse; + indices: { [indexName: string]: FieldStatsResponseIndex }; + conflicts?: { [fieldName: string]: string }; +} - export interface FieldStatsResponseIndex { - fields: { [fieldName: string]: FieldStatsResponseField }; - } +export interface FieldStatsResponseIndex { + fields: { [fieldName: string]: FieldStatsResponseField }; +} - export interface FieldStatsResponseField { - max_doc: number; - doc_count: number; - density: number; - sum_doc_freq: number; - sum_total_term_freq: number; - min_value: any; - max_value: any; - is_searchable: string; - is_aggregatable: string; - } +export interface FieldStatsResponseField { + max_doc: number; + doc_count: number; + density: number; + sum_doc_freq: number; + sum_total_term_freq: number; + min_value: any; + max_value: any; + is_searchable: string; + is_aggregatable: string; +} - export interface GetParams extends GenericParams { - storedFields?: NameList; - parent?: string; - preference?: string; - realtime?: boolean; - refresh?: boolean; - routing?: string; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - version?: number; - versionType?: VersionType; - id: string; - index: string; - type: string; - } +export interface GetParams extends GenericParams { + storedFields?: NameList; + parent?: string; + preference?: string; + realtime?: boolean; + refresh?: boolean; + routing?: string; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + version?: number; + versionType?: VersionType; + id: string; + index: string; + type: string; +} - export interface GetResponse { - _index: string; - _type: string; - _id: string; - _version: number; - found: boolean; - _source: T; - } +export interface GetResponse { + _index: string; + _type: string; + _id: string; + _version: number; + found: boolean; + _source: T; +} - export interface GetScriptParams extends GenericParams { - id: string; - lang: string; - } +export interface GetScriptParams extends GenericParams { + id: string; + lang: string; +} - export interface GetSourceParams extends GenericParams { - preference?: string; - realtime?: boolean; - refresh?: boolean; - routing?: string; - _source: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - version?: number; - versionType?: VersionType; - id: string; - index: string; - type: string; - } +export interface GetSourceParams extends GenericParams { + preference?: string; + realtime?: boolean; + refresh?: boolean; + routing?: string; + _source: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + version?: number; + versionType?: VersionType; + id: string; + index: string; + type: string; +} - export interface GetTemplateParams extends GenericParams { - id: string; - } +export interface GetTemplateParams extends GenericParams { + id: string; +} - export interface IndexDocumentParams extends GenericParams { - waitForActiveShards?: string; - opType?: "index" | "create"; - parent?: string; - refresh?: string; - routing?: string; - timeout?: TimeSpan; - timestamp?: Date | number; - ttl?: TimeSpan; - version?: number; - versionType?: VersionType; - pipeline?: string; - id?: string; - index: string; - type: string; - body: T; - } +export interface IndexDocumentParams extends GenericParams { + waitForActiveShards?: string; + opType?: "index" | "create"; + parent?: string; + refresh?: string; + routing?: string; + timeout?: TimeSpan; + timestamp?: Date | number; + ttl?: TimeSpan; + version?: number; + versionType?: VersionType; + pipeline?: string; + id?: string; + index: string; + type: string; + body: T; +} - export interface InfoParams extends GenericParams { - } +export interface InfoParams extends GenericParams { +} - export interface MGetParams extends GenericParams { - storedFields?: NameList; - preference?: string; - realtime?: Boolean; - refresh?: Boolean; - source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - index?: string; - type?: string; - } +export interface MGetParams extends GenericParams { + storedFields?: NameList; + preference?: string; + realtime?: boolean; + refresh?: boolean; + source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + index?: string; + type?: string; +} - export interface MGetResponse { - docs?: GetResponse[]; - } +export interface MGetResponse { + docs?: GetResponse[]; +} - export interface MSearchParams extends GenericParams { - search_type?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; - maxConcurrentSearches?: number; - index?: NameList; - type?: NameList; - } +export interface MSearchParams extends GenericParams { + search_type?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; + maxConcurrentSearches?: number; + index?: NameList; + type?: NameList; +} - export interface MSearchResponse { - responses?: SearchResponse[]; - } +export interface MSearchResponse { + responses?: SearchResponse[]; +} - export interface MSearchTemplateParams extends GenericParams { - search_type?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; - index?: NameList; - type?: NameList; - } +export interface MSearchTemplateParams extends GenericParams { + search_type?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; + index?: NameList; + type?: NameList; +} - export interface MTermVectorsParams extends GenericParams { - ids?: NameList; - termStatistics?: boolean; - fieldStatistics?: boolean; - fields?: NameList; - offsets?: boolean; - positions?: boolean; - payloads?: boolean; - preference?: string; - routing?: string; - parent?: string; - realtime?: boolean; - version?: number; - versionType?: VersionType; - index: string; - type: string; - } +export interface MTermVectorsParams extends GenericParams { + ids?: NameList; + termStatistics?: boolean; + fieldStatistics?: boolean; + fields?: NameList; + offsets?: boolean; + positions?: boolean; + payloads?: boolean; + preference?: string; + routing?: string; + parent?: string; + realtime?: boolean; + version?: number; + versionType?: VersionType; + index: string; + type: string; +} - export interface PingParams extends GenericParams { - } +export interface PingParams extends GenericParams { +} - export interface PutScriptParams extends GenericParams { - id: string; - lang: string; - body: any; - } +export interface PutScriptParams extends GenericParams { + id: string; + lang: string; + body: any; +} - export interface PutTemplateParams extends GenericParams { - id: string; - body: any; - } +export interface PutTemplateParams extends GenericParams { + id: string; + body: any; +} - export interface ReindexParams extends GenericParams { - refresh?: boolean; - timeout?: TimeSpan; - waitForActiveShards?: string; - waitForCompletion?: boolean; - requestsPerSecond?: number; - body: { - conflicts?: string; - source: { - index: string | string[]; - type?: string | string[]; - query?: any; - sort?: any; - size?: number; - remote?: { - host: string; - username?: string; - password?: string; - } - }; - dest: { - index: string; - version_type?: string; - op_type?: string; - routing?: string; - pipeline?: string; - }; - script?: { - inline: string; - lang: string; +export interface ReindexParams extends GenericParams { + refresh?: boolean; + timeout?: TimeSpan; + waitForActiveShards?: string; + waitForCompletion?: boolean; + requestsPerSecond?: number; + body: { + conflicts?: string; + source: { + index: string | string[]; + type?: string | string[]; + query?: any; + sort?: any; + size?: number; + remote?: { + host: string; + username?: string; + password?: string; } }; - } - - export interface ReindexResponse { - took: number; - updated: number; - created: number; - batches: number; - version_conflicts: number; - retries: { - bulk: number; - search: number; - }; - throttled_millis: number; - failures: any[]; - } - - export interface ReindexRethrottleParams extends GenericParams { - requestsPerSecond: number; - taskId: string; - } - - export interface RenderSearchTemplateParams extends GenericParams { - id: string; - } - - export interface ScrollParams extends GenericParams { - scroll: TimeSpan; - scrollId: string; - } - - export interface SearchParams extends GenericParams { - analyzer?: string; - analyzeWildcard?: boolean; - defaultOperator?: DefaultOperator; - df?: string; - explain?: boolean; - storedFields?: NameList; - docvalueFields?: NameList; - fielddataFields?: NameList; - from?: number; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - preference?: string; - q?: string; - routing?: NameList; - scroll?: TimeSpan; - searchType?: "query_then_fetch" | "dfs_query_then_fetch"; - size?: number; - sort?: NameList; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - terminateAfter?: number; - stats?: NameList; - suggestField?: string; - suggestMode?: "missing" | "popular" | "always"; - suggestSize?: number; - suggestText?: string; - timeout?: TimeSpan; - trackScores?: boolean; - version?: boolean; - requestCache?: boolean; - index?: NameList; - type?: NameList; - } - - export interface SearchResponse { - took: number; - timed_out: boolean; - _scroll_id?: string; - _shards: ShardsResponse; - hits: { - total: number; - max_score: number; - hits: { - _index: string; - _type: string; - _id: string; - _score: number; - _source: T; - _version?: number; - _explanation?: Explanation; - fields?: any; - highlight?: any; - inner_hits?: any; - }[]; - }; - aggregations?: any; - } - - export interface SearchShardsParams extends GenericParams { - preference?: string; - routing?: string; - local?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index: NameList; - type: NameList; - } - - export interface SearchShardsResponse { - nodes: any; - shards: SearchShardsResponseShard[][]; - } - - export interface SearchShardsResponseShard { - index: string; - node: string; - primary: boolean; - share: number; - state: string; - allocation_id: { - id: string; - }; - relocating_node: any; - } - - export interface SearchTemplateParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - preference?: string; - routing?: NameList; - scroll?: TimeSpan; - searchType?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; - index: NameList; - type: NameList; - } - - export interface SuggestParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - preference?: string; - routing?: string; - index: NameList; - } - - export interface TermvectorsParams extends GenericParams { - termStatistics?: boolean; - fieldStatistics?: boolean; - fields?: NameList; - offsets?: boolean; - positions?: boolean; - payloads?: boolean; - preference?: string; - routing?: string; - parent?: string; - realtime?: boolean; - version?: number; - versionType?: VersionType; - index: string; - type: string; - id?: string; - } - - export interface UpdateDocumentParams extends GenericParams { - waitForActiveShards?: string; - fields?: NameList; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - lang?: string; - parent?: string; - refresh?: Refresh; - retryOnConflict?: number; - routing?: string; - timeout?: TimeSpan; - timestamp?: Date | number; - ttl?: TimeSpan; - version?: number; - versionType?: "internal" | "force"; - id: string; - index: string; - type: string; - } - - export interface UpdateDocumentByQueryParams extends GenericParams { - analyzer?: string; - analyzeWildcard?: boolean; - defaultOperator?: DefaultOperator; - df?: string; - explain?: boolean; - storedFields?: NameList; - docvalueFields?: NameList; - fielddataFields?: NameList; - from?: number; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - conflicts?: Conflicts; - expandWildcards?: ExpandWildcards; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - pipeline?: string; - preference?: string; - q?: string; - routing?: NameList; - scroll?: TimeSpan; - searchType?: "query_then_fetch" | "dfs_query_then_fetch"; - searchTimeout?: TimeSpan; - size?: number; - sort?: NameList; - _source?: NameList; - _sourceExclude?: NameList; - _sourceInclude?: NameList; - terminateAfter?: number; - stats?: NameList; - suggestField?: string; - suggestMode?: "missing" | "popular" | "always"; - suggestSize?: number; - suggestText?: string; - timeout?: TimeSpan; - trackScores?: boolean; - version?: boolean; - versionType?: boolean; - requestCache?: boolean; - refresh?: boolean; - waitForActiveShards?: string; - scrollSize?: number; - waitForCompletion?: boolean; - requestsPerSecond?: number; - index: NameList; - type: NameList; - } - - export interface Cat { - aliases(params: CatAliasesParams, callback: (error: any, response: any) => void): void; - aliases(params: CatAliasesParams): Promise; - allocation(params: CatAllocationParams, callback: (error: any, response: any) => void): void; - allocation(params: CatAllocationParams): Promise; - count(params: CatCountParams, callback: (error: any, response: any) => void): void; - count(params: CatAllocationParams): Promise; - fielddata(params: CatFielddataParams, callback: (error: any, response: any) => void): void; - fielddata(params: CatFielddataParams): Promise; - health(params: CatHealthParams, callback: (error: any, response: any) => void): void; - health(params: CatHealthParams): Promise; - help(params: CatHelpParams, callback: (error: any, response: any) => void): void; - help(params: CatHelpParams): Promise; - indices(params: CatIndicesParams, callback: (error: any, response: any) => void): void; - indices(params: CatIndicesParams): Promise; - master(params: CatCommonParams, callback: (error: any, response: any) => void): void; - master(params: CatCommonParams): Promise; - nodeattrs(params: CatCommonParams, callback: (error: any, response: any) => void): void; - nodeattrs(params: CatCommonParams): Promise; - nodes(params: CatCommonParams, callback: (error: any, response: any) => void): void; - nodes(params: CatCommonParams): Promise; - pendingTasks(params: CatCommonParams, callback: (error: any, response: any) => void): void; - pendingTasks(params: CatCommonParams): Promise; - plugins(params: CatCommonParams, callback: (error: any, response: any) => void): void; - plugins(params: CatCommonParams): Promise; - recovery(params: CatRecoveryParams, callback: (error: any, response: any) => void): void; - recovery(params: CatRecoveryParams): Promise; - repositories(params: CatCommonParams, callback: (error: any, response: any) => void): void; - repositories(params: CatCommonParams): Promise; - segments(params: CatSegmentsParams, callback: (error: any, response: any) => void): void; - segments(params: CatSegmentsParams): Promise; - shards(params: CatShardsParams, callback: (error: any, response: any) => void): void; - shards(params: CatShardsParams): Promise; - snapshots(params: CatSnapshotsParams, callback: (error: any, response: any) => void): void; - snapshots(params: CatSnapshotsParams): Promise; - tasks(params: CatTasksParams, callback: (error: any, response: any) => void): void; - tasks(params: CatTasksParams): Promise; - threadPool(params: CatThreadPoolParams, callback: (error: any, response: any) => void): void; - threadPool(params: CatThreadPoolParams): Promise; - } - - export type CatBytes = "b" | "k" | "kb" | "m" | "mb" | "g" | "gb" | "t" | "tb" | "p" | "pb"; - - export interface CatCommonParams extends GenericParams { - format: string; - local?: boolean; - masterTimeout?: TimeSpan; - h?: NameList; - help?: boolean; - v?: boolean; - } - - export interface CatAliasesParams extends CatCommonParams { - name?: NameList; - } - - export interface CatAllocationParams extends CatCommonParams { - bytes?: CatBytes; - nodeId?: NameList; - } - - export interface CatCountParams extends CatCommonParams { - index?: NameList; - } - - export interface CatFielddataParams extends CatCommonParams { - bytes?: CatBytes; - fields?: NameList; - } - - export interface CatHealthParams extends CatCommonParams { - ts?: boolean; - } - - export interface CatHelpParams extends GenericParams { - help?: boolean; - } - - export interface CatIndicesParams extends CatCommonParams { - bytes?: CatBytes; - health?: "green" | "yellow" | "red"; - pri?: boolean; - index?: NameList; - } - - export interface CatRecoveryParams extends GenericParams { - format: string; - bytes?: CatBytes; - masterTimeout?: TimeSpan; - h?: NameList; - help?: boolean; - v?: boolean; - } - - export interface CatSegmentsParams extends GenericParams { - format: string; - h?: NameList; - help?: boolean; - v?: boolean; - index?: NameList; - } - - export interface CatShardsParams extends CatCommonParams { - index?: NameList; - } - - export interface CatSnapshotsParams extends GenericParams { - format: string; - ignoreUnavailable?: boolean; - masterTimeout?: TimeSpan; - h?: NameList; - help?: boolean; - v?: boolean; - repository?: NameList; - } - - export interface CatTasksParams extends GenericParams { - format: string; - nodeId?: NameList; - actions?: NameList; - detailed?: boolean; - parentNode?: string; - parentTask?: number; - h?: NameList; - help?: boolean; - v?: boolean; - } - - export interface CatThreadPoolParams extends CatCommonParams { - size?: "" | "k" | "m" | "g" | "t" | "p"; - threadPoolPatterns?: NameList; - } - - export interface Cluster { - allocationExplain(params: ClusterAllocationExplainParams, callback: (error: any, response: any) => void): void; - allocationExplain(params: ClusterAllocationExplainParams): Promise; - getSettings(params: ClusterGetSettingsParams, callback: (error: any, response: any) => void): void; - getSettings(params: ClusterGetSettingsParams): Promise; - health(params: ClusterHealthParams, callback: (error: any, response: any) => void): void; - health(params: ClusterHealthParams): Promise; - pendingTasks(params: ClusterPendingTasksParams, callback: (error: any, response: any) => void): void; - pendingTasks(params: ClusterPendingTasksParams): Promise; - putSettings(params: ClusterPutSettingsParams, callback: (error: any, response: any) => void): void; - putSettings(params: ClusterPutSettingsParams): Promise; - reroute(params: ClusterRerouteParams, callback: (error: any, response: any) => void): void; - reroute(params: ClusterRerouteParams): Promise; - state(params: ClusterStateParams, callback: (error: any, response: any) => void): void; - state(params: ClusterStateParams): Promise; - stats(params: ClusterStatsParams, callback: (error: any, response: any) => void): void; - stats(params: ClusterStatsParams): Promise; - } - - export interface ClusterAllocationExplainParams extends GenericParams { - includeYesDecisions?: boolean; - includeDiskInfo?: boolean; - } - - export interface ClusterGetSettingsParams extends GenericParams { - flatSettings?: boolean; - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - includeDefaults?: boolean; - } - - export interface ClusterHealthParams extends GenericParams { - level?: "cluster" | "indices" | "shards"; - local?: boolean; - masterTimeout?: TimeSpan; - waitForActiveShards?: string; - waitForNodes?: string; - waitForEvents?: "immediate" | "urgent" | "high" | "normal" | "low" | "languid"; - waitForRelocatingShards?: boolean; - waitForStatus?: "green" | "yellow" | "red"; - index?: NameList; - } - - export interface ClusterPendingTasksParams extends GenericParams { - local?: boolean; - masterTimeout?: TimeSpan; - } - - export interface ClusterPutSettingsParams extends GenericParams { - flatSettings?: boolean; - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - } - - export interface ClusterRerouteParams extends GenericParams { - dryRun?: boolean; - explain?: boolean; - retryFailed?: boolean; - metric?: NameList; - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - } - - export interface ClusterStateParams extends GenericParams { - local?: boolean; - masterTimeout?: TimeSpan; - flatSettings?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index?: NameList; - metric?: NameList; - } - - export interface ClusterStatsParams extends GenericParams { - flatSettings?: boolean; - human?: boolean; - timeout?: TimeSpan; - nodeId?: NameList; - } - - export class Indices { - analyze(params: IndicesAnalyzeParams, callback: (error: any, response: any, status: any) => void): void; - analyze(params: IndicesAnalyzeParams): Promise; - clearCache(params: IndicesClearCacheParams, callback: (error: any, response: any, status: any) => void): void; - clearCache(params: IndicesClearCacheParams): Promise; - close(params: IndicesCloseParams, callback: (error: any, response: any, status: any) => void): void; - close(params: IndicesCloseParams): Promise; - create(params: IndicesCreateParams, callback: (error: any, response: any, status: any) => void): void; - create(params: IndicesCreateParams): Promise; - delete(params: IndicesDeleteParams, callback: (error: any, response: any, status: any) => void): void; - delete(params: IndicesDeleteParams): Promise; - deleteAlias(params: IndicesDeleteAliasParams, callback: (error: any, response: any, status: any) => void): void; - deleteAlias(params: IndicesDeleteAliasParams): Promise; - deleteTemplate(params: IndicesDeleteTemplateParams, callback: (error: any, response: any, status: any) => void): void; - deleteTemplate(params: IndicesDeleteTemplateParams): Promise; - exists(params: IndicesExistsParams, callback: (error: any, response: any, status: any) => void): void; - exists(params: IndicesExistsParams): Promise; - existsAlias(params: IndicesExistsAliasParams, callback: (error: any, response: any, status: any) => void): void; - existsAlias(params: IndicesExistsAliasParams): Promise; - existsTemplate(params: IndicesExistsTemplateParams, callback: (error: any, response: any, status: any) => void): void; - existsTemplate(params: IndicesExistsTemplateParams): Promise; - existsType(params: IndicesExistsTypeParams, callback: (error: any, response: any, status: any) => void): void; - existsType(params: IndicesExistsTypeParams): Promise; - flush(params: IndicesFlushParams, callback: (error: any, response: any, status: any) => void): void; - flush(params: IndicesFlushParams): Promise; - flushSynced(params: IndicesFlushSyncedParams, callback: (error: any, response: any, status: any) => void): void; - flushSynced(params: IndicesFlushSyncedParams): Promise; - forcemerge(params: IndicesForcemergeParams, callback: (error: any, response: any, status: any) => void): void; - forcemerge(params: IndicesForcemergeParams): Promise; - get(params: IndicesGetParams, callback: (error: any, response: any, status: any) => void): void; - get(params: IndicesGetParams): Promise; - getAlias(params: IndicesGetAliasParams, callback: (error: any, response: any, status: any) => void): void; - getAlias(params: IndicesGetAliasParams): Promise; - getFieldMapping(params: IndicesGetFieldMappingParams, callback: (error: any, response: any, status: any) => void): void; - getFieldMapping(params: IndicesGetFieldMappingParams): Promise; - getMapping(params: IndicesGetMappingParams, callback: (error: any, response: any, status: any) => void): void; - getMapping(params: IndicesGetMappingParams): Promise; - getSettings(params: IndicesGetSettingsParams, callback: (error: any, response: any, status: any) => void): void; - getSettings(params: IndicesGetSettingsParams): Promise; - getTemplate(params: IndicesGetTemplateParams, callback: (error: any, response: any, status: any) => void): void; - getTemplate(params: IndicesGetTemplateParams): Promise; - getUpgrade(params: IndicesGetUpgradeParams, callback: (error: any, response: any, status: any) => void): void; - getUpgrade(params: IndicesGetUpgradeParams): Promise; - open(params: IndicesOpenParams, callback: (error: any, response: any, status: any) => void): void; - open(params: IndicesOpenParams): Promise; - putAlias(params: IndicesPutAliasParams, callback: (error: any, response: any, status: any) => void): void; - putAlias(params: IndicesPutAliasParams): Promise; - putMapping(params: IndicesPutMappingParams, callback: (error: any, response: any, status: any) => void): void; - putMapping(params: IndicesPutMappingParams): Promise; - putSettings(params: IndicesPutSettingsParams, callback: (error: any, response: any, status: any) => void): void; - putSettings(params: IndicesPutSettingsParams): Promise; - putTemplate(params: IndicesPutTemplateParams, callback: (error: any, response: any) => void): void; - putTemplate(params: IndicesPutTemplateParams): Promise; - recovery(params: IndicesRecoveryParams, callback: (error: any, response: any) => void): void; - recovery(params: IndicesRecoveryParams): Promise; - refresh(params: IndicesRefreshParams, callback: (error: any, response: any) => void): void; - refresh(params: IndicesRefreshParams): Promise; - rollover(params: IndicesRolloverParams, callback: (error: any, response: IndicesRolloverResponse) => void): void; - rollover(params: IndicesRolloverParams): Promise; - segments(params: IndicesSegmentsParams, callback: (error: any, response: any) => void): void; - segments(params: IndicesSegmentsParams): Promise; - shardStores(params: IndicesShardStoresParams, callback: (error: any, response: any) => void): void; - shardStores(params: IndicesShardStoresParams): Promise; - shrink(params: IndicesShrinkParams, callback: (error: any, response: any) => void): void; - shrink(params: IndicesShrinkParams): Promise; - stats(params: IndicesStatsParams, callback: (error: any, response: any) => void): void; - stats(params: IndicesStatsParams): Promise; - updateAliases(params: IndicesUpdateAliasesParams, callback: (error: any, response: any) => void): void; - updateAliases(params: IndicesUpdateAliasesParams): Promise; - upgrade(params: IndicesUpgradeParams, callback: (error: any, response: any) => void): void; - upgrade(params: IndicesUpgradeParams): Promise; - validateQuery(params: IndicesValidateQueryParams, callback: (error: any, response: any) => void): void; - validateQuery(params: IndicesValidateQueryParams): Promise; - } - - export interface IndicesAnalyzeParams extends GenericParams { - analyzer?: string; - charFilter?: NameList; - field?: string; - filter?: NameList; - index?: string; - perferLocal?: boolean; - text?: NameList; - tokenizer?: string; - explain?: boolean; - attributes?: NameList; - format?: ""; - } - - export interface IndicesClearCacheParams extends GenericParams { - fieldData?: boolean; - fielddata?: boolean; // yes the docs really have both - fields?: NameList; - query?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index?: NameList; - recycler?: boolean; - request?: boolean; - } - - export interface IndicesCloseParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index: NameList; - } - - export interface IndicesCreateParams extends GenericParams { - waitForActiveShards?: string; - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - updateAllTypes?: boolean; - index: string; - } - - export interface IndicesDeleteParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - index: NameList; - } - - export interface IndicesDeleteAliasParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - index: NameList; - name: NameList; - } - - export interface IndicesDeleteTemplateParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - name: string; - } - - export interface IndicesExistsParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - local?: boolean; - index: NameList; - } - - export interface IndicesExistsAliasParams extends IndicesExistsParams { - name: NameList; - } - - export interface IndicesExistsTemplateParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - name: NameList; - } - - export interface IndicesExistsTypeParams extends IndicesExistsParams { - type: NameList; - } - - export interface IndicesFlushParams extends GenericParams { - force?: boolean; - waitIfOngoing?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index: NameList; - } - - export interface IndicesFlushSyncedParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index: NameList; - } - - export interface IndicesForcemergeParams extends GenericParams { - flush?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - maxNumSegments?: number; - onlyExpungeDeletes?: boolean; - operationThreading?: any; // even the docs don't know what this does - waitForMerge?: boolean; - index: NameList; - } - - export interface IndicesGetParams extends GenericParams { - local?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - flatSettings?: boolean; - human?: boolean; - includeDefaults?: boolean; - index?: NameList; - feature?: NameList; - } - - export interface IndicesGetAliasParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - local?: boolean; - index?: NameList; - name?: NameList; - } - - export interface IndicesGetFieldMappingParams extends GenericParams { - includeDefaults?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - local?: boolean; - index?: NameList; - type?: NameList; - fields?: NameList; - } - - export interface IndicesGetMappingParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - local?: boolean; - index?: NameList; - type?: NameList; - } - - export interface IndicesGetSettingsParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - flatSettings?: boolean; - local?: boolean; - human?: boolean; - includeDefaults?: boolean; - index?: NameList; - name?: NameList; - } - - export interface IndicesGetTemplateParams extends GenericParams { - flatSettings?: boolean; - masterTimeout?: TimeSpan; - local?: boolean; - name?: NameList; - } - - export interface IndicesGetUpgradeParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - human?: boolean; - index?: NameList; - } - - export interface IndicesOpenParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - index?: NameList; - } - - export interface IndicesPutAliasParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - index?: NameList; - name: NameList; - } - - export interface IndicesPutMappingParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - updateAllTypes?: boolean; - index: NameList; - type: string; - body: any; - } - - export interface IndicesPutSettingsParams extends GenericParams { - masterTimeout?: TimeSpan; - preserveExisting?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - flatSettings?: boolean; - index: NameList; - body: any; - } - - export interface IndicesPutTemplateParams extends GenericParams { - order?: number; - create?: boolean; - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - flatSettings?: boolean; - name: string; - body: any; - } - - export interface IndicesRecoveryParams extends GenericParams { - detailed?: boolean; - activeOnly?: boolean; - human?: boolean; - index: NameList; - } - - export interface IndicesRefreshParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - force?: boolean; - operationThreading?: any; // even the docs don't know what this does - index: NameList; - } - - export interface IndicesRolloverParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - waitForActiveShards?: number | string; - alias?: string; - newIndex?: string; - } - - export interface IndicesRolloverResponse { - acknowledged: boolean; - shards_acknowledged: boolean; - old_index: string; - new_index: string; - rolled_over: boolean; - dry_run: boolean; - conditions: { [condition: string]: boolean }; - } - - export interface IndicesSegmentsParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - human?: boolean; - operationThreading?: any; // even the docs don't know what this does - verbose?: boolean; - index: NameList; - } - - export interface IndicesShardStoresParams extends GenericParams { - status?: NameList; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - operationThreading?: any; // even the docs don't know what this does - index: NameList; - } - - export interface IndicesShrinkParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - waitForActiveShards?: string | number; - index: string; - target: string; - } - - export interface IndicesStatsParams extends GenericParams { - completionFields?: NameList; - fielddataFields?: NameList; - fields?: NameList; - groups?: NameList; - human?: boolean; - level?: "cluster" | "indices" | "shards"; - types?: NameList; - index: NameList; - metric?: NameList; - } - - export interface IndicesUpdateAliasesParams extends GenericParams { - timeout?: TimeSpan; - masterTimeout?: TimeSpan; - body: { - actions: IndicesUpdateAliasesParamsAction[]; - }; - } - - export interface IndicesUpdateAliasesParamsAction { - add?: { - index?: string; - indices?: string[]; - alias: string; - }; - remove?: { - index?: string; - indices?: string[]; - alias: string; - }; - remove_index?: { + dest: { index: string; + version_type?: string; + op_type?: string; + routing?: string; + pipeline?: string; }; - } - - export interface IndicesUpgradeParams extends GenericParams { - expandWildcards?: ExpandWildcards; - ignoreUnavailable?: boolean; - waitForCompletion?: boolean; - onlyAncientSegments?: boolean; - index: NameList; - } - - export interface IndicesValidateQueryParams extends GenericParams { - explain?: boolean; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: ExpandWildcards; - operationThreading?: any; // even the docs don't know what this does - q?: string; - analyzer?: string; - analyzeWildcard?: boolean; - defaultOperator?: DefaultOperator; - df?: string; - lenient?: boolean; - lowercaseExpandedTerms?: boolean; - rewrite?: boolean; - index: NameList; - type?: NameList; - } - - export class Ingest { - deletePipeline(params: IngestDeletePipelineParams, callback: (error: any, response: any, status: any) => void): void; - deletePipeline(params: IngestDeletePipelineParams): Promise; - getPipeline(params: IngestGetPipelineParams, callback: (error: any, response: any, status: any) => void): void; - getPipeline(params: IngestGetPipelineParams): Promise; - putPipeline(params: IngestPutPipelineParams, callback: (error: any, response: any, status: any) => void): void; - putPipeline(params: IngestPutPipelineParams): Promise; - simulate(params: IngestSimulateParams, callback: (error: any, response: any, status: any) => void): void; - simulate(params: IngestSimulateParams): Promise; - } - - export interface IngestDeletePipelineParams extends GenericParams { - masterTimeout?: number; - timeout?: number; - id: string; - } - - export interface IngestGetPipelineParams extends GenericParams { - masterTimeout?: number; - id: string; - } - - export interface IngestPutPipelineParams extends GenericParams { - masterTimeout?: number; - timeout?: number; - id: string; - body: any; - } - - export interface IngestSimulateParams extends GenericParams { - verbose?: boolean; - id: string; - } - - export class Nodes { - hotThreads(params: NodesHotThreadsParams, callback: (error: any, response: any, status: any) => void): void; - hotThreads(params: NodesHotThreadsParams): Promise; - info(params: NodesInfoParams, callback: (error: any, response: any, status: any) => void): void; - info(params: NodesInfoParams): Promise; - stats(params: NodesStatsParams, callback: (error: any, response: any, status: any) => void): void; - stats(params: NodesStatsParams): Promise; - } - - export interface NodesHotThreadsParams extends GenericParams { - interval?: TimeSpan; - snapshots?: number; - threads?: number; - ignoreIdleThreads?: boolean; - type?: "cpu" | "wait" | "blocked"; - timeout?: TimeSpan; - nodeId: NameList; - } - - export interface NodesInfoParams extends GenericParams { - flatSettings?: boolean; - human?: boolean; - timeout?: TimeSpan; - nodeId: NameList; - metric?: NameList; - } - - export interface NodesStatsParams extends GenericParams { - completionFields?: NameList; - fielddataFields?: NameList; - fields?: NameList; - groups?: boolean; - human?: boolean; - level?: "indices" | "node" | "shards"; - types?: NameList; - timeout?: TimeSpan; - metric?: NameList; - indexMetric?: NameList; - nodeId?: NameList; - } - - export class Snapshot { - create(params: SnapshotCreateParams, callback: (error: any, response: any, status: any) => void): void; - create(params: SnapshotCreateParams): Promise; - createRepository(params: SnapshotCreateRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - createRepository(params: SnapshotCreateRepositoryParams): Promise; - delete(params: SnapshotDeleteParams, callback: (error: any, response: any, status: any) => void): void; - delete(params: SnapshotDeleteParams): Promise; - deleteRepository(params: SnapshotDeleteRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - deleteRepository(params: SnapshotDeleteRepositoryParams): Promise; - get(params: SnapshotGetParams, callback: (error: any, response: any, status: any) => void): void; - get(params: SnapshotGetParams): Promise; - getRepository(params: SnapshotGetRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - getRepository(params: SnapshotGetRepositoryParams): Promise; - restore(params: SnapshotRestoreParams, callback: (error: any, response: any, status: any) => void): void; - restore(params: SnapshotRestoreParams): Promise; - status(params: SnapshotStatusParams, callback: (error: any, response: any, status: any) => void): void; - status(params: SnapshotStatusParams): Promise; - verifyRepository(params: SnapshotVerifyRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - verifyRepository(params: SnapshotVerifyRepositoryParams): Promise; - } - - export interface SnapshotCreateParams extends GenericParams { - masterTimeout?: TimeSpan; - waitForCompletion?: boolean; - repository: string; - snapshot: string; - } - - export interface SnapshotCreateRepositoryParams extends GenericParams { - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - verify?: boolean; - repository: string; - } - - export interface SnapshotDeleteParams extends GenericParams { - masterTimeout?: TimeSpan; - repository: string; - snapshot: string; - } - - export interface SnapshotDeleteRepositoryParams extends GenericParams { - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - repository: string; - } - - export interface SnapshotGetParams extends GenericParams { - masterTimeout?: TimeSpan; - ignoreUnavailable?: boolean; - repository: string; - snapshot: NameList; - } - - export interface SnapshotGetRepositoryParams extends GenericParams { - masterTimeout?: TimeSpan; - local?: boolean; - repository: NameList; - } - - export interface SnapshotRestoreParams extends GenericParams { - masterTimeout?: TimeSpan; - waitForCompletion?: boolean; - repository: string; - snapshot: string; - } - - export interface SnapshotStatusParams extends GenericParams { - masterTimeout?: TimeSpan; - ignoreUnavailable?: boolean; - repository: string; - snapshot: NameList; - } - - export interface SnapshotVerifyRepositoryParams extends GenericParams { - masterTimeout?: TimeSpan; - timeout?: TimeSpan; - repository: string; - } - - export class Tasks { - cancel(params: TasksCancelParams, callback: (error: any, response: any, status: any) => void): void; - cancel(params: TasksCancelParams): Promise; - get(params: TasksGetParams, callback: (error: any, response: any, status: any) => void): void; - get(params: TasksGetParams): Promise; - list(params: TasksListParams, callback: (error: any, response: any, status: any) => void): void; - list(params: TasksListParams): Promise; - } - - export interface TasksCancelParams extends GenericParams { - nodeId?: NameList; - actions?: NameList; - parentNode?: string; - parentTask?: string; - taskId?: string; - } - - export interface TasksGetParams extends GenericParams { - waitForCompletion?: boolean; - taskId?: string; - } - - export interface TasksListParams extends GenericParams { - nodeId?: NameList; - actions?: NameList; - detailed?: boolean; - parentNode?: string; - parentTask?: string; - waitForCompletion?: boolean; - groupBy?: "nodes" | "parents"; - } + script?: { + inline: string; + lang: string; + } + }; } -declare module "elasticsearch" { - export = Elasticsearch; +export interface ReindexResponse { + took: number; + updated: number; + created: number; + batches: number; + version_conflicts: number; + retries: { + bulk: number; + search: number; + }; + throttled_millis: number; + failures: any[]; +} + +export interface ReindexRethrottleParams extends GenericParams { + requestsPerSecond: number; + taskId: string; +} + +export interface RenderSearchTemplateParams extends GenericParams { + id: string; +} + +export interface ScrollParams extends GenericParams { + scroll: TimeSpan; + scrollId: string; +} + +export interface SearchParams extends GenericParams { + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + explain?: boolean; + storedFields?: NameList; + docvalueFields?: NameList; + fielddataFields?: NameList; + from?: number; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + preference?: string; + q?: string; + routing?: NameList; + scroll?: TimeSpan; + searchType?: "query_then_fetch" | "dfs_query_then_fetch"; + size?: number; + sort?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + terminateAfter?: number; + stats?: NameList; + suggestField?: string; + suggestMode?: "missing" | "popular" | "always"; + suggestSize?: number; + suggestText?: string; + timeout?: TimeSpan; + trackScores?: boolean; + version?: boolean; + requestCache?: boolean; + index?: NameList; + type?: NameList; +} + +export interface SearchResponse { + took: number; + timed_out: boolean; + _scroll_id?: string; + _shards: ShardsResponse; + hits: { + total: number; + max_score: number; + hits: { + _index: string; + _type: string; + _id: string; + _score: number; + _source: T; + _version?: number; + _explanation?: Explanation; + fields?: any; + highlight?: any; + inner_hits?: any; + }[]; + }; + aggregations?: any; +} + +export interface SearchShardsParams extends GenericParams { + preference?: string; + routing?: string; + local?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; + type: NameList; +} + +export interface SearchShardsResponse { + nodes: any; + shards: SearchShardsResponseShard[][]; +} + +export interface SearchShardsResponseShard { + index: string; + node: string; + primary: boolean; + share: number; + state: string; + allocation_id: { + id: string; + }; + relocating_node: any; +} + +export interface SearchTemplateParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + preference?: string; + routing?: NameList; + scroll?: TimeSpan; + searchType?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; + index: NameList; + type: NameList; +} + +export interface SuggestParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + preference?: string; + routing?: string; + index: NameList; +} + +export interface TermvectorsParams extends GenericParams { + termStatistics?: boolean; + fieldStatistics?: boolean; + fields?: NameList; + offsets?: boolean; + positions?: boolean; + payloads?: boolean; + preference?: string; + routing?: string; + parent?: string; + realtime?: boolean; + version?: number; + versionType?: VersionType; + index: string; + type: string; + id?: string; +} + +export interface UpdateDocumentParams extends GenericParams { + waitForActiveShards?: string; + fields?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + lang?: string; + parent?: string; + refresh?: Refresh; + retryOnConflict?: number; + routing?: string; + timeout?: TimeSpan; + timestamp?: Date | number; + ttl?: TimeSpan; + version?: number; + versionType?: "internal" | "force"; + id: string; + index: string; + type: string; +} + +export interface UpdateDocumentByQueryParams extends GenericParams { + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + explain?: boolean; + storedFields?: NameList; + docvalueFields?: NameList; + fielddataFields?: NameList; + from?: number; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + conflicts?: Conflicts; + expandWildcards?: ExpandWildcards; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + pipeline?: string; + preference?: string; + q?: string; + routing?: NameList; + scroll?: TimeSpan; + searchType?: "query_then_fetch" | "dfs_query_then_fetch"; + searchTimeout?: TimeSpan; + size?: number; + sort?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + terminateAfter?: number; + stats?: NameList; + suggestField?: string; + suggestMode?: "missing" | "popular" | "always"; + suggestSize?: number; + suggestText?: string; + timeout?: TimeSpan; + trackScores?: boolean; + version?: boolean; + versionType?: boolean; + requestCache?: boolean; + refresh?: boolean; + waitForActiveShards?: string; + scrollSize?: number; + waitForCompletion?: boolean; + requestsPerSecond?: number; + index: NameList; + type: NameList; +} + +export interface Cat { + aliases(params: CatAliasesParams, callback: (error: any, response: any) => void): void; + aliases(params: CatAliasesParams): Promise; + allocation(params: CatAllocationParams, callback: (error: any, response: any) => void): void; + allocation(params: CatAllocationParams): Promise; + count(params: CatCountParams, callback: (error: any, response: any) => void): void; + count(params: CatAllocationParams): Promise; + fielddata(params: CatFielddataParams, callback: (error: any, response: any) => void): void; + fielddata(params: CatFielddataParams): Promise; + health(params: CatHealthParams, callback: (error: any, response: any) => void): void; + health(params: CatHealthParams): Promise; + help(params: CatHelpParams, callback: (error: any, response: any) => void): void; + help(params: CatHelpParams): Promise; + indices(params: CatIndicesParams, callback: (error: any, response: any) => void): void; + indices(params: CatIndicesParams): Promise; + master(params: CatCommonParams, callback: (error: any, response: any) => void): void; + master(params: CatCommonParams): Promise; + nodeattrs(params: CatCommonParams, callback: (error: any, response: any) => void): void; + nodeattrs(params: CatCommonParams): Promise; + nodes(params: CatCommonParams, callback: (error: any, response: any) => void): void; + nodes(params: CatCommonParams): Promise; + pendingTasks(params: CatCommonParams, callback: (error: any, response: any) => void): void; + pendingTasks(params: CatCommonParams): Promise; + plugins(params: CatCommonParams, callback: (error: any, response: any) => void): void; + plugins(params: CatCommonParams): Promise; + recovery(params: CatRecoveryParams, callback: (error: any, response: any) => void): void; + recovery(params: CatRecoveryParams): Promise; + repositories(params: CatCommonParams, callback: (error: any, response: any) => void): void; + repositories(params: CatCommonParams): Promise; + segments(params: CatSegmentsParams, callback: (error: any, response: any) => void): void; + segments(params: CatSegmentsParams): Promise; + shards(params: CatShardsParams, callback: (error: any, response: any) => void): void; + shards(params: CatShardsParams): Promise; + snapshots(params: CatSnapshotsParams, callback: (error: any, response: any) => void): void; + snapshots(params: CatSnapshotsParams): Promise; + tasks(params: CatTasksParams, callback: (error: any, response: any) => void): void; + tasks(params: CatTasksParams): Promise; + threadPool(params: CatThreadPoolParams, callback: (error: any, response: any) => void): void; + threadPool(params: CatThreadPoolParams): Promise; +} + +export type CatBytes = "b" | "k" | "kb" | "m" | "mb" | "g" | "gb" | "t" | "tb" | "p" | "pb"; + +export interface CatCommonParams extends GenericParams { + format: string; + local?: boolean; + masterTimeout?: TimeSpan; + h?: NameList; + help?: boolean; + v?: boolean; +} + +export interface CatAliasesParams extends CatCommonParams { + name?: NameList; +} + +export interface CatAllocationParams extends CatCommonParams { + bytes?: CatBytes; + nodeId?: NameList; +} + +export interface CatCountParams extends CatCommonParams { + index?: NameList; +} + +export interface CatFielddataParams extends CatCommonParams { + bytes?: CatBytes; + fields?: NameList; +} + +export interface CatHealthParams extends CatCommonParams { + ts?: boolean; +} + +export interface CatHelpParams extends GenericParams { + help?: boolean; +} + +export interface CatIndicesParams extends CatCommonParams { + bytes?: CatBytes; + health?: "green" | "yellow" | "red"; + pri?: boolean; + index?: NameList; +} + +export interface CatRecoveryParams extends GenericParams { + format: string; + bytes?: CatBytes; + masterTimeout?: TimeSpan; + h?: NameList; + help?: boolean; + v?: boolean; +} + +export interface CatSegmentsParams extends GenericParams { + format: string; + h?: NameList; + help?: boolean; + v?: boolean; + index?: NameList; +} + +export interface CatShardsParams extends CatCommonParams { + index?: NameList; +} + +export interface CatSnapshotsParams extends GenericParams { + format: string; + ignoreUnavailable?: boolean; + masterTimeout?: TimeSpan; + h?: NameList; + help?: boolean; + v?: boolean; + repository?: NameList; +} + +export interface CatTasksParams extends GenericParams { + format: string; + nodeId?: NameList; + actions?: NameList; + detailed?: boolean; + parentNode?: string; + parentTask?: number; + h?: NameList; + help?: boolean; + v?: boolean; +} + +export interface CatThreadPoolParams extends CatCommonParams { + size?: "" | "k" | "m" | "g" | "t" | "p"; + threadPoolPatterns?: NameList; +} + +export interface Cluster { + allocationExplain(params: ClusterAllocationExplainParams, callback: (error: any, response: any) => void): void; + allocationExplain(params: ClusterAllocationExplainParams): Promise; + getSettings(params: ClusterGetSettingsParams, callback: (error: any, response: any) => void): void; + getSettings(params: ClusterGetSettingsParams): Promise; + health(params: ClusterHealthParams, callback: (error: any, response: any) => void): void; + health(params: ClusterHealthParams): Promise; + pendingTasks(params: ClusterPendingTasksParams, callback: (error: any, response: any) => void): void; + pendingTasks(params: ClusterPendingTasksParams): Promise; + putSettings(params: ClusterPutSettingsParams, callback: (error: any, response: any) => void): void; + putSettings(params: ClusterPutSettingsParams): Promise; + reroute(params: ClusterRerouteParams, callback: (error: any, response: any) => void): void; + reroute(params: ClusterRerouteParams): Promise; + state(params: ClusterStateParams, callback: (error: any, response: any) => void): void; + state(params: ClusterStateParams): Promise; + stats(params: ClusterStatsParams, callback: (error: any, response: any) => void): void; + stats(params: ClusterStatsParams): Promise; +} + +export interface ClusterAllocationExplainParams extends GenericParams { + includeYesDecisions?: boolean; + includeDiskInfo?: boolean; +} + +export interface ClusterGetSettingsParams extends GenericParams { + flatSettings?: boolean; + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + includeDefaults?: boolean; +} + +export interface ClusterHealthParams extends GenericParams { + level?: "cluster" | "indices" | "shards"; + local?: boolean; + masterTimeout?: TimeSpan; + waitForActiveShards?: string; + waitForNodes?: string; + waitForEvents?: "immediate" | "urgent" | "high" | "normal" | "low" | "languid"; + waitForRelocatingShards?: boolean; + waitForStatus?: "green" | "yellow" | "red"; + index?: NameList; +} + +export interface ClusterPendingTasksParams extends GenericParams { + local?: boolean; + masterTimeout?: TimeSpan; +} + +export interface ClusterPutSettingsParams extends GenericParams { + flatSettings?: boolean; + masterTimeout?: TimeSpan; + timeout?: TimeSpan; +} + +export interface ClusterRerouteParams extends GenericParams { + dryRun?: boolean; + explain?: boolean; + retryFailed?: boolean; + metric?: NameList; + masterTimeout?: TimeSpan; + timeout?: TimeSpan; +} + +export interface ClusterStateParams extends GenericParams { + local?: boolean; + masterTimeout?: TimeSpan; + flatSettings?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; + metric?: NameList; +} + +export interface ClusterStatsParams extends GenericParams { + flatSettings?: boolean; + human?: boolean; + timeout?: TimeSpan; + nodeId?: NameList; +} + +export class Indices { + analyze(params: IndicesAnalyzeParams, callback: (error: any, response: any, status: any) => void): void; + analyze(params: IndicesAnalyzeParams): Promise; + clearCache(params: IndicesClearCacheParams, callback: (error: any, response: any, status: any) => void): void; + clearCache(params: IndicesClearCacheParams): Promise; + close(params: IndicesCloseParams, callback: (error: any, response: any, status: any) => void): void; + close(params: IndicesCloseParams): Promise; + create(params: IndicesCreateParams, callback: (error: any, response: any, status: any) => void): void; + create(params: IndicesCreateParams): Promise; + delete(params: IndicesDeleteParams, callback: (error: any, response: any, status: any) => void): void; + delete(params: IndicesDeleteParams): Promise; + deleteAlias(params: IndicesDeleteAliasParams, callback: (error: any, response: any, status: any) => void): void; + deleteAlias(params: IndicesDeleteAliasParams): Promise; + deleteTemplate(params: IndicesDeleteTemplateParams, callback: (error: any, response: any, status: any) => void): void; + deleteTemplate(params: IndicesDeleteTemplateParams): Promise; + exists(params: IndicesExistsParams, callback: (error: any, response: any, status: any) => void): void; + exists(params: IndicesExistsParams): Promise; + existsAlias(params: IndicesExistsAliasParams, callback: (error: any, response: any, status: any) => void): void; + existsAlias(params: IndicesExistsAliasParams): Promise; + existsTemplate(params: IndicesExistsTemplateParams, callback: (error: any, response: any, status: any) => void): void; + existsTemplate(params: IndicesExistsTemplateParams): Promise; + existsType(params: IndicesExistsTypeParams, callback: (error: any, response: any, status: any) => void): void; + existsType(params: IndicesExistsTypeParams): Promise; + flush(params: IndicesFlushParams, callback: (error: any, response: any, status: any) => void): void; + flush(params: IndicesFlushParams): Promise; + flushSynced(params: IndicesFlushSyncedParams, callback: (error: any, response: any, status: any) => void): void; + flushSynced(params: IndicesFlushSyncedParams): Promise; + forcemerge(params: IndicesForcemergeParams, callback: (error: any, response: any, status: any) => void): void; + forcemerge(params: IndicesForcemergeParams): Promise; + get(params: IndicesGetParams, callback: (error: any, response: any, status: any) => void): void; + get(params: IndicesGetParams): Promise; + getAlias(params: IndicesGetAliasParams, callback: (error: any, response: any, status: any) => void): void; + getAlias(params: IndicesGetAliasParams): Promise; + getFieldMapping(params: IndicesGetFieldMappingParams, callback: (error: any, response: any, status: any) => void): void; + getFieldMapping(params: IndicesGetFieldMappingParams): Promise; + getMapping(params: IndicesGetMappingParams, callback: (error: any, response: any, status: any) => void): void; + getMapping(params: IndicesGetMappingParams): Promise; + getSettings(params: IndicesGetSettingsParams, callback: (error: any, response: any, status: any) => void): void; + getSettings(params: IndicesGetSettingsParams): Promise; + getTemplate(params: IndicesGetTemplateParams, callback: (error: any, response: any, status: any) => void): void; + getTemplate(params: IndicesGetTemplateParams): Promise; + getUpgrade(params: IndicesGetUpgradeParams, callback: (error: any, response: any, status: any) => void): void; + getUpgrade(params: IndicesGetUpgradeParams): Promise; + open(params: IndicesOpenParams, callback: (error: any, response: any, status: any) => void): void; + open(params: IndicesOpenParams): Promise; + putAlias(params: IndicesPutAliasParams, callback: (error: any, response: any, status: any) => void): void; + putAlias(params: IndicesPutAliasParams): Promise; + putMapping(params: IndicesPutMappingParams, callback: (error: any, response: any, status: any) => void): void; + putMapping(params: IndicesPutMappingParams): Promise; + putSettings(params: IndicesPutSettingsParams, callback: (error: any, response: any, status: any) => void): void; + putSettings(params: IndicesPutSettingsParams): Promise; + putTemplate(params: IndicesPutTemplateParams, callback: (error: any, response: any) => void): void; + putTemplate(params: IndicesPutTemplateParams): Promise; + recovery(params: IndicesRecoveryParams, callback: (error: any, response: any) => void): void; + recovery(params: IndicesRecoveryParams): Promise; + refresh(params: IndicesRefreshParams, callback: (error: any, response: any) => void): void; + refresh(params: IndicesRefreshParams): Promise; + rollover(params: IndicesRolloverParams, callback: (error: any, response: IndicesRolloverResponse) => void): void; + rollover(params: IndicesRolloverParams): Promise; + segments(params: IndicesSegmentsParams, callback: (error: any, response: any) => void): void; + segments(params: IndicesSegmentsParams): Promise; + shardStores(params: IndicesShardStoresParams, callback: (error: any, response: any) => void): void; + shardStores(params: IndicesShardStoresParams): Promise; + shrink(params: IndicesShrinkParams, callback: (error: any, response: any) => void): void; + shrink(params: IndicesShrinkParams): Promise; + stats(params: IndicesStatsParams, callback: (error: any, response: any) => void): void; + stats(params: IndicesStatsParams): Promise; + updateAliases(params: IndicesUpdateAliasesParams, callback: (error: any, response: any) => void): void; + updateAliases(params: IndicesUpdateAliasesParams): Promise; + upgrade(params: IndicesUpgradeParams, callback: (error: any, response: any) => void): void; + upgrade(params: IndicesUpgradeParams): Promise; + validateQuery(params: IndicesValidateQueryParams, callback: (error: any, response: any) => void): void; + validateQuery(params: IndicesValidateQueryParams): Promise; +} + +export interface IndicesAnalyzeParams extends GenericParams { + analyzer?: string; + charFilter?: NameList; + field?: string; + filter?: NameList; + index?: string; + perferLocal?: boolean; + text?: NameList; + tokenizer?: string; + explain?: boolean; + attributes?: NameList; + format?: ""; +} + +export interface IndicesClearCacheParams extends GenericParams { + fieldData?: boolean; + fielddata?: boolean; // yes the docs really have both + fields?: NameList; + query?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; + recycler?: boolean; + request?: boolean; +} + +export interface IndicesCloseParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; +} + +export interface IndicesCreateParams extends GenericParams { + waitForActiveShards?: string; + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + updateAllTypes?: boolean; + index: string; +} + +export interface IndicesDeleteParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + index: NameList; +} + +export interface IndicesDeleteAliasParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + index: NameList; + name: NameList; +} + +export interface IndicesDeleteTemplateParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + name: string; +} + +export interface IndicesExistsParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index: NameList; +} + +export interface IndicesExistsAliasParams extends IndicesExistsParams { + name: NameList; +} + +export interface IndicesExistsTemplateParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + name: NameList; +} + +export interface IndicesExistsTypeParams extends IndicesExistsParams { + type: NameList; +} + +export interface IndicesFlushParams extends GenericParams { + force?: boolean; + waitIfOngoing?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; +} + +export interface IndicesFlushSyncedParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; +} + +export interface IndicesForcemergeParams extends GenericParams { + flush?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + maxNumSegments?: number; + onlyExpungeDeletes?: boolean; + operationThreading?: any; // even the docs don't know what this does + waitForMerge?: boolean; + index: NameList; +} + +export interface IndicesGetParams extends GenericParams { + local?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + flatSettings?: boolean; + human?: boolean; + includeDefaults?: boolean; + index?: NameList; + feature?: NameList; +} + +export interface IndicesGetAliasParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index?: NameList; + name?: NameList; +} + +export interface IndicesGetFieldMappingParams extends GenericParams { + includeDefaults?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index?: NameList; + type?: NameList; + fields?: NameList; +} + +export interface IndicesGetMappingParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index?: NameList; + type?: NameList; +} + +export interface IndicesGetSettingsParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + flatSettings?: boolean; + local?: boolean; + human?: boolean; + includeDefaults?: boolean; + index?: NameList; + name?: NameList; +} + +export interface IndicesGetTemplateParams extends GenericParams { + flatSettings?: boolean; + masterTimeout?: TimeSpan; + local?: boolean; + name?: NameList; +} + +export interface IndicesGetUpgradeParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + human?: boolean; + index?: NameList; +} + +export interface IndicesOpenParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; +} + +export interface IndicesPutAliasParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + index?: NameList; + name: NameList; +} + +export interface IndicesPutMappingParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + updateAllTypes?: boolean; + index: NameList; + type: string; + body: any; +} + +export interface IndicesPutSettingsParams extends GenericParams { + masterTimeout?: TimeSpan; + preserveExisting?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + flatSettings?: boolean; + index: NameList; + body: any; +} + +export interface IndicesPutTemplateParams extends GenericParams { + order?: number; + create?: boolean; + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + flatSettings?: boolean; + name: string; + body: any; +} + +export interface IndicesRecoveryParams extends GenericParams { + detailed?: boolean; + activeOnly?: boolean; + human?: boolean; + index: NameList; +} + +export interface IndicesRefreshParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + force?: boolean; + operationThreading?: any; // even the docs don't know what this does + index: NameList; +} + +export interface IndicesRolloverParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + waitForActiveShards?: number | string; + alias?: string; + newIndex?: string; +} + +export interface IndicesRolloverResponse { + acknowledged: boolean; + shards_acknowledged: boolean; + old_index: string; + new_index: string; + rolled_over: boolean; + dry_run: boolean; + conditions: { [condition: string]: boolean }; +} + +export interface IndicesSegmentsParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + human?: boolean; + operationThreading?: any; // even the docs don't know what this does + verbose?: boolean; + index: NameList; +} + +export interface IndicesShardStoresParams extends GenericParams { + status?: NameList; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + operationThreading?: any; // even the docs don't know what this does + index: NameList; +} + +export interface IndicesShrinkParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + waitForActiveShards?: string | number; + index: string; + target: string; +} + +export interface IndicesStatsParams extends GenericParams { + completionFields?: NameList; + fielddataFields?: NameList; + fields?: NameList; + groups?: NameList; + human?: boolean; + level?: "cluster" | "indices" | "shards"; + types?: NameList; + index: NameList; + metric?: NameList; +} + +export interface IndicesUpdateAliasesParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + body: { + actions: IndicesUpdateAliasesParamsAction[]; + }; +} + +export interface IndicesUpdateAliasesParamsAction { + add?: { + index?: string; + indices?: string[]; + alias: string; + }; + remove?: { + index?: string; + indices?: string[]; + alias: string; + }; + remove_index?: { + index: string; + }; +} + +export interface IndicesUpgradeParams extends GenericParams { + expandWildcards?: ExpandWildcards; + ignoreUnavailable?: boolean; + waitForCompletion?: boolean; + onlyAncientSegments?: boolean; + index: NameList; +} + +export interface IndicesValidateQueryParams extends GenericParams { + explain?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + operationThreading?: any; // even the docs don't know what this does + q?: string; + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + rewrite?: boolean; + index: NameList; + type?: NameList; +} + +export class Ingest { + deletePipeline(params: IngestDeletePipelineParams, callback: (error: any, response: any, status: any) => void): void; + deletePipeline(params: IngestDeletePipelineParams): Promise; + getPipeline(params: IngestGetPipelineParams, callback: (error: any, response: any, status: any) => void): void; + getPipeline(params: IngestGetPipelineParams): Promise; + putPipeline(params: IngestPutPipelineParams, callback: (error: any, response: any, status: any) => void): void; + putPipeline(params: IngestPutPipelineParams): Promise; + simulate(params: IngestSimulateParams, callback: (error: any, response: any, status: any) => void): void; + simulate(params: IngestSimulateParams): Promise; +} + +export interface IngestDeletePipelineParams extends GenericParams { + masterTimeout?: number; + timeout?: number; + id: string; +} + +export interface IngestGetPipelineParams extends GenericParams { + masterTimeout?: number; + id: string; +} + +export interface IngestPutPipelineParams extends GenericParams { + masterTimeout?: number; + timeout?: number; + id: string; + body: any; +} + +export interface IngestSimulateParams extends GenericParams { + verbose?: boolean; + id: string; +} + +export class Nodes { + hotThreads(params: NodesHotThreadsParams, callback: (error: any, response: any, status: any) => void): void; + hotThreads(params: NodesHotThreadsParams): Promise; + info(params: NodesInfoParams, callback: (error: any, response: any, status: any) => void): void; + info(params: NodesInfoParams): Promise; + stats(params: NodesStatsParams, callback: (error: any, response: any, status: any) => void): void; + stats(params: NodesStatsParams): Promise; +} + +export interface NodesHotThreadsParams extends GenericParams { + interval?: TimeSpan; + snapshots?: number; + threads?: number; + ignoreIdleThreads?: boolean; + type?: "cpu" | "wait" | "blocked"; + timeout?: TimeSpan; + nodeId: NameList; +} + +export interface NodesInfoParams extends GenericParams { + flatSettings?: boolean; + human?: boolean; + timeout?: TimeSpan; + nodeId: NameList; + metric?: NameList; +} + +export interface NodesStatsParams extends GenericParams { + completionFields?: NameList; + fielddataFields?: NameList; + fields?: NameList; + groups?: boolean; + human?: boolean; + level?: "indices" | "node" | "shards"; + types?: NameList; + timeout?: TimeSpan; + metric?: NameList; + indexMetric?: NameList; + nodeId?: NameList; +} + +export class Snapshot { + create(params: SnapshotCreateParams, callback: (error: any, response: any, status: any) => void): void; + create(params: SnapshotCreateParams): Promise; + createRepository(params: SnapshotCreateRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + createRepository(params: SnapshotCreateRepositoryParams): Promise; + delete(params: SnapshotDeleteParams, callback: (error: any, response: any, status: any) => void): void; + delete(params: SnapshotDeleteParams): Promise; + deleteRepository(params: SnapshotDeleteRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + deleteRepository(params: SnapshotDeleteRepositoryParams): Promise; + get(params: SnapshotGetParams, callback: (error: any, response: any, status: any) => void): void; + get(params: SnapshotGetParams): Promise; + getRepository(params: SnapshotGetRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + getRepository(params: SnapshotGetRepositoryParams): Promise; + restore(params: SnapshotRestoreParams, callback: (error: any, response: any, status: any) => void): void; + restore(params: SnapshotRestoreParams): Promise; + status(params: SnapshotStatusParams, callback: (error: any, response: any, status: any) => void): void; + status(params: SnapshotStatusParams): Promise; + verifyRepository(params: SnapshotVerifyRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + verifyRepository(params: SnapshotVerifyRepositoryParams): Promise; +} + +export interface SnapshotCreateParams extends GenericParams { + masterTimeout?: TimeSpan; + waitForCompletion?: boolean; + repository: string; + snapshot: string; +} + +export interface SnapshotCreateRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + verify?: boolean; + repository: string; +} + +export interface SnapshotDeleteParams extends GenericParams { + masterTimeout?: TimeSpan; + repository: string; + snapshot: string; +} + +export interface SnapshotDeleteRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + repository: string; +} + +export interface SnapshotGetParams extends GenericParams { + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + repository: string; + snapshot: NameList; +} + +export interface SnapshotGetRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + local?: boolean; + repository: NameList; +} + +export interface SnapshotRestoreParams extends GenericParams { + masterTimeout?: TimeSpan; + waitForCompletion?: boolean; + repository: string; + snapshot: string; +} + +export interface SnapshotStatusParams extends GenericParams { + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + repository: string; + snapshot: NameList; +} + +export interface SnapshotVerifyRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + repository: string; +} + +export class Tasks { + cancel(params: TasksCancelParams, callback: (error: any, response: any, status: any) => void): void; + cancel(params: TasksCancelParams): Promise; + get(params: TasksGetParams, callback: (error: any, response: any, status: any) => void): void; + get(params: TasksGetParams): Promise; + list(params: TasksListParams, callback: (error: any, response: any, status: any) => void): void; + list(params: TasksListParams): Promise; +} + +export interface TasksCancelParams extends GenericParams { + nodeId?: NameList; + actions?: NameList; + parentNode?: string; + parentTask?: string; + taskId?: string; +} + +export interface TasksGetParams extends GenericParams { + waitForCompletion?: boolean; + taskId?: string; +} + +export interface TasksListParams extends GenericParams { + nodeId?: NameList; + actions?: NameList; + detailed?: boolean; + parentNode?: string; + parentTask?: string; + waitForCompletion?: boolean; + groupBy?: "nodes" | "parents"; +} + +export namespace errors { + class _Abstract extends Error {} + class Generic extends _Abstract {} + class ConnectionFault extends _Abstract {} + class NoConnections extends _Abstract {} + class RequestTimeout extends _Abstract {} + class Serialization extends _Abstract {} + class RequestTypeError extends _Abstract {} + + class MultipleChoices extends _Abstract {} + class MovedPermanently extends _Abstract {} + class SeeOther extends _Abstract {} + class NotModified extends _Abstract {} + class UseProxy extends _Abstract {} + class TemporaryRedirect extends _Abstract {} + class PermanentRedirect extends _Abstract {} + class BadRequest extends _Abstract {} + class AuthenticationException extends _Abstract {} + class PaymentRequired extends _Abstract {} + class AuthorizationException extends _Abstract {} + class NotFound extends _Abstract {} + class MethodNotAllowed extends _Abstract {} + class NotAcceptable extends _Abstract {} + class ProxyAuthenticationRequired extends _Abstract {} + class LengthRequired extends _Abstract {} + class PreconditionFailed extends _Abstract {} + class RequestEntityTooLarge extends _Abstract {} + class RequestURITooLong extends _Abstract {} + class UnsupportedMediaType extends _Abstract {} + class RequestedRangeNotSatisfiable extends _Abstract {} + class ExpectationFailed extends _Abstract {} + class ImATeapot extends _Abstract {} + class TooManyConnectionsFromThisIP extends _Abstract {} + class UpgradeRequired extends _Abstract {} + class TooManyRequests extends _Abstract {} + class BlockedByWindowsParentalControls extends _Abstract {} + class RequestHeaderTooLarge extends _Abstract {} + class HTTPToHTTPS extends _Abstract {} + class ClientClosedRequest extends _Abstract {} + class InternalServerError extends _Abstract {} + class NotImplemented extends _Abstract {} + class BadGateway extends _Abstract {} + class ServiceUnavailable extends _Abstract {} + class GatewayTimeout extends _Abstract {} + class HTTPVersionNotSupported extends _Abstract {} + class VariantAlsoNegotiates extends _Abstract {} + class NotExtended extends _Abstract {} } diff --git a/types/elasticsearch/tsconfig.json b/types/elasticsearch/tsconfig.json index 2d62eac43d..21ac20d7e9 100644 --- a/types/elasticsearch/tsconfig.json +++ b/types/elasticsearch/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -21,4 +21,4 @@ "index.d.ts", "elasticsearch-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/elasticsearch/tslint.json b/types/elasticsearch/tslint.json index a41bf5d19a..f3cb50d5de 100644 --- a/types/elasticsearch/tslint.json +++ b/types/elasticsearch/tslint.json @@ -1,79 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "array-type": false, + "no-empty-interface": false, + "max-line-length": false } } From cfff51283f67ca026f527e6366f6e9949c91d3b1 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 21 Nov 2017 23:22:46 +0100 Subject: [PATCH 064/269] enable that rule --- types/elasticsearch/index.d.ts | 8 +++++++- types/elasticsearch/tslint.json | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index c728f9e495..fbf37f83fb 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -1,6 +1,12 @@ // Type definitions for elasticsearch 5.0 // Project: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html -// Definitions by: Casper Skydt , Blake Smith , Dave Dunkin , Jeffery Grajkowski , Margus Lamp , Ahmad Ferdous Bin Alam +// Definitions by: Casper Skydt +// Blake Smith +// Dave Dunkin +// Jeffery Grajkowski +// Margus Lamp +// Ahmad Ferdous Bin Alam +// Simon Schick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/elasticsearch/tslint.json b/types/elasticsearch/tslint.json index f3cb50d5de..aacabc1e5a 100644 --- a/types/elasticsearch/tslint.json +++ b/types/elasticsearch/tslint.json @@ -3,7 +3,6 @@ "rules": { "no-unnecessary-generics": false, "array-type": false, - "no-empty-interface": false, - "max-line-length": false + "no-empty-interface": false } } From e4013bda94546eb275412a49398cbadb95d7898c Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 21 Nov 2017 23:27:54 +0100 Subject: [PATCH 065/269] fix lint even more --- types/elasticsearch/index.d.ts | 10 +++++----- types/elasticsearch/tslint.json | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index fbf37f83fb..b143015d9c 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -6,7 +6,7 @@ // Jeffery Grajkowski // Margus Lamp // Ahmad Ferdous Bin Alam -// Simon Schick +// Simon Schick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -466,7 +466,7 @@ export interface MGetParams extends GenericParams { } export interface MGetResponse { - docs?: GetResponse[]; + docs?: Array>; } export interface MSearchParams extends GenericParams { @@ -477,7 +477,7 @@ export interface MSearchParams extends GenericParams { } export interface MSearchResponse { - responses?: SearchResponse[]; + responses?: Array>; } export interface MSearchTemplateParams extends GenericParams { @@ -627,7 +627,7 @@ export interface SearchResponse { hits: { total: number; max_score: number; - hits: { + hits: Array<{ _index: string; _type: string; _id: string; @@ -638,7 +638,7 @@ export interface SearchResponse { fields?: any; highlight?: any; inner_hits?: any; - }[]; + }>; }; aggregations?: any; } diff --git a/types/elasticsearch/tslint.json b/types/elasticsearch/tslint.json index aacabc1e5a..e9003e412b 100644 --- a/types/elasticsearch/tslint.json +++ b/types/elasticsearch/tslint.json @@ -2,7 +2,6 @@ "extends": "dtslint/dt.json", "rules": { "no-unnecessary-generics": false, - "array-type": false, "no-empty-interface": false } } From 93a41c8fb27c93e2deb4bccfb1fd21486ef84399 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 21 Nov 2017 23:38:53 +0100 Subject: [PATCH 066/269] bump dependant package TS version --- types/http-aws-es/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/http-aws-es/index.d.ts b/types/http-aws-es/index.d.ts index c14547a58f..91e12604f8 100644 --- a/types/http-aws-es/index.d.ts +++ b/types/http-aws-es/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/TheDeveloper/http-aws-es#readme // Definitions by: Marco Gonzalez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// From 4ac89406f988df28c08ee3df6f99c7c33eedc7bf Mon Sep 17 00:00:00 2001 From: Cameron Martin Date: Tue, 21 Nov 2017 22:47:52 +0000 Subject: [PATCH 067/269] Made most isXXX methods in babel-traverse be type guards. Most of them are just a 1:1 mapping between isXXX and NodePath, but for the ones that are not (which are all near the bottom of the list of methods) I looked at https://github.com/babel/babel/blob/master/packages/babel-traverse/src/path/lib/virtual-types.js and https://github.com/babel/babel/blob/master/packages/babel-types/src/validators.js to determine what type they are. --- types/babel-traverse/index.d.ts | 356 ++++++++++++++++---------------- 1 file changed, 178 insertions(+), 178 deletions(-) diff --git a/types/babel-traverse/index.d.ts b/types/babel-traverse/index.d.ts index 682550b161..37e7076432 100644 --- a/types/babel-traverse/index.d.ts +++ b/types/babel-traverse/index.d.ts @@ -600,185 +600,185 @@ export class NodePath { addComments(type: string, comments: any[]): void; // ------------------------- isXXX ------------------------- - isArrayExpression(opts?: object): boolean; - isAssignmentExpression(opts?: object): boolean; - isBinaryExpression(opts?: object): boolean; - isDirective(opts?: object): boolean; - isDirectiveLiteral(opts?: object): boolean; - isBlockStatement(opts?: object): boolean; - isBreakStatement(opts?: object): boolean; - isCallExpression(opts?: object): boolean; - isCatchClause(opts?: object): boolean; - isConditionalExpression(opts?: object): boolean; - isContinueStatement(opts?: object): boolean; - isDebuggerStatement(opts?: object): boolean; - isDoWhileStatement(opts?: object): boolean; - isEmptyStatement(opts?: object): boolean; - isExpressionStatement(opts?: object): boolean; - isFile(opts?: object): boolean; - isForInStatement(opts?: object): boolean; - isForStatement(opts?: object): boolean; - isFunctionDeclaration(opts?: object): boolean; - isFunctionExpression(opts?: object): boolean; - isIdentifier(opts?: object): boolean; - isIfStatement(opts?: object): boolean; - isLabeledStatement(opts?: object): boolean; - isStringLiteral(opts?: object): boolean; - isNumericLiteral(opts?: object): boolean; - isNullLiteral(opts?: object): boolean; - isBooleanLiteral(opts?: object): boolean; - isRegExpLiteral(opts?: object): boolean; - isLogicalExpression(opts?: object): boolean; - isMemberExpression(opts?: object): boolean; - isNewExpression(opts?: object): boolean; - isProgram(opts?: object): boolean; - isObjectExpression(opts?: object): boolean; - isObjectMethod(opts?: object): boolean; - isObjectProperty(opts?: object): boolean; - isRestElement(opts?: object): boolean; - isReturnStatement(opts?: object): boolean; - isSequenceExpression(opts?: object): boolean; - isSwitchCase(opts?: object): boolean; - isSwitchStatement(opts?: object): boolean; - isThisExpression(opts?: object): boolean; - isThrowStatement(opts?: object): boolean; - isTryStatement(opts?: object): boolean; - isUnaryExpression(opts?: object): boolean; - isUpdateExpression(opts?: object): boolean; - isVariableDeclaration(opts?: object): boolean; - isVariableDeclarator(opts?: object): boolean; - isWhileStatement(opts?: object): boolean; - isWithStatement(opts?: object): boolean; - isAssignmentPattern(opts?: object): boolean; - isArrayPattern(opts?: object): boolean; - isArrowFunctionExpression(opts?: object): boolean; - isClassBody(opts?: object): boolean; - isClassDeclaration(opts?: object): boolean; - isClassExpression(opts?: object): boolean; - isExportAllDeclaration(opts?: object): boolean; - isExportDefaultDeclaration(opts?: object): boolean; - isExportNamedDeclaration(opts?: object): boolean; - isExportSpecifier(opts?: object): boolean; - isForOfStatement(opts?: object): boolean; - isImportDeclaration(opts?: object): boolean; - isImportDefaultSpecifier(opts?: object): boolean; - isImportNamespaceSpecifier(opts?: object): boolean; - isImportSpecifier(opts?: object): boolean; - isMetaProperty(opts?: object): boolean; - isClassMethod(opts?: object): boolean; - isObjectPattern(opts?: object): boolean; - isSpreadElement(opts?: object): boolean; - isSuper(opts?: object): boolean; - isTaggedTemplateExpression(opts?: object): boolean; - isTemplateElement(opts?: object): boolean; - isTemplateLiteral(opts?: object): boolean; - isYieldExpression(opts?: object): boolean; - isAnyTypeAnnotation(opts?: object): boolean; - isArrayTypeAnnotation(opts?: object): boolean; - isBooleanTypeAnnotation(opts?: object): boolean; - isBooleanLiteralTypeAnnotation(opts?: object): boolean; - isNullLiteralTypeAnnotation(opts?: object): boolean; - isClassImplements(opts?: object): boolean; - isClassProperty(opts?: object): boolean; - isDeclareClass(opts?: object): boolean; - isDeclareFunction(opts?: object): boolean; - isDeclareInterface(opts?: object): boolean; - isDeclareModule(opts?: object): boolean; - isDeclareTypeAlias(opts?: object): boolean; - isDeclareVariable(opts?: object): boolean; - isExistentialTypeParam(opts?: object): boolean; - isFunctionTypeAnnotation(opts?: object): boolean; - isFunctionTypeParam(opts?: object): boolean; - isGenericTypeAnnotation(opts?: object): boolean; - isInterfaceExtends(opts?: object): boolean; - isInterfaceDeclaration(opts?: object): boolean; - isIntersectionTypeAnnotation(opts?: object): boolean; - isMixedTypeAnnotation(opts?: object): boolean; - isNullableTypeAnnotation(opts?: object): boolean; - isNumericLiteralTypeAnnotation(opts?: object): boolean; - isNumberTypeAnnotation(opts?: object): boolean; - isStringLiteralTypeAnnotation(opts?: object): boolean; - isStringTypeAnnotation(opts?: object): boolean; - isThisTypeAnnotation(opts?: object): boolean; - isTupleTypeAnnotation(opts?: object): boolean; - isTypeofTypeAnnotation(opts?: object): boolean; - isTypeAlias(opts?: object): boolean; - isTypeAnnotation(opts?: object): boolean; - isTypeCastExpression(opts?: object): boolean; - isTypeParameterDeclaration(opts?: object): boolean; - isTypeParameterInstantiation(opts?: object): boolean; - isObjectTypeAnnotation(opts?: object): boolean; - isObjectTypeCallProperty(opts?: object): boolean; - isObjectTypeIndexer(opts?: object): boolean; - isObjectTypeProperty(opts?: object): boolean; - isQualifiedTypeIdentifier(opts?: object): boolean; - isUnionTypeAnnotation(opts?: object): boolean; - isVoidTypeAnnotation(opts?: object): boolean; - isJSXAttribute(opts?: object): boolean; - isJSXClosingElement(opts?: object): boolean; - isJSXElement(opts?: object): boolean; - isJSXEmptyExpression(opts?: object): boolean; - isJSXExpressionContainer(opts?: object): boolean; - isJSXIdentifier(opts?: object): boolean; - isJSXMemberExpression(opts?: object): boolean; - isJSXNamespacedName(opts?: object): boolean; - isJSXOpeningElement(opts?: object): boolean; - isJSXSpreadAttribute(opts?: object): boolean; - isJSXText(opts?: object): boolean; - isNoop(opts?: object): boolean; - isParenthesizedExpression(opts?: object): boolean; - isAwaitExpression(opts?: object): boolean; - isBindExpression(opts?: object): boolean; - isDecorator(opts?: object): boolean; - isDoExpression(opts?: object): boolean; - isExportDefaultSpecifier(opts?: object): boolean; - isExportNamespaceSpecifier(opts?: object): boolean; - isRestProperty(opts?: object): boolean; - isSpreadProperty(opts?: object): boolean; - isExpression(opts?: object): boolean; - isBinary(opts?: object): boolean; - isScopable(opts?: object): boolean; - isBlockParent(opts?: object): boolean; - isBlock(opts?: object): boolean; - isStatement(opts?: object): boolean; - isTerminatorless(opts?: object): boolean; - isCompletionStatement(opts?: object): boolean; - isConditional(opts?: object): boolean; - isLoop(opts?: object): boolean; - isWhile(opts?: object): boolean; - isExpressionWrapper(opts?: object): boolean; - isFor(opts?: object): boolean; - isForXStatement(opts?: object): boolean; - isFunction(opts?: object): boolean; - isFunctionParent(opts?: object): boolean; - isPureish(opts?: object): boolean; - isDeclaration(opts?: object): boolean; - isLVal(opts?: object): boolean; - isLiteral(opts?: object): boolean; - isImmutable(opts?: object): boolean; - isUserWhitespacable(opts?: object): boolean; - isMethod(opts?: object): boolean; - isObjectMember(opts?: object): boolean; - isProperty(opts?: object): boolean; - isUnaryLike(opts?: object): boolean; - isPattern(opts?: object): boolean; - isClass(opts?: object): boolean; - isModuleDeclaration(opts?: object): boolean; - isExportDeclaration(opts?: object): boolean; - isModuleSpecifier(opts?: object): boolean; - isFlow(opts?: object): boolean; - isFlowBaseAnnotation(opts?: object): boolean; - isFlowDeclaration(opts?: object): boolean; - isJSX(opts?: object): boolean; - isNumberLiteral(opts?: object): boolean; - isRegexLiteral(opts?: object): boolean; - isReferencedIdentifier(opts?: object): boolean; - isReferencedMemberExpression(opts?: object): boolean; - isBindingIdentifier(opts?: object): boolean; - isScope(opts?: object): boolean; + isArrayExpression(opts?: object): this is NodePath ; + isAssignmentExpression(opts?: object): this is NodePath; + isBinaryExpression(opts?: object): this is NodePath; + isDirective(opts?: object): this is NodePath; + isDirectiveLiteral(opts?: object): this is NodePath; + isBlockStatement(opts?: object): this is NodePath; + isBreakStatement(opts?: object): this is NodePath; + isCallExpression(opts?: object): this is NodePath; + isCatchClause(opts?: object): this is NodePath; + isConditionalExpression(opts?: object): this is NodePath; + isContinueStatement(opts?: object): this is NodePath; + isDebuggerStatement(opts?: object): this is NodePath; + isDoWhileStatement(opts?: object): this is NodePath; + isEmptyStatement(opts?: object): this is NodePath; + isExpressionStatement(opts?: object): this is NodePath; + isFile(opts?: object): this is NodePath; + isForInStatement(opts?: object): this is NodePath; + isForStatement(opts?: object): this is NodePath; + isFunctionDeclaration(opts?: object): this is NodePath; + isFunctionExpression(opts?: object): this is NodePath; + isIdentifier(opts?: object): this is NodePath; + isIfStatement(opts?: object): this is NodePath; + isLabeledStatement(opts?: object): this is NodePath; + isStringLiteral(opts?: object): this is NodePath; + isNumericLiteral(opts?: object): this is NodePath; + isNullLiteral(opts?: object): this is NodePath; + isBooleanLiteral(opts?: object): this is NodePath; + isRegExpLiteral(opts?: object): this is NodePath; + isLogicalExpression(opts?: object): this is NodePath; + isMemberExpression(opts?: object): this is NodePath; + isNewExpression(opts?: object): this is NodePath; + isProgram(opts?: object): this is NodePath; + isObjectExpression(opts?: object): this is NodePath; + isObjectMethod(opts?: object): this is NodePath; + isObjectProperty(opts?: object): this is NodePath; + isRestElement(opts?: object): this is NodePath; + isReturnStatement(opts?: object): this is NodePath; + isSequenceExpression(opts?: object): this is NodePath; + isSwitchCase(opts?: object): this is NodePath; + isSwitchStatement(opts?: object): this is NodePath; + isThisExpression(opts?: object): this is NodePath; + isThrowStatement(opts?: object): this is NodePath; + isTryStatement(opts?: object): this is NodePath; + isUnaryExpression(opts?: object): this is NodePath; + isUpdateExpression(opts?: object): this is NodePath; + isVariableDeclaration(opts?: object): this is NodePath; + isVariableDeclarator(opts?: object): this is NodePath; + isWhileStatement(opts?: object): this is NodePath; + isWithStatement(opts?: object): this is NodePath; + isAssignmentPattern(opts?: object): this is NodePath; + isArrayPattern(opts?: object): this is NodePath; + isArrowFunctionExpression(opts?: object): this is NodePath; + isClassBody(opts?: object): this is NodePath; + isClassDeclaration(opts?: object): this is NodePath; + isClassExpression(opts?: object): this is NodePath; + isExportAllDeclaration(opts?: object): this is NodePath; + isExportDefaultDeclaration(opts?: object): this is NodePath; + isExportNamedDeclaration(opts?: object): this is NodePath; + isExportSpecifier(opts?: object): this is NodePath; + isForOfStatement(opts?: object): this is NodePath; + isImportDeclaration(opts?: object): this is NodePath; + isImportDefaultSpecifier(opts?: object): this is NodePath; + isImportNamespaceSpecifier(opts?: object): this is NodePath; + isImportSpecifier(opts?: object): this is NodePath; + isMetaProperty(opts?: object): this is NodePath; + isClassMethod(opts?: object): this is NodePath; + isObjectPattern(opts?: object): this is NodePath; + isSpreadElement(opts?: object): this is NodePath; + isSuper(opts?: object): this is NodePath; + isTaggedTemplateExpression(opts?: object): this is NodePath; + isTemplateElement(opts?: object): this is NodePath; + isTemplateLiteral(opts?: object): this is NodePath; + isYieldExpression(opts?: object): this is NodePath; + isAnyTypeAnnotation(opts?: object): this is NodePath; + isArrayTypeAnnotation(opts?: object): this is NodePath; + isBooleanTypeAnnotation(opts?: object): this is NodePath; + isBooleanLiteralTypeAnnotation(opts?: object): this is NodePath; + isNullLiteralTypeAnnotation(opts?: object): this is NodePath; + isClassImplements(opts?: object): this is NodePath; + isClassProperty(opts?: object): this is NodePath; + isDeclareClass(opts?: object): this is NodePath; + isDeclareFunction(opts?: object): this is NodePath; + isDeclareInterface(opts?: object): this is NodePath; + isDeclareModule(opts?: object): this is NodePath; + isDeclareTypeAlias(opts?: object): this is NodePath; + isDeclareVariable(opts?: object): this is NodePath; + isExistentialTypeParam(opts?: object): this is NodePath; + isFunctionTypeAnnotation(opts?: object): this is NodePath; + isFunctionTypeParam(opts?: object): this is NodePath; + isGenericTypeAnnotation(opts?: object): this is NodePath; + isInterfaceExtends(opts?: object): this is NodePath; + isInterfaceDeclaration(opts?: object): this is NodePath; + isIntersectionTypeAnnotation(opts?: object): this is NodePath; + isMixedTypeAnnotation(opts?: object): this is NodePath; + isNullableTypeAnnotation(opts?: object): this is NodePath; + isNumericLiteralTypeAnnotation(opts?: object): this is NodePath; + isNumberTypeAnnotation(opts?: object): this is NodePath; + isStringLiteralTypeAnnotation(opts?: object): this is NodePath; + isStringTypeAnnotation(opts?: object): this is NodePath; + isThisTypeAnnotation(opts?: object): this is NodePath; + isTupleTypeAnnotation(opts?: object): this is NodePath; + isTypeofTypeAnnotation(opts?: object): this is NodePath; + isTypeAlias(opts?: object): this is NodePath; + isTypeAnnotation(opts?: object): this is NodePath; + isTypeCastExpression(opts?: object): this is NodePath; + isTypeParameterDeclaration(opts?: object): this is NodePath; + isTypeParameterInstantiation(opts?: object): this is NodePath; + isObjectTypeAnnotation(opts?: object): this is NodePath; + isObjectTypeCallProperty(opts?: object): this is NodePath; + isObjectTypeIndexer(opts?: object): this is NodePath; + isObjectTypeProperty(opts?: object): this is NodePath; + isQualifiedTypeIdentifier(opts?: object): this is NodePath; + isUnionTypeAnnotation(opts?: object): this is NodePath; + isVoidTypeAnnotation(opts?: object): this is NodePath; + isJSXAttribute(opts?: object): this is NodePath; + isJSXClosingElement(opts?: object): this is NodePath; + isJSXElement(opts?: object): this is NodePath; + isJSXEmptyExpression(opts?: object): this is NodePath; + isJSXExpressionContainer(opts?: object): this is NodePath; + isJSXIdentifier(opts?: object): this is NodePath; + isJSXMemberExpression(opts?: object): this is NodePath; + isJSXNamespacedName(opts?: object): this is NodePath; + isJSXOpeningElement(opts?: object): this is NodePath; + isJSXSpreadAttribute(opts?: object): this is NodePath; + isJSXText(opts?: object): this is NodePath; + isNoop(opts?: object): this is NodePath; + isParenthesizedExpression(opts?: object): this is NodePath; + isAwaitExpression(opts?: object): this is NodePath; + isBindExpression(opts?: object): this is NodePath; + isDecorator(opts?: object): this is NodePath; + isDoExpression(opts?: object): this is NodePath; + isExportDefaultSpecifier(opts?: object): this is NodePath; + isExportNamespaceSpecifier(opts?: object): this is NodePath; + isRestProperty(opts?: object): this is NodePath; + isSpreadProperty(opts?: object): this is NodePath; + isExpression(opts?: object): this is NodePath; + isBinary(opts?: object): this is NodePath; + isScopable(opts?: object): this is NodePath; + isBlockParent(opts?: object): this is NodePath; + isBlock(opts?: object): this is NodePath; + isStatement(opts?: object): this is NodePath; + isTerminatorless(opts?: object): this is NodePath; + isCompletionStatement(opts?: object): this is NodePath; + isConditional(opts?: object): this is NodePath; + isLoop(opts?: object): this is NodePath; + isWhile(opts?: object): this is NodePath; + isExpressionWrapper(opts?: object): this is NodePath; + isFor(opts?: object): this is NodePath; + isForXStatement(opts?: object): this is NodePath; + isFunction(opts?: object): this is NodePath; + isFunctionParent(opts?: object): this is NodePath; + isPureish(opts?: object): this is NodePath; + isDeclaration(opts?: object): this is NodePath; + isLVal(opts?: object): this is NodePath; + isLiteral(opts?: object): this is NodePath; + isImmutable(opts?: object): this is NodePath; + isUserWhitespacable(opts?: object): this is NodePath; + isMethod(opts?: object): this is NodePath; + isObjectMember(opts?: object): this is NodePath; + isProperty(opts?: object): this is NodePath; + isUnaryLike(opts?: object): this is NodePath; + isPattern(opts?: object): this is NodePath; + isClass(opts?: object): this is NodePath; + isModuleDeclaration(opts?: object): this is NodePath; + isExportDeclaration(opts?: object): this is NodePath; + isModuleSpecifier(opts?: object): this is NodePath; + isFlow(opts?: object): this is NodePath; + isFlowBaseAnnotation(opts?: object): this is NodePath; + isFlowDeclaration(opts?: object): this is NodePath; + isJSX(opts?: object): this is NodePath; + isNumberLiteral(opts?: object): this is NodePath; + isRegexLiteral(opts?: object): this is NodePath; + isReferencedIdentifier(opts?: object): this is NodePath; + isReferencedMemberExpression(opts?: object): this is NodePath; + isBindingIdentifier(opts?: object): this is NodePath; + isScope(opts?: object): this is NodePath; isReferenced(opts?: object): boolean; - isBlockScoped(opts?: object): boolean; - isVar(opts?: object): boolean; + isBlockScoped(opts?: object): this is NodePath; + isVar(opts?: object): this is NodePath; isUser(opts?: object): boolean; isGenerated(opts?: object): boolean; isPure(opts?: object): boolean; From 0b0d27cd8c053fb902c3b9b1c88cfca3f9cebd72 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 21 Nov 2017 23:51:00 +0100 Subject: [PATCH 068/269] sort and add conflict --- types/elasticsearch/index.d.ts | 67 +++++++++++++++++----------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index b143015d9c..1b45a237e5 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -1613,46 +1613,47 @@ export namespace errors { class Generic extends _Abstract {} class ConnectionFault extends _Abstract {} class NoConnections extends _Abstract {} - class RequestTimeout extends _Abstract {} class Serialization extends _Abstract {} class RequestTypeError extends _Abstract {} - class MultipleChoices extends _Abstract {} - class MovedPermanently extends _Abstract {} - class SeeOther extends _Abstract {} - class NotModified extends _Abstract {} - class UseProxy extends _Abstract {} - class TemporaryRedirect extends _Abstract {} - class PermanentRedirect extends _Abstract {} - class BadRequest extends _Abstract {} class AuthenticationException extends _Abstract {} - class PaymentRequired extends _Abstract {} class AuthorizationException extends _Abstract {} - class NotFound extends _Abstract {} - class MethodNotAllowed extends _Abstract {} - class NotAcceptable extends _Abstract {} - class ProxyAuthenticationRequired extends _Abstract {} - class LengthRequired extends _Abstract {} - class PreconditionFailed extends _Abstract {} - class RequestEntityTooLarge extends _Abstract {} - class RequestURITooLong extends _Abstract {} - class UnsupportedMediaType extends _Abstract {} - class RequestedRangeNotSatisfiable extends _Abstract {} - class ExpectationFailed extends _Abstract {} - class ImATeapot extends _Abstract {} - class TooManyConnectionsFromThisIP extends _Abstract {} - class UpgradeRequired extends _Abstract {} - class TooManyRequests extends _Abstract {} - class BlockedByWindowsParentalControls extends _Abstract {} - class RequestHeaderTooLarge extends _Abstract {} - class HTTPToHTTPS extends _Abstract {} - class ClientClosedRequest extends _Abstract {} - class InternalServerError extends _Abstract {} - class NotImplemented extends _Abstract {} class BadGateway extends _Abstract {} - class ServiceUnavailable extends _Abstract {} + class BadRequest extends _Abstract {} + class BlockedByWindowsParentalControls extends _Abstract {} + class ClientClosedRequest extends _Abstract {} + class Conflict extends _Abstract {} + class ExpectationFailed extends _Abstract {} class GatewayTimeout extends _Abstract {} + class HTTPToHTTPS extends _Abstract {} class HTTPVersionNotSupported extends _Abstract {} - class VariantAlsoNegotiates extends _Abstract {} + class ImATeapot extends _Abstract {} + class InternalServerError extends _Abstract {} + class LengthRequired extends _Abstract {} + class MethodNotAllowed extends _Abstract {} + class MovedPermanently extends _Abstract {} + class MultipleChoices extends _Abstract {} + class NotAcceptable extends _Abstract {} class NotExtended extends _Abstract {} + class NotFound extends _Abstract {} + class NotImplemented extends _Abstract {} + class NotModified extends _Abstract {} + class PaymentRequired extends _Abstract {} + class PermanentRedirect extends _Abstract {} + class PreconditionFailed extends _Abstract {} + class ProxyAuthenticationRequired extends _Abstract {} + class RequestedRangeNotSatisfiable extends _Abstract {} + class RequestEntityTooLarge extends _Abstract {} + class RequestHeaderTooLarge extends _Abstract {} + class RequestTimeout extends _Abstract {} + class RequestURITooLong extends _Abstract {} + class SeeOther extends _Abstract {} + class ServiceUnavailable extends _Abstract {} + class TemporaryRedirect extends _Abstract {} + class TooManyConnectionsFromThisIP extends _Abstract {} + class TooManyRequests extends _Abstract {} + class UnsupportedMediaType extends _Abstract {} + class UpgradeRequired extends _Abstract {} + class UseProxy extends _Abstract {} + class VariantAlsoNegotiates extends _Abstract {} } From 49601d338349927bbdc959f9b8b53c3eb1e60256 Mon Sep 17 00:00:00 2001 From: Rui Cruz Date: Tue, 21 Nov 2017 22:51:54 +0000 Subject: [PATCH 069/269] create interface https://github.com/lovell/sharp/commit/1aa053ce6f8aadba51010c56e0cfc563c952fd1b#commitcomment-25672716 --- types/sharp/index.d.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/types/sharp/index.d.ts b/types/sharp/index.d.ts index 530501dd13..69f4bc970a 100644 --- a/types/sharp/index.d.ts +++ b/types/sharp/index.d.ts @@ -423,6 +423,8 @@ declare namespace sharp { density?: number; /** describes raw pixel image data. */ raw?: Raw; + /** describes a blank overlay to be created. */ + create?: Create; } interface CacheOptions { @@ -445,6 +447,17 @@ declare namespace sharp { channels: number; } + interface Create { + /** Number of pixels wide */ + width: number; + /** Number of pixels high */ + height: number; + /** Number of bands e.g. 3 for RGB, 4 for RGBA */ + channels: number; + /** parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. */ + background: string | RGBA; + } + interface Metadata { /** Name of decoder used to decompress image data e.g. jpeg, png, webp, gif, svg */ format?: string; From 39d7d3ab396f96c80208e3144fff530135c6e268 Mon Sep 17 00:00:00 2001 From: Jeff Jacobson Date: Tue, 21 Nov 2017 15:38:42 -0800 Subject: [PATCH 070/269] fixed type def --- types/geojson/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/geojson/index.d.ts b/types/geojson/index.d.ts index d6ba411e3f..e6783255eb 100644 --- a/types/geojson/index.d.ts +++ b/types/geojson/index.d.ts @@ -130,7 +130,7 @@ export interface MultiPolygon extends GeometryObject { */ export interface GeometryCollection extends GeometryObject { type: "GeometryCollection"; - geometries: Array; + geometries: Array; } export type GeoJsonProperties = { [name: string]: any; } | null; From 5ddd7d6c05957b30078dff689036e8ddaceef44c Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Wed, 22 Nov 2017 11:22:29 +0100 Subject: [PATCH 071/269] update lolex typings. --- types/lolex/index.d.ts | 82 +++++++++++++++++++++++++------------- types/lolex/lolex-tests.ts | 29 +++++--------- 2 files changed, 64 insertions(+), 47 deletions(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index c0dec4cd56..b033862062 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for lolex 1.5 +// Type definitions for lolex 2.1 // Project: https://github.com/sinonjs/lolex -// Definitions by: Wim Looman , Josh Goldberg +// Definitions by: Wim Looman +// Josh Goldberg +// Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** @@ -34,7 +36,7 @@ type BrowserClock = LolexClock; type NodeClock = LolexClock & { /** * Mimicks process.hrtime(). - * + * * @param prevTime Previous system time to calculate time elapsed. * @returns High resolution real time as [seconds, nanoseconds]. */ @@ -49,7 +51,7 @@ type Clock = BrowserClock | NodeClock; /** * Names of clock methods that may be faked by install. */ -type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date"; +type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick"; /** * Controls the flow of time. @@ -67,7 +69,7 @@ export interface LolexClock { /** * Schedules a callback to be fired once timeout milliseconds have ticked by. - * + * * @param callback Callback to be fired. * @param timeout How many ticks to wait to run the callback. * @param args Any extra arguments to pass to the callback. @@ -77,14 +79,14 @@ export interface LolexClock { /** * Clears a timer, as long as it was created using setTimeout. - * + * * @param id Timer ID or object. */ clearTimeout(id: TTimerId): void; /** * Schedules a callback to be fired every time timeout milliseconds have ticked by. - * + * * @param callback Callback to be fired. * @param timeout How many ticks to wait between callbacks. * @param args Any extra arguments to pass to the callback. @@ -94,14 +96,14 @@ export interface LolexClock { /** * Clears a timer, as long as it was created using setInterval. - * + * * @param id Timer ID or object. */ clearInterval(id: TTimerId): void; /** * Schedules the callback to be fired once 0 milliseconds have ticked by. - * + * * @param callback Callback to be fired. * @remarks You'll still have to call clock.tick() for the callback to fire. * @remarks If called during a tick the callback won't fire until 1 millisecond has ticked by. @@ -110,11 +112,16 @@ export interface LolexClock { /** * Clears a timer, as long as it was created using setImmediate. - * + * * @param id Timer ID or object. */ clearImmediate(id: TTimerId): void; + /** + * Simulates process.nextTick(); + */ + nextTick(callback: () => any): void; + /** * Advances the clock to the the moment of the first scheduled timer, firing it. */ @@ -122,14 +129,14 @@ export interface LolexClock { /** * Advance the clock, firing callbacks if necessary. - * + * * @param time How many ticks to advance by. */ tick(time: number | string): void; /** * Runs all pending timers until there are none remaining. - * + * * @remarks If new timers are added while it is executing they will be run as well. */ runAll(): void; @@ -142,7 +149,7 @@ export interface LolexClock { /** * Simulates a user changing the system clock. - * + * * @param now New system time. * @remarks This affects the current time but it does not in itself cause timers to fire. */ @@ -157,7 +164,7 @@ export interface LolexClock { /** * Creates a clock. - * + * * @param now Current time for the clock. * @param loopLimit Maximum number of timers that will be run when calling runAll() * before assuming that we have an infinite loop and throwing an error @@ -167,23 +174,42 @@ export interface LolexClock { */ export declare function createClock(now?: number | Date, loopLimit?: number): TClock; -/** - * Creates a clock and installs it globally. - * - * @param now Current time for the clock, as with lolex.createClock(). - * @param toFake Names of methods that should be faked. - * @type TClock Type of clock to create. - * @usage lolex.install(["setTimeout", "clearTimeout"]); - */ -export declare function install(now?: number | Date, toFake?: FakeMethod[]): TClock; + +export interface LolexInstallOpts { + /** + * installs lolex onto the specified target context (default: global) + */ + target?: any; + /** + * installs lolex with the specified unix epoch (default: 0) + */ + now?: number; + /** + * an array with explicit function names to hijack. When not set, lolex will automatically fake all methods except nextTick + * e.g., lolex.install({ toFake: ["setTimeout", "nextTick"]}) will fake only setTimeout and nextTick + */ + toFake?: FakeMethod[]; + /** + * the maximum number of timers that will be run when calling runAll() (default: 1000) + */ + loopLimit?: number; + /** + * tells lolex to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by + * 20ms for every 20ms change in the real system time) (default: false) + */ + shouldAdvanceTime?: boolean; + /** + * relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change + * in the real system time (default: 20) + */ + advanceTimeDelta?: number; +} /** - * Creates a clock and installs it onto the context object. - * - * @param context Context to install the clock onto. + * Creates a clock and installs it globally. + * * @param now Current time for the clock, as with lolex.createClock(). * @param toFake Names of methods that should be faked. * @type TClock Type of clock to create. - * @usage lolex.install(context, ["setTimeout", "clearTimeout"]); */ -export declare function install(context?: any, now?: number | Date, toFake?: FakeMethod[]): TClock; +export declare function install(opts: LolexInstallOpts): TClock; diff --git a/types/lolex/lolex-tests.ts b/types/lolex/lolex-tests.ts index 876e4280c5..8039140dc5 100644 --- a/types/lolex/lolex-tests.ts +++ b/types/lolex/lolex-tests.ts @@ -16,25 +16,14 @@ lolex.createClock(new Date()); lolex.createClock(7, 9001); lolex.createClock(new Date(), 9001); -lolex.install(7); -lolex.install(new Date()); -lolex.install(7, ["setTimeout"]); -lolex.install(new Date(), ["setTimeout"]); - -lolex.install(7); -lolex.install(new Date()); -lolex.install(7, ["setTimeout"]); -lolex.install(new Date(), ["setTimeout"]); - -lolex.install({}, 7); -lolex.install({}, new Date()); -lolex.install({}, 7, ["setTimeout"]); -lolex.install({}, new Date(), ["setTimeout"]); - -lolex.install({}, 7); -lolex.install({}, new Date()); -lolex.install({}, 7, ["setTimeout"]); -lolex.install({}, new Date(), ["setTimeout"]); +lolex.install({ + advanceTimeDelta: 20, + loopLimit: 10, + now: 0, + shouldAdvanceTime: true, + target: {}, + toFake: ["setTimeout"] +}); const browserNow: number = browserClock.now; const browserDate: Date = new browserClock.Date(); @@ -80,5 +69,7 @@ nodeClock.setSystemTime(); nodeClock.setSystemTime(7); nodeClock.setSystemTime(new Date()); +nodeClock.nextTick(() => undefined); + browserClock.uninstall(); nodeClock.uninstall(); From 85205b1b8f76dca3fe0827a5242e48f627ff6f96 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Wed, 22 Nov 2017 11:25:57 +0100 Subject: [PATCH 072/269] bugfix in tsconfig.json - non-existing compiler option. --- types/lolex/tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/lolex/tsconfig.json b/types/lolex/tsconfig.json index e9ab242410..d3832ef8ed 100644 --- a/types/lolex/tsconfig.json +++ b/types/lolex/tsconfig.json @@ -8,7 +8,6 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, - "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -21,4 +20,4 @@ "index.d.ts", "lolex-tests.ts" ] -} \ No newline at end of file +} From 3f362978d81d5113ad2a1640e56cdc68ae695087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Flor=C3=AAncio?= Date: Wed, 22 Nov 2017 12:45:29 +0000 Subject: [PATCH 073/269] Fixed linter errors --- types/node-cache/index.d.ts | 1 - types/node-cache/node-cache-tests.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/node-cache/index.d.ts b/types/node-cache/index.d.ts index 00e7316edc..069bd4fb32 100644 --- a/types/node-cache/index.d.ts +++ b/types/node-cache/index.d.ts @@ -257,7 +257,6 @@ declare class NodeCache extends events.EventEmitter implements NodeCache.NodeCac cb?: Callback, ): boolean; - /** * list all keys within this cache * @param cb Callback function diff --git a/types/node-cache/node-cache-tests.ts b/types/node-cache/node-cache-tests.ts index 66c2fb4176..ebf1b88688 100644 --- a/types/node-cache/node-cache-tests.ts +++ b/types/node-cache/node-cache-tests.ts @@ -83,7 +83,7 @@ interface TypeSample { result = cache.getStats(); } -/* tslint:disable void-return no-void-expression */ +/* tslint-:disable void-return no-void-expression { let cache: NodeCache; let result: void; @@ -95,4 +95,4 @@ interface TypeSample { let result: void; result = cache.close(); } -/* tslint:enable void-return */ + tslint-:enable void-return */ From 004b817c7c23daa667d810f72a3deb6fe015648f Mon Sep 17 00:00:00 2001 From: Jochen Becker Date: Wed, 22 Nov 2017 14:48:54 +0100 Subject: [PATCH 074/269] [cordova-plugin-keyboard] Support for deprecated events --- .../cordova-plugin-keyboard-tests.ts | 2 +- types/cordova-plugin-keyboard/index.d.ts | 48 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts b/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts index 8a707f057d..fa5cf72a30 100644 --- a/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts +++ b/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts @@ -28,4 +28,4 @@ window.addEventListener('keyboardWillShow', () => console.log('keyboardWillShow' window.addEventListener('keyboardWillHide', () => console.log('keyboardWillHide')); -window.addEventListener('keyboardHeightWillChange', (event) => console.log(`keyboardHeightWillChange - keyboard height: ${event.keyboardHeight}`)); +window.addEventListener('keyboardHeightWillChange', (event: CordovaKeyboardEvent) => console.log(`keyboardHeightWillChange - keyboard height: ${event.keyboardHeight}`)); diff --git a/types/cordova-plugin-keyboard/index.d.ts b/types/cordova-plugin-keyboard/index.d.ts index 6298050b2c..af880d732a 100644 --- a/types/cordova-plugin-keyboard/index.d.ts +++ b/types/cordova-plugin-keyboard/index.d.ts @@ -136,7 +136,18 @@ interface Keyboard { * * */ - automaticScrollToTopOnHiding: boolean + automaticScrollToTopOnHiding: boolean, + + /** + * Deprecated Events + */ + onshow(): void, + + onhide(): void, + + onhiding(): void, + + onshowing(): void } interface CordovaKeyboardEvent extends Event { @@ -144,42 +155,31 @@ interface CordovaKeyboardEvent extends Event { keyboardHeight: number; } -interface Window { +interface WindowEventMap { /** - * @param type This event is fired when keyboard fully shown. - * - * @param callback Function is called when keyboard is shown. + * This event is fired when keyboard fully shown. */ - addEventListener(type: 'keyboardDidShow', callback: () => any, useCapture?: boolean): void; + 'keyboardDidShow': Event, /** - * @param type This event is fired when the keyboard is fully closed. - * - * @param callback Function is called when keyboard is closed. + * This event is fired when the keyboard is fully closed. */ - addEventListener(type: 'keyboardDidHide', callback: () => any, useCapture?: boolean): void; + 'keyboardDidHide': Event, /** - * @param type This event fires before keyboard will be shown. - * - * @param callback Function is called when keyboard is about to be shown on the screen. + * This event fires before keyboard will be shown. */ - addEventListener(type: 'keyboardWillShow', callback: () => any, useCapture?: boolean): void; + 'keyboardWillShow': Event, /** - * @param type This event is fired when the keyboard is fully closed. - * - * @param callback Function is called when keyboard is about to be closed. + * This event is fired when the keyboard is fully closed. */ - addEventListener(type: 'keyboardWillHide', callback: () => any, useCapture?: boolean): void; + 'keyboardWillHide': Event, /** - * @param type This event is fired when the keyboard is fully closed. - * - * @param callback Function is called when keyboard is about to be closed. The function is - * passed an InAppBrowserEvent object as a parameter. + * This event is fired when the keyboard is fully closed. */ - addEventListener(type: 'keyboardHeightWillChange', callback: (event: CordovaKeyboardEvent) => any, useCapture?: boolean): void; -} + 'keyboardHeightWillChange': CordovaKeyboardEvent + } declare var Keyboard: Keyboard; From c6798928cb5f078d1ff655e244c448973e7f4523 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Wed, 22 Nov 2017 16:17:30 +0100 Subject: [PATCH 075/269] Also add 'hrtime' method. --- types/lolex/index.d.ts | 2 +- types/lolex/lolex-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index b033862062..c0688a5b09 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -51,7 +51,7 @@ type Clock = BrowserClock | NodeClock; /** * Names of clock methods that may be faked by install. */ -type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick"; +type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime"; /** * Controls the flow of time. diff --git a/types/lolex/lolex-tests.ts b/types/lolex/lolex-tests.ts index 8039140dc5..95b6a2be78 100644 --- a/types/lolex/lolex-tests.ts +++ b/types/lolex/lolex-tests.ts @@ -22,7 +22,7 @@ lolex.install({ now: 0, shouldAdvanceTime: true, target: {}, - toFake: ["setTimeout"] + toFake: ["setTimeout", "nextTick", "hrtime"] }); const browserNow: number = browserClock.now; From 2923550d2611e4553c1d03e26a06242e95e658df Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Wed, 22 Nov 2017 16:18:29 +0100 Subject: [PATCH 076/269] Revert "bugfix in tsconfig.json - non-existing compiler option." This reverts commit 85205b1b8f76dca3fe0827a5242e48f627ff6f96. --- types/lolex/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/lolex/tsconfig.json b/types/lolex/tsconfig.json index d3832ef8ed..e9ab242410 100644 --- a/types/lolex/tsconfig.json +++ b/types/lolex/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +21,4 @@ "index.d.ts", "lolex-tests.ts" ] -} +} \ No newline at end of file From 186e8dd72d1b7f31803bf35ba7565478a64432ca Mon Sep 17 00:00:00 2001 From: Cameron Martin Date: Wed, 22 Nov 2017 19:45:31 +0000 Subject: [PATCH 077/269] Fixed error with isReferencedIdentifier. --- types/babel-traverse/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/babel-traverse/index.d.ts b/types/babel-traverse/index.d.ts index 37e7076432..df420c17bd 100644 --- a/types/babel-traverse/index.d.ts +++ b/types/babel-traverse/index.d.ts @@ -772,7 +772,7 @@ export class NodePath { isJSX(opts?: object): this is NodePath; isNumberLiteral(opts?: object): this is NodePath; isRegexLiteral(opts?: object): this is NodePath; - isReferencedIdentifier(opts?: object): this is NodePath; + isReferencedIdentifier(opts?: object): this is NodePath; isReferencedMemberExpression(opts?: object): this is NodePath; isBindingIdentifier(opts?: object): this is NodePath; isScope(opts?: object): this is NodePath; From 7b9d08ea801e5dea842a8ad3b8377dc56441df1c Mon Sep 17 00:00:00 2001 From: Cameron Martin Date: Wed, 22 Nov 2017 19:48:42 +0000 Subject: [PATCH 078/269] Updated isXX methods of babel-types to be in-line with babel-traverse. --- types/babel-types/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/babel-types/index.d.ts b/types/babel-types/index.d.ts index 1879c81e85..a49909ed4a 100644 --- a/types/babel-types/index.d.ts +++ b/types/babel-types/index.d.ts @@ -1265,13 +1265,13 @@ export function isJSX(node: object, opts?: object): node is JSX; export function isNumberLiteral(node: object, opts?: object): node is NumericLiteral; export function isRegexLiteral(node: object, opts?: object): node is RegExpLiteral; -export function isReferencedIdentifier(node: object, opts?: object): boolean; -export function isReferencedMemberExpression(node: object, opts?: object): boolean; -export function isBindingIdentifier(node: object, opts?: object): boolean; -export function isScope(node: object, opts?: object): boolean; +export function isReferencedIdentifier(node: object, opts?: object): node is Identifier | JSXIdentifier; +export function isReferencedMemberExpression(node: object, opts?: object): node is MemberExpression; +export function isBindingIdentifier(node: object, opts?: object): node is Identifier; +export function isScope(node: object, opts?: object): node is Scopable; export function isReferenced(node: object, opts?: object): boolean; -export function isBlockScoped(node: object, opts?: object): boolean; -export function isVar(node: object, opts?: object): boolean; +export function isBlockScoped(node: object, opts?: object): node is FunctionDeclaration | ClassDeclaration | VariableDeclaration; +export function isVar(node: object, opts?: object): node is VariableDeclaration; export function isUser(node: object, opts?: object): boolean; export function isGenerated(node: object, opts?: object): boolean; export function isPure(node: object, opts?: object): boolean; From 40e24912b2d95b3508b7d68efadb0141541c14b3 Mon Sep 17 00:00:00 2001 From: Nick Veys Date: Wed, 22 Nov 2017 14:34:13 -0600 Subject: [PATCH 079/269] Improve importability of angular-websocket --- types/angular-websocket/index.d.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/types/angular-websocket/index.d.ts b/types/angular-websocket/index.d.ts index b7b3f55093..f11f01c891 100644 --- a/types/angular-websocket/index.d.ts +++ b/types/angular-websocket/index.d.ts @@ -4,16 +4,23 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import * as ng from "angular"; +import * as angular from "angular"; + +export type IWebSocketConfigOptions = angular.websocket.IWebSocketConfigOptions; +export type IWebSocketProvider = angular.websocket.IWebSocketProvider; +export type IWebSocketMessageOptions = angular.websocket.IWebSocketMessageOptions; +export type IWebSocketMessageHandler = angular.websocket.IWebSocketMessageHandler; +export type IWebSocketQueueItem = angular.websocket.IWebSocketQueueItem; +export type IWebSocket = angular.websocket.IWebSocket; declare module "angular" { - namespace websocket { + export namespace websocket { /** * Options available to be specified for IWebSocketProvider. */ type IWebSocketConfigOptions = { - scope?: ng.IScope; + scope?: angular.IScope; rootScopeFailOver?: boolean; useApplyAsync?: boolean; initialTimeout?: number; @@ -54,7 +61,7 @@ declare module "angular" { /** Type corresponding to items stored in $WebSocket#sendQueue instance. */ type IWebSocketQueueItem = { message: any; - defered: ng.IPromise; + defered: angular.IPromise; } interface IWebSocket { @@ -108,7 +115,7 @@ declare module "angular" { * * @param data data to send, if this is an object, it will be stringified before sending */ - send(data: string | {}): ng.IPromise; + send(data: string | {}): angular.IPromise; /** * WebSocket instance. From 75d009816c1852e32be20e761a2dfbf78df86dd6 Mon Sep 17 00:00:00 2001 From: Nick Veys Date: Wed, 22 Nov 2017 15:15:19 -0600 Subject: [PATCH 080/269] Move tslint, tsconfig closer to defaults, fix all linting issues --- .../angular-websocket-tests.ts | 105 ++++++++---------- types/angular-websocket/index.d.ts | 68 ++++++------ types/angular-websocket/tsconfig.json | 16 +-- types/angular-websocket/tslint.json | 75 +------------ 4 files changed, 91 insertions(+), 173 deletions(-) diff --git a/types/angular-websocket/angular-websocket-tests.ts b/types/angular-websocket/angular-websocket-tests.ts index 1df77b7a2a..51246c529a 100644 --- a/types/angular-websocket/angular-websocket-tests.ts +++ b/types/angular-websocket/angular-websocket-tests.ts @@ -1,69 +1,62 @@ -let dummySocket: ng.websocket.IWebSocket; -let dummyPromise: ng.IPromise; -let dummyScope: ng.IScope; +import * as ng from 'angular'; -let provider: ng.websocket.IWebSocketProvider = (url: string, protocols?:string[] | ng.websocket.IWebSocketConfigOptions, options?: ng.websocket.IWebSocketConfigOptions) => { - return dummySocket; -} +(promise: angular.IPromise, scope: ng.IScope, provider: ng.websocket.IWebSocketProvider) => { + const socket = provider("wss://localhost"); + const socketWithProtocols = provider("wss://localhost", ["protocol-a", "protocol-b"]); -let socketWithProtocol = provider("wss://localhost", "protocol"); -let socketWithProtocols = provider("wss://localhost", ["protocol-a", "protocol-b"]); + const socketWithOptions = provider("wss://localhost", { + scope, + rootScopeFailOver: true, + useApplyAsync: true, + initialTimeout: 100, + maxTimeout: 300000, + reconnectIfNotNormalClose: true, + binaryType: "blob" + }); -let socketWithOptions = provider("wss://localhost", { - scope: dummyScope, - rootScopeFailOver: true, - useApplyAsync: true, - initialTimeout: 100, - maxTimeout: 300000, - reconnectIfNotNormalClose: true, - binaryType: "blob" -}); + const socketWithProtocolAndOptions = provider("wss://localhost", "protocol", { + scope, + rootScopeFailOver: true, + useApplyAsync: true, + initialTimeout: 100, + maxTimeout: 300000, + reconnectIfNotNormalClose: true, + binaryType: "blob" + }); -let socketWithProtocolAndOptions = provider("wss://localhost", "protocol", { - scope: dummyScope, - rootScopeFailOver: true, - useApplyAsync: true, - initialTimeout: 100, - maxTimeout: 300000, - reconnectIfNotNormalClose: true, - binaryType: "blob" -}); + socket.onOpen((event: Event) => {}) + .onClose((event: Event) => {}) + .onError((event: Event) => {}) + .onMessage((event: Event) => {}); -let socket = provider("wss://localhost"); + socket.onMessage((event: Event) => {}, { filter: /Some Filter/ }) + .onMessage((event: Event) => {}, { filter: 'Some Filter' }) + .onMessage((event: Event) => {}, { filter: 'Some Filter', autoApply: true }) + .onMessage((event: Event) => {}, { autoApply: false }); -socket.onOpen((event) => {}) - .onClose((event) => {}) - .onError((event) => {}) - .onMessage((event) => {}); + socket.close(true); + socket.close(); -socket.onMessage((event) => {}, { filter: /Some Filter/ }) - .onMessage((event) => {}, { filter: 'Some Filter' }) - .onMessage((event) => {}, { filter: 'Some Filter', autoApply: true }) - .onMessage((event) => {}, { autoApply: false }); + socket.send("Some great data here!").finally(() => {}); + socket.send({ list: [1, 2, 3, 4] }); -socket.close(true); -socket.close(); + socket.socket.send("data"); + socket.socket.close(); + socket.socket.close(1); + socket.socket.close(1, "reason"); -socket.send("Some great data here!").finally(() => {}); -socket.send({ list: [1, 2, 3, 4] }); + socket.sendQueue.push({ message: "msg", defered: promise }); -socket.socket.send("data"); -socket.socket.close(); -socket.socket.close(1); -socket.socket.close(1, "reason"); + socket.onOpenCallbacks.push((event: Event) => {}); + socket.onCloseCallbacks.push((event: CloseEvent) => {}); + socket.onErrorCallbacks.push((event: Event) => {}); + socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: 'Some Filter', autoApply: true }); + socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: /Some Filter/, autoApply: true }); + socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, autoApply: true }); -socket.sendQueue.push({ message: "msg", defered: dummyPromise }); + socket.readyState = 0; -socket.onOpenCallbacks.push((event: Event) => {}); -socket.onCloseCallbacks.push((event: CloseEvent) => {}); -socket.onErrorCallbacks.push((event: Event) => {}); -socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: 'Some Filter', autoApply: true }); -socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: /Some Filter/, autoApply: true }); -socket.onMessageCallbacks.push({ fn: (event: MessageEvent) => {}, pattern: undefined, autoApply: true }); - -socket.readyState = 0; - -socket.initialTimeout = 10; - -socket.maxTimeout = 5000; + socket.initialTimeout = 10; + socket.maxTimeout = 5000; +}; diff --git a/types/angular-websocket/index.d.ts b/types/angular-websocket/index.d.ts index f11f01c891..0b26bd2cfd 100644 --- a/types/angular-websocket/index.d.ts +++ b/types/angular-websocket/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for angular-websocket v2.0 +// Type definitions for angular-websocket 2.0 // Project: https://github.com/AngularClass/angular-websocket // Definitions by: Nick Veys // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,33 +14,32 @@ export type IWebSocketQueueItem = angular.websocket.IWebSocketQueueItem; export type IWebSocket = angular.websocket.IWebSocket; declare module "angular" { - export namespace websocket { - + namespace websocket { /** * Options available to be specified for IWebSocketProvider. */ - type IWebSocketConfigOptions = { - scope?: angular.IScope; - rootScopeFailOver?: boolean; - useApplyAsync?: boolean; - initialTimeout?: number; - maxTimeout?: number; - binaryType?: "blob" | "arraybuffer"; - reconnectIfNotNormalClose?: boolean; - } - interface IWebSocketProvider { - /** - * Creates and opens an IWebSocket instance. - * - * @param url url to connect to - * @return websocket instance - */ - (url: string, protocols?: string | string[] | IWebSocketConfigOptions, options?: IWebSocketConfigOptions): IWebSocket; + interface IWebSocketConfigOptions { + scope?: IScope; + rootScopeFailOver?: boolean; + useApplyAsync?: boolean; + initialTimeout?: number; + maxTimeout?: number; + binaryType?: "blob" | "arraybuffer"; + reconnectIfNotNormalClose?: boolean; } + /** + * Creates and opens an IWebSocket instance. + * + * @param url url to connect to + * @return websocket instance + */ + type IWebSocketProvider = + (url: string, protocols?: string | string[] | IWebSocketConfigOptions, + options?: IWebSocketConfigOptions) => IWebSocket; + /** Options available to be specified for IWebSocket.onMessage */ - type IWebSocketMessageOptions = { - + interface IWebSocketMessageOptions { /** * If specified, only messages that match the filter will cause the message event * to be fired. @@ -51,21 +50,20 @@ declare module "angular" { autoApply?: boolean; } - /** Type corresponding to onMessage callbaks stored in $Websocket#onMessageCallbacks instance. */ - type IWebSocketMessageHandler = { - fn: (evt: MessageEvent) => void; - pattern: string | RegExp; - autoApply: boolean; + /** Type corresponding to onMessage callbacks stored in $Websocket#onMessageCallbacks instance. */ + interface IWebSocketMessageHandler { + fn: (evt: MessageEvent) => void; + pattern?: string | RegExp; + autoApply: boolean; } /** Type corresponding to items stored in $WebSocket#sendQueue instance. */ - type IWebSocketQueueItem = { - message: any; - defered: angular.IPromise; + interface IWebSocketQueueItem { + message: any; + defered: IPromise; } interface IWebSocket { - /** * Adds a callback to be executed each time a socket connection is opened for * this instance. @@ -115,7 +113,7 @@ declare module "angular" { * * @param data data to send, if this is an object, it will be stringified before sending */ - send(data: string | {}): angular.IPromise; + send(data: string | {}): IPromise; /** * WebSocket instance. @@ -130,7 +128,7 @@ declare module "angular" { /** * List of callbacks to be executed when the socket is opened. */ - onOpenCallbacks: ((evt: Event) => void)[]; + onOpenCallbacks: Array<((evt: Event) => void)>; /** * List of callbacks to be executed when a message is received from the socket. @@ -140,12 +138,12 @@ declare module "angular" { /** * List of callbacks to be executed when an error is received from the socket. */ - onErrorCallbacks: ((evt: Event) => void)[]; + onErrorCallbacks: Array<((evt: Event) => void)>; /** * List of callbacks to be executed when the socket is closed. */ - onCloseCallbacks: ((evt: CloseEvent) => void)[]; + onCloseCallbacks: Array<((evt: CloseEvent) => void)>; /** * Returns either the readyState value from the underlying WebSocket instance diff --git a/types/angular-websocket/tsconfig.json b/types/angular-websocket/tsconfig.json index 96aab30ef0..89d5cb9dc3 100644 --- a/types/angular-websocket/tsconfig.json +++ b/types/angular-websocket/tsconfig.json @@ -1,8 +1,4 @@ { - "files": [ - "index.d.ts", - "angular-websocket-tests.ts" - ], "compilerOptions": { "module": "commonjs", "lib": [ @@ -11,8 +7,8 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": false, + "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,5 +16,9 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true - } -} \ No newline at end of file + }, + "files": [ + "index.d.ts", + "angular-websocket-tests.ts" + ] +} diff --git a/types/angular-websocket/tslint.json b/types/angular-websocket/tslint.json index a41bf5d19a..2c7c1bed53 100644 --- a/types/angular-websocket/tslint.json +++ b/types/angular-websocket/tslint.json @@ -1,79 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "interface-name": false } } From d7848388b9482bbc77115510018df12192271716 Mon Sep 17 00:00:00 2001 From: Bryan Johnson Date: Wed, 22 Nov 2017 14:24:33 -0700 Subject: [PATCH 081/269] update mapbox-gl to handle expressions and heatmaps --- types/mapbox-gl/index.d.ts | 1646 ++++++++++++++++++------------------ 1 file changed, 838 insertions(+), 808 deletions(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index ddaafced3d..520f267b5f 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mapbox GL JS v0.41.0 +// Type definitions for Mapbox GL JS v0.42.2 // Project: https://github.com/mapbox/mapbox-gl-js // Definitions by: Dominik Bruderer , Patrick Reames // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,1080 +7,1110 @@ /// declare namespace mapboxgl { - let accessToken: string; - let version: string; - export function supported(options?: {failIfMajorPerformanceCaveat?: boolean}): boolean; - export function setRTLTextPlugin(pluginURL: string, callback: Function): void; + let accessToken: string; + let version: string; - type LngLatLike = number[] | LngLat; - type LngLatBoundsLike = number[][] | LngLatLike[] | LngLatBounds; - type PointLike = number[] | Point; + export function supported(options?: { failIfMajorPerformanceCaveat?: boolean }): boolean; - /** - * Map - */ - export class Map extends Evented { - constructor(options?: MapboxOptions); + export function setRTLTextPlugin(pluginURL: string, callback: Function): void; - addControl(control: Control, position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'): this; + type LngLatLike = number[] | LngLat; + type LngLatBoundsLike = number[][] | LngLatLike[] | LngLatBounds; + type PointLike = number[] | Point; + type Expression = any[]; - removeControl(control: Control): this; + /** + * Map + */ + export class Map extends Evented { + constructor(options?: MapboxOptions); - addClass(klass: string, options?: mapboxgl.StyleOptions): this; + addControl(control: Control, position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'): this; - removeClass(klass: string, options?: mapboxgl.StyleOptions): this; + removeControl(control: Control): this; - setClasses(klasses: string[], options?: mapboxgl.StyleOptions): this; + addClass(klass: string, options?: mapboxgl.StyleOptions): this; - hasClass(klass: string): boolean; + removeClass(klass: string, options?: mapboxgl.StyleOptions): this; - getClasses(): string[]; + setClasses(klasses: string[], options?: mapboxgl.StyleOptions): this; - resize(): this; + hasClass(klass: string): boolean; - getBounds(): mapboxgl.LngLatBounds; + getClasses(): string[]; - setMaxBounds(lnglatbounds?: LngLatBoundsLike): this; + resize(): this; - setMinZoom(minZoom?: number): this; + getBounds(): mapboxgl.LngLatBounds; - getMinZoom(): number; + setMaxBounds(lnglatbounds?: LngLatBoundsLike): this; - setMaxZoom(maxZoom?: number): this; + setMinZoom(minZoom?: number): this; - getMaxZoom(): number; + getMinZoom(): number; - project(lnglat: LngLatLike): mapboxgl.Point; + setMaxZoom(maxZoom?: number): this; - unproject(point: PointLike): mapboxgl.LngLat; + getMaxZoom(): number; - queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature[]; + project(lnglat: LngLatLike): mapboxgl.Point; - querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[]; + unproject(point: PointLike): mapboxgl.LngLat; - setStyle(style: mapboxgl.Style | string): this; + queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: { layers?: string[], filter?: any[] }): GeoJSON.Feature[]; - getStyle(): mapboxgl.Style; + querySourceFeatures(sourceID: string, parameters?: { sourceLayer?: string, filter?: any[] }): GeoJSON.Feature[]; - isStyleLoaded(): boolean; + setStyle(style: mapboxgl.Style | string): this; - addSource(id: string, source: VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw): this; + getStyle(): mapboxgl.Style; - isSourceLoaded(id: string): boolean; + isStyleLoaded(): boolean; - areTilesLoaded(): boolean; + addSource(id: string, source: VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw): this; - removeSource(id: string): this; + isSourceLoaded(id: string): boolean; - getSource(id: string): VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource; + areTilesLoaded(): boolean; - addImage(name: string, image: HTMLImageElement | ArrayBufferView, options?: {width?: number, height?: number, pixelRatio?: number}): this; + removeSource(id: string): this; - removeImage(name: string): this; + getSource(id: string): VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource; - loadImage(url: string, callback: Function): this; + addImage(name: string, image: HTMLImageElement | ArrayBufferView, options?: { width?: number, height?: number, pixelRatio?: number }): this; - addLayer(layer: mapboxgl.Layer, before?: string): this; + removeImage(name: string): this; - moveLayer(id: string, beforeId?: string): this; + loadImage(url: string, callback: Function): this; - removeLayer(id: string): this; + addLayer(layer: mapboxgl.Layer, before?: string): this; - getLayer(id: string): mapboxgl.Layer; + moveLayer(id: string, beforeId?: string): this; - setFilter(layer: string, filter?: any[]): this; + removeLayer(id: string): this; - setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this; + getLayer(id: string): mapboxgl.Layer; - getFilter(layer: string): any[]; + setFilter(layer: string, filter?: any[]): this; - setPaintProperty(layer: string, name: string, value: any, klass?: string): this; + setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this; - getPaintProperty(layer: string, name: string, klass?: string): any; + getFilter(layer: string): any[]; - setLayoutProperty(layer: string, name: string, value: any): this; + setPaintProperty(layer: string, name: string, value: any, klass?: string): this; - getLayoutProperty(layer: string, name: string, klass?: string): any; + getPaintProperty(layer: string, name: string, klass?: string): any; - setLight(options: mapboxgl.Light, lightOptions: any): this; + setLayoutProperty(layer: string, name: string, value: any): this; - getLight(): mapboxgl.Light; + getLayoutProperty(layer: string, name: string, klass?: string): any; - getContainer(): HTMLElement; + setLight(options: mapboxgl.Light, lightOptions: any): this; - getCanvasContainer(): HTMLElement; + getLight(): mapboxgl.Light; - getCanvas(): HTMLCanvasElement; + getContainer(): HTMLElement; - loaded(): boolean; + getCanvasContainer(): HTMLElement; - remove(): void; + getCanvas(): HTMLCanvasElement; - onError(): void; + loaded(): boolean; - showTileBoundaries: boolean; + remove(): void; - showCollisionBoxes: boolean; + onError(): void; - repaint: boolean; + showTileBoundaries: boolean; - getCenter(): mapboxgl.LngLat; + showCollisionBoxes: boolean; - setCenter(center: LngLatLike, eventData?: mapboxgl.EventData): this; + repaint: boolean; - panBy(offset: number[], options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + getCenter(): mapboxgl.LngLat; - panTo(lnglat: LngLatLike, options?: mapboxgl.AnimationOptions, eventdata?: mapboxgl.EventData): this; + setCenter(center: LngLatLike, eventData?: mapboxgl.EventData): this; - getZoom(): number; + panBy(offset: number[], options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - setZoom(zoom: number, eventData?: mapboxgl.EventData): this; + panTo(lnglat: LngLatLike, options?: mapboxgl.AnimationOptions, eventdata?: mapboxgl.EventData): this; - zoomTo(zoom: number, options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + getZoom(): number; - zoomIn(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + setZoom(zoom: number, eventData?: mapboxgl.EventData): this; - zoomOut(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + zoomTo(zoom: number, options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - getBearing(): number; + zoomIn(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - setBearing(bearing: number, eventData?: mapboxgl.EventData): this; + zoomOut(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - rotateTo(bearing: number, options?: mapboxgl.AnimationOptions, eventData?: EventData): this; + getBearing(): number; - resetNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + setBearing(bearing: number, eventData?: mapboxgl.EventData): this; - snapToNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + rotateTo(bearing: number, options?: mapboxgl.AnimationOptions, eventData?: EventData): this; - getPitch(): number; + resetNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - setPitch(pitch: number, eventData?: EventData): this; + snapToNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - fitBounds(bounds: LngLatBoundsLike, options?: { linear?: boolean, easing?: Function, padding?: number | mapboxgl.PaddingOptions, offset?: PointLike, maxZoom?: number }, eventData?: mapboxgl.EventData): this; + getPitch(): number; - jumpTo(options: mapboxgl.CameraOptions, eventData?: mapboxgl.EventData): this; + setPitch(pitch: number, eventData?: EventData): this; - easeTo(options: mapboxgl.CameraOptions | mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + fitBounds(bounds: LngLatBoundsLike, options?: { linear?: boolean, easing?: Function, padding?: number | mapboxgl.PaddingOptions, offset?: PointLike, maxZoom?: number }, eventData?: mapboxgl.EventData): this; - flyTo(options: mapboxgl.FlyToOptions, eventData?: mapboxgl.EventData): this; + jumpTo(options: mapboxgl.CameraOptions, eventData?: mapboxgl.EventData): this; - isMoving(): boolean; + easeTo(options: mapboxgl.CameraOptions | mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; - stop(): this; + flyTo(options: mapboxgl.FlyToOptions, eventData?: mapboxgl.EventData): this; - scrollZoom: ScrollZoomHandler; + isMoving(): boolean; - boxZoom: BoxZoomHandler; + stop(): this; - dragRotate: DragRotateHandler; + scrollZoom: ScrollZoomHandler; - dragPan: DragPanHandler; + boxZoom: BoxZoomHandler; - keyboard: KeyboardHandler; + dragRotate: DragRotateHandler; - doubleClickZoom: DoubleClickZoomHandler; + dragPan: DragPanHandler; - touchZoomRotate: TouchZoomRotateHandler; - } + keyboard: KeyboardHandler; - export interface MapboxOptions { - /** If true, an attribution control will be added to the map. */ - attributionControl?: boolean; + doubleClickZoom: DoubleClickZoomHandler; - bearing?: number; + touchZoomRotate: TouchZoomRotateHandler; + } - /** Snap to north threshold in degrees. */ - bearingSnap?: number; + export interface MapboxOptions { + /** If true, an attribution control will be added to the map. */ + attributionControl?: boolean; - /** If true, enable the "box zoom" interaction (see BoxZoomHandler) */ - boxZoom?: boolean; + bearing?: number; - /** initial map center */ - center?: LngLatLike; + /** Snap to north threshold in degrees. */ + bearingSnap?: number; - /** Style class names with which to initialize the map */ - classes?: string[]; + /** If true, enable the "box zoom" interaction (see BoxZoomHandler) */ + boxZoom?: boolean; - /** ID of the container element */ - container?: string | Element; + /** initial map center */ + center?: LngLatLike; - /** If true, enable the "drag to pan" interaction (see DragPanHandler). */ - dragPan?: boolean; + /** Style class names with which to initialize the map */ + classes?: string[]; - /** If true, enable the "drag to rotate" interaction (see DragRotateHandler). */ - dragRotate?: boolean; + /** ID of the container element */ + container?: string | Element; - /** If true, enable the "double click to zoom" interaction (see DoubleClickZoomHandler). */ - doubleClickZoom?: boolean; + /** If true, enable the "drag to pan" interaction (see DragPanHandler). */ + dragPan?: boolean; - /** If true, the map will track and update the page URL according to map position */ - hash?: boolean; + /** If true, enable the "drag to rotate" interaction (see DragRotateHandler). */ + dragRotate?: boolean; - /** If true, map creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than expected. */ - failIfMayorPerformanceCaveat?: boolean; + /** If true, enable the "double click to zoom" interaction (see DoubleClickZoomHandler). */ + doubleClickZoom?: boolean; - /** If false, no mouse, touch, or keyboard listeners are attached to the map, so it will not respond to input */ - interactive?: boolean; + /** If true, the map will track and update the page URL according to map position */ + hash?: boolean; - /** If true, enable keyboard shortcuts (see KeyboardHandler). */ - keyboard?: boolean; + /** If true, map creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than expected. */ + failIfMayorPerformanceCaveat?: boolean; - logoPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + /** If false, no mouse, touch, or keyboard listeners are attached to the map, so it will not respond to input */ + interactive?: boolean; - /** If set, the map is constrained to the given bounds. */ - maxBounds?: LngLatBoundsLike; + /** If true, enable keyboard shortcuts (see KeyboardHandler). */ + keyboard?: boolean; - /** Maximum zoom of the map */ - maxZoom?: number; + logoPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; - /** Minimum zoom of the map */ - minZoom?: number; + /** If set, the map is constrained to the given bounds. */ + maxBounds?: LngLatBoundsLike; - /** If true, The maps canvas can be exported to a PNG using map.getCanvas().toDataURL();. This is false by default as a performance optimization. */ - preserveDrawingBuffer?: boolean; + /** Maximum zoom of the map */ + maxZoom?: number; - pitch?: number; + /** Minimum zoom of the map */ + minZoom?: number; - refreshExpiredTiles?: boolean; + /** If true, The maps canvas can be exported to a PNG using map.getCanvas().toDataURL();. This is false by default as a performance optimization. */ + preserveDrawingBuffer?: boolean; - renderWorldCopies?: boolean; + pitch?: number; - /** If true, enable the "scroll to zoom" interaction */ - scrollZoom?: boolean; + refreshExpiredTiles?: boolean; - /** stylesheet location */ - style?: mapboxgl.Style | string; + renderWorldCopies?: boolean; - /** If true, the map will automatically resize when the browser window resizes */ - trackResize?: boolean; + /** If true, enable the "scroll to zoom" interaction */ + scrollZoom?: boolean; - /** If true, enable the "pinch to rotate and zoom" interaction (see TouchZoomRotateHandler). */ - touchZoomRotate?: boolean; + /** stylesheet location */ + style?: mapboxgl.Style | string; - /** Initial zoom level */ - zoom?: number; + /** If true, the map will automatically resize when the browser window resizes */ + trackResize?: boolean; - /** Maximum tile cache size for each layer. */ - maxTileCacheSize?: number; - } + /** If true, enable the "pinch to rotate and zoom" interaction (see TouchZoomRotateHandler). */ + touchZoomRotate?: boolean; - export interface PaddingOptions { - top: number; - bottom: number; - left: number; - right: number; - } + /** Initial zoom level */ + zoom?: number; - /** - * BoxZoomHandler - */ - export class BoxZoomHandler { - constructor(map: mapboxgl.Map); + /** Maximum tile cache size for each layer. */ + maxTileCacheSize?: number; + } - isEnabled(): boolean; + export interface PaddingOptions { + top: number; + bottom: number; + left: number; + right: number; + } - isActive(): boolean; + /** + * BoxZoomHandler + */ + export class BoxZoomHandler { + constructor(map: mapboxgl.Map); - enable(): void; + isEnabled(): boolean; - disable(): void; - } + isActive(): boolean; - /** - * ScrollZoomHandler - */ - export class ScrollZoomHandler { - constructor(map: mapboxgl.Map); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - enable(): void; + /** + * ScrollZoomHandler + */ + export class ScrollZoomHandler { + constructor(map: mapboxgl.Map); - disable(): void; - } + isEnabled(): boolean; - /** - * DragPenHandler - */ - export class DragPanHandler { - constructor(map: mapboxgl.Map); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - isActive(): boolean; + /** + * DragPenHandler + */ + export class DragPanHandler { + constructor(map: mapboxgl.Map); - enable(): void; + isEnabled(): boolean; - disable(): void; - } + isActive(): boolean; - /** - * DragRotateHandler - */ - export class DragRotateHandler { - constructor(map: mapboxgl.Map, options?: {bearingSnap?: number, pitchWithRotate?: boolean}); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - isActive(): boolean; + /** + * DragRotateHandler + */ + export class DragRotateHandler { + constructor(map: mapboxgl.Map, options?: { bearingSnap?: number, pitchWithRotate?: boolean }); - enable(): void; + isEnabled(): boolean; - disable(): void; - } + isActive(): boolean; - /** - * KeyboardHandler - */ - export class KeyboardHandler { - constructor(map: mapboxgl.Map); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - enable(): void; + /** + * KeyboardHandler + */ + export class KeyboardHandler { + constructor(map: mapboxgl.Map); - disable(): void; - } + isEnabled(): boolean; - /** - * DoubleClickZoomHandler - */ - export class DoubleClickZoomHandler { - constructor(map: mapboxgl.Map); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - enable(): void; + /** + * DoubleClickZoomHandler + */ + export class DoubleClickZoomHandler { + constructor(map: mapboxgl.Map); - disable(): void; - } + isEnabled(): boolean; - /** - * TouchZoomRotateHandler - */ - export class TouchZoomRotateHandler { - constructor(map: mapboxgl.Map); + enable(): void; - isEnabled(): boolean; + disable(): void; + } - enable(): void; + /** + * TouchZoomRotateHandler + */ + export class TouchZoomRotateHandler { + constructor(map: mapboxgl.Map); - disable(): void; + isEnabled(): boolean; - disableRotation(): void; + enable(): void; - enableRotation(): void; - } + disable(): void; - export interface IControl { - onAdd(map: Map): HTMLElement; - onRemove(map: Map): any; - getDefaultPosition(): string; - } + disableRotation(): void; - /** - * Control - */ - export class Control extends Evented { - } + enableRotation(): void; + } - /** - * Navigation - */ - export class NavigationControl extends Control { - constructor(); - } + export interface IControl { + onAdd(map: Map): HTMLElement; - export class PositionOptions { - enableHighAccuracy?: boolean; - timeout?: number; - maximumAge?: number; - } + onRemove(map: Map): any; - export class FitBoundsOptions { - maxZoom?: number; - } + getDefaultPosition(): string; + } - /** - * Geolocate - */ - export class GeolocateControl extends Control { - constructor(options?: {positionOptions?: PositionOptions, fitBoundsOptions?: FitBoundsOptions, trackUserLocation?: boolean, showUserLocation?: boolean}); - } + /** + * Control + */ + export class Control extends Evented { + } - /** - * Attribution - */ - export class AttributionControl extends Control { - constructor(options?: {compact?: boolean}); - } + /** + * Navigation + */ + export class NavigationControl extends Control { + constructor(); + } - /** - * Scale - */ - export class ScaleControl extends Control { - constructor(options?: {maxWidth?: number, unit?: string}) - } + export class PositionOptions { + enableHighAccuracy?: boolean; + timeout?: number; + maximumAge?: number; + } - /** - * Fullscreen - */ - export class FullscreenControl extends Control { - constructor(); - } + export class FitBoundsOptions { + maxZoom?: number; + } - /** - * Popup - */ - export class Popup extends Evented { - constructor(options?: mapboxgl.PopupOptions); + /** + * Geolocate + */ + export class GeolocateControl extends Control { + constructor(options?: { positionOptions?: PositionOptions, fitBoundsOptions?: FitBoundsOptions, trackUserLocation?: boolean, showUserLocation?: boolean }); + } - addTo(map: mapboxgl.Map): this; + /** + * Attribution + */ + export class AttributionControl extends Control { + constructor(options?: { compact?: boolean }); + } - isOpen(): boolean; + /** + * Scale + */ + export class ScaleControl extends Control { + constructor(options?: { maxWidth?: number, unit?: string }) + } - remove(): this; + /** + * Fullscreen + */ + export class FullscreenControl extends Control { + constructor(); + } - getLngLat(): mapboxgl.LngLat; + /** + * Popup + */ + export class Popup extends Evented { + constructor(options?: mapboxgl.PopupOptions); - setLngLat(lnglat: LngLatLike): this; + addTo(map: mapboxgl.Map): this; - setText(text: string): this; + isOpen(): boolean; - setHTML(html: string): this; + remove(): this; - setDOMContent(htmlNode: Node): this; - } + getLngLat(): mapboxgl.LngLat; - export interface PopupOptions { - closeButton?: boolean; + setLngLat(lnglat: LngLatLike): this; - closeOnClick?: boolean; + setText(text: string): this; - anchor?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + setHTML(html: string): this; - offset?: number | PointLike | { [key:string]: PointLike;}; - } + setDOMContent(htmlNode: Node): this; + } - export interface Style { - bearing?: number; - center?: number[]; - glyphs?: string; - layers?: Layer[]; - metadata?: any; - name?: string; - pitch?: number; - light?: Light; - sources?: any; - sprite?: string; - transition?: Transition; - version: number; - zoom?: number; - } + export interface PopupOptions { + closeButton?: boolean; - export interface Transition { - delay?: number; - duration?: number; - } + closeOnClick?: boolean; - export interface Light { - "anchor"?: "map" | "viewport"; - "position"?: number[]; - "color"?: string; - "intensity"?: number; - } + anchor?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; - export interface Source { - type: "vector" | "raster" | "geojson" | "image" | "video" | "canvas"; - } + offset?: number | PointLike | { [key: string]: PointLike; }; + } - /** - * GeoJSONSource - */ + export interface Style { + bearing?: number; + center?: number[]; + glyphs?: string; + layers?: Layer[]; + metadata?: any; + name?: string; + pitch?: number; + light?: Light; + sources?: any; + sprite?: string; + transition?: Transition; + version: number; + zoom?: number; + } - export interface GeoJSONSourceRaw extends Source, GeoJSONSourceOptions { - type: "geojson"; - } + export interface Transition { + delay?: number; + duration?: number; + } - export class GeoJSONSource implements GeoJSONSourceRaw { - type: "geojson"; + export interface Light { + 'anchor'?: 'map' | 'viewport'; + 'position'?: number[]; + 'color'?: string; + 'intensity'?: number; + } - constructor(options?: mapboxgl.GeoJSONSourceOptions); + export interface Source { + type: 'vector' | 'raster' | 'geojson' | 'image' | 'video' | 'canvas'; + } - setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; - } + /** + * GeoJSONSource + */ - export interface GeoJSONSourceOptions { - data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; + export interface GeoJSONSourceRaw extends Source, GeoJSONSourceOptions { + type: 'geojson'; + } - maxzoom?: number; + export class GeoJSONSource implements GeoJSONSourceRaw { + type: 'geojson'; - buffer?: number; + constructor(options?: mapboxgl.GeoJSONSourceOptions); - tolerance?: number; + setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; + } - cluster?: number | boolean; + export interface GeoJSONSourceOptions { + data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string; - clusterRadius?: number; + maxzoom?: number; - clusterMaxZoom?: number; - } + buffer?: number; - /** - * VideoSource - */ - export interface VideoSource extends VideoSourceOptions { } - export class VideoSource implements Source { - type: "video"; + tolerance?: number; - constructor(options?: mapboxgl.VideoSourceOptions); + cluster?: number | boolean; - getVideo(): HTMLVideoElement; + clusterRadius?: number; - setCoordinates(coordinates: number[][]): this; - } + clusterMaxZoom?: number; + } - export interface VideoSourceOptions { - urls?: string[]; + /** + * VideoSource + */ + export interface VideoSource extends VideoSourceOptions { + } - coordinates?: number[][]; - } + export class VideoSource implements Source { + type: 'video'; - /** - * ImageSource - */ - export interface ImageSource extends ImageSourceOptions { } - export class ImageSource implements Source { - type: "image"; + constructor(options?: mapboxgl.VideoSourceOptions); - constructor(options?: mapboxgl.ImageSourceOptions); + getVideo(): HTMLVideoElement; - setCoordinates(coordinates: number[][]): this; - } + setCoordinates(coordinates: number[][]): this; + } - export interface ImageSourceOptions { - url?: string; + export interface VideoSourceOptions { + urls?: string[]; - coordinates?: number[][]; - } + coordinates?: number[][]; + } - /** - * CanvasSource - */ - export class CanvasSource implements Source, CanvasSourceOptions { - type: "canvas"; + /** + * ImageSource + */ + export interface ImageSource extends ImageSourceOptions { + } - coordinates: number[][]; + export class ImageSource implements Source { + type: 'image'; - canvas: string; + constructor(options?: mapboxgl.ImageSourceOptions); - getCanvas(): HTMLCanvasElement; + setCoordinates(coordinates: number[][]): this; + } - setCoordinates(coordinates: number[][]): this; - } + export interface ImageSourceOptions { + url?: string; - export interface CanvasSourceOptions { - coordinates: number[][]; + coordinates?: number[][]; + } - animate?: boolean; + /** + * CanvasSource + */ + export class CanvasSource implements Source, CanvasSourceOptions { + type: 'canvas'; - canvas: string; - } + coordinates: number[][]; - interface VectorSource extends Source { - type: "vector"; - url?: string; - tiles?: string[]; - minzoom?: number; - maxzoom?: number; - } + canvas: string; - interface RasterSource extends Source { - type: "raster"; - url: string; - tiles?: string[]; - minzoom?: number; - maxzoom?: number; - tileSize?: number; - } + getCanvas(): HTMLCanvasElement; - /** - * LngLat - */ - export class LngLat { - lng: number; - lat: number; + setCoordinates(coordinates: number[][]): this; + } - constructor(lng: number, lat: number); + export interface CanvasSourceOptions { + coordinates: number[][]; - /** Return a new LngLat object whose longitude is wrapped to the range (-180, 180). */ - wrap(): mapboxgl.LngLat; + animate?: boolean; - /** Return a LngLat as an array */ - toArray(): number[]; + canvas: string; + } - /** Return a LngLat as a string */ - toString(): string; + interface VectorSource extends Source { + type: 'vector'; + url?: string; + tiles?: string[]; + minzoom?: number; + maxzoom?: number; + } - toBounds(radius: number): LngLatBounds; + interface RasterSource extends Source { + type: 'raster'; + url: string; + tiles?: string[]; + minzoom?: number; + maxzoom?: number; + tileSize?: number; + } - static convert(input: LngLatLike): mapboxgl.LngLat; - } + /** + * LngLat + */ + export class LngLat { + lng: number; + lat: number; - /** - * LngLatBounds - */ - export class LngLatBounds { - sw: LngLatLike; - ne: LngLatLike; - constructor(sw?: LngLatLike, ne?: LngLatLike); + constructor(lng: number, lat: number); - setNorthEast(ne: LngLatLike): this; + /** Return a new LngLat object whose longitude is wrapped to the range (-180, 180). */ + wrap(): mapboxgl.LngLat; - setSouthWest(sw: LngLatLike): this; + /** Return a LngLat as an array */ + toArray(): number[]; - /** Extend the bounds to include a given LngLat or LngLatBounds. */ - extend(obj: mapboxgl.LngLat | mapboxgl.LngLatBounds): this; + /** Return a LngLat as a string */ + toString(): string; - /** Get the point equidistant from this box's corners */ - getCenter(): mapboxgl.LngLat; + toBounds(radius: number): LngLatBounds; - /** Get southwest corner */ - getSouthWest(): mapboxgl.LngLat; + static convert(input: LngLatLike): mapboxgl.LngLat; + } - /** Get northeast corner */ - getNorthEast(): mapboxgl.LngLat; + /** + * LngLatBounds + */ + export class LngLatBounds { + sw: LngLatLike; + ne: LngLatLike; - /** Get northwest corner */ - getNorthWest(): mapboxgl.LngLat; + constructor(sw?: LngLatLike, ne?: LngLatLike); - /** Get southeast corner */ - getSouthEast(): mapboxgl.LngLat; + setNorthEast(ne: LngLatLike): this; - /** Get west edge longitude */ - getWest(): number; + setSouthWest(sw: LngLatLike): this; - /** Get south edge latitude */ - getSouth(): number; + /** Extend the bounds to include a given LngLat or LngLatBounds. */ + extend(obj: mapboxgl.LngLat | mapboxgl.LngLatBounds): this; - /** Get east edge longitude */ - getEast(): number; + /** Get the point equidistant from this box's corners */ + getCenter(): mapboxgl.LngLat; - /** Get north edge latitude */ - getNorth(): number; + /** Get southwest corner */ + getSouthWest(): mapboxgl.LngLat; - /** Returns a LngLatBounds as an array */ - toArray(): number[][]; + /** Get northeast corner */ + getNorthEast(): mapboxgl.LngLat; - /** Return a LngLatBounds as a string */ - toString(): string; + /** Get northwest corner */ + getNorthWest(): mapboxgl.LngLat; - /** Convert an array to a LngLatBounds object, or return an existing LngLatBounds object unchanged. */ - static convert(input: LngLatBoundsLike): mapboxgl.LngLatBounds; - } + /** Get southeast corner */ + getSouthEast(): mapboxgl.LngLat; - /** - * Point - */ - // Todo: Pull out class to seperate definition for Module "point-geometry" - export class Point { - x: number; - y: number; + /** Get west edge longitude */ + getWest(): number; - constructor(x: number, y: number); + /** Get south edge latitude */ + getSouth(): number; - clone(): Point; + /** Get east edge longitude */ + getEast(): number; - add(p: number): Point; + /** Get north edge latitude */ + getNorth(): number; - sub(p: number): Point; + /** Returns a LngLatBounds as an array */ + toArray(): number[][]; - mult(k: number): Point; + /** Return a LngLatBounds as a string */ + toString(): string; - div(k: number): Point; + /** Convert an array to a LngLatBounds object, or return an existing LngLatBounds object unchanged. */ + static convert(input: LngLatBoundsLike): mapboxgl.LngLatBounds; + } - rotate(a: number): Point; + /** + * Point + */ + // Todo: Pull out class to seperate definition for Module "point-geometry" + export class Point { + x: number; + y: number; - matMult(m: number): Point; + constructor(x: number, y: number); - unit(): Point; + clone(): Point; - perp(): Point; + add(p: number): Point; - round(): Point; + sub(p: number): Point; - mag(): number; + mult(k: number): Point; - equals(p: Point): boolean; + div(k: number): Point; - dist(p: Point): number; + rotate(a: number): Point; - distSqr(p: Point): number; + matMult(m: number): Point; - angle(): number; + unit(): Point; - angleTo(p: Point): number; + perp(): Point; - angleWidth(p: Point): number; + round(): Point; - angleWithSep(x: number, y: number): number; + mag(): number; - static convert(a: PointLike): Point; - } + equals(p: Point): boolean; - export class Marker { - constructor(element?: HTMLElement, options?: { offset?: PointLike }); + dist(p: Point): number; - addTo(map: Map): this; + distSqr(p: Point): number; - remove(): this; + angle(): number; - getLngLat(): LngLat; + angleTo(p: Point): number; - setLngLat(lngLat: LngLatLike): this; + angleWidth(p: Point): number; - setPopup(popup?: Popup): this; + angleWithSep(x: number, y: number): number; - getPopup(): Popup; + static convert(a: PointLike): Point; + } - togglePopup(): this; - } + export class Marker { + constructor(element?: HTMLElement, options?: { offset?: PointLike }); - /** - * Evented - */ - export class Evented { - on(type: string, listener: Function): this; + addTo(map: Map): this; - on(type: string, layer: string, listener: Function): this; + remove(): this; - off(type?: string | any, listener?: Function): this; + getLngLat(): LngLat; - off(type?: string | any, layer?: string, listener?: Function): this; + setLngLat(lngLat: LngLatLike): this; - once(type: string, listener: Function): this; + setPopup(popup?: Popup): this; - fire(type: string, data?: mapboxgl.EventData | Object): this; + getPopup(): Popup; - listens(type: string): boolean; - } + togglePopup(): this; + } - /** - * StyleOptions - */ - export interface StyleOptions { - transition?: boolean; - } - - /** - * EventData - */ - export class EventData { - type: string; - target: Map; - originalEvent: Event; - point: mapboxgl.Point; - lngLat: mapboxgl.LngLat; - } - - export class MapMouseEvent { - type: string; - target: Map; - originalEvent: MouseEvent; - point: mapboxgl.Point; - lngLat: mapboxgl.LngLat; - } - - export class MapTouchEvent { - type: string; - target: Map; - originalEvent: TouchEvent; - point: mapboxgl.Point; - lngLat: mapboxgl.LngLat; - points: Point[]; - lngLats: LngLat[]; - } - - export class MapBoxZoomEvent { - originalEvent: MouseEvent; - boxZoomBounds: LngLatBounds; - } - - export class MapDataEvent { - type: string; - dataType: "source" | "style" | "tile"; - isSourceLoaded?: boolean; - source?: mapboxgl.Source; - coord?: any; - } - - /** - * AnimationOptions - */ - export interface AnimationOptions { - /** Number in milliseconds */ - duration?: number; - easing?: Function; - /** point, origin of movement relative to map center */ - offset?: PointLike; - /** When set to false, no animation happens */ - animate?: boolean; - } - - /** - * CameraOptions - */ - export interface CameraOptions { - /** Map center */ - center?: LngLatLike; - /** Map zoom level */ - zoom?: number; - /** Map rotation bearing in degrees counter-clockwise from north */ - bearing?: number; - /** Map angle in degrees at which the camera is looking at the ground */ - pitch?: number; - /** If zooming, the zoom center (defaults to map center) */ - around?: LngLatLike; - } - - /** - * FlyToOptions - */ - export interface FlyToOptions extends AnimationOptions, CameraOptions { - curve?: number; - minZoom?: number; - speed?: number; - screenSpeed?: number; - easing?: Function; - } - - /** - * MapEvent - */ - export interface MapEvent { - resize?: void; - webglcontextlost?: {originalEvent: WebGLContextEvent}; - webglcontextrestored?: {originalEvent: WebGLContextEvent}; - remove?: void; - dataloading?: {data: mapboxgl.MapDataEvent}; - data?: {data: mapboxgl.MapDataEvent}; - render?: void; - contextmenu?: {data: mapboxgl.MapMouseEvent}; - dblclick?: {data: mapboxgl.MapMouseEvent}; - click?: {data: mapboxgl.MapMouseEvent}; - tiledataloading?: {data: mapboxgl.MapDataEvent}; - sourcedataloading?: {data: mapboxgl.MapDataEvent}; - styledataloading?: {data: mapboxgl.MapDataEvent}; - touchcancel?: {data: mapboxgl.MapTouchEvent}; - touchmove?: {data: mapboxgl.MapTouchEvent}; - touchend?: {data: mapboxgl.MapTouchEvent}; - touchstart?: {data: mapboxgl.MapTouchEvent}; - mousemove?: {data: mapboxgl.MapMouseEvent}; - mouseup?: {data: mapboxgl.MapMouseEvent}; - mousedown?: {data: mapboxgl.MapMouseEvent}; - moveend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - move?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - movestart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - mouseout?:{data: mapboxgl.MapMouseEvent}; - load?: void; - sourcedata?: {data: mapboxgl.MapDataEvent}; - styledata?: {data: mapboxgl.MapDataEvent}; - zoomend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - zoom?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - zoomstart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - boxzoomcancel?: {data: mapboxgl.MapBoxZoomEvent}; - boxzoomstart?: {data: mapboxgl.MapBoxZoomEvent}; - boxzoomend?: {data: mapboxgl.MapBoxZoomEvent}; - rotate?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - rotatestart?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - rotateend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - drag?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - dragend?: {data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent}; - pitch?: {data: mapboxgl.EventData}; - } - - export interface Layer { - id: string; - type?: "fill" | "line" | "symbol" | "circle" | "fill-extrusion" | "raster" | "background" | "heatmap"; - - metadata?: any; - ref?: string; - - source?: string | VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw; - - "source-layer"?: string; - - minzoom?: number; - maxzoom?: number; - - interactive?: boolean; - - filter?: any[]; - layout?: BackgroundLayout | FillLayout | FillExtrusionLayout | LineLayout | SymbolLayout | RasterLayout | CircleLayout; - paint?: BackgroundPaint | FillPaint | FillExtrusionPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint; - } - - export interface StyleFunction { - stops?: any[][]; - property?: string; - base?: number; - type?: "identity" | "exponential" | "interval" | "categorical"; - default?: any; - "colorSpace"?: "rgb" | "lab" | "interval"; - } - - export interface BackgroundLayout { - visibility?: "visible" | "none"; - } - export interface BackgroundPaint { - "background-color"?: string; - "background-pattern"?: string; - "background-opacity"?: number; - } - - export interface FillLayout { - visibility?: "visible" | "none"; - } - export interface FillPaint { - "fill-antialias"?: boolean; - "fill-opacity"?: number | StyleFunction; - "fill-color"?: string | StyleFunction; - "fill-outline-color"?: string | StyleFunction; - "fill-translate"?: number[]; - "fill-translate-anchor"?: "map" | "viewport"; - "fill-pattern"?: "string"; - } - - export interface FillExtrusionLayout { - visibility?: "visible" | "none"; - } - export interface FillExtrusionPaint { - "fill-extrusion-opacity"?: number; - "fill-extrusion-color"?: string | StyleFunction; - "fill-extrusion-translate"?: number[]; - "fill-extrusion-translate-anchor"?: "map" | "viewport"; - "fill-extrusion-pattern"?: string; - "fill-extrusion-height"?: number | StyleFunction; - "fill-extrusion-base"?: number | StyleFunction; - } - - export interface LineLayout { - visibility?: "visible" | "none"; - - "line-cap"?: "butt" | "round" | "square"; - "line-join"?: "bevel" | "round" | "miter"; - "line-miter-limit"?: number; - "line-round-limit"?: number; - } - export interface LinePaint { - "line-opacity"?: number | StyleFunction; - "line-color"?: string | StyleFunction; - "line-translate"?: number[]; - "line-translate-anchor"?: "map" | "viewport"; - "line-width"?: number | StyleFunction; - "line-gap-width"?: number | StyleFunction; - "line-offset"?: number | StyleFunction; - "line-blur"?: number | StyleFunction; - "line-dasharray"?: number[]; - "line-dasharray-transition"?: Transition; - "line-pattern"?: string; - } - - export interface SymbolLayout { - visibility?: "visible" | "none"; - - "symbol-placement"?: "point" | "line"; - "symbol-spacing"?: number; - "symbol-avoid-edges"?: boolean; - "icon-allow-overlap"?: boolean; - "icon-ignore-placement"?: boolean; - "icon-optional"?: boolean; - "icon-rotation-alignment"?: "map" | "viewport" | "auto"; - "icon-pitch-alignment"?: "map" | "viewport"| "auto"; - "icon-size"?: number | StyleFunction; - "icon-text-fit"?: "none" | "both" | "width" | "height"; - "icon-text-fit-padding"?: number[]; - "icon-image"?: string | StyleFunction; - "icon-rotate"?: number | StyleFunction; - "icon-padding"?: number; - "icon-keep-upright"?: boolean; - "icon-offset"?: number[] | StyleFunction; - "text-pitch-alignment"?: "map" | "viewport" | "auto"; - "text-rotation-alignment"?: "map" | "viewport" | "auto"; - "text-field"?: string | StyleFunction; - "text-font"?: string | string[]; - "text-size"?: number | StyleFunction; - "text-max-width"?: number; - "text-line-height"?: number; - "text-letter-spacing"?: number; - "text-justify"?: "left" | "center" | "right"; - "text-anchor"?: "center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right"; - "text-max-angle"?: number; - "text-rotate"?: number | StyleFunction; - "text-padding"?: number; - "text-keep-upright"?: boolean; - "text-transform"?: "none" | "uppercase" | "lowercase" | StyleFunction; - "text-offset"?: number[]; - "text-allow-overlap"?: boolean; - "text-ignore-placement"?: boolean; - "text-optional"?: boolean; - - } - export interface SymbolPaint { - "icon-opacity"?: number | StyleFunction; - "icon-color"?: string | StyleFunction; - "icon-halo-color"?: string | StyleFunction; - "icon-halo-width"?: number | StyleFunction; - "icon-halo-blur"?: number | StyleFunction; - "icon-translate"?: number[]; - "icon-translate-anchor"?: "map" | "viewport"; - "text-opacity"?: number | StyleFunction; - "text-color"?: string | StyleFunction; - "text-halo-color"?: string | StyleFunction; - "text-halo-width"?: number | StyleFunction; - "text-halo-blur"?: number | StyleFunction; - "text-translate"?: number[]; - "text-translate-anchor"?: "map" | "viewport"; - } - - export interface RasterLayout { - visibility?: "visible" | "none"; - } - - export interface RasterPaint { - "raster-opacity"?: number; - "raster-hue-rotate"?: number; - "raster-brightness-min"?: number; - "raster-brightness-max"?: number; - "raster-saturation"?: number; - "raster-contrast"?: number; - "raster-fade-duration"?: number; - } - - export interface CircleLayout { - visibility?: "visible" | "none"; - } - - export interface CirclePaint { - "circle-radius"?: number | StyleFunction; - "circle-radius-transition"?: Transition; - "circle-color"?: string | StyleFunction; - "circle-blur"?: number | StyleFunction; - "circle-opacity"?: number | StyleFunction; - "circle-translate"?: number[]; - "circle-translate-anchor"?: "map" | "viewport"; - "circle-pitch-scale"?: "map" | "viewport"; - "circle-pitch-alignment"?: "map" | "viewport"; - "circle-stroke-width"?: number | StyleFunction; - "circle-stroke-color"?: string | StyleFunction; - "circle-stroke-opacity"?: number | StyleFunction; - } + /** + * Evented + */ + export class Evented { + on(type: string, listener: Function): this; + + on(type: string, layer: string, listener: Function): this; + + off(type?: string | any, listener?: Function): this; + + off(type?: string | any, layer?: string, listener?: Function): this; + + once(type: string, listener: Function): this; + + fire(type: string, data?: mapboxgl.EventData | Object): this; + + listens(type: string): boolean; + } + + /** + * StyleOptions + */ + export interface StyleOptions { + transition?: boolean; + } + + /** + * EventData + */ + export class EventData { + type: string; + target: Map; + originalEvent: Event; + point: mapboxgl.Point; + lngLat: mapboxgl.LngLat; + } + + export class MapMouseEvent { + type: string; + target: Map; + originalEvent: MouseEvent; + point: mapboxgl.Point; + lngLat: mapboxgl.LngLat; + } + + export class MapTouchEvent { + type: string; + target: Map; + originalEvent: TouchEvent; + point: mapboxgl.Point; + lngLat: mapboxgl.LngLat; + points: Point[]; + lngLats: LngLat[]; + } + + export class MapBoxZoomEvent { + originalEvent: MouseEvent; + boxZoomBounds: LngLatBounds; + } + + export class MapDataEvent { + type: string; + dataType: 'source' | 'style' | 'tile'; + isSourceLoaded?: boolean; + source?: mapboxgl.Source; + coord?: any; + } + + /** + * AnimationOptions + */ + export interface AnimationOptions { + /** Number in milliseconds */ + duration?: number; + easing?: Function; + /** point, origin of movement relative to map center */ + offset?: PointLike; + /** When set to false, no animation happens */ + animate?: boolean; + } + + /** + * CameraOptions + */ + export interface CameraOptions { + /** Map center */ + center?: LngLatLike; + /** Map zoom level */ + zoom?: number; + /** Map rotation bearing in degrees counter-clockwise from north */ + bearing?: number; + /** Map angle in degrees at which the camera is looking at the ground */ + pitch?: number; + /** If zooming, the zoom center (defaults to map center) */ + around?: LngLatLike; + } + + /** + * FlyToOptions + */ + export interface FlyToOptions extends AnimationOptions, CameraOptions { + curve?: number; + minZoom?: number; + speed?: number; + screenSpeed?: number; + easing?: Function; + } + + /** + * MapEvent + */ + export interface MapEvent { + resize?: void; + webglcontextlost?: { originalEvent: WebGLContextEvent }; + webglcontextrestored?: { originalEvent: WebGLContextEvent }; + remove?: void; + dataloading?: { data: mapboxgl.MapDataEvent }; + data?: { data: mapboxgl.MapDataEvent }; + render?: void; + contextmenu?: { data: mapboxgl.MapMouseEvent }; + dblclick?: { data: mapboxgl.MapMouseEvent }; + click?: { data: mapboxgl.MapMouseEvent }; + tiledataloading?: { data: mapboxgl.MapDataEvent }; + sourcedataloading?: { data: mapboxgl.MapDataEvent }; + styledataloading?: { data: mapboxgl.MapDataEvent }; + touchcancel?: { data: mapboxgl.MapTouchEvent }; + touchmove?: { data: mapboxgl.MapTouchEvent }; + touchend?: { data: mapboxgl.MapTouchEvent }; + touchstart?: { data: mapboxgl.MapTouchEvent }; + mousemove?: { data: mapboxgl.MapMouseEvent }; + mouseup?: { data: mapboxgl.MapMouseEvent }; + mousedown?: { data: mapboxgl.MapMouseEvent }; + moveend?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + move?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + movestart?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + mouseout?: { data: mapboxgl.MapMouseEvent }; + load?: void; + sourcedata?: { data: mapboxgl.MapDataEvent }; + styledata?: { data: mapboxgl.MapDataEvent }; + zoomend?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + zoom?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + zoomstart?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + boxzoomcancel?: { data: mapboxgl.MapBoxZoomEvent }; + boxzoomstart?: { data: mapboxgl.MapBoxZoomEvent }; + boxzoomend?: { data: mapboxgl.MapBoxZoomEvent }; + rotate?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + rotatestart?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + rotateend?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + drag?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + dragend?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; + pitch?: { data: mapboxgl.EventData }; + } + + export interface Layer { + id: string; + type?: 'fill' | 'line' | 'symbol' | 'circle' | 'fill-extrusion' | 'raster' | 'background' | 'heatmap'; + + metadata?: any; + ref?: string; + + source?: string | VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw; + + 'source-layer'?: string; + + minzoom?: number; + maxzoom?: number; + + interactive?: boolean; + + filter?: any[]; + layout?: BackgroundLayout | FillLayout | FillExtrusionLayout | LineLayout | SymbolLayout | RasterLayout | CircleLayout | HeatmapLayout; + paint?: BackgroundPaint | FillPaint | FillExtrusionPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint | HeatmapPaint; + } + + export interface StyleFunction { + stops?: any[][]; + property?: string; + base?: number; + type?: 'identity' | 'exponential' | 'interval' | 'categorical'; + default?: any; + 'colorSpace'?: 'rgb' | 'lab' | 'interval'; + } + + export interface BackgroundLayout { + visibility?: 'visible' | 'none'; + } + + export interface BackgroundPaint { + 'background-color'?: string | Expression; + 'background-pattern'?: string; + 'background-opacity'?: number | Expression; + } + + export interface FillLayout { + visibility?: 'visible' | 'none'; + } + + export interface FillPaint { + 'fill-antialias'?: boolean; + 'fill-opacity'?: number | StyleFunction | Expression; + 'fill-color'?: string | StyleFunction | Expression; + 'fill-outline-color'?: string | StyleFunction | Expression; + 'fill-translate'?: number[] | Expression; + 'fill-translate-anchor'?: 'map' | 'viewport'; + 'fill-pattern'?: string; + } + + export interface FillExtrusionLayout { + visibility?: 'visible' | 'none'; + } + + export interface FillExtrusionPaint { + 'fill-extrusion-opacity'?: number | Expression; + 'fill-extrusion-color'?: string | StyleFunction | Expression; + 'fill-extrusion-translate'?: number[] | Expression; + 'fill-extrusion-translate-anchor'?: 'map' | 'viewport'; + 'fill-extrusion-pattern'?: string; + 'fill-extrusion-height'?: number | StyleFunction | Expression; + 'fill-extrusion-base'?: number | StyleFunction | Expression; + } + + export interface LineLayout { + visibility?: 'visible' | 'none'; + + 'line-cap'?: 'butt' | 'round' | 'square'; + 'line-join'?: 'bevel' | 'round' | 'miter'; + 'line-miter-limit'?: number | Expression; + 'line-round-limit'?: number | Expression; + } + + export interface LinePaint { + 'line-opacity'?: number | StyleFunction | Expression; + 'line-color'?: string | StyleFunction | Expression; + 'line-translate'?: number[] | Expression; + 'line-translate-anchor'?: 'map' | 'viewport'; + 'line-width'?: number | StyleFunction | Expression; + 'line-gap-width'?: number | StyleFunction | Expression; + 'line-offset'?: number | StyleFunction | Expression; + 'line-blur'?: number | StyleFunction | Expression; + 'line-dasharray'?: number[]; + 'line-dasharray-transition'?: Transition; + 'line-pattern'?: string; + } + + export interface SymbolLayout { + visibility?: 'visible' | 'none'; + + 'symbol-placement'?: 'point' | 'line'; + 'symbol-spacing'?: number | Expression; + 'symbol-avoid-edges'?: boolean; + 'icon-allow-overlap'?: boolean; + 'icon-ignore-placement'?: boolean; + 'icon-optional'?: boolean; + 'icon-rotation-alignment'?: 'map' | 'viewport' | 'auto'; + 'icon-pitch-alignment'?: 'map' | 'viewport' | 'auto'; + 'icon-size'?: number | StyleFunction | Expression; + 'icon-text-fit'?: 'none' | 'both' | 'width' | 'height'; + 'icon-text-fit-padding'?: number[] | Expression; + 'icon-image'?: string | StyleFunction; + 'icon-rotate'?: number | StyleFunction | Expression; + 'icon-padding'?: number | Expression; + 'icon-keep-upright'?: boolean; + 'icon-offset'?: number[] | StyleFunction | Expression; + 'text-pitch-alignment'?: 'map' | 'viewport' | 'auto'; + 'text-rotation-alignment'?: 'map' | 'viewport' | 'auto'; + 'text-field'?: string | StyleFunction; + 'text-font'?: string | string[]; + 'text-size'?: number | StyleFunction | Expression; + 'text-max-width'?: number | Expression; + 'text-line-height'?: number | Expression; + 'text-letter-spacing'?: number | Expression; + 'text-justify'?: 'left' | 'center' | 'right'; + 'text-anchor'?: 'center' | 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + 'text-max-angle'?: number | Expression; + 'text-rotate'?: number | StyleFunction | Expression; + 'text-padding'?: number | Expression; + 'text-keep-upright'?: boolean; + 'text-transform'?: 'none' | 'uppercase' | 'lowercase' | StyleFunction | Expression; + 'text-offset'?: number[] | Expression; + 'text-allow-overlap'?: boolean; + 'text-ignore-placement'?: boolean; + 'text-optional'?: boolean; + + } + + export interface SymbolPaint { + 'icon-opacity'?: number | StyleFunction | Expression; + 'icon-color'?: string | StyleFunction | Expression; + 'icon-halo-color'?: string | StyleFunction | Expression; + 'icon-halo-width'?: number | StyleFunction | Expression; + 'icon-halo-blur'?: number | StyleFunction | Expression; + 'icon-translate'?: number[] | Expression; + 'icon-translate-anchor'?: 'map' | 'viewport'; + 'text-opacity'?: number | StyleFunction | Expression; + 'text-color'?: string | StyleFunction | Expression; + 'text-halo-color'?: string | StyleFunction | Expression; + 'text-halo-width'?: number | StyleFunction | Expression; + 'text-halo-blur'?: number | StyleFunction | Expression; + 'text-translate'?: number[] | Expression; + 'text-translate-anchor'?: 'map' | 'viewport'; + } + + export interface RasterLayout { + visibility?: 'visible' | 'none'; + } + + export interface RasterPaint { + 'raster-opacity'?: number | Expression; + 'raster-hue-rotate'?: number | Expression; + 'raster-brightness-min'?: number | Expression; + 'raster-brightness-max'?: number | Expression; + 'raster-saturation'?: number | Expression; + 'raster-contrast'?: number | Expression; + 'raster-fade-duration'?: number | Expression; + } + + export interface CircleLayout { + visibility?: 'visible' | 'none'; + } + + export interface CirclePaint { + 'circle-radius'?: number | StyleFunction | Expression; + 'circle-radius-transition'?: Transition; + 'circle-color'?: string | StyleFunction | Expression; + 'circle-blur'?: number | StyleFunction | Expression; + 'circle-opacity'?: number | StyleFunction | Expression; + 'circle-translate'?: number[] | Expression; + 'circle-translate-anchor'?: 'map' | 'viewport'; + 'circle-pitch-scale'?: 'map' | 'viewport'; + 'circle-pitch-alignment'?: 'map' | 'viewport'; + 'circle-stroke-width'?: number | StyleFunction | Expression; + 'circle-stroke-color'?: string | StyleFunction | Expression; + 'circle-stroke-opacity'?: number | StyleFunction | Expression; + } + + export interface HeatmapLayout { + visibility?: 'visible' | 'none'; + } + + export interface HeatmapPaint { + 'heatmap-radius'?: number | Expression; + 'heatmap-transition'?: Transition; + 'heatmap-weight'?: number | StyleFunction | Expression; + 'heatmap-intensity'?: number | Expression; + 'heatmap-color'?: string | Expression; + 'heatmap-color-transition'?: Transition; + 'heatmap-opacity'?: number | Expression; + 'heatmap-opacity-transition'?: Transition; + } } declare module 'mapbox-gl' { - export = mapboxgl; + export = mapboxgl; } declare module 'mapbox-gl/dist/mapbox-gl' { - export = mapboxgl; + export = mapboxgl; } From a045a2c505c0aa38042d04a3ddd086b56c1894c0 Mon Sep 17 00:00:00 2001 From: Peter Blazejewicz Date: Wed, 22 Nov 2017 22:31:33 +0100 Subject: [PATCH 082/269] Update contract for Auth0DecodedHash of auth0-js This commit updates contract for results of the WebAuth.parseHash call to v.8 of auth0-js. Here is a link to relevant vanilla JS implementation: https://git.io/vFNdC Thanks! --- types/auth0-js/index.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index 76a2c5f319..85e4401266 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/auth0/auth0.js // Definitions by: Adrian Chia // Matt Durrant +// Peter Blazejewicz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace auth0; @@ -525,14 +526,21 @@ export interface Auth0Error { statusText?: string; } +/** + * The contents of the authResult object returned by {@link WebAuth#parseHash } + * @export + * @interface Auth0DecodedHash + */ export interface Auth0DecodedHash { accessToken?: string; idToken?: string; idTokenPayload?: any; + appState?: any; refreshToken?: string; state?: string; expiresIn?: number; tokenType?: string; + scope?: string; } /** Represents the response from an API Token Delegation request. */ From a1642fcdfe696d402565ac09668cfa7fb24a6f0e Mon Sep 17 00:00:00 2001 From: Peter Blazejewicz Date: Wed, 22 Nov 2017 22:45:34 +0100 Subject: [PATCH 083/269] Bump auth0-js version covered by this definition file I have tested with 8.11.3 - hence the version bump Thanks! --- types/auth0-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index 85e4401266..02642f0934 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Auth0.js 8.10 +// Type definitions for Auth0.js 8.11.3 // Project: https://github.com/auth0/auth0.js // Definitions by: Adrian Chia // Matt Durrant From 83146bf4e5fc65acafde5617ff8490b421868c58 Mon Sep 17 00:00:00 2001 From: Yu-Hsin Lu Date: Thu, 23 Nov 2017 14:42:28 +0800 Subject: [PATCH 084/269] Modify data attribute of CheerioElement `data` attribute is a option field. --- types/cheerio/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index 7ea8360849..8250848374 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -263,7 +263,7 @@ interface CheerioElement { parent: CheerioElement; parentNode: CheerioElement; nodeValue: string; - data: string; + data?: string; } interface CheerioAPI extends CheerioSelector, CheerioStatic { From 860ffb8e9c585e3c9e2f2f2ea0f3bd5b56511c8a Mon Sep 17 00:00:00 2001 From: rbot <30998401+rk-7@users.noreply.github.com> Date: Thu, 23 Nov 2017 12:19:54 +0530 Subject: [PATCH 085/269] Clubbed into one file. Added support for Alexa SDK for Node.js version 1.0.21 --- types/alexa-sdk/alexa-sdk-tests.ts | 20 - types/alexa-sdk/index.d.ts | 974 +++++++++++++++++++++++++- types/alexa-sdk/responseBuilder.d.ts | 170 ----- types/alexa-sdk/services.d.ts | 199 ------ types/alexa-sdk/templateBuilders.d.ts | 232 ------ types/alexa-sdk/tsconfig.json | 5 - types/alexa-sdk/types.d.ts | 208 ------ types/alexa-sdk/utils.d.ts | 96 --- 8 files changed, 952 insertions(+), 952 deletions(-) delete mode 100644 types/alexa-sdk/alexa-sdk-tests.ts delete mode 100644 types/alexa-sdk/responseBuilder.d.ts delete mode 100644 types/alexa-sdk/services.d.ts delete mode 100644 types/alexa-sdk/templateBuilders.d.ts delete mode 100644 types/alexa-sdk/types.d.ts delete mode 100644 types/alexa-sdk/utils.d.ts diff --git a/types/alexa-sdk/alexa-sdk-tests.ts b/types/alexa-sdk/alexa-sdk-tests.ts deleted file mode 100644 index c77bc93091..0000000000 --- a/types/alexa-sdk/alexa-sdk-tests.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as Alexa from "alexa-sdk"; - -const handler = (event: Alexa.RequestBody, context: Alexa.Context, callback: () => void) => { - const alexa = Alexa.handler(event, context); - alexa.resources = {}; - alexa.registerHandlers(handlers); - alexa.execute(); -}; - -const handlers: Alexa.Handlers = { - 'LaunchRequest': function() { - this.emit('SayHello'); - }, - 'HelloWorldIntent': function() { - this.emit('SayHello'); - }, - 'SayHello': function() { - this.emit(':tell', 'Hello World!'); - } -}; diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index bf64ff08df..744523b2ac 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,18 +1,870 @@ - -import { utils } from './utils'; -import { AlexaObject, Image, TextField, TextContent, RequestBody, Context } from './types'; -// Type definitions for Alexa SDK for Node.js 1.0 +// Type definitions for Alexa SDK for Node.js 1.0.21 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs // Definitions by: Pete Beegle // Huw // pascalwhoop // Ben +// rk-7 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - +// TypeScript Version: 2.7 +import { i18n } from "i18next"; export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; +export let StateString: string; +//#region Types +export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; +export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; + +export interface CardImage { + smallImageUrl: string; + largeImageUrl: string; +} +export interface Image { + smallImageUrl: string; + largeImageUrl: string; + contentDescription: string; + sources: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>; +} +export type TextField = { + text: string, + type: string +}; +export type TextContent = { + primaryText: TextField, + secondaryText: TextField, + tertiaryText: TextField, +} +export type ListItem = { image: Image; token: string; textContent: TextContent; }; +export type Template = { + title: string; + token: string; + backgroundImage: Image; + backButton: string; + type: string; + image: Image; + listItems: ListItem[]; +}; + +export interface AlexaObject extends Handler { + _event: any; + _context: any; + _callback: any; + state: any; + appId: any; + response: any; + resources: any; + dynamoDBTableName: any; + saveBeforeResponse: boolean; + registerHandlers: (...handlers: Array>) => any; + execute: () => void; +} + +export interface Handlers { + [intent: string]: (this: Handler) => void; +} + +export interface Handler { + on: any; + emit(event: string, ...args: any[]): boolean; + emitWithState: any; + state: any; + handler: any; + i18n: i18n, + locale: any, + event: RequestBody; + attributes: any; + context: any; + callback: Function; + name: any; + isOverriden: any; + t: (token: string, ...args: any[]) => void; + response: ResponseBuilder; +} +export enum PLAYER_ACTIVITY { + IDLE = 'IDLE', + PAUSED = 'PAUSED', + PLAYING = 'PLAYING', + BUFFER_UNDERRUN = 'BUFFER_UNDERRUN', + FINISHED = 'FINISHED', + STOPPED = 'STOPPED' +} +export interface Context { + System: System + AudioPlayer: AudioPlayer +} +export interface Application { + applicationId: string; + [key: string]: string; +} +export interface System { + apiAccessToken: string; + apiEndpoint: string; + application: Application; + device: any; + user: any; +} +export interface AudioPlayer { + token: string; + offsetInMilliseconds: number; + playerActivity: PLAYER_ACTIVITY; +} +export interface RequestBody { + version: string; + session: Session; + request: T; +} + +export interface Session { + new: boolean; + sessionId: string; + attributes: { [key: string]: any }; + application: Application; + user: SessionUser; +} + +export interface SessionUser { + userId: string; + accessToken?: string; + /** + * @deprecated + */ + permissions: Permissions; +} +export interface Permissions { + consentToken: string; + [key: string]: string; +} +export interface LaunchRequest extends Request { } + +export interface IntentRequest extends Request { + dialogState?: DialogStates; + intent?: Intent; +} + +export interface SessionEndedRequest extends Request { + reason?: string; +} + +export interface Request { + type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest"; + requestId: string; + timestamp: string; + locale?: string; +} + +export interface ResolutionStatus { + code: string; +} + +export interface ResolutionValue { + name: string; + id: string; +} + +export interface ResolutionValueContainer { + value: ResolutionValue; +} + +export interface Resolution { + authority: string; + status: ResolutionStatus; + values: ResolutionValueContainer[]; +} + +export interface Resolutions { + resolutionsPerAuthority: Resolution[]; +} + +export interface SlotValue { + confirmationStatus?: ConfirmationStatuses; + name: string; + value?: any; + resolutions?: Resolutions; +} + +export interface Intent { + confirmationStatus?: ConfirmationStatuses; + name: string; + slots: Record; +} + +export interface ResponseBody { + version: string; + sessionAttributes?: any; + response: Response; +} + +export interface Response { + outputSpeech?: OutputSpeech; + card?: Card; + reprompt?: Reprompt; + directives?: any; + shouldEndSession?: boolean; +} + +export interface OutputSpeech { + type: "PlainText" | "SSML"; + text?: string; + ssml?: string; +} + +export interface Card { + type: "Simple" | "Standard" | "LinkAccount"; + title?: string; + content?: string; + text?: string; + image?: Image; +} + +export interface Reprompt { + outputSpeech: OutputSpeech; +} +export declare const CARD_TYPES: { + STANDARD: 'Standard', + SIMPLE: 'Simple', + LINK_ACCOUNT: 'LinkAccount', + ASK_FOR_PERMISSIONS_CONSENT: 'AskForPermissionsConsent' +}; + +export declare const HINT_TYPES: { + PLAIN_TEXT: 'PlainText' +}; + +export declare const DIRECTIVE_TYPES: { + AUDIOPLAYER: { + PLAY: 'AudioPlayer.Play', + STOP: 'AudioPlayer.Stop', + CLEAR_QUEUE: 'AudioPlayer.ClearQueue' + }, + DISPLAY: { + RENDER_TEMPLATE: 'Display.RenderTemplate' + }, + HINT: 'Hint', + VIDEOAPP: { + LAUNCH: 'VideoApp.Launch' + } +}; +export interface ApiClientOptions { + hostname: string; + port: string; + path: string; + protocol: string; + headers: string; + method: string; +} +export interface ApiClientResponse { + statusCode: string; + statusText: string; + body: Object; + headers: Object +} +export interface ListItemObject { + value: string, + status: string, + version: any +} +export interface ListObject { + name: string, + status: string, + version: any +} +//#endregion +//#region templateBuilders + +export namespace templateBuilders { + export interface SetTextContent> { + setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T; + } + export interface SetListItems> { + setListItems(listItems: ListItem[]): T; + } + export abstract class TemplateBuilder> { + public template: Template; + constructor(); + + /** + * Sets the title of the template + * + * @param {string} title + * @returns + * @memberof TemplateBuilder + */ + public setTitle(title: string): T; + + /** + * Sets the token of the template + * + * @param {string} token + * @returns + * @memberof TemplateBuilder + */ + public setToken(token: string): T; + + /** + * Sets the background image of the template + * + * @param {Image} image + * @returns + * @memberof TemplateBuilder + */ + public setBackgroundImage(image: Image): T; + + /** + * Sets the backButton behavior + * + * @param {string} backButtonBehavior 'VISIBLE' or 'HIDDEN' + * @returns + * @memberof TemplateBuilder + */ + public setBackButtonBehavior(backButtonBehavior: string): T; + + /** + * Builds the template JSON object + * + * @returns + * @memberof TemplateBuilder + */ + public build(): Template; + // /** + // * Sets the text content for the template + // * + // * @param {TextField} primaryText + // * @param {TextField} secondaryText + // * @param {TextField} tertiaryText + // * @returns TemplateBuilder + // * @memberof TemplateBuilder + // */ + // public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T; + } + /** + * Used to build a list of ListItems for ListTemplate + * + * @class ListItemBuilder + */ + export class ListItemBuilder { + constructor(); + public items: ListItem[]; + /** + * Add an item to the list of template + * + * @param {Image} image + * @param {string} token + * @param {TextField} primaryText + * @param {TextField} secondaryText + * @param {TextField} tertiaryText + * @memberof ListItemBuilder + */ + public addItem(image: Image, token: string, primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): ListItemBuilder; + + public build(): ListItem[]; + } + /** + * Used to create BodyTemplate1 objects + * + * @class BodyTemplate1Builder + * @extends {TemplateBuilder} + */ + export class BodyTemplate1Builder extends TemplateBuilder implements SetTextContent{ + constructor(); + /** + * Sets the text content for the template + * + * @param {TextField} primaryText + * @param {TextField} secondaryText + * @param {TextField} tertiaryText + * @returns BodyTemplate1Builder + * @memberof BodyTemplate1Builder + */ + public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate1Builder; + } + /** + * Used to create BodyTemplate2 objects + * + * @class BodyTemplate2Builder + * @extends {TemplateBuilder} + */ + export class BodyTemplate2Builder extends TemplateBuilder implements SetTextContent { + constructor(); + + /** + * Sets the image for the template + * + * @param {Image} image + * @returns + * @memberof BodyTemplate2Builder + */ + public setImage(image: Image): BodyTemplate2Builder + + /** + * Sets the text content for the template + * + * @param {TextField} primaryText + * @param {TextField} secondaryText + * @param {TextField} tertiaryText + * @returns BodyTemplate2Builder + * @memberof BodyTemplate2Builder + */ + public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate2Builder; + } + /** + * Used to create BodyTemplate3 objects + * + * @class BodyTemplate3Builder + * @extends {TemplateBuilder} + */ + export class BodyTemplate3Builder extends TemplateBuilder implements SetTextContent { + constructor(); + + /** + * Sets the image for the template + * + * @param {any} image + * @returns + * @memberof BodyTemplate3Builder + */ + public setImage(image: any): BodyTemplate3Builder; + + /** + * Sets the text content for the template + * + * @param {TextField} primaryText + * @param {TextField} secondaryText + * @param {TextField} tertiaryText + * @returns BodyTemplate3Builder + * @memberof BodyTemplate3Builder + */ + public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate3Builder; + } + /** + * Used to create BodyTemplate6 objects + * + * @class BodyTemplate6Builder + * @extends {TemplateBuilder} + */ + export class BodyTemplate6Builder extends TemplateBuilder implements SetTextContent { + constructor(); + + /** + * Sets the image for the template + * + * @param {any} image + * @returns + * @memberof BodyTemplate6Builder + */ + public setImage(image: any): BodyTemplate6Builder; + + /** + * Sets the text content for the template + * + * @param {TextField} primaryText + * @param {TextField} secondaryText + * @param {TextField} tertiaryText + * @returns BodyTemplate6Builder + * @memberof BodyTemplate6Builder + */ + public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate6Builder; + } + /** + * Used to create BodyTemplate7 objects + * + * @class BodyTemplate7Builder + * @extends {TemplateBuilder} + */ + export class BodyTemplate7Builder extends TemplateBuilder { + constructor(); + + /** + * Sets the image for the template + * + * @param {Image} image + * @returns + * @memberof BodyTemplate7Builder + */ + setImage(image: Image): BodyTemplate7Builder + } + /** + * Used to create ListTemplate1 objects + * + * @class ListTemplate1Builder + * @extends {TemplateBuilder} + */ + export class ListTemplate1Builder extends TemplateBuilder implements SetListItems { + constructor(); + + /** + * Set the items for the list + * + * @param {any} listItems + * @returns + * @memberof ListTemplate1Builder + */ + setListItems(listItems: ListItem[]): ListTemplate1Builder; + } + /** + * Used to create ListTemplate2 objects + * + * @class ListTemplate2Builder + * @extends {TemplateBuilder} + */ + export class ListTemplate2Builder extends TemplateBuilder implements SetListItems { + constructor(); + + /** + * Set the items for the list + * + * @param {any} listItems + * @returns + * @memberof ListTemplate2Builder + */ + setListItems(listItems: ListItem[]): ListTemplate2Builder; + } + +} +//#endregion +//#region services +export namespace services { + export interface ApiClient { + /** + * Make a POST API call to the specified uri with headers and optional body + * @param {string} uri http(s?) endpoint to call + * @param {Object} headers Key value pair of headers + * @param {string} body post body to send + * @returns {Promise} + * @memberof ApiClient + */ + post(uri: string, headers: Object, body?: string): Promise; + /** + * Make a PUT API call to the specified uri with headers and optional body + * @param {string} uri http(s?) endpoint to call + * @param {Object} headers Key value pair of headers + * @param {string} body post body to send + * @returns {Promise} + * @memberof ApiClient + */ + put(uri: string, headers: Object, body?: string): Promise; + /** + * Make a GET API call to the specified uri with headers + * @param {string} uri http(s?) endpoint to call + * @param {Object} headers key value pair of headers + * @returns {Promise} + * @memberof ApiClient + */ + get(uri: string, headers: Object): Promise; + /** + * Make a DELETE API call to the specified uri with headers + * @param {string} uri http(s?) endpoint to call + * @param {Object} headers key value pair of headers + * @returns {Promise} + */ + delete(uri: string, headers: Object): Promise; + } + export class DeviceAddressService { + /** + * Create an instance of DeviceAddressService + * @param {ApiClient} [apiClient=new ApiClient()] ApiClient + * @memberOf DeviceAddressService + */ + constructor(apiClient: ApiClient); + + /** + * Get full address information from Alexa Device Address API + * @param {string} deviceId deviceId from Alexa request + * @param {string} apiEndpoint API apiEndpoint from Alexa request + * @param {string} token bearer token for device address permission + * @returns {Promise} + * @memberOf DeviceAddressService + */ + getFullAddress(deviceId: string, apiEndpoint: string, token: string): Promise; + + /** + * Get country and postal information from Alexa Device Address API + * @param {string} deviceId deviceId from Alexa request + * @param {string} apiEndpoint API apiEndpoint from Alexa request + * @param {string} token bearer token for device address permission + * @returns {Promise} + * @memberOf DeviceAddressService + */ + getCountryAndPostalCode(deviceId: string, apiEndpoint: string, token: string): Promise; + } + export class DirectiveService { + + /** + * Creates an instance of DirectiveService. + * @param {ApiClient} [apiClient=new ApiClient()] ApiClient + * @memberof DirectiveService + */ + constructor(apiClient: ApiClient); + + /** + * Send the specified directiveObj to Alexa directive service + * + * @param {Object} directive directive to send to service + * @param {string} apiEndpoint API endpoint from Alexa request + * @param {string} token bearer token for directive service + * @returns {Promise} + * @memberof DirectiveService + */ + enqueue(directive: Object, apiEndpoint: string, token: string): Promise; + } + export class ListManagementService { + + /** + * Create an instance of ListManagementService + * @param apiClient + */ + constructor(apiClient: ApiClient); + + /** + * Set apiEndpoint address, default is 'https://api.amazonalexa.com' + * @param apiEndpoint + * @returns void + * @memberOf ListManagementService + */ + setApiEndpoint(apiEndpoint: string): void; + + /** + * Get currently set apiEndpoint address + * @returns {string} + * @memberOf ListManagementService + */ + getApiEndpoint(): string; + + /** + * Retrieve the metadata for all customer lists, including the customer's default lists + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + getListsMetadata(token: string): Promise; + + /** + * Create a custom list. The new list name must be different than any existing list name + * @param {ListObject} listObject + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + createList(listObject: ListObject, token: string): Promise + + /** + * Retrieve list metadata including the items in the list with requested status + * @param {string} listId unique Id associated with the list + * @param {string} itemStatus itemsStatus can be either 'active' or 'completed' + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + getList(listId: string, itemStatus: string, token: string): Promise; + + /** + * Update a custom list. Only the list name or state can be updated + * @param {string} listId unique Id associated with the list + * @param {ListObject} listObject + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + updateList(listId: string, listObject: ListObject, token: string): Promise; + + /** + * Delete a custom list + * @param {string} listId unique Id associated with the list + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + deleteList(listId: string, token: string): Promise; + + /** + * Create an item in an active list or in a default list + * @param {string} listId unique Id associated with the list + * @param {ListItemObject} listItemObject + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + createListItem(listId: string, listItemObject: ListItemObject, token: string): Promise; + + /** + * Retrieve single item within any list by listId and itemId + * @param {string} listId unique Id associated with the list + * @param {string} itemId unique Id associated with the item + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + getListItem(listId: string, itemId: string, token: string): Promise; + + /** + * Update an item value or item status + * @param {string} listId unique Id associated with the list + * @param {string} itemId unique Id associated with the item + * @param {ListItemObject} listItemObject + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + updateListItem(listId: string, itemId: string, listItemObject: ListItemObject, token: string): Promise; + + /** + * Delete an item in the specified list + * @param {string} listId unique Id associated with the list + * @param {string} itemId unique Id associated with the item + * @param {string} token bearer token for list management permission + * @returns {Promise} + * @memberOf ListManagementService + */ + deleteListItem(listId: string, itemId: string, token: string): Promise; + } +} +//#endregion +//#region ResponseBuilder +/** + * Responsible for building JSON responses as per the Alexa skills kit interface + * https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference#response-body-syntax + * + * @class ResponseBuilder + */ +export class ResponseBuilder { + constructor(alexaHandler: Handler); + + /** + * Have Alexa say the provided speechOutput to the user + * + * @param {string} speechOutput + * @returns + * @memberof ResponseBuilder + */ + speak(speechOutput: string): ResponseBuilder; + + /** + * Have alexa listen for speech from the user. If the user doesn't respond within 8 seconds + * then have alexa reprompt with the provided reprompt speech + * @param {string} repromptSpeech + * @returns + * @memberof ResponseBuilder + */ + listen(repromptSpeech: string): ResponseBuilder; + + /** + * Render a card with the following title, content and image + * + * @param {string} cardTitle + * @param {string} cardContent + * @param {{smallImageUrl : string, largeImageUrl : string}} cardImage + * @returns + * @memberof ResponseBuilder + */ + cardRenderer(cardTitle: string, cardContent: string, cardImage: CardImage): ResponseBuilder; + + /** + * Render a link account card + * + * @returns + * @memberof ResponseBuilder + */ + linkAccountCard(): ResponseBuilder; + + /** + * Render a askForPermissionsConsent card + * @param {[{ [key: string]: string }]} permissions + * @returns + * @memberOf ResponseBuilder + */ + askForPermissionsConsentCard(permissions: [{ [key: string]: string }]): ResponseBuilder; + + /** + * Creates a play, stop or clearQueue audioPlayer directive depending on the directive type passed in. + * @deprecated - use audioPlayerPlay, audioPlayerStop, audioPlayerClearQueue instead + * @param {string} directiveType + * @param {string} behavior + * @param {string} url + * @param {string} token + * @param {string} expectedPreviousToken + * @param {number} offsetInMilliseconds + * @returns + * @memberof ResponseBuilder + */ + audioPlayer(directiveType: string, behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder; + + /** + * Creates an AudioPlayer play directive + * + * @param {string} behavior Describes playback behavior. Accepted values: + * REPLACE_ALL: Immediately begin playback of the specified stream, and replace current and enqueued streams. + * ENQUEUE: Add the specified stream to the end of the current queue. This does not impact the currently playing stream. + * REPLACE_ENQUEUED: Replace all streams in the queue. This does not impact the currently playing stream. + * @param {string} url Identifies the location of audio content at a remote HTTPS location. + * The audio file must be hosted at an Internet-accessible HTTPS endpoint. HTTPS is required, and the domain hosting the + * files must present a valid, trusted SSL certificate. Self-signed certificates cannot be used. + * The supported formats for the audio file include AAC/MP4, MP3, HLS, PLS and M3U. Bitrates: 16kbps to 384 kbps. + * @param {string} token A token that represents the audio stream. This token cannot exceed 1024 characters + * @param {string} expectedPreviousToken A token that represents the expected previous stream. + * This property is required and allowed only when the playBehavior is ENQUEUE. This is used to prevent potential race conditions + * if requests to progress through a playlist and change tracks occur at the same time. + * @param {number} offsetInMilliseconds The timestamp in the stream from which Alexa should begin playback. + * Set to 0 to start playing the stream from the beginning. Set to any other value to start playback from that associated point in the stream + * @returns + * @memberof ResponseBuilder + */ + audioPlayerPlay(behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder; + + /** + * Creates an AudioPlayer Stop directive - Stops the current audio Playback + * + * @returns + * @memberof ResponseBuilder + */ + audioPlayerStop(): ResponseBuilder; + + /** + * Creates an AudioPlayer ClearQueue directive - clear the queue without stopping the currently playing stream, + * or clear the queue and stop any currently playing stream. + * + * @param {string} clearBehavior Describes the clear queue behavior. Accepted values: + * CLEAR_ENQUEUED: clears the queue and continues to play the currently playing stream + * CLEAR_ALL: clears the entire playback queue and stops the currently playing stream (if applicable). + * @returns + * @memberof ResponseBuilder + */ + audioPlayerClearQueue(clearBehavior: string): ResponseBuilder; + + /** + * Creates a Display RenderTemplate Directive + * + * Use a template builder to generate a template object + * + * @param {Template} template + * @returns + * @memberof ResponseBuilder + */ + renderTemplate(template: Template): ResponseBuilder; + + /** + * Creates a hint directive - show a hint on the screen of the echo show + * + * @param {string} hintText text to show on the hint + * @param {string} hintType (optional) Default value : PlainText + * @returns + * @memberof ResponseBuilder + */ + hint(hintText: string, hintType: string): ResponseBuilder; + + /** + * Creates a VideoApp play directive to play a video + * + * @param {string} source Identifies the location of video content at a remote HTTPS location. + * The video file must be hosted at an Internet-accessible HTTPS endpoint. + * @param {{title : string, subtitle : string}} metadata (optional) Contains an object that provides the + * information that can be displayed on VideoApp. + * @returns + * @memberof ResponseBuilder + */ + playVideo(source: string, metadata: { title: string, subtitle: string }): ResponseBuilder; +} +//#endregion +//#region directives export namespace directives { export class VoicePlayerSpeakDirective { /** @@ -24,22 +876,100 @@ export namespace directives { constructor(requestId: string, speechContent: string); } } -//#region exports from other modules -export { templateBuilders } from "./templateBuilders"; +//#endregion +//#region utils +export namespace utils { + export class ImageUtils { + /** + * Creates an image object with a single source + * + * These images may be in either JPEG or PNG formats, with the appropriate file extensions. + * An image cannot be larger than 2 MB + * You must host the images at HTTPS URLs that are publicly accessible. + * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. + * + * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, + * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, + * which means that larger images will be downscaled for display on Echo Show if provided. + * + * example : ImageUtils.makeImage('https://url/to/my/img.png', 300, 400, 'SMALL', 'image description') + * + * @static + * @param {string} url url of the image + * @param {number} widthPixels (optional) width of the image in pixels + * @param {number} heightPixels (optional) height of the image in pixels + * @param {string} size size of the image (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE) + * @param {string} description text used to describe the image in a screen reader + * @returns + * @memberof ImageUtils + */ + public static makeImage(url: string, widthPixels?: number, heightPixels?: number, size?: string, description?: string): Image; + /** + * + * Creates an image object with a multiple sources, source images are provided as an array of image objects + * + * These images may be in either JPEG or PNG formats, with the appropriate file extensions. + * An image cannot be larger than 2 MB + * You must host the images at HTTPS URLs that are publicly accessible. + * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. + * + * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, + * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, + * which means that larger images will be downscaled for display on Echo Show if provided. + * example : + * let imgArr = [ + * { 'https://url/to/my/small.png', 300, 400, 'SMALL' }, + * { 'https://url/to/my/large.png', 900, 1200, 'LARGE' }, + * ] + * ImageUtils.makeImage(imgArr, 'image description') + * + * @static + * @param {{url : string, widthPixels : number, heightPixels : number, size : string}[]} imgArr + * @param {string} description text used to describe the image in a screen reader + * @returns + * @memberof ImageUtils + */ + public static makeImages(imgArr: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>, description: string): Image; + } + /** + * Utility methods for building TextField objects + * + * @class TextUtils + */ + export class TextUtils { -export { services } from "./services"; + /** + * Creates a plain TextField object with contents : text + * + * @static + * @param {string} text contents of plain text object + * @returns + * @memberof TextUtils + */ + public static makePlainText(text: string): TextField; -export { - AlexaObject, Image, CardImage, TextField, - TextContent, RequestBody, Context, Handler, IntentRequest, - ListItem, Template, Handlers, Session, SessionApplication, - SessionUser, LaunchRequest, SessionEndedRequest, - Request, ResolutionStatus, ResolutionValue, - ResolutionValueContainer, Resolutions, SlotValue, - Intent, ResponseBody, Response, OutputSpeech, - Card, Reprompt, ConfirmationStatuses, DialogStates, - StateString + /** + * Creates a rich TextField object with contents : text + * + * @static + * @param {string} text + * @returns + * @memberof TextUtils + */ + public static makeRichText(text: string): TextField; -} from './types'; -export { utils } from './utils'; -//#endregion \ No newline at end of file + /** + * Creates a textContent + * + * @static + * @param {{type : string, text : string}} primaryText + * @param {{type : string, text : string}} secondaryText + * @param {{type : string, text : string}} tertiaryText + * @returns + * @memberof TextUtils + */ + public static makeTextContent(primaryText: { type: string, text: string }, + secondaryText: { type: string, text: string }, tertiaryText: { type: string, text: string }): TextContent + } +} +//#endregion diff --git a/types/alexa-sdk/responseBuilder.d.ts b/types/alexa-sdk/responseBuilder.d.ts deleted file mode 100644 index 83d32cf4f0..0000000000 --- a/types/alexa-sdk/responseBuilder.d.ts +++ /dev/null @@ -1,170 +0,0 @@ -import { Handler, Request, Template, Image, CardImage } from './types'; -export declare const CARD_TYPES: { - STANDARD: 'Standard', - SIMPLE: 'Simple', - LINK_ACCOUNT: 'LinkAccount', - ASK_FOR_PERMISSIONS_CONSENT: 'AskForPermissionsConsent' -}; - -export declare const HINT_TYPES: { - PLAIN_TEXT: 'PlainText' -}; - -export declare const DIRECTIVE_TYPES: { - AUDIOPLAYER: { - PLAY: 'AudioPlayer.Play', - STOP: 'AudioPlayer.Stop', - CLEAR_QUEUE: 'AudioPlayer.ClearQueue' - }, - DISPLAY: { - RENDER_TEMPLATE: 'Display.RenderTemplate' - }, - HINT: 'Hint', - VIDEOAPP: { - LAUNCH: 'VideoApp.Launch' - } -}; - -/** - * Responsible for building JSON responses as per the Alexa skills kit interface - * https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference#response-body-syntax - * - * @class ResponseBuilder - */ -export class ResponseBuilder { - constructor(alexaHandler: Handler); - - /** - * Have Alexa say the provided speechOutput to the user - * - * @param {string} speechOutput - * @returns - * @memberof ResponseBuilder - */ - speak(speechOutput: string): ResponseBuilder; - - /** - * Have alexa listen for speech from the user. If the user doesn't respond within 8 seconds - * then have alexa reprompt with the provided reprompt speech - * @param {string} repromptSpeech - * @returns - * @memberof ResponseBuilder - */ - listen(repromptSpeech: string): ResponseBuilder; - - /** - * Render a card with the following title, content and image - * - * @param {string} cardTitle - * @param {string} cardContent - * @param {{smallImageUrl : string, largeImageUrl : string}} cardImage - * @returns - * @memberof ResponseBuilder - */ - cardRenderer(cardTitle: string, cardContent: string, cardImage: CardImage): ResponseBuilder; - - /** - * Render a link account card - * - * @returns - * @memberof ResponseBuilder - */ - linkAccountCard(): ResponseBuilder; - - /** - * Render a askForPermissionsConsent card - * @param {[{ [key: string]: string }]} permissions - * @returns - * @memberOf ResponseBuilder - */ - askForPermissionsConsentCard(permissions: [{ [key: string]: string }]): ResponseBuilder; - - /** - * Creates a play, stop or clearQueue audioPlayer directive depending on the directive type passed in. - * @deprecated - use audioPlayerPlay, audioPlayerStop, audioPlayerClearQueue instead - * @param {string} directiveType - * @param {string} behavior - * @param {string} url - * @param {string} token - * @param {string} expectedPreviousToken - * @param {number} offsetInMilliseconds - * @returns - * @memberof ResponseBuilder - */ - audioPlayer(directiveType: string, behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder; - - /** - * Creates an AudioPlayer play directive - * - * @param {string} behavior Describes playback behavior. Accepted values: - * REPLACE_ALL: Immediately begin playback of the specified stream, and replace current and enqueued streams. - * ENQUEUE: Add the specified stream to the end of the current queue. This does not impact the currently playing stream. - * REPLACE_ENQUEUED: Replace all streams in the queue. This does not impact the currently playing stream. - * @param {string} url Identifies the location of audio content at a remote HTTPS location. - * The audio file must be hosted at an Internet-accessible HTTPS endpoint. HTTPS is required, and the domain hosting the - * files must present a valid, trusted SSL certificate. Self-signed certificates cannot be used. - * The supported formats for the audio file include AAC/MP4, MP3, HLS, PLS and M3U. Bitrates: 16kbps to 384 kbps. - * @param {string} token A token that represents the audio stream. This token cannot exceed 1024 characters - * @param {string} expectedPreviousToken A token that represents the expected previous stream. - * This property is required and allowed only when the playBehavior is ENQUEUE. This is used to prevent potential race conditions - * if requests to progress through a playlist and change tracks occur at the same time. - * @param {number} offsetInMilliseconds The timestamp in the stream from which Alexa should begin playback. - * Set to 0 to start playing the stream from the beginning. Set to any other value to start playback from that associated point in the stream - * @returns - * @memberof ResponseBuilder - */ - audioPlayerPlay(behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder; - - /** - * Creates an AudioPlayer Stop directive - Stops the current audio Playback - * - * @returns - * @memberof ResponseBuilder - */ - audioPlayerStop(): ResponseBuilder; - - /** - * Creates an AudioPlayer ClearQueue directive - clear the queue without stopping the currently playing stream, - * or clear the queue and stop any currently playing stream. - * - * @param {string} clearBehavior Describes the clear queue behavior. Accepted values: - * CLEAR_ENQUEUED: clears the queue and continues to play the currently playing stream - * CLEAR_ALL: clears the entire playback queue and stops the currently playing stream (if applicable). - * @returns - * @memberof ResponseBuilder - */ - audioPlayerClearQueue(clearBehavior: string): ResponseBuilder; - - /** - * Creates a Display RenderTemplate Directive - * - * Use a template builder to generate a template object - * - * @param {Template} template - * @returns - * @memberof ResponseBuilder - */ - renderTemplate(template: Template): ResponseBuilder; - - /** - * Creates a hint directive - show a hint on the screen of the echo show - * - * @param {string} hintText text to show on the hint - * @param {string} hintType (optional) Default value : PlainText - * @returns - * @memberof ResponseBuilder - */ - hint(hintText: string, hintType: string): ResponseBuilder; - - /** - * Creates a VideoApp play directive to play a video - * - * @param {string} source Identifies the location of video content at a remote HTTPS location. - * The video file must be hosted at an Internet-accessible HTTPS endpoint. - * @param {{title : string, subtitle : string}} metadata (optional) Contains an object that provides the - * information that can be displayed on VideoApp. - * @returns - * @memberof ResponseBuilder - */ - playVideo(source: string, metadata: { title: string, subtitle: string }): ResponseBuilder; -} \ No newline at end of file diff --git a/types/alexa-sdk/services.d.ts b/types/alexa-sdk/services.d.ts deleted file mode 100644 index 1498f17cbe..0000000000 --- a/types/alexa-sdk/services.d.ts +++ /dev/null @@ -1,199 +0,0 @@ -export namespace services { - export interface ApiClientOptions { hostname: string; port: string; path: string; protocol: string; headers: string; method: string } - export interface ApiClientResponse { statusCode: string; statusText: string; body: Object; headers: Object } - export interface ListItemObject { value: string, status: string, version: any } - export interface ListObject { name: string, status: string, version: any } - export interface ApiClient { - /** - * Make a POST API call to the specified uri with headers and optional body - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers Key value pair of headers - * @param {string} body post body to send - * @returns {Promise} - * @memberof ApiClient - */ - post(uri: string, headers: Object, body?: string): Promise; - /** - * Make a PUT API call to the specified uri with headers and optional body - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers Key value pair of headers - * @param {string} body post body to send - * @returns {Promise} - * @memberof ApiClient - */ - put(uri: string, headers: Object, body?: string): Promise; - /** - * Make a GET API call to the specified uri with headers - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers key value pair of headers - * @returns {Promise} - * @memberof ApiClient - */ - get(uri: string, headers: Object): Promise; - /** - * Make a DELETE API call to the specified uri with headers - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers key value pair of headers - * @returns {Promise} - */ - delete(uri: string, headers: Object): Promise; - } - export class DeviceAddressService { - /** - * Create an instance of DeviceAddressService - * @param {ApiClient} [apiClient=new ApiClient()] ApiClient - * @memberOf DeviceAddressService - */ - constructor(apiClient: ApiClient); - - /** - * Get full address information from Alexa Device Address API - * @param {string} deviceId deviceId from Alexa request - * @param {string} apiEndpoint API apiEndpoint from Alexa request - * @param {string} token bearer token for device address permission - * @returns {Promise} - * @memberOf DeviceAddressService - */ - getFullAddress(deviceId: string, apiEndpoint: string, token: string): Promise; - - /** - * Get country and postal information from Alexa Device Address API - * @param {string} deviceId deviceId from Alexa request - * @param {string} apiEndpoint API apiEndpoint from Alexa request - * @param {string} token bearer token for device address permission - * @returns {Promise} - * @memberOf DeviceAddressService - */ - getCountryAndPostalCode(deviceId: string, apiEndpoint: string, token: string): Promise; - } - export class DirectiveService { - - /** - * Creates an instance of DirectiveService. - * @param {ApiClient} [apiClient=new ApiClient()] ApiClient - * @memberof DirectiveService - */ - constructor(apiClient: ApiClient); - - /** - * Send the specified directiveObj to Alexa directive service - * - * @param {Object} directive directive to send to service - * @param {string} apiEndpoint API endpoint from Alexa request - * @param {string} token bearer token for directive service - * @returns {Promise} - * @memberof DirectiveService - */ - enqueue(directive: Object, apiEndpoint: string, token: string): Promise; - } - export class ListManagementService { - - /** - * Create an instance of ListManagementService - * @param apiClient - */ - constructor(apiClient: ApiClient); - - /** - * Set apiEndpoint address, default is 'https://api.amazonalexa.com' - * @param apiEndpoint - * @returns void - * @memberOf ListManagementService - */ - setApiEndpoint(apiEndpoint: string): void; - - /** - * Get currently set apiEndpoint address - * @returns {string} - * @memberOf ListManagementService - */ - getApiEndpoint(): string; - - /** - * Retrieve the metadata for all customer lists, including the customer's default lists - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService - */ - getListsMetadata(token: string): Promise; - - /** - * Create a custom list. The new list name must be different than any existing list name - * @param {ListObject} listObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService - */ - createList(listObject: ListObject, token: string): Promise - - /** - * Retrieve list metadata including the items in the list with requested status - * @param {string} listId unique Id associated with the list - * @param {string} itemStatus itemsStatus can be either 'active' or 'completed' - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService - */ - getList(listId: string, itemStatus: string, token: string): Promise; - - /** - * Update a custom list. Only the list name or state can be updated - * @param {string} listId unique Id associated with the list - * @param {ListObject} listObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService - */ - updateList(listId: string, listObject: ListObject, token: string): Promise; - - /** - * Delete a custom list - * @param {string} listId unique Id associated with the list - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService - */ - deleteList(listId: string, token: string): Promise; - - /** - * Create an item in an active list or in a default list - * @param {string} listId unique Id associated with the list - * @param {ListItemObject} listItemObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService - */ - createListItem(listId: string, listItemObject: ListItemObject, token: string): Promise; - - /** - * Retrieve single item within any list by listId and itemId - * @param {string} listId unique Id associated with the list - * @param {string} itemId unique Id associated with the item - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService - */ - getListItem(listId: string, itemId: string, token: string): Promise; - - /** - * Update an item value or item status - * @param {string} listId unique Id associated with the list - * @param {string} itemId unique Id associated with the item - * @param {ListItemObject} listItemObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService - */ - updateListItem(listId: string, itemId: string, listItemObject: ListItemObject, token: string): Promise; - - /** - * Delete an item in the specified list - * @param {string} listId unique Id associated with the list - * @param {string} itemId unique Id associated with the item - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService - */ - deleteListItem(listId: string, itemId: string, token: string): Promise; - } -} \ No newline at end of file diff --git a/types/alexa-sdk/templateBuilders.d.ts b/types/alexa-sdk/templateBuilders.d.ts deleted file mode 100644 index 03834ca54a..0000000000 --- a/types/alexa-sdk/templateBuilders.d.ts +++ /dev/null @@ -1,232 +0,0 @@ -import { Image, TextField, ListItem, Template } from './types'; -export namespace templateBuilders { - export interface SetTextContent> { - setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T; - } - export interface SetListItems> { - setListItems(listItems: ListItem[]): T; - } - export abstract class TemplateBuilder> { - public template: Template; - constructor(); - - /** - * Sets the title of the template - * - * @param {string} title - * @returns - * @memberof TemplateBuilder - */ - public setTitle(title: string): T; - - /** - * Sets the token of the template - * - * @param {string} token - * @returns - * @memberof TemplateBuilder - */ - public setToken(token: string): T; - - /** - * Sets the background image of the template - * - * @param {Image} image - * @returns - * @memberof TemplateBuilder - */ - public setBackgroundImage(image: Image): T; - - /** - * Sets the backButton behavior - * - * @param {string} backButtonBehavior 'VISIBLE' or 'HIDDEN' - * @returns - * @memberof TemplateBuilder - */ - public setBackButtonBehavior(backButtonBehavior: string): T; - - /** - * Builds the template JSON object - * - * @returns - * @memberof TemplateBuilder - */ - public build(): Template; - // /** - // * Sets the text content for the template - // * - // * @param {TextField} primaryText - // * @param {TextField} secondaryText - // * @param {TextField} tertiaryText - // * @returns TemplateBuilder - // * @memberof TemplateBuilder - // */ - // public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T; - } - /** - * Used to build a list of ListItems for ListTemplate - * - * @class ListItemBuilder - */ - export class ListItemBuilder { - constructor(); - public items: ListItem[]; - /** - * Add an item to the list of template - * - * @param {Image} image - * @param {string} token - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText - * @memberof ListItemBuilder - */ - public addItem(image: Image, token: string, primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): ListItemBuilder; - - public build(): ListItem[]; - } - /** - * Used to create BodyTemplate1 objects - * - * @class BodyTemplate1Builder - * @extends {TemplateBuilder} - */ - export class BodyTemplate1Builder extends TemplateBuilder implements SetTextContent{ - constructor(); - /** - * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText - * @returns BodyTemplate1Builder - * @memberof BodyTemplate1Builder - */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate1Builder; - } - /** - * Used to create BodyTemplate2 objects - * - * @class BodyTemplate2Builder - * @extends {TemplateBuilder} - */ - export class BodyTemplate2Builder extends TemplateBuilder implements SetTextContent { - constructor(); - - /** - * Sets the image for the template - * - * @param {Image} image - * @returns - * @memberof BodyTemplate2Builder - */ - public setImage(image: Image): BodyTemplate2Builder - - /** - * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText - * @returns BodyTemplate2Builder - * @memberof BodyTemplate2Builder - */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate2Builder; - } - /** - * Used to create BodyTemplate3 objects - * - * @class BodyTemplate3Builder - * @extends {TemplateBuilder} - */ - export class BodyTemplate3Builder extends TemplateBuilder implements SetTextContent { - constructor(); - - /** - * Sets the image for the template - * - * @param {any} image - * @returns - * @memberof BodyTemplate3Builder - */ - public setImage(image: any): BodyTemplate3Builder; - - /** - * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText - * @returns BodyTemplate3Builder - * @memberof BodyTemplate3Builder - */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate3Builder; - } - /** - * Used to create BodyTemplate6 objects - * - * @class BodyTemplate6Builder - * @extends {TemplateBuilder} - */ - export class BodyTemplate6Builder extends TemplateBuilder implements SetTextContent { - constructor(); - - /** - * Sets the image for the template - * - * @param {any} image - * @returns - * @memberof BodyTemplate6Builder - */ - public setImage(image: any): BodyTemplate6Builder; - - /** - * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText - * @returns BodyTemplate6Builder - * @memberof BodyTemplate6Builder - */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate6Builder; - } - /** - * Used to create ListTemplate1 objects - * - * @class ListTemplate1Builder - * @extends {TemplateBuilder} - */ - export class ListTemplate1Builder extends TemplateBuilder implements SetListItems { - constructor(); - - /** - * Set the items for the list - * - * @param {any} listItems - * @returns - * @memberof ListTemplate1Builder - */ - setListItems(listItems: ListItem[]): ListTemplate1Builder; - } - /** - * Used to create ListTemplate2 objects - * - * @class ListTemplate2Builder - * @extends {TemplateBuilder} - */ - export class ListTemplate2Builder extends TemplateBuilder implements SetListItems { - constructor(); - - /** - * Set the items for the list - * - * @param {any} listItems - * @returns - * @memberof ListTemplate2Builder - */ - setListItems(listItems: ListItem[]): ListTemplate2Builder; - } - -} \ No newline at end of file diff --git a/types/alexa-sdk/tsconfig.json b/types/alexa-sdk/tsconfig.json index e5b9d60424..d1932fa469 100644 --- a/types/alexa-sdk/tsconfig.json +++ b/types/alexa-sdk/tsconfig.json @@ -19,10 +19,5 @@ "files": [ "index.d.ts", "alexa-sdk-tests.ts" - "responseBuilder.d.ts", - "services.d.ts", - "templateBuilders.d.ts", - "types.d.ts", - "utils.d.ts", ] } diff --git a/types/alexa-sdk/types.d.ts b/types/alexa-sdk/types.d.ts deleted file mode 100644 index 42daa46f60..0000000000 --- a/types/alexa-sdk/types.d.ts +++ /dev/null @@ -1,208 +0,0 @@ -import { i18n } from "../i18next"; -import { ResponseBuilder } from "./responseBuilder"; -export let StateString: string; - -export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; -export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; - -export interface CardImage { - smallImageUrl: string; - largeImageUrl: string; -} -export interface Image { - smallImageUrl: string; - largeImageUrl: string; - contentDescription: string; - sources: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>; -} -export type TextField = { - text: string, - type: string -}; -export type TextContent = { - primaryText: TextField, - secondaryText: TextField, - tertiaryText: TextField, -} -export type ListItem = { image: Image; token: string; textContent: TextContent; }; -export type Template = { - title: string; - token: string; - backgroundImage: Image; - backButton: string; - type: string; - image: Image; - listItems: ListItem[]; -}; - -export interface AlexaObject extends Handler { - _event: any; - _context: any; - _callback: any; - state: any; - appId: any; - response: any; - resources: any; - dynamoDBTableName: any; - saveBeforeResponse: boolean; - registerHandlers: (...handlers: Array>) => any; - execute: () => void; -} - -export interface Handlers { - [intent: string]: (this: Handler) => void; -} - -export interface Handler { - on: any; - emit(event: string, ...args: any[]): boolean; - emitWithState: any; - state: any; - handler: any; - i18n: i18n, - locale: any, - event: RequestBody; - attributes: any; - context: any; - callback: Function; - name: any; - isOverriden: any; - t: (token: string, ...args: any[]) => void; - response: ResponseBuilder; -} -export enum PLAYER_ACTIVITY { - IDLE = 'IDLE', - PAUSED = 'PAUSED', - PLAYING = 'PLAYING', - BUFFER_UNDERRUN = 'BUFFER_UNDERRUN', - FINISHED = 'FINISHED', - STOPPED = 'STOPPED' -} -export interface Context { - System: System - AudioPlayer: AudioPlayer -} -export interface System { - apiAccessToken: string; - apiEndpoint: string; - application: any; - device: any; - user: any; -} -export interface AudioPlayer { - token: string; - offsetInMilliseconds: number; - playerActivity: PLAYER_ACTIVITY; -} -export interface RequestBody { - version: string; - session: Session; - request: T; -} - -export interface Session { - new: boolean; - sessionId: string; - attributes: any; - application: SessionApplication; - user: SessionUser; -} - -export interface SessionApplication { - applicationId: string; -} - -export interface SessionUser { - userId: string; - accessToken?: string; - /** - * @deprecated - */ - permissions: any; -} - -export interface LaunchRequest extends Request { } - -export interface IntentRequest extends Request { - dialogState?: DialogStates; - intent?: Intent; -} - -export interface SessionEndedRequest extends Request { - reason?: string; -} - -export interface Request { - type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest"; - requestId: string; - timestamp: string; - locale?: string; -} - -export interface ResolutionStatus { - code: string; -} - -export interface ResolutionValue { - name: string; - id: string; -} - -export interface ResolutionValueContainer { - value: ResolutionValue; -} - -export interface Resolution { - authority: string; - status: ResolutionStatus; - values: ResolutionValueContainer[]; -} - -export interface Resolutions { - resolutionsPerAuthority: Resolution[]; -} - -export interface SlotValue { - confirmationStatus?: ConfirmationStatuses; - name: string; - value?: any; - resolutions?: Resolutions; -} - -export interface Intent { - confirmationStatus?: ConfirmationStatuses; - name: string; - slots: Record; -} - -export interface ResponseBody { - version: string; - sessionAttributes?: any; - response: Response; -} - -export interface Response { - outputSpeech?: OutputSpeech; - card?: Card; - reprompt?: Reprompt; - directives?: any; - shouldEndSession?: boolean; -} - -export interface OutputSpeech { - type: "PlainText" | "SSML"; - text?: string; - ssml?: string; -} - -export interface Card { - type: "Simple" | "Standard" | "LinkAccount"; - title?: string; - content?: string; - text?: string; - image?: Image; -} - -export interface Reprompt { - outputSpeech: OutputSpeech; -} \ No newline at end of file diff --git a/types/alexa-sdk/utils.d.ts b/types/alexa-sdk/utils.d.ts deleted file mode 100644 index 056a52530e..0000000000 --- a/types/alexa-sdk/utils.d.ts +++ /dev/null @@ -1,96 +0,0 @@ - -import { TextField, TextContent, Image } from "./types"; -export namespace utils { - export class ImageUtils { - /** - * Creates an image object with a single source - * - * These images may be in either JPEG or PNG formats, with the appropriate file extensions. - * An image cannot be larger than 2 MB - * You must host the images at HTTPS URLs that are publicly accessible. - * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. - * - * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, - * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, - * which means that larger images will be downscaled for display on Echo Show if provided. - * - * example : ImageUtils.makeImage('https://url/to/my/img.png', 300, 400, 'SMALL', 'image description') - * - * @static - * @param {string} url url of the image - * @param {number} widthPixels (optional) width of the image in pixels - * @param {number} heightPixels (optional) height of the image in pixels - * @param {string} size size of the image (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE) - * @param {string} description text used to describe the image in a screen reader - * @returns - * @memberof ImageUtils - */ - public static makeImage(url: string, widthPixels?: number, heightPixels?: number, size?: string, description?: string): Image; - /** - * - * Creates an image object with a multiple sources, source images are provided as an array of image objects - * - * These images may be in either JPEG or PNG formats, with the appropriate file extensions. - * An image cannot be larger than 2 MB - * You must host the images at HTTPS URLs that are publicly accessible. - * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. - * - * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, - * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, - * which means that larger images will be downscaled for display on Echo Show if provided. - * example : - * let imgArr = [ - * { 'https://url/to/my/small.png', 300, 400, 'SMALL' }, - * { 'https://url/to/my/large.png', 900, 1200, 'LARGE' }, - * ] - * ImageUtils.makeImage(imgArr, 'image description') - * - * @static - * @param {{url : string, widthPixels : number, heightPixels : number, size : string}[]} imgArr - * @param {string} description text used to describe the image in a screen reader - * @returns - * @memberof ImageUtils - */ - public static makeImages(imgArr: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>, description: string): Image; - } - /** - * Utility methods for building TextField objects - * - * @class TextUtils - */ - export class TextUtils { - - /** - * Creates a plain TextField object with contents : text - * - * @static - * @param {string} text contents of plain text object - * @returns - * @memberof TextUtils - */ - public static makePlainText(text: string): TextField; - - /** - * Creates a rich TextField object with contents : text - * - * @static - * @param {string} text - * @returns - * @memberof TextUtils - */ - public static makeRichText(text: string): TextField; - - /** - * Creates a textContent - * - * @static - * @param {{type : string, text : string}} primaryText - * @param {{type : string, text : string}} secondaryText - * @param {{type : string, text : string}} tertiaryText - * @returns - * @memberof TextUtils - */ - public static makeTextContent(primaryText: { type: string, text: string }, - secondaryText: { type: string, text: string }, tertiaryText: { type: string, text: string }): TextContent - } -} \ No newline at end of file From 5838284de2e44af57f6f7733b26fe59f8f8ca250 Mon Sep 17 00:00:00 2001 From: rbot <30998401+rk-7@users.noreply.github.com> Date: Thu, 23 Nov 2017 12:29:21 +0530 Subject: [PATCH 086/269] Reverted alexa-sdk-tests.ts --- types/alexa-sdk/alexa-sdk-tests.ts | 20 ++++++++++++++++++++ types/alexa-sdk/tslint.json | 19 ++++++++++--------- 2 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 types/alexa-sdk/alexa-sdk-tests.ts diff --git a/types/alexa-sdk/alexa-sdk-tests.ts b/types/alexa-sdk/alexa-sdk-tests.ts new file mode 100644 index 0000000000..0c511979d4 --- /dev/null +++ b/types/alexa-sdk/alexa-sdk-tests.ts @@ -0,0 +1,20 @@ +import * as Alexa from "alexa-sdk"; + +const handler = (event: Alexa.RequestBody, context: Alexa.Context, callback: () => void) => { + const alexa = Alexa.handler(event, context); + alexa.resources = {}; + alexa.registerHandlers(handlers); + alexa.execute(); +}; + +const handlers: Alexa.Handlers = { + 'LaunchRequest': function () { + this.emit('SayHello'); + }, + 'HelloWorldIntent': function () { + this.emit('SayHello'); + }, + 'SayHello': function () { + this.emit(':tell', 'Hello World!'); + } +}; diff --git a/types/alexa-sdk/tslint.json b/types/alexa-sdk/tslint.json index 78f1939ba2..32a9916641 100644 --- a/types/alexa-sdk/tslint.json +++ b/types/alexa-sdk/tslint.json @@ -1,10 +1,11 @@ -{ "extends": "dtslint/dt.json", - "rules": { - "object-literal-shorthand": false, - "object-literal-key-quote": false, - "no-empty-interface": false, - "prefer-method-signature": false, - "object-literal-key-quotes": false, - "no-any": false - } +{ + "extends": "dtslint/dt.json", + "rules": { + "object-literal-shorthand": false, + "object-literal-key-quote": false, + "no-empty-interface": false, + "prefer-method-signature": false, + "object-literal-key-quotes": false, + "no-any": false + } } From f9702725c729deec03d7e571ff358b5124ab7886 Mon Sep 17 00:00:00 2001 From: Peter Blazejewicz Date: Thu, 23 Nov 2017 09:20:47 +0100 Subject: [PATCH 087/269] Fix CI check failures This makes the PR complies with CI build requirements --- types/auth0-js/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index 02642f0934..faab2ac006 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Auth0.js 8.11.3 +// Type definitions for Auth0.js 8.11 // Project: https://github.com/auth0/auth0.js // Definitions by: Adrian Chia // Matt Durrant @@ -528,8 +528,6 @@ export interface Auth0Error { /** * The contents of the authResult object returned by {@link WebAuth#parseHash } - * @export - * @interface Auth0DecodedHash */ export interface Auth0DecodedHash { accessToken?: string; From 6ad9ba8e3c1e881462901da876507641f6bc0615 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Thu, 23 Nov 2017 09:48:33 +0100 Subject: [PATCH 088/269] review comment fixes --- types/lolex/index.d.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index c0688a5b09..510cb911ec 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -120,7 +120,7 @@ export interface LolexClock { /** * Simulates process.nextTick(); */ - nextTick(callback: () => any): void; + nextTick(callback: () => void): void; /** * Advances the clock to the the moment of the first scheduled timer, firing it. @@ -177,29 +177,34 @@ export declare function createClock(now?: number | Date, l export interface LolexInstallOpts { /** - * installs lolex onto the specified target context (default: global) + * Installs lolex onto the specified target context (default: global) */ target?: any; + /** - * installs lolex with the specified unix epoch (default: 0) + * Installs lolex with the specified unix epoch (default: 0) */ now?: number; + /** - * an array with explicit function names to hijack. When not set, lolex will automatically fake all methods except nextTick + * An array with explicit function names to hijack. When not set, lolex will automatically fake all methods except nextTick * e.g., lolex.install({ toFake: ["setTimeout", "nextTick"]}) will fake only setTimeout and nextTick */ toFake?: FakeMethod[]; + /** - * the maximum number of timers that will be run when calling runAll() (default: 1000) + * The maximum number of timers that will be run when calling runAll() (default: 1000) */ loopLimit?: number; + /** - * tells lolex to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by + * Tells lolex to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by * 20ms for every 20ms change in the real system time) (default: false) */ shouldAdvanceTime?: boolean; + /** - * relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change + * Relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change * in the real system time (default: 20) */ advanceTimeDelta?: number; From c68d201b29a92c0b4b622da2cccbf6971c8bf1a8 Mon Sep 17 00:00:00 2001 From: Mark Raymond Date: Thu, 23 Nov 2017 09:59:59 +0000 Subject: [PATCH 089/269] Remove unnecessary `/// `. The redux typings use `export`, not `declare module`, and so don't need /// as well as the import. --- types/redux-immutable-state-invariant/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/redux-immutable-state-invariant/index.d.ts b/types/redux-immutable-state-invariant/index.d.ts index b81b6cc47f..6ad2a0e588 100644 --- a/types/redux-immutable-state-invariant/index.d.ts +++ b/types/redux-immutable-state-invariant/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Remo H. Jansen , Ben Rogers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - import * as Redux from "redux"; type isImmutableDefault = (value: any) => boolean; From 26bb67e8d7db5735ca266ba4fb0ec7257a5c72b7 Mon Sep 17 00:00:00 2001 From: rbot <30998401+rk-7@users.noreply.github.com> Date: Thu, 23 Nov 2017 17:44:33 +0530 Subject: [PATCH 090/269] Fixed lint errors for alexa-sdk --- types/alexa-sdk/alexa-sdk-tests.ts | 6 +- types/alexa-sdk/index.d.ts | 821 ++++++++++++++--------------- 2 files changed, 394 insertions(+), 433 deletions(-) diff --git a/types/alexa-sdk/alexa-sdk-tests.ts b/types/alexa-sdk/alexa-sdk-tests.ts index 0c511979d4..c77bc93091 100644 --- a/types/alexa-sdk/alexa-sdk-tests.ts +++ b/types/alexa-sdk/alexa-sdk-tests.ts @@ -8,13 +8,13 @@ const handler = (event: Alexa.RequestBody, context: Alexa.Context }; const handlers: Alexa.Handlers = { - 'LaunchRequest': function () { + 'LaunchRequest': function() { this.emit('SayHello'); }, - 'HelloWorldIntent': function () { + 'HelloWorldIntent': function() { this.emit('SayHello'); }, - 'SayHello': function () { + 'SayHello': function() { this.emit(':tell', 'Hello World!'); } }; diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 744523b2ac..e4ea78c104 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Alexa SDK for Node.js 1.0.21 +// Type definitions for Alexa SDK for Node.js 1.0 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs // Definitions by: Pete Beegle // Huw @@ -6,45 +6,66 @@ // Ben // rk-7 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.7 +// TypeScript Version: 2.2 import { i18n } from "i18next"; export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; export let StateString: string; //#region Types -export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; -export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; - export interface CardImage { + /** + * Recommended size (in px): 720w x 480h + */ smallImageUrl: string; + /** + * Recommended size (in px): 1200w x 800h + */ largeImageUrl: string; } +export interface ImageSource { + url: string; + widthPixels?: number; + heightPixels?: number; + /** + * Possible values: 'X_SMALL' | 'SMALL' | 'MEDIUM' | 'LARGE' | 'X_LARGE' + * Recommended size respectively (in px): 480 x 320 | 720 x 480 | 960 x 640 | 1200 x 800 | 1920 x 1280 + */ + size?: string; +} export interface Image { - smallImageUrl: string; - largeImageUrl: string; contentDescription: string; - sources: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>; + sources: ImageSource[]; } -export type TextField = { - text: string, - type: string -}; -export type TextContent = { - primaryText: TextField, - secondaryText: TextField, - tertiaryText: TextField, -} -export type ListItem = { image: Image; token: string; textContent: TextContent; }; -export type Template = { - title: string; - token: string; - backgroundImage: Image; - backButton: string; +export interface TextField { + text: string; type: string; - image: Image; - listItems: ListItem[]; -}; +} +export interface TextContent { + primaryText?: TextField; + secondaryText?: TextField; + tertiaryText?: TextField; +} +export interface ListItem { + image?: Image; + token: string; + textContent?: TextContent; +} +export interface Template { + title?: string; + token: string; + backgroundImage?: Image; + /** + * Possible values 'HIDDEN' | 'VISIBLE' + */ + backButton?: string; + /** + * Possible values 'BodyTemplate1' | 'BodyTemplate2'| 'BodyTemplate3'| 'BodyTemplate6'| 'ListTemplate1'| 'ListTemplate2' + */ + type: string; + image?: Image; + listItems?: ListItem[]; +} export interface AlexaObject extends Handler { _event: any; @@ -70,28 +91,21 @@ export interface Handler { emitWithState: any; state: any; handler: any; - i18n: i18n, - locale: any, + i18n: i18n; + locale: any; event: RequestBody; attributes: any; context: any; - callback: Function; + callback: (param: any) => void; name: any; isOverriden: any; t: (token: string, ...args: any[]) => void; response: ResponseBuilder; } -export enum PLAYER_ACTIVITY { - IDLE = 'IDLE', - PAUSED = 'PAUSED', - PLAYING = 'PLAYING', - BUFFER_UNDERRUN = 'BUFFER_UNDERRUN', - FINISHED = 'FINISHED', - STOPPED = 'STOPPED' -} + export interface Context { - System: System - AudioPlayer: AudioPlayer + System: System; + AudioPlayer: AudioPlayer; } export interface Application { applicationId: string; @@ -107,7 +121,10 @@ export interface System { export interface AudioPlayer { token: string; offsetInMilliseconds: number; - playerActivity: PLAYER_ACTIVITY; + /** + * Possible values: 'IDLE'|'PAUSED'|'PLAYING'|'BUFFER_UNDERRUN'|'FINISHED'|'STOPPED' + */ + playerActivity: string; } export interface RequestBody { version: string; @@ -122,23 +139,25 @@ export interface Session { application: Application; user: SessionUser; } - export interface SessionUser { userId: string; accessToken?: string; - /** - * @deprecated - */ permissions: Permissions; } export interface Permissions { + /** + * @deprecated + */ consentToken: string; [key: string]: string; } export interface LaunchRequest extends Request { } export interface IntentRequest extends Request { - dialogState?: DialogStates; + /** + * Possible values: 'STARTED'| 'IN_PROGRESS'| 'COMPLETED' + */ + dialogState?: string; intent?: Intent; } @@ -177,14 +196,20 @@ export interface Resolutions { } export interface SlotValue { - confirmationStatus?: ConfirmationStatuses; + /** + * Possible values: 'NONE'| 'DENIED'| 'CONFIRMED' + */ + confirmationStatus?: string; name: string; value?: any; resolutions?: Resolutions; } export interface Intent { - confirmationStatus?: ConfirmationStatuses; + /** + * Possible values: 'NONE'| 'DENIED'| 'CONFIRMED' + */ + confirmationStatus?: string; name: string; slots: Record; } @@ -214,24 +239,24 @@ export interface Card { title?: string; content?: string; text?: string; - image?: Image; + image?: CardImage; } export interface Reprompt { outputSpeech: OutputSpeech; } -export declare const CARD_TYPES: { +export const CARD_TYPES: { STANDARD: 'Standard', SIMPLE: 'Simple', LINK_ACCOUNT: 'LinkAccount', ASK_FOR_PERMISSIONS_CONSENT: 'AskForPermissionsConsent' }; -export declare const HINT_TYPES: { +export const HINT_TYPES: { PLAIN_TEXT: 'PlainText' }; -export declare const DIRECTIVE_TYPES: { +export const DIRECTIVE_TYPES: { AUDIOPLAYER: { PLAY: 'AudioPlayer.Play', STOP: 'AudioPlayer.Stop', @@ -256,466 +281,448 @@ export interface ApiClientOptions { export interface ApiClientResponse { statusCode: string; statusText: string; - body: Object; - headers: Object + body: object; + headers: object; } +/** + * Todo-ListItem class + * Refer https://developer.amazon.com/docs/custom-skills/access-the-alexa-shopping-and-to-do-lists.html + */ export interface ListItemObject { - value: string, - status: string, - version: any + /** + * item id (String, limit 60 characters) + */ + id: string; + /** + * item value (String, limit is 256 characters) + */ + value: string; + /** + * item status + * Possible values: "active" or "completed" + */ + status?: string; + /** + * item version (Positive integer | string) + */ + version?: any; + /** + * created time (ISO 8601 time format with time zone) + */ + createdTime: Date; + /** + * updated time (ISO 8601 time format with time zone) + */ + updatedTime: Date; + /** + * URL to retrieve the item (String) + */ + href?: string; } +/** + * Todo-List class + * Refer https://developer.amazon.com/docs/custom-skills/access-the-alexa-shopping-and-to-do-lists.html + */ export interface ListObject { - name: string, - status: string, - version: any + /** + * list id (String) + */ + listId: string; + /** + * list name (String) + */ + name: string; + /** + * "active" or "archived" (Enum) + */ + state?: string; + /** + * Possibly status of the list (or state?) + * Fetched from commit eebba0d at https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/ + * File path: alexa-skills-kit-sdk-for-nodejs/lib/services/listManagementService.js + */ + status?: string; + /** + * list version (long | string) + */ + version?: any; + /** + * Urls to active and completed items + * href is lint to the items having certain status. + * The status can be "active" or "completed". + */ + statusMap: { href: string; status: string; }; + /** + * Items that belong to this list. + */ + items: ListItemObject[]; } //#endregion //#region templateBuilders +/** + * Generates templates for Echo Show device. + */ export namespace templateBuilders { - export interface SetTextContent> { + interface SetTextContent> { setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T; } - export interface SetListItems> { + interface SetListItems> { setListItems(listItems: ListItem[]): T; } - export abstract class TemplateBuilder> { - public template: Template; + /** + * Refer https://developer.amazon.com/docs/custom-skills/display-interface-reference.html#image-sizes + */ + abstract class TemplateBuilder> { + template: Template; constructor(); /** * Sets the title of the template - * - * @param {string} title - * @returns - * @memberof TemplateBuilder + * @param title title + * @returns TemplateBuilder */ - public setTitle(title: string): T; + setTitle(title: string): T; /** * Sets the token of the template - * - * @param {string} token - * @returns - * @memberof TemplateBuilder + * @param token token + * @returns TemplateBuilder */ - public setToken(token: string): T; + setToken(token: string): T; /** * Sets the background image of the template - * - * @param {Image} image - * @returns - * @memberof TemplateBuilder + * @param image image + * @returns TemplateBuilder */ - public setBackgroundImage(image: Image): T; + setBackgroundImage(image: Image): T; /** * Sets the backButton behavior - * - * @param {string} backButtonBehavior 'VISIBLE' or 'HIDDEN' - * @returns - * @memberof TemplateBuilder + * @param backButtonBehavior 'VISIBLE' or 'HIDDEN' + * @returns TemplateBuilder */ - public setBackButtonBehavior(backButtonBehavior: string): T; + setBackButtonBehavior(backButtonBehavior: string): T; /** * Builds the template JSON object - * - * @returns - * @memberof TemplateBuilder + * @returns Template */ - public build(): Template; - // /** - // * Sets the text content for the template - // * - // * @param {TextField} primaryText - // * @param {TextField} secondaryText - // * @param {TextField} tertiaryText - // * @returns TemplateBuilder - // * @memberof TemplateBuilder - // */ - // public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T; + build(): Template; } /** * Used to build a list of ListItems for ListTemplate - * - * @class ListItemBuilder */ - export class ListItemBuilder { + class ListItemBuilder { constructor(); - public items: ListItem[]; + items: ListItem[]; /** * Add an item to the list of template - * - * @param {Image} image - * @param {string} token - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText - * @memberof ListItemBuilder + * @param image image + * @param token token + * @param primaryText primaryText + * @param secondaryText secondaryText + * @param tertiaryText tertiaryText */ - public addItem(image: Image, token: string, primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): ListItemBuilder; + addItem(image: Image, token: string, primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): ListItemBuilder; - public build(): ListItem[]; + build(): ListItem[]; } /** * Used to create BodyTemplate1 objects - * - * @class BodyTemplate1Builder - * @extends {TemplateBuilder} */ - export class BodyTemplate1Builder extends TemplateBuilder implements SetTextContent{ + class BodyTemplate1Builder extends TemplateBuilder implements SetTextContent { constructor(); /** * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText + * @param primaryText primaryText + * @param secondaryText secondaryText + * @param tertiaryText tertiaryText * @returns BodyTemplate1Builder - * @memberof BodyTemplate1Builder */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate1Builder; + setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate1Builder; } /** * Used to create BodyTemplate2 objects - * - * @class BodyTemplate2Builder - * @extends {TemplateBuilder} */ - export class BodyTemplate2Builder extends TemplateBuilder implements SetTextContent { + class BodyTemplate2Builder extends TemplateBuilder implements SetTextContent { constructor(); /** * Sets the image for the template - * - * @param {Image} image - * @returns - * @memberof BodyTemplate2Builder + * @param image image + * @returns BodyTemplate2Builder */ - public setImage(image: Image): BodyTemplate2Builder + setImage(image: Image): BodyTemplate2Builder; /** * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText + * @param primaryText primaryText + * @param secondaryText secondaryText + * @param tertiaryText tertiaryText * @returns BodyTemplate2Builder - * @memberof BodyTemplate2Builder */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate2Builder; + setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate2Builder; } /** * Used to create BodyTemplate3 objects - * - * @class BodyTemplate3Builder - * @extends {TemplateBuilder} */ - export class BodyTemplate3Builder extends TemplateBuilder implements SetTextContent { + class BodyTemplate3Builder extends TemplateBuilder implements SetTextContent { constructor(); /** * Sets the image for the template - * - * @param {any} image - * @returns - * @memberof BodyTemplate3Builder + * @param image image + * @returns BodyTemplate3Builder */ - public setImage(image: any): BodyTemplate3Builder; + setImage(image: any): BodyTemplate3Builder; /** * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText + * @param primaryText primaryText + * @param secondaryText secondaryText + * @param tertiaryText tertiaryText * @returns BodyTemplate3Builder - * @memberof BodyTemplate3Builder */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate3Builder; + setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate3Builder; } /** * Used to create BodyTemplate6 objects - * - * @class BodyTemplate6Builder - * @extends {TemplateBuilder} */ - export class BodyTemplate6Builder extends TemplateBuilder implements SetTextContent { + class BodyTemplate6Builder extends TemplateBuilder implements SetTextContent { constructor(); /** * Sets the image for the template - * - * @param {any} image - * @returns - * @memberof BodyTemplate6Builder + * @param image image + * @returns BodyTemplate6Builder */ - public setImage(image: any): BodyTemplate6Builder; + setImage(image: any): BodyTemplate6Builder; /** * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText + * @param primaryText primaryText + * @param secondaryText secondaryText + * @param tertiaryText tertiaryText * @returns BodyTemplate6Builder - * @memberof BodyTemplate6Builder */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate6Builder; + setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate6Builder; } /** * Used to create BodyTemplate7 objects - * - * @class BodyTemplate7Builder - * @extends {TemplateBuilder} */ - export class BodyTemplate7Builder extends TemplateBuilder { + class BodyTemplate7Builder extends TemplateBuilder { constructor(); /** * Sets the image for the template - * - * @param {Image} image - * @returns - * @memberof BodyTemplate7Builder + * @param image image + * @returns BodyTemplate7Builder */ - setImage(image: Image): BodyTemplate7Builder + setImage(image: Image): BodyTemplate7Builder; } /** * Used to create ListTemplate1 objects - * - * @class ListTemplate1Builder - * @extends {TemplateBuilder} */ - export class ListTemplate1Builder extends TemplateBuilder implements SetListItems { + class ListTemplate1Builder extends TemplateBuilder implements SetListItems { constructor(); /** * Set the items for the list - * - * @param {any} listItems - * @returns - * @memberof ListTemplate1Builder + * @param listItems listItems + * @returns ListTemplate1Builder */ setListItems(listItems: ListItem[]): ListTemplate1Builder; } /** * Used to create ListTemplate2 objects - * - * @class ListTemplate2Builder - * @extends {TemplateBuilder} */ - export class ListTemplate2Builder extends TemplateBuilder implements SetListItems { + class ListTemplate2Builder extends TemplateBuilder implements SetListItems { constructor(); /** * Set the items for the list - * - * @param {any} listItems - * @returns - * @memberof ListTemplate2Builder + * @param listItems listItems + * @returns ListTemplate2Builder */ setListItems(listItems: ListItem[]): ListTemplate2Builder; } - } //#endregion //#region services export namespace services { - export interface ApiClient { + interface ApiClient { /** * Make a POST API call to the specified uri with headers and optional body - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers Key value pair of headers - * @param {string} body post body to send - * @returns {Promise} - * @memberof ApiClient + * @param uri http(s?) endpoint to call + * @param headers Key value pair of headers + * @param body post body to send + * @returns Promise */ - post(uri: string, headers: Object, body?: string): Promise; + post(uri: string, headers: object, body?: string): Promise; /** * Make a PUT API call to the specified uri with headers and optional body - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers Key value pair of headers - * @param {string} body post body to send - * @returns {Promise} - * @memberof ApiClient + * @param uri http(s?) endpoint to call + * @param headers Key value pair of headers + * @param body post body to send + * @returns Promise */ - put(uri: string, headers: Object, body?: string): Promise; + put(uri: string, headers: object, body?: string): Promise; /** * Make a GET API call to the specified uri with headers - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers key value pair of headers - * @returns {Promise} - * @memberof ApiClient + * @param uri http(s?) endpoint to call + * @param headers key value pair of headers + * @returns Promise */ - get(uri: string, headers: Object): Promise; + get(uri: string, headers: object): Promise; /** - * Make a DELETE API call to the specified uri with headers - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers key value pair of headers - * @returns {Promise} - */ - delete(uri: string, headers: Object): Promise; + * Make a DELETE API call to the specified uri with headers + * @param uri http(s?) endpoint to call + * @param headers key value pair of headers + * @returns Promise + */ + delete(uri: string, headers: object): Promise; } - export class DeviceAddressService { + class DeviceAddressService { /** * Create an instance of DeviceAddressService - * @param {ApiClient} [apiClient=new ApiClient()] ApiClient - * @memberOf DeviceAddressService + * @param [apiClient=new ApiClient()] ApiClient */ constructor(apiClient: ApiClient); /** * Get full address information from Alexa Device Address API - * @param {string} deviceId deviceId from Alexa request - * @param {string} apiEndpoint API apiEndpoint from Alexa request - * @param {string} token bearer token for device address permission - * @returns {Promise} - * @memberOf DeviceAddressService + * @param deviceId deviceId from Alexa request + * @param apiEndpoint API apiEndpoint from Alexa request + * @param token bearer token for device address permission + * @returns Promise */ - getFullAddress(deviceId: string, apiEndpoint: string, token: string): Promise; + getFullAddress(deviceId: string, apiEndpoint: string, token: string): Promise; /** * Get country and postal information from Alexa Device Address API - * @param {string} deviceId deviceId from Alexa request - * @param {string} apiEndpoint API apiEndpoint from Alexa request - * @param {string} token bearer token for device address permission - * @returns {Promise} - * @memberOf DeviceAddressService + * @param deviceId deviceId from Alexa request + * @param apiEndpoint API apiEndpoint from Alexa request + * @param token bearer token for device address permission + * @returns Promise */ - getCountryAndPostalCode(deviceId: string, apiEndpoint: string, token: string): Promise; + getCountryAndPostalCode(deviceId: string, apiEndpoint: string, token: string): Promise; } - export class DirectiveService { - + class DirectiveService { /** * Creates an instance of DirectiveService. - * @param {ApiClient} [apiClient=new ApiClient()] ApiClient - * @memberof DirectiveService + * @param [apiClient=new ApiClient()] ApiClient */ constructor(apiClient: ApiClient); /** * Send the specified directiveObj to Alexa directive service * - * @param {Object} directive directive to send to service - * @param {string} apiEndpoint API endpoint from Alexa request - * @param {string} token bearer token for directive service - * @returns {Promise} - * @memberof DirectiveService + * @param directive directive to send to service + * @param apiEndpoint API endpoint from Alexa request + * @param token bearer token for directive service + * @returns Promise */ - enqueue(directive: Object, apiEndpoint: string, token: string): Promise; + enqueue(directive: object, apiEndpoint: string, token: string): Promise; } - export class ListManagementService { - + class ListManagementService { /** * Create an instance of ListManagementService - * @param apiClient + * @param apiClient apiClient */ constructor(apiClient: ApiClient); /** * Set apiEndpoint address, default is 'https://api.amazonalexa.com' - * @param apiEndpoint + * @param apiEndpoint apiEndpoint * @returns void - * @memberOf ListManagementService */ setApiEndpoint(apiEndpoint: string): void; /** * Get currently set apiEndpoint address - * @returns {string} - * @memberOf ListManagementService + * @returns string */ getApiEndpoint(): string; /** * Retrieve the metadata for all customer lists, including the customer's default lists - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param token bearer token for list management permission + * @returns Promise */ - getListsMetadata(token: string): Promise; + getListsMetadata(token: string): Promise; /** * Create a custom list. The new list name must be different than any existing list name - * @param {ListObject} listObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listObject listObject + * @param token bearer token for list management permission + * @returns Promise */ - createList(listObject: ListObject, token: string): Promise + createList(listObject: ListObject, token: string): Promise; /** * Retrieve list metadata including the items in the list with requested status - * @param {string} listId unique Id associated with the list - * @param {string} itemStatus itemsStatus can be either 'active' or 'completed' - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param itemStatus itemsStatus can be either 'active' or 'completed' + * @param token bearer token for list management permission + * @returns Promise */ - getList(listId: string, itemStatus: string, token: string): Promise; + getList(listId: string, itemStatus: string, token: string): Promise; /** * Update a custom list. Only the list name or state can be updated - * @param {string} listId unique Id associated with the list - * @param {ListObject} listObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param listObject listObject + * @param token bearer token for list management permission + * @returns Promise */ - updateList(listId: string, listObject: ListObject, token: string): Promise; + updateList(listId: string, listObject: ListObject, token: string): Promise; /** * Delete a custom list - * @param {string} listId unique Id associated with the list - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param token bearer token for list management permission + * @returns Promise */ - deleteList(listId: string, token: string): Promise; + deleteList(listId: string, token: string): Promise; /** * Create an item in an active list or in a default list - * @param {string} listId unique Id associated with the list - * @param {ListItemObject} listItemObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param listItemObject listItemObject + * @param token bearer token for list management permission + * @returns Promise */ - createListItem(listId: string, listItemObject: ListItemObject, token: string): Promise; + createListItem(listId: string, listItemObject: ListItemObject, token: string): Promise; /** * Retrieve single item within any list by listId and itemId - * @param {string} listId unique Id associated with the list - * @param {string} itemId unique Id associated with the item - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param itemId unique Id associated with the item + * @param token bearer token for list management permission + * @returns Promise */ - getListItem(listId: string, itemId: string, token: string): Promise; + getListItem(listId: string, itemId: string, token: string): Promise; /** * Update an item value or item status - * @param {string} listId unique Id associated with the list - * @param {string} itemId unique Id associated with the item - * @param {ListItemObject} listItemObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param itemId unique Id associated with the item + * @param listItemObject listItemObject + * @param token bearer token for list management permission + * @returns Promise */ - updateListItem(listId: string, itemId: string, listItemObject: ListItemObject, token: string): Promise; + updateListItem(listId: string, itemId: string, listItemObject: ListItemObject, token: string): Promise; /** * Delete an item in the specified list - * @param {string} listId unique Id associated with the list - * @param {string} itemId unique Id associated with the item - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param itemId unique Id associated with the item + * @param token bearer token for list management permission + * @returns Promise */ - deleteListItem(listId: string, itemId: string, token: string): Promise; + deleteListItem(listId: string, itemId: string, token: string): Promise; } } //#endregion @@ -723,155 +730,132 @@ export namespace services { /** * Responsible for building JSON responses as per the Alexa skills kit interface * https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference#response-body-syntax - * - * @class ResponseBuilder */ export class ResponseBuilder { constructor(alexaHandler: Handler); /** * Have Alexa say the provided speechOutput to the user - * - * @param {string} speechOutput - * @returns - * @memberof ResponseBuilder + * @param speechOutput speechOutput + * @returns ResponseBuilder */ speak(speechOutput: string): ResponseBuilder; /** * Have alexa listen for speech from the user. If the user doesn't respond within 8 seconds * then have alexa reprompt with the provided reprompt speech - * @param {string} repromptSpeech - * @returns - * @memberof ResponseBuilder + * @param repromptSpeech repromptSpeech + * @returns ResponseBuilder */ listen(repromptSpeech: string): ResponseBuilder; /** * Render a card with the following title, content and image - * - * @param {string} cardTitle - * @param {string} cardContent - * @param {{smallImageUrl : string, largeImageUrl : string}} cardImage - * @returns - * @memberof ResponseBuilder + * @param cardTitle cardTitle + * @param cardContent cardContent + * @param cardImage cardImage + * @returns ResponseBuilder */ cardRenderer(cardTitle: string, cardContent: string, cardImage: CardImage): ResponseBuilder; /** * Render a link account card - * - * @returns - * @memberof ResponseBuilder + * @returns ResponseBuilder */ linkAccountCard(): ResponseBuilder; /** * Render a askForPermissionsConsent card - * @param {[{ [key: string]: string }]} permissions - * @returns - * @memberOf ResponseBuilder + * @param permissions permissions + * @returns ResponseBuilder */ askForPermissionsConsentCard(permissions: [{ [key: string]: string }]): ResponseBuilder; /** * Creates a play, stop or clearQueue audioPlayer directive depending on the directive type passed in. * @deprecated - use audioPlayerPlay, audioPlayerStop, audioPlayerClearQueue instead - * @param {string} directiveType - * @param {string} behavior - * @param {string} url - * @param {string} token - * @param {string} expectedPreviousToken - * @param {number} offsetInMilliseconds - * @returns - * @memberof ResponseBuilder + * @param directiveType directiveType + * @param behavior behavior + * @param url url + * @param token token + * @param expectedPreviousToken expectedPreviousToken + * @param offsetInMilliseconds offsetInMilliseconds + * @returns ResponseBuilder */ audioPlayer(directiveType: string, behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder; /** * Creates an AudioPlayer play directive - * - * @param {string} behavior Describes playback behavior. Accepted values: + * @param behavior Describes playback behavior. Accepted values: * REPLACE_ALL: Immediately begin playback of the specified stream, and replace current and enqueued streams. * ENQUEUE: Add the specified stream to the end of the current queue. This does not impact the currently playing stream. * REPLACE_ENQUEUED: Replace all streams in the queue. This does not impact the currently playing stream. - * @param {string} url Identifies the location of audio content at a remote HTTPS location. - * The audio file must be hosted at an Internet-accessible HTTPS endpoint. HTTPS is required, and the domain hosting the - * files must present a valid, trusted SSL certificate. Self-signed certificates cannot be used. + * @param url Identifies the location of audio content at a remote HTTPS location. + * The audio file must be hosted at an Internet-accessible HTTPS endpoint. HTTPS is required, and the domain hosting the + * files must present a valid, trusted SSL certificate. Self-signed certificates cannot be used. * The supported formats for the audio file include AAC/MP4, MP3, HLS, PLS and M3U. Bitrates: 16kbps to 384 kbps. - * @param {string} token A token that represents the audio stream. This token cannot exceed 1024 characters - * @param {string} expectedPreviousToken A token that represents the expected previous stream. - * This property is required and allowed only when the playBehavior is ENQUEUE. This is used to prevent potential race conditions + * @param token A token that represents the audio stream. This token cannot exceed 1024 characters + * @param expectedPreviousToken A token that represents the expected previous stream. + * This property is required and allowed only when the playBehavior is ENQUEUE. This is used to prevent potential race conditions * if requests to progress through a playlist and change tracks occur at the same time. - * @param {number} offsetInMilliseconds The timestamp in the stream from which Alexa should begin playback. + * @param offsetInMilliseconds The timestamp in the stream from which Alexa should begin playback. * Set to 0 to start playing the stream from the beginning. Set to any other value to start playback from that associated point in the stream - * @returns - * @memberof ResponseBuilder + * @returns ResponseBuilder */ audioPlayerPlay(behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder; /** * Creates an AudioPlayer Stop directive - Stops the current audio Playback - * - * @returns - * @memberof ResponseBuilder + * @returns ResponseBuilder */ audioPlayerStop(): ResponseBuilder; /** * Creates an AudioPlayer ClearQueue directive - clear the queue without stopping the currently playing stream, * or clear the queue and stop any currently playing stream. - * - * @param {string} clearBehavior Describes the clear queue behavior. Accepted values: + * @param clearBehavior Describes the clear queue behavior. Accepted values: * CLEAR_ENQUEUED: clears the queue and continues to play the currently playing stream * CLEAR_ALL: clears the entire playback queue and stops the currently playing stream (if applicable). - * @returns - * @memberof ResponseBuilder + * @returns ResponseBuilder */ audioPlayerClearQueue(clearBehavior: string): ResponseBuilder; /** * Creates a Display RenderTemplate Directive - * * Use a template builder to generate a template object - * - * @param {Template} template - * @returns - * @memberof ResponseBuilder + * @param template template + * @returns ResponseBuilder */ renderTemplate(template: Template): ResponseBuilder; /** * Creates a hint directive - show a hint on the screen of the echo show - * - * @param {string} hintText text to show on the hint - * @param {string} hintType (optional) Default value : PlainText - * @returns - * @memberof ResponseBuilder + * @param hintText text to show on the hint + * @param hintType (optional) Default value : PlainText + * @returns ResponseBuilder */ hint(hintText: string, hintType: string): ResponseBuilder; /** * Creates a VideoApp play directive to play a video - * - * @param {string} source Identifies the location of video content at a remote HTTPS location. + * @param source Identifies the location of video content at a remote HTTPS location. * The video file must be hosted at an Internet-accessible HTTPS endpoint. - * @param {{title : string, subtitle : string}} metadata (optional) Contains an object that provides the + * @param metadata (optional) Contains an object that provides the * information that can be displayed on VideoApp. - * @returns - * @memberof ResponseBuilder + * @returns ResponseBuilder */ playVideo(source: string, metadata: { title: string, subtitle: string }): ResponseBuilder; } //#endregion //#region directives export namespace directives { - export class VoicePlayerSpeakDirective { + class VoicePlayerSpeakDirective { + header: { requestId: string }; + directive: { type: string, speech: string }; /** * Creates an instance of VoicePlayerSpeakDirective. - * @param {string} requestId - requestId from which the call is originated from - * @param {string} speechContent - Contents of the speech directive either in plain text or SSML. - * @memberof DirectiveService + * @param requestId - requestId from which the call is originated from + * @param speechContent - Contents of the speech directive either in plain text or SSML. */ constructor(requestId: string, speechContent: string); } @@ -879,97 +863,74 @@ export namespace directives { //#endregion //#region utils export namespace utils { - export class ImageUtils { + namespace ImageUtils { /** * Creates an image object with a single source - * * These images may be in either JPEG or PNG formats, with the appropriate file extensions. * An image cannot be larger than 2 MB * You must host the images at HTTPS URLs that are publicly accessible. * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. - * - * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, - * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, + * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, + * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, * which means that larger images will be downscaled for display on Echo Show if provided. - * * example : ImageUtils.makeImage('https://url/to/my/img.png', 300, 400, 'SMALL', 'image description') - * - * @static - * @param {string} url url of the image - * @param {number} widthPixels (optional) width of the image in pixels - * @param {number} heightPixels (optional) height of the image in pixels - * @param {string} size size of the image (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE) - * @param {string} description text used to describe the image in a screen reader - * @returns - * @memberof ImageUtils + * @param url url of the image + * @param widthPixels (optional) width of the image in pixels + * @param heightPixels (optional) height of the image in pixels + * @param size size of the image (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE) + * @param description text used to describe the image in a screen reader + * @returns Image */ - public static makeImage(url: string, widthPixels?: number, heightPixels?: number, size?: string, description?: string): Image; + function makeImage(url: string, widthPixels?: number, heightPixels?: number, size?: string, description?: string): Image; /** - * - * Creates an image object with a multiple sources, source images are provided as an array of image objects - * - * These images may be in either JPEG or PNG formats, with the appropriate file extensions. - * An image cannot be larger than 2 MB - * You must host the images at HTTPS URLs that are publicly accessible. - * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. - * - * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, - * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, - * which means that larger images will be downscaled for display on Echo Show if provided. - * example : - * let imgArr = [ - * { 'https://url/to/my/small.png', 300, 400, 'SMALL' }, - * { 'https://url/to/my/large.png', 900, 1200, 'LARGE' }, - * ] - * ImageUtils.makeImage(imgArr, 'image description') - * - * @static - * @param {{url : string, widthPixels : number, heightPixels : number, size : string}[]} imgArr - * @param {string} description text used to describe the image in a screen reader - * @returns - * @memberof ImageUtils - */ - public static makeImages(imgArr: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>, description: string): Image; + * Creates an image object with a multiple sources, source images are provided as an array of image objects + * These images may be in either JPEG or PNG formats, with the appropriate file extensions. + * An image cannot be larger than 2 MB + * You must host the images at HTTPS URLs that are publicly accessible. + * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. + * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, + * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, + * which means that larger images will be downscaled for display on Echo Show if provided. + * example : + * let imgArr = [ + * { 'https://url/to/my/small.png', 300, 400, 'SMALL' }, + * { 'https://url/to/my/large.png', 900, 1200, 'LARGE' }, + * ] + * ImageUtils.makeImage(imgArr, 'image description') + * + * @param imgArr Array of Image + * @param description text used to describe the image in a screen reader + * @returns Image + */ + function makeImages(imgArr: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>, description: string): Image; } /** * Utility methods for building TextField objects - * - * @class TextUtils */ - export class TextUtils { - + namespace TextUtils { /** * Creates a plain TextField object with contents : text - * - * @static - * @param {string} text contents of plain text object - * @returns - * @memberof TextUtils + * @param text contents of plain text object + * @returns TextField */ - public static makePlainText(text: string): TextField; + function makePlainText(text: string): TextField; /** * Creates a rich TextField object with contents : text - * - * @static - * @param {string} text - * @returns - * @memberof TextUtils + * @param text text + * @returns TextField */ - public static makeRichText(text: string): TextField; + function makeRichText(text: string): TextField; /** * Creates a textContent - * - * @static - * @param {{type : string, text : string}} primaryText - * @param {{type : string, text : string}} secondaryText - * @param {{type : string, text : string}} tertiaryText - * @returns - * @memberof TextUtils + * @param primaryText primary Text + * @param secondaryText secondary Text + * @param tertiaryText tertiary Text + * @returns TextContent */ - public static makeTextContent(primaryText: { type: string, text: string }, - secondaryText: { type: string, text: string }, tertiaryText: { type: string, text: string }): TextContent + function makeTextContent(primaryText: { type: string, text: string }, + secondaryText: { type: string, text: string }, tertiaryText: { type: string, text: string }): TextContent; } } //#endregion From 79261ec1db0240e80d9699e1f8113d60bc49f102 Mon Sep 17 00:00:00 2001 From: rbot <30998401+rk-7@users.noreply.github.com> Date: Thu, 23 Nov 2017 17:57:01 +0530 Subject: [PATCH 091/269] Updated Typescript version to 2.3 for the dependency i18next. --- types/alexa-sdk/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index e4ea78c104..5f4f9cf6ff 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -6,7 +6,7 @@ // Ben // rk-7 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 import { i18n } from "i18next"; export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; From 36e1028c2927efea58781478733e25349906d344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Thu, 23 Nov 2017 15:18:37 +0100 Subject: [PATCH 092/269] chart.js: Add missing 'aspectRatio' in ChartOptions --- types/chart.js/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index f4f4bda40d..049488f8db 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -159,6 +159,7 @@ declare namespace Chart { interface ChartOptions { responsive?: boolean; responsiveAnimationDuration?: number; + aspectRatio?: number; maintainAspectRatio?: boolean; events?: string[]; onClick?(event?: MouseEvent, activeElements?: Array<{}>): any; From 00cf286abb4b8842ba73f14e116404a2c24d5713 Mon Sep 17 00:00:00 2001 From: Sami Jaber Date: Thu, 23 Nov 2017 13:24:43 -0500 Subject: [PATCH 093/269] react-loadable - add types of new SSR features --- types/react-loadable/index.d.ts | 65 ++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/types/react-loadable/index.d.ts b/types/react-loadable/index.d.ts index 480ca7765f..f8b4d566c6 100644 --- a/types/react-loadable/index.d.ts +++ b/types/react-loadable/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-loadable 4.0 +// Type definitions for react-loadable 5.3 // Project: https://github.com/thejameskyle/react-loadable#readme // Definitions by: Diogo Franco , Oden S. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -36,6 +36,31 @@ export interface CommonOptions { * After the specified time in milliseconds passes, the component's `timedOut` prop will be set to true. */ timeout?: number | false | null; + + /** + * Optional array of module paths that `Loadable.Capture`'s `report` function will be applied on during + * server-side rendering. This helps the server know which modules were imported/used during SSR. + * ```ts + * Loadable({ + * loader: () => import('./my-component'), + * modules: ['./my-component'], + * }); + * ``` + */ + modules?: string[]; + + /** + * An optional function which returns an array of Webpack module ids which you can get + * with require.resolveWeak. This is used by the client (inside `Loadable.preloadReady`) to + * guarantee each webpack module is preloaded before the first client render. + * ```ts + * Loadable({ + * loader: () => import('./Foo'), + * webpack: () => [require.resolveWeak('./Foo')], + * }); + * ``` + */ + webpack?: () => number[]; } export interface OptionsWithoutRender extends CommonOptions { @@ -112,9 +137,47 @@ export interface LoadableComponent { preload(): void; } +export interface LoadableCaptureProps { + /** + * Function called for every moduleName that is rendered via React Loadable. + */ + report: (moduleName: string) => void; +} + export interface Loadable { (options: Options): React.ComponentType & LoadableComponent; Map(options: OptionsWithMap): React.ComponentType & LoadableComponent; + + /** + * This will call all of the LoadableComponent.preload methods recursively until they are all + * resolved. Allowing you to preload all of your dynamic modules in environments like the server. + * ```ts + * Loadable.preloadAll().then(() => { + * app.listen(3000, () => { + * console.log('Running on http://localhost:3000/'); + * }); + * }); + * ``` + */ + preloadAll(): Promise; + + /** + * Check for modules that are already loaded in the browser and call the matching + * `LoadableComponent.preload` methods. + * ```ts + * window.main = () => { + * Loadable.preloadReady().then(() => { + * ReactDOM.hydrate( + * , + * document.getElementById('app'), + * ); + * }); + * }; + * ``` + * */ + preloadReady(): Promise; + + Capture: React.ComponentType; } declare const LoadableExport: Loadable; From 054b82ad1616eab8efac26a27beaa1a2b7ea295e Mon Sep 17 00:00:00 2001 From: Sami Jaber Date: Thu, 23 Nov 2017 14:23:16 -0500 Subject: [PATCH 094/269] fix JSDoc formatting --- types/react-loadable/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-loadable/index.d.ts b/types/react-loadable/index.d.ts index f8b4d566c6..6220b23ea6 100644 --- a/types/react-loadable/index.d.ts +++ b/types/react-loadable/index.d.ts @@ -174,7 +174,7 @@ export interface Loadable { * }); * }; * ``` - * */ + */ preloadReady(): Promise; Capture: React.ComponentType; From c5174becbcb95abcf53c23d9f0e7ed0f0a58aad5 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 23 Nov 2017 14:51:55 -0500 Subject: [PATCH 095/269] Change dom.remove to include Element --- types/tinymce/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/tinymce/index.d.ts b/types/tinymce/index.d.ts index 65c33f4adb..3719b35784 100644 --- a/types/tinymce/index.d.ts +++ b/types/tinymce/index.d.ts @@ -826,7 +826,7 @@ export namespace dom { parseStyle(cssText: string): {}; - remove(node: string, keepChildren?: boolean): Element | T[]; + remove(node: string | Element, keepChildren?: boolean): Element | T[]; removeAllAttribs(e: Element): void; From e3e6a085dbc7c2d15e9e3c988c0241dd7038a12f Mon Sep 17 00:00:00 2001 From: Peter Blazejewicz Date: Thu, 23 Nov 2017 22:32:12 +0100 Subject: [PATCH 096/269] Update auth0-js RenewAuthOptions This commit adds: - documentation for existing interface options - missing options from current v.8 of Auth0 for RenewAuthOptions The documentation and missing fields are based on existing Auth0 documentation here: - https://git.io/vFxy3 - https://github.com/auth0/auth0.js/pull/572 Thanks! --- types/auth0-js/auth0-js-tests.ts | 4 ++- types/auth0-js/index.d.ts | 57 +++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/types/auth0-js/auth0-js-tests.ts b/types/auth0-js/auth0-js-tests.ts index 06d428de20..d425cca21a 100644 --- a/types/auth0-js/auth0-js-tests.ts +++ b/types/auth0-js/auth0-js-tests.ts @@ -109,7 +109,9 @@ webAuth.renewAuth({}, (err, authResult) => {}); webAuth.renewAuth({ nonce: '123', state: '456', - postMessageDataType: 'auth0:silent-authentication' + postMessageDataType: 'auth0:silent-authentication', + usePostMessage: true, + timeout: 30 * 1000 }, (err, authResult) => { // Renewed tokens or error }); diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index 76a2c5f319..b47898d871 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -667,17 +667,72 @@ export interface ParseHashOptions { } export interface RenewAuthOptions { + /** + * your Auth0 domain + */ domain?: string; + /** + * your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard + */ clientID?: string; + /** + * url that the Auth0 will redirect after Auth with the Authorization Response + */ redirectUri?: string; + /** + * type of the response used by OAuth 2.0 flow. It can be any space separated + * list of the values `code`, `token`, `id_token`. + * {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0} + */ responseType?: string; + /** + * how the Auth response is encoded and redirected back to the client. + * Supported values are `query`, `fragment` and `form_post`. + * The `query` value is only supported when `responseType` is `code`. + * {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes} + */ responseMode?: string; + /** + * value used to mitigate XSRF attacks. + * {@link https://auth0.com/docs/protocols/oauth2/oauth-state} + */ state?: string; + /** + * value used to mitigate replay attacks when using Implicit Grant. + * {@link https://auth0.com/docs/api-auth/tutorials/nonce} + */ nonce?: string; + /** + * scopes to be requested during Auth. e.g. `openid email` + */ scope?: string; + /** + * identifier of the resource server who will consume the access token issued after Auth + */ audience?: string; - usePostMessage?: boolean; + /** + * identifier data type to look for in postMessage event data, where events are initiated + * from silent callback urls, before accepting a message event is the event expected. + * A value of false means any postMessage event will trigger a callback. + */ postMessageDataType?: string; + /** + * origin of redirectUri to expect postMessage response from. + * Defaults to the origin of the receiving window. Only used if usePostMessage is truthy. + */ + postMessageOrigin?: string; + /** + * value in milliseconds used to timeout when the `/authorize` call is failing + * as part of the silent authentication with postmessage enabled due to a configuration. + */ + timeout?: number; + /** + * use postMessage to comunicate between the silent callback and the SPA. + * When false the SDK will attempt to parse the url hash should ignore the url hash + * and no extra behaviour is needed + * @default false + */ + usePostMessage?: boolean; } export interface AuthorizeOptions { From 8981174bc5ba89a4f36f774e6add0b527e43bc82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Thu, 23 Nov 2017 23:11:08 +0100 Subject: [PATCH 097/269] leaflet.heat TypeScript type definitions --- leaflet.heat/leaflet.heat-tests.ts | 38 ++++++++++++++++++++++++++++++ leaflet.heat/leaflet.heat.d.ts | 32 +++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 leaflet.heat/leaflet.heat-tests.ts create mode 100644 leaflet.heat/leaflet.heat.d.ts diff --git a/leaflet.heat/leaflet.heat-tests.ts b/leaflet.heat/leaflet.heat-tests.ts new file mode 100644 index 0000000000..2d5f86edfe --- /dev/null +++ b/leaflet.heat/leaflet.heat-tests.ts @@ -0,0 +1,38 @@ +/// +/// + +var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + osmAttrib = '© OpenStreetMap contributors', + osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}), + map = new L.Map('map', { + layers: [osm], + center: new L.LatLng(50.5, 30.5), + zoom: 15, + }); + +// Each point in the input array can be either an array like [50.5, 30.5, 0.5], or a Leaflet LatLng object. +var heat: L.HeatLayer = L.heatLayer([ + [50.5, 30.5, 0.2], // lat, lng, intensity + [50.6, 30.4, 0.5], + new L.LatLng(50.7, 30.3), +], {radius: 25}).addTo(map); + +// Set options on the heat layer +heat.setOptions({ + minOpacity: 0.05, + maxZoom: 18, + max: 1.0, + radius: 25, + blur: 15, + gradient: {0.4: 'blue', 0.65: 'lime', 1: 'red'}, +}); + +// Add new point to heat layer +var newLatLng = new L.LatLng(50.8, 30.2); +heat.addLatLng(newLatLng); + +// Set new latLng list to the heat layer +heat.setLatLngs([newLatLng, newLatLng, newLatLng, [50.6, 30.4, 0.5],]); + +// Redraw the heat layer +heat.redraw(); diff --git a/leaflet.heat/leaflet.heat.d.ts b/leaflet.heat/leaflet.heat.d.ts new file mode 100644 index 0000000000..4d80fb3fb4 --- /dev/null +++ b/leaflet.heat/leaflet.heat.d.ts @@ -0,0 +1,32 @@ +// Type definitions for Leaflet.heat v0.2.0 +// Project: https://github.com/Leaflet/Leaflet.heat +// Definitions by: Önder Ceylan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace L { + type HeatLatLngTuple = [number, number, number]; + + interface ColorGradientConfig { + [key: number]: string; + } + + interface HeatMapOptions { + minOpacity?: number; + maxZoom?: number; + max?: number; + radius?: number; + blur?: number; + gradient?: ColorGradientConfig; + } + + interface HeatLayer extends TileLayer { + setOptions?(options: HeatMapOptions): HeatLayer; + addLatLng?(latlng: LatLng | HeatLatLngTuple): HeatLayer; + setLatLngs?(latlngs: Array): HeatLayer; + redraw(): HeatLayer; + } + + function heatLayer(latlngs: Array, options: HeatMapOptions): HeatLayer; +} From 851c45d5bb2debd39343bb020699972e4f45cc46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Thu, 23 Nov 2017 23:20:59 +0100 Subject: [PATCH 098/269] Removed redraw() extension --- leaflet.heat/leaflet.heat.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/leaflet.heat/leaflet.heat.d.ts b/leaflet.heat/leaflet.heat.d.ts index 4d80fb3fb4..0fdc113ee9 100644 --- a/leaflet.heat/leaflet.heat.d.ts +++ b/leaflet.heat/leaflet.heat.d.ts @@ -25,7 +25,6 @@ declare namespace L { setOptions?(options: HeatMapOptions): HeatLayer; addLatLng?(latlng: LatLng | HeatLatLngTuple): HeatLayer; setLatLngs?(latlngs: Array): HeatLayer; - redraw(): HeatLayer; } function heatLayer(latlngs: Array, options: HeatMapOptions): HeatLayer; From 54ecabbe5e978c07ab8bc37afb623394d68186ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Fri, 24 Nov 2017 01:06:30 +0100 Subject: [PATCH 099/269] Restructured the files and added missing json configurations --- .../{leaflet.heat.d.ts => index.d.ts} | 0 leaflet.heat/leaflet.heat-tests.ts | 9 ++++--- leaflet.heat/tsconfig.json | 24 +++++++++++++++++++ leaflet.heat/tslint.json | 1 + 4 files changed, 29 insertions(+), 5 deletions(-) rename leaflet.heat/{leaflet.heat.d.ts => index.d.ts} (100%) create mode 100644 leaflet.heat/tsconfig.json create mode 100644 leaflet.heat/tslint.json diff --git a/leaflet.heat/leaflet.heat.d.ts b/leaflet.heat/index.d.ts similarity index 100% rename from leaflet.heat/leaflet.heat.d.ts rename to leaflet.heat/index.d.ts diff --git a/leaflet.heat/leaflet.heat-tests.ts b/leaflet.heat/leaflet.heat-tests.ts index 2d5f86edfe..7007bf0227 100644 --- a/leaflet.heat/leaflet.heat-tests.ts +++ b/leaflet.heat/leaflet.heat-tests.ts @@ -1,7 +1,6 @@ /// -/// - -var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', +/// +const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmAttrib = '© OpenStreetMap contributors', osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}), map = new L.Map('map', { @@ -11,7 +10,7 @@ var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', }); // Each point in the input array can be either an array like [50.5, 30.5, 0.5], or a Leaflet LatLng object. -var heat: L.HeatLayer = L.heatLayer([ +const heat: L.HeatLayer = L.heatLayer([ [50.5, 30.5, 0.2], // lat, lng, intensity [50.6, 30.4, 0.5], new L.LatLng(50.7, 30.3), @@ -28,7 +27,7 @@ heat.setOptions({ }); // Add new point to heat layer -var newLatLng = new L.LatLng(50.8, 30.2); +const newLatLng = new L.LatLng(50.8, 30.2); heat.addLatLng(newLatLng); // Set new latLng list to the heat layer diff --git a/leaflet.heat/tsconfig.json b/leaflet.heat/tsconfig.json new file mode 100644 index 0000000000..482c984b8c --- /dev/null +++ b/leaflet.heat/tsconfig.json @@ -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", + "leaflet.heat-tests.ts" + ] +} diff --git a/leaflet.heat/tslint.json b/leaflet.heat/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/leaflet.heat/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From dd5f686f91f704ae9c2318235c3ff38ff2c3bb4c Mon Sep 17 00:00:00 2001 From: noppoman Date: Fri, 24 Nov 2017 14:53:59 +0900 Subject: [PATCH 100/269] add constructor options of openDevTools to nightmare.js --- types/nightmare/index.d.ts | 9 ++++++++- types/nightmare/nightmare-tests.ts | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index 0796a0f8e1..7be47c2d30 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Nightmare 1.6.6 +// Type definitions for Nightmare 2.10.0 // Project: https://github.com/segmentio/nightmare // Definitions by: horiuchi // Sam Yang @@ -147,6 +147,13 @@ declare namespace Nightmare { typeInterval?: number; x?: number; y?: number; + openDevTools?: { + /** + * Opens the devtools with specified dock state, can be right, bottom, undocked, detach. + * https://github.com/electron/electron/blob/master/docs/api/web-contents.md#contentsopendevtoolsoptions + */ + mode?: string; + }; } export interface IRequest { diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index eea21ae84c..1dfe655c94 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -364,4 +364,6 @@ new Nightmare() new Nightmare() .goto('https://github.com/segmentio/nightmare') .click('a[href="/segmentio/nightmare/archive/master.zip"]') - .download('/some/other/path/master.zip'); \ No newline at end of file + .download('/some/other/path/master.zip'); + +new Nightmare({show: true, openDevTools: {mode: 'detach'}}); From c9fbcc97767c5dbab555db77b712685befab0ce9 Mon Sep 17 00:00:00 2001 From: ipv4sec Date: Fri, 24 Nov 2017 15:38:09 +0800 Subject: [PATCH 101/269] feat: add mapnik d.ts --- types/mapnik/index.d.ts | 49 ++++++++++++++++++++++++++++++++++++ types/mapnik/mapnik-tests.ts | 40 +++++++++++++++++++++++++++++ types/mapnik/tsconfig.json | 23 +++++++++++++++++ types/mapnik/tslint.json | 1 + 4 files changed, 113 insertions(+) create mode 100644 types/mapnik/index.d.ts create mode 100644 types/mapnik/mapnik-tests.ts create mode 100644 types/mapnik/tsconfig.json create mode 100644 types/mapnik/tslint.json diff --git a/types/mapnik/index.d.ts b/types/mapnik/index.d.ts new file mode 100644 index 0000000000..33b455f0dd --- /dev/null +++ b/types/mapnik/index.d.ts @@ -0,0 +1,49 @@ +// Type definitions for mapnik 3.x +// Project: http://mapnik.org +// Definitions by: Loli +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +export const settings: any; +export function register_default_fonts(): void; +export function register_default_input_plugins(): void; +export function register_datasource(path: string): void; +export class VectorTile { + constructor(z: number, x: number, y: number) + addDataSync(vectorTile: any): void; +} +export class Datasource { + constructor(datasource: any) + featureset(): Featureset; +} + +export class Featureset { + constructor() + next(): FeaturesetNext; +} +export class FeaturesetNext { + constructor() + toJSON(): string; +} + +export class Image { + constructor(x: number, y: number) + encode(type: string, callback?: (err: Error, buffer: Buffer) => void): void; + getData(): Buffer; +} + +export interface Image { + // constructor(x: number, y: number) + new(x: number, y: number): () => void; + encode(type: string, callback?: (err: Error, buffer: Buffer) => void): void; + getData(): Buffer; + save(fp: string): () => void; + open(fp: string): () => void; +} + +export class Map { + constructor(x: number, y: number) + load(xml: string, callback?: (err: Error, map: Map) => void): void; + zoomAll(): void; + render(images: Image | VectorTile , callback?: (err: Error, map: Image) => void): void; +} diff --git a/types/mapnik/mapnik-tests.ts b/types/mapnik/mapnik-tests.ts new file mode 100644 index 0000000000..23e726f111 --- /dev/null +++ b/types/mapnik/mapnik-tests.ts @@ -0,0 +1,40 @@ +import * as mapnik from "mapnik"; +import * as fs from "fs"; +import * as path from "path"; + +mapnik.register_default_fonts(); +mapnik.register_default_input_plugins(); + +const map: mapnik.Map = new mapnik.Map(256, 256); +map.load('./test/stylesheet.xml', function xx(err: Error, map: mapnik.Map) { + if (err) throw err; + map.zoomAll(); + const im: mapnik.Image = new mapnik.Image(256, 256); + map.render(im, function xxx(err: Error, im: mapnik.Image) { + if (err) throw err; + im.encode('png', function xxxx(err: Error, buffer: Buffer) { + if (err) throw err; + fs.writeFile('map.png', buffer, function xxxxx(err: Error) { + if (err) throw err; + console.log('saved map image to map.png'); + }); + }); + }); +}); + +// new mapnik.Image.open("xxx").save("xx"); + +mapnik.register_datasource(path.join(mapnik.settings.paths.input_plugins, 'shape.input')); +const ds: mapnik.Datasource = new mapnik.Datasource({type: 'shape', file: 'test/data/world_merc.shp'}); +const featureset: mapnik.Featureset = ds.featureset(); +const geojson: any = { + type: "FeatureCollection", + features: [ + ] +}; +let feat: mapnik.FeaturesetNext = featureset.next(); +while (feat) { + geojson.features.push(JSON.parse(feat.toJSON())); + feat = featureset.next(); +} +fs.writeFileSync("output.geojson", JSON.stringify(geojson, null, 2)); diff --git a/types/mapnik/tsconfig.json b/types/mapnik/tsconfig.json new file mode 100644 index 0000000000..81f111a37e --- /dev/null +++ b/types/mapnik/tsconfig.json @@ -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", + "mapnik-tests.ts" + ] +} \ No newline at end of file diff --git a/types/mapnik/tslint.json b/types/mapnik/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/mapnik/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file From c1aa9c5c5013f8970112c5188f5e0eab888a4bec Mon Sep 17 00:00:00 2001 From: ChenX Date: Fri, 24 Nov 2017 16:52:53 +0800 Subject: [PATCH 102/269] update Geometry functions --- types/three/three-core.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 5ea903080b..63a1e1cb38 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -1369,6 +1369,8 @@ export class Geometry extends EventDispatcher { */ mergeVertices(): number; + setFromPoints(points: Array | Array): this; + sortFacesByMaterialIndex(): void; toJSON(): any; From ba40bebaf245a4f6cf51f30855e8a35d40460c20 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Fri, 24 Nov 2017 18:18:17 +0900 Subject: [PATCH 103/269] feat: add new configurations --- types/react-swipeable/index.d.ts | 39 ++++++++++--------- .../react-swipeable/react-swipeable-tests.tsx | 2 + types/react-swipeable/tsconfig.json | 6 +-- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/types/react-swipeable/index.d.ts b/types/react-swipeable/index.d.ts index b0036ae119..496f0500cf 100644 --- a/types/react-swipeable/index.d.ts +++ b/types/react-swipeable/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for react-swipeable 4.0 +// Type definitions for react-swipeable 4.2 // Project: https://www.npmjs.com/package/react-swipeable // Definitions by: Giedrius Grabauskas // Konstantin Vasilev +// Hiroki Horiuchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -10,30 +11,32 @@ import * as React from 'react'; declare class ReactSwipeable extends React.Component {} declare namespace ReactSwipeable { - type OnSwipingCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void; - type OnSwipedCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, isFlick: boolean, velocity: number) => void; - type OnSwipedDirectionCallback = (event: React.TouchEvent, delta: number, isFlick: boolean) => void; - type OnSwipingDirectionCallback = (event: React.TouchEvent, delta: number) => void; - type OnTapCallback = (event: React.TouchEvent) => void; + type OnSwipingCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void; + type OnSwipedCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, isFlick: boolean, velocity: number) => void; + type OnSwipedDirectionCallback = (event: React.TouchEvent, delta: number, isFlick: boolean) => void; + type OnSwipingDirectionCallback = (event: React.TouchEvent, delta: number) => void; + type OnTapCallback = (event: React.TouchEvent) => void; - interface SwipeableProps extends React.ClassAttributes, React.HTMLAttributes { - onSwiped?: OnSwipedCallback; - onSwiping?: OnSwipingCallback; - onSwipingUp?: OnSwipingDirectionCallback; - onSwipingRight?: OnSwipingDirectionCallback; - onSwipingDown?: OnSwipingDirectionCallback; - onSwipingLeft?: OnSwipingDirectionCallback; - onSwipedUp?: OnSwipedDirectionCallback; - onSwipedRight?: OnSwipedDirectionCallback; - onSwipedDown?: OnSwipedDirectionCallback; - onSwipedLeft?: OnSwipedDirectionCallback; - onTap?: OnTapCallback; + interface SwipeableProps extends React.ClassAttributes, React.HTMLAttributes { + onSwiped?: OnSwipedCallback; + onSwiping?: OnSwipingCallback; + onSwipingUp?: OnSwipingDirectionCallback; + onSwipingRight?: OnSwipingDirectionCallback; + onSwipingDown?: OnSwipingDirectionCallback; + onSwipingLeft?: OnSwipingDirectionCallback; + onSwipedUp?: OnSwipedDirectionCallback; + onSwipedRight?: OnSwipedDirectionCallback; + onSwipedDown?: OnSwipedDirectionCallback; + onSwipedLeft?: OnSwipedDirectionCallback; + onTap?: OnTapCallback; flickThreshold?: number; delta?: number; preventDefaultTouchmoveEvent?: boolean; stopPropagation?: boolean; nodeName?: string; trackMouse?: boolean; + disabled?: boolean; + innerRef?: React.Ref; children?: React.ReactNode; } } diff --git a/types/react-swipeable/react-swipeable-tests.tsx b/types/react-swipeable/react-swipeable-tests.tsx index 61093a203e..4fa67abffa 100644 --- a/types/react-swipeable/react-swipeable-tests.tsx +++ b/types/react-swipeable/react-swipeable-tests.tsx @@ -35,6 +35,8 @@ class SampleComponent extends React.PureComponent { stopPropagation nodeName="swipe" trackMouse + disabled + innerRef="swipe-ref" onClick={this.handleClick} >
diff --git a/types/react-swipeable/tsconfig.json b/types/react-swipeable/tsconfig.json index 0d676ade9b..a720949edf 100644 --- a/types/react-swipeable/tsconfig.json +++ b/types/react-swipeable/tsconfig.json @@ -6,8 +6,8 @@ "dom" ], "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -22,4 +22,4 @@ "index.d.ts", "react-swipeable-tests.tsx" ] -} \ No newline at end of file +} From 713261fb718e5175ad7b0fe87d98ca732057414f Mon Sep 17 00:00:00 2001 From: rbot <30998401+rk-7@users.noreply.github.com> Date: Fri, 24 Nov 2017 18:12:39 +0530 Subject: [PATCH 104/269] Fixing Travis issues. Reverting TypeScript version: 2.2. Updated Context interface. Since aws-lambda-mock-context depends on this (alexa-sdk) which has lower typescript version but alexa-sdk should ideally depend on i18next which has higher TS version. Removing i18next from "alexa-sdk" --- types/alexa-sdk/index.d.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 5f4f9cf6ff..a9c630269f 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -6,8 +6,8 @@ // Ben // rk-7 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 -import { i18n } from "i18next"; +// TypeScript Version: 2.2 + export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; export let StateString: string; @@ -91,7 +91,7 @@ export interface Handler { emitWithState: any; state: any; handler: any; - i18n: i18n; + i18n: any; locale: any; event: RequestBody; attributes: any; @@ -104,8 +104,16 @@ export interface Handler { } export interface Context { - System: System; - AudioPlayer: AudioPlayer; + callbackWaitsForEmptyEventLoop: boolean; + logGroupName: string; + logStreamName: string; + functionName: string; + memoryLimitInMB: string; + functionVersion: string; + invokeid: string; + awsRequestId: string; + System?: System; + AudioPlayer?: AudioPlayer; } export interface Application { applicationId: string; From 45ff477173a281ddea1f2028f537806341850412 Mon Sep 17 00:00:00 2001 From: Neal Stewart Date: Fri, 24 Nov 2017 11:20:20 +0100 Subject: [PATCH 105/269] Extend MeasuredComponenttProps with type passed to withContentType --- types/react-measure/index.d.ts | 12 ++++--- types/react-measure/react-measure-tests.tsx | 35 ++++++++++++++++++--- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/types/react-measure/index.d.ts b/types/react-measure/index.d.ts index 6a06a04d37..945a49213a 100644 --- a/types/react-measure/index.d.ts +++ b/types/react-measure/index.d.ts @@ -6,7 +6,7 @@ import * as React from "react"; -type MeasurementType = "client" | "offset" | "scroll" | "bounds" | "margin"; +export type MeasurementType = "client" | "offset" | "scroll" | "bounds" | "margin"; interface TopLeft { readonly top: number; @@ -38,12 +38,14 @@ export interface ContentRect { entry?: any; } -export interface ChildrenOpts { +export interface MeasuredComponentProps { measureRef(ref: Element | null): void; measure(): void; contentRect: ContentRect; } +type MeasuredComponent = React.ComponentType; + export interface MeasureProps { client?: boolean; offset?: boolean; @@ -52,9 +54,11 @@ export interface MeasureProps { margin?: boolean; innerRef?(ref: Element | null): void; onResize?(contentRect: ContentRect): void; - children?(arg: ChildrenOpts): React.ReactElement; + children?: React.SFC; } -export declare function withContentRect(types: MeasurementType | MeasurementType[]): (fn: (arg: ChildrenOpts) => React.ReactElement) => React.ComponentClass; +export declare function withContentRect(types: ReadonlyArray | MeasurementType): + (fn: MeasuredComponent) => React.ComponentType; + declare class Measure extends React.Component> {} export default Measure; diff --git a/types/react-measure/react-measure-tests.tsx b/types/react-measure/react-measure-tests.tsx index b467fd8caa..1e58ecbbbe 100644 --- a/types/react-measure/react-measure-tests.tsx +++ b/types/react-measure/react-measure-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import Measure, { ContentRect, withContentRect } from "react-measure"; +import Measure, { ContentRect, withContentRect, MeasuredComponentProps, MeasurementType } from "react-measure"; class Test extends React.Component { render() { @@ -63,7 +63,26 @@ class Test2 extends React.Component { } } -function testHocComponent(): React.ComponentClass { +interface Props { + a: string; +} + +const TestFunctionalComponentWithProps: React.SFC = ({a, contentRect, measureRef}) => { + return ( +
{a}
+ ); +}; + +class TestClassComponentWithProps extends React.Component { + render() { + const {a, contentRect, measureRef} = this.props; + return ( +
{a}
+ ); + } +} + +function testHocComponent() { return withContentRect('bounds')(({measureRef, measure, contentRect}) => (
Some content here @@ -74,11 +93,17 @@ function testHocComponent(): React.ComponentClass { )); } -function testHocComponent2(): React.ComponentClass { - return withContentRect(['scroll', 'margin'])(({measureRef}) => ( +function testHocComponent2() { + return withContentRect(['scroll', 'margin'] as ReadonlyArray)(({measureRef}) => (
Some content here
)); } const HocComponent = testHocComponent(); -const el = ; +const el = ; + +const MeasuredFunctionalComponent = withContentRect('bounds')(TestFunctionalComponentWithProps); +const funcEl = ; + +const MeasuredClassComponent = withContentRect('bounds')(TestClassComponentWithProps); +const classEl = ; From cf5d3756ce7479dabdab00545ae06330b88be7fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Fri, 24 Nov 2017 15:46:18 +0100 Subject: [PATCH 106/269] Moved the files under types folder --- {leaflet.heat => types/leaflet.heat}/index.d.ts | 0 {leaflet.heat => types/leaflet.heat}/leaflet.heat-tests.ts | 0 {leaflet.heat => types/leaflet.heat}/tsconfig.json | 0 {leaflet.heat => types/leaflet.heat}/tslint.json | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {leaflet.heat => types/leaflet.heat}/index.d.ts (100%) rename {leaflet.heat => types/leaflet.heat}/leaflet.heat-tests.ts (100%) rename {leaflet.heat => types/leaflet.heat}/tsconfig.json (100%) rename {leaflet.heat => types/leaflet.heat}/tslint.json (100%) diff --git a/leaflet.heat/index.d.ts b/types/leaflet.heat/index.d.ts similarity index 100% rename from leaflet.heat/index.d.ts rename to types/leaflet.heat/index.d.ts diff --git a/leaflet.heat/leaflet.heat-tests.ts b/types/leaflet.heat/leaflet.heat-tests.ts similarity index 100% rename from leaflet.heat/leaflet.heat-tests.ts rename to types/leaflet.heat/leaflet.heat-tests.ts diff --git a/leaflet.heat/tsconfig.json b/types/leaflet.heat/tsconfig.json similarity index 100% rename from leaflet.heat/tsconfig.json rename to types/leaflet.heat/tsconfig.json diff --git a/leaflet.heat/tslint.json b/types/leaflet.heat/tslint.json similarity index 100% rename from leaflet.heat/tslint.json rename to types/leaflet.heat/tslint.json From 75dd3af6069b42c34c51d5cc18285b58308e53a8 Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Fri, 24 Nov 2017 16:31:47 +0000 Subject: [PATCH 107/269] [chai] added missing include methods to Assert --- types/chai/chai-tests.ts | 50 +++++++++++++++ types/chai/index.d.ts | 135 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 184 insertions(+), 1 deletion(-) diff --git a/types/chai/chai-tests.ts b/types/chai/chai-tests.ts index 0076396422..401e5f468a 100644 --- a/types/chai/chai-tests.ts +++ b/types/chai/chai-tests.ts @@ -1357,6 +1357,56 @@ suite('assert', () => { assert.notInclude(undefined, 'bar'); }); + test('deepInclude', () => { + assert.deepInclude('foobar', 'bar'); + assert.deepInclude([1, 2, 3], 3); + assert.deepInclude('foobar', 'baz'); + assert.deepInclude(undefined, 'bar'); + }); + + test('notDeepInclude', () => { + assert.notDeepInclude('foobar', 'baz'); + assert.notDeepInclude([1, 2, 3], 4); + assert.notDeepInclude('foobar', 'bar'); + assert.notDeepInclude(undefined, 'bar'); + }); + + test('nestedInclude', () => { + assert.nestedInclude({'.a': {'b': 'x'}}, {'\\.a.[b]': 'x'}); + assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'}); + }); + + test('notNestedInclude', () => { + assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\.a.b': 'y'}); + assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'}); + }); + + test('deepNestedInclude', () => { + assert.deepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {x: 1}}); + assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}}); + }); + + test('notDeepNestedInclude', () => { + assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}}) + assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}}); + }); + + test('ownInclude', () => { + assert.ownInclude({ a: 1 }, { a: 1 }); + }); + + test('notOwnInclude', () => { + assert.notOwnInclude({ a: 1 }, { a: 1 }); + }); + + test('deepOwnInclude', () => { + assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}}); + }); + + test('notDeepOwnInclude', () => { + assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}}); + }); + test('lengthOf', () => { assert.lengthOf([1, 2, 3], 3); assert.lengthOf('foobar', 6); diff --git a/types/chai/index.d.ts b/types/chai/index.d.ts index 340d69f7cd..faafa3b2a8 100644 --- a/types/chai/index.d.ts +++ b/types/chai/index.d.ts @@ -7,6 +7,7 @@ // Matt Wistrand , // Josh Goldberg // Shaun Luttin +// Gintautas Miselis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // @@ -706,13 +707,145 @@ declare namespace Chai { /** * Asserts that haystack does not include needle. * - * @type T Type of values in haystack. * @param haystack Container array. * @param needle Potential value contained in haystack. * @param message Message to display on error. */ notInclude(haystack: any[], needle: any, message?: string): void; + + /** + * Asserts that haystack includes needle. Can be used to assert the inclusion of a value in an array or a subset of properties in an object. Deep equality is used. + * + * @param haystack Container string. + * @param needle Potential expected substring of haystack. + * @param message Message to display on error. + */ + deepInclude(haystack: string, needle: string, message?: string): void; + + /** + * Asserts that haystack includes needle. Can be used to assert the inclusion of a value in an array or a subset of properties in an object. Deep equality is used. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + deepInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that haystack does not include needle. Can be used to assert the absence of a value in an array or a subset of properties in an object. Deep equality is used. + * + * @param haystack Container string. + * @param needle Potential expected substring of haystack. + * @param message Message to display on error. + */ + notDeepInclude(haystack: string, needle: any, message?: string): void; + + /** + * Asserts that haystack does not include needle. Can be used to assert the absence of a value in an array or a subset of properties in an object. Deep equality is used. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notDeepInclude(haystack: any[], needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + nestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object. + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notNestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while checking for deep equality + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + deepNestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object while checking for deep equality. + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notDeepNestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + ownInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notOwnInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties and checking for deep + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + deepOwnInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties and checking for deep equality. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notDeepOwnInclude(haystack: any, needle: any, message?: string): void; + /** * Asserts that value matches the regular expression regexp. * From 9c46bbbdb2f4808b4e6ca28f1de8acd282522b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Fri, 24 Nov 2017 18:26:14 +0100 Subject: [PATCH 108/269] Fixed references to main leaflet definition --- types/leaflet.heat/index.d.ts | 2 +- types/leaflet.heat/leaflet.heat-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/leaflet.heat/index.d.ts b/types/leaflet.heat/index.d.ts index 0fdc113ee9..c58921046a 100644 --- a/types/leaflet.heat/index.d.ts +++ b/types/leaflet.heat/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Önder Ceylan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// declare namespace L { type HeatLatLngTuple = [number, number, number]; diff --git a/types/leaflet.heat/leaflet.heat-tests.ts b/types/leaflet.heat/leaflet.heat-tests.ts index 7007bf0227..0e7a33fa50 100644 --- a/types/leaflet.heat/leaflet.heat-tests.ts +++ b/types/leaflet.heat/leaflet.heat-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmAttrib = '© OpenStreetMap contributors', From 05003fe74b33b8b6216ebd2e8a5750208cce0c07 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 24 Nov 2017 13:15:12 -0800 Subject: [PATCH 109/269] Stubbed Node and removed --lib dom from highlight.js --- types/highlight.js/index.d.ts | 6 +++++- types/highlight.js/tsconfig.json | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/highlight.js/index.d.ts b/types/highlight.js/index.d.ts index d691811b47..f96be1c06f 100644 --- a/types/highlight.js/index.d.ts +++ b/types/highlight.js/index.d.ts @@ -1,10 +1,14 @@ // Type definitions for highlight.js v9.12 // Project: https://github.com/isagalaev/highlight.js -// Definitions by: Niklas Mollenhauer , Jeremy Hull +// Definitions by: Niklas Mollenhauer +// Jeremy Hull +// Josh Goldberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace hljs { + interface Node { } + export function highlight( name: string, value: string, diff --git a/types/highlight.js/tsconfig.json b/types/highlight.js/tsconfig.json index 5f5d2ae011..e3627e99ca 100644 --- a/types/highlight.js/tsconfig.json +++ b/types/highlight.js/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, From 6c0d935374856d65c74627775e52d552a26768e8 Mon Sep 17 00:00:00 2001 From: CBoland Date: Fri, 24 Nov 2017 14:45:00 -0600 Subject: [PATCH 110/269] Updated datatables.net for 1.10.10 Release Notes: https://cdn.datatables.net/1.10.10/ * Created a type for static column render functions. * Implemented $.fn.dataTable.render.text per release notes. * Implemented language.aria.paginate per release notes. * Added test/sample for handling column-visibility event with new parameter. * Implemented order.fixed() method per release notes. --- types/datatables.net/datatables.net-tests.ts | 32 ++++++++- types/datatables.net/index.d.ts | 71 +++++++++++++++++++- 2 files changed, 100 insertions(+), 3 deletions(-) diff --git a/types/datatables.net/datatables.net-tests.ts b/types/datatables.net/datatables.net-tests.ts index af722ab74f..e5cb5184fd 100644 --- a/types/datatables.net/datatables.net-tests.ts +++ b/types/datatables.net/datatables.net-tests.ts @@ -21,7 +21,13 @@ const lang: DataTables.LanguageSettings = { }, aria: { sortAscending: ": activate to sort column ascending", - sortDescending: ": activate to sort column descending" + sortDescending: ": activate to sort column descending", + paginate: { + first: "First", + last: "Last", + next: "Next", + previous: "Previous" + } } }; @@ -98,6 +104,7 @@ let col: DataTables.ColumnSettings = { orderable: true, orderData: 10, orderDataType: "dom-checkbox", + orderFixed: [[0, 'asc'], [1, 'desc']], orderSequence: ['asc', 'desc'], render: 1, searchable: true, @@ -118,6 +125,20 @@ col = { data: colDataFunc, render: colRenderFunc, }; +col = { + data: "salary", + render: $.fn.dataTable.render.number('\'', '.', 0, '$'), +}; +col = { + data: "url", + render: $.fn.dataTable.render.text(), +}; +col = { + orderFixed: { + pre: [[0, 'asc'], [1, 'desc']], + post: [[0, 'asc'], [1, 'desc']] + } +}; //#endregion "Column" @@ -135,6 +156,7 @@ let colDef: DataTables.ColumnDefsSettings = { orderable: true, orderData: 10, orderDataType: "dom-checkbox", + orderFixed: [[0, 'asc'], [1, 'desc']], orderSequence: ['asc', 'desc'], render: 1, searchable: true, @@ -353,6 +375,9 @@ let order_set = dt.order([0, "asc"]); order_set = dt.order([0, "asc"], [1, "desc"]); // TODO: Fíx that order_set = dt.order([[0, "asc"], [1, "desc"]]); +const fixed_get: DataTables.ObjectOrderFixed = dt.order.fixed(); +const fixed_set: DataTables.Api = dt.order.fixed({pre: [0, "asc"], post: [1, "desc"]}); + const orderListerner = order_set.order.listener("node", 1, () => { }); const page_get = dt.page(); @@ -791,6 +816,11 @@ dt.columns.adjust().draw(false); // adjust column sizing and redraw dt.columns().every(() => { }); dt.columns().every((colIdx, tableLoop, colLoop) => { }); +$('#example').on('column-visibility.dt', (e: object, settings: DataTables.Settings, column: number, state: boolean, recalc: boolean | undefined) => { + const widthRecalced = (recalc || recalc === undefined); + console.log(`Column ${column} has changed to ${(state ? 'visible' : 'hidden')} and width ${(widthRecalced) ? 'was' : 'was not'} recalculated.`); +}); + //#endregion "Methods-Column" //#region "Methods-Row" diff --git a/types/datatables.net/index.d.ts b/types/datatables.net/index.d.ts index 7cd4b8589b..cdddc98789 100644 --- a/types/datatables.net/index.d.ts +++ b/types/datatables.net/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for JQuery DataTables 1.10 // Project: http://www.datatables.net -// Definitions by: Kiarash Ghiaseddin , Omid Rad , Armin Sander +// Definitions by: Kiarash Ghiaseddin +// Omid Rad +// Armin Sander +// Craig Boland // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -329,6 +332,16 @@ declare namespace DataTables { (order?: Array<(string | number)> | Array>): Api; (order: Array<(string | number)>, ...args: any[]): Api; + /** + * Get the fixed ordering that is applied to the table. If there is more than one table in the API's context, + * the ordering of the first table will be returned only (use table() if you require the ordering of a different table in the API's context). + */ + fixed(): ObjectOrderFixed; + /** + * Set the table's fixed ordering. Note this doesn't actually perform the order, but rather queues it up - use draw() to perform the ordering. + */ + fixed(order: ObjectOrderFixed): Api; + /** * Add an ordering listener to an element, for a given column. * @@ -1085,6 +1098,14 @@ declare namespace DataTables { */ isDataTable(table: string): boolean; + /** + * Helpers for `columns.render`. + * + * The options defined here can be used with the `columns.render` initialisation + * option to provide a display renderer. + */ + render: StaticRenderFunctions; + /** * Get all DataTable tables that have been initialised - optionally you can select to get only currently visible tables and / or retrieve the tables as API instances. * @@ -1125,6 +1146,42 @@ declare namespace DataTables { ext: ExtSettings; } + interface ObjectColumnRender { + display(d?: number | string | object): string | object; + } + + interface ObjectOrderFixed { + /** + * Two-element array: + * 0: Column index to order upon. + * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order). + */ + pre?: any[]; + /** + * Two-element array: + * 0: Column index to order upon. + * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order). + */ + post?: any[]; + } + + interface StaticRenderFunctions { + /** + * Will format numeric data (defined by `columns.data`) for display, retaining the original unformatted data for sorting and filtering. + * + * @param thousands Thousands grouping separator. + * @param decimal Decimal point indicator. + * @param precision Integer number of decimal points to show. + * @param prefix Prefix (optional). + * @param postfix Postfix (/suffix) (optional). + */ + number(thousands: string, decimal: string, precision: number, prefix?: string, postfix?: string): ObjectColumnRender; + /** + * Escape HTML to help prevent XSS attacks. It has no optional parameters. + */ + text(): ObjectColumnRender; + } + interface StaticUtilFunctions { /** * Escape special characters in a regular expression string. Since: 1.10.4 @@ -1563,6 +1620,15 @@ declare namespace DataTables { */ orderDataType?: string; + /** + * Ordering to always be applied to the table. Since 1.10 + * + * Array type is prefix ordering only and is a two-element array: + * 0: Column index to order upon. + * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order). + */ + orderFixed?: any[] | ObjectOrderFixed; + /** * Order direction application sequence. Since: 1.10 */ @@ -1571,7 +1637,7 @@ declare namespace DataTables { /** * Render (process) the data for use in the table. Since: 1.10 */ - render?: number | string | ObjectColumnData | FunctionColumnRender; + render?: number | string | ObjectColumnData | FunctionColumnRender | ObjectColumnRender; /** * Enable or disable filtering on the data in this column. Since: 1.10 @@ -1727,6 +1793,7 @@ declare namespace DataTables { interface LanguageAriaSettings { sortAscending: string; sortDescending: string; + paginate?: LanguagePaginateSettings; } //#endregion "language-settings" From c576d719249614327516c3369c1d71475b8c5b08 Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Fri, 24 Nov 2017 19:44:54 -0500 Subject: [PATCH 111/269] v9 Compatibility Modified to handle deprecations and have comments that give directions to the sdk webpage. Added XrmEnum constants for ease of use. --- types/xrm/index.d.ts | 4596 ++++++++++++++++++++++++------------------ 1 file changed, 2619 insertions(+), 1977 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 31bdd6776a..93a09dc19a 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -7,16 +7,28 @@ // Tully H // Scott Durow // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 declare var Xrm: Xrm.XrmStatic; -declare function GetGlobalContext(): Xrm.Context; + +/** + * Gets the global context. + * The method provides access to the global context without going through the form context. + * + * It is preferreed to use {@link Xrm.Utility.getGlobalContext Xrm.Utility.getGlobalContext()} instead. + * @see Xrm.Utility.getGlobalContext + */ +declare function GetGlobalContext(): Xrm.GlobalContext; interface Window { Xrm: Xrm.XrmStatic; - GetGlobalContext(): Xrm.Context; + GetGlobalContext(): Xrm.GlobalContext; } +/** + * Xrm Namespace + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference External Link: Client API Reference} + */ declare namespace Xrm { /** * Static xRM object. @@ -24,7 +36,8 @@ declare namespace Xrm { interface XrmStatic { /** * Provides a namespace container for the context, data and ui objects. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ Page: Page; @@ -34,55 +47,89 @@ declare namespace Xrm { /** * Provides a container for useful functions not directly related to the current page. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility External Link: Xrm.Utility (Client API reference)} */ Utility: Utility; /** * Provides methods to create and manage records in the mobile clients (for phones tablets). + * @deprecated Use {@link Xrm.WebApi} instead. */ Mobile: Mobile; /** * Provides methods to display a web page in the side pane of web client. * - * @see {@link https://msdn.microsoft.com/en-us/library/mt790281.aspx} for details. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-panel External Link: Xrm.Panel} */ Panel: Panel; /** * Provides properties and methods to use Web API to create and manage records and execute Web API actions and functions in Customer Engagement. * - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi External Link: Xrm.WebApi (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/use-microsoft-dynamics-365-web-api External Link: Use the Customer Engagement Web API} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/get-started-web-api-client-side-javascript Get started with the Customer Engagement Web API (client-side JavaScript)} */ WebApi: WebApi; /** * Provides methods to use native device capabilities of mobile devices. * - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device External Link: Xrm.Device (Client API reference)} */ Device: Device; /** * Provides methods to encode strings. * - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-encoding} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-encoding External Link: Xrm.Encoding (Client API reference)} */ Encoding: Encoding; } /** - * Client Types for Xrm.Page.context.getClient(). + * Client Types for {@link GlobalContext.getClient globalContext.getClient()}. + * @see XrmEnum.Client */ - type Client = "Web" | "Outlook" | "Mobile"; + type Client = "Web" | "Outlook" | "Mobile" | "UnifiedServiceDesk"; /** - * Client States for Xrm.Page.context.getClientState(). + * Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. + * @see XrmEnum.ClientState */ type ClientState = "Online" | "Offline"; /** - * Themes for Xrm.Page.context.getCurrentTheme(). + * Display States for setDisplayState() on {@link Controls.ProcessControl.setDisplayState Processes} and {@link Controls.Tab.setDisplayState Tabs}. + * @see XrmEnum.DisplayState + */ + type DisplayState = "collapsed" | "expanded"; + + /** + * The {@link Entity.save Entity}'s Save Mode + * @see XrmEnum.EntitySaveMode + * @see Entity + * @see Entity.save + */ + type EntitySaveMode = "saveandclose" | "saveandnew"; + + /** + * Form Notification Levels for {@link Ui.setFormNotification formContext.ui.setFormNotification()}. + * @see XrmEnum.FormNotificationLevel + */ + type FormNotificationLevel = "ERROR" | "INFO" | "WARNING"; + + /** + * Submit Mode for {@link Attributes.Attribute.setSubmitMode} Attributes.Attribute.setSubmitMode(). + * @see XrmEnum.SubmitMode + */ + type SubmitMode = "always" | "dirty" | "never"; + + /** + * Themes for {@link GlobalContext.getCurrentTheme globalContext.getCurrentTheme()}. + * Note: getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. + * @see XrmEnum.Theme */ type Theme = "default" | "Office12Blue" | "Office14Silver"; @@ -92,15 +139,13 @@ declare namespace Xrm { interface ClientContext { /** * Returns a value to indicate which client the script is executing in. - * - * @return The client, as either "Web", "Outlook", or "Mobile" + * @returns The client, as either "Web", "Outlook", or "Mobile" */ getClient(): Client; /** * Gets client's current state. - * - * @return The client state, as either "Online" or "Offline" + * @returns The client state, as either "Online" or "Offline" */ getClientState(): ClientState; @@ -266,8 +311,9 @@ declare namespace Xrm { /** * Interface for the xRM application context. + * GetGlobalContext() */ - interface Context { + interface GlobalContext { /** * The client's context instance. */ @@ -285,16 +331,17 @@ declare namespace Xrm { /** * Returns information about the advanced configuration settings for the organization. - * @param setting Name of the configuration setting. + * @param setting Name of the configuration setting. + * @see XrmEnum.AdvancedConfigSettingOption */ getAdvancedConfigSetting(setting: "MaxChildIncidentNumber" | "MaxIncidentMergeNumber"): number; /** * Gets client's base URL for Dynamics CRM * - * @return The client's base URL + * @returns The client's base URL * - * @remarks For Dynamics CRM On-Premises: http(s)://server/org + * @example For Dynamics CRM On-Premises: http(s)://server/org * For Dynamics CRM Online: https://org.crm.dynamics.com * For Dynamics CRM for Outlook (Offline): http://localhost:2525 */ @@ -310,93 +357,103 @@ declare namespace Xrm { */ getCurrentAppProperties(): Async.PromiseLike; + /** + * Returns the URL of the current business app in Customer Engagement. + * @example Online https://[org].crm.dynamics.com/main.aspx?appid=[GUID] + * OnPrem https://[server]/[org]/main.aspx?appid=[GUID] + * @returns A string containing the url of the current business app. + */ + getCurrentAppUrl(): string; + /** * Gets current styling theme. - * - * @return The name of the current theme, as either "default", "Office12Blue", or "Office14Silver" - * - * @remarks This function does not work with Dynamics CRM for tablets. + * Note: This function does not work with Dynamics CRM for tablets or in the unified interface. + * @returns The name of the current theme, as either "default", "Office12Blue", or "Office14Silver" */ getCurrentTheme(): Theme; /** * Gets whether automatic save is enabled. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return true if automatic saving is enabled, otherwise false. + * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.isAutoSaveEnabled globalContext.organizationSettings.isAutoSaveEnabled} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns true if automatic saving is enabled, otherwise false. */ getIsAutoSaveEnabled(): boolean; /** * Gets organization's LCID (language code). - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return The organization language code. - * - * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx|Microsoft Locale ID Values} + * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.languageId globalContext.organizationSettings.languageId} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns The organization language code. + * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx External Link: Microsoft Locale ID Values} */ getOrgLcid(): number; /** * Gets organization's unique name. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return The organization's unique name. * - * @remarks This value can be found on the Developer Resources page within Dynamics CRM + * Note: This value can be found on the Developer Resources page within Dynamics CRM. + * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.uniqueName} globalContext.organizationSettings.uniqueName instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns The organization's unique name. */ getOrgUniqueName(): string; /** * Gets query string parameters. - * - * @return The query string parameters, in a dictionary object representing name and value pairs. - * @deprecated: Deprecated in v9 (Still applicable in Web Client). See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @returns The query string parameters, in a dictionary object representing name and value pairs. + * @deprecated Deprecated in v9 (Still applicable in Web Client). + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ getQueryStringParameters(): { [index: string]: any }; /** * Returns the difference between the local time and Coordinated Universal Time (UTC). * - * @return The time zone offset, in minutes. + * @returns The time zone offset, in minutes. */ getTimeZoneOffsetMinutes(): number; /** * Gets user's unique identifier. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return The user's identifier in Guid format. - * - * @remarks Example: "{B05EC7CE-5D51-DF11-97E0-00155DB232D0}" + * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.userId globalContext.userSettings.userId} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns The user's identifier in Guid format. + * @example Example: "{B05EC7CE-5D51-DF11-97E0-00155DB232D0}" */ getUserId(): string; /** * Gets user's LCID (language code). - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return The user's language code. + * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.languageId globalContext.userSetings.languageId} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns The user's language code. * - * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx|Microsoft Locale ID Values} + * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx External Link: Microsoft Locale ID Values} */ getUserLcid(): number; /** * Gets the name of the current user. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return The user's name. + * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.userName globalContext.userSettings.userName} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns The user's name. */ getUserName(): string; /** * Gets all user security roles. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @return An array of user role identifiers, in Guid format. - * - * @remarks Example: ["cf4cc7ce-5d51-df11-97e0-00155db232d0"] + * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.securityRoles globalContext.userSettings.securityRoles} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @returns An array of user role identifiers, in Guid format. + * @example Example: ["cf4cc7ce-5d51-df11-97e0-00155db232d0"] */ getUserRoles(): string[]; /** * Returns the version number of the Dynamics 365 server. * - * @return The version number + * @returns The version number */ getVersion(): string; @@ -409,17 +466,175 @@ declare namespace Xrm { * Prefixes the current organization's unique name to a string; typically a URL path. * * @param sPath Local pathname of the resource. - * @return A path string with the organization name. - * - * @remarks Format: "/"+ OrgName + sPath + * @returns A path string with the organization name. Format: "/"+ OrgName + sPath */ prependOrgName(sPath: string): string; } + namespace Events { + /** + * Interface for save event arguments. + */ + interface SaveEventArguments { + /** + * @summary Gets save mode, as an integer. + * + * @returns The save mode. + * + * @description Gets save mode, as an integer. + * Values returned are: 1 Save + * 2 Save and Close + * 59 Save and New + * 70 AutoSave (Where enabled; can be used with an OnSave handler + * to conditionally disable auto-saving) + * 58 Save as Completed (Activities) + * 5 Deactivate + * 6 Reactivate + * 47 Assign (All user- or team-owned entities) + * 7 Send (Email) + * 16 Qualify (Lead) + * 15 Disqualify (Lead) + */ + getSaveMode(): XrmEnum.SaveMode; + + /** + * Returns a boolean value to indicate if the record's save has been prevented. + * + * @returns true if saving is prevented, otherwise false. + */ + isDefaultPrevented(): boolean; + + /** + * Prevents the save operation from being submitted to the server. + * All remaining "on save" handlers will continue execution. + */ + preventDefault(): void; + } + + /** + * Interface for process stage change event arguments. + */ + interface StageChangeEventArguments { + /** + * Gets the direction of the stage change. + * @returns The direction: "next" or "previous" + */ + getDirection(): ProcessFlow.StageChangeDirection; + + /** + * Gets the destination stage object + * @returns The stage object. For switching between entities, returns the previous stage object + */ + getStage(): ProcessFlow.Stage; + } + + /** + * Interface for process stage selected event arguments. + */ + interface StageSelectedEventArguments { + /** + * Gets the selected stage object + * @returns The stage object + */ + getStage(): ProcessFlow.Stage; + } + + /** + * Interface for the event context. + */ + interface EventContext { + /** + * Gets the Xrm context. + * @returns The Xrm context. + */ + getContext(): GlobalContext; + + /** + * Gets the handler's depth, which is the order in which the handler is executed. + * @returns The depth, a 0-based index. + */ + getDepth(): number; + + /** + * Gets a reference to the object for which event occurred. + * @returns The event source. + */ + getEventSource(): Attributes.Attribute | Controls.Control | Entity; + + /** + * Gets a reference to the currnet form context + * @returns The {@link FormContext form context} + */ + getFormContext(): FormContext; + + /** + * @summary Gets the shared variable with the specified key. + * @param T Generic type parameter. + * @param key The key. + * @returns The shared variable. + * @desc Gets the shared variable with the specified key. + * Used to pass values between handlers of an event. + */ + getSharedVariable(key: string): T; + + /** + * @summary Sets a shared variable. + * @param T Generic type parameter. + * @param key The key. + * @param value The value. + * @desc Sets the shared variable with the specified key. + * Used to pass values between handlers of an event. + */ + setSharedVariable(key: string, value: T): void; + } + + /** + * Interface for a save event context + */ + interface SaveEventContext extends EventContext { + /** + * Gets save-event arguments. + * @returns The event arguments. Returns null for all but the "save" event. + */ + getEventArgs(): SaveEventArguments; + } + + /** + * Interface for a process stage change event context + */ + interface StageChangeEventContext extends EventContext { + /** + * Gets process stage change event arguments. + * @returns The event arguments. + */ + getEventArgs(): StageChangeEventArguments; + } + + interface StageSelectedEventContext extends EventContext { + /** + * Gets process stage selected event arguments. + * @returns The event arguments. + */ + getEventArgs(): StageSelectedEventArguments; + } + + /** + * Type for a context-sensitive handler. + * @param context The context. + */ + type ContextSensitiveHandler = (context: EventContext) => void; + + /** + * Type for a process status change handler. + * @param status The process status. + */ + type ProcessStatusChangeHandler = (status: ProcessFlow.ProcessStatus) => void; + } + /** * Defines save options to control how appointment, recurring appointment, or service activity records are processed. * - * @see {@link https://msdn.microsoft.com/en-us/library/dn481607.aspx#Anchor_2} for details. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data/save External Link: save(Client API reference)} */ interface SaveOptions { /** @@ -430,29 +645,27 @@ declare namespace Xrm { } /** - * Interface for the Xrm.Page.data object. + * Interface for the formContext.data object. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data External Link: formContext.data (Client API reference)} */ interface Data { /** * Asynchronously refreshes data on the form, without reloading the page. - * * @param save true to save the record, after the refresh. - * @return Returns an asynchronous promise. + * @returns Returns an asynchronous promise. */ refresh(save: boolean): Async.PromiseLike; /** * Asynchronously saves the record. - * - * @return Returns an asynchronous promise. + * @returns Returns an asynchronous promise. */ save(): Async.PromiseLike; /** * Asynchronously saves the record with the option to set callback functions to be executed after the save operation is completed. - * * @param saveOptions Options to control how appointment, recurring appointment, or service activity records are processed. - * @return Returns an asynchronous promise. + * @returns Returns an asynchronous promise. */ save(saveOptions: SaveOptions): Async.PromiseLike; @@ -460,158 +673,146 @@ declare namespace Xrm { * Collection of non-entity data on the form. * Items in this collection are of the same type as the attributes collection, but they are not attributes of the form entity. * In V9 this is only available in the Unified Client + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/attributes External Link: Attributes (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + * @see Attributes */ - attributes: Collection.ItemCollection; + attributes: Collection.ItemCollection; /** - * The record context of the form. + * The record context of the form, {@link Entity formContext.data.entity} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data-entity External Link: formContext.data.entity (Client API reference)} */ - entity: Page.Entity; + entity: Entity; /** - * The process API for Xrm.Page.data. + * The process API for {@link ProcessFlow.ProcessManager formContext.ui.process}. * @remarks This member may be undefined when Process Flows are not used by the current entity. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data-process External Link: formContext.data.process (Client API reference)} */ - process: Page.data.ProcessManager; + process: ProcessFlow.ProcessManager; } /** - * Interface for Page context + * Interface for formContext + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/executioncontext/getformcontext External Link: getFormContext (Client API reference)} */ - interface Page { - /** - * Provides methods to retrieve information specific to an organization, a user, or parameters passed to a page. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - */ - context: Context; - + interface FormContext { /** * Provides methods to work with the form. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data External Link: formContext.data (Client API reference)} */ data: Data; /** * Contains properties and methods to retrieve information about the user interface as well as collections for several subcomponents of the form. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui External Link: formContext.ui (Client API reference)} */ ui: Ui; /** * Gets all attributes. - * - * @return An array of attributes. + * @returns An array of attributes. */ - getAttribute(): Page.Attribute[]; + getAttribute(): Attributes.Attribute[]; /** * Gets an attribute matching attributeName. - * - * @tparam T An Attribute type. + * @param T An Attribute type. * @param attributeName Name of the attribute. - * @return The attribute. + * @returns The attribute. */ - getAttribute(attributeName: string): T; + getAttribute(attributeName: string): T; /** * Gets an attribute matching attributeName. - * * @param attributeName Name of the attribute. - * @return The attribute. + * @returns The attribute. */ - getAttribute(attributeName: string): Page.Attribute; + getAttribute(attributeName: string): Attributes.Attribute; /** * Gets an attribute by index. - * * @param index The attribute index. - * @return The attribute. + * @returns The attribute. */ - getAttribute(index: number): Page.Attribute; + getAttribute(index: number): Attributes.Attribute; /** * Gets an attribute. - * * @param delegateFunction A matching delegate function - * @return An array of attribute. + * @returns An array of attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - getAttribute(delegateFunction: Collection.MatchingDelegate): Page.Attribute[]; + getAttribute(delegateFunction: Collection.MatchingDelegate): Attributes.Attribute[]; /** * Gets all controls. - * - * @return An array of controls. + * @returns An array of controls. */ - getControl(): Page.Control[]; + getControl(): Controls.Control[]; /** * Gets a control matching controlName. - * * @param T A Control type * @param controlName Name of the control. - * - * @return The control. + * @returns The control. */ - getControl(controlName: string): T; + getControl(controlName: string): T; /** * Gets a control matching controlName. - * - * @param controlName Name of the control. - * @return The control. + * @param controlName Name of the control. + * @returns The control. */ - getControl(controlName: string): Page.Control; + getControl(controlName: string): Controls.Control; /** * Gets a control by index. - * * @param T A Control type * @param index The control index. - * - * @return The control. + * @returns The control. */ - getControl(index: number): T; + getControl(index: number): T; /** * Gets a control by index. - * * @param index The control index. - * @return The control. + * @returns The control. */ - getControl(index: number): Page.Control; + getControl(index: number): Controls.Control; /** * Gets a control. - * * @param delegateFunction A matching delegate function. - * @return An array of control. + * @returns An array of control. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - getControl(delegateFunction: Collection.MatchingDelegate): Page.Control[]; + getControl(delegateFunction: Collection.MatchingDelegate): Controls.Control[]; } /** - * Interface for the Xrm.Page.ui object. + * Interface for the formContext.ui object. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui External Link: formContext.ui (Client API reference)} */ interface Ui { /** * Displays a form level notification. Any number of notifications can be displayed and will remain until removed using clearFormNotification. * The height of the notification area is limited so each new message will be added to the top. - * * @param message The text of the notification message. * @param level The level of the notification which defines how the message will be displayed, such as the icon. + * ERROR: Notification will use the system error icon. + * WARNING: Notification will use the system warning icon. + * INFO: Notification will use the system info icon. * @param uniqueId Unique identifier for the notification which is used with clearFormNotification to remove the notification. - * - * @return true if it succeeds, otherwise false. - * - * @remarks Values for level are: ERROR Notification will use the system error icon. - * WARNING Notification will use the system warning icon. - * INFO Notification will use the system info icon. + * @returns true if it succeeds, otherwise false. */ - setFormNotification(message: string, level: Page.ui.FormNotificationLevel, uniqueId: string): boolean; + setFormNotification(message: string, level: FormNotificationLevel, uniqueId: string): boolean; /** * Clears the form notification described by uniqueId. - * * @param uniqueId Unique identifier. - * @return True if it succeeds, otherwise false. + * @returns True if it succeeds, otherwise false. */ clearFormNotification(uniqueId: string): boolean; @@ -622,9 +823,7 @@ declare namespace Xrm { /** * Gets form type. - * - * @return The form type. - * + * @returns The form type. * @remarks Values returned are: 0 Undefined * 1 Create * 2 Update @@ -637,25 +836,20 @@ declare namespace Xrm { /** * Gets view port height. - * - * @return The view port height, in pixels. - * + * @returns The view port height, in pixels. * @remarks This method does not work with Microsoft Dynamics CRM for tablets. */ getViewPortHeight(): number; /** * Gets view port width. - * - * @return The view port width, in pixels. - * + * @returns The view port width, in pixels. * @remarks This method does not work with Microsoft Dynamics CRM for tablets. */ getViewPortWidth(): number; /** * Re-evaluates the ribbon's configured EnableRules. - * * @remarks This method does not work with Microsoft Dynamics CRM for tablets. */ refreshRibbon(): void; @@ -663,36 +857,40 @@ declare namespace Xrm { /** * The business process flow API, used to interact with the business process flow control in a form. */ - process: Page.ui.ProcessManager; + process: Controls.ProcessControl; /** * A reference to the collection of controls on the form. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - controls: Collection.ItemCollection; + controls: Collection.ItemCollection; /** * The form selector API. * * @remarks This API does not exist with Microsoft Dynamics CRM for tablets. */ - formSelector: Page.FormSelector; + formSelector: Controls.FormSelector; /** * The navigation API. * * @remarks This API does not exist with Microsoft Dynamics CRM for tablets. */ - navigation: Page.Navigation; + navigation: Controls.Navigation; /** * A reference to the collection of tabs on the form. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - tabs: Collection.ItemCollection; + tabs: Collection.ItemCollection; /** * A collection of all the quick view controls on a form using the new form rendering engine (also called "turbo forms"). + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-quickforms ExternalLink: formContext.ui.quickForms (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui External Link: formContext.ui (Client API reference)} */ - quickForms: Collection.ItemCollection; + quickForms: Collection.ItemCollection; } /** @@ -727,6 +925,7 @@ declare namespace Xrm { /** * Interface for the Xrm.Utility API + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility External Link: Xrm.Utility (Client API reference)} */ interface Utility { /** @@ -737,27 +936,28 @@ declare namespace Xrm { /** * Returns the valid state transitions for the specified entity type and state code. * TODO: No info on the return type is available - * @param entityName The logical name of the entity. - * @param stateCode The state code to find out the allowed status transition values. + * @param entityName The logical name of the entity. + * @param stateCode The state code to find out the allowed status transition values. */ getAllowedStatusTransitions(entityName: string, stateCode: number): Async.PromiseLike; /** * Returns the entity metadata for the specified entity. - * @param entityName The logical name of the entity. - * @param attributes The attributes to get metadata for. + * @param entityName The logical name of the entity. + * @param attributes The attributes to get metadata for. */ getEntityMetadata(entityName: string, attributes?: string[]): Async.PromiseLike; /** * The method provides access to the global context without going through the form context. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility/getglobalcontext External Link: getGlobalContext (Client API reference)} */ - getGlobalContext(): Context; + getGlobalContext(): GlobalContext; /** * Returns the localized string for a given key associated with the specified web resource. - * @param webResourceName The name of the web resource. - * @param key The key for the localized string. + * @param webResourceName The name of the web resource. + * @param key The key for the localized string. * @returns A localized string. */ getResourceString(webResourceName: string, key: string): string; @@ -766,6 +966,9 @@ declare namespace Xrm { * Invokes an action based on the specified parameters * @param name Name of the process action to invoke. * @param parameters An object containing input parameters for the action. You define an object using key:value pairs of items, where key is of String type. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility/invokeprocessaction External Link: invokeProcessAction (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/customize/actions External Link: Actions overview} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/create-own-actions External Link: Create your own actions} */ invokeProcessAction(name: string, parameters: Collection.Dictionary): Async.PromiseLike; @@ -773,12 +976,13 @@ declare namespace Xrm { * Opens a lookup control to select one or more items. * @param lookupOptions Defines the options for opening the lookup dialog */ - lookupObjects(lookupOptions: LookupOptions): Async.PromiseLike; + lookupObjects(lookupOptions: LookupOptions): Async.PromiseLike; /** * Refreshes the parent grid containing the specified record. + * @param lookupOptions: The lookup value of the parent object to refresh. */ - refreshParentGrid(lookupOptions: Page.LookupValue): void; + refreshParentGrid(lookupOptions: LookupValue): void; /** * Displays a progress dialog with the specified message. @@ -789,8 +993,8 @@ declare namespace Xrm { /** * Displays an alert dialog, with an "OK" button. - * @deprecated: Deprecated in v9. Use Xrm.Navigation. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * + * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openAlertDialog} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * @param message The message. * @param onCloseCallback The "OK" callback. */ @@ -798,8 +1002,8 @@ declare namespace Xrm { /** * Displays a confirmation dialog, with "OK" and "Cancel" buttons. - * @deprecated: Deprecated in v9. Use Xrm.Navigation. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * + * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openConfirmDialog} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * @param message The message. * @param yesCloseCallback The "OK" callback. * @param noCloseCallback The "Cancel" callback. @@ -808,30 +1012,31 @@ declare namespace Xrm { /** * Query if 'entityType' is an Activity entity. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @param entityType Type of the entity. - * - * @return true if the entity is an Activity, false if not. + * @deprecated Deprecated in v9. Use {@link Xrm.Utility.getEntityMetadata Xrm.Utility.getEntityMetadata(entityName, ["IsActivity"])} instead. + * @remarks The isActivityType method is synchronous so it was suitable for ribbon rules. + * However, the replacement method, getEntityMetadata, is asynchronous, and is not suitable for ribbon rules. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @param entityType Type of the entity. + * @returns true if the entity is an Activity, false if not. */ isActivityType(entityType: string): boolean; /** * Opens quick create. - * @deprecated: Deprecated in v9. Use Xrm.Navigation. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @param entityLogicalName The logical name of the entity to create. - * @param createFromEntity (Optional) Designates a record that will provide default values - * based on mapped attribute values. - * @param parameters (Optional) A dictionary object that passes extra query string - * parameters to the form. Invalid query string parameters will cause an - * error. - * @return Returns an asynchronous promise. + * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openForm} instead with the option {useQuickCreateForm:true}. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @param entityLogicalName The logical name of the entity to create. + * @param createFromEntity (Optional) Designates a record that will provide default values based on mapped attribute values. + * @param parameters (Optional) A dictionary object that passes extra query string parameters to the form. Invalid query string parameters will cause an error. + * @returns Returns an asynchronous promise. */ - openQuickCreate(entityLogicalName: string, createFromEntity?: Page.LookupValue, parameters?: Utility.OpenParameters): + openQuickCreate(entityLogicalName: string, createFromEntity?: LookupValue, parameters?: Utility.OpenParameters): Async.PromiseLike; /** * Opens an entity form. - * @deprecated: Deprecated in v9. Use Xrm.Navigation. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openForm} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * @param name The entity's logical name. * @param id (Optional) The unique identifier for the record. * @param parameters (Optional) A dictionary object that passes extra query string parameters to the form. @@ -841,16 +1046,13 @@ declare namespace Xrm { /** * Opens an HTML Web Resource in a new browser window. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @param webResourceName Name of the HTML web resource. Can be used to pass URL - * parameters. See Remarks. - * @param webResourceData (Optional) Data to pass into the Web Resource's data parameter. - * It is advised to use encodeURIcomponent() to encode the value. + * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openWebResource} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @param webResourceName Name of the HTML web resource. Can be used to pass URL parameters. See Remarks. + * @param webResourceData (Optional) Data to pass into the Web Resource's data parameter. It is advised to use encodeURIcomponent() to encode the value. * @param width (Optional) The width of the new window. * @param height (Optional) The height of the new window. - * - * @return A Window reference, containing the opened Web Resource. - * + * @returns A Window reference, containing the opened Web Resource. * @remarks This function will not work with Microsoft Dynamics CRM for tablets. * Valid WebResource URL Parameters: typename * type @@ -869,39 +1071,41 @@ declare namespace Xrm { interface Mobile { /** * Provides methods to create and manage records in the mobile clients while working in the offline mode. - * - * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx} for details. + * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx External Link: Xrm.Mobile.offline (client-side reference)} + * @deprecated Use {@link Xrm.WebApi.offline} instead. Xrm.WebApi.offline is implemented differently than Xrm.Mobile.offline + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ offline: MobileOffline; } /** * Interface for the Mobile.offline methods to create and manage records in the mobile clients while working in the offline mode. - * - * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx} for details. + * @deprecated Use {@link Xrm.WebApi.offline} instead. Xrm.WebApi.offline is implemented differently than Xrm.Mobile.offline + * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx External Link: Xrm.Mobile.offline (client-side reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ interface MobileOffline { /** * Returns whether an entity is offline enabled. - * * @param entityType The logical name of the entity. - * @return True if the entity is offline enabled; otherwise False. + * @returns True if the entity is offline enabled; otherwise False. + * @deprecated Use {@link Xrm.WebApi.isAvailableOffline} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ isOfflineEnabled(entityType: string): boolean; /** * Creates an entity record in mobile clients while working in the offline mode. - * * @param entityType The logical name of the entity. * @param data A dictionary object containing key : value pairs for the record to create. - * - * @return Returns an asynchronous promise. - * + * @returns Returns an asynchronous promise. * @remarks You cannot create intersect and activity party entities. * Only the following attribute types are supported in offline mode: * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier + * @deprecated Use {@link Xrm.WebApi.createRecord} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ createRecord(entityType: string, data: { [attributeName: string]: any }): Async.PromiseLike; @@ -911,15 +1115,16 @@ declare namespace Xrm { * @param entityType The logical name of the entity. * @param id GUID of the record to retrieve. * @param options (Optional) OData system query options to retrieve your data. Supports $select and $expand - * Example: ?$select=name&$expand=primarycontactid($select=contactid,fullname) - * - * @return Returns an asynchronous promise. - * + * @example Example options + * options: ?$select=name&$expand=primarycontactid($select=contactid,fullname) + * @returns Returns an asynchronous promise. * @remarks Only $select option can be specified within $expand. * Only the following attribute types are supported in offline mode: * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier + * @deprecated Use {@link Xrm.WebApi.retrieveRecord} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ retrieveRecord(entityType: string, id: string, options: string): Async.PromiseLike; @@ -929,13 +1134,11 @@ declare namespace Xrm { * @param entityType The logical name of the entity. * @param options (Optional) The logical name of the enti * @param maxPageSize (Optional) A positive number to indicates the number of entity records to be returned per page. - * If you do not specify this parameter, the default value is passed as 5000. - * If the number of records being retrieved is more than maxPageSize, an @odata.nextLink property - * will be returned, and you can use the value of the @odata.nextLink property with a new GET - * request to return next set of records. - * - * @return Returns an asynchronous promise. - * + * If you do not specify this parameter, the default value is passed as 5000. + * If the number of records being retrieved is more than maxPageSize, an @odata.nextLink property + * will be returned, and you can use the value of the @odata.nextLink property with a new GET + * request to return next set of records. + * @returns Returns an asynchronous promise. * @remarks A maximum of 5000 related records can be retrieved when using $expand. * Only $select option can be specified within $expand. * $skip query option is not supported. @@ -943,50 +1146,50 @@ declare namespace Xrm { * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier + * @deprecated Use {@link Xrm.WebApi.retrieveMultipleRecords} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ retrieveMultipleRecords(entityType: string, options: string, maxPageSize: number): Async.PromiseLike>; /** * Updates an entity record in mobile clients while working in the offline mode. - * * @param entityType The logical name of the entity. * @param id GUID of the record to update. * @param data A dictionary object containing key : value pairs for the record to update. - * - * @return Returns an asynchronous promise. - * + * @returns Returns an asynchronous promise. * @remarks You cannot update intersect and activity party entities. * Only the following attribute types are supported in offline mode: * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier + * @deprecated Use {@link Xrm.WebApi.updateRecord} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ updateRecord(entityType: string, id: string, data: { [attributeName: string]: any }): Async.PromiseLike; /** * Deletes an entity record in mobile clients while working in the offline mode. - * * @param entityType The logical name of the entity. * @param id GUID of the record to delete. - * - * @return Returns an asynchronous promise. - * + * @returns Returns an asynchronous promise. * @remarks You cannot delete intersect and activity party entities. + * @deprecated Use {@link Xrm.WebApi.deleteRecord} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ deleteRecord(entityType: string, id: string): Async.PromiseLike; } /** * Interface for the Xrm.Panel API + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-panel External Link: Xrm.Panel} */ interface Panel { /** * Displays the web page represented by a URL in the static area in the side pane, which appears on all pages in the web client. - * * @param url URL of the page to be loaded in the side pane static area. * @param title Title of the side pane static area. - * * @remarks This method is only supported for the web client. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-panel/loadpanel External Link: loadPanel (Client-side reference)} */ LoadPanel(url: string, title: string): void; } @@ -1017,7 +1220,7 @@ declare namespace Xrm { /** * A lookup value which identifies the record which has been created. */ - savedEntityReference: Page.LookupValue; + savedEntityReference: LookupValue; } /** @@ -1055,7 +1258,8 @@ declare namespace Xrm { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onFulfilled?: (value: T) => U | PromiseLike, onRejected?: (error: any) => U | PromiseLike): PromiseLike; + then(onFulfilled?: (value: T) => U | PromiseLike, onRejected?: (error: any) => U | PromiseLike): + PromiseLike; then(onFulfilled?: (value: T) => U | PromiseLike, onRejected?: (error: any) => void): PromiseLike; /** @@ -1090,7 +1294,7 @@ declare namespace Xrm { * @param item The item. * @param index Zero-based index of the item array. * - * @return true if the item matches, false if it does not. + * @returns true if the item matches, false if it does not. */ type MatchingDelegate = (item: T, index?: number) => boolean; @@ -1112,385 +1316,1184 @@ declare namespace Xrm { [index: number]: T; } + /** + * Collections are structures to provide access to data that represent an array, but without the ability to modify the data in the array. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections Collections (Client API reference)} + */ type ItemCollection = Dictionary & { /** * Applies an operation to all items in this collection. - * * @param delegate An iterative delegate function */ forEach(delegate: IterativeDelegate): void; /** * Gets the item using a delegate matching function - * * @param delegate A matching delegate function - * - * @return A T[] whose members have been validated by delegate. + * @returns A T[] whose members have been validated by delegate. */ get(delegate: MatchingDelegate): T[]; /** * Gets the item given by the index. - * * @param itemNumber The item number to get. - * - * @return The T in the itemNumber-th place. + * @returns The T in the itemNumber-th place. */ get(itemNumber: number): T; /** * Gets the item given by the index. - * * @param itemNumber The item number to get. - * - * @return The T in the itemNumber-th place. - * - * @see {@link Xrm.Page.Control.getName()} for Control-naming schemes. + * @returns The T in the itemNumber-th place. + * @see {@link Controls.Control.getName Controls.Control.getName()} for Control-naming schemes. */ get(itemNumber: number): TSubType; /** * Gets the item given by the key. - * * @param itemName The item name to get. - * - * @return The T matching the key itemName. - * - * @see {@link Xrm.Page.Control.getName()} for Control-naming schemes. + * @returns The T matching the key itemName. + * @see {@link Controls.Control.getName Controls.Control.getName()} for Control-naming schemes. */ get(itemName: string): T; /** * Gets the item given by the key. - * * @param itemName The item name to get. - * - * @return The T matching the key itemName. - * - * @see {@link Xrm.Page.Control.getName()} for Control-naming schemes. + * @returns The T matching the key itemName. + * @see {@link Controls.Control.getName Controls.Control.getName()} for Control-naming schemes. */ get(attributeName: string): TSubType; /** * Gets the entire array of T. - * - * @return A T[]. + * @returns A T[]. */ get(): T[]; /** * Gets the length of the collection. - * - * @return The length. + * @returns The length. */ getLength(): number; }; } /** - * The Xrm.Page API - * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328255.aspx|Documentation} for details. + * Interface for Page context + * @deprecated Use {@link Xrm.Events.EventContext.getFormContext formContext} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs}a + */ + interface Page extends FormContext { + /** + * Provides methods to retrieve information specific to an organization, a user, or parameters passed to a page. + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + */ + context: GlobalContext; + } + + /** + * Xrm.Page namespace has been deprecated + * @deprecated Use {@link Xrm.Events.EventContext.getFormContext formContext} instead. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ namespace Page { /** - * Requirement Level for Xrm.Page.Attribute.getRequiredLevel() and Xrm.Page.Attribute.setRequiredLevel(). + * @deprecated Use {@link Xrm.Controls.AddControlNotificationOptions} instead. */ - type RequirementLevel = "none" | "recommended" | "required"; + interface AddControlNotificationOptions extends Controls.AddControlNotificationOptions { } + + /** + * Interface to define the actions on a control notification + * @deprecated Use {@link Xrm.Controls.ControlNotificationAction} instead. + */ + interface ControlNotificationAction extends Controls.ControlNotificationAction { } + + /** + * Interface for an entity's form selector item. + * @deprecated Use {@link Xrm.Controls.FormItem} instead. + */ + interface FormItem extends Controls.FormItem { } + + /** + * Interface for the form selector API. + * @deprecated Use {@link Xrm.Controls.FormSelector} instead. + */ + interface FormSelector extends Controls.FormSelector { } + + /** + * Interface for Xrm.Page.ui.navigation. + * @deprecated Use {@link Xrm.Controls.Navigation} instead. + */ + interface Navigation extends Controls.Navigation { } + + /** + * Interface for a navigation item. + * @see UiElement + * @see UiFocusable + * @deprecated Use {@link Xrm.Controls.NavigationItem} instead. + */ + interface NavigationItem extends Controls.NavigationItem { } + + /** + * Constants to use with the addNotification method of form controls + * @deprecated Use {@link Xrm.Controls.NotificationLevel} instead. + */ + type NotificationLevel = Controls.NotificationLevel; + /** + * Requirement Level for Xrm.Page.Attribute.getRequiredLevel() and Xrm.Page.Attribute.setRequiredLevel(). + * @deprecated Use {@link Xrm.Attributes.RequirementLevel} instead. + */ + type RequirementLevel = Attributes.RequirementLevel; /** * Save Modes for Xrm.Page.Entity.save(). + * @deprecated Use {@link Xrm.EntitySaveMode} instead. */ - type SaveMode = "saveandclose" | "saveandnew"; + type SaveMode = EntitySaveMode; /** * Status for Xrm.Page.Stage.getStatus(). + * @deprecated Use {@link Xrm.ProcessFlow.StageStatus} instead. */ - type StageStatus = "active" | "inactive"; + type StageStatus = ProcessFlow.StageStatus; /** * Status for Xrm.Page.Process.getStatus(). + * @deprecated Use {@link Xrm.ProcessFlow.ProcessStatus} instead */ - type ProcessStatus = "active" | "aborted" | "finished"; + type ProcessStatus = ProcessFlow.ProcessStatus; /** * Submit Mode for Xrm.Page.Attribute.getSubmitMode() and Xrm.Page.Attribute.setSubmitMode(). + * @deprecated Use {@link Xrm.SubmitMode} instead. */ - type SubmitMode = "always" | "dirty" | "never"; + type SubmitMode = Xrm.SubmitMode; /** * Control type for Xrm.Page.ui.QuickForm.getControlType(). + * @deprecated Use {@link Xrm.Controls.ControlQuickFormType} instead. + * */ - type ControlQuickFormType = "quickform"; + type ControlQuickFormType = Controls.ControlQuickFormType; /** * Control types for Xrm.Page.Control.getControlType(). + * @deprecated Use {@link Xrm.Controls.ControlType} instead. */ - type ControlType = "standard" | "iframe" | "lookup" | "optionset" | "subgrid" | "webresource" | "notes" | "timercontrol" | "kbsearch" | "timelinewall" | ControlQuickFormType; + type ControlType = Controls.ControlType; /** * Date attribute formats for Xrm.Page.Attribute.getFormat(), used by DateAttribute. + * @deprecated Use {@link Xrm.Attributes.DateAttributeFormat} instead. */ - type DateAttributeFormat = "date" | "datetime"; + type DateAttributeFormat = Attributes.DateAttributeFormat; /** * Integer attribute formats for Xrm.Page.Attribute.getFormat(), used by NumberAttribute. + * @deprecated Use {@link Xrm.Attributes.IntegerAttributeFormat} instead. */ - type IntegerAttributeFormat = "duration" | "none"; + type IntegerAttributeFormat = Attributes.IntegerAttributeFormat; /** * OptionSet attribute formats for Xrm.Page.Attribute.getFormat(), used by OptionSetAttribute. + * @deprecated Use {@link Xrm.Attributes.OptiopnSetAttributeFormat} instead. */ - type OptionSetAttributeFormat = "language" | "timezone"; + type OptionSetAttributeFormat = Attributes.OptionSetAttributeFormat; /** * String attribute formats for Xrm.Page.Attribute.getFormat(), used by StringAttribute. + * @deprecated Use {@link Xrm.Attributes.StringAttributeFormat} instead. */ - type StringAttributeFormat = "email" | "phone" | "text" | "textarea" | "tickersymbol" | "url"; + type StringAttributeFormat = Attributes.StringAttributeFormat; /** * Attribute types for Xrm.ui.ProcessMonitor Xrm.Page.Attribute.setDisplayState(). + * @deprecated Use {@link Xrm.Attributes.AttributeType} instead. */ - type AttributeType = "boolean" | "datetime" | "decimal" | "double" | "integer" | "lookup" | "memo" | "money" | "optionset" | "string"; + type AttributeType = Attributes.AttributeType; /** * Direction types for a process stage change event + * @deprecated Use {@link Xrm.ProcessFlow.StageChangeDirection} instead. */ - type StageChangeDirection = "Next" | "Previous"; + type StageChangeDirection = ProcessFlow.StageChangeDirection; /** * Attribute formats for Xrm.Page.Attribute.getFormat(). + * @deprecated Use {@link Xrm.Attributes.AttributeFormat} instead. */ - type AttributeFormat = DateAttributeFormat | IntegerAttributeFormat | OptionSetAttributeFormat | StringAttributeFormat; + type AttributeFormat = Attributes.AttributeFormat; /** * Interface for a CRM Business Process Flow instance. + * @deprecated Use {@link Xrm.ProcessFlow.Process} instead. */ - interface Process { - /** - * Returns the unique identifier of the process. - * - * @return The identifier for this process, in GUID format. - * - * @remarks Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". - */ - getId(): string; - - /** - * Returns the name of the process. - * - * @return The name. - */ - getName(): string; - - /** - * Returns an collection of stages in the process. - * - * @return The stages. - */ - getStages(): Collection.ItemCollection; - - /** - * Returns a boolean value to indicate if the process is rendered. - * - * @return true if the process is rendered, false if not. - */ - isRendered(): boolean; - } + interface Process extends ProcessFlow.Process { } /** * Interface for CRM Business Process Flow stages. + * @deprecated Use {@link Xrm.ProcessFlow.Stage} instead. */ - interface Stage { - /** - * Returns an object with a getValue method which will return the integer value of the business process flow - * category. - * - * @return The stage category. - */ - getCategory(): { getValue(): XrmEnum.StageCategory }; + interface Stage extends ProcessFlow.Stage { } - /** - * Returns the logical name of the entity associated with the stage. - * - * @return The entity name. - */ - getEntityName(): string; - - /** - * Returns the unique identifier of the stage. - * - * @return The identifier of the Stage, in GUID format. - * - * @remarks Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". - */ - getId(): string; - - /** - * Returns the name of the stage. - * - * @return The name. - */ - getName(): string; - - /** - * Returns the status of the stage. - * - * @return The status. - * - * @remarks This method will return either "active" or "inactive". - */ - getStatus(): StageStatus; - - /** - * Returns a collection of steps in the stage. - * - * @return An array of Step. - */ - getSteps(): Step[]; - } - - interface Step { - /** - * Returns the logical name of the attribute associated to the step. - * - * @return The attribute. - * - * @remarks Some steps don’t contain an attribute value. - */ - getAttribute(): string; - - /** - * Returns the name of the step. - * - * @return The name. - */ - getName(): string; - - /** - * Returns whether the step is required in the business process flow. - * - * @return true if required, false if not. - * - * @remarks Returns true if the step is marked as required in the Business Process Flow editor; otherwise, false. - * There is no connection between this value and the values you can change in the Xrm.Page.data.entity - * attribute RequiredLevel methods. - */ - isRequired(): boolean; - } + /** + * Interface for CRM Business Process Flow steps. + * @deprecated Use {@link Xrm.ProcessFlow.Step} instead. + */ + interface Step extends ProcessFlow.Step { } /** * Interface for the event context. + * @deprecated Use {@link Xrm.Events.EventContext} instead. */ - interface EventContext { - /** - * Gets the Xrm context. - * - * @return The Xrm context. - */ - getContext(): Context; - - /** - * Gets the handler's depth, which is the order in which the handler is executed. - * - * @return The depth, a 0-based index. - */ - getDepth(): number; - - /** - * Returns the event arguments for the event context - * Get event args returns null for read operations - * - * @return The event arguments or null - */ - getEventArgs(): SaveEventArguments | StageChangeEventArguments | StageSelectedEventArguments; - - /** - * Gets a reference to the object for which event occurred. - * - * @return The event source. - */ - getEventSource(): Attribute | Control | Entity; - - /** - * Gets a reference to the currnet form context - * - * @return The form context - */ - getFormContext(): Page; - - /** - * Gets the shared variable with the specified key. - * - * @param T Generic type parameter. - * @param key The key. - * - * @return The shared variable. - * - * @remarks Used to pass values between handlers of an event. - */ - getSharedVariable(key: string): T; - - /** - * Sets a shared variable. - * - * @param T Generic type parameter. - * @param key The key. - * @param value The value. - * - * @remarks Used to pass values between handlers of an event. - */ - setSharedVariable(key: string, value: T): void; - } + interface EventContext extends Events.EventContext { } /** * Interface for a save event context + * @deprecated Use {@link Xrm.Events.SaveEventContext} instead. */ - interface SaveEventContext extends EventContext { - /** - * Gets save-event arguments. - * - * @return The event arguments. - * - * @remarks Returns null for all but the "save" event. - */ - getEventArgs(): SaveEventArguments; - } + interface SaveEventContext extends Events.SaveEventContext { } /** * Interface for a process stage change event context + * @deprecated Use {@link Xrm.Events.StageChangeEventContext} instead. */ - interface StageChangeEventContext extends EventContext { - /** - * Gets process stage change event arguments. - * - * @return The event arguments. - * - */ - getEventArgs(): StageChangeEventArguments; - } + interface StageChangeEventContext extends Events.StageChangeEventContext { } - interface StageSelectedEventContext extends EventContext { - /** - * Gets process stage selected event arguments. - * - * @return The event arguments. - * - */ - getEventArgs(): StageSelectedEventArguments; - } + /** + * Interface for a process stage select event context + * @deprecated Use {@link Xrm.Events.StageSelectedEventContext} instead. + */interface StageSelectedEventContext extends Events.StageSelectedEventContext { } /** * Type for a context-sensitive handler. * @param context The context. + * @deprecated Use {@link Xrm.Events.ContextSensitiveHandler} instead. */ - type ContextSensitiveHandler = (context: EventContext) => void; + type ContextSensitiveHandler = Events.ContextSensitiveHandler; /** * Type for a process status change handler. * @param status The process status. + * @deprecated Use {@link Xrm.Events.ProcessStatusChangeHandler} instead. */ - type ProcessStatusChangeHandler = (status: ProcessStatus) => void; + type ProcessStatusChangeHandler = Events.ProcessStatusChangeHandler; + + /** + * Interface for UI elements with labels. + * @deprecated Use {@link Xrm.Controls.UiLabelElement} instead. + */ + interface UiLabelElement extends Controls.UiLabelElement { } + + /** + * Interface for UI elements which can have the visibility value read. + * @deprecated Use {@link Xrm.Controls.UiCanGetVisibleElement} instead. + */ + interface UiCanGetVisibleElement extends Controls.UiCanGetVisibleElement { } + + /** + * Interface for UI elements which can have the visibility value updated. + * @deprecated Use {@link Xrm.Controls.UiCanSetVisibleElement} instead. + */ + interface UiCanSetVisibleElement extends Controls.UiCanSetVisibleElement { } + + /** + * Base interface for standard UI elements. + * @deprecated Use {@link Xrm.Controls.UiStandardElement} instead. + */ + interface UiStandardElement extends Controls.UiStandardElement { } + + /** + * Interface for focusable UI elements. + * @deprecated Use {@link Xrm.Controls.UiFocusable} instead. + */ + interface UiFocusable extends Controls.UiFocusable { } + + /** + * Interface for controls which methods provide immediate feedback or take actions as user types in a control. + * Contains methods which can be used to perform data validations in a control even before the user commits (saves) the value in a form. + * @deprecated Use {@link Xrm.Controls.UiKeyPressable} instead. + */ + interface UiKeyPressable extends Controls.UiKeyPressable { } + + /** + * Interface for Result value of AutoCompleteResultSet + * @deprecated Use {@link Xrm.Controls.AutoCompleteResult} instead. + */ + interface AutoCompleteResult extends Controls.AutoCompleteResult { } + + /** + * Interface for command of AutoCompleteResultSet. This is displayed at the bottom of the auto complete view + * @deprecated Use {@link Xrm.Controls.AutoCompleteCommand} instead. + */ + interface AutoCompleteCommand extends Controls.AutoCompleteCommand { } + + /** + * Interface for showAutoComplete argument + * @deprecated Use {@link Xrm.Controls.AutoCompleteResultSet} instead. + */ + interface AutoCompleteResultSet extends Controls.AutoCompleteResultSet { } + + /** + * Interface for a Lookup value. + * @deprecated Use {@link Xrm.LookupValue} instead. + */ + interface LookupValue extends Xrm.LookupValue { } + + /** + * Interface for an OptionSet value. + * @deprecated Use {@link Xrm.OptionSetValue} instead. + */ + interface OptionSetValue extends Xrm.OptionSetValue { } + + /** + * Interface for a privilege. + * @deprecated Use {@link Xrm.Privilege} instead. + */ + interface Privilege extends Xrm.Privilege { } + + /** + * Interface for an Entity attribute. + * @deprecated Use {@link Xrm.Attributes.Attribute} instead. + */ + interface Attribute extends Attributes.Attribute { } + + /** + * Interface for a Number attribute. + * @see Attribute + * @deprecated Use {@link Xrm.Attributes.NumberAttribute} instead. + */ + interface NumberAttribute extends Attributes.NumberAttribute { } + + /** + * Interface for a String attribute. + * @see Attribute + * @deprecated Use {@link Xrm.Attributes.StringAttribute} instead. + */ + interface StringAttribute extends Attributes.StringAttribute { } + + /** + * Common interface for enumeration attributes (OptionSet and Boolean). + * @see Attribute + * @deprecated Use {@link Xrm.Attributes.EnumAttribute} instead. + */ + interface EnumAttribute extends Attributes.EnumAttribute { } + + /** + * Interface for a Boolean attribute. + * @see EnumAttribute + * @deprecated Use {@link Xrm.Attributes.BooleanAttribute} instead. + */ + interface BooleanAttribute extends Attributes.BooleanAttribute { } + + /** + * Interface for a Date attribute. + * @see Attribute + * @deprecated Use {@link Xrm.Attributes.DateAttribute} instead. + */ + interface DateAttribute extends Attributes.DateAttribute { } + + /** + * Interface an OptionSet attribute. + * @see EnumAttribute + * @deprecated Use {@link Xrm.Attributes.OptionSetAttribute} instead. + */ + interface OptionSetAttribute extends Attributes.OptionSetAttribute { } + + /** + * Interface a Lookup attribute. + * @see Attribute + * @deprecated Use {@link Xrm.Attributes.LookupAttribute} instead. + */ + interface LookupAttribute extends Attributes.LookupAttribute { } + + /** + * Interface for the form's record context, Xrm.Page.data.entity + * @deprecated Use {@link Xrm.Entity} instead. + */ + interface Entity extends Xrm.Entity { } + + /** + * Interface for save event arguments. + * @deprecated Use {@link Xrm.Events.SaveEventContext} instead. + */ + interface SaveEventArguments extends Events.SaveEventContext { } + + /** + * Interface for process stage change event arguments. + * @deprecated Use {@link Xrm.Events.StageChangeEventArguments} instead. + */ + interface StageChangeEventArguments extends Events.StageChangeEventArguments { } + + /** + * Interface for process stage selected event arguments. + * @deprecated Use {@link Xrm.Events.StageSelectedEventArguments} instead. + */ + interface StageSelectedEventArguments extends Events.StageSelectedEventArguments { } + + /** + * Interface for Xrm.Page.ui controls. + * @see UiElement + * @deprecated Use {@link Xrm.Controls.Control} instead. + */ + interface Control extends Controls.Control { } + + /** + * Interface for a standard control. + * @see Control + * @deprecated Use {@link Xrm.Controls.StandardControl} instead. + */ + interface StandardControl extends Controls.StandardControl { } + + /** + * Interface for Auto Lookup Control. + * This is not an Entity Lookup, but a control that supports AutoComplete / KeyPress Events (Text or Number) + * @remarks This interface is not supported for CRM mobile clients (phones or tablets) and the interactive service hub. It is only available for Updated entities. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.AutoLookupControl} instead. + */ + interface AutoLookupControl extends Controls.AutoLookupControl { } + + /** + * Interface for a String control. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.StringControl} instead. + */ + interface StringControl extends Controls.StringControl { } + + /** + * Interface for a Number control. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.NumberControl} instead. + */ + interface NumberControl extends AutoLookupControl { } + + /** + * Interface for a Date control. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.DateControl} instead. + */ + interface DateControl extends StandardControl { } + + /** + * Interface for a Lookup control. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.LookupControl} instead. + */ + interface LookupControl extends Controls.LookupControl { } + + /** + * Interface for an OptionSet control. + * @see StandardControl + * @deprecated Use {@link Xrm.Controls.OptionSetControl} instead. + */ + interface OptionSetControl extends Controls.OptionSetControl { } + + /** + * Interface for a CRM grid control. + * + * @see Control + * @deprecated Use {@link Xrm.Controls.GridControl} instead. + */ + interface GridControl extends Controls.GridControl { } + + /** + * Interface for a framed control, which is either a Web Resource or an Iframe. + * @see Control + * @remarks An Iframe control provides additional methods, so use {@link IframeControl} where + * appropriate. Silverlight controls should use {@link SilverlightControl}. + * @deprecated Use {@link Xrm.Controls.FramedControl} instead. + */ + interface FramedControl extends Controls.FramedControl { } + + /** + * Interface for an Iframe control. + * @see FramedControl + * @deprecated Use {@link Xrm.Controls.IframeControl} instead. + */ + interface IframeControl extends Controls.IframeControl { } + + /** + * Interface for a Silverlight control. + * @see Control + * @deprecated Use {@link Xrm.Controls.SilverlightControl} instead. + */ + interface SilverlightControl extends Controls.SilverlightControl { } + + /** + * Interface for a Timeline control. + * @see Control + * @deprecated Use {@link Xrm.Controls.TimelineWall} instead. + */ + interface TimelineWall extends Controls.TimelineWall { } + + /** + * Interface for a form tab. + * @see UiElement + * @see UiFocusable + * @deprecated Use {@link Xrm.Controls.Tab} instead. + */ + interface Tab extends Controls.Tab { } + + /** + * Interface for a form section. + * @see UiElement + * @deprecated Use {@link Xrm.Controls.Section} instead. + */ + interface Section extends Controls.Section { } + + /** + * Module for the Xrm.Page.data API. + * @deprecated Use {@link Xrm.Form.data formContext.data} has been deprecated. + */ + namespace data { + /** + * Interface for the Xrm.Page.data.process API. + * @deprecated Use {@link Xrm.ProcessFlow.ProcessManager} instead. + */ + interface ProcessManager extends ProcessFlow.ProcessManager { + } + + /** + * Called when method to get active processes is complete + * @param status The result of the get active processes operation. + * @remarks Returns object with the following key-value pairs: + * CreatedOn + * ProcessDefinitionID + * ProcessDefinitionName + * ProcessInstanceID + * ProcessInstanceName + * StatusCodeName + * @deprecated Use {@link Xrm.ProcessFlow.GetProcessInstancesDelegate} instead. + */ + type GetProcessInstancesDelegate = ProcessFlow.GetProcessInstancesDelegate; + + /** + * Called when method to set active process is complete + * @param status The result of the set active process operation. + * @remarks Values returned are: success (The operation succeeded.) + * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) + * @deprecated Use {@link Xrm.ProcessFlow.SetProcessInstanceDelegate} instead. + */ + type SetProcessInstanceDelegate = ProcessFlow.SetProcessInstanceDelegate; + + /** + * Called when process change methods have completed. + * @param status The result of the process change operation. + * @remarks Values returned are: success (The operation succeeded.) + * crossEntity (The previous stage is for a different entity.) + * beginning (The active stage is the first stage of the active path.) + * invalid (The operation failed because the selected stage isn’t the same + * as the active stage.) + * unreachable (The stage exists on a different path.) + * @deprecated Use {@link Xrm.ProcessFlow.ProcessCallbackDelegate} instead. + */ + type ProcessCallbackDelegate = ProcessFlow.ProcessCallbackDelegate; + + /** + * Called when process set status method has completed. + * + * @param status The new status of the process instance + * + * @remarks Values returned are: active + * aborted + * finished + * @deprecated Use {@link Xrm.ProcessFlow.ProcessSetStatusDelegate} instead. + */ + type ProcessSetStatusDelegate = ProcessFlow.ProcessSetStatusDelegate; + + /** + * Represents a key-value pair, where the key is the Process Flow's ID, and the value is the name thereof. + * @deprecated Use {@link Xrm.ProcessFlow.ProcessDictionary} instead. + */ + interface ProcessDictionary extends ProcessFlow.ProcessDictionary { } + } + + /** + * Contains properties and methods to retrieve information about the user interface as well as collections for several subcomponents of the form. + * @deprecated Use {@link Xrm.Form.ui formContext.ui} instead. + */ + namespace ui { + /** + * Form Notification Levels for Xrm.Ui.setFormNotification(). + * @deprecated Use {@link Xrm.FormNotificationLevel} instead. + */ + type FormNotificationLevel = Xrm.FormNotificationLevel; + + /** + * Display States for Xrm.ui.ProcessMonitor.setDisplayState(). + * @deprecated Use {@link Xrm.DisplayState} instead. + */ + type DisplayState = Xrm.DisplayState; + + /** + * Interface for Xrm.Page.ui.process API + * @deprecated Use {@link Xrm.Controls.ProcessControl} instead. + */ + interface ProcessManager extends Controls.ProcessControl { } + + /** + * Interface for a grid. Use Grid methods to access information about data in the grid. Grid is returned by the + * GridControl.getGrid method. + * @deprecated Use {@link Xrm.Controls.Grid} instead. + */ + interface Grid extends Controls.Grid { } + + /** + * Interface for a grid row. Use the GridRow.getData method to access the GridRowData. A collection of GridRow is + * returned by Grid.getRows and Grid.getSelectedRows methods. + * In V9 - this is essentailly a form context. + * @deprecated Use {@link Xrm.Controls.Grid.GridRow} instead. + */ + interface GridRow extends Controls.Grid.GridRow { } + + /** + * Interface for grid row data. Use the GridRowData.getEntity method to access the GridEntity. GridRowData is + * returned by the GridRow.getData method. + * @deprecated Use {@link Xrm.Controls.Grid.GridRowData} instead. + */ + interface GridRowData extends Controls.Grid.GridRowData { } + + /** + * Interface for a grid entity. Use the GridEntity methods to access data about the specific records in the rows. + * GridEntity is returned by the GridRowData.getEntity method. + * @deprecated Use {@link Xrm.Controls.Grid.GridRowData} instead.v + */ + interface GridEntity extends Controls.Grid.GridEntity { } + + /** + * Interface for the view selector. Use the ViewSelector methods to get or set information about the view selector + * of the grid control. + * @deprecated Use {@link Xrm.Controls.ViewSelector} instead. + */ + interface ViewSelector extends Controls.ViewSelector { } + + /** + * Interface for a view selector item. This object contains data that identifies a view. Use this as a parameter to + * the ViewSelector.setCurrentView method. + * @deprecated Use {@link Xrm.Controls.ViewSelectorItem} instead. + */ + interface ViewSelectorItem extends Controls.ViewSelectorItem { } + + /** + * Interface for a quick view control instance on a form. + * @see {@link https://msdn.microsoft.com/en-us/library/mt736908.aspx External Link: Xrm.Page.ui quickForms (client-side reference)} + * @deprecated Use {@link Xrm.Controls.ViewSelectorItem} instead. + */ + interface QuickForm extends Controls.QuickFormControl { } + } + } + + /** + * Interface for a Lookup value. + */ + interface LookupValue { + /** + * The identifier. + */ + id: string; + + /** + * The name + */ + name?: string; + + /** + * Type of the entity. + */ + entityType: string; + } + + /** + * Interface for an OptionSet value. + */ + interface OptionSetValue { + /** + * The label text. + */ + text: string; + + /** + * The value, as a number + */ + value: number; + } + + /** + * A collection of types and methods for working with formContext attributes. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/attributes External Link: Attributes (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + namespace Attributes { + /** + * Requirement Level for {@link Attributes.Attribute.getRequiredLevel Attributes.Attribute.getRequiredLevel()} and + * {@link Attributes.Attribute.setRequiredLevel Attributes.Attribute.setRequiredLevel()}. + * @see XrmEnum.AttributeRequirementLevel + */ + type RequirementLevel = "none" | "recommended" | "required"; + + /** + * Date attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.DateAttribute DateAttribute}. + * @see XrmEnum.DateAttributeFormat + */ + type DateAttributeFormat = "date" | "datetime"; + + /** + * Integer attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.NumberAttribute NumberAttribute}. + * @see XrmEnum.IntegerAttributeFormat + */ + type IntegerAttributeFormat = "duration" | "none"; + + /** + * OptionSet attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.OptionSetAttribute OptionSetAttribute}. + * @see XrmEnum.OptionSetAttributeFormat + */ + type OptionSetAttributeFormat = "language" | "timezone"; + + /** + * String attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.StringAttribute StringAttribute}. + * @see XrmEnum.StringAttributeFormat + */ + type StringAttributeFormat = "email" | "phone" | "text" | "textarea" | "tickersymbol" | "url"; + + /** + * Attribute types for {@link Attributes.Attribute.setDisplayState()}. + * @see XrmEnum.AttributeType + */ + type AttributeType = "boolean" | "datetime" | "decimal" | "double" | "integer" | + "lookup" | "memo" | "money" | "multioptionset" | "optionset" | "string"; + + /** + * Attribute formats for {@link Attributes.Attribute.getFormat Attributes.Attribute.getFormat()}. + * @see XrmEnum.DateAttributeFormat + * @see XrmEnum.IntegerAttributeFormat + * @see XrmEnum.OptionSetAttributeFormat + * @see XrmEnum.StringAttributeFormat + */ + type AttributeFormat = DateAttributeFormat | IntegerAttributeFormat | OptionSetAttributeFormat | StringAttributeFormat; + + /** + * Interface for an Entity attribute. + */ + interface Attribute { + /** + * Adds a handler to be called when the attribute's value is changed. + * @param handler The function reference. + */ + addOnChange(handler: Events.ContextSensitiveHandler): void; + + /** + * Fire all "on change" event handlers. + */ + fireOnChange(): void; + + /** + * Gets attribute type. + * @returns The attribute's type name. + * Values returned are: boolean + * datetime + * decimal + * double + * integer + * lookup + * memo + * money + * optionset + * string + */ + getAttributeType(): string; + + /** + * Gets the attribute format. + * + * @returns The format of the attribute. + * + * @see getAttributeType + * Values returned are: date (datetime) + * datetime (datetime) + * duration (integer) + * email (string) + * language (optionset) + * none (integer) + * phone (string) + * text (string) + * textarea (string) + * tickersymbol (string) + * timezone (optionset) + * url (string) + */ + getFormat(): AttributeFormat; + + /** + * Gets a boolean value indicating whether this Attribute has unsaved changes. + * @returns true if there are unsaved changes, otherwise false. + */ + getIsDirty(): boolean; + + /** + * Gets the logical name of the attribute. + * @returns The logical name. + */ + getName(): string; + + /** + * Gets a reference to the record context of this attribute. + * @returns The parent record context. + */ + getParent(): Entity; + + /** + * Gets the current level of requirement for the attribute. + * @returns The required level, as either "none", "required", or "recommended" + */ + getRequiredLevel(): RequirementLevel; + + /** + * Gets current submit mode for the attribute. + * @returns The submit mode, as either "always", "never", or "dirty" + * @remarks The default value is "dirty" + */ + getSubmitMode(): SubmitMode; + + /** + * Gets the current user's privileges for the attribute. + * @returns The user privileges. + */ + getUserPrivilege(): Privilege; + + /** + * Removes the handler from the "on change" event. + * @param handler The handler. + */ + removeOnChange(handler: Events.ContextSensitiveHandler): void; + + /** + * Sets the required level. + * @param requirementLevel The requirement level, as either "none", "required", or "recommended" + * @see XrmEnum.AttributeRequirementLevel + */ + setRequiredLevel(requirementLevel: RequirementLevel): void; + + /** + * Sets the submit mode. + * @param submitMode The submit mode, as either "always", "never", or "dirty". + * @default submitMode "dirty" + * @see XrmEnum.AttributeRequirementLevel + */ + setSubmitMode(submitMode: SubmitMode): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + + /** + * Gets the value. + * @returns The value. + */ + getValue(): any; + + /** + * Sets the value. + * @param value The value. + */ + setValue(value: any): void; + } + + /** + * Interface for a Number attribute. + * @see Attribute + */ + interface NumberAttribute extends Attribute { + /** + * Gets the attribute format. + * @returns The format of the attribute. + * Values returned are: duration, none + */ + getFormat(): IntegerAttributeFormat; + + /** + * Gets the maximum value allowed. + * @returns The maximum value allowed. + */ + getMax(): number; + + /** + * Gets the minimum value allowed. + * @returns The minimum value allowed. + */ + getMin(): number; + + /** + * Gets the attribute's configured precision. + * @returns The total number of allowed decimal places. + */ + getPrecision(): number; + + /** + * Gets the value. + * @returns The value. + */ + getValue(): number; + + /** + * Sets the value. + * @param value The value. + * @remarks Attributes on Quick Create Forms will not save values set with this method. + */ + setValue(value: number): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + } + + /** + * Interface for a String attribute. + * @see Attribute + */ + interface StringAttribute extends Attribute { + /** + * Gets the attribute format. + * @returns The format of the attribute. + * Values returned are: email, phone, text, textarea, tickersymbol, url + */ + getFormat(): StringAttributeFormat; + + /** + * Gets maximum length allowed. + * + * @returns The maximum length allowed. + * + * @remarks The email form's "Description" attribute does not have the this method. + */ + getMaxLength(): number; + + /** + * Gets the value. + * + * @returns The value. + */ + getValue(): string; + + /** + * Sets the value. + * @param value The value. + * @remarks A String field with the {@link Attribute.getFormat|email} format enforces email + * address formatting. Attributes on Quick Create Forms will not save values set + * with this method. + */ + setValue(value: string): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + } + + /** + * Common interface for enumeration attributes (OptionSet and Boolean). + * @see Attribute + */ + interface EnumAttribute extends Attribute { + /** + * Gets the initial value of the attribute. + * @returns The initial value. + * @remarks Valid for OptionSet and boolean attribute types + */ + getInitialValue(): number | boolean; + } + + /** + * Interface for a Boolean attribute. + * @see EnumAttribute + */ + interface BooleanAttribute extends EnumAttribute { + /** + * Gets the initial value of the attribute. + * @returns The initial value. + * @remarks Valid for OptionSet and boolean attribute types + */ + getInitialValue(): boolean; + + /** + * Gets the value. + * @returns true if it succeeds, false if it fails. + */ + getValue(): boolean; + + /** + * Sets the value. + * @param value The value. + * @remarks Attributes on Quick Create Forms will not save values set with this method. + */ + setValue(value: boolean): void; + } + + /** + * Interface for a Date attribute. + * + * @see Attribute + */ + interface DateAttribute extends Attribute { + /** + * Gets the attribute format. + * + * @returns The format of the attribute. + * Values returned are: date, datetime + */ + getFormat(): DateAttributeFormat; + + /** + * Gets the value. + * @returns The value. + */ + getValue(): Date; + + /** + * Sets the value. + * @param value The value. + * @remarks Attributes on Quick Create Forms will not save values set with this method. + */ + setValue(value: Date): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + } + + /** + * Interface an OptionSet attribute. + * @see EnumAttribute + */ + interface OptionSetAttribute extends EnumAttribute { + /** + * Gets the attribute format. + * @returns The format of the attribute. + * Values returned are: language, timezone + */ + getFormat(): OptionSetAttributeFormat; + + /** + * Gets the initial value of the attribute. + * @returns The initial value. + * @remarks Valid for OptionSet and boolean attribute types + */ + getInitialValue(): number; + + /** + * Gets the option matching a value. + * @param value The enumeration value of the option desired. + * @returns The option. + */ + getOption(value: number): OptionSetValue; + + /** + * Gets the option matching a label. + * @param label The label of the option desired. + * @returns The option. + */ + getOption(label: string): OptionSetValue; + + /** + * Gets all of the options. + * @returns An array of options. + */ + getOptions(): OptionSetValue[]; + + /** + * Gets selected option. + * @returns The selected option. + */ + getSelectedOption(): OptionSetValue; + + /** + * Gets the label of the currently selected option. + * @returns The current value's label. + */ + getText(): string; + + /** + * Gets the value. + * @returns The value. + */ + getValue(): number; + + /** + * Sets the value. + * @param value The value. + * @remarks The getOptions() method returns option values as strings. You must use parseInt + * to convert them to numbers before you can use those values to set the value of an + * OptionSet attribute. Attributes on Quick Create Forms will not save values set + * with this method. + */ + setValue(value: number): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + } + + /** + * Interface a Lookup attribute. + * + * @see Attribute + */ + interface LookupAttribute extends Attribute { + /** + * Gets a boolean value indicating whether the Lookup is a multi-value PartyList. + * @returns true the attribute is a PartyList, otherwise false. + */ + getIsPartyList(): boolean; + + /** + * Gets the value. + * @returns An array of LookupValue. + */ + getValue(): LookupValue[]; + + /** + * Sets the value. + * @param value The value. + * @remarks Attributes on Quick Create Forms will not save values set with this method. + */ + setValue(value: LookupValue[]): void; + + /** + * A collection of all the controls on the form that interface with this attribute. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; + } + } + + /** + * A collection of types and methods for working with formContext controls. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + namespace Controls { + /** + * Control type for formContext.ui.quickForms.getControlType(). + */ + type ControlQuickFormType = "quickform"; + + /** + * Control types for {@link Controls.Control.getControlType Controls.Control.getControlType()}. + * @see XrmEnum.StandardControlType + */ + type ControlType = "standard" | "iframe" | "lookup" | "optionset" | + "subgrid" | "webresource" | "notes" | "timercontrol" | "kbsearch" | + "timelinewall" | ControlQuickFormType; /** * Interface for UI elements with labels. @@ -1499,7 +2502,7 @@ declare namespace Xrm { /** * Gets the label. * - * @return The label. + * @returns The label. */ getLabel(): string; @@ -1518,7 +2521,7 @@ declare namespace Xrm { /** * Gets the visibility state. * - * @return true if the tab is visible, otherwise false. + * @returns true if the tab is visible, otherwise false. */ getVisible(): boolean; } @@ -1565,10 +2568,11 @@ declare namespace Xrm { /** * Use this to add a function as an event handler for the keypress event so that the function is called when you type a character in the specific text or number field. * For a sample JavaScript code that uses the addOnKeyPress method to configure the auto-completion experience, see Sample: Auto-complete in CRM controls. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * @param handler The function reference. */ - addOnKeyPress(handler: ContextSensitiveHandler): void; + addOnKeyPress(handler: Events.ContextSensitiveHandler): void; /** * Use this to manually fire an event handler that you created for a specific text or number field to be executed on the keypress event. @@ -1577,11 +2581,12 @@ declare namespace Xrm { /** * Use this to remove an event handler for a text or number field that you added using addOnKeyPress. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * Remarks: If an anonymous function is set using addOnKeyPress, it can’t be removed using this method. * @param handler The function reference. */ - removeOnKeyPress(handler: ContextSensitiveHandler): void; + removeOnKeyPress(handler: Events.ContextSensitiveHandler): void; } /** @@ -1645,944 +2650,14 @@ declare namespace Xrm { } /** - * Interface for a Lookup value. - */ - interface LookupValue { - /** - * The identifier. - */ - id: string; - - /** - * The name - */ - name?: string; - - /** - * Type of the entity. - */ - entityType: string; - } - - /** - * Interface for an OptionSet value. - */ - interface OptionSetValue { - /** - * The label text. - */ - text: string; - - /** - * The value, as a number - */ - value: number; - } - - /** - * Interface for a privilege. - */ - interface Privilege { - /** - * True if the user can read. - */ - canRead: boolean; - - /** - * True if the user can update. - */ - canUpdate: boolean; - - /** - * True if the user can create. - */ - canCreate: boolean; - } - - /** - * Interface for an Entity attribute. - */ - interface Attribute { - /** - * Adds a handler to be called when the attribute's value is changed. - * - * @param handler The function reference. - */ - addOnChange(handler: ContextSensitiveHandler): void; - - /** - * Fire all "on change" event handlers. - */ - fireOnChange(): void; - - /** - * Gets attribute type. - * - * @return The attribute's type name. - * - * @remarks Values returned are: boolean - * datetime - * decimal - * double - * integer - * lookup - * memo - * money - * optionset - * string - */ - getAttributeType(): string; - - /** - * Gets the attribute format. - * - * @return The format of the attribute. - * - * @see {@link getAttributeType()} - * - * @remarks Values returned are: date (datetime) - * datetime (datetime) - * duration (integer) - * email (string) - * language (optionset) - * none (integer) - * phone (string) - * text (string) - * textarea (string) - * tickersymbol (string) - * timezone (optionset) - * url (string) - */ - getFormat(): AttributeFormat; - - /** - * Gets a boolean value indicating whether this Attribute has unsaved changes. - * - * @return true if there are unsaved changes, otherwise false. - */ - getIsDirty(): boolean; - - /** - * Gets the logical name of the attribute. - * - * @return The logical name. - */ - getName(): string; - - /** - * Gets a reference to the record context of this attribute. - * - * @return The parent record context. - */ - getParent(): Entity; - - /** - * Gets the current level of requirement for the attribute. - * - * @return The required level, as either "none", "required", or "recommended" - */ - getRequiredLevel(): RequirementLevel; - - /** - * Gets current submit mode for the attribute. - * - * @return The submit mode, as either "always", "never", or "dirty" - * - * @remarks The default value is "dirty" - */ - getSubmitMode(): SubmitMode; - - /** - * Gets the current user's privileges for the attribute. - * - * @return The user privileges. - */ - getUserPrivilege(): Privilege; - - /** - * Removes the handler from the "on change" event. - * - * @param handler The handler. - */ - removeOnChange(handler: ContextSensitiveHandler): void; - - /** - * Sets the required level. - * - * @param requirementLevel The requirement level, as either "none", "required", or "recommended" - */ - setRequiredLevel(requirementLevel: RequirementLevel): void; - - /** - * Sets the submit mode. - * - * @param submitMode The submit mode, as either "always", "never", or "dirty". - * - * @remarks The default value is "dirty" - */ - setSubmitMode(submitMode: SubmitMode): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - - /** - * Gets the value. - * - * @return The value. - */ - getValue(): any; - - /** - * Sets the value. - * - * @param value The value. - */ - setValue(value: any): void; - } - - /** - * Interface for a Number attribute. + * Interface for controls. * - * @sa Attribute - */ - interface NumberAttribute extends Attribute { - /** - * Gets the attribute format. - * - * @return The format of the attribute. - * - * @remarks Values returned are: duration - * none - */ - getFormat(): IntegerAttributeFormat; - - /** - * Gets the maximum value allowed. - * - * @return The maximum value allowed. - */ - getMax(): number; - - /** - * Gets the minimum value allowed. - * - * @return The minimum value allowed. - */ - getMin(): number; - - /** - * Gets the attribute's configured precision. - * - * @return The total number of allowed decimal places. - */ - getPrecision(): number; - - /** - * Gets the value. - * - * @return The value. - */ - getValue(): number; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks Attributes on Quick Create Forms will not save values set with this method. - */ - setValue(value: number): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - } - - /** - * Interface for a String attribute. - * - * @sa Attribute - */ - interface StringAttribute extends Attribute { - /** - * Gets the attribute format. - * - * @return The format of the attribute. - * - * @remarks Values returned are: email - * phone - * text - * textarea - * tickersymbol - * url - */ - getFormat(): StringAttributeFormat; - - /** - * Gets maximum length allowed. - * - * @return The maximum length allowed. - * - * @remarks The email form's "Description" attribute does not have the this method. - */ - getMaxLength(): number; - - /** - * Gets the value. - * - * @return The value. - */ - getValue(): string; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks A String field with the {@link Attribute.getFormat|email} format enforces email - * address formatting. Attributes on Quick Create Forms will not save values set - * with this method. - */ - setValue(value: string): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - } - - /** - * Common interface for enumeration attributes (OptionSet and Boolean). - * - * @sa Attribute - */ - interface EnumAttribute extends Attribute { - /** - * Gets the initial value of the attribute. - * - * @return The initial value. - * - * @remarks Valid for OptionSet and boolean attribute types - */ - getInitialValue(): number | boolean; - } - - /** - * Interface for a Boolean attribute. - * - * @sa EnumAttribute - */ - interface BooleanAttribute extends EnumAttribute { - /** - * Gets the initial value of the attribute. - * - * @return The initial value. - * - * @remarks Valid for OptionSet and boolean attribute types - */ - getInitialValue(): boolean; - - /** - * Gets the value. - * - * @return true if it succeeds, false if it fails. - */ - getValue(): boolean; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks Attributes on Quick Create Forms will not save values set with this method. - */ - setValue(value: boolean): void; - } - - /** - * Interface for a Date attribute. - * - * @sa Attribute - */ - interface DateAttribute extends Attribute { - /** - * Gets the attribute format. - * - * @return The format of the attribute. - * - * @remarks Values returned are: date - * datetime - */ - getFormat(): DateAttributeFormat; - - /** - * Gets the value. - * - * @return The value. - */ - getValue(): Date; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks Attributes on Quick Create Forms will not save values set with this method. - */ - setValue(value: Date): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - } - - /** - * Interface an OptionSet attribute. - * - * @sa EnumAttribute - */ - interface OptionSetAttribute extends EnumAttribute { - /** - * Gets the attribute format. - * - * @return The format of the attribute. - * - * @remarks Values returned are: language - * timezone - */ - getFormat(): OptionSetAttributeFormat; - - /** - * Gets the initial value of the attribute. - * - * @return The initial value. - * - * @remarks Valid for OptionSet and boolean attribute types - */ - getInitialValue(): number; - - /** - * Gets the option matching a value. - * - * @param value The enumeration value of the option desired. - * - * @return The option. - */ - getOption(value: number): OptionSetValue; - - /** - * Gets the option matching a label. - * - * @param label The label of the option desired. - * - * @return The option. - */ - getOption(label: string): OptionSetValue; - - /** - * Gets all of the options. - * - * @return An array of options. - */ - getOptions(): OptionSetValue[]; - - /** - * Gets selected option. - * - * @return The selected option. - */ - getSelectedOption(): OptionSetValue; - - /** - * Gets the label of the currently selected option. - * - * @return The current value's label. - */ - getText(): string; - - /** - * Gets the value. - * - * @return The value. - */ - getValue(): number; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks The getOptions() method returns option values as strings. You must use parseInt - * to convert them to numbers before you can use those values to set the value of an - * OptionSet attribute. Attributes on Quick Create Forms will not save values set - * with this method. - */ - setValue(value: number): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - } - - /** - * Interface a Lookup attribute. - * - * @sa Attribute - */ - interface LookupAttribute extends Attribute { - /** - * Gets a boolean value indicating whether the Lookup is a multi-value PartyList. - * - * @return true the attribute is a PartyList, otherwise false. - */ - getIsPartyList(): boolean; - - /** - * Gets the value. - * - * @return An array of LookupValue. - */ - getValue(): LookupValue[]; - - /** - * Sets the value. - * - * @param value The value. - * - * @remarks Attributes on Quick Create Forms will not save values set with this method. - */ - setValue(value: LookupValue[]): void; - - /** - * A collection of all the controls on the form that interface with this attribute. - */ - controls: Collection.ItemCollection; - } - - /** - * Interface for the form's record context, Xrm.Page.data.entity - */ - interface Entity { - /** - * Adds a handler to be called when the record is saved. - * - * @param handler The handler. - */ - addOnSave(handler: ContextSensitiveHandler): void; - - /** - * Gets an serialized-XML string representing data that will be passed to the server upon saving - * the record. - * - * @return The XML in string format. - * - * @remarks This function does not work with Microsoft Dynamics CRM for tablets. Example: - * "Contoso55555425 - * 555-1234". - */ - getDataXml(): string; - - /** - * Gets entity's logical name. - * - * @return The logical name. - */ - getEntityName(): string; - - /** - * Gets the record's unique identifier. - * - * @return The identifier, in Guid format. - * - * @remarks Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". - */ - getId(): string; - - /** - * Gets a boolean value indicating whether the record has unsaved changes. - * - * @return true if there are unsaved changes, otherwise false. - */ - getIsDirty(): boolean; - - /** - * Gets the record's primary attribute value. - * - * @return The primary attribute value. - * - * @remarks The value for this attribute is used when links to the record are displayed. - */ - getPrimaryAttributeValue(): string; - - /** - * Removes the handler from the "on save" event. - * - * @param handler The handler. - */ - removeOnSave(handler: ContextSensitiveHandler): void; - - /** - * Saves the record. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @remarks When using quick create forms in the web application the saveandnew option is not - * applied. It will always work as if saveandclose were used. Quick create forms in - * Microsoft Dynamics CRM for tablets will apply the saveandnew behavior. - */ - save(): void; - - /** - * Saves the record with the given save mode. - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} - * @param saveMode (Optional) the save mode to save, as either "saveandclose" or - * "saveandnew". - */ - save(saveMode: SaveMode): void; - - /** - * The collection of attributes for the record. - */ - attributes: Collection.ItemCollection; - } - - /** - * Interface for save event arguments. - */ - interface SaveEventArguments { - /** - * Gets save mode, as an integer. - * - * @return The save mode. - * - * @remarks Values returned are: 1 Save - * 2 Save and Close - * 59 Save and New - * 70 AutoSave (Where enabled; can be used with an OnSave handler - * to conditionally disable auto-saving) - * 58 Save as Completed (Activities) - * 5 Deactivate - * 6 Reactivate - * 47 Assign (All user- or team-owned entities) - * 7 Send (Email) - * 16 Qualify (Lead) - * 15 Disqualify (Lead) - */ - getSaveMode(): XrmEnum.SaveMode; - - /** - * Returns a boolean value to indicate if the record's save has been prevented. - * - * @return true if saving is prevented, otherwise false. - */ - isDefaultPrevented(): boolean; - - /** - * Prevents the save operation from being submitted to the server. - * - * @remarks All remaining "on save" handlers will continue execution. - */ - preventDefault(): void; - } - - /** - * Interface for process stage change event arguments. - */ - interface StageChangeEventArguments { - /** - * Gets the direction of the stage change. - * - * @return The direction. - * - * @remarks Values returned are: "next" or "previous" - */ - getDirection(): StageChangeDirection; - - /** - * Gets the destination stage object - * - * @return The stage object - * - * @remarks For switching between entities, returns the previous stage object - */ - getStage(): Stage; - } - - /** - * Interface for process stage selected event arguments. - */ - interface StageSelectedEventArguments { - /** - * Gets the selected stage object - * - * @return The stage object - */ - getStage(): Stage; - } - - /** - * Module for the Xrm.Page.data API. - */ - namespace data { - /** - * Interface for the Xrm.Page.data.process API. - */ - interface ProcessManager { - /** - * Returns a Process object representing the active process. - * - * @return current active process. - */ - getActiveProcess(): Process; - - /** - * Set a Process as the active process. - * - * @param processId The Id of the process to make the active process. - * @param callbackFunction (Optional) a function to call when the operation is complete. - */ - setActiveProcess(processId: string, callbackFunction?: ProcessCallbackDelegate): void; - - /** - * Returns all process instances for the entity record that the calling user has access to. - * - * @param callbackFunction (Optional) a function to call when the operation is complete. - */ - getProcessInstances(callbackFunction: GetProcessInstancesDelegate): void; - - /** - * Sets a process instance as the active instance - * - * @param processInstanceId The Id of the process instance to make the active instance. - * @param callbackFunction (Optional) a function to call when the operation is complete. - */ - setActiveProcessInstance(processInstanceId: string, callbackFunction: SetProcessInstanceDelegate): void; - - /** - * Returns a Stage object representing the active stage. - * - * @return current active stage. - */ - getActiveStage(): Stage; - - /** - * Set a stage as the active stage. - * - * @param stageId the Id of the stage to make the active stage. - * @param callbackFunction (Optional) a function to call when the operation is complete. - */ - setActiveStage(stageId: string, callbackFunction?: ProcessCallbackDelegate): void; - - /** - * Use this method to get a collection of stages currently in the active path with methods to interact with the - * stages displayed in the business process flow control. The active path represents stages currently rendered in - * the process control based on the branching rules and current data in the record. - * - * @return A collection of all completed stages, the currently active stage, and the predicted set of future stages - * based on satisfied conditions in the branching rule. This may be a subset of the stages returned with - * Xrm.Page.data.process.getActiveProcess because it will only include those stages which represent a valid - * transition from the current stage based on branching that has occurred in the process. - */ - getActivePath(): Collection.ItemCollection; - - /** - * Use this method to asynchronously retrieve the enabled business process flows that the user can switch to for an - * entity. - * - * @param callbackFunction The callback function must accept a parameter that contains an object with - * dictionary properties where the name of the property is the Id of the - * business process flow and the value of the property is the name of the - * business process flow. - * The enabled processes are filtered according to the user’s privileges. The - * list of enabled processes is the same ones a user can see in the UI if they - * want to change the process manually. - */ - getEnabledProcesses(callbackFunction: (enabledProcesses: ProcessDictionary) => void): void; - - /** - * Use this method to get the currently selected stage. - * - * @return The currently selected stage. - */ - getSelectedStage(): Stage; - - /** - * Use this to add a function as an event handler for the OnStageChange event so that it will be called when the - * business process flow stage changes. - * @param handler The function will be added to the bottom of the event - * handler pipeline. The execution context is automatically - * set to be the first parameter passed to the event handler. - * Use a reference to a named function rather than an - * anonymous function if you may later want to remove the - * event handler. - */ - addOnStageChange(handler: ContextSensitiveHandler): void; - - /** - * Use this to add a function as an event handler for the OnProcessStatusChange event so that it will be called when the - * business process flow status changes. - * @param handler The function will be added to the bottom of the event - * handler pipeline. The execution context is automatically - * set to be the first parameter passed to the event handler. - * Use a reference to a named function rather than an - * anonymous function if you may later want to remove the - * event handler. - */ - addOnProcessStatusChange(handler: ProcessStatusChangeHandler): void; - - /** - * Use this to add a function as an event handler for the OnStageSelected event so that it will be called - * when a business process flow stage is selected. - * - * @param handler The function will be added to the bottom of the event - * handler pipeline. The execution context is automatically - * set to be the first parameter passed to the event handler. - * Use a reference to a named function rather than an - * anonymous function if you may later want to remove the - * event handler. - */ - addOnStageSelected(handler: ContextSensitiveHandler): void; - - /** - * Use this to remove a function as an event handler for the OnProcessStatusChange event. - * - * @param handler If an anonymous function is set using the addOnProcessStatusChange method it - * cannot be removed using this method. - */ - removeOnProcessStatusChange(handler: ProcessStatusChangeHandler): void; - - /** - * Use this to remove a function as an event handler for the OnStageChange event. - * - * @param handler If an anonymous function is set using the addOnStageChange method it - * cannot be removed using this method. - */ - removeOnStageChange(handler: ContextSensitiveHandler): void; - - /** - * Use this to remove a function as an event handler for the OnStageChange event. - * - * @param handler If an anonymous function is set using the addOnStageChange method it - * cannot be removed using this method. - */ - removeOnStageSelected(handler: ContextSensitiveHandler): void; - - /** - * Progresses to the next stage. - * - * @param callbackFunction (Optional) A function to call when the operation is complete. - * - */ - moveNext(callbackFunction?: ProcessCallbackDelegate): void; - - /** - * Moves to the previous stage. - * - * @param callbackFunction (Optional) A function to call when the operation is complete. - * . - */ - movePrevious(callbackFunction?: ProcessCallbackDelegate): void; - - /** - * Use this method to get the unique identifier of the process instance - * - * @return The unique identifier of the process instance - */ - getInstanceId(): string; - - /** - * Use this method to get the name of the process instance - * - * @return The name of the process instance - */ - getInstanceName(): string; - - /** - * Use this method to get the current status of the process instance - * - * @return The current status of the process - */ - getStatus(): ProcessStatus; - - /** - * Use this method to set the current status of the process instance - * - * @param status The new status for the process - * @param callbackFunction (Optional) a function to call when the operation is complete. - */ - setStatus(status: ProcessStatus, callbackFunction: ProcessSetStatusDelegate): void; - } - - /** - * Called when method to get active processes is complete - * - * @param status The result of the get active processes operation. - * - * @remarks Returns object with the following key-value pairs: - * CreatedOn - * ProcessDefinitionID - * ProcessDefinitionName - * ProcessInstanceID - * ProcessInstanceName - * StatusCodeName - */ - type GetProcessInstancesDelegate = (object: ProcessDictionary) => void; - - /** - * Called when method to set active process is complete - * - * @param status The result of the set active process operation. - * - * @remarks Values returned are: success (The operation succeeded.) - * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) - */ - type SetProcessInstanceDelegate = (status: string) => void; - - /** - * Called when process change methods have completed. - * - * @param status The result of the process change operation. - * - * @remarks Values returned are: success (The operation succeeded.) - * crossEntity (The previous stage is for a different entity.) - * beginning (The active stage is the first stage of the active path.) - * invalid (The operation failed because the selected stage isn’t the same - * as the active stage.) - * unreachable (The stage exists on a different path.) - */ - type ProcessCallbackDelegate = (status: string) => void; - - /** - * Called when process set status method has completed. - * - * @param status The new status of the process instance - * - * @remarks Values returned are: active - * aborted - * finished - */ - type ProcessSetStatusDelegate = (status: ProcessStatus) => void; - - /** - * Represents a key-value pair, where the key is the Process Flow's ID, and the value is the name thereof. - */ - interface ProcessDictionary { [index: string]: string; } - } - - /** - * Interface for Xrm.Page.ui controls. - * - * @sa UiElement + * @see UiElement */ interface Control extends UiLabelElement, UiCanGetVisibleElement { /** * Gets the controls type. - * - * @return The control type. - * + * @returns The control type. * @remarks Values returned are: standard * iframe * lookup @@ -2600,9 +2675,7 @@ declare namespace Xrm { /** * Gets the name of the control on the form. - * - * @return The name of the control. - * + * @returns The name of the control. * @remarks The name assigned to a control is not determined until the form loads. Changes to * the form may change the name assigned to a given control. * When you use the control getName method the name of the first control will be the @@ -2619,50 +2692,66 @@ declare namespace Xrm { /** * Gets a reference to the Section parent of the control. * - * @return The parent Section. + * @returns The parent Section. */ getParent(): Section; } + /** + * Interface for {@link Ui.navigation formContext.ui.navigation}. + */ + interface Navigation { + /** + * A reference to the collection of available navigation items. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + items: Collection.ItemCollection; + } + + /** + * Interface for a navigation item. + * @see UiElement + * @see UiFocusable + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-navigation formContext.ui.navigation item (Client API reference)} + */ + interface NavigationItem extends UiStandardElement, UiFocusable { + /** + * Gets the name of the item. + * @returns The identifier. + */ + getId(): string; + } + /** * Interface for a standard control. - * - * @sa Control + * @see Control */ interface StandardControl extends Control, UiStandardElement, UiFocusable { /** * Clears the notification identified by uniqueId. - * * @param uniqueId (Optional) Unique identifier. - * - * @return true if it succeeds, false if it fails. - * + * @returns true if it succeeds, false if it fails. * @remarks If the uniqueId parameter is not used, the current notification shown will be removed. */ clearNotification(uniqueId?: string): boolean; /** * Gets a boolean value, indicating whether the control is disabled. - * - * @return true if it is disabled, otherwise false. + * @returns true if it is disabled, otherwise false. */ getDisabled(): boolean; /** * Sets the state of the control to either enabled, or disabled. - * * @param disabled true to disable, false to enable. */ setDisabled(disabled: boolean): void; /** * Sets a control-local notification message. - * * @param message The message. * @param uniqueId Unique identifier. - * - * @return true if it succeeds, false if it fails. - * + * @returns true if it succeeds, false if it fails. * @remarks When this method is used on Microsoft Dynamics CRM for tablets a red "X" icon * appears next to the control. Tapping on the icon will display the message. */ @@ -2675,28 +2764,25 @@ declare namespace Xrm { /** * Gets the control's bound attribute. - * - * @tparam T An Attribute type. - * - * @return The attribute. + * @template T An Attribute type. + * @returns The attribute. */ - getAttribute(): T; + getAttribute(): T; /** * Gets the control's bound attribute. - * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): Attribute; + getAttribute(): Attributes.Attribute; } /** * Interface for Auto Lookup Control. * This is not an Entity Lookup, but a control that supports AutoComplete / KeyPress Events (Text or Number) - * * @remarks This interface is not supported for CRM mobile clients (phones or tablets) and the interactive service hub. It is only available for Updated entities. - * - * @sa StandardControl + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see StandardControl */ interface AutoLookupControl extends StandardControl, UiKeyPressable { /** @@ -2709,14 +2795,16 @@ declare namespace Xrm { /** * Hides the auto-completion drop-down list configured for a specific text field - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} */ hideAutoComplete(): void; /** * Shows upt to 10 matching strings in a drop-down list as users press keys to type charactrer in a specific text field. * On selecting an item in the drop-down list, the value in the text field changes to the selected item, the drop-down list disappears, and the OnChange event for the text field is invoked - * @deprecated: Deprecated in v9. See {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated} + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} * @param resultSet The results to show */ showAutoComplete(resultSet: AutoCompleteResultSet): void; @@ -2724,55 +2812,47 @@ declare namespace Xrm { /** * Interface for a String control. - * - * @sa StandardControl + * @see StandardControl */ interface StringControl extends AutoLookupControl { /** * Gets the control's bound attribute. - * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): StringAttribute; + getAttribute(): Attributes.StringAttribute; } /** * Interface for a Number control. - * - * @sa StandardControl + * @see StandardControl */ interface NumberControl extends AutoLookupControl { /** * Gets the control's bound attribute. - * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): NumberAttribute; + getAttribute(): Attributes.NumberAttribute; } /** * Interface for a Date control. - * - * @sa StandardControl + * @see StandardControl */ interface DateControl extends StandardControl { /** * Gets the control's bound attribute. - * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): DateAttribute; + getAttribute(): Attributes.DateAttribute; /** * Gets the status of the time-of-day component of the Date control. - * - * @return true if the time is shown, otherwise false. + * @returns true if the time is shown, otherwise false. */ getShowTime(): boolean; /** * Sets the visibility of the time component of the Date control. - * * @param showTimeValue true to show, false to hide the time value. */ setShowTime(showTimeValue: boolean): void; @@ -2780,30 +2860,24 @@ declare namespace Xrm { /** * Interface for a Lookup control. - * - * @sa StandardControl + * @see StandardControl */ interface LookupControl extends StandardControl { /** * Adds a handler to the "pre search" event of the Lookup control. - * * @param handler The handler. */ - addPreSearch(handler: ContextSensitiveHandler): void; + addPreSearch(handler: Events.ContextSensitiveHandler): void; /** * Adds an additional custom filter to the lookup, with the "AND" filter operator. * Can only be used within a "pre search" event handler - * - * @sa addPreSearch - * - * @param filter Specifies the filter, as a serialized FetchXML - * "filter" node. + * @see addPreSearch + * @param filter Specifies the filter, as a serialized FetchXML "filter" node. * @param entityLogicalName (Optional) The logical name of the entity. - * * @remarks If entityLogicalName is not specified, the filter will be applied to all entities * valid for the Lookup control. - * Example filter: + * @example Example filter: * * */ @@ -2811,51 +2885,43 @@ declare namespace Xrm { /** * Adds a custom view for the Lookup dialog. - * * @param viewId Unique identifier for the view, in Guid format. * @param entityName Name of the entity. * @param viewDisplayName Name of the view to display. * @param fetchXml The FetchXML query for the view's contents, serialized as a string. * @param layoutXml The Layout XML, serialized as a string. * @param isDefault true, to treat this view as default. - * * @remarks Cannot be used on "Owner" Lookup controls. * The viewId is never saved to CRM, but must be unique across available views. Generating - * a new value can be accomplished with a {@link http://www.guidgen.com/|Guid generator}. - * Example viewId value: "{00000000-0000-0000-0000-000000000001}" - * Layout XML Reference: {@link http://msdn.microsoft.com/en-us/library/gg334522.aspx}. + * a new value can be accomplished with a {@link http://www.guidgen.com/ Guid generator(external link)}. + * @example Example viewId value: "{00000000-0000-0000-0000-000000000001}" + * @see {@link http://msdn.microsoft.com/en-us/library/gg334522.aspx External Link: Layout XML Reference} */ addCustomView(viewId: string, entityName: string, viewDisplayName: string, fetchXml: string, layoutXml: string, isDefault: boolean): void; /** * Gets the control's bound attribute. - * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): LookupAttribute; + getAttribute(): Attributes.LookupAttribute; /** * Gets the unique identifier of the default view. - * - * @return The default view, in Guid format. - * - * @remarks Example: "{00000000-0000-0000-0000-000000000000}" + * @returns The default view, in Guid format. + * @example Example return: "{00000000-0000-0000-0000-000000000000}" */ getDefaultView(): string; /** * Removes the handler from the "pre search" event of the Lookup control. - * * @param handler The handler. */ removePreSearch(handler: () => void): void; /** * Sets the Lookup's default view. - * * @param viewGuid Unique identifier for the view. - * - * @remarks Example viewGuid value: "{00000000-0000-0000-0000-000000000000}" + * @example Example viewGuid value: "{00000000-0000-0000-0000-000000000000}" */ setDefaultView(viewGuid: string): void; @@ -2873,7 +2939,7 @@ declare namespace Xrm { /** * Interface for an OptionSet control. * - * @sa StandardControl + * @see StandardControl */ interface OptionSetControl extends StandardControl { /** @@ -2895,9 +2961,9 @@ declare namespace Xrm { /** * Gets the control's bound attribute. * - * @return The attribute. + * @returns The attribute. */ - getAttribute(): OptionSetAttribute; + getAttribute(): Attributes.OptionSetAttribute; /** * Removes the option matching the value. @@ -2910,7 +2976,7 @@ declare namespace Xrm { /** * Interface for a CRM grid control. * - * @sa Control + * @see Control */ interface GridControl extends Control { /** @@ -2923,277 +2989,73 @@ declare namespace Xrm { /** * This method returns context information about the GridControl. * - * @return The context type. + * @returns The context type. */ getContextType(): XrmEnum.GridControlContext; /** * Use this method to get the logical name of the entity data displayed in the grid. * - * @return The entity name. + * @returns The entity name. */ getEntityName(): string; /** * Use this method to get access to the Grid available in the GridControl. - * - * @return The grid. + * @returns The grid. */ - getGrid(): ui.Grid; + getGrid(): Grid; /** * Use this method to get access to the ViewSelector available for the GridControl when it is configured to display views. - * - * @return The view selector. + * @returns The view selector. */ - getViewSelector(): ui.ViewSelector; + getViewSelector(): ViewSelector; /** * Refreshes the sub grid. - * * @remarks Not available during the "on load" event of the form. */ refresh(): void; /** * Use this method to remove event handlers from the GridControl's OnLoad event. - * * @param handler The handler. */ removeOnLoad(handler: () => void): void; } /** - * Interface for a framed control, which is either a Web Resource or an Iframe. - * - * @sa Control - * - * @remarks An Iframe control provides additional methods, so use {@link IframeControl} where - * appropriate. Silverlight controls should use {@link SilverlightControl}. + * Interface for a grid. Use Grid methods to access information about data in the grid. Grid is returned by the + * GridControl.getGrid method. */ - interface FramedControl extends Control { + interface Grid { /** - * Gets the DOM element containing the control. - * - * @return The container object. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + * Returns a collection of every GridRow in the Grid. + * @returns The rows. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - getObject(): HTMLIFrameElement; + getRows(): Collection.ItemCollection; /** - * Gets the URL value of the control. - * - * @return The source URL. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + * Returns a collection of every selected GridRow in the Grid. + * @returns The selected rows. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ - getSrc(): string; + getSelectedRows(): Collection.ItemCollection; /** - * Sets the URL value of the control. - * - * @param src The source URL. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + * Returns the total number of records in the Grid. + * @returns The total record count. */ - setSrc(src: string): void; + getTotalRecordCount(): number; } - /** - * Interface for an Iframe control. - * - * @sa FramedControl - */ - interface IframeControl extends FramedControl, UiCanSetVisibleElement { - /** - * Gets initial URL defined for the Iframe. - * - * @return The initial URL. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. - */ - getInitialUrl(): string; - } - - /** - * Interface for a Silverlight control. - * - * @sa Control - */ - interface SilverlightControl extends Control { - /** - * Gets the query string value passed to Silverlight. - * - * @return The data. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. - */ - getData(): string; - - /** - * Sets the query string value passed to Silverlight. - * - * @param data The data. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. - */ - setData(data: string): void; - - /** - * Gets the DOM element containing the control. - * - * @return The container object. - * - * @remarks Unavailable for Microsoft Dynamics CRM for tablets. - */ - getObject(): HTMLObjectElement; - } - - /** - * Interface for a Timeline control. - * - * @sa Control - */ - interface TimelineWall extends Control { - /** - * Refreshes the data displayed in a timelinewall and timer control. - * - */ - refresh(): void; - } - - /** - * Interface for a form tab. - * - * @sa UiElement - * @sa UiFocusable - */ - interface Tab extends UiStandardElement, UiFocusable { - /** - * Gets display state of the tab. - * - * @return The display state, as either "expanded" or "collapsed" - */ - getDisplayState(): ui.DisplayState; - - /** - * Gets the name of the tab. - * - * @return The name. - */ - getName(): string; - - /** - * Gets a reference to the Xrm.Page.ui parent of the tab. - * - * @return The parent. - */ - getParent(): Ui; - - /** - * Sets display state of the tab. - * - * @param displayState Display state of the tab, as either "expanded" or "collapsed" - */ - setDisplayState(displayState: ui.DisplayState): void; - - /** - * A reference to the collection of form sections within this tab. - */ - sections: Collection.ItemCollection
; - } - - /** - * Interface for a form section. - * - * @sa UiElement - */ - interface Section extends UiStandardElement { - /** - * Gets the name of the section. - * - * @return The name. - */ - getName(): string; - - /** - * Gets a reference to the Xrm.Page.Tab parent of this item. - * - * @return The parent. - */ - getParent(): Tab; - - /** - * A reference to the collection of controls within this tab. - */ - controls: Collection.ItemCollection; - } - - /** - * Module for Xrm.Page.ui API. - */ - namespace ui { - /** - * Form Notification Levels for Xrm.Ui.setFormNotification(). - */ - type FormNotificationLevel = "ERROR" | "INFO" | "WARNING"; - - /** - * Display States for Xrm.ui.ProcessMonitor.setDisplayState(). - */ - type DisplayState = "collapsed" | "expanded"; - - /** - * Interface for Xrm.Page.ui.process API - */ - interface ProcessManager { - /** - * Sets display state of the process flow control. - * - * @param displayState Display state of the process flow control, as either "expanded" or "collapsed" - */ - setDisplayState(displayState: DisplayState): void; - - /** - * Sets the visibility state. - * - * @param visible true to show, false to hide. - */ - setVisible(visible: boolean): void; - } - - /** - * Interface for a grid. Use Grid methods to access information about data in the grid. Grid is returned by the - * GridControl.getGrid method. - */ - interface Grid { - /** - * Returns a collection of every GridRow in the Grid. - * - * @return The rows. - */ - getRows(): Collection.ItemCollection; - - /** - * Returns a collection of every selected GridRow in the Grid. - * - * @return The selected rows. - */ - getSelectedRows(): Collection.ItemCollection; - - /** - * Returns the total number of records in the Grid. - * - * @return The total record count. - */ - getTotalRecordCount(): number; - } - + namespace Grid { /** * Interface for a grid row. Use the GridRow.getData method to access the GridRowData. A collection of GridRow is * returned by Grid.getRows and Grid.getSelectedRows methods. - * In V9 - this is essentailly a form context. + * In V9 - this is essentailly a form context */ interface GridRow { /** @@ -3203,7 +3065,7 @@ declare namespace Xrm { /** * Returns the GridRowData for the GridRow. * @deprecated Deprecated in V9 - use data field instead - * @return The data. + * @returns The data. */ getData(): GridRowData; } @@ -3215,8 +3077,8 @@ declare namespace Xrm { interface GridRowData { /** * Returns the GridEntity for the GridRowData. - * - * @return The entity. + * @returns The entity. + * @deprecated Use GridRow.data.entity instead of using GridRow.getData().getEntity(). */ getEntity(): GridEntity; } @@ -3224,232 +3086,254 @@ declare namespace Xrm { /** * Interface for a grid entity. Use the GridEntity methods to access data about the specific records in the rows. * GridEntity is returned by the GridRowData.getEntity method. + * + * @deprecated Use GridRow.data.entity instead. */ interface GridEntity { /** * Returns the logical name for the record in the row. * - * @return The entity name. + * @returns The entity name. + * @deprecated Use GridRow.data.entity.getEntityName() instead. */ getEntityName(): string; /** * Returns a LookupValue that references this record. * - * @return The entity reference. + * @returns The entity reference. + * @deprecated Use GridRow.data.entity.getEntityReference() instead. */ getEntityReference(): LookupValue; /** * Returns the id for the record in the row. * - * @return The identifier of the GridEntity, in GUID format. - * - * @remarks Example return: "{00000000-0000-0000-0000-000000000000}" + * @returns The identifier of the GridEntity, in GUID format. + * @example Example return: "{00000000-0000-0000-0000-000000000000}" + * @deprecated Use GridRow.data.entity.getId() instead. */ getId(): string; /** * Returns the primary attribute value for the record in the row. (Commonly the name.) * - * @return The primary attribute value. + * @returns The primary attribute value. + * @deprecated Use GridRow.data.entity.getPrimaryAttributeValue() instead. */ getPrimaryAttributeValue(): string; } - - /** - * Interface for the view selector. Use the ViewSelector methods to get or set information about the view selector - * of the grid control. - */ - interface ViewSelector { - /** - * Use this method to get a reference to the current view. - * - * @return The current view. - */ - getCurrentView(): ViewSelectorItem; - - /** - * Use this method to determine whether the view selector is visible. - * - * @return true if visible, false if not. - */ - isVisible(): boolean; - - /** - * Use this method to set the current view. - * - * @param viewSelectorItem The view selector item. - */ - setCurrentView(viewSelectorItem: ViewSelectorItem): void; - } - - /** - * Interface for a view selector item. This object contains data that identifies a view. Use this as a parameter to - * the ViewSelector.setCurrentView method. - */ - interface ViewSelectorItem { - /** - * Returns a LookupValue that references this view. - * - * @return The entity reference. - */ - getEntityReference(): LookupValue; - } - - /** - * Interface for a quick view control instance on a form. - * - * @see {@link https://msdn.microsoft.com/en-us/library/mt736908.aspx#bkmk_isLoaded} for details. - */ - interface QuickForm extends Control, UiLabelElement, UiCanGetVisibleElement { - /** - * Gets the constituent controls in a quick view control. - * - * @return An array of controls. - * - * @remarks Constituent controls in a quick view control are read only. - */ - getControl(): Control[]; - - /** - * Gets the constituent controls in a quick view control. - * - * @param T A Control type - * @param controlName Name of the control. - * - * @return The control. - * - * @remarks Constituent controls in a quick view control are read only. - */ - getControl(controlName: string): T; - - /** - * Gets the constituent controls in a quick view control. - * - * @param controlName Name of the control. - * - * @return The control. - * - * @remarks Constituent controls in a quick view control are read only. - */ - getControl(controlName: string): Control; - - /** - * Gets a control by index. - * - * @param T A Control type - * @param index The control index. - * - * @return The control. - * - * @remarks Constituent controls in a quick view control are read only. - */ - getControl(index: number): T; - - /** - * Gets a control by index. - * - * @param index The control index. - * - * @return The control. - * - * @remarks Constituent controls in a quick view control are read only. - */ - getControl(index: number): Control; - - /** - * Gets the controls type. - * - * @return Returns a string value that categorizes quick view controls. - */ - getControlType(): ControlQuickFormType; - - /** - * Returns whether the data binding for the constituent controls in a quick view control is complete. - * - * @return True is the data binding for a constituent control is complete, otherwise false. - * because the quick view form that the control is bound to may not have loaded completely. - * As a result, using the getAttribute or any data-related methods on a constituent control might not work. - * The isLoaded method for the quick view control helps determine the data binding status for constituent controls in a quick view control. - * - * @remarks The data binding for the constituent controls in a quick view control may not be complete during the main form OnLoad event - */ - isLoaded(): boolean; - - /** - * Refreshes the data displayed in a quick view control. - */ - refresh(): void; - } } /** - * Interface for a navigation item. - * - * @sa UiElement - * @sa UiFocusable + * Interface for a framed control, which is either a Web Resource or an Iframe. + * @see Control + * @remarks An Iframe control provides additional methods, so use {@link IframeControl} where + * appropriate. Silverlight controls should use {@link SilverlightControl}. */ - interface NavigationItem extends UiStandardElement, UiFocusable { + interface FramedControl extends Control { /** - * Gets the name of the item. - * - * @return The identifier. + * Gets the DOM element containing the control. + * @returns The container object. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. */ - getId(): string; + getObject(): HTMLIFrameElement; + + /** + * Gets the URL value of the control. + * @returns The source URL. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + */ + getSrc(): string; + + /** + * Sets the URL value of the control. + * @param src The source URL. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + */ + setSrc(src: string): void; } /** - * Interface for Xrm.Page.ui.navigation. + * Interface for an Iframe control. + * @see FramedControl */ - interface Navigation { + interface IframeControl extends FramedControl, UiCanSetVisibleElement { /** - * A reference to the collection of available navigation items. + * Gets initial URL defined for the Iframe. + * @returns The initial URL. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. */ - items: Collection.ItemCollection; + getInitialUrl(): string; } /** - * Interface for an entity's form selector item. + * Interface for a quick view control instance on a form. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-quickforms ExternalLink: formContext.ui.quickForms (Client API reference)} */ - interface FormItem { + interface QuickFormControl extends Control, UiLabelElement, UiCanGetVisibleElement { /** - * Gets the unique identifier of the form. - * - * @return The identifier, in Guid format. + * Gets the constituent controls in a quick view control. + * @returns An array of controls. + * @remarks Constituent controls in a quick view control are read only. */ - getId(): string; + getControl(): Control[]; /** - * Gets the label for the form. - * - * @return The label. + * Gets the constituent controls in a quick view control. + * @param T A Control type + * @param controlName Name of the control. + * @returns The control. + * @remarks Constituent controls in a quick view control are read only. */ - getLabel(): string; + getControl(controlName: string): T; /** - * Navigates the user to this form. + * Gets the constituent controls in a quick view control. + * @param controlName Name of the control. + * @returns The control. + * @remarks Constituent controls in a quick view control are read only. */ - navigate(): void; + getControl(controlName: string): Control; + + /** + * Gets a control by index. + * @param T A Control type + * @param index The control index. + * @returns The control. + * @remarks Constituent controls in a quick view control are read only. + */ + getControl(index: number): T; + + /** + * Gets a control by index. + * @param index The control index. + * @returns The control. + * @remarks Constituent controls in a quick view control are read only. + */ + getControl(index: number): Control; + + /** + * Gets the controls type. + * @returns Returns a string value ("quickform") that categorizes quick view controls. + */ + getControlType(): ControlQuickFormType; + + /** + * Returns whether the data binding for the constituent controls in a quick view control is complete. + * @returns True is the data binding for a constituent control is complete, otherwise false. + * because the quick view form that the control is bound to may not have loaded completely. + * As a result, using the getAttribute or any data-related methods on a constituent control might not work. + * The isLoaded method for the quick view control helps determine the data binding status for constituent controls in a quick view control. + * @remarks The data binding for the constituent controls in a quick view control may not be complete during the main form OnLoad event + */ + isLoaded(): boolean; + + /** + * Refreshes the data displayed in a quick view control. + */ + refresh(): void; } /** - * Interface for the form selector API. + * Interface for a Silverlight control. + * @see Control + * @deprecated The Silverlight WebResource is deprecated on the web client, and is not supported on the new Unified Interface in v9. + * Instead of silverlight, use custom controls created using the HTML web resources with HTML5 to create UI components to visualize and interact with data. */ - interface FormSelector { + interface SilverlightControl extends Control { /** - * Gets current form. - * - * @return The current item. - * - * @remarks When only one form is available this method will return null. + * Gets the query string value passed to Silverlight. + * @returns The data. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. */ - getCurrentItem(): FormItem; + getData(): string; /** - * A reference to the collection of available forms. + * Sets the query string value passed to Silverlight. + * @param data The data. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. */ - items: Collection.ItemCollection; + setData(data: string): void; + + /** + * Gets the DOM element containing the control. + * @returns The container object. + * @remarks Unavailable for Microsoft Dynamics CRM for tablets. + */ + getObject(): HTMLObjectElement; + } + + /** + * Interface for a Timeline control. + * @see Control + */ + interface TimelineWall extends Control { + /** + * Refreshes the data displayed in a timelinewall and timer control. + */ + refresh(): void; + } + + /** + * Interface for a form tab. + * @see UiElement + * @see UiFocusable + */ + interface Tab extends UiStandardElement, UiFocusable { + /** + * Gets display state of the tab. + * @returns The display state, as either "expanded" or "collapsed" + */ + getDisplayState(): DisplayState; + + /** + * Gets the name of the tab. + * @returns The name. + */ + getName(): string; + + /** + * Gets a reference to the {@link FormContext.ui formContext.ui} parent of the tab. + * @returns The parent. + */ + getParent(): Ui; + + /** + * Sets display state of the tab. + * @param displayState Display state of the tab, as either "expanded" or "collapsed" + */ + setDisplayState(displayState: DisplayState): void; + + /** + * A reference to the collection of form sections within this tab. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + sections: Collection.ItemCollection
; + } + + /** + * Interface for a form section. + * @see UiElement + */ + interface Section extends UiStandardElement { + /** + * Gets the name of the section. + * @returns The name. + */ + getName(): string; + + /** + * Gets a reference to the parent {@link Tab}. + * @returns The parent. + */ + getParent(): Tab; + + /** + * A reference to the collection of controls within this tab. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + controls: Collection.ItemCollection; } interface AddControlNotificationOptions { @@ -3494,19 +3378,548 @@ declare namespace Xrm { */ actions: Array<() => void>; } + + interface ProcessControl extends UiCanGetVisibleElement, UiCanSetVisibleElement { + /** + * Sets display state of the process flow control. + * @param displayState Display state of the process flow control, as either "expanded" or "collapsed" + */ + setDisplayState(displayState: DisplayState): void; + + /** + * Gets the display state of the process flow control. + */ + getDisplayState(): DisplayState; + + /** + * Reflow the UI of the process control + * @param updateUI Specify true to update the UI of the process control; false otherwise. + * @param parentStage ID of the parent stage. + * @param nextStage ID of the next stage. + */ + reflow(updateUI: boolean, parentStage: string, nextStage: string): void; + } + + /** + * Interface for an entity's form selector item. + */ + interface FormItem { + /** + * Gets the unique identifier of the form. + * @returns The identifier, in Guid format. + */ + getId(): string; + + /** + * Gets the label for the form. + * @returns The label. + */ + getLabel(): string; + + /** + * Navigates the user to this form. + */ + navigate(): void; + } + + /** + * Interface for the form selector API. + */ + interface FormSelector { + /** + * Gets current form. + * @returns The current item. + * @remarks When only one form is available this method will return null. + */ + getCurrentItem(): FormItem; + + /** + * A reference to the collection of available forms. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + items: Collection.ItemCollection; + } + + /** + * Interface for the view selector. Use the ViewSelector methods to get or set information about the view selector + * of the grid control. + */ + interface ViewSelector { + /** + * Use this method to get a reference to the current view. + * @returns The current view. + */ + getCurrentView(): ViewSelectorItem; + + /** + * Use this method to determine whether the view selector is visible. + * @returns true if visible, false if not. + */ + isVisible(): boolean; + + /** + * Use this method to set the current view. + * @param viewSelectorItem The view selector item. + */ + setCurrentView(viewSelectorItem: ViewSelectorItem): void; + } + + /** + * Interface for a view selector item. This object contains data that identifies a view. Use this as a parameter to + * the ViewSelector.setCurrentView method. + */ + interface ViewSelectorItem { + /** + * Returns a LookupValue that references this view. + * @returns The entity reference. + */ + getEntityReference(): LookupValue; + } + } + + /** + * Interface for the form's record context, {@link Data.entity formContext.data.entity} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data-entity External Link: formContext.data.entity (Client API reference)} + */ + interface Entity { + /** + * Adds a handler to be called when the record is saved. + * @param handler The handler. + */ + addOnSave(handler: Events.ContextSensitiveHandler): void; + + /** + * Gets an serialized-XML string representing data that will be passed to the server upon saving the record. + * @returns The XML in string format. + * @remarks This function does not work with Microsoft Dynamics CRM for tablets. + * @example "Contoso55555425 + * 555-1234". + */ + getDataXml(): string; + + /** + * Gets entity's logical name. + * @returns The logical name. + */ + getEntityName(): string; + + /** + * Gets the record's unique identifier. + * @returns The identifier, in Guid format. + * @example Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". + */ + getId(): string; + + /** + * Gets a boolean value indicating whether the record has unsaved changes. + * @returns true if there are unsaved changes, otherwise false. + */ + getIsDirty(): boolean; + + /** + * Gets the record's primary attribute value. + * @returns The primary attribute value. + * @remarks The value for this attribute is used when links to the record are displayed. + */ + getPrimaryAttributeValue(): string; + + /** + * Removes the handler from the "on save" event. + * @param handler The handler. + */ + removeOnSave(handler: Events.ContextSensitiveHandler): void; + + /** + * Saves the record. + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @remarks When using quick create forms in the web application the saveandnew option is not + * applied. It will always work as if saveandclose were used. Quick create forms in + * Microsoft Dynamics CRM for tablets will apply the saveandnew behavior. + */ + save(): void; + + /** + * Saves the record with the given save mode. + * @deprecated Deprecated in v9. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @param saveMode (Optional) the save mode to save, as either "saveandclose" or "saveandnew". + */ + save(saveMode: EntitySaveMode): void; + + /** + * The collection of attributes for the record. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/attributes External Link: Attributes (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + attributes: Collection.ItemCollection; + } + + namespace ProcessFlow { + /** + * Direction types for a process stage change event + * @see XrmEnum.StageChangeDirection + */ + type StageChangeDirection = "Next" | "Previous"; + + /** + * Status for {@link ProcessFlow.Stage.getStatus Stage.getStatus()}. + * @see XrmEnum.StageStatus + */ + type StageStatus = "active" | "inactive"; + + /** + * Status for {@link ProcessFlow.Process.getStatus Process.getStatus()}. + * @see XrmEnum.ProcessStatus + */ + type ProcessStatus = "active" | "aborted" | "finished"; + + /** + * Interface for a CRM Business Process Flow instance. + */ + interface Process { + /** + * Returns the unique identifier of the process. + * @returns The identifier for this process, in GUID format. + * @example Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". + */ + getId(): string; + + /** + * Returns the name of the process. + * @returns The name. + */ + getName(): string; + + /** + * Returns an collection of stages in the process. + * @returns The stages. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + getStages(): Collection.ItemCollection; + + /** + * Returns a boolean value to indicate if the process is rendered. + * @returns true if the process is rendered, false if not. + */ + isRendered(): boolean; + } + + /** + * Interface for CRM Business Process Flow stages. + */ + interface Stage { + /** + * Returns an object with a getValue method which will return the integer value of the business process flow + * category. + * @returns The stage category. + */ + getCategory(): { getValue(): XrmEnum.StageCategory }; + + /** + * Returns the logical name of the entity associated with the stage. + * @returns The entity name. + */ + getEntityName(): string; + + /** + * Returns the unique identifier of the stage. + * @returns The identifier of the Stage, in GUID format. + * @example Example: "{825CB223-A651-DF11-AA8B-00155DBA3804}". + */ + getId(): string; + + /** + * Returns the name of the stage. + * @returns The name. + */ + getName(): string; + + /** + * Returns the status of the stage. + * @returns The status, either "active" or "inactive". + */ + getStatus(): StageStatus; + + /** + * Returns a collection of steps in the stage. + * @returns An array of Step. + */ + getSteps(): Step[]; + } + + interface Step { + /** + * Returns the logical name of the attribute associated to the step. + * @returns The attribute. + * @remarks Some steps don’t contain an attribute value. + */ + getAttribute(): string; + + /** + * Returns the name of the step. + * @returns The name. + */ + getName(): string; + + /** + * Returns whether the step is required in the business process flow. + * @returns true if required, false if not. + * @remarks Returns true if the step is marked as required in the Business Process Flow editor; otherwise, false. + * There is no connection between this value and the values you can change in the formContext.data.entity + * attribute RequiredLevel methods. + */ + isRequired(): boolean; + } + + /** + * Interface for the formContext.data.process API. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data-process External Link: formContext.data.process (Client API reference)} + */ + interface ProcessManager { + /** + * Returns a Process object representing the active process. + * @returns current active process. + */ + getActiveProcess(): Process; + + /** + * Set a Process as the active process. + * @param processId The Id of the process to make the active process. + * @param callbackFunction (Optional) a function to call when the operation is complete. + */ + setActiveProcess(processId: string, callbackFunction?: ProcessCallbackDelegate): void; + + /** + * Returns all process instances for the entity record that the calling user has access to. + * @param callbackFunction (Optional) a function to call when the operation is complete. + */ + getProcessInstances(callbackFunction: GetProcessInstancesDelegate): void; + + /** + * Sets a process instance as the active instance + * @param processInstanceId The Id of the process instance to make the active instance. + * @param callbackFunction (Optional) a function to call when the operation is complete. + */ + setActiveProcessInstance(processInstanceId: string, callbackFunction: SetProcessInstanceDelegate): void; + + /** + * Returns a Stage object representing the active stage. + * @returns current active stage. + */ + getActiveStage(): Stage; + + /** + * Set a stage as the active stage. + * @param stageId the Id of the stage to make the active stage. + * @param callbackFunction (Optional) a function to call when the operation is complete. + */ + setActiveStage(stageId: string, callbackFunction?: ProcessCallbackDelegate): void; + + /** + * Use this method to get a collection of stages currently in the active path with methods to interact with the + * stages displayed in the business process flow control. The active path represents stages currently rendered in + * the process control based on the branching rules and current data in the record. + * @returns A collection of all completed stages, the currently active stage, and the predicted set of future stages + * based on satisfied conditions in the branching rule. This may be a subset of the stages returned with + * formContext.data.process.getActiveProcess because it will only include those stages which represent a valid + * transition from the current stage based on branching that has occurred in the process. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + getActivePath(): Collection.ItemCollection; + + /** + * Use this method to asynchronously retrieve the enabled business process flows that the user can switch to for an + * entity. + * @param callbackFunction The callback function must accept a parameter that contains an object with + * dictionary properties where the name of the property is the Id of the + * business process flow and the value of the property is the name of the + * business process flow. + * The enabled processes are filtered according to the user’s privileges. The + * list of enabled processes is the same ones a user can see in the UI if they + * want to change the process manually. + */ + getEnabledProcesses(callbackFunction: (enabledProcesses: ProcessDictionary) => void): void; + + /** + * Use this method to get the currently selected stage. + * @returns The currently selected stage. + */ + getSelectedStage(): Stage; + + /** + * Use this to add a function as an event handler for the OnStageChange event so that it will be called when the + * business process flow stage changes. + * @param handler The function will be added to the bottom of the event + * handler pipeline. The execution context is automatically + * set to be the first parameter passed to the event handler. + * Use a reference to a named function rather than an + * anonymous function if you may later want to remove the + * event handler. + */ + addOnStageChange(handler: Events.ContextSensitiveHandler): void; + + /** + * Use this to add a function as an event handler for the OnProcessStatusChange event so that it will be called when the + * business process flow status changes. + * @param handler The function will be added to the bottom of the event + * handler pipeline. The execution context is automatically + * set to be the first parameter passed to the event handler. + * Use a reference to a named function rather than an + * anonymous function if you may later want to remove the + * event handler. + */ + addOnProcessStatusChange(handler: Events.ProcessStatusChangeHandler): void; + + /** + * Use this to add a function as an event handler for the OnStageSelected event so that it will be called + * when a business process flow stage is selected. + * @param handler The function will be added to the bottom of the event + * handler pipeline. The execution context is automatically + * set to be the first parameter passed to the event handler. + * Use a reference to a named function rather than an + * anonymous function if you may later want to remove the + * event handler. + */ + addOnStageSelected(handler: Events.ContextSensitiveHandler): void; + + /** + * Use this to remove a function as an event handler for the OnProcessStatusChange event. + * @param handler If an anonymous function is set using the addOnProcessStatusChange method it + * cannot be removed using this method. + */ + removeOnProcessStatusChange(handler: Events.ProcessStatusChangeHandler): void; + + /** + * Use this to remove a function as an event handler for the OnStageChange event. + * @param handler If an anonymous function is set using the addOnStageChange method it + * cannot be removed using this method. + */ + removeOnStageChange(handler: Events.ContextSensitiveHandler): void; + + /** + * Use this to remove a function as an event handler for the OnStageChange event. + * @param handler If an anonymous function is set using the addOnStageChange method it + * cannot be removed using this method. + */ + removeOnStageSelected(handler: Events.ContextSensitiveHandler): void; + + /** + * Progresses to the next stage. + * @param callbackFunction (Optional) A function to call when the operation is complete. + */ + moveNext(callbackFunction?: ProcessCallbackDelegate): void; + + /** + * Moves to the previous stage. + * @param callbackFunction (Optional) A function to call when the operation is complete. + * . + */ + movePrevious(callbackFunction?: ProcessCallbackDelegate): void; + + /** + * Use this method to get the unique identifier of the process instance + * @returns The unique identifier of the process instance + */ + getInstanceId(): string; + + /** + * Use this method to get the name of the process instance + * @returns The name of the process instance + */ + getInstanceName(): string; + + /** + * Use this method to get the current status of the process instance + * @returns The current status of the process + */ + getStatus(): ProcessStatus; + + /** + * Use this method to set the current status of the process instance + * @param status The new status for the process + * @param callbackFunction (Optional) a function to call when the operation is complete. + */ + setStatus(status: ProcessStatus, callbackFunction: ProcessSetStatusDelegate): void; + } + + /** + * Called when method to get active processes is complete + * @param status The result of the get active processes operation. + * @remarks Returns object with the following key-value pairs: + * CreatedOn + * ProcessDefinitionID + * ProcessDefinitionName + * ProcessInstanceID + * ProcessInstanceName + * StatusCodeName + */ + type GetProcessInstancesDelegate = (object: ProcessDictionary) => void; + + /** + * Called when method to set active process is complete + * @param status The result of the set active process operation. + * @remarks Values returned are: success (The operation succeeded.) + * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) + */ + type SetProcessInstanceDelegate = (status: string) => void; + + /** + * Called when process change methods have completed. + * @param status The result of the process change operation. + * @remarks Values returned are: success (The operation succeeded.) + * crossEntity (The previous stage is for a different entity.) + * beginning (The active stage is the first stage of the active path.) + * invalid (The operation failed because the selected stage isn’t the same + * as the active stage.) + * unreachable (The stage exists on a different path.) + */ + type ProcessCallbackDelegate = (status: string) => void; + + /** + * Called when process set status method has completed. + * @param status The new status of the process instance: active, aborted, or finished + */ + type ProcessSetStatusDelegate = (status: ProcessStatus) => void; + + /** + * Represents a key-value pair, where the key is the Process Flow's ID, and the value is the name thereof. + */ + interface ProcessDictionary { + [index: string]: string; + } + } + + /** + * Interface for a user attribute privilege. + */ + interface Privilege { + /** + * True if the user can read. + */ + canRead: boolean; + + /** + * True if the user can update. + */ + canUpdate: boolean; + + /** + * True if the user can create. + */ + canCreate: boolean; } /** * An definition module for URL-based, CRM component parameters. - * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx} for details. + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} */ namespace Url { /** * Command Bar Display options for Xrm.Url.FormOpenParameters.cmdbar, Xrm.Url.ViewOpenParameters.cmdbar, and Xrm.Utility.FormOpenParameters.cmdbar. */ - type CmdBarDisplay = "true" | "false"; + /** * Navigation Bar Display options for Xrm.Url.FormOpenParameters.navbar, Xrm.Url.ViewOpenParameters.navbar, and Xrm.Utility.FormOpenParameters.navbar. */ @@ -3521,9 +3934,7 @@ declare namespace Xrm { * Interface for defining parameters on a request to open a form with main.aspx (as with * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". - * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx} for details. - * + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} * @remarks A member for "pagetype" is not provided. The value "entityrecord" is required in * the URL, for forms. Example: "pagetype=entityrecord" */ @@ -3537,8 +3948,7 @@ declare namespace Xrm { * Additional parameters can be provided to the request. This can only be used to provide * default field values for the form, or pass data to custom parameters that have been * customized for the form. See example below for setting the selected form. - * - * @remarks Example: encodeURIComponent("formid={8c9f3e6f-7839-e211-831e-00155db7d98f}"); + * @example Example: encodeURIComponent("formid={8c9f3e6f-7839-e211-831e-00155db7d98f}"); */ extraqs?: string; @@ -3564,7 +3974,7 @@ declare namespace Xrm { * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx} for details. + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} * * @remarks A member for "pagetype" is not provided. The value "entitylist" is required in * the URL, for views. Example: "pagetype=entitylist" @@ -3583,7 +3993,6 @@ declare namespace Xrm { /** * The type of view identified by {@link viewid}. - * * @remarks Accepted values are: 1039 System View * 4230 User View. */ @@ -3610,8 +4019,7 @@ declare namespace Xrm { * Interface for defining parameters of a request to open a dialog with rundialog.aspx (as with * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". - * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx} for details. + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} */ interface DialogOpenParameters { /** @@ -3636,7 +4044,7 @@ declare namespace Xrm { * window.open). Useful for parsing out the keys and values into a string of the format: * "&key=value" * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx} for details. + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} */ interface ReportOpenParameters { /** @@ -3663,7 +4071,7 @@ declare namespace Xrm { /** * The Xrm.Utility API * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328255.aspx|Documentation} for details. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility External Link: Xrm.Utility (Client API reference)} */ namespace Utility { /** @@ -3718,8 +4126,7 @@ declare namespace Xrm { /** * Namespace to hold Xrm.Navigation related types - * - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-navigation} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-navigation External Link: Xrm.Navigation (Client API reference)} */ namespace Navigation { interface AlertStrings { @@ -3750,12 +4157,12 @@ declare namespace Xrm { subtitle?: string; /** - * (Optional) The title to be displyed in the confirmation dialog. + * (Optional) The title to be displyed in the confirmation dialog. */ - title: string; + title?: string; /** - * The message to be displyed in the alert dialog. + * The message to be displyed in the alert dialog. */ text: string; } @@ -3773,7 +4180,7 @@ declare namespace Xrm { interface OpenWebresourceOptions extends DialogSizeOptions { /** - * Indicates whether to open the web resource in a new window. + * Indicates whether to open the web resource in a new window. */ openInNewWindow: boolean; } @@ -3839,7 +4246,7 @@ declare namespace Xrm { /** * Designates a record that will provide default values based on mapped attribute values.The lookup object has the following String properties: entityType, id, and name (optional). */ - createFromEntity?: Page.LookupValue; + createFromEntity?: LookupValue; /** * ID of the entity record to display the form for. */ @@ -3925,7 +4332,7 @@ declare namespace Xrm { * 0:OneToMany * 1:ManyToMany */ - relationshipType?: XrmEnum.RelationshipType; // + relationshipType?: XrmEnum.RelationshipType; // /** * Role type in relationship.Specify one of the following values: * 1:Referencing @@ -3941,7 +4348,7 @@ declare namespace Xrm { interface Navigation { /** * Displays an alert dialog containing a message and a button. - * @param alertStrings The strings to be used in the alert dialog. + * @param alertStrings The strings to be used in the alert dialog. * @param alertOptions The height and width options for alert dialog */ openAlertDialog(alertStrings: Navigation.AlertStrings, alertOptions: Navigation.DialogSizeOptions): Async.PromiseLike; @@ -3973,7 +4380,7 @@ declare namespace Xrm { /** * Opens a URL, including file URLs. * @param url URL to open. - * @param openUrlOptions Options to open the URL + * @param openUrlOptions Options to open the URL */ openUrl(url: string, openUrlOptions?: Navigation.DialogSizeOptions): void; @@ -3981,7 +4388,7 @@ declare namespace Xrm { * Opens an HTML web resource. * @param webResourceName Name of the HTML web resource. * @param windowOptions (Optional) Window options for opening the web resource. - * It is advised to use encodeURIcomponent() to encode the value. + * It is advised to use encodeURIcomponent() to encode the value. */ openWebResource(webResourceName: string, windowOptions?: Navigation.OpenWebresourceOptions, data?: string): void; } @@ -3995,6 +4402,9 @@ declare namespace Xrm { */ interface EntityMetadata { ActivityTypeMask: number; + /** + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ Attributes: Collection.ItemCollection; AutoRouteToOwnerQueue: boolean; CanEnableSyncToExternalSearchIndex: boolean; @@ -4050,13 +4460,18 @@ declare namespace Xrm { RecurrenceBaseEntityLogicalName: string; PrimaryImageAttribute: string; } + /** * Type to hold Labels as part of the EntityMetadata */ interface Label { + /** + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ LocalizedLabels: Collection.ItemCollection; UserLocalizedLabel: LocalizedLabel; } + /** * Type to hold a Label as part of the EntityMetadata */ @@ -4064,18 +4479,26 @@ declare namespace Xrm { Label: string; LanguageCode: number; } + /** * Type to hold the Attribute metadata as part of the EntityMetadata */ interface AttributeMetadata { defaultFormValue: number; + /** + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ options: Collection.ItemCollection; logicalName: string; displayName: string; attributeType: XrmEnum.AttributeTypeCode; entityLogicalName: string; + /** + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} + */ optionSet: Collection.ItemCollection; } + /** * Type to hold the optionset metadata as part of the EntityMetadata */ @@ -4095,7 +4518,7 @@ declare namespace Xrm { /** * Namespace to hold Xrm.Device related types - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device External Link: Xrm.Device (Client API reference)} */ namespace Device { /** @@ -4186,47 +4609,41 @@ declare namespace Xrm { /** * Interface for Xrm.Device API - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-device External Link: Xrm.Device (Client API reference)} */ interface Device { /** * Invokes the device microphone to record audio. - * * @returns On success, returns Base64 encoded file */ captureAudio(): Async.PromiseLike; /** * Invokes the device camera to capture an image. - * * @returns On success, returns Base64 encoded file */ captureImage(imageOptions: Device.CaptureImageOptions): Async.PromiseLike; /** * Invokes the device camera to capture video. - * * @returns On success, returns Base64 encoded file */ captureVideo(): Async.PromiseLike; /** * Invokes the device camera to scan the barcode information, such as a product number. - * * @returns On success, Barcode value is returned as a String */ getBarcodeValue(): Async.PromiseLike; /** * Returns the current location using the device geolocation capability. - * * @returns On success, returns current geolocation information */ getCurrentPosition(): Async.PromiseLike; /** * Opens a dialog box to select files from your computer (web client) or mobile device (mobile clients). - * * @returns On success, returns an array of files */ pickFile(pickFileOptions: Device.PickFileOptions): Async.PromiseLike; @@ -4234,23 +4651,19 @@ declare namespace Xrm { /** * Interface for Xrm.Encoding API - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-encoding} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-encoding External Link: Xrm.Encoding (Client API reference)} */ interface Encoding { /** * Applies attribute encoding to a string. - * * @param arg String to be encoded. - * * @returns Encoded string. */ xmlAttributeEncode(arg: string): string; /** * Applies XML encoding to a string. - * * @param arg String to be encoded. - * * @returns Encoded string. */ xmlEncode(arg: string): string; @@ -4258,14 +4671,12 @@ declare namespace Xrm { /** * Provides properties and methods to use Web API to create and manage records and execute Web API actions and functions in Customer Engagement. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi External Link: Xrm.WebApi (Client API reference)} */ - interface WebApi extends WebApiBase { + interface WebApi extends WebApiOffline { /** * Returns a boolean value indicating whether an entity is offline enabled. - * - * @param entityLogicalName Logical name of the entity. For example: "account". - * + * @param entityLogicalName Logical name of the entity. For example: "account". * @returns true if the entity is offline enabled; otherwise false. */ isAvailableOffline(entityLogicalName: string): boolean; @@ -4273,74 +4684,122 @@ declare namespace Xrm { /** * Provides methods to use Web API to create and manage records and execute Web API actions and functions in Customer Engagement when connected to the Customer Engagement server (online mode). */ - online: WebApi; + online: WebApiOnline; /** * Provides methods to create and manage records in the Dynamics 365 Customer Engagement mobile clients while working in the offline mode. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/offline} for details + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/offline} */ - offline: WebApi; + offline: WebApiOffline; } /** - * Interface for the Xrm.WebApi API + * Interface for the Xrm.WebApi.online API + * Execute and ExecuteMultiple are only available when online, not offline. */ - interface WebApiBase { + interface WebApiOnline extends WebApiOffline { + /** + * Execute a single action, function, or CRUD operation. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/execute External Link: execute (Client API reference)} + * @param request Object that will be passed to the Web API endpoint to execute an action, function, or CRUD request. + * The object exposes a getMetadata method that lets you define the metadata for the action, function or CRUD request you want to execute. + * The getMetadata method has the following parameters: + * -boundParameter: (Optional) String. The name of the bound parameter for the action or function to execute. + * Specify undefined if you are executing a CRUD request. + * Specify null if the action or function to execute is not bound to any entity. + * Specify entity logical name or entity set name in case the action or function to execute is bound to one. + * -operationName: (Optional). String. Name of the action, function, or one of the following values if you are executing a CRUD request: "Create", "Retrieve", "RetrieveMultiple", "Update", or "Delete". + * -operationType: (Optional). Number. Indicates the type of operation you are executing; specify one of the following values: + * 0: Action + * 1: Function + * 2: CRUD + * -parameterTypes: Object. The metadata for parameter types. The object has the following attributes: + * -enumProperties: (Optional) Object. The metadata for enum types. The object has two string attributes: name and value + * -structuralProperty: Number. The category of the parameter type. Specify one of the following values: + * 0: Unknown + * 1: PrimitiveType + * 2: ComplexType + * 3: EnumerationType + * 4: Collection + * 5: EntityType + * -typeName: String. The fully qualified name of the parameter type. + */ + execute(request: any): Async.PromiseLike; + + /** + * Execute a collection of action, function, or CRUD operations. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/executemultiple External Link: executeMultiple (Client API reference)} + * @param request An array of one of one of the following types: + * -objects where each object is an action, function, or CRUD request that you want to execute + * against the Web API endpoint. Each object exposes a getMetadata method that lets you define + * the metadata for the action, function or CRUD request you want to execute. This is the same + * object that you pass in the execute method. For information about the object, see execute. + * -change set (an array of objects), where each object in the change set is as defined above. + * In this case, all the request objects specified in the change set will get executed in a + * transaction. + */ + executeMultiple(request: any[]): Async.PromiseLike; + } + + /** + * Interface for the Xrm.WebApi.offline API + */ + interface WebApiOffline { /** * Creates an entity record - * * @param entityLogicalName Logical name of the entity you want to create. For example: "account". * @param record A JSON object defining the attributes and values for the new entity record. - * - * @return On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @returns On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/createrecord External Link: createRecord (Client API reference)} */ createRecord(entityLogicalName: string, record: any): Async.PromiseLike; /** * Deletes an entity record. - * * @param entityLogicalName The entity logical name of the record you want to delete. For example: "account". * @param id GUID of the entity record you want to delete. - * - * @return On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @returns On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/deleterecord External Link: deleteRecord (Client API reference)} */ deleteRecord(entityLogicalName: string, id: string): Async.PromiseLike; /** * Retrieves an entity record. - * * @param entityLogicalName The entity logical name of the record you want to retrieve. For example: "account". * @param id GUID of the entity record you want to retrieve. - * @param options (Optional) OData system query options, $select and $expand, to retrieve your data. - * -Use the $select system query option to limit the properties returned by including a comma-separated list of property names. - * This is an important performance best practice. If properties aren’t specified using $select, all properties will be returned. - * -Use the $expand system query option to control what data from related entities is returned. - * If you just include the name of the navigation property, you’ll receive all the properties for related records. - * You can limit the properties returned for related records using the $select system query option in parentheses - * after the navigation property name. Use this for both single-valued and collection-valued navigation properties. - * You can also specify multiple query options by using & to separate the query options. For example: - * $select=name&$expand=primarycontactid($select=contactid,fullname) - * - * @return On success, returns a promise containing a JSON object with the retrieved attributes and their values. + * @param options (Optional) OData system query options, $select and $expand, to retrieve your data. + * -Use the $select system query option to limit the properties returned by including a comma-separated + * list of property names. This is an important performance best practice. If properties aren’t + * specified using $select, all properties will be returned. + * -Use the $expand system query option to control what data from related entities is returned. If you + * just include the name of the navigation property, you’ll receive all the properties for related + * records. You can limit the properties returned for related records using the $select system query + * option in parentheses after the navigation property name. Use this for both single-valued and + * collection-valued navigation properties. + * You can also specify multiple query options by using & to separate the query options. + * @example: options example: + * options: $select=name&$expand=primarycontactid($select=contactid,fullname) + * @returns On success, returns a promise containing a JSON object with the retrieved attributes and their values. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrieverecord External Link: retrieveRecord (Client API reference)} */ retrieveRecord(entityLogicalName: string, id: string, options: string): Async.PromiseLike; /** * Retrieves a collection of entity records. * @param entityLogicalName The entity logical name of the records you want to retrieve. For example: "account". - * @param options (Optional) OData system query options or FetchXML query to retrieve your data. - * Following system query options are supported: $select, $top, $filter, $expand, and $orderby. - * To specify a FetchXML query, use the fetchXml attribute to specify the query. - * NOTE: You must always use the $select system query option to limit the properties returned for an entity record - * by including a comma-separated list of property names. This is an important performance best practice. - * If properties aren’t specified using $select, all properties will be returned. - * You can specify multiple system query options by using & to separate the query options. - * @param maxPageSize (Optional) Specify a positive number that indicates the number of entity records to be returned per page. - * If you do not specify this parameter, the default value is passed as 5000. - * If the number of records being retrieved is more than the specified maxPageSize value, nextLink attribute in the returned - * Promise object will contain a link to retrieve the next set of entities. + * @param options (Optional) OData system query options or FetchXML query to retrieve your data. + * Following system query options are supported: $select, $top, $filter, $expand, and $orderby. + * To specify a FetchXML query, use the fetchXml attribute to specify the query. + * NOTE: You must always use the $select system query option to limit the properties returned for an entity + * record by including a comma-separated list of property names. This is an important performance best practice. + * If properties aren’t specified using $select, all properties will be returned. * - * @return On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * You can specify multiple system query options by using & to separate the query options. + * @param maxPageSize (Optional) Specify a positive number that indicates the number of entity records to be returned per page. + * If you do not specify this parameter, the default value is passed as 5000. If the number of records being retrieved is more than the specified + * maxPageSize value, nextLink attribute in the returned promise object will contain a link to retrieve the next set of entities. + * @returns On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrievemultiplerecords External Link: retrieveMultipleRecords (Client API reference)} */ retrieveMultipleRecords(entityLogicalName: string, options?: string, maxPageSize?: number): Async.PromiseLike; @@ -4349,30 +4808,10 @@ declare namespace Xrm { * @param entityLogicalName The entity logical name of the record you want to update. For example: "account". * @param id GUID of the entity record you want to update. * @param Data A JSON object containing key: value pairs, where key is the property of the entity and value is the value of the property you want update. - * - * @return On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @returns On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/updaterecord External Link: updateRecord (Client API reference)} */ updateRecord(entityLogicalName: string, id: string, data: any): Async.PromiseLike; - - /** - * Execute a single action, function, or CRUD operation. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/execute} for more info - * @param request Object that will be passed to the Web API endpoint to execute an action, function, or CRUD request. - */ - execute(request: any): Async.PromiseLike; - - /** - * Execute a collection of action, function, or CRUD operations. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/executemultiple} for more info - * @param request An array of one of one of the following types: - * -objects where each object is an action, function, or CRUD request that you want to execute - * against the Web API endpoint. Each object exposes a getMetadata method that lets you - * define the metadata for the action, function or CRUD request you want to execute. - * This is the same object that you pass in the execute method. For information about the object, see execute. - * -Change set (an array of objects), where each object in the change set is as defined above. - * In this case, all the request objects specified in the change set will get executed in a transaction. - */ - executeMultiple(request: any[]): Async.PromiseLike; } /** @@ -4414,11 +4853,13 @@ declare namespace Xrm { */ ok: boolean; /** - * Numeric value in the response status code.For example: 200 + * Numeric value in the response status code. + * @example 200 */ status: number; /** - * Description of the response status code.For example: OK + * Description of the response status code. + * @example "OK" */ statusText: string; /** @@ -4442,7 +4883,15 @@ declare namespace XrmEnum { Update = 2, ReadOnly = 3, Disabled = 4, - BulkEdit = 6 + BulkEdit = 6, + /** + * @deprecated QuickCreate has been deprecated + */ + QuickCreate = 5, + /** + * @deprecated ReadOptimized has been deprecated. + */ + ReadOptimized = 11, } /** @@ -4459,7 +4908,7 @@ declare namespace XrmEnum { Assign = 47, Send = 7, Qualify = 16, - Disqualify = 15 + Disqualify = 15, } /** @@ -4472,7 +4921,7 @@ declare namespace XrmEnum { Close = 3, Identify = 4, Research = 5, - Resolve = 6 + Resolve = 6, } /** @@ -4483,7 +4932,7 @@ declare namespace XrmEnum { RibbonContextForm = 1, RibbonContextListing = 2, FormContextUnrelated = 3, - FormContextRelated = 4 + FormContextRelated = 4, } /** @@ -4491,7 +4940,7 @@ declare namespace XrmEnum { */ const enum ViewType { SystemView = 1039, - UserView = 4230 + UserView = 4230, } /** @@ -4518,7 +4967,7 @@ declare namespace XrmEnum { Virtual = 17, BigInt = 18, ManagedProperty = 19, - EntityName = 20 + EntityName = 20, } /** @@ -4528,7 +4977,7 @@ declare namespace XrmEnum { None = 0, SystemRequired = 1, ApplicationRequired = 2, - Recommended = 3 + Recommended = 3, } /** @@ -4536,7 +4985,7 @@ declare namespace XrmEnum { */ const enum OpenFileOptions { Open = 1, - Save = 2 + Save = 2, } /** @@ -4544,7 +4993,7 @@ declare namespace XrmEnum { */ const enum WindowPositions { Center = 1, - Side = 2 + Side = 2, } /** @@ -4552,7 +5001,7 @@ declare namespace XrmEnum { */ const enum RelationshipType { OneToMany = 0, - ManyToMany = 1 + ManyToMany = 1, } /** @@ -4560,13 +5009,206 @@ declare namespace XrmEnum { */ const enum RoleType { Referencing = 1, - AssociationEntity = 2 + AssociationEntity = 2, } const enum ClientFormFactor { Unknown = 1, Desktop = 2, Tablet = 3, - Phone = 4 + Phone = 4, + } + + /** + * Constant Enum: Client Types for {@link GlobalContext.getClient globalContext.getClient()}. + * @see Xrm.Client + */ + const enum Client { + Web = "Web", + Outlook = "Outlook", + Mobile = "Mobile", + UnifiedServiceDesk = "UnifiedServiceDesk", + USD = "UnifiedServiceDesk" + } + + /** + * Constant Enum: Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. + * @see Xrm.ClientState + */ + const enum ClientState { + Online = "Online", + Offline = "Offline" + } + + /** + * Constant Enum: Display States for setDisplayState() on {@link Controls.ProcessControl.setDisplayState Processes} and {@link Controls.Tab.setDisplayState Tabs}. + * @see Xrm.DisplayState + */ + const enum DisplayState { + Expanded = "expanded", + Collapsed = "collapsed" + } + + /** + * Constant Enum: {@link Entity.save Entity} Save Modes + * @see Xrm.EntitySaveMode + * @see Entity + * @see Entity.save + */ + const enum EntitySaveMode { + SaveAndClose = "saveandclose", + SaveAndNew = "saveandnew" + } + + /** + * Constant Enum: Form Notification Levels for {@link Ui.setFormNotification formContext.ui.setFormNotification()}. + * @see Xrm.FormNotificationLevel + */ + const enum FormNotificationLevel { + Error = "ERROR", + Info = "INFO", + Warning = "Warning" + } + + /** + * Constant Enum: Submit Modes for {@link Attributes.Attribute.setSubmitMode} Attributes.Attribute.setSubmitMode(). + * @see Xrm.SubmitMode + */ + const enum SubmitMode { + Always = "always", + Dirty = "dirty", + Never = "never" + } + + /** + * Constant Enum: Themes for {@link GlobalContext.getCurrentTheme globalContext.getCurrentTheme()}. + * Note: getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. + */ + const enum Theme { + Default = "default", + Office12Blue = "Office12Blue", + Office14Silver = "Office14Silver" + } + + /** + * Constant Enum: Settings for {@link GlobalContext.getAdvancedConfigSetting globalContext.getAdvancedConfigSetting(setting)} + */ + const enum AdvancedConfigSettingOption { + MaxChildIncidentNumber = "MaxChildIncidentNumber", + MaxIncidentMergeNumber = "MaxIncidentMergeNumber" + } + + /** + * Constant Enum: Requirement Level for {@link Attributes.Attribute.getRequiredLevel Attributes.Attribute.getRequiredLevel()} and + * {@link Attributes.Attribute.setRequiredLevel Attributes.Attribute.setRequiredLevel()}. + * @see Xrm.Attributes.RequirementLevel + */ + const enum AttributeRequirementLevel { + None = "none", + Recommended = "recommended", + Required = "required" + } + + /** + * Constant Enum: Date attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.DateAttribute DateAttribute}. + * @see Xrm.Attributes.DateAttributeFormat + */ + const enum DateAttributeFormat { + Date = "date", + DateTime = "datetime" + } + + /** + * Constant Enum: Integer attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.NumberAttribute NumberAttribute}. + * @see Xrm.Attributes.IntegerAttributeFormat + */ + const enum IntegerAttributeFormat { + Duration = "duration", + None = "none" + } + + /** + * Constant Enum: OptionSet attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.OptionSetAttribute OptionSetAttribute}. + * @see Xrm.Attributes.OptionSetAttributeFormat + */ + const enum OptionSetAttributeFormat { + Language = "language", + TimeZone = "timezone" + } + + /** + * Constant Enum: String attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.StringAttribute StringAttribute}. + * @see Xrm.Attributes.StringAttributeFormat + */ + const enum StringAttributeFormat { + Email = "email", + Phone = "phone", + Text = "text", + TextArea = "textarea", + TickerSymbol = "tickersymbol", + URL = "url" + } + + /** + * Constant Enum: Attribute types for {@link Attributes.Attribute.setDisplayState()}. + * @see Xrm.Attributes.AttributeType + */ + const enum AttributeType { + Boolean = "boolean", + DateTime = "datetime", + Decimal = "decimal", + Double = "double", + Integer = "integer", + Lookup = "lookup", + Memo = "memo", + Money = "money", + OptionSet = "optionset", + String = "string" + } + + /** + * Constant Enum: Control types for {@link Controls.Control.getControlType Controls.Control.getControlType()}. + * @see Xrm.Controls.ControlType + */ + const enum StandardControlType { + Standard = "standard", + IFrame = "iframe", + Lookup = "lookup", + OptionSet = "optionset", + SubGrid = "subgrid", + WebResource = "webresource", + Notes = "notes", + TimerControl = "timercontrol", + KBSearch = "kbsearch", + TimeLineWall = "timelinewall", + QuickForm = "quickform" + } + + /** + * Constant Enum: Direction types for a process stage change event + * @see ProcessFlow.StageChangeDirection + */ + const enum StageChangeDirection { + Next = "Next", + Previous = "Previous" + } + + /** + * Constant Enum: Status for {@link ProcessFlow.Stage.getStatus Stage.getStatus()}. + * @see ProcessFlow.StageStatus + */ + const enum StageStatus { + Active = "active", + Inactive = "inactive" + } + + /** + * Constant Enum: Status for {@link ProcessFlow.Process.getStatus Process.getStatus()}. + * @see ProcessFlow.ProcessStatus + */ + const enum ProcessStatus { + Active = "active", + Aborted = "aborted", + Finished = "finished" } } From ab9aae1cfb5f475a7838e5475999b6b829d6edb6 Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Fri, 24 Nov 2017 19:47:42 -0500 Subject: [PATCH 112/269] Modified to allow empty interfaces Empty interfaces need to be allowed. They are being used to allow the use of deprecated items before they are removed from the javascript api. It will help people be able to see what they are using is deprecated and needs to be called differently without the need for us to copy and paste the replicated objects, which largely at this point, most of them are. --- types/xrm/tslint.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/xrm/tslint.json b/types/xrm/tslint.json index f4cc3f2d22..6164356b33 100644 --- a/types/xrm/tslint.json +++ b/types/xrm/tslint.json @@ -18,6 +18,7 @@ "double" ], "jsdoc-format": true, - "no-unnecessary-generics": false + "no-unnecessary-generics": false, + "no-empty-interface": false } } From 170e250976ae92292622e241f0b222652650aeac Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Fri, 24 Nov 2017 20:04:07 -0500 Subject: [PATCH 113/269] Fixed External Links Fixed a few links. All external links that do not link to an obejct in the definition are tagged with "External Link: " --- types/xrm/index.d.ts | 87 +++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 42 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 93a09dc19a..9914598cad 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -37,7 +37,7 @@ declare namespace Xrm { /** * Provides a namespace container for the context, data and ui objects. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ Page: Page; @@ -69,7 +69,7 @@ declare namespace Xrm { * * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi External Link: Xrm.WebApi (Client API reference)} * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/use-microsoft-dynamics-365-web-api External Link: Use the Customer Engagement Web API} - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/get-started-web-api-client-side-javascript Get started with the Customer Engagement Web API (client-side JavaScript)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/get-started-web-api-client-side-javascript External Link: Get started with the Customer Engagement Web API (client-side JavaScript)} */ WebApi: WebApi; @@ -375,7 +375,7 @@ declare namespace Xrm { /** * Gets whether automatic save is enabled. * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.isAutoSaveEnabled globalContext.organizationSettings.isAutoSaveEnabled} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns true if automatic saving is enabled, otherwise false. */ getIsAutoSaveEnabled(): boolean; @@ -383,7 +383,7 @@ declare namespace Xrm { /** * Gets organization's LCID (language code). * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.languageId globalContext.organizationSettings.languageId} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The organization language code. * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx External Link: Microsoft Locale ID Values} */ @@ -394,7 +394,7 @@ declare namespace Xrm { * * Note: This value can be found on the Developer Resources page within Dynamics CRM. * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.uniqueName} globalContext.organizationSettings.uniqueName instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The organization's unique name. */ getOrgUniqueName(): string; @@ -403,7 +403,7 @@ declare namespace Xrm { * Gets query string parameters. * @returns The query string parameters, in a dictionary object representing name and value pairs. * @deprecated Deprecated in v9 (Still applicable in Web Client). - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ getQueryStringParameters(): { [index: string]: any }; @@ -417,7 +417,7 @@ declare namespace Xrm { /** * Gets user's unique identifier. * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.userId globalContext.userSettings.userId} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The user's identifier in Guid format. * @example Example: "{B05EC7CE-5D51-DF11-97E0-00155DB232D0}" */ @@ -426,7 +426,7 @@ declare namespace Xrm { /** * Gets user's LCID (language code). * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.languageId globalContext.userSetings.languageId} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The user's language code. * * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx External Link: Microsoft Locale ID Values} @@ -436,7 +436,7 @@ declare namespace Xrm { /** * Gets the name of the current user. * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.userName globalContext.userSettings.userName} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The user's name. */ getUserName(): string; @@ -444,7 +444,7 @@ declare namespace Xrm { /** * Gets all user security roles. * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.securityRoles globalContext.userSettings.securityRoles} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns An array of user role identifiers, in Guid format. * @example Example: ["cf4cc7ce-5d51-df11-97e0-00155db232d0"] */ @@ -541,6 +541,9 @@ declare namespace Xrm { /** * Interface for the event context. + * In the API documentation, this is sometimes refferred to as the executionContext. + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/clientapi-execution-context External Link: Client API execution context} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/execution-context External Link: Execution context (Client API reference)} */ interface EventContext { /** @@ -994,7 +997,7 @@ declare namespace Xrm { /** * Displays an alert dialog, with an "OK" button. * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openAlertDialog} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param message The message. * @param onCloseCallback The "OK" callback. */ @@ -1003,7 +1006,7 @@ declare namespace Xrm { /** * Displays a confirmation dialog, with "OK" and "Cancel" buttons. * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openConfirmDialog} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param message The message. * @param yesCloseCallback The "OK" callback. * @param noCloseCallback The "Cancel" callback. @@ -1015,7 +1018,7 @@ declare namespace Xrm { * @deprecated Deprecated in v9. Use {@link Xrm.Utility.getEntityMetadata Xrm.Utility.getEntityMetadata(entityName, ["IsActivity"])} instead. * @remarks The isActivityType method is synchronous so it was suitable for ribbon rules. * However, the replacement method, getEntityMetadata, is asynchronous, and is not suitable for ribbon rules. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param entityType Type of the entity. * @returns true if the entity is an Activity, false if not. */ @@ -1024,7 +1027,7 @@ declare namespace Xrm { /** * Opens quick create. * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openForm} instead with the option {useQuickCreateForm:true}. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param entityLogicalName The logical name of the entity to create. * @param createFromEntity (Optional) Designates a record that will provide default values based on mapped attribute values. * @param parameters (Optional) A dictionary object that passes extra query string parameters to the form. Invalid query string parameters will cause an error. @@ -1036,7 +1039,7 @@ declare namespace Xrm { /** * Opens an entity form. * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openForm} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param name The entity's logical name. * @param id (Optional) The unique identifier for the record. * @param parameters (Optional) A dictionary object that passes extra query string parameters to the form. @@ -1047,7 +1050,7 @@ declare namespace Xrm { /** * Opens an HTML Web Resource in a new browser window. * @deprecated Deprecated in v9. Use {@link Xrm.Navigation.openWebResource} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param webResourceName Name of the HTML web resource. Can be used to pass URL parameters. See Remarks. * @param webResourceData (Optional) Data to pass into the Web Resource's data parameter. It is advised to use encodeURIcomponent() to encode the value. * @param width (Optional) The width of the new window. @@ -1073,7 +1076,7 @@ declare namespace Xrm { * Provides methods to create and manage records in the mobile clients while working in the offline mode. * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx External Link: Xrm.Mobile.offline (client-side reference)} * @deprecated Use {@link Xrm.WebApi.offline} instead. Xrm.WebApi.offline is implemented differently than Xrm.Mobile.offline - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ offline: MobileOffline; } @@ -1082,7 +1085,7 @@ declare namespace Xrm { * Interface for the Mobile.offline methods to create and manage records in the mobile clients while working in the offline mode. * @deprecated Use {@link Xrm.WebApi.offline} instead. Xrm.WebApi.offline is implemented differently than Xrm.Mobile.offline * @see {@link https://msdn.microsoft.com/en-us/library/mt787123.aspx External Link: Xrm.Mobile.offline (client-side reference)} - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ interface MobileOffline { /** @@ -1090,7 +1093,7 @@ declare namespace Xrm { * @param entityType The logical name of the entity. * @returns True if the entity is offline enabled; otherwise False. * @deprecated Use {@link Xrm.WebApi.isAvailableOffline} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ isOfflineEnabled(entityType: string): boolean; @@ -1105,7 +1108,7 @@ declare namespace Xrm { * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.createRecord} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ createRecord(entityType: string, data: { [attributeName: string]: any }): Async.PromiseLike; @@ -1124,7 +1127,7 @@ declare namespace Xrm { * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.retrieveRecord} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ retrieveRecord(entityType: string, id: string, options: string): Async.PromiseLike; @@ -1147,7 +1150,7 @@ declare namespace Xrm { * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.retrieveMultipleRecords} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ retrieveMultipleRecords(entityType: string, options: string, maxPageSize: number): Async.PromiseLike>; @@ -1163,7 +1166,7 @@ declare namespace Xrm { * Integer, Lookup, Memo, Money, Owner, Picklist, String, State * Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.updateRecord} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ updateRecord(entityType: string, id: string, data: { [attributeName: string]: any }): Async.PromiseLike; @@ -1174,7 +1177,7 @@ declare namespace Xrm { * @returns Returns an asynchronous promise. * @remarks You cannot delete intersect and activity party entities. * @deprecated Use {@link Xrm.WebApi.deleteRecord} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ deleteRecord(entityType: string, id: string): Async.PromiseLike; } @@ -1318,7 +1321,7 @@ declare namespace Xrm { /** * Collections are structures to provide access to data that represent an array, but without the ability to modify the data in the array. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections Collections (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} */ type ItemCollection = Dictionary & { /** @@ -1382,13 +1385,13 @@ declare namespace Xrm { /** * Interface for Page context * @deprecated Use {@link Xrm.Events.EventContext.getFormContext formContext} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs}a + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs}a */ interface Page extends FormContext { /** * Provides methods to retrieve information specific to an organization, a user, or parameters passed to a page. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ context: GlobalContext; } @@ -1396,7 +1399,7 @@ declare namespace Xrm { /** * Xrm.Page namespace has been deprecated * @deprecated Use {@link Xrm.Events.EventContext.getFormContext formContext} instead. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ namespace Page { /** @@ -2569,7 +2572,7 @@ declare namespace Xrm { * Use this to add a function as an event handler for the keypress event so that the function is called when you type a character in the specific text or number field. * For a sample JavaScript code that uses the addOnKeyPress method to configure the auto-completion experience, see Sample: Auto-complete in CRM controls. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param handler The function reference. */ addOnKeyPress(handler: Events.ContextSensitiveHandler): void; @@ -2582,7 +2585,7 @@ declare namespace Xrm { /** * Use this to remove an event handler for a text or number field that you added using addOnKeyPress. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * Remarks: If an anonymous function is set using addOnKeyPress, it can’t be removed using this method. * @param handler The function reference. */ @@ -2712,7 +2715,7 @@ declare namespace Xrm { * Interface for a navigation item. * @see UiElement * @see UiFocusable - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-navigation formContext.ui.navigation item (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-navigation External Link: formContext.ui.navigation item (Client API reference)} */ interface NavigationItem extends UiStandardElement, UiFocusable { /** @@ -2781,7 +2784,7 @@ declare namespace Xrm { * This is not an Entity Lookup, but a control that supports AutoComplete / KeyPress Events (Text or Number) * @remarks This interface is not supported for CRM mobile clients (phones or tablets) and the interactive service hub. It is only available for Updated entities. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @see StandardControl */ interface AutoLookupControl extends StandardControl, UiKeyPressable { @@ -2796,7 +2799,7 @@ declare namespace Xrm { /** * Hides the auto-completion drop-down list configured for a specific text field * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} */ hideAutoComplete(): void; @@ -2804,7 +2807,7 @@ declare namespace Xrm { * Shows upt to 10 matching strings in a drop-down list as users press keys to type charactrer in a specific text field. * On selecting an item in the drop-down list, the value in the text field changes to the selected item, the drop-down list disappears, and the OnChange event for the text field is invoked * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param resultSet The results to show */ showAutoComplete(resultSet: AutoCompleteResultSet): void; @@ -3169,7 +3172,7 @@ declare namespace Xrm { /** * Interface for a quick view control instance on a form. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-quickforms ExternalLink: formContext.ui.quickForms (Client API reference)} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-quickforms External Link: formContext.ui.quickForms (Client API reference)} */ interface QuickFormControl extends Control, UiLabelElement, UiCanGetVisibleElement { /** @@ -3532,7 +3535,7 @@ declare namespace Xrm { /** * Saves the record. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @remarks When using quick create forms in the web application the saveandnew option is not * applied. It will always work as if saveandclose were used. Quick create forms in * Microsoft Dynamics CRM for tablets will apply the saveandnew behavior. @@ -3542,7 +3545,7 @@ declare namespace Xrm { /** * Saves the record with the given save mode. * @deprecated Deprecated in v9. - * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link:Deprecated Client APIs} + * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @param saveMode (Optional) the save mode to save, as either "saveandclose" or "saveandnew". */ save(saveMode: EntitySaveMode): void; @@ -3912,7 +3915,7 @@ declare namespace Xrm { /** * An definition module for URL-based, CRM component parameters. - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} */ namespace Url { /** @@ -3934,7 +3937,7 @@ declare namespace Xrm { * Interface for defining parameters on a request to open a form with main.aspx (as with * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} * @remarks A member for "pagetype" is not provided. The value "entityrecord" is required in * the URL, for forms. Example: "pagetype=entityrecord" */ @@ -3974,7 +3977,7 @@ declare namespace Xrm { * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} * * @remarks A member for "pagetype" is not provided. The value "entitylist" is required in * the URL, for views. Example: "pagetype=entitylist" @@ -4019,7 +4022,7 @@ declare namespace Xrm { * Interface for defining parameters of a request to open a dialog with rundialog.aspx (as with * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} */ interface DialogOpenParameters { /** @@ -4044,7 +4047,7 @@ declare namespace Xrm { * window.open). Useful for parsing out the keys and values into a string of the format: * "&key=value" * - * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link:Open forms, views, dialogs, and reports with a URL} + * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} */ interface ReportOpenParameters { /** From 346363a0ccf48a12fb281bb710c3623af0a36c07 Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Fri, 24 Nov 2017 20:09:09 -0500 Subject: [PATCH 114/269] Removed trailing commas Cleanup trailing commas on enums. --- types/xrm/index.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 9914598cad..d76d9caea6 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -4894,7 +4894,7 @@ declare namespace XrmEnum { /** * @deprecated ReadOptimized has been deprecated. */ - ReadOptimized = 11, + ReadOptimized = 11 } /** @@ -4911,7 +4911,7 @@ declare namespace XrmEnum { Assign = 47, Send = 7, Qualify = 16, - Disqualify = 15, + Disqualify = 15 } /** @@ -4924,7 +4924,7 @@ declare namespace XrmEnum { Close = 3, Identify = 4, Research = 5, - Resolve = 6, + Resolve = 6 } /** @@ -4935,7 +4935,7 @@ declare namespace XrmEnum { RibbonContextForm = 1, RibbonContextListing = 2, FormContextUnrelated = 3, - FormContextRelated = 4, + FormContextRelated = 4 } /** @@ -4943,7 +4943,7 @@ declare namespace XrmEnum { */ const enum ViewType { SystemView = 1039, - UserView = 4230, + UserView = 4230 } /** @@ -4970,7 +4970,7 @@ declare namespace XrmEnum { Virtual = 17, BigInt = 18, ManagedProperty = 19, - EntityName = 20, + EntityName = 20 } /** @@ -4980,7 +4980,7 @@ declare namespace XrmEnum { None = 0, SystemRequired = 1, ApplicationRequired = 2, - Recommended = 3, + Recommended = 3 } /** @@ -4988,7 +4988,7 @@ declare namespace XrmEnum { */ const enum OpenFileOptions { Open = 1, - Save = 2, + Save = 2 } /** @@ -4996,7 +4996,7 @@ declare namespace XrmEnum { */ const enum WindowPositions { Center = 1, - Side = 2, + Side = 2 } /** @@ -5004,7 +5004,7 @@ declare namespace XrmEnum { */ const enum RelationshipType { OneToMany = 0, - ManyToMany = 1, + ManyToMany = 1 } /** @@ -5012,14 +5012,14 @@ declare namespace XrmEnum { */ const enum RoleType { Referencing = 1, - AssociationEntity = 2, + AssociationEntity = 2 } const enum ClientFormFactor { Unknown = 1, Desktop = 2, Tablet = 3, - Phone = 4, + Phone = 4 } /** From 0c4d0b2d22c642f6494fa53dd4a871e539778e4c Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Fri, 24 Nov 2017 22:36:55 -0500 Subject: [PATCH 115/269] Fixed @see to use @link as well tsdoc doesn't support @see that directs to an internal link like jsdoc does. http://usejsdoc.org/tags-see.html tsdoc supports @returns as well as @return. Made some other tsdoc markup changes. --- types/xrm/index.d.ts | 196 +++++++++++++++++++++---------------------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index d76d9caea6..c94bc245fc 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -16,7 +16,7 @@ declare var Xrm: Xrm.XrmStatic; * The method provides access to the global context without going through the form context. * * It is preferreed to use {@link Xrm.Utility.getGlobalContext Xrm.Utility.getGlobalContext()} instead. - * @see Xrm.Utility.getGlobalContext + * @see {@link Xrm.Utility.getGlobalContext} */ declare function GetGlobalContext(): Xrm.GlobalContext; @@ -90,46 +90,46 @@ declare namespace Xrm { /** * Client Types for {@link GlobalContext.getClient globalContext.getClient()}. - * @see XrmEnum.Client + * @see {@link XrmEnum.Client} */ type Client = "Web" | "Outlook" | "Mobile" | "UnifiedServiceDesk"; /** * Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. - * @see XrmEnum.ClientState + * @see {@link XrmEnum.ClientState} */ type ClientState = "Online" | "Offline"; /** * Display States for setDisplayState() on {@link Controls.ProcessControl.setDisplayState Processes} and {@link Controls.Tab.setDisplayState Tabs}. - * @see XrmEnum.DisplayState + * @see {@link XrmEnum.DisplayState} */ type DisplayState = "collapsed" | "expanded"; /** * The {@link Entity.save Entity}'s Save Mode - * @see XrmEnum.EntitySaveMode - * @see Entity - * @see Entity.save + * @see {@link XrmEnum.EntitySaveMode} + * @see {@link Entity} + * @see {@link Entity.save} */ type EntitySaveMode = "saveandclose" | "saveandnew"; /** * Form Notification Levels for {@link Ui.setFormNotification formContext.ui.setFormNotification()}. - * @see XrmEnum.FormNotificationLevel + * @see {@link XrmEnum.FormNotificationLevel} */ type FormNotificationLevel = "ERROR" | "INFO" | "WARNING"; /** * Submit Mode for {@link Attributes.Attribute.setSubmitMode} Attributes.Attribute.setSubmitMode(). - * @see XrmEnum.SubmitMode + * @see {@link XrmEnum.SubmitMode} */ type SubmitMode = "always" | "dirty" | "never"; /** * Themes for {@link GlobalContext.getCurrentTheme globalContext.getCurrentTheme()}. * Note: getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. - * @see XrmEnum.Theme + * @see {@link XrmEnum.Theme} */ type Theme = "default" | "Office12Blue" | "Office14Silver"; @@ -332,7 +332,7 @@ declare namespace Xrm { /** * Returns information about the advanced configuration settings for the organization. * @param setting Name of the configuration setting. - * @see XrmEnum.AdvancedConfigSettingOption + * @see {@link XrmEnum.AdvancedConfigSettingOption} */ getAdvancedConfigSetting(setting: "MaxChildIncidentNumber" | "MaxIncidentMergeNumber"): number; @@ -678,7 +678,7 @@ declare namespace Xrm { * In V9 this is only available in the Unified Client * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/attributes External Link: Attributes (Client API reference)} * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/collections External Link: Collections (Client API reference)} - * @see Attributes + * @see {@link Attributes} */ attributes: Collection.ItemCollection; @@ -1433,8 +1433,8 @@ declare namespace Xrm { /** * Interface for a navigation item. - * @see UiElement - * @see UiFocusable + * @see {@link UiElement} + * @see {@link UiFocusable} * @deprecated Use {@link Xrm.Controls.NavigationItem} instead. */ interface NavigationItem extends Controls.NavigationItem { } @@ -1665,49 +1665,49 @@ declare namespace Xrm { /** * Interface for a Number attribute. - * @see Attribute + * @see {@link Attribute} * @deprecated Use {@link Xrm.Attributes.NumberAttribute} instead. */ interface NumberAttribute extends Attributes.NumberAttribute { } /** * Interface for a String attribute. - * @see Attribute + * @see {@link Attribute} * @deprecated Use {@link Xrm.Attributes.StringAttribute} instead. */ interface StringAttribute extends Attributes.StringAttribute { } /** * Common interface for enumeration attributes (OptionSet and Boolean). - * @see Attribute + * @see {@link Attribute} * @deprecated Use {@link Xrm.Attributes.EnumAttribute} instead. */ interface EnumAttribute extends Attributes.EnumAttribute { } /** * Interface for a Boolean attribute. - * @see EnumAttribute + * @see {@link EnumAttribute} * @deprecated Use {@link Xrm.Attributes.BooleanAttribute} instead. */ interface BooleanAttribute extends Attributes.BooleanAttribute { } /** * Interface for a Date attribute. - * @see Attribute + * @see {@link Attribute} * @deprecated Use {@link Xrm.Attributes.DateAttribute} instead. */ interface DateAttribute extends Attributes.DateAttribute { } /** * Interface an OptionSet attribute. - * @see EnumAttribute + * @see {@link EnumAttribute} * @deprecated Use {@link Xrm.Attributes.OptionSetAttribute} instead. */ interface OptionSetAttribute extends Attributes.OptionSetAttribute { } /** * Interface a Lookup attribute. - * @see Attribute + * @see {@link Attribute} * @deprecated Use {@link Xrm.Attributes.LookupAttribute} instead. */ interface LookupAttribute extends Attributes.LookupAttribute { } @@ -1738,14 +1738,14 @@ declare namespace Xrm { /** * Interface for Xrm.Page.ui controls. - * @see UiElement + * @see {@link UiElement} * @deprecated Use {@link Xrm.Controls.Control} instead. */ interface Control extends Controls.Control { } /** * Interface for a standard control. - * @see Control + * @see {@link Control} * @deprecated Use {@link Xrm.Controls.StandardControl} instead. */ interface StandardControl extends Controls.StandardControl { } @@ -1754,42 +1754,42 @@ declare namespace Xrm { * Interface for Auto Lookup Control. * This is not an Entity Lookup, but a control that supports AutoComplete / KeyPress Events (Text or Number) * @remarks This interface is not supported for CRM mobile clients (phones or tablets) and the interactive service hub. It is only available for Updated entities. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.AutoLookupControl} instead. */ interface AutoLookupControl extends Controls.AutoLookupControl { } /** * Interface for a String control. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.StringControl} instead. */ interface StringControl extends Controls.StringControl { } /** * Interface for a Number control. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.NumberControl} instead. */ interface NumberControl extends AutoLookupControl { } /** * Interface for a Date control. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.DateControl} instead. */ interface DateControl extends StandardControl { } /** * Interface for a Lookup control. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.LookupControl} instead. */ interface LookupControl extends Controls.LookupControl { } /** * Interface for an OptionSet control. - * @see StandardControl + * @see {@link StandardControl} * @deprecated Use {@link Xrm.Controls.OptionSetControl} instead. */ interface OptionSetControl extends Controls.OptionSetControl { } @@ -1797,14 +1797,14 @@ declare namespace Xrm { /** * Interface for a CRM grid control. * - * @see Control + * @see {@link Control} * @deprecated Use {@link Xrm.Controls.GridControl} instead. */ interface GridControl extends Controls.GridControl { } /** * Interface for a framed control, which is either a Web Resource or an Iframe. - * @see Control + * @see {@link Control} * @remarks An Iframe control provides additional methods, so use {@link IframeControl} where * appropriate. Silverlight controls should use {@link SilverlightControl}. * @deprecated Use {@link Xrm.Controls.FramedControl} instead. @@ -1813,36 +1813,36 @@ declare namespace Xrm { /** * Interface for an Iframe control. - * @see FramedControl + * @see {@link FramedControl} * @deprecated Use {@link Xrm.Controls.IframeControl} instead. */ interface IframeControl extends Controls.IframeControl { } /** * Interface for a Silverlight control. - * @see Control + * @see {@link Control} * @deprecated Use {@link Xrm.Controls.SilverlightControl} instead. */ interface SilverlightControl extends Controls.SilverlightControl { } /** * Interface for a Timeline control. - * @see Control + * @see {@link Control} * @deprecated Use {@link Xrm.Controls.TimelineWall} instead. */ interface TimelineWall extends Controls.TimelineWall { } /** * Interface for a form tab. - * @see UiElement - * @see UiFocusable + * @see {@link UiElement} + * @see {@link UiFocusable} * @deprecated Use {@link Xrm.Controls.Tab} instead. */ interface Tab extends Controls.Tab { } /** * Interface for a form section. - * @see UiElement + * @see {@link UiElement} * @deprecated Use {@link Xrm.Controls.Section} instead. */ interface Section extends Controls.Section { } @@ -2033,47 +2033,47 @@ declare namespace Xrm { /** * Requirement Level for {@link Attributes.Attribute.getRequiredLevel Attributes.Attribute.getRequiredLevel()} and * {@link Attributes.Attribute.setRequiredLevel Attributes.Attribute.setRequiredLevel()}. - * @see XrmEnum.AttributeRequirementLevel + * @see {@link XrmEnum.AttributeRequirementLevel} */ type RequirementLevel = "none" | "recommended" | "required"; /** * Date attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.DateAttribute DateAttribute}. - * @see XrmEnum.DateAttributeFormat + * @see {@link XrmEnum.DateAttributeFormat} */ type DateAttributeFormat = "date" | "datetime"; /** * Integer attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.NumberAttribute NumberAttribute}. - * @see XrmEnum.IntegerAttributeFormat + * @see {@link XrmEnum.IntegerAttributeFormat} */ type IntegerAttributeFormat = "duration" | "none"; /** * OptionSet attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.OptionSetAttribute OptionSetAttribute}. - * @see XrmEnum.OptionSetAttributeFormat + * @see {@link XrmEnum.OptionSetAttributeFormat} */ type OptionSetAttributeFormat = "language" | "timezone"; /** * String attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.StringAttribute StringAttribute}. - * @see XrmEnum.StringAttributeFormat + * @see {@link XrmEnum.StringAttributeFormat} */ type StringAttributeFormat = "email" | "phone" | "text" | "textarea" | "tickersymbol" | "url"; /** * Attribute types for {@link Attributes.Attribute.setDisplayState()}. - * @see XrmEnum.AttributeType + * @see {@link XrmEnum.AttributeType} */ type AttributeType = "boolean" | "datetime" | "decimal" | "double" | "integer" | "lookup" | "memo" | "money" | "multioptionset" | "optionset" | "string"; /** * Attribute formats for {@link Attributes.Attribute.getFormat Attributes.Attribute.getFormat()}. - * @see XrmEnum.DateAttributeFormat - * @see XrmEnum.IntegerAttributeFormat - * @see XrmEnum.OptionSetAttributeFormat - * @see XrmEnum.StringAttributeFormat + * @see {@link XrmEnum.DateAttributeFormat} + * @see {@link XrmEnum.IntegerAttributeFormat} + * @see {@link XrmEnum.OptionSetAttributeFormat} + * @see {@link XrmEnum.StringAttributeFormat} */ type AttributeFormat = DateAttributeFormat | IntegerAttributeFormat | OptionSetAttributeFormat | StringAttributeFormat; @@ -2113,7 +2113,7 @@ declare namespace Xrm { * * @returns The format of the attribute. * - * @see getAttributeType + * @see {@link getAttributeType} * Values returned are: date (datetime) * datetime (datetime) * duration (integer) @@ -2175,7 +2175,7 @@ declare namespace Xrm { /** * Sets the required level. * @param requirementLevel The requirement level, as either "none", "required", or "recommended" - * @see XrmEnum.AttributeRequirementLevel + * @see {@link XrmEnum.AttributeRequirementLevel} */ setRequiredLevel(requirementLevel: RequirementLevel): void; @@ -2183,7 +2183,7 @@ declare namespace Xrm { * Sets the submit mode. * @param submitMode The submit mode, as either "always", "never", or "dirty". * @default submitMode "dirty" - * @see XrmEnum.AttributeRequirementLevel + * @see {@link XrmEnum.AttributeRequirementLevel} */ setSubmitMode(submitMode: SubmitMode): void; @@ -2208,7 +2208,7 @@ declare namespace Xrm { /** * Interface for a Number attribute. - * @see Attribute + * @see {@link Attribute} */ interface NumberAttribute extends Attribute { /** @@ -2258,7 +2258,7 @@ declare namespace Xrm { /** * Interface for a String attribute. - * @see Attribute + * @see {@link Attribute} */ interface StringAttribute extends Attribute { /** @@ -2302,7 +2302,7 @@ declare namespace Xrm { /** * Common interface for enumeration attributes (OptionSet and Boolean). - * @see Attribute + * @see {@link Attribute} */ interface EnumAttribute extends Attribute { /** @@ -2315,7 +2315,7 @@ declare namespace Xrm { /** * Interface for a Boolean attribute. - * @see EnumAttribute + * @see {@link EnumAttribute} */ interface BooleanAttribute extends EnumAttribute { /** @@ -2342,7 +2342,7 @@ declare namespace Xrm { /** * Interface for a Date attribute. * - * @see Attribute + * @see {@link Attribute} */ interface DateAttribute extends Attribute { /** @@ -2375,7 +2375,7 @@ declare namespace Xrm { /** * Interface an OptionSet attribute. - * @see EnumAttribute + * @see {@link EnumAttribute} */ interface OptionSetAttribute extends EnumAttribute { /** @@ -2450,7 +2450,7 @@ declare namespace Xrm { /** * Interface a Lookup attribute. * - * @see Attribute + * @see {@link Attribute} */ interface LookupAttribute extends Attribute { /** @@ -2492,7 +2492,7 @@ declare namespace Xrm { /** * Control types for {@link Controls.Control.getControlType Controls.Control.getControlType()}. - * @see XrmEnum.StandardControlType + * @see {@link XrmEnum.StandardControlType} */ type ControlType = "standard" | "iframe" | "lookup" | "optionset" | "subgrid" | "webresource" | "notes" | "timercontrol" | "kbsearch" | @@ -2655,7 +2655,7 @@ declare namespace Xrm { /** * Interface for controls. * - * @see UiElement + * @see {@link UiElement} */ interface Control extends UiLabelElement, UiCanGetVisibleElement { /** @@ -2713,8 +2713,8 @@ declare namespace Xrm { /** * Interface for a navigation item. - * @see UiElement - * @see UiFocusable + * @see {@link UiElement} + * @see {@link UiFocusable} * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-ui-navigation External Link: formContext.ui.navigation item (Client API reference)} */ interface NavigationItem extends UiStandardElement, UiFocusable { @@ -2727,7 +2727,7 @@ declare namespace Xrm { /** * Interface for a standard control. - * @see Control + * @see {@link Control} */ interface StandardControl extends Control, UiStandardElement, UiFocusable { /** @@ -2785,7 +2785,7 @@ declare namespace Xrm { * @remarks This interface is not supported for CRM mobile clients (phones or tablets) and the interactive service hub. It is only available for Updated entities. * @deprecated Deprecated in v9. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} - * @see StandardControl + * @see {@link StandardControl} */ interface AutoLookupControl extends StandardControl, UiKeyPressable { /** @@ -2815,7 +2815,7 @@ declare namespace Xrm { /** * Interface for a String control. - * @see StandardControl + * @see {@link StandardControl} */ interface StringControl extends AutoLookupControl { /** @@ -2827,7 +2827,7 @@ declare namespace Xrm { /** * Interface for a Number control. - * @see StandardControl + * @see {@link StandardControl} */ interface NumberControl extends AutoLookupControl { /** @@ -2839,7 +2839,7 @@ declare namespace Xrm { /** * Interface for a Date control. - * @see StandardControl + * @see {@link StandardControl} */ interface DateControl extends StandardControl { /** @@ -2863,7 +2863,7 @@ declare namespace Xrm { /** * Interface for a Lookup control. - * @see StandardControl + * @see {@link StandardControl} */ interface LookupControl extends StandardControl { /** @@ -2875,7 +2875,7 @@ declare namespace Xrm { /** * Adds an additional custom filter to the lookup, with the "AND" filter operator. * Can only be used within a "pre search" event handler - * @see addPreSearch + * @see {@link addPreSearch} * @param filter Specifies the filter, as a serialized FetchXML "filter" node. * @param entityLogicalName (Optional) The logical name of the entity. * @remarks If entityLogicalName is not specified, the filter will be applied to all entities @@ -2942,7 +2942,7 @@ declare namespace Xrm { /** * Interface for an OptionSet control. * - * @see StandardControl + * @see {@link StandardControl} */ interface OptionSetControl extends StandardControl { /** @@ -2979,7 +2979,7 @@ declare namespace Xrm { /** * Interface for a CRM grid control. * - * @see Control + * @see {@link Control} */ interface GridControl extends Control { /** @@ -3130,7 +3130,7 @@ declare namespace Xrm { /** * Interface for a framed control, which is either a Web Resource or an Iframe. - * @see Control + * @see {@link Control} * @remarks An Iframe control provides additional methods, so use {@link IframeControl} where * appropriate. Silverlight controls should use {@link SilverlightControl}. */ @@ -3159,7 +3159,7 @@ declare namespace Xrm { /** * Interface for an Iframe control. - * @see FramedControl + * @see {@link FramedControl} */ interface IframeControl extends FramedControl, UiCanSetVisibleElement { /** @@ -3240,7 +3240,7 @@ declare namespace Xrm { /** * Interface for a Silverlight control. - * @see Control + * @see {@link Control} * @deprecated The Silverlight WebResource is deprecated on the web client, and is not supported on the new Unified Interface in v9. * Instead of silverlight, use custom controls created using the HTML web resources with HTML5 to create UI components to visualize and interact with data. */ @@ -3269,7 +3269,7 @@ declare namespace Xrm { /** * Interface for a Timeline control. - * @see Control + * @see {@link Control} */ interface TimelineWall extends Control { /** @@ -3280,8 +3280,8 @@ declare namespace Xrm { /** * Interface for a form tab. - * @see UiElement - * @see UiFocusable + * @see {@link UiElement} + * @see {@link UiFocusable} */ interface Tab extends UiStandardElement, UiFocusable { /** @@ -3317,7 +3317,7 @@ declare namespace Xrm { /** * Interface for a form section. - * @see UiElement + * @see {@link UiElement} */ interface Section extends UiStandardElement { /** @@ -3561,19 +3561,19 @@ declare namespace Xrm { namespace ProcessFlow { /** * Direction types for a process stage change event - * @see XrmEnum.StageChangeDirection + * @see {@link XrmEnum.StageChangeDirection} */ type StageChangeDirection = "Next" | "Previous"; /** * Status for {@link ProcessFlow.Stage.getStatus Stage.getStatus()}. - * @see XrmEnum.StageStatus + * @see {@link XrmEnum.StageStatus} */ type StageStatus = "active" | "inactive"; /** * Status for {@link ProcessFlow.Process.getStatus Process.getStatus()}. - * @see XrmEnum.ProcessStatus + * @see {@link XrmEnum.ProcessStatus} */ type ProcessStatus = "active" | "aborted" | "finished"; @@ -5024,7 +5024,7 @@ declare namespace XrmEnum { /** * Constant Enum: Client Types for {@link GlobalContext.getClient globalContext.getClient()}. - * @see Xrm.Client + * @see {@link Xrm.Client} */ const enum Client { Web = "Web", @@ -5036,7 +5036,7 @@ declare namespace XrmEnum { /** * Constant Enum: Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. - * @see Xrm.ClientState + * @see {@link Xrm.ClientState} */ const enum ClientState { Online = "Online", @@ -5045,7 +5045,7 @@ declare namespace XrmEnum { /** * Constant Enum: Display States for setDisplayState() on {@link Controls.ProcessControl.setDisplayState Processes} and {@link Controls.Tab.setDisplayState Tabs}. - * @see Xrm.DisplayState + * @see {@link Xrm.DisplayState} */ const enum DisplayState { Expanded = "expanded", @@ -5054,9 +5054,9 @@ declare namespace XrmEnum { /** * Constant Enum: {@link Entity.save Entity} Save Modes - * @see Xrm.EntitySaveMode - * @see Entity - * @see Entity.save + * @see {@link Xrm.EntitySaveMode} + * @see {@link Entity} + * @see {@link Entity.save} */ const enum EntitySaveMode { SaveAndClose = "saveandclose", @@ -5065,7 +5065,7 @@ declare namespace XrmEnum { /** * Constant Enum: Form Notification Levels for {@link Ui.setFormNotification formContext.ui.setFormNotification()}. - * @see Xrm.FormNotificationLevel + * @see {@link Xrm.FormNotificationLevel} */ const enum FormNotificationLevel { Error = "ERROR", @@ -5075,7 +5075,7 @@ declare namespace XrmEnum { /** * Constant Enum: Submit Modes for {@link Attributes.Attribute.setSubmitMode} Attributes.Attribute.setSubmitMode(). - * @see Xrm.SubmitMode + * @see {@link Xrm.SubmitMode} */ const enum SubmitMode { Always = "always", @@ -5104,7 +5104,7 @@ declare namespace XrmEnum { /** * Constant Enum: Requirement Level for {@link Attributes.Attribute.getRequiredLevel Attributes.Attribute.getRequiredLevel()} and * {@link Attributes.Attribute.setRequiredLevel Attributes.Attribute.setRequiredLevel()}. - * @see Xrm.Attributes.RequirementLevel + * @see {@link Xrm.Attributes.RequirementLevel} */ const enum AttributeRequirementLevel { None = "none", @@ -5114,7 +5114,7 @@ declare namespace XrmEnum { /** * Constant Enum: Date attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.DateAttribute DateAttribute}. - * @see Xrm.Attributes.DateAttributeFormat + * @see {@link Xrm.Attributes.DateAttributeFormat} */ const enum DateAttributeFormat { Date = "date", @@ -5123,7 +5123,7 @@ declare namespace XrmEnum { /** * Constant Enum: Integer attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.NumberAttribute NumberAttribute}. - * @see Xrm.Attributes.IntegerAttributeFormat + * @see {@link Xrm.Attributes.IntegerAttributeFormat} */ const enum IntegerAttributeFormat { Duration = "duration", @@ -5132,7 +5132,7 @@ declare namespace XrmEnum { /** * Constant Enum: OptionSet attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.OptionSetAttribute OptionSetAttribute}. - * @see Xrm.Attributes.OptionSetAttributeFormat + * @see {@link Xrm.Attributes.OptionSetAttributeFormat} */ const enum OptionSetAttributeFormat { Language = "language", @@ -5141,7 +5141,7 @@ declare namespace XrmEnum { /** * Constant Enum: String attribute formats for Attributes.Attribute.getFormat(), used by {@link Attributes.StringAttribute StringAttribute}. - * @see Xrm.Attributes.StringAttributeFormat + * @see {@link Xrm.Attributes.StringAttributeFormat} */ const enum StringAttributeFormat { Email = "email", @@ -5154,7 +5154,7 @@ declare namespace XrmEnum { /** * Constant Enum: Attribute types for {@link Attributes.Attribute.setDisplayState()}. - * @see Xrm.Attributes.AttributeType + * @see {@link Xrm.Attributes.AttributeType} */ const enum AttributeType { Boolean = "boolean", @@ -5171,7 +5171,7 @@ declare namespace XrmEnum { /** * Constant Enum: Control types for {@link Controls.Control.getControlType Controls.Control.getControlType()}. - * @see Xrm.Controls.ControlType + * @see {@link Xrm.Controls.ControlType} */ const enum StandardControlType { Standard = "standard", @@ -5189,7 +5189,7 @@ declare namespace XrmEnum { /** * Constant Enum: Direction types for a process stage change event - * @see ProcessFlow.StageChangeDirection + * @see {@link ProcessFlow.StageChangeDirection} */ const enum StageChangeDirection { Next = "Next", @@ -5198,7 +5198,7 @@ declare namespace XrmEnum { /** * Constant Enum: Status for {@link ProcessFlow.Stage.getStatus Stage.getStatus()}. - * @see ProcessFlow.StageStatus + * @see {@link ProcessFlow.StageStatus} */ const enum StageStatus { Active = "active", @@ -5207,7 +5207,7 @@ declare namespace XrmEnum { /** * Constant Enum: Status for {@link ProcessFlow.Process.getStatus Process.getStatus()}. - * @see ProcessFlow.ProcessStatus + * @see {@link ProcessFlow.ProcessStatus} */ const enum ProcessStatus { Active = "active", From 9bdb3afa3b64d219800dce567fc700a3b4fe5c98 Mon Sep 17 00:00:00 2001 From: zwh8800 Date: Sat, 25 Nov 2017 15:39:28 +0800 Subject: [PATCH 116/269] fix @types/puppeteer $eval type error --- types/puppeteer/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index b6220485fb..b1f214aa7b 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -667,7 +667,8 @@ export interface FrameBase { */ $eval( selector: string, - fn: (...args: any[]) => void + fn: (ele: ElementHandle | null, ...args: any[]) => any, + ...args: any[] ): Promise; /** @@ -680,7 +681,7 @@ export interface FrameBase { */ $$eval( selector: string, - fn: (...args: any[]) => void, + fn: (eles: ElementHandle[], ...args: any[]) => any, ...args: any[] ): Promise; From 1cfcf9cf86133649435a589a6a360bcd4c889446 Mon Sep 17 00:00:00 2001 From: Nicolas Beck Date: Sat, 25 Nov 2017 09:15:44 +0100 Subject: [PATCH 117/269] fixed type of drawerLabel prop according to the docs and my own test 'string' is also allowed as drawerLabel --- types/react-navigation/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 8883d98da4..cd528e82e8 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -349,7 +349,8 @@ export interface NavigationDrawerScreenOptions extends NavigationScreenOptions { any > | null)); drawerLabel?: - React.ReactElement + string + | React.ReactElement | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< any > | null)); From 2165db7ccda31ac29f79b330d3747a412afb5457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Sat, 25 Nov 2017 10:18:08 +0100 Subject: [PATCH 118/269] Set references to global leaflet definition Added package.json Removed optional flags from methods --- types/leaflet.heat/index.d.ts | 8 ++++---- types/leaflet.heat/leaflet.heat-tests.ts | 2 -- types/leaflet.heat/package.json | 5 +++++ types/leaflet.heat/tslint.json | 4 +++- 4 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 types/leaflet.heat/package.json diff --git a/types/leaflet.heat/index.d.ts b/types/leaflet.heat/index.d.ts index c58921046a..787d15fa58 100644 --- a/types/leaflet.heat/index.d.ts +++ b/types/leaflet.heat/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Önder Ceylan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// declare namespace L { type HeatLatLngTuple = [number, number, number]; @@ -22,9 +22,9 @@ declare namespace L { } interface HeatLayer extends TileLayer { - setOptions?(options: HeatMapOptions): HeatLayer; - addLatLng?(latlng: LatLng | HeatLatLngTuple): HeatLayer; - setLatLngs?(latlngs: Array): HeatLayer; + setOptions(options: HeatMapOptions): HeatLayer; + addLatLng(latlng: LatLng | HeatLatLngTuple): HeatLayer; + setLatLngs(latlngs: Array): HeatLayer; } function heatLayer(latlngs: Array, options: HeatMapOptions): HeatLayer; diff --git a/types/leaflet.heat/leaflet.heat-tests.ts b/types/leaflet.heat/leaflet.heat-tests.ts index 0e7a33fa50..aead8f1960 100644 --- a/types/leaflet.heat/leaflet.heat-tests.ts +++ b/types/leaflet.heat/leaflet.heat-tests.ts @@ -1,5 +1,3 @@ -/// -/// const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmAttrib = '© OpenStreetMap contributors', osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}), diff --git a/types/leaflet.heat/package.json b/types/leaflet.heat/package.json new file mode 100644 index 0000000000..1931c5cea0 --- /dev/null +++ b/types/leaflet.heat/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@types/leaflet": "^1.2.2" + } +} diff --git a/types/leaflet.heat/tslint.json b/types/leaflet.heat/tslint.json index 3db14f85ea..f93cf8562a 100644 --- a/types/leaflet.heat/tslint.json +++ b/types/leaflet.heat/tslint.json @@ -1 +1,3 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json" +} From 6022290bae8e809cac42688211cbece29e5c2e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Sat, 25 Nov 2017 10:22:35 +0100 Subject: [PATCH 119/269] Updated package.json --- types/leaflet.heat/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/leaflet.heat/package.json b/types/leaflet.heat/package.json index 1931c5cea0..62b4195c6f 100644 --- a/types/leaflet.heat/package.json +++ b/types/leaflet.heat/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "@types/leaflet": "^1.2.2" + "leaflet": "^1.2.0", + "leaflet.heat": "^0.2.0" } } From 601baf65a56ec1b00b6bbf1687b5797ad52d7403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Sat, 25 Nov 2017 10:29:07 +0100 Subject: [PATCH 120/269] Removed package.json --- types/leaflet.heat/package.json | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 types/leaflet.heat/package.json diff --git a/types/leaflet.heat/package.json b/types/leaflet.heat/package.json deleted file mode 100644 index 62b4195c6f..0000000000 --- a/types/leaflet.heat/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "leaflet": "^1.2.0", - "leaflet.heat": "^0.2.0" - } -} From 8c9eee81fd9e88aa54ede70628c5c15c90a1b1f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Sat, 25 Nov 2017 10:43:07 +0100 Subject: [PATCH 121/269] Removed comment for the package name --- types/leaflet.heat/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/leaflet.heat/index.d.ts b/types/leaflet.heat/index.d.ts index 787d15fa58..672ad41760 100644 --- a/types/leaflet.heat/index.d.ts +++ b/types/leaflet.heat/index.d.ts @@ -1,4 +1,3 @@ -// Type definitions for Leaflet.heat v0.2.0 // Project: https://github.com/Leaflet/Leaflet.heat // Definitions by: Önder Ceylan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 33996a0dc0586258c72e3057a0918856908e04c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Sat, 25 Nov 2017 10:47:11 +0100 Subject: [PATCH 122/269] Changed comment for the package name --- types/leaflet.heat/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/leaflet.heat/index.d.ts b/types/leaflet.heat/index.d.ts index 672ad41760..eafcb00e6f 100644 --- a/types/leaflet.heat/index.d.ts +++ b/types/leaflet.heat/index.d.ts @@ -1,3 +1,4 @@ +// Type definitions for Leaflet.heat // Project: https://github.com/Leaflet/Leaflet.heat // Definitions by: Önder Ceylan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 10dbe17f78505e574f5a554317ee4ee6b135d12c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Sat, 25 Nov 2017 10:50:57 +0100 Subject: [PATCH 123/269] Added dependent TypeScript version --- types/leaflet.heat/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/leaflet.heat/index.d.ts b/types/leaflet.heat/index.d.ts index eafcb00e6f..66464fcb08 100644 --- a/types/leaflet.heat/index.d.ts +++ b/types/leaflet.heat/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for Leaflet.heat +// Type definitions for Leaflet.heat v0.2.0 // Project: https://github.com/Leaflet/Leaflet.heat // Definitions by: Önder Ceylan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// From 693a778e7ed5b98627c1884c6cc9a888ecedd8c6 Mon Sep 17 00:00:00 2001 From: Ben Stevens Date: Sat, 25 Nov 2017 12:06:31 +0000 Subject: [PATCH 124/269] add element.destroy to stripe-v3 --- types/stripe-v3/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/stripe-v3/index.d.ts b/types/stripe-v3/index.d.ts index db8257401c..6d499a73d8 100644 --- a/types/stripe-v3/index.d.ts +++ b/types/stripe-v3/index.d.ts @@ -185,6 +185,7 @@ declare namespace stripe { blur(): void; clear(): void; unmount(): void; + destroy(): void; update(options: ElementsOptions): void; } From f0795a3470f96fe20ed3bde5a05f1048f7337601 Mon Sep 17 00:00:00 2001 From: Abdessamad MOUHASSINE Date: Sat, 25 Nov 2017 12:22:20 +0000 Subject: [PATCH 125/269] Add missing exports Add `normalize` and `match` functions --- types/type-is/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/type-is/index.d.ts b/types/type-is/index.d.ts index 93c70aa4a3..e3dd9da1fc 100644 --- a/types/type-is/index.d.ts +++ b/types/type-is/index.d.ts @@ -13,7 +13,9 @@ declare function typeIs(request: IncomingMessage, types: string[]): string | fal declare function typeIs(request: IncomingMessage, ...types: string[]): string | false | null; declare namespace typeIs { + function normalize (type: string): string | false; function hasBody(request: IncomingMessage): boolean; function is(mediaType: string, types: string[]): string | false; function is(mediaType: string, ...types: string[]): string | false; + function mimeMatch (expected: false | string, actual: string): boolean; } From e6862574f957bd1e5400f670d41db011bf0ce8f8 Mon Sep 17 00:00:00 2001 From: Abdessamad MOUHASSINE Date: Sat, 25 Nov 2017 13:07:40 +0000 Subject: [PATCH 126/269] Fix tslint issue --- types/type-is/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/type-is/index.d.ts b/types/type-is/index.d.ts index e3dd9da1fc..9fffd0bb9a 100644 --- a/types/type-is/index.d.ts +++ b/types/type-is/index.d.ts @@ -13,9 +13,9 @@ declare function typeIs(request: IncomingMessage, types: string[]): string | fal declare function typeIs(request: IncomingMessage, ...types: string[]): string | false | null; declare namespace typeIs { - function normalize (type: string): string | false; + function normalize(type: string): string | false; function hasBody(request: IncomingMessage): boolean; function is(mediaType: string, types: string[]): string | false; function is(mediaType: string, ...types: string[]): string | false; - function mimeMatch (expected: false | string, actual: string): boolean; + function mimeMatch(expected: false | string, actual: string): boolean; } From 90e335c7e86629de863f8ac172cf188fb728f4f9 Mon Sep 17 00:00:00 2001 From: rk-7 <30998401+rk-7@users.noreply.github.com> Date: Sat, 25 Nov 2017 19:44:54 +0530 Subject: [PATCH 127/269] alexa-sdk: Reverted the ConfirmationStatuses and DialogStates enum values to types. Added more types. --- types/alexa-sdk/index.d.ts | 116 +++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 64 deletions(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index a9c630269f..33fdc6dd7b 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -11,6 +11,18 @@ export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; export let StateString: string; +export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; +export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; +export type ListItemObjectStatus = "active" | "completed"; +export type ListObjectState = "active" | "archived"; +export type ImageSourceSize = "X_SMALL" | "SMALL" | "MEDIUM" | "LARGE" | "X_LARGE"; +export type TemplateBackButtonVisibility = "HIDDEN" | "VISIBLE"; +export type TemplateType = "BodyTemplate1" | "BodyTemplate2" | "BodyTemplate3" | "BodyTemplate6" | "BodyTemplate6" | "ListTemplate1" | "ListTemplate2"; +export type AudioPlayerActivity = "IDLE" | "PAUSED" | "PLAYING" | "BUFFER_UNDERRUN" | "FINISHED" | "STOPPED"; +export type CardType = "Standard" | "Simple" | "LinkAccount" | "AskForPermissionsConsent"; +export type HintType = "PlainText"; +export type DirectiveTypes = "AudioPlayer.Play" | "AudioPlayer.Stop" | "AudioPlayer.ClearQueue" | "Display.RenderTemplate" | "Hint" | "VideoApp.Launch"; +export type TextContentType = "PlainText" | "RichText"; //#region Types export interface CardImage { @@ -28,10 +40,14 @@ export interface ImageSource { widthPixels?: number; heightPixels?: number; /** - * Possible values: 'X_SMALL' | 'SMALL' | 'MEDIUM' | 'LARGE' | 'X_LARGE' - * Recommended size respectively (in px): 480 x 320 | 720 x 480 | 960 x 640 | 1200 x 800 | 1920 x 1280 + * Recommended sizes for the following dimensions (in px): + * 480 x 320 for X_SMALL, + * 720 x 480 for SMALL, + * 960 x 640 for MEDIUM, + * 1200 x 800 for LARGE, + * 1920 x 1280 for X_LARGE */ - size?: string; + size?: ImageSourceSize; } export interface Image { contentDescription: string; @@ -51,18 +67,19 @@ export interface ListItem { token: string; textContent?: TextContent; } + export interface Template { title?: string; token: string; backgroundImage?: Image; /** - * Possible values 'HIDDEN' | 'VISIBLE' + * Visibility of the back button. */ - backButton?: string; + backButton?: TemplateBackButtonVisibility; /** - * Possible values 'BodyTemplate1' | 'BodyTemplate2'| 'BodyTemplate3'| 'BodyTemplate6'| 'ListTemplate1'| 'ListTemplate2' + * Template type. */ - type: string; + type: TemplateType; image?: Image; listItems?: ListItem[]; } @@ -130,9 +147,9 @@ export interface AudioPlayer { token: string; offsetInMilliseconds: number; /** - * Possible values: 'IDLE'|'PAUSED'|'PLAYING'|'BUFFER_UNDERRUN'|'FINISHED'|'STOPPED' + * Player activity */ - playerActivity: string; + playerActivity: AudioPlayerActivity; } export interface RequestBody { version: string; @@ -162,10 +179,7 @@ export interface Permissions { export interface LaunchRequest extends Request { } export interface IntentRequest extends Request { - /** - * Possible values: 'STARTED'| 'IN_PROGRESS'| 'COMPLETED' - */ - dialogState?: string; + dialogState?: DialogStates; intent?: Intent; } @@ -204,20 +218,14 @@ export interface Resolutions { } export interface SlotValue { - /** - * Possible values: 'NONE'| 'DENIED'| 'CONFIRMED' - */ - confirmationStatus?: string; + confirmationStatus?: ConfirmationStatuses; name: string; value?: any; resolutions?: Resolutions; } export interface Intent { - /** - * Possible values: 'NONE'| 'DENIED'| 'CONFIRMED' - */ - confirmationStatus?: string; + confirmationStatus?: ConfirmationStatuses; name: string; slots: Record; } @@ -243,7 +251,7 @@ export interface OutputSpeech { } export interface Card { - type: "Simple" | "Standard" | "LinkAccount"; + type: CardType; title?: string; content?: string; text?: string; @@ -253,31 +261,7 @@ export interface Card { export interface Reprompt { outputSpeech: OutputSpeech; } -export const CARD_TYPES: { - STANDARD: 'Standard', - SIMPLE: 'Simple', - LINK_ACCOUNT: 'LinkAccount', - ASK_FOR_PERMISSIONS_CONSENT: 'AskForPermissionsConsent' -}; -export const HINT_TYPES: { - PLAIN_TEXT: 'PlainText' -}; - -export const DIRECTIVE_TYPES: { - AUDIOPLAYER: { - PLAY: 'AudioPlayer.Play', - STOP: 'AudioPlayer.Stop', - CLEAR_QUEUE: 'AudioPlayer.ClearQueue' - }, - DISPLAY: { - RENDER_TEMPLATE: 'Display.RenderTemplate' - }, - HINT: 'Hint', - VIDEOAPP: { - LAUNCH: 'VideoApp.Launch' - } -}; export interface ApiClientOptions { hostname: string; port: string; @@ -307,9 +291,8 @@ export interface ListItemObject { value: string; /** * item status - * Possible values: "active" or "completed" */ - status?: string; + status?: ListItemObjectStatus; /** * item version (Positive integer | string) */ @@ -341,9 +324,10 @@ export interface ListObject { */ name: string; /** + * state * "active" or "archived" (Enum) */ - state?: string; + state?: ListObjectState; /** * Possibly status of the list (or state?) * Fetched from commit eebba0d at https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/ @@ -359,15 +343,15 @@ export interface ListObject { * href is lint to the items having certain status. * The status can be "active" or "completed". */ - statusMap: { href: string; status: string; }; + statusMap: { href: string; status: ListItemObjectStatus; }; /** * Items that belong to this list. */ items: ListItemObject[]; } //#endregion -//#region templateBuilders +//#region templateBuilders /** * Generates templates for Echo Show device. */ @@ -408,7 +392,7 @@ export namespace templateBuilders { /** * Sets the backButton behavior - * @param backButtonBehavior 'VISIBLE' or 'HIDDEN' + * @param backButtonBehavior "VISIBLE" or "HIDDEN" * @returns TemplateBuilder */ setBackButtonBehavior(backButtonBehavior: string): T; @@ -558,6 +542,7 @@ export namespace templateBuilders { } } //#endregion + //#region services export namespace services { interface ApiClient { @@ -642,7 +627,7 @@ export namespace services { constructor(apiClient: ApiClient); /** - * Set apiEndpoint address, default is 'https://api.amazonalexa.com' + * Set apiEndpoint address, default is "https://api.amazonalexa.com" * @param apiEndpoint apiEndpoint * @returns void */ @@ -672,11 +657,11 @@ export namespace services { /** * Retrieve list metadata including the items in the list with requested status * @param listId unique Id associated with the list - * @param itemStatus itemsStatus can be either 'active' or 'completed' + * @param itemStatus itemsStatus can be either "active" or "completed" * @param token bearer token for list management permission * @returns Promise */ - getList(listId: string, itemStatus: string, token: string): Promise; + getList(listId: string, itemStatus: ListItemObjectStatus, token: string): Promise; /** * Update a custom list. Only the list name or state can be updated @@ -734,6 +719,7 @@ export namespace services { } } //#endregion + //#region ResponseBuilder /** * Responsible for building JSON responses as per the Alexa skills kit interface @@ -842,7 +828,7 @@ export class ResponseBuilder { * @param hintType (optional) Default value : PlainText * @returns ResponseBuilder */ - hint(hintText: string, hintType: string): ResponseBuilder; + hint(hintText: string, hintType: HintType): ResponseBuilder; /** * Creates a VideoApp play directive to play a video @@ -855,6 +841,7 @@ export class ResponseBuilder { playVideo(source: string, metadata: { title: string, subtitle: string }): ResponseBuilder; } //#endregion + //#region directives export namespace directives { class VoicePlayerSpeakDirective { @@ -869,6 +856,7 @@ export namespace directives { } } //#endregion + //#region utils export namespace utils { namespace ImageUtils { @@ -881,7 +869,7 @@ export namespace utils { * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, * which means that larger images will be downscaled for display on Echo Show if provided. - * example : ImageUtils.makeImage('https://url/to/my/img.png', 300, 400, 'SMALL', 'image description') + * example : ImageUtils.makeImage("https://url/to/my/img.png", 300, 400, "SMALL", "image description") * @param url url of the image * @param widthPixels (optional) width of the image in pixels * @param heightPixels (optional) height of the image in pixels @@ -889,7 +877,7 @@ export namespace utils { * @param description text used to describe the image in a screen reader * @returns Image */ - function makeImage(url: string, widthPixels?: number, heightPixels?: number, size?: string, description?: string): Image; + function makeImage(url: string, widthPixels?: number, heightPixels?: number, size?: ImageSourceSize, description?: string): Image; /** * Creates an image object with a multiple sources, source images are provided as an array of image objects * These images may be in either JPEG or PNG formats, with the appropriate file extensions. @@ -901,16 +889,16 @@ export namespace utils { * which means that larger images will be downscaled for display on Echo Show if provided. * example : * let imgArr = [ - * { 'https://url/to/my/small.png', 300, 400, 'SMALL' }, - * { 'https://url/to/my/large.png', 900, 1200, 'LARGE' }, + * { "https://url/to/my/small.png", 300, 400, "SMALL" }, + * { "https://url/to/my/large.png", 900, 1200, "LARGE" }, * ] - * ImageUtils.makeImage(imgArr, 'image description') + * ImageUtils.makeImage(imgArr, "image description") * * @param imgArr Array of Image * @param description text used to describe the image in a screen reader * @returns Image */ - function makeImages(imgArr: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>, description: string): Image; + function makeImages(imgArr: Array<{ url: string, widthPixels: number, heightPixels: number, size: ImageSourceSize }>, description: string): Image; } /** * Utility methods for building TextField objects @@ -937,8 +925,8 @@ export namespace utils { * @param tertiaryText tertiary Text * @returns TextContent */ - function makeTextContent(primaryText: { type: string, text: string }, - secondaryText: { type: string, text: string }, tertiaryText: { type: string, text: string }): TextContent; + function makeTextContent(primaryText: { type: TextContentType, text: string }, + secondaryText: { type: TextContentType, text: string }, tertiaryText: { type: TextContentType, text: string }): TextContent; } } //#endregion From aa7f42d55d629b5ff14de02a4c2d61cb220e852c Mon Sep 17 00:00:00 2001 From: zwh8800 Date: Sat, 25 Nov 2017 22:43:01 +0800 Subject: [PATCH 128/269] rename ele to element --- types/puppeteer/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index b1f214aa7b..311d2c47b7 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -667,7 +667,7 @@ export interface FrameBase { */ $eval( selector: string, - fn: (ele: ElementHandle | null, ...args: any[]) => any, + fn: (element: ElementHandle | null, ...args: any[]) => any, ...args: any[] ): Promise; @@ -681,7 +681,7 @@ export interface FrameBase { */ $$eval( selector: string, - fn: (eles: ElementHandle[], ...args: any[]) => any, + fn: (elements: ElementHandle[], ...args: any[]) => any, ...args: any[] ): Promise; From b5bec704d9c2dcb0f513fbb23fac2423405aafc1 Mon Sep 17 00:00:00 2001 From: tai2 Date: Sun, 26 Nov 2017 00:29:21 +0900 Subject: [PATCH 129/269] [ignore-styles] new package --- types/ignore-styles/ignore-styles-tests.ts | 15 ++++++++++++++ types/ignore-styles/index.d.ts | 24 ++++++++++++++++++++++ types/ignore-styles/tsconfig.json | 23 +++++++++++++++++++++ types/ignore-styles/tslint.json | 1 + 4 files changed, 63 insertions(+) create mode 100644 types/ignore-styles/ignore-styles-tests.ts create mode 100644 types/ignore-styles/index.d.ts create mode 100644 types/ignore-styles/tsconfig.json create mode 100644 types/ignore-styles/tslint.json diff --git a/types/ignore-styles/ignore-styles-tests.ts b/types/ignore-styles/ignore-styles-tests.ts new file mode 100644 index 0000000000..1a7dbc74c1 --- /dev/null +++ b/types/ignore-styles/ignore-styles-tests.ts @@ -0,0 +1,15 @@ +import register, { DEFAULT_EXTENSIONS, oldHandlers, noOp, restore } from 'ignore-styles'; + +register(['.css'], (module, filename) => {}); // $ExpectType void +register(['.css']); // $ExpectType void +register(undefined, (module, filename) => {}); // $ExpectType void +register([1], (module, filename) => {}); // $ExpectError +register(['.css'], 1); // $ExpectError + +DEFAULT_EXTENSIONS[0]; // $ExpectType string + +oldHandlers['.css']; // $ExpectType Handler + +noOp(); // $ExpectType void + +restore(); // $ExpectType void diff --git a/types/ignore-styles/index.d.ts b/types/ignore-styles/index.d.ts new file mode 100644 index 0000000000..2eab90b591 --- /dev/null +++ b/types/ignore-styles/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for ignore-styles 5.0 +// Project: https://github.com/bkonkle/ignore-styles +// Definitions by: Taiju Muto +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// + +export type Handler = (m: NodeModule, filename: string) => any; + +export const DEFAULT_EXTENSIONS: string[]; + +export let oldHandlers: { + [ext: string]: Handler +}; + +export function noOp(): void; + +export function restore(): void; + +export default function register( + extensions?: string[], + handler?: Handler +): void; diff --git a/types/ignore-styles/tsconfig.json b/types/ignore-styles/tsconfig.json new file mode 100644 index 0000000000..aed3487cf4 --- /dev/null +++ b/types/ignore-styles/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ignore-styles-tests.ts" + ] +} diff --git a/types/ignore-styles/tslint.json b/types/ignore-styles/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ignore-styles/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From adf67a1d500d1b0f2a38b3bc2a855170358ffc0b Mon Sep 17 00:00:00 2001 From: martincostello Date: Sat, 25 Nov 2017 17:13:01 +0000 Subject: [PATCH 130/269] Updates for Apple Pay JS version 3 Update the type definitions for Apple Pay JS version 3. --- types/applepayjs/applepayjs-tests.ts | 122 ++++++++- types/applepayjs/index.d.ts | 361 ++++++++++++++++++++++++--- 2 files changed, 436 insertions(+), 47 deletions(-) diff --git a/types/applepayjs/applepayjs-tests.ts b/types/applepayjs/applepayjs-tests.ts index 505dbd2daf..de58dd30cd 100644 --- a/types/applepayjs/applepayjs-tests.ts +++ b/types/applepayjs/applepayjs-tests.ts @@ -20,6 +20,70 @@ describe("ApplePaySession", () => { break; } }); + it("the contact fields are defined", () => { + const contacts = [ + ApplePayJS.ApplePayContactField.email, + ApplePayJS.ApplePayContactField.name, + ApplePayJS.ApplePayContactField.phone, + ApplePayJS.ApplePayContactField.phoneticName, + ApplePayJS.ApplePayContactField.postalAddress + ]; + }); + it("the error codes are defined", () => { + const errorCodes = [ + ApplePayJS.ApplePayErrorCode.addressUnserviceable, + ApplePayJS.ApplePayErrorCode.billingContactInvalid, + ApplePayJS.ApplePayErrorCode.shippingContactInvalid, + ApplePayJS.ApplePayErrorCode.unknown + ]; + }); + it("the error contact fields are defined", () => { + const contacts = [ + ApplePayJS.ApplePayErrorContactField.addressLines, + ApplePayJS.ApplePayErrorContactField.administrativeArea, + ApplePayJS.ApplePayErrorContactField.country, + ApplePayJS.ApplePayErrorContactField.countryCode, + ApplePayJS.ApplePayErrorContactField.emailAddress, + ApplePayJS.ApplePayErrorContactField.locality, + ApplePayJS.ApplePayErrorContactField.name, + ApplePayJS.ApplePayErrorContactField.phoneNumber, + ApplePayJS.ApplePayErrorContactField.phoneticName, + ApplePayJS.ApplePayErrorContactField.postalAddress, + ApplePayJS.ApplePayErrorContactField.postalCode, + ApplePayJS.ApplePayErrorContactField.subAdministrativeArea, + ApplePayJS.ApplePayErrorContactField.subLocality + ]; + }); + it("the line item types are defined", () => { + const errorCodes = [ + ApplePayJS.ApplePayLineItemType.final, + ApplePayJS.ApplePayLineItemType.pending + ]; + }); + it("the merchant capabilities are defined", () => { + const errorCodes = [ + ApplePayJS.ApplePayMerchantCapability.supports3DS, + ApplePayJS.ApplePayMerchantCapability.supportsCredit, + ApplePayJS.ApplePayMerchantCapability.supportsDebit, + ApplePayJS.ApplePayMerchantCapability.supportsEMV + ]; + }); + it("the payment method types are defined", () => { + const errorCodes = [ + ApplePayJS.ApplePayPaymentMethodType.credit, + ApplePayJS.ApplePayPaymentMethodType.debit, + ApplePayJS.ApplePayPaymentMethodType.prepaid, + ApplePayJS.ApplePayPaymentMethodType.store + ]; + }); + it("the shipping types are defined", () => { + const errorCodes = [ + ApplePayJS.ApplePayShippingType.delivery, + ApplePayJS.ApplePayShippingType.servicePickup, + ApplePayJS.ApplePayShippingType.shipping, + ApplePayJS.ApplePayShippingType.storePickup + ]; + }); it("can create a new instance", () => { const version = 1; const paymentRequest = { @@ -57,7 +121,7 @@ describe("ApplePaySession", () => { }); }); it("can call instance methods", () => { - const version = 1; + const version = 3; const paymentRequest = { countryCode: "US", currencyCode: "USD", @@ -66,7 +130,9 @@ describe("ApplePaySession", () => { "visa" ], merchantCapabilities: [ - "supports3DS" + "supports3DS", + ApplePayJS.ApplePayMerchantCapability.supportsCredit, + ApplePayJS.ApplePayMerchantCapability.supportsDebit ], total: { label: "My Store", @@ -80,8 +146,22 @@ describe("ApplePaySession", () => { session.completeMerchantValidation({ foo: "bar" }); + session.completePayment(ApplePaySession.STATUS_SUCCESS); + const authorizationResult = { + status: ApplePaySession.STATUS_FAILURE, + errors: [ + { + code: ApplePayJS.ApplePayErrorCode.addressUnserviceable, + contactField: ApplePayJS.ApplePayErrorContactField.postalCode, + message: "The specified postal code cannot be delivered to." + } + ] + }; + + session.completePayment(authorizationResult); + const total = { label: "Subtotal", type: "final", @@ -97,11 +177,12 @@ describe("ApplePaySession", () => { { label: "Free Shipping", amount: "0.00", - type: "pending" + type: ApplePayJS.ApplePayLineItemType.final }, { label: "Estimated Tax", - amount: "3.06" + amount: "3.06", + type: ApplePayJS.ApplePayLineItemType.pending } ]; @@ -120,17 +201,35 @@ describe("ApplePaySession", () => { session.completePaymentMethodSelection(total, lineItems); + const paymentUpdate = { + newTotal: total + }; + + session.completePaymentMethodSelection(paymentUpdate); + session.completeShippingContactSelection( ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS, shippingMethods, total, lineItems); + const contactUpdate = { + newTotal: total + }; + + session.completeShippingContactSelection(contactUpdate); + session.completeShippingMethodSelection( ApplePaySession.STATUS_SUCCESS, total, lineItems); + const shippingUpdate = { + newTotal: total + }; + + session.completeShippingMethodSelection(shippingUpdate); + session.oncancel = (event: ApplePayJS.Event): void => { event.cancelBubble = true; }; @@ -175,7 +274,7 @@ describe("ApplePayPaymentRequest", () => { merchantCapabilities: [ "supports3DS", "supportsCredit", - "supportsDebit" + ApplePayJS.ApplePayMerchantCapability.supportsDebit ], supportedNetworks: [ "amex", @@ -197,11 +296,15 @@ describe("ApplePayPaymentRequest", () => { familyName: "Patel", givenName: "Ravi", phoneNumber: "(408) 555-5555", + phoneticFamilyName: "Patel", + phoneticGivenName: "Ravi", addressLines: [ "1 Infinite Loop" ], locality: "Cupertino", + subLocality: "", administrativeArea: "CA", + subAdministrativeArea: "", postalCode: "95014", country: "United States", countryCode: "US" @@ -226,14 +329,14 @@ describe("ApplePayPaymentRequest", () => { paymentRequest.requiredBillingContactFields = [ "postalAddress", - "name" + ApplePayJS.ApplePayContactField.name ]; paymentRequest.requiredShippingContactFields = [ "postalAddress", "name", "phone", - "email" + ApplePayJS.ApplePayContactField.name ]; paymentRequest.shippingContact = { @@ -241,11 +344,15 @@ describe("ApplePayPaymentRequest", () => { familyName: "Patel", givenName: "Ravi", phoneNumber: "(408) 555-5555", + phoneticFamilyName: "Patel", + phoneticGivenName: "Ravi", addressLines: [ "1 Infinite Loop" ], locality: "Cupertino", + subLocality: "", administrativeArea: "CA", + subAdministrativeArea: "", postalCode: "95014", country: "United States", countryCode: "US" @@ -265,5 +372,6 @@ describe("ApplePayPaymentRequest", () => { ]; paymentRequest.shippingType = "storePickup"; + paymentRequest.shippingType = ApplePayJS.ApplePayShippingType.delivery; }); }); diff --git a/types/applepayjs/index.d.ts b/types/applepayjs/index.d.ts index f705a4fad2..112fb569ba 100644 --- a/types/applepayjs/index.d.ts +++ b/types/applepayjs/index.d.ts @@ -4,23 +4,23 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** - * A session object for managing the payment process on the web. + * ApplePaySession is the entry point for Apple Pay on the web. */ declare class ApplePaySession extends EventTarget { /** - * Creates a new instance of the ApplePaySession class. - * @param version - The version of the ApplePay JS API you are using. - * @param paymentRequest - An ApplePayPaymentRequest object that contains the information that is displayed on the Apple Pay payment sheet. + * The entry point for Apple Pay on the web. + * @param version - The version number of the ApplePay JS API you are using. The current API version number is 3. + * @param paymentRequest - An ApplePayPaymentRequest object that contains the information to be displayed on the Apple Pay payment sheet. */ constructor(version: number, paymentRequest: ApplePayJS.ApplePayPaymentRequest); /** - * A callback function that is automatically called when the payment UI is dismissed with an error. + * A callback function that is automatically called when the payment UI is dismissed. */ oncancel: (event: ApplePayJS.Event) => void; /** - * A callback function that is automatically called when the user has authorized the Apple Pay payment, typically via TouchID. + * A callback function that is automatically called when the user has authorized the Apple Pay payment with Touch ID, Face ID, or passcode. */ onpaymentauthorized: (event: ApplePayJS.ApplePayPaymentAuthorizedEvent) => void; @@ -45,28 +45,28 @@ declare class ApplePaySession extends EventTarget { onvalidatemerchant: (event: ApplePayJS.ApplePayValidateMerchantEvent) => void; /** - * Indicates whether or not the device supports Apple Pay. + * Indicates whether the device supports Apple Pay. * @returns true if the device supports making payments with Apple Pay; otherwise, false. */ static canMakePayments(): boolean; /** - * Indicates whether or not the device supports Apple Pay and if the user has an active card in Wallet. - * @param merchantIdentifier - The merchant ID received when the merchant enrolled in Apple Pay. - * @returns true if the device supports Apple Pay and there is at least one active card in Wallet; otherwise, false. + * Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet. + * @param merchantIdentifier - The merchant ID created when the merchant enrolled in Apple Pay. + * @returns true if the device supports Apple Pay and there is at least one active card in Wallet that is qualified for payments on the web; otherwise, false. */ static canMakePaymentsWithActiveCard(merchantIdentifier: string): Promise; /** * Displays the Set up Apple Pay button. - * @param merchantIdentifier - The merchant ID received when the merchant enrolled in Apple Pay. + * @param merchantIdentifier - The merchant ID created when the merchant enrolled in Apple Pay. * @returns A boolean value indicating whether setup was successful. */ static openPaymentSetup(merchantIdentifier: string): Promise; /** - * Verifies if a web browser supports a given Apple Pay JS API version. - * @param version - A number representing the Apple Pay JS API version being checked. The initial version is 1. + * Verifies whether a web browser supports a given Apple Pay JS API version. + * @param version - A number representing the Apple Pay JS API version being checked. The initial version is 1. The latest version is 3. * @returns A boolean value indicating whether the web browser supports the given API version. Returns false if the web browser does not support the specified version. */ static supportsVersion(version: number): boolean; @@ -82,26 +82,38 @@ declare class ApplePaySession extends EventTarget { begin(): void; /** - * Call after the merchant has been validated. + * Completes the validation for a merchant session. * @param merchantSession - An opaque message session object. */ - completeMerchantValidation(merchantSession: any): void; + completeMerchantValidation(merchantSession: object): void; /** - * Call when a payment has been authorized. - * @param status - The status of the payment. + * Completes the payment authorization with a result for Apple Pay JS versions 1 and 2. + * @param status - The status of the payment, whether it succeeded or failed. */ completePayment(status: number): void; /** - * Call after a payment method has been selected. + * Completes the payment authorization with a result for Apple Pay JS version 3. + * @param result - The result of the payment authorization, including its status and list of errors. + */ + completePayment(result: ApplePayJS.ApplePayPaymentAuthorizationResult): void; + + /** + * Call after a payment method has been selected for Apple Pay JS versions 1 and 2. * @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase. * @param newLineItems - A sequence of ApplePayLineItem dictionaries. */ completePaymentMethodSelection(newTotal: ApplePayJS.ApplePayLineItem, newLineItems: ApplePayJS.ApplePayLineItem[]): void; /** - * Call after a shipping contact has been selected. + * Completes the selection of a payment method with an update for Apple Pay JS version 3. + * @param update - The updated payment method. + */ + completePaymentMethodSelection(update: ApplePayJS.ApplePayPaymentMethodUpdate): void; + + /** + * Completes the selection of a shipping contact with an update for Apple Pay JS versions 1 and 2. * @param status - The status of the shipping contact update. * @param newShippingMethods - A sequence of ApplePayShippingMethod dictionaries. * @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase. @@ -114,13 +126,25 @@ declare class ApplePaySession extends EventTarget { newLineItems: ApplePayJS.ApplePayLineItem[]): void; /** - * Call after the shipping method has been selected. + * Completes the selection of a shipping contact with an update for Apple Pay JS version 3. + * @param update - The updated shipping contact. + */ + completeShippingContactSelection(update: ApplePayJS.ApplePayShippingContactUpdate): void; + + /** + * Call after the shipping method has been selected for Apple Pay JS versions 1 and 2. * @param status - The status of the shipping method update. * @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase. * @param newLineItems - A sequence of ApplePayLineItem dictionaries. */ completeShippingMethodSelection(status: number, newTotal: ApplePayJS.ApplePayLineItem, newLineItems: ApplePayJS.ApplePayLineItem[]): void; + /** + * Completes the selection of a shipping method with an update for Apple Pay JS version 3. + * @param update - The updated shipping method. + */ + completeShippingMethodSelection(update: ApplePayJS.ApplePayShippingMethodUpdate): void + /** * The requested action succeeded. */ @@ -163,6 +187,79 @@ declare class ApplePaySession extends EventTarget { } declare namespace ApplePayJS { + + /** + * Field names used for requesting contact information in a payment request. + */ + enum ApplePayContactField { + email = 'email', + name = 'name', + phone = 'phone', + postalAddress = 'postalAddress', + phoneticName = 'phoneticName', + } + + /** + * A customizable error type that you create to indicate problems with the address or contact information on an Apple Pay sheet. + */ + interface ApplePayError { + /** + * The error code for this instance. + */ + code: ApplePayErrorCode; + + /** + * The name of the field that contains the error. + */ + contactField?: ApplePayErrorContactField; + + /** + * A localized, user-facing string that describes the error. + */ + message: string; + } + + /** + * The error code that indicates whether an error on the payment sheet is for shipping or billing information, or for another kind of error. + */ + enum ApplePayErrorCode { + /** + * Shipping address or contact information is invalid or missing. + */ + shippingContactInvalid = 'shippingContactInvalid', + /** + * Billing address information is invalid or missing. + */ + billingContactInvalid = 'billingContactInvalid', + /** + * The merchant cannot provide service to the shipping address (for example, can't deliver to a P.O. Box). + */ + addressUnserviceable = 'addressUnserviceable', + /** + * An unknown but nonfatal error occurred during payment processing. The user can attempt authorization again. + */ + unknown = 'unknown', + } + + /** + * Names of the fields in the shipping or billing contact information, used to locate errors in the payment sheet. + */ + enum ApplePayErrorContactField { + phoneNumber = 'phoneNumber', + emailAddress = 'emailAddress', + name = 'name', + phoneticName = 'phoneticName', + postalAddress = 'postalAddress', + addressLines = 'addressLines', + locality = 'locality', + subLocality = 'subLocality', + postalCode = 'postalCode', + administrativeArea = 'administrativeArea', + subAdministrativeArea = 'subAdministrativeArea', + country = 'country', + countryCode = 'countryCode', + } + /** * Defines a line item in a payment request - for example, total, tax, discount, or grand total. */ @@ -180,7 +277,47 @@ declare namespace ApplePayJS { /** * A value that indicates if the line item is final or pending. */ - type?: string; + type?: string | ApplePayLineItemType; + } + + /** + * A type that indicates whether a line item is final or pending. + */ + enum ApplePayLineItemType { + /** + * A line item representing the known, final cost. + */ + final = 'final', + + /** + * A line item representing an estimated or unknown cost. + */ + pending = 'pending', + } + + /** + * The payment capabilities supported by the merchant. + */ + enum ApplePayMerchantCapability { + /** + * Required. This value must be supplied. + */ + supports3DS = 'supports3DS', + + /** + * Include this value only if you support China Union Pay transactions. + */ + supportsEMV = 'supportsEMV', + + /** + * Optional. If present, only transactions that are categorized as credit cards are allowed. + */ + supportsCredit = 'supportsCredit', + + /** + * Optional. If present, only transactions that are categorized as debit cards are allowed. + */ + supportsDebit = 'supportsDebit', } /** @@ -188,7 +325,7 @@ declare namespace ApplePayJS { */ interface ApplePayPayment { /** - * The encrypted token for an authorized payment. + * The encrypted information for an authorized payment. */ token: ApplePayPaymentToken; @@ -208,11 +345,26 @@ declare namespace ApplePayJS { */ abstract class ApplePayPaymentAuthorizedEvent extends Event { /** - * The payment token used to authorize a payment. + * The authorized payment information for this transaction. */ readonly payment: ApplePayPayment; } + /** + * The result of payment authorization, including status and errors. + */ + interface ApplePayPaymentAuthorizationResult { + /** + * The status code for the authorization result. + */ + status: number; + + /** + * A list of custom errors to display on the payment sheet. + */ + errors?: ApplePayError[]; + } + /** * Encapsulates contact information needed for billing and shipping. */ @@ -238,7 +390,17 @@ declare namespace ApplePayJS { phoneNumber: string; /** - * The address for the contact. + * The phonetic spelling of the contact's family name. + */ + phoneticFamilyName: string; + + /** + * The phonetic spelling of the contact's given name. + */ + phoneticGivenName: string; + + /** + * The street portion of the address for the contact. */ addressLines: string[]; @@ -247,29 +409,39 @@ declare namespace ApplePayJS { */ locality: string; + /** + * Additional information associated with the location, typically defined at the city or town level (such as district or neighborhood), in a postal address. + */ + subLocality: string; + /** * The state for the contact. */ administrativeArea: string; /** - * The zip code, where applicable, for the contact. + * The subadministrative area (such as a county or other region) in a postal address. + */ + subAdministrativeArea: string; + + /** + * The zip code or postal code, where applicable, for the contact. */ postalCode: string; /** - * The colloquial country name for the contact. + * The name of the country for the contact. */ country: string; /** - * The contact's ISO country code. + * The contact’s two-letter ISO 3166 country code. */ countryCode: string; } /** - * Contains information about an Apple Pay payment card. + * A dictionary that describes an Apple Pay payment card. */ interface ApplePayPaymentMethod { /** @@ -279,21 +451,30 @@ declare namespace ApplePayJS { /** * A string, suitable for display, that is the name of the payment network backing the card. - * The value is one of the supported networks specified in the supportedNetworks property of the ApplePayPaymentRequest. */ network: string; /** * A value representing the card's type of payment. */ - type: string; + type: string | ApplePayPaymentMethodType; /** - * The payment pass object associated with the payment. + * The payment pass object currently selected to complete the payment. */ paymentPass: ApplePayPaymentPass; } + /** + * A payment card's type of payment. + */ + enum ApplePayPaymentMethodType { + debit = 'debit', + credit = 'credit', + prepaid = 'prepaid', + store = 'store' + } + /** * The ApplePayPaymentMethodSelectedEvent class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function. */ @@ -304,6 +485,21 @@ declare namespace ApplePayJS { readonly paymentMethod: ApplePayPaymentMethod; } + /** + * Updated transaction details resulting from a change in payment method. + */ + interface ApplePayPaymentMethodUpdate { + /** + * An optional list of line items. + */ + newLineItems?: ApplePayLineItem[]; + + /** + * The new total resulting from a change in the payment method. + */ + newTotal: ApplePayLineItem; + } + /** * Represents a provisioned payment card for Apple Pay payments. */ @@ -331,7 +527,37 @@ declare namespace ApplePayJS { /** * The activation state of the pass. */ - activationState: string; + activationState: string | ApplePayPaymentPassActivationState; + } + + /** + * Payment pass activation states. + */ + enum ApplePayPaymentPassActivationState { + /** + * Active and ready to be used for payment. + */ + activated = 'activated', + + /** + * Not active but may be activated by the issuer. + */ + requiresActivation = 'requiresActivation', + + /** + * Not ready for use but activation is in progress. + */ + activating = 'activating', + + /** + * Not active and can't be activated. + */ + suspended = 'suspended', + + /** + * Not active because the issuer has disabled the account associated with the device. + */ + deactivated = 'deactivated', } /** @@ -357,7 +583,7 @@ declare namespace ApplePayJS { * The payment capabilities supported by the merchant. * The value must at least contain ApplePayMerchantCapability.supports3DS. */ - merchantCapabilities: string[]; + merchantCapabilities: string[] | ApplePayMerchantCapability[]; /** * The payment networks supported by the merchant. @@ -377,12 +603,12 @@ declare namespace ApplePayJS { /** * The billing information that you require from the user in order to process the transaction. */ - requiredBillingContactFields?: string[]; + requiredBillingContactFields?: string[] | ApplePayContactField[]; /** * The shipping information that you require from the user in order to fulfill the order. */ - requiredShippingContactFields?: string[]; + requiredShippingContactFields?: string[] | ApplePayContactField[]; /** * Shipping contact information for the user. @@ -397,7 +623,12 @@ declare namespace ApplePayJS { /** * How the items are to be shipped. */ - shippingType?: string; + shippingType?: string | ApplePayShippingType; + + /** + * A list of ISO 3166 country codes for limiting payments to cards from specific countries. + */ + supportedCountries?: string[]; /** * Optional user-defined data. @@ -406,7 +637,7 @@ declare namespace ApplePayJS { } /** - * Contains the user's payment credentials. + * An object that contains the user's payment credentials. */ interface ApplePayPaymentToken { /** @@ -426,7 +657,7 @@ declare namespace ApplePayJS { } /** - * The ApplePayShippingContactSelectedEvent class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function. + * Encapsulates the attributes contained by the onshippingcontactselected callback function. */ abstract class ApplePayShippingContactSelectedEvent extends Event { /** @@ -435,6 +666,31 @@ declare namespace ApplePayJS { readonly shippingContact: ApplePayPaymentContact; } + /** + * Updated transaction details resulting from a change in shipping contact, including any errors. + */ + class ApplePayShippingContactUpdate { + /** + * List of custom errors to display on the payment sheet. + */ + errors?: ApplePayError[]; + + /** + * An optional list of updated line items. + */ + newLineItems?: ApplePayLineItem[]; + + /** + * A list of shipping methods that are available to the updated shipping contact. + */ + newShippingMethods?: ApplePayShippingMethod[]; + + /** + * The new total resulting from a change in the shipping contact. + */ + newTotal: ApplePayLineItem; + } + /** * Defines a shipping method for delivering physical goods. */ @@ -471,11 +727,36 @@ declare namespace ApplePayJS { } /** - * The ApplePayValidateMerchantEvent class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function. + * Updated transaction details resulting from a change in shipping method. + */ + interface ApplePayShippingMethodUpdate { + /** + * An optional list of updated line items. + */ + newLineItems?: ApplePayLineItem[]; + + /** + * The new total resulting from a change in the shipping method. + */ + newTotal: ApplePayLineItem; + } + + /** + * A type that indicates how purchased items are to be shipped. + */ + enum ApplePayShippingType { + shipping = 'shipping', + delivery = 'delivery', + storePickup = 'storePickup', + servicePickup = 'servicePickup', + } + + /** + * The attributes contained by the onvalidatemerchant callback function. */ abstract class ApplePayValidateMerchantEvent extends Event { /** - * The URL used to validate the merchant server. + * The URL your server must use to validate itself and obtain a merchant session object. */ readonly validationURL: string; } From c4de1120548f7b57c216a479cdfe5b4139aff24a Mon Sep 17 00:00:00 2001 From: martincostello Date: Sat, 25 Nov 2017 17:18:16 +0000 Subject: [PATCH 131/269] Update header Update the version to 3. Change author URL to my GitHub profile URL. --- types/applepayjs/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/applepayjs/index.d.ts b/types/applepayjs/index.d.ts index 112fb569ba..203d75d06c 100644 --- a/types/applepayjs/index.d.ts +++ b/types/applepayjs/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Apple Pay JS 1.0 +// Type definitions for Apple Pay JS 3.0 // Project: https://developer.apple.com/reference/applepayjs -// Definitions by: Martin Costello +// Definitions by: Martin Costello // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** From 0d5a690b400db139c05a90c17bc7ce506343710c Mon Sep 17 00:00:00 2001 From: martincostello Date: Sat, 25 Nov 2017 17:38:38 +0000 Subject: [PATCH 132/269] Fix variable names Fix copy-pasted variable names in tests. --- types/applepayjs/applepayjs-tests.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/applepayjs/applepayjs-tests.ts b/types/applepayjs/applepayjs-tests.ts index de58dd30cd..f2a6548128 100644 --- a/types/applepayjs/applepayjs-tests.ts +++ b/types/applepayjs/applepayjs-tests.ts @@ -21,7 +21,7 @@ describe("ApplePaySession", () => { } }); it("the contact fields are defined", () => { - const contacts = [ + const contactFields = [ ApplePayJS.ApplePayContactField.email, ApplePayJS.ApplePayContactField.name, ApplePayJS.ApplePayContactField.phone, @@ -38,7 +38,7 @@ describe("ApplePaySession", () => { ]; }); it("the error contact fields are defined", () => { - const contacts = [ + const errorContacts = [ ApplePayJS.ApplePayErrorContactField.addressLines, ApplePayJS.ApplePayErrorContactField.administrativeArea, ApplePayJS.ApplePayErrorContactField.country, @@ -55,13 +55,13 @@ describe("ApplePaySession", () => { ]; }); it("the line item types are defined", () => { - const errorCodes = [ + const lineItemTypes = [ ApplePayJS.ApplePayLineItemType.final, ApplePayJS.ApplePayLineItemType.pending ]; }); it("the merchant capabilities are defined", () => { - const errorCodes = [ + const capabilities = [ ApplePayJS.ApplePayMerchantCapability.supports3DS, ApplePayJS.ApplePayMerchantCapability.supportsCredit, ApplePayJS.ApplePayMerchantCapability.supportsDebit, @@ -69,7 +69,7 @@ describe("ApplePaySession", () => { ]; }); it("the payment method types are defined", () => { - const errorCodes = [ + const paymentMethods = [ ApplePayJS.ApplePayPaymentMethodType.credit, ApplePayJS.ApplePayPaymentMethodType.debit, ApplePayJS.ApplePayPaymentMethodType.prepaid, @@ -77,7 +77,7 @@ describe("ApplePaySession", () => { ]; }); it("the shipping types are defined", () => { - const errorCodes = [ + const shippingTypes = [ ApplePayJS.ApplePayShippingType.delivery, ApplePayJS.ApplePayShippingType.servicePickup, ApplePayJS.ApplePayShippingType.shipping, From 483c3f154bb4b65b254baccce694ad7280219069 Mon Sep 17 00:00:00 2001 From: Guangda Zhang Date: Sat, 25 Nov 2017 09:50:33 -0800 Subject: [PATCH 133/269] Add ajax and ajaxOptions to adapter --- types/ember-data/index.d.ts | 8 ++++++++ types/ember-data/test/adapter.ts | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index bf273f2f20..35a291634b 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -1032,6 +1032,14 @@ declare namespace DS { * should use the REST adapter. */ class RESTAdapter extends Adapter implements BuildURLMixin { + /** + * Takes a URL, an HTTP method and a hash of data, and makes an HTTP request. + */ + ajax(url: string, type: string, options: object): Promise; + /** + * Generate ajax options + */ + ajaxOptions(url: string, type: string, options: object): object; /** * By default, the RESTAdapter will send the query params sorted alphabetically to the * server. diff --git a/types/ember-data/test/adapter.ts b/types/ember-data/test/adapter.ts index d648f73310..b8d0bed62f 100644 --- a/types/ember-data/test/adapter.ts +++ b/types/ember-data/test/adapter.ts @@ -23,3 +23,24 @@ const AuthTokenHeader = DS.JSONAPIAdapter.extend({ }; }) }); + +const UseAjax = DS.JSONAPIAdapter.extend({ + query(store: DS.Store, type: string, query: object) { + const url = 'https://api.example.com/my-api'; + return this.ajax(url, 'POST', { + param: 'foo' + }); + } +}); + +const UseAjaxOptions = DS.JSONAPIAdapter.extend({ + query(store: DS.Store, type: string, query: object) { + const url = 'https://api.example.com/my-api'; + const options = this.ajaxOptions(url, 'DELETE', { + foo: 'bar' + }); + return Ember.$.ajax(url, { + ...options + }); + } +}); From 29ba5a506ac3582d12a9cc505450f6970214373c Mon Sep 17 00:00:00 2001 From: rk-7 <30998401+rk-7@users.noreply.github.com> Date: Sat, 25 Nov 2017 23:35:50 +0530 Subject: [PATCH 134/269] Fixed minor type annotion issues. --- types/alexa-sdk/index.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 33fdc6dd7b..02def0b4d6 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -294,9 +294,9 @@ export interface ListItemObject { */ status?: ListItemObjectStatus; /** - * item version (Positive integer | string) + * item version (Positive integer) */ - version?: any; + version?: number | string; /** * created time (ISO 8601 time format with time zone) */ @@ -335,9 +335,9 @@ export interface ListObject { */ status?: string; /** - * list version (long | string) + * list version (Positive integer) */ - version?: any; + version?: number; /** * Urls to active and completed items * href is lint to the items having certain status. @@ -468,7 +468,7 @@ export namespace templateBuilders { * @param image image * @returns BodyTemplate3Builder */ - setImage(image: any): BodyTemplate3Builder; + setImage(image: Image): BodyTemplate3Builder; /** * Sets the text content for the template @@ -490,7 +490,7 @@ export namespace templateBuilders { * @param image image * @returns BodyTemplate6Builder */ - setImage(image: any): BodyTemplate6Builder; + setImage(image: Image): BodyTemplate6Builder; /** * Sets the text content for the template @@ -828,7 +828,7 @@ export class ResponseBuilder { * @param hintType (optional) Default value : PlainText * @returns ResponseBuilder */ - hint(hintText: string, hintType: HintType): ResponseBuilder; + hint(hintText: string, hintType?: HintType): ResponseBuilder; /** * Creates a VideoApp play directive to play a video @@ -838,7 +838,7 @@ export class ResponseBuilder { * information that can be displayed on VideoApp. * @returns ResponseBuilder */ - playVideo(source: string, metadata: { title: string, subtitle: string }): ResponseBuilder; + playVideo(source: string, metadata?: { title: string, subtitle: string }): ResponseBuilder; } //#endregion @@ -898,7 +898,7 @@ export namespace utils { * @param description text used to describe the image in a screen reader * @returns Image */ - function makeImages(imgArr: Array<{ url: string, widthPixels: number, heightPixels: number, size: ImageSourceSize }>, description: string): Image; + function makeImages(imgArr: Array<{ url: string, widthPixels?: number, heightPixels?: number, size: ImageSourceSize }>, description: string): Image; } /** * Utility methods for building TextField objects From 3c79b74f9c37eda6e7ee63dbcd0dee9160cd33e2 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sat, 25 Nov 2017 19:00:51 +0000 Subject: [PATCH 135/269] Improve type definitions Change enums to types. Make the properties on the ApplePayPaymentContact interface optional to make it easier to provide minimal information to an ApplePayPaymentRequest. --- types/applepayjs/applepayjs-tests.ts | 96 +++-------------- types/applepayjs/index.d.ts | 151 +++++++++++++-------------- 2 files changed, 88 insertions(+), 159 deletions(-) diff --git a/types/applepayjs/applepayjs-tests.ts b/types/applepayjs/applepayjs-tests.ts index f2a6548128..99b323453b 100644 --- a/types/applepayjs/applepayjs-tests.ts +++ b/types/applepayjs/applepayjs-tests.ts @@ -20,73 +20,9 @@ describe("ApplePaySession", () => { break; } }); - it("the contact fields are defined", () => { - const contactFields = [ - ApplePayJS.ApplePayContactField.email, - ApplePayJS.ApplePayContactField.name, - ApplePayJS.ApplePayContactField.phone, - ApplePayJS.ApplePayContactField.phoneticName, - ApplePayJS.ApplePayContactField.postalAddress - ]; - }); - it("the error codes are defined", () => { - const errorCodes = [ - ApplePayJS.ApplePayErrorCode.addressUnserviceable, - ApplePayJS.ApplePayErrorCode.billingContactInvalid, - ApplePayJS.ApplePayErrorCode.shippingContactInvalid, - ApplePayJS.ApplePayErrorCode.unknown - ]; - }); - it("the error contact fields are defined", () => { - const errorContacts = [ - ApplePayJS.ApplePayErrorContactField.addressLines, - ApplePayJS.ApplePayErrorContactField.administrativeArea, - ApplePayJS.ApplePayErrorContactField.country, - ApplePayJS.ApplePayErrorContactField.countryCode, - ApplePayJS.ApplePayErrorContactField.emailAddress, - ApplePayJS.ApplePayErrorContactField.locality, - ApplePayJS.ApplePayErrorContactField.name, - ApplePayJS.ApplePayErrorContactField.phoneNumber, - ApplePayJS.ApplePayErrorContactField.phoneticName, - ApplePayJS.ApplePayErrorContactField.postalAddress, - ApplePayJS.ApplePayErrorContactField.postalCode, - ApplePayJS.ApplePayErrorContactField.subAdministrativeArea, - ApplePayJS.ApplePayErrorContactField.subLocality - ]; - }); - it("the line item types are defined", () => { - const lineItemTypes = [ - ApplePayJS.ApplePayLineItemType.final, - ApplePayJS.ApplePayLineItemType.pending - ]; - }); - it("the merchant capabilities are defined", () => { - const capabilities = [ - ApplePayJS.ApplePayMerchantCapability.supports3DS, - ApplePayJS.ApplePayMerchantCapability.supportsCredit, - ApplePayJS.ApplePayMerchantCapability.supportsDebit, - ApplePayJS.ApplePayMerchantCapability.supportsEMV - ]; - }); - it("the payment method types are defined", () => { - const paymentMethods = [ - ApplePayJS.ApplePayPaymentMethodType.credit, - ApplePayJS.ApplePayPaymentMethodType.debit, - ApplePayJS.ApplePayPaymentMethodType.prepaid, - ApplePayJS.ApplePayPaymentMethodType.store - ]; - }); - it("the shipping types are defined", () => { - const shippingTypes = [ - ApplePayJS.ApplePayShippingType.delivery, - ApplePayJS.ApplePayShippingType.servicePickup, - ApplePayJS.ApplePayShippingType.shipping, - ApplePayJS.ApplePayShippingType.storePickup - ]; - }); it("can create a new instance", () => { const version = 1; - const paymentRequest = { + const paymentRequest: ApplePayJS.ApplePayPaymentRequest = { countryCode: "US", currencyCode: "USD", supportedNetworks: [ @@ -122,7 +58,7 @@ describe("ApplePaySession", () => { }); it("can call instance methods", () => { const version = 3; - const paymentRequest = { + const paymentRequest: ApplePayJS.ApplePayPaymentRequest = { countryCode: "US", currencyCode: "USD", supportedNetworks: [ @@ -131,8 +67,8 @@ describe("ApplePaySession", () => { ], merchantCapabilities: [ "supports3DS", - ApplePayJS.ApplePayMerchantCapability.supportsCredit, - ApplePayJS.ApplePayMerchantCapability.supportsDebit + "supportsCredit", + "supportsDebit" ], total: { label: "My Store", @@ -149,12 +85,12 @@ describe("ApplePaySession", () => { session.completePayment(ApplePaySession.STATUS_SUCCESS); - const authorizationResult = { + const authorizationResult: ApplePayJS.ApplePayPaymentAuthorizationResult = { status: ApplePaySession.STATUS_FAILURE, errors: [ { - code: ApplePayJS.ApplePayErrorCode.addressUnserviceable, - contactField: ApplePayJS.ApplePayErrorContactField.postalCode, + code: "addressUnserviceable", + contactField: "postalCode", message: "The specified postal code cannot be delivered to." } ] @@ -162,13 +98,13 @@ describe("ApplePaySession", () => { session.completePayment(authorizationResult); - const total = { + const total: ApplePayJS.ApplePayLineItem = { label: "Subtotal", type: "final", amount: "35.00" }; - const lineItems = [ + const lineItems: ApplePayJS.ApplePayLineItem[] = [ { label: "Subtotal", type: "final", @@ -177,12 +113,12 @@ describe("ApplePaySession", () => { { label: "Free Shipping", amount: "0.00", - type: ApplePayJS.ApplePayLineItemType.final + type: "final" }, { label: "Estimated Tax", amount: "3.06", - type: ApplePayJS.ApplePayLineItemType.pending + type: "pending" } ]; @@ -274,7 +210,7 @@ describe("ApplePayPaymentRequest", () => { merchantCapabilities: [ "supports3DS", "supportsCredit", - ApplePayJS.ApplePayMerchantCapability.supportsDebit + "supportsDebit" ], supportedNetworks: [ "amex", @@ -296,8 +232,6 @@ describe("ApplePayPaymentRequest", () => { familyName: "Patel", givenName: "Ravi", phoneNumber: "(408) 555-5555", - phoneticFamilyName: "Patel", - phoneticGivenName: "Ravi", addressLines: [ "1 Infinite Loop" ], @@ -329,14 +263,14 @@ describe("ApplePayPaymentRequest", () => { paymentRequest.requiredBillingContactFields = [ "postalAddress", - ApplePayJS.ApplePayContactField.name + "name" ]; paymentRequest.requiredShippingContactFields = [ "postalAddress", "name", "phone", - ApplePayJS.ApplePayContactField.name + "name" ]; paymentRequest.shippingContact = { @@ -372,6 +306,6 @@ describe("ApplePayPaymentRequest", () => { ]; paymentRequest.shippingType = "storePickup"; - paymentRequest.shippingType = ApplePayJS.ApplePayShippingType.delivery; + paymentRequest.shippingType = "delivery"; }); }); diff --git a/types/applepayjs/index.d.ts b/types/applepayjs/index.d.ts index 203d75d06c..20b7dcf07d 100644 --- a/types/applepayjs/index.d.ts +++ b/types/applepayjs/index.d.ts @@ -191,13 +191,12 @@ declare namespace ApplePayJS { /** * Field names used for requesting contact information in a payment request. */ - enum ApplePayContactField { - email = 'email', - name = 'name', - phone = 'phone', - postalAddress = 'postalAddress', - phoneticName = 'phoneticName', - } + type ApplePayContactField = + 'email' | + 'name' | + 'phone' | + 'postalAddress' | + 'phoneticName'; /** * A customizable error type that you create to indicate problems with the address or contact information on an Apple Pay sheet. @@ -222,43 +221,44 @@ declare namespace ApplePayJS { /** * The error code that indicates whether an error on the payment sheet is for shipping or billing information, or for another kind of error. */ - enum ApplePayErrorCode { + type ApplePayErrorCode = /** * Shipping address or contact information is invalid or missing. */ - shippingContactInvalid = 'shippingContactInvalid', + 'shippingContactInvalid' | + /** * Billing address information is invalid or missing. */ - billingContactInvalid = 'billingContactInvalid', + 'billingContactInvalid' | + /** * The merchant cannot provide service to the shipping address (for example, can't deliver to a P.O. Box). */ - addressUnserviceable = 'addressUnserviceable', + 'addressUnserviceable' | + /** * An unknown but nonfatal error occurred during payment processing. The user can attempt authorization again. */ - unknown = 'unknown', - } + 'unknown'; /** * Names of the fields in the shipping or billing contact information, used to locate errors in the payment sheet. */ - enum ApplePayErrorContactField { - phoneNumber = 'phoneNumber', - emailAddress = 'emailAddress', - name = 'name', - phoneticName = 'phoneticName', - postalAddress = 'postalAddress', - addressLines = 'addressLines', - locality = 'locality', - subLocality = 'subLocality', - postalCode = 'postalCode', - administrativeArea = 'administrativeArea', - subAdministrativeArea = 'subAdministrativeArea', - country = 'country', - countryCode = 'countryCode', - } + type ApplePayErrorContactField = + 'phoneNumber' | + 'emailAddress' | + 'name' | + 'phoneticName' | + 'postalAddress' | + 'addressLines' | + 'locality' | + 'subLocality' | + 'postalCode' | + 'administrativeArea' | + 'subAdministrativeArea' | + 'country' | + 'countryCode'; /** * Defines a line item in a payment request - for example, total, tax, discount, or grand total. @@ -277,48 +277,46 @@ declare namespace ApplePayJS { /** * A value that indicates if the line item is final or pending. */ - type?: string | ApplePayLineItemType; + type?: ApplePayLineItemType; } /** * A type that indicates whether a line item is final or pending. */ - enum ApplePayLineItemType { + type ApplePayLineItemType = /** * A line item representing the known, final cost. */ - final = 'final', + 'final' | /** * A line item representing an estimated or unknown cost. */ - pending = 'pending', - } + 'pending'; /** * The payment capabilities supported by the merchant. */ - enum ApplePayMerchantCapability { + type ApplePayMerchantCapability = /** * Required. This value must be supplied. */ - supports3DS = 'supports3DS', + 'supports3DS' | /** * Include this value only if you support China Union Pay transactions. */ - supportsEMV = 'supportsEMV', + 'supportsEMV' | /** * Optional. If present, only transactions that are categorized as credit cards are allowed. */ - supportsCredit = 'supportsCredit', + 'supportsCredit' | /** * Optional. If present, only transactions that are categorized as debit cards are allowed. */ - supportsDebit = 'supportsDebit', - } + 'supportsDebit'; /** * Represents the result of authorizing a payment request and contains encrypted payment information. @@ -372,72 +370,72 @@ declare namespace ApplePayJS { /** * An email address for the contact. */ - emailAddress: string; + emailAddress?: string; /** * The contact's family name. */ - familyName: string; + familyName?: string; /** * The contact's given name. */ - givenName: string; + givenName?: string; /** * A phone number for the contact. */ - phoneNumber: string; + phoneNumber?: string; /** * The phonetic spelling of the contact's family name. */ - phoneticFamilyName: string; + phoneticFamilyName?: string; /** * The phonetic spelling of the contact's given name. */ - phoneticGivenName: string; + phoneticGivenName?: string; /** * The street portion of the address for the contact. */ - addressLines: string[]; + addressLines?: string[]; /** * The city for the contact. */ - locality: string; + locality?: string; /** * Additional information associated with the location, typically defined at the city or town level (such as district or neighborhood), in a postal address. */ - subLocality: string; + subLocality?: string; /** * The state for the contact. */ - administrativeArea: string; + administrativeArea?: string; /** * The subadministrative area (such as a county or other region) in a postal address. */ - subAdministrativeArea: string; + subAdministrativeArea?: string; /** * The zip code or postal code, where applicable, for the contact. */ - postalCode: string; + postalCode?: string; /** * The name of the country for the contact. */ - country: string; + country?: string; /** * The contact’s two-letter ISO 3166 country code. */ - countryCode: string; + countryCode?: string; } /** @@ -457,7 +455,7 @@ declare namespace ApplePayJS { /** * A value representing the card's type of payment. */ - type: string | ApplePayPaymentMethodType; + type: ApplePayPaymentMethodType; /** * The payment pass object currently selected to complete the payment. @@ -468,12 +466,11 @@ declare namespace ApplePayJS { /** * A payment card's type of payment. */ - enum ApplePayPaymentMethodType { - debit = 'debit', - credit = 'credit', - prepaid = 'prepaid', - store = 'store' - } + type ApplePayPaymentMethodType = + 'debit' | + 'credit' | + 'prepaid' | + 'store'; /** * The ApplePayPaymentMethodSelectedEvent class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function. @@ -527,38 +524,37 @@ declare namespace ApplePayJS { /** * The activation state of the pass. */ - activationState: string | ApplePayPaymentPassActivationState; + activationState: ApplePayPaymentPassActivationState; } /** * Payment pass activation states. */ - enum ApplePayPaymentPassActivationState { + type ApplePayPaymentPassActivationState = /** * Active and ready to be used for payment. */ - activated = 'activated', + 'activated' | /** * Not active but may be activated by the issuer. */ - requiresActivation = 'requiresActivation', + 'requiresActivation' | /** * Not ready for use but activation is in progress. */ - activating = 'activating', + 'activating' | /** * Not active and can't be activated. */ - suspended = 'suspended', + 'suspended' | /** * Not active because the issuer has disabled the account associated with the device. */ - deactivated = 'deactivated', - } + 'deactivated'; /** * Encapsulates a request for payment, including information about payment processing capabilities, the payment amount, and shipping information. @@ -583,7 +579,7 @@ declare namespace ApplePayJS { * The payment capabilities supported by the merchant. * The value must at least contain ApplePayMerchantCapability.supports3DS. */ - merchantCapabilities: string[] | ApplePayMerchantCapability[]; + merchantCapabilities: ApplePayMerchantCapability[]; /** * The payment networks supported by the merchant. @@ -603,12 +599,12 @@ declare namespace ApplePayJS { /** * The billing information that you require from the user in order to process the transaction. */ - requiredBillingContactFields?: string[] | ApplePayContactField[]; + requiredBillingContactFields?: ApplePayContactField[]; /** * The shipping information that you require from the user in order to fulfill the order. */ - requiredShippingContactFields?: string[] | ApplePayContactField[]; + requiredShippingContactFields?: ApplePayContactField[]; /** * Shipping contact information for the user. @@ -623,7 +619,7 @@ declare namespace ApplePayJS { /** * How the items are to be shipped. */ - shippingType?: string | ApplePayShippingType; + shippingType?: ApplePayShippingType; /** * A list of ISO 3166 country codes for limiting payments to cards from specific countries. @@ -744,12 +740,11 @@ declare namespace ApplePayJS { /** * A type that indicates how purchased items are to be shipped. */ - enum ApplePayShippingType { - shipping = 'shipping', - delivery = 'delivery', - storePickup = 'storePickup', - servicePickup = 'servicePickup', - } + type ApplePayShippingType = + 'shipping' | + 'delivery' | + 'storePickup' | + 'servicePickup'; /** * The attributes contained by the onvalidatemerchant callback function. From d72fc5bf61228bacbc1bc574005d8b62aaae902b Mon Sep 17 00:00:00 2001 From: amzac Date: Sat, 25 Nov 2017 20:23:25 +0100 Subject: [PATCH 136/269] Fix Nightwatch getTitle type + this contexts --- types/nightwatch/index.d.ts | 24 ++++++++++++------------ types/nightwatch/nightwatch-tests.ts | 3 +++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/types/nightwatch/index.d.ts b/types/nightwatch/index.d.ts index 3a7e81d0fa..1607a8a2f4 100644 --- a/types/nightwatch/index.d.ts +++ b/types/nightwatch/index.d.ts @@ -887,7 +887,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The value of the attribute */ - getAttribute(selector: string, attribute: string, callback?: (result: NightwatchCallbackResult) => void): this; + getAttribute(selector: string, attribute: string, callback?: (this:NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Retrieve a single cookie visible to the current page. The cookie is returned as a cookie JSON object, as defined here. @@ -906,7 +906,7 @@ export interface NightwatchAPI { * @param callback: The callback function which will receive the response as an argument. * @returns The cookie object as a selenium cookie JSON object or null if the cookie wasn't found. */ - getCookie(name: string, callback?: (result: NightwatchCallbackResult) => void): this; + getCookie(name: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Retrieve all cookies visible to the current page. The cookies are returned as an array of cookie JSON object, @@ -924,7 +924,7 @@ export interface NightwatchAPI { * @param callback: The callback function which will receive the response as an argument. * @returns A list of cookies */ - getCookies(callback?: (result: NightwatchCallbackResult) => void): this; + getCookies(callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Retrieve the value of a css property for a given DOM element. Uses elementIdCssProperty protocol command. @@ -944,7 +944,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The value of the css property */ - getCssProperty(selector: string, cssProperty: string, callback?: (result: NightwatchCallbackResult) => void): this; + getCssProperty(selector: string, cssProperty: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Determine an element's size in pixels. Uses elementIdSize protocol command. @@ -964,7 +964,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The width and height of the element in pixels */ - getElementSize(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getElementSize(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Determine an element's location on the page. The point (0, 0) refers to the upper-left corner of the page. @@ -985,7 +985,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The X and Y coordinates for the element on the page */ - getLocation(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getLocation(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Determine an element's location on the screen once it has been scrolled into view. Uses elementIdLocationInView protocol command. @@ -1005,7 +1005,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The X and Y coordinates for the element on the page. */ - getLocationInView(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getLocationInView(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Gets a log from selenium @@ -1059,7 +1059,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The element's tag name, as a lowercase string. */ - getTagName(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getTagName(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Returns the visible text for the element. Uses elementIdText protocol command. @@ -1078,7 +1078,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The element's visible text. */ - getText(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getText(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Returns the title of the current page. Uses title protocol command. @@ -1095,7 +1095,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The page title. */ - getTitle(callback?: (result: NightwatchCallbackResult) => void): this; + getTitle(callback?: (this: NightwatchAPI, result?: string) => void): this; /** * Returns a form element current value. Uses elementIdValue protocol command. @@ -1114,7 +1114,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The element's value. */ - getValue(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + getValue(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * This command is an alias to url and also a convenience method when called without any arguments in the sense that it performs a call to .url() with passing the value of launch_url @@ -1180,7 +1180,7 @@ export interface NightwatchAPI { * @param selector: The CSS/Xpath selector used to locate the element. * @param callback: Optional callback function to be called when the command finishes. */ - isVisible(selector: string, callback?: (result: NightwatchCallbackResult) => void): this; + isVisible(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Maximizes the current window. diff --git a/types/nightwatch/nightwatch-tests.ts b/types/nightwatch/nightwatch-tests.ts index a40c8c466a..3b0f1bf187 100644 --- a/types/nightwatch/nightwatch-tests.ts +++ b/types/nightwatch/nightwatch-tests.ts @@ -7,6 +7,9 @@ const test: NightwatchTests = { .waitForElementVisible('body', 1000) .setValue('input[type=text]', 'nightwatch') .waitForElementVisible('button[name=btnG]', 1000) + .getTitle(function(result){ + this.assert.equal(typeof result, 'string'); + }) .click('button[name=btnG]') .pause(1000) .assert.containsText('#main', 'Night Watch') From 6c34866d89a98441740c7f7373c3004c2e32944f Mon Sep 17 00:00:00 2001 From: martincostello Date: Sat, 25 Nov 2017 19:43:10 +0000 Subject: [PATCH 137/269] Fix tslint errors Fix tslint errors. --- types/applepayjs/index.d.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/types/applepayjs/index.d.ts b/types/applepayjs/index.d.ts index 20b7dcf07d..39d4463daf 100644 --- a/types/applepayjs/index.d.ts +++ b/types/applepayjs/index.d.ts @@ -85,19 +85,13 @@ declare class ApplePaySession extends EventTarget { * Completes the validation for a merchant session. * @param merchantSession - An opaque message session object. */ - completeMerchantValidation(merchantSession: object): void; + completeMerchantValidation(merchantSession: any): void; /** - * Completes the payment authorization with a result for Apple Pay JS versions 1 and 2. - * @param status - The status of the payment, whether it succeeded or failed. + * Completes the payment authorization with a result. + * @param result - The status of the payment, whether it succeeded or failed for Apple Pay JS versions 1 and 2, or the result of the payment authorization, including its status and list of errors for Apple Pay JS version 3. */ - completePayment(status: number): void; - - /** - * Completes the payment authorization with a result for Apple Pay JS version 3. - * @param result - The result of the payment authorization, including its status and list of errors. - */ - completePayment(result: ApplePayJS.ApplePayPaymentAuthorizationResult): void; + completePayment(result: number | ApplePayJS.ApplePayPaymentAuthorizationResult): void; /** * Call after a payment method has been selected for Apple Pay JS versions 1 and 2. @@ -143,7 +137,7 @@ declare class ApplePaySession extends EventTarget { * Completes the selection of a shipping method with an update for Apple Pay JS version 3. * @param update - The updated shipping method. */ - completeShippingMethodSelection(update: ApplePayJS.ApplePayShippingMethodUpdate): void + completeShippingMethodSelection(update: ApplePayJS.ApplePayShippingMethodUpdate): void; /** * The requested action succeeded. @@ -187,7 +181,6 @@ declare class ApplePaySession extends EventTarget { } declare namespace ApplePayJS { - /** * Field names used for requesting contact information in a payment request. */ From e0623b5cf3432f627c8826a657bf36cd1af1771b Mon Sep 17 00:00:00 2001 From: martincostello Date: Sat, 25 Nov 2017 19:47:36 +0000 Subject: [PATCH 138/269] Fix comment line that is too long Fix a line of comment that is too long. --- types/applepayjs/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/applepayjs/index.d.ts b/types/applepayjs/index.d.ts index 39d4463daf..a37f60b6fd 100644 --- a/types/applepayjs/index.d.ts +++ b/types/applepayjs/index.d.ts @@ -89,7 +89,8 @@ declare class ApplePaySession extends EventTarget { /** * Completes the payment authorization with a result. - * @param result - The status of the payment, whether it succeeded or failed for Apple Pay JS versions 1 and 2, or the result of the payment authorization, including its status and list of errors for Apple Pay JS version 3. + * @param result - The status of the payment, whether it succeeded or failed for Apple Pay JS versions 1 and 2, + * or the result of the payment authorization, including its status and list of errors for Apple Pay JS version 3. */ completePayment(result: number | ApplePayJS.ApplePayPaymentAuthorizationResult): void; From af47b2bfc58bc86044fe1562b573e1f3927587ea Mon Sep 17 00:00:00 2001 From: amzac Date: Sat, 25 Nov 2017 21:00:13 +0100 Subject: [PATCH 139/269] Fix tslint... --- types/nightwatch/index.d.ts | 7 +--- types/nightwatch/tslint.json | 76 +++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 8 deletions(-) diff --git a/types/nightwatch/index.d.ts b/types/nightwatch/index.d.ts index 1607a8a2f4..cd2ec9e912 100644 --- a/types/nightwatch/index.d.ts +++ b/types/nightwatch/index.d.ts @@ -4,7 +4,6 @@ // Connor Schlesiger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/* tslint:disable:max-line-length */ export interface NightwatchCustomPageObjects { page: {}; @@ -633,7 +632,6 @@ export interface NightwatchTypedCallbackResult { state: Error | string; } -// tslint:disable-next-line:no-empty-interface export interface NightwatchCallbackResult extends NightwatchTypedCallbackResult { } @@ -1305,7 +1303,7 @@ export interface NightwatchAPI { * callback providing a done callback function for completion as the first argument. Two parameters: allows for asynchronous execution * with the "api" object passed in as the first argument, followed by the done callback. */ - perform(callback: (done?: () => void) => void): this; // tslint:disable-line:unified-signatures + perform(callback: (done?: () => void) => void): this; /** * Resizes the current window. @@ -2144,10 +2142,8 @@ export interface NightwatchAPI { launch_url: string; } -/* tslint:disable-next-line:no-empty-interface */ export interface NightwatchCustomCommands {} -/* tslint:disable-next-line:no-empty-interface */ export interface NightwatchCustomAssertions {} export interface NightwatchBrowser extends NightwatchAPI, NightwatchCustomCommands, NightwatchCustomAssertions, NightwatchCustomPageObjects { } @@ -2200,4 +2196,3 @@ export interface Nightwatch { client: NightwatchClient; } -/* tslint:enable:max-line-length */ diff --git a/types/nightwatch/tslint.json b/types/nightwatch/tslint.json index b1439230db..a41bf5d19a 100644 --- a/types/nightwatch/tslint.json +++ b/types/nightwatch/tslint.json @@ -1,7 +1,79 @@ { "extends": "dtslint/dt.json", "rules": { - // TODO - "no-any-union": false + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false } } From 77a37a7faba9b7598d07313a590bfc617b195764 Mon Sep 17 00:00:00 2001 From: Karlis Gangis Date: Sat, 25 Nov 2017 22:07:37 +0200 Subject: [PATCH 140/269] react-redux: fix Options generic type arguments in connect() --- types/react-redux/index.d.ts | 10 +++++----- types/react-redux/react-redux-tests.tsx | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 8e2556ec6c..2a015389da 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -120,28 +120,28 @@ export interface Connect { mapStateToProps: MapStateToPropsParam, mapDispatchToProps: null | undefined, mergeProps: null | undefined, - options: Options + options: Options ): InferableComponentEnhancerWithProps & TStateProps, TOwnProps>; - ( + ( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: null | undefined, - options: Options + options: Options<{}, TStateProps, TOwnProps> ): InferableComponentEnhancerWithProps; ( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: null | undefined, - options: Options + options: Options ): InferableComponentEnhancerWithProps; ( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: MergeProps, - options: Options + options: Options ): InferableComponentEnhancerWithProps; } diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index af77473473..393c4d09da 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -247,22 +247,26 @@ namespace MapStateAndDispatchAndMerge { } namespace MapStateAndOptions { + interface State { state: string; } interface OwnProps { foo: string } interface StateProps { bar: number } interface DispatchProps { dispatch: Dispatch } class TestComponent extends Component {} - const mapStateToProps = () => ({ + const mapStateToProps = (state: State) => ({ bar: 1 }) - const Test = connect( + const areStatePropsEqual = (next: StateProps, current: StateProps) => true; + + const Test = connect( mapStateToProps, null, null, { - pure: true + pure: true, + areStatePropsEqual, } )(TestComponent) From a0c5e8a72c253cfb51790a2f7388a7558b07d6bd Mon Sep 17 00:00:00 2001 From: amzac Date: Sat, 25 Nov 2017 21:47:40 +0100 Subject: [PATCH 141/269] Fix lint review --- types/nightwatch/index.d.ts | 37 +++++++++----- types/nightwatch/nightwatch-tests.ts | 2 +- types/nightwatch/tslint.json | 74 ---------------------------- 3 files changed, 25 insertions(+), 88 deletions(-) diff --git a/types/nightwatch/index.d.ts b/types/nightwatch/index.d.ts index cd2ec9e912..a32a07b3dd 100644 --- a/types/nightwatch/index.d.ts +++ b/types/nightwatch/index.d.ts @@ -4,7 +4,6 @@ // Connor Schlesiger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - export interface NightwatchCustomPageObjects { page: {}; } @@ -632,6 +631,7 @@ export interface NightwatchTypedCallbackResult { state: Error | string; } +// tslint:disable-next-line:no-empty-interface export interface NightwatchCallbackResult extends NightwatchTypedCallbackResult { } @@ -885,7 +885,7 @@ export interface NightwatchAPI { * @param callback: Optional callback function to be called when the command finishes. * @returns The value of the attribute */ - getAttribute(selector: string, attribute: string, callback?: (this:NightwatchAPI, result: NightwatchCallbackResult) => void): this; + getAttribute(selector: string, attribute: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; /** * Retrieve a single cookie visible to the current page. The cookie is returned as a cookie JSON object, as defined here. @@ -1303,7 +1303,7 @@ export interface NightwatchAPI { * callback providing a done callback function for completion as the first argument. Two parameters: allows for asynchronous execution * with the "api" object passed in as the first argument, followed by the done callback. */ - perform(callback: (done?: () => void) => void): this; + perform(callback: (done?: () => void) => void): this; // tslint:disable-line:unified-signatures /** * Resizes the current window. @@ -1557,7 +1557,9 @@ export interface NightwatchAPI { * ``` * @param selector: The selector (CSS / Xpath) used to locate the element. * @param time: The number of milliseconds to wait. The runner performs repeated checks every 500 ms. - * @param abortOnFailure: By the default if the element is not found the test will fail. Set this to false if you wish for the test to continue even if the assertion fails. To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. + * @param abortOnFailure: By the default if the element is not found the test will fail. + * Set this to false if you wish for the test to continue even if the assertion fails. + * To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. * @param callback: Optional callback function to be called when the command finishes. * @param message: Optional message to be shown in the output; the message supports two placeholders: %s for current selector and %d for the time (e.g. Element %s was not in the page for %d ms). */ @@ -1845,7 +1847,8 @@ export interface NightwatchAPI { /** * Send a sequence of key strokes to the active element. The sequence is defined in the same format as the sendKeys command. * An object map with available keys and their respective UTF-8 characters, as defined on W3C WebDriver draft spec, is loaded onto the main Nightwatch instance as client.Keys. - * Rather than the setValue, the modifiers are not released at the end of the call. The state of the modifier keys is kept between calls, so mouse interactions can be performed while modifier keys are depressed. + * Rather than the setValue, the modifiers are not released at the end of the call. + * The state of the modifier keys is kept between calls, so mouse interactions can be performed while modifier keys are depressed. * @param keysToSend: The keys sequence to be sent. * @param callback: Optional callback function to be called when the command finishes. */ @@ -1860,8 +1863,10 @@ export interface NightwatchAPI { mouseButtonClick(button: string, callback?: () => void): this; /** - * Click and hold the left mouse button (at the coordinates set by the last moveto command). Note that the next mouse-related command that should follow is mouseButtonUp . Any other mouse command (such as click or another call to buttondown) will yield undefined behaviour. - * Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right'). It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly. + * Click and hold the left mouse button (at the coordinates set by the last moveto command). Note that the next mouse-related command that should follow is mouseButtonUp . + * Any other mouse command (such as click or another call to buttondown) will yield undefined behaviour. + * Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right'). + * It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly. * @param button: The mouse button * @param callback: Optional callback function to be called when the command finishes. */ @@ -1869,14 +1874,16 @@ export interface NightwatchAPI { /** * Releases the mouse button previously held (where the mouse is currently at). Must be called once for every mouseButtonDown command issued. - * Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right'). It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly. + * Can be used for implementing drag-and-drop. The button can be (0, 1, 2) or ('left', 'middle', 'right'). + * It defaults to left mouse button, and if you don't pass in a button but do pass in a callback, it will handle it correctly. * @param button: The mouse button * @param callback: Optional callback function to be called when the command finishes. */ mouseButtonUp(button: string, callback?: () => void): this; /** - * Move the mouse by an offset of the specificed element. If no element is specified, the move is relative to the current mouse cursor. If an element is provided but no offset, the mouse will be moved to the center of the element. + * Move the mouse by an offset of the specificed element. If no element is specified, the move is relative to the current mouse cursor. + * If an element is provided but no offset, the mouse will be moved to the center of the element. * If the element is not visible, it will be scrolled into view. * @param element: Opaque ID assigned to the element to move to. If not specified or is null, the offset is relative to current position of the mouse. * @param xofset: X offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element. @@ -1995,14 +2002,16 @@ export interface NightwatchAPI { /** * Configure the amount of time that a particular type of operation can execute for before they are aborted and a |Timeout| error is returned to the client. - * @param typeOfOperation: The type of operation to set the timeout for. Valid values are: "script" for script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting a page load timeout. + * @param typeOfOperation: The type of operation to set the timeout for. + * Valid values are: "script" for script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting a page load timeout. * @param ms: The amount of time, in milliseconds, that time-limited commands are permitted to run. * @param callback: Optional callback function to be called when the command finishes. */ timeouts(typeOfOperation: string, ms: number, callback?: () => void): this; /** - * Set the amount of time, in milliseconds, that asynchronous scripts executed by /session/:sessionId/execute_async are permitted to run before they are aborted and a |Timeout| error is returned to the client. + * Set the amount of time, in milliseconds, that asynchronous scripts executed by /session/:sessionId/execute_async are permitted + * to run before they are aborted and a |Timeout| error is returned to the client. * @param ms: The amount of time, in milliseconds, that time-limited commands are permitted to run. * @param callback: Optional callback function to be called when the command finishes. */ @@ -2085,7 +2094,8 @@ export interface NightwatchAPI { windowMaximize(handleOrName?: string, callback?: () => void): this; /** - * Change or get the position of the specified window. If the second argument is a function it will be used as a callback and the call will perform a get request to retrieve the existing window position. + * Change or get the position of the specified window. If the second argument is a function it will be used as a callback and the call + * will perform a get request to retrieve the existing window position. * @param windowHandle: * @param: offsetX: * @param: offsetY: @@ -2142,8 +2152,10 @@ export interface NightwatchAPI { launch_url: string; } +/* tslint:disable-next-line:no-empty-interface */ export interface NightwatchCustomCommands {} +/* tslint:disable-next-line:no-empty-interface */ export interface NightwatchCustomAssertions {} export interface NightwatchBrowser extends NightwatchAPI, NightwatchCustomCommands, NightwatchCustomAssertions, NightwatchCustomPageObjects { } @@ -2195,4 +2207,3 @@ export interface Nightwatch { api: NightwatchAPI; client: NightwatchClient; } - diff --git a/types/nightwatch/nightwatch-tests.ts b/types/nightwatch/nightwatch-tests.ts index 3b0f1bf187..548dcee9bd 100644 --- a/types/nightwatch/nightwatch-tests.ts +++ b/types/nightwatch/nightwatch-tests.ts @@ -7,7 +7,7 @@ const test: NightwatchTests = { .waitForElementVisible('body', 1000) .setValue('input[type=text]', 'nightwatch') .waitForElementVisible('button[name=btnG]', 1000) - .getTitle(function(result){ + .getTitle(function(result) { this.assert.equal(typeof result, 'string'); }) .click('button[name=btnG]') diff --git a/types/nightwatch/tslint.json b/types/nightwatch/tslint.json index a41bf5d19a..495d29983d 100644 --- a/types/nightwatch/tslint.json +++ b/types/nightwatch/tslint.json @@ -1,79 +1,5 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false } } From a8967e924799d1171053e63e7eac71db81db7adb Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Sat, 25 Nov 2017 16:00:07 -0500 Subject: [PATCH 142/269] Fixed @link references Fixed @link references --- types/xrm/index.d.ts | 522 ++++++++++++++++++++++--------------------- 1 file changed, 273 insertions(+), 249 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index c94bc245fc..ab9adfd1fa 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -82,20 +82,19 @@ declare namespace Xrm { /** * Provides methods to encode strings. - * * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-encoding External Link: Xrm.Encoding (Client API reference)} */ Encoding: Encoding; } /** - * Client Types for {@link GlobalContext.getClient globalContext.getClient()}. + * Client Types for {@link ClientContext.getClient clientContext.getClient()}. * @see {@link XrmEnum.Client} */ type Client = "Web" | "Outlook" | "Mobile" | "UnifiedServiceDesk"; /** - * Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. + * Client States for {@link ClientContext.getClientState clientContext.getClientState()}. * @see {@link XrmEnum.ClientState} */ type ClientState = "Online" | "Offline"; @@ -128,7 +127,7 @@ declare namespace Xrm { /** * Themes for {@link GlobalContext.getCurrentTheme globalContext.getCurrentTheme()}. - * Note: getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. + * @remarks getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. * @see {@link XrmEnum.Theme} */ type Theme = "default" | "Office12Blue" | "Office14Silver"; @@ -338,12 +337,11 @@ declare namespace Xrm { /** * Gets client's base URL for Dynamics CRM - * * @returns The client's base URL - * - * @example For Dynamics CRM On-Premises: http(s)://server/org - * For Dynamics CRM Online: https://org.crm.dynamics.com - * For Dynamics CRM for Outlook (Offline): http://localhost:2525 + * @example + * * For Dynamics CRM On-Premises: http(s)://server/org + * * For Dynamics CRM Online: https://org.crm.dynamics.com + * * For Dynamics CRM for Outlook (Offline): http://localhost:2525 */ getClientUrl(): string; @@ -359,15 +357,16 @@ declare namespace Xrm { /** * Returns the URL of the current business app in Customer Engagement. - * @example Online https://[org].crm.dynamics.com/main.aspx?appid=[GUID] - * OnPrem https://[server]/[org]/main.aspx?appid=[GUID] + * @example + * * Online https://**org**.crm.dynamics.com/main.aspx?appid=**GUID** + * * OnPrem https://**server**\/**org**\/main.aspx?appid=**GUID** * @returns A string containing the url of the current business app. */ getCurrentAppUrl(): string; /** * Gets current styling theme. - * Note: This function does not work with Dynamics CRM for tablets or in the unified interface. + * @remarks This function does not work with Dynamics CRM for tablets or in the unified interface. * @returns The name of the current theme, as either "default", "Office12Blue", or "Office14Silver" */ getCurrentTheme(): Theme; @@ -391,8 +390,7 @@ declare namespace Xrm { /** * Gets organization's unique name. - * - * Note: This value can be found on the Developer Resources page within Dynamics CRM. + * @remarks This value can be found on the Developer Resources page within Dynamics CRM. * @deprecated Deprecated in v9. Use {@link Xrm.OrganizationSettings.uniqueName} globalContext.organizationSettings.uniqueName instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The organization's unique name. @@ -409,7 +407,6 @@ declare namespace Xrm { /** * Returns the difference between the local time and Coordinated Universal Time (UTC). - * * @returns The time zone offset, in minutes. */ getTimeZoneOffsetMinutes(): number; @@ -428,7 +425,6 @@ declare namespace Xrm { * @deprecated Deprecated in v9. Use {@link Xrm.UserSettings.languageId globalContext.userSetings.languageId} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} * @returns The user's language code. - * * @see {@link http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx External Link: Microsoft Locale ID Values} */ getUserLcid(): number; @@ -452,7 +448,6 @@ declare namespace Xrm { /** * Returns the version number of the Dynamics 365 server. - * * @returns The version number */ getVersion(): string; @@ -464,7 +459,6 @@ declare namespace Xrm { /** * Prefixes the current organization's unique name to a string; typically a URL path. - * * @param sPath Local pathname of the resource. * @returns A path string with the organization name. Format: "/"+ OrgName + sPath */ @@ -478,28 +472,25 @@ declare namespace Xrm { interface SaveEventArguments { /** * @summary Gets save mode, as an integer. - * * @returns The save mode. - * - * @description Gets save mode, as an integer. - * Values returned are: 1 Save - * 2 Save and Close - * 59 Save and New - * 70 AutoSave (Where enabled; can be used with an OnSave handler - * to conditionally disable auto-saving) - * 58 Save as Completed (Activities) - * 5 Deactivate - * 6 Reactivate - * 47 Assign (All user- or team-owned entities) - * 7 Send (Email) - * 16 Qualify (Lead) - * 15 Disqualify (Lead) + * @description Gets save mode, as an integer.
+ * **Values returned are**: + * * 1 Save + * * 2 Save and Close + * * 59 Save and New + * * 70 AutoSave (Where enabled; can be used with an OnSave handler to conditionally disable auto-saving) + * * 58 Save as Completed (Activities) + * * 5 Deactivate + * * 6 Reactivate + * * 47 Assign (All user- or team-owned entities) + * * 7 Send (Email) + * * 16 Qualify (Lead) + * * 15 Disqualify (Lead) */ getSaveMode(): XrmEnum.SaveMode; /** * Returns a boolean value to indicate if the record's save has been prevented. - * * @returns true if saving is prevented, otherwise false. */ isDefaultPrevented(): boolean; @@ -649,6 +640,7 @@ declare namespace Xrm { /** * Interface for the formContext.data object. + * @note NTOE NOTE * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data External Link: formContext.data (Client API reference)} */ interface Data { @@ -827,13 +819,14 @@ declare namespace Xrm { /** * Gets form type. * @returns The form type. - * @remarks Values returned are: 0 Undefined - * 1 Create - * 2 Update - * 3 Read Only - * 4 Disabled - * 6 Bulk Edit - * Deprecated values are 5 (Quick Create), and 11 (Read Optimized) + * @remarks **Values returned are**: + * * 0 Undefined + * * 1 Create + * * 2 Update + * * 3 Read Only + * * 4 Disabled + * * 6 Bulk Edit + * * Deprecated values are 5 (Quick Create), and 11 (Read Optimized) */ getFormType(): XrmEnum.FormType; @@ -870,14 +863,12 @@ declare namespace Xrm { /** * The form selector API. - * * @remarks This API does not exist with Microsoft Dynamics CRM for tablets. */ formSelector: Controls.FormSelector; /** * The navigation API. - * * @remarks This API does not exist with Microsoft Dynamics CRM for tablets. */ navigation: Controls.Navigation; @@ -946,8 +937,8 @@ declare namespace Xrm { /** * Returns the entity metadata for the specified entity. - * @param entityName The logical name of the entity. - * @param attributes The attributes to get metadata for. + * @param entityName The logical name of the entity. + * @param attributes The attributes to get metadata for. */ getEntityMetadata(entityName: string, attributes?: string[]): Async.PromiseLike; @@ -959,8 +950,8 @@ declare namespace Xrm { /** * Returns the localized string for a given key associated with the specified web resource. - * @param webResourceName The name of the web resource. - * @param key The key for the localized string. + * @param webResourceName The name of the web resource. + * @param key The key for the localized string. * @returns A localized string. */ getResourceString(webResourceName: string, key: string): string; @@ -1056,14 +1047,15 @@ declare namespace Xrm { * @param width (Optional) The width of the new window. * @param height (Optional) The height of the new window. * @returns A Window reference, containing the opened Web Resource. - * @remarks This function will not work with Microsoft Dynamics CRM for tablets. - * Valid WebResource URL Parameters: typename - * type - * id - * orgname - * userlcid - * data (identical to this method's webResourceData parameter) - * formid + * @remarks This function will not work with Microsoft Dynamics CRM for tablets.
+ * **Valid WebResource URL Parameters**: + * * typename + * * type + * * id + * * orgname + * * userlcid + * * data (identical to this method's webResourceData parameter) + * * formid */ openWebResource(webResourceName: string, webResourceData?: string, width?: number, height?: number): Window; } @@ -1102,10 +1094,10 @@ declare namespace Xrm { * @param entityType The logical name of the entity. * @param data A dictionary object containing key : value pairs for the record to create. * @returns Returns an asynchronous promise. - * @remarks You cannot create intersect and activity party entities. - * Only the following attribute types are supported in offline mode: - * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName - * Integer, Lookup, Memo, Money, Owner, Picklist, String, State + * @remarks You cannot create intersect and activity party entities.
+ * Only the following attribute types are supported in offline mode:
+ * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName
+ * Integer, Lookup, Memo, Money, Owner, Picklist, String, State
* Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.createRecord} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} @@ -1121,10 +1113,10 @@ declare namespace Xrm { * @example Example options * options: ?$select=name&$expand=primarycontactid($select=contactid,fullname) * @returns Returns an asynchronous promise. - * @remarks Only $select option can be specified within $expand. - * Only the following attribute types are supported in offline mode: - * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName - * Integer, Lookup, Memo, Money, Owner, Picklist, String, State + * @remarks Only $select option can be specified within $expand.
+ * Only the following attribute types are supported in offline mode:
+ * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName
+ * Integer, Lookup, Memo, Money, Owner, Picklist, String, State
* Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.retrieveRecord} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} @@ -1137,17 +1129,17 @@ declare namespace Xrm { * @param entityType The logical name of the entity. * @param options (Optional) The logical name of the enti * @param maxPageSize (Optional) A positive number to indicates the number of entity records to be returned per page. - * If you do not specify this parameter, the default value is passed as 5000. - * If the number of records being retrieved is more than maxPageSize, an @odata.nextLink property - * will be returned, and you can use the value of the @odata.nextLink property with a new GET - * request to return next set of records. + * * If you do not specify this parameter, the default value is passed as 5000. + * * If the number of records being retrieved is more than maxPageSize, an @odata.nextLink property + * will be returned, and you can use the value of the @odata.nextLink property with a new GET + * request to return next set of records. * @returns Returns an asynchronous promise. * @remarks A maximum of 5000 related records can be retrieved when using $expand. - * Only $select option can be specified within $expand. - * $skip query option is not supported. - * Only the following attribute types are supported in offline mode: - * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName - * Integer, Lookup, Memo, Money, Owner, Picklist, String, State + * * Only $select option can be specified within $expand. + * * $skip query option is not supported. + * * Only the following attribute types are supported in offline mode:
+ * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName
+ * Integer, Lookup, Memo, Money, Owner, Picklist, String, State
* Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.retrieveMultipleRecords} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} @@ -1160,10 +1152,10 @@ declare namespace Xrm { * @param id GUID of the record to update. * @param data A dictionary object containing key : value pairs for the record to update. * @returns Returns an asynchronous promise. - * @remarks You cannot update intersect and activity party entities. - * Only the following attribute types are supported in offline mode: - * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName - * Integer, Lookup, Memo, Money, Owner, Picklist, String, State + * @remarks You cannot update intersect and activity party entities.
+ * Only the following attribute types are supported in offline mode:
+ * BigInt, Boolean, Customer, DateTime, Decimal, Double, EntityName
+ * Integer, Lookup, Memo, Money, Owner, Picklist, String, State
* Status, UniqueIdentifier * @deprecated Use {@link Xrm.WebApi.updateRecord} instead. * @see {@link https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated External Link: Deprecated Client APIs} @@ -1293,17 +1285,14 @@ declare namespace Xrm { namespace Collection { /** * Called for each item in an array - * * @param item The item. * @param index Zero-based index of the item array. - * * @returns true if the item matches, false if it does not. */ type MatchingDelegate = (item: T, index?: number) => boolean; /** * Called for each item in an array - * * @param item The item. * @param index Zero-based index of the item array. */ @@ -1311,7 +1300,6 @@ declare namespace Xrm { /** * Interface for an item collection. - * * @param T Generic type parameter. */ interface Dictionary { @@ -1862,13 +1850,13 @@ declare namespace Xrm { /** * Called when method to get active processes is complete * @param status The result of the get active processes operation. - * @remarks Returns object with the following key-value pairs: - * CreatedOn - * ProcessDefinitionID - * ProcessDefinitionName - * ProcessInstanceID - * ProcessInstanceName - * StatusCodeName + * @remarks **Returns object with the following key-value pairs**: + * * CreatedOn + * * ProcessDefinitionID + * * ProcessDefinitionName + * * ProcessInstanceID + * * ProcessInstanceName + * * StatusCodeName * @deprecated Use {@link Xrm.ProcessFlow.GetProcessInstancesDelegate} instead. */ type GetProcessInstancesDelegate = ProcessFlow.GetProcessInstancesDelegate; @@ -1876,8 +1864,9 @@ declare namespace Xrm { /** * Called when method to set active process is complete * @param status The result of the set active process operation. - * @remarks Values returned are: success (The operation succeeded.) - * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) + * @remarks **Values returned are**: + * * success (The operation succeeded.) + * * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) * @deprecated Use {@link Xrm.ProcessFlow.SetProcessInstanceDelegate} instead. */ type SetProcessInstanceDelegate = ProcessFlow.SetProcessInstanceDelegate; @@ -1885,24 +1874,23 @@ declare namespace Xrm { /** * Called when process change methods have completed. * @param status The result of the process change operation. - * @remarks Values returned are: success (The operation succeeded.) - * crossEntity (The previous stage is for a different entity.) - * beginning (The active stage is the first stage of the active path.) - * invalid (The operation failed because the selected stage isn’t the same - * as the active stage.) - * unreachable (The stage exists on a different path.) + * @remarks **Values returned are**: + * * success (The operation succeeded.) + * * crossEntity (The previous stage is for a different entity.) + * * beginning (The active stage is the first stage of the active path.) + * * invalid (The operation failed because the selected stage isn’t the same as the active stage.) + * * unreachable (The stage exists on a different path.) * @deprecated Use {@link Xrm.ProcessFlow.ProcessCallbackDelegate} instead. */ type ProcessCallbackDelegate = ProcessFlow.ProcessCallbackDelegate; /** * Called when process set status method has completed. - * * @param status The new status of the process instance - * - * @remarks Values returned are: active - * aborted - * finished + * @remarks **Values returned are**: + * * active + * * aborted + * * finished * @deprecated Use {@link Xrm.ProcessFlow.ProcessSetStatusDelegate} instead. */ type ProcessSetStatusDelegate = ProcessFlow.ProcessSetStatusDelegate; @@ -2094,38 +2082,38 @@ declare namespace Xrm { /** * Gets attribute type. - * @returns The attribute's type name. - * Values returned are: boolean - * datetime - * decimal - * double - * integer - * lookup - * memo - * money - * optionset - * string + * @returns The attribute's type name.

+ * **Values returned are**: + * * boolean + * * datetime + * * decimal + * * double + * * integer + * * lookup + * * memo + * * money + * * optionset + * * string */ getAttributeType(): string; /** * Gets the attribute format. - * - * @returns The format of the attribute. - * + * @returns The format of the attribute.

+ * **Values returned are**: + * * date (datetime) + * * datetime (datetime) + * * duration (integer) + * * email (string) + * * language (optionset) + * * none (integer) + * * phone (string) + * * text (string) + * * textarea (string) + * * tickersymbol (string) + * * timezone (optionset) + * * url (string) * @see {@link getAttributeType} - * Values returned are: date (datetime) - * datetime (datetime) - * duration (integer) - * email (string) - * language (optionset) - * none (integer) - * phone (string) - * text (string) - * textarea (string) - * tickersymbol (string) - * timezone (optionset) - * url (string) */ getFormat(): AttributeFormat; @@ -2270,9 +2258,7 @@ declare namespace Xrm { /** * Gets maximum length allowed. - * * @returns The maximum length allowed. - * * @remarks The email form's "Description" attribute does not have the this method. */ getMaxLength(): number; @@ -2504,14 +2490,12 @@ declare namespace Xrm { interface UiLabelElement { /** * Gets the label. - * * @returns The label. */ getLabel(): string; /** * Sets the label. - * * @param label The label. */ setLabel(label: string): void; @@ -2523,7 +2507,6 @@ declare namespace Xrm { interface UiCanGetVisibleElement { /** * Gets the visibility state. - * * @returns true if the tab is visible, otherwise false. */ getVisible(): boolean; @@ -2535,7 +2518,6 @@ declare namespace Xrm { interface UiCanSetVisibleElement { /** * Sets the visibility state. - * * @param visible true to show, false to hide. */ setVisible(visible: boolean): void; @@ -2547,7 +2529,6 @@ declare namespace Xrm { interface UiStandardElement extends UiCanGetVisibleElement, UiLabelElement { /** * Sets the visibility state. - * * @param visible true to show, false to hide. */ setVisible(visible: boolean): void; @@ -2660,19 +2641,20 @@ declare namespace Xrm { interface Control extends UiLabelElement, UiCanGetVisibleElement { /** * Gets the controls type. - * @returns The control type. - * @remarks Values returned are: standard - * iframe - * lookup - * optionset - * subgrid - * webresource - * notes - * timercontrol - * kbsearch (CRM Online Only, use parature.d.ts) - * quickform (see ui.QuickForm) - * customcontrol: . (A custom control for mobile phone and tablet clients). - * customsubgrid: . (A custom dataset control for mobile phone and tablet clients). + * @returns The control type.

+ * **Values returned are**: + * * standard + * * iframe + * * lookup + * * optionset + * * subgrid + * * webresource + * * notes + * * timercontrol + * * kbsearch (CRM Online Only, use parature.d.ts) + * * quickform (see ui.QuickForm) + * * customcontrol: . (A custom control for mobile phone and tablet clients). + * * customsubgrid: . (A custom dataset control for mobile phone and tablet clients). */ getControlType(): ControlType | string; @@ -2694,7 +2676,6 @@ declare namespace Xrm { /** * Gets a reference to the Section parent of the control. - * * @returns The parent Section. */ getParent(): Section; @@ -3816,7 +3797,6 @@ declare namespace Xrm { /** * Moves to the previous stage. * @param callbackFunction (Optional) A function to call when the operation is complete. - * . */ movePrevious(callbackFunction?: ProcessCallbackDelegate): void; @@ -3849,33 +3829,34 @@ declare namespace Xrm { /** * Called when method to get active processes is complete * @param status The result of the get active processes operation. - * @remarks Returns object with the following key-value pairs: - * CreatedOn - * ProcessDefinitionID - * ProcessDefinitionName - * ProcessInstanceID - * ProcessInstanceName - * StatusCodeName + * @remarks **Returns object with the following key-value pairs**: + * * CreatedOn + * * ProcessDefinitionID + * * ProcessDefinitionName + * * ProcessInstanceID + * * ProcessInstanceName + * * StatusCodeName */ type GetProcessInstancesDelegate = (object: ProcessDictionary) => void; /** * Called when method to set active process is complete * @param status The result of the set active process operation. - * @remarks Values returned are: success (The operation succeeded.) - * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) + * @remarks **Values returned are**: + * * success (The operation succeeded.) + * * invalid (The processInstanceId isn’t valid or the process isn’t enabled.) */ type SetProcessInstanceDelegate = (status: string) => void; /** * Called when process change methods have completed. * @param status The result of the process change operation. - * @remarks Values returned are: success (The operation succeeded.) - * crossEntity (The previous stage is for a different entity.) - * beginning (The active stage is the first stage of the active path.) - * invalid (The operation failed because the selected stage isn’t the same - * as the active stage.) - * unreachable (The stage exists on a different path.) + * @remarks **Values returned are**: + * * success (The operation succeeded.) + * * crossEntity (The previous stage is for a different entity.) + * * beginning (The active stage is the first stage of the active path.) + * * invalid (The operation failed because the selected stage isn’t the same as the active stage.) + * * unreachable (The stage exists on a different path.) */ type ProcessCallbackDelegate = (status: string) => void; @@ -3920,16 +3901,19 @@ declare namespace Xrm { namespace Url { /** * Command Bar Display options for Xrm.Url.FormOpenParameters.cmdbar, Xrm.Url.ViewOpenParameters.cmdbar, and Xrm.Utility.FormOpenParameters.cmdbar. + * @see {@link XrmEnum.CmdBarDisplay} */ type CmdBarDisplay = "true" | "false"; /** * Navigation Bar Display options for Xrm.Url.FormOpenParameters.navbar, Xrm.Url.ViewOpenParameters.navbar, and Xrm.Utility.FormOpenParameters.navbar. + * @see {@link XrmEnum.NavBarDisplay} */ type NavBarDisplay = "entity" | "off" | "on"; /** * Report Open Action options for Xrm.Url.ReportOpenParameters.actions. + * @see {@link XrmEnum.ReportAction} */ type ReportAction = "filter" | "run"; @@ -3957,17 +3941,18 @@ declare namespace Xrm { /** * Controls whether the command bar is displayed. - * Accepted values are: "true" (The command bar is displayed.) - * "false" (The command bar is not displayed.) + * @remarks **Accepted values are**: + * * "true" (The command bar is displayed.) + * * "false" (The command bar is not displayed.) */ cmdbar?: CmdBarDisplay; /** * Controls whether the Navigation bar is displayed on the form. - * Accepted values are: "on" (The navigation bar is displayed.) - * "off" (The navigation bar is not displayed.) - * "entity" (On an entity form, only the navigation options for related - * entities are available.) + * @remarks **Accepted values are**: + * * "on" (The navigation bar is displayed.) + * * "off" (The navigation bar is not displayed.) + * * "entity" (On an entity form, only the navigation options for related entities are available.) */ navbar?: NavBarDisplay; } @@ -3976,9 +3961,7 @@ declare namespace Xrm { * Interface for defining parameters on a request to open a view with main.aspx (as with * window.open). Useful for parsing the keys and values into a string of the format: * "&key=value". - * * @see {@link http://msdn.microsoft.com/en-us/library/gg328483.aspx External Link: Open forms, views, dialogs, and reports with a URL} - * * @remarks A member for "pagetype" is not provided. The value "entitylist" is required in * the URL, for views. Example: "pagetype=entitylist" */ @@ -3996,24 +3979,26 @@ declare namespace Xrm { /** * The type of view identified by {@link viewid}. - * @remarks Accepted values are: 1039 System View - * 4230 User View. + * @remarks **Accepted values are**: + * * 1039 System View + * * 4230 User View. */ viewtype: XrmEnum.ViewType; /** * Controls whether the command bar is displayed. - * Accepted values are: "true" (The command bar is displayed.) - * "false" (The command bar is not displayed.) + * @remarks **Accepted values are**: + * * "true" (The command bar is displayed.) + * * "false" (The command bar is not displayed.) */ cmdbar?: CmdBarDisplay; /** * Controls whether the Navigation bar is displayed on the form. - * Accepted values are: "on" (The navigation bar is displayed.) - * "off" (The navigation bar is not displayed.) - * "entity" (On an entity form, only the navigation options for related - * entities are available.) + * @remarks **Accepted values are**: + * * "on" (The navigation bar is displayed.) + * * "off" (The navigation bar is not displayed.) + * * "entity" (On an entity form, only the navigation options for related entities are available.) */ navbar?: NavBarDisplay; } @@ -4052,9 +4037,9 @@ declare namespace Xrm { interface ReportOpenParameters { /** * The action to perform, as either "run" or "filter". - * - * @remarks "run" Executes the report with default filters. - * "filter" Presents the user with the filter editor, and a "Run Report" button. + * @remarks **Actions**: + * * "run" Executes the report with default filters. + * * "filter" Presents the user with the filter editor, and a "Run Report" button. */ action: ReportAction; @@ -4101,17 +4086,18 @@ declare namespace Xrm { /** * Controls whether the Navigation bar is displayed on the form. - * Accepted values are: "on" (The navigation bar is displayed.) - * "off" (The navigation bar is not displayed.) - * "entity" (On an entity form, only the navigation options for related - * entities are available.) + * @remarks **Accepted values are**: + * * "on" (The navigation bar is displayed.) + * * "off" (The navigation bar is not displayed.) + * * "entity" (On an entity form, only the navigation options for related entities are available.) */ navbar?: Url.NavBarDisplay; /** * Controls whether the command bar is displayed. - * Accepted values are: "true" (The command bar is displayed.) - * "false" (The command bar is not displayed.) + * @remarks **Accepted values are**: + * * "true" (The command bar is displayed.) + * * "false" (The command bar is not displayed.) */ cmdbar?: Url.CmdBarDisplay; } @@ -4276,9 +4262,9 @@ declare namespace Xrm { isOfflineSyncError?: boolean; /** * Controls whether the navigation bar is displayed and whether application navigation is available using the areas and subareas defined in the sitemap.Valid vlaues are: "on", "off", or "entity". - * on: The navigation bar is displayed.This is the default behavior if the navBar parameter is not used. - * off: The navigation bar is not displayed.People can navigate using other user interface elements or the back and forward buttons. - * entity: On an entity form, only the navigation options for related entities are available.After navigating to a related entity, a back button is displayed in the navigation bar to allow returning to the original record. + * * on: The navigation bar is displayed.This is the default behavior if the navBar parameter is not used. + * * off: The navigation bar is not displayed.People can navigate using other user interface elements or the back and forward buttons. + * * entity: On an entity form, only the navigation options for related entities are available.After navigating to a related entity, a back button is displayed in the navigation bar to allow returning to the original record. */ navBar?: Url.NavBarDisplay; /** @@ -4287,8 +4273,8 @@ declare namespace Xrm { openInNewWindow?: boolean; /** * Specify one of the following values for the window position of the form on the screen: - * 1:center - * 2:side + * * 1:center + * * 2:side */ windowPosition?: XrmEnum.WindowPositions; /** @@ -4332,14 +4318,14 @@ declare namespace Xrm { navigationPropertyName?: string; /** * Relationship type.Specify one of the following values: - * 0:OneToMany - * 1:ManyToMany + * * 0:OneToMany + * * 1:ManyToMany */ relationshipType?: XrmEnum.RelationshipType; // /** * Role type in relationship.Specify one of the following values: - * 1:Referencing - * 2:AssociationEntity + * * 1:Referencing + * * 2:AssociationEntity */ roleType?: XrmEnum.RoleType; } @@ -4588,6 +4574,7 @@ declare namespace Xrm { /** * Posible file types for Xrm.Device.pickFile options + * @see {@link XrmEnum.DevicePickFileType} */ type PickFileTypes = "audio" | "video" | "image"; @@ -4704,28 +4691,28 @@ declare namespace Xrm { /** * Execute a single action, function, or CRUD operation. * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/execute External Link: execute (Client API reference)} - * @param request Object that will be passed to the Web API endpoint to execute an action, function, or CRUD request. - * The object exposes a getMetadata method that lets you define the metadata for the action, function or CRUD request you want to execute. - * The getMetadata method has the following parameters: - * -boundParameter: (Optional) String. The name of the bound parameter for the action or function to execute. - * Specify undefined if you are executing a CRUD request. - * Specify null if the action or function to execute is not bound to any entity. - * Specify entity logical name or entity set name in case the action or function to execute is bound to one. - * -operationName: (Optional). String. Name of the action, function, or one of the following values if you are executing a CRUD request: "Create", "Retrieve", "RetrieveMultiple", "Update", or "Delete". - * -operationType: (Optional). Number. Indicates the type of operation you are executing; specify one of the following values: - * 0: Action - * 1: Function - * 2: CRUD - * -parameterTypes: Object. The metadata for parameter types. The object has the following attributes: - * -enumProperties: (Optional) Object. The metadata for enum types. The object has two string attributes: name and value - * -structuralProperty: Number. The category of the parameter type. Specify one of the following values: - * 0: Unknown - * 1: PrimitiveType - * 2: ComplexType - * 3: EnumerationType - * 4: Collection - * 5: EntityType - * -typeName: String. The fully qualified name of the parameter type. + * @param request Object that will be passed to the Web API endpoint to execute an action, function, or CRUD request. + * @remarks The object exposes a getMetadata method that lets you define the metadata for the action, function or CRUD request you want to execute.
+ * **The getMetadata method has the following parameters**: + * - boundParameter: (Optional) String. The name of the bound parameter for the action or function to execute. + * * Specify undefined if you are executing a CRUD request. + * * Specify null if the action or function to execute is not bound to any entity. + * * Specify entity logical name or entity set name in case the action or function to execute is bound to one. + * - operationName: (Optional). String. Name of the action, function, or one of the following values if you are executing a CRUD request: "Create", "Retrieve", "RetrieveMultiple", "Update", or "Delete". + * - operationType: (Optional). Number. Indicates the type of operation you are executing; specify one of the following values: + * * 0: Action + * * 1: Function + * * 2: CRUD + * - parameterTypes: Object. The metadata for parameter types. The object has the following attributes: + * - enumProperties: (Optional) Object. The metadata for enum types. The object has two string attributes: name and value + * - structuralProperty: Number. The category of the parameter type. Specify one of the following values: + * * 0: Unknown + * * 1: PrimitiveType + * * 2: ComplexType + * * 3: EnumerationType + * * 4: Collection + * * 5: EntityType + * - typeName: String. The fully qualified name of the parameter type. */ execute(request: any): Async.PromiseLike; @@ -4733,13 +4720,13 @@ declare namespace Xrm { * Execute a collection of action, function, or CRUD operations. * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/executemultiple External Link: executeMultiple (Client API reference)} * @param request An array of one of one of the following types: - * -objects where each object is an action, function, or CRUD request that you want to execute - * against the Web API endpoint. Each object exposes a getMetadata method that lets you define - * the metadata for the action, function or CRUD request you want to execute. This is the same - * object that you pass in the execute method. For information about the object, see execute. - * -change set (an array of objects), where each object in the change set is as defined above. - * In this case, all the request objects specified in the change set will get executed in a - * transaction. + * -objects where each object is an action, function, or CRUD request that you want to execute + * * against the Web API endpoint. Each object exposes a getMetadata method that lets you define + * the metadata for the action, function or CRUD request you want to execute. This is the same + * object that you pass in the execute method. For information about the object, see execute. + * -change set (an array of objects), where each object in the change set is as defined above. + * * In this case, all the request objects specified in the change set will get executed in a + * transaction. */ executeMultiple(request: any[]): Async.PromiseLike; } @@ -4770,18 +4757,18 @@ declare namespace Xrm { * Retrieves an entity record. * @param entityLogicalName The entity logical name of the record you want to retrieve. For example: "account". * @param id GUID of the entity record you want to retrieve. - * @param options (Optional) OData system query options, $select and $expand, to retrieve your data. - * -Use the $select system query option to limit the properties returned by including a comma-separated - * list of property names. This is an important performance best practice. If properties aren’t - * specified using $select, all properties will be returned. - * -Use the $expand system query option to control what data from related entities is returned. If you - * just include the name of the navigation property, you’ll receive all the properties for related - * records. You can limit the properties returned for related records using the $select system query - * option in parentheses after the navigation property name. Use this for both single-valued and - * collection-valued navigation properties. - * You can also specify multiple query options by using & to separate the query options. - * @example: options example: - * options: $select=name&$expand=primarycontactid($select=contactid,fullname) + * @param options (Optional) OData system query options, $select and $expand, to retrieve your data. + * - Use the $select system query option to limit the properties returned by including a comma-separated + * list of property names. This is an important performance best practice. If properties aren’t + * specified using $select, all properties will be returned. + * - Use the $expand system query option to control what data from related entities is returned. If you + * just include the name of the navigation property, you’ll receive all the properties for related + * records. You can limit the properties returned for related records using the $select system query + * option in parentheses after the navigation property name. Use this for both single-valued and + * collection-valued navigation properties. + * - You can also specify multiple query options by using & to separate the query options. + * @example options example: + * options: $select=name&$expand=primarycontactid($select=contactid,fullname) * @returns On success, returns a promise containing a JSON object with the retrieved attributes and their values. * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrieverecord External Link: retrieveRecord (Client API reference)} */ @@ -4790,16 +4777,15 @@ declare namespace Xrm { /** * Retrieves a collection of entity records. * @param entityLogicalName The entity logical name of the records you want to retrieve. For example: "account". - * @param options (Optional) OData system query options or FetchXML query to retrieve your data. - * Following system query options are supported: $select, $top, $filter, $expand, and $orderby. - * To specify a FetchXML query, use the fetchXml attribute to specify the query. - * NOTE: You must always use the $select system query option to limit the properties returned for an entity - * record by including a comma-separated list of property names. This is an important performance best practice. - * If properties aren’t specified using $select, all properties will be returned. - * - * You can specify multiple system query options by using & to separate the query options. - * @param maxPageSize (Optional) Specify a positive number that indicates the number of entity records to be returned per page. - * If you do not specify this parameter, the default value is passed as 5000. If the number of records being retrieved is more than the specified + * @param options (Optional) OData system query options or FetchXML query to retrieve your data. + * * Following system query options are supported: $select, $top, $filter, $expand, and $orderby. + * * To specify a FetchXML query, use the fetchXml attribute to specify the query. + * * NOTE: You must always use the $select system query option to limit the properties returned for an entity + * record by including a comma-separated list of property names. This is an important performance best practice. + * * If properties aren’t specified using $select, all properties will be returned. + * * You can specify multiple system query options by using & to separate the query options. + * @param maxPageSize (Optional) Specify a positive number that indicates the number of entity records to be returned per page. + * * If you do not specify this parameter, the default value is passed as 5000. If the number of records being retrieved is more than the specified * maxPageSize value, nextLink attribute in the returned promise object will contain a link to retrieve the next set of entities. * @returns On success, returns a promise object containing the attributes specified earlier in the description of the successCallback parameter. * @see {@link https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrievemultiplerecords External Link: retrieveMultipleRecords (Client API reference)} @@ -5085,7 +5071,7 @@ declare namespace XrmEnum { /** * Constant Enum: Themes for {@link GlobalContext.getCurrentTheme globalContext.getCurrentTheme()}. - * Note: getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. + * @remarks getCurrentTheme() does not work with Dynamics CRM for tablets or in the unified interface. */ const enum Theme { Default = "default", @@ -5214,4 +5200,42 @@ declare namespace XrmEnum { Aborted = "aborted", Finished = "finished" } + + /** + * Constant Enum: Command Bar Display options for Xrm.Url.FormOpenParameters.cmdbar, Xrm.Url.ViewOpenParameters.cmdbar, and Xrm.Utility.FormOpenParameters.cmdbar. + * @see {@link Xrm.Url.CmdBarDisplay} + */ + const enum CmdBarDisplay { + True = "true", + False = "false" + } + + /** + * Constant Enum: Navigation Bar Display options for Xrm.Url.FormOpenParameters.navbar, Xrm.Url.ViewOpenParameters.navbar, and Xrm.Utility.FormOpenParameters.navbar. + * @see {@link Xrm.Url.NavBarDisplay} + */ + const enum NavBarDisplay { + Entity = "entity", + On = "on", + Off = "off" + } + + /** + * Constant Enum: Report Open Action options for Xrm.Url.ReportOpenParameters.actions. + * @see {@link Xrm.Url.ReportAction} + */ + const enum ReportAction { + Filter = "filter", + Run = "run" + } + + /** + * Constant Enum: Posible file types for Xrm.Device.pickFile options + * @see {@link Xrm.Device.PickFileTypes} + */ + const enum DevicePickFileType { + Audio = "audio", + Video = "vidoe", + Image = "image" + } } From c1fb697564f821cd1bf53b054e97a28d3c0d52ec Mon Sep 17 00:00:00 2001 From: Carlton Colter Date: Sat, 25 Nov 2017 16:06:03 -0500 Subject: [PATCH 143/269] GlobalContext changed to ClientContext GlobalContext changed to ClientContext in remaining constant @link tags --- types/xrm/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index ab9adfd1fa..59eb452db8 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -5009,7 +5009,7 @@ declare namespace XrmEnum { } /** - * Constant Enum: Client Types for {@link GlobalContext.getClient globalContext.getClient()}. + * Constant Enum: Client Types for {@link ClientContext.getClient clientContext.getClient()}. * @see {@link Xrm.Client} */ const enum Client { @@ -5021,7 +5021,7 @@ declare namespace XrmEnum { } /** - * Constant Enum: Client States for {@link GlobalContext.getClientState globalContext.getClientState()}. + * Constant Enum: Client States for {@link ClientContext.getClientState clientContext.getClientState()}. * @see {@link Xrm.ClientState} */ const enum ClientState { From 36b6f554a7f861046d2a82b46f55b40702215534 Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Sat, 25 Nov 2017 21:18:28 +0000 Subject: [PATCH 144/269] [lokijs] update definition to lokijs@1.5.1 --- types/lokijs/index.d.ts | 2825 ++++++++++++++++++++-------------- types/lokijs/lokijs-tests.ts | 6 +- types/lokijs/tsconfig.json | 2 +- 3 files changed, 1637 insertions(+), 1196 deletions(-) diff --git a/types/lokijs/index.d.ts b/types/lokijs/index.d.ts index f250786778..74f1b6f09e 100644 --- a/types/lokijs/index.d.ts +++ b/types/lokijs/index.d.ts @@ -1,854 +1,1431 @@ -// Type definitions for lokijs v1.2.5 +// Type definitions for lokijs v1.5.1 // Project: https://github.com/techfort/LokiJS // Definitions by: TeamworkGuy2 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -// NOTE: definition last updated (2016-3-13) based on latest code as of https://github.com/techfort/LokiJS/commit/3d2cf9546cd22556444deeabc4df314f227ecf5c +// NOTE: definition last updated (2017-11-25) based on latest code as of https://github.com/techfort/LokiJS/commit/f6c8f1c362cfc9ed63d93cd165ef0ac3bad131bf -/** LokiJS +/** + * LokiJS * A lightweight document oriented javascript database * @author Joe Minichino */ - -/** Loki: The main database class - * @constructor - * @param {string} filename - name of the file to be saved to - * @param {object} options - config object +/** comparison operators + * a is the value in the collection + * b is the query value */ -interface Loki extends LokiEventEmitter { - // autosave support (disabled by default) - autosave: boolean; - autosaveInterval: number; // milliseconds between auto-saves - autosaveHandle: number; // ID from setInterval(...) - collections: LokiCollection[]; - databaseVersion: number; - engineVersion: number; - ENV: string;/*NODEJS, CORDOVA, BROWSER*/ - events: { [id: string]: ((...args: any[]) => void)[] }; /*{ - 'init': ((...args) => void)[]; - 'loaded': ((...args) => void)[]; - 'flushChanges': ((...args) => void)[]; - 'close': ((...args) => void)[]; - 'changes': ((...args) => void)[]; - 'warning': ((...args) => void)[]; - };*/ - filename: string; - options: LokiConfigureOptions; - persistenceAdapter: LokiPersistenceInterface; - // persistenceMethod could be 'fs', 'localStorage', or 'adapter' - // this is optional option param, otherwise environment detection will be used - // if user passes their own adapter we will force this method to 'adapter' later, so no need to pass method option. - persistenceMethod: string; /*'fs', 'localStorage', 'adapter'*/ - verbose: boolean; +declare var LokiOps: { + $eq(a: any, b: any): boolean; + // abstract/loose equality + $aeq(a: any, b: any): boolean; + $ne(a: any, b: any): boolean; + // date equality / loki abstract equality test + $dteq(a: any, b: any): boolean; + $gt(a: any, b: any): boolean; + $gte(a: any, b: any): boolean; + $lt(a: any, b: any): boolean; + $lte(a: any, b: any): boolean; + /** ex : coll.find({'orderCount': {$between: [10, 50]}}); */ + $between(a: any, vals: any/*[any, any]*/): boolean; + $in(a: any, b: any): boolean; + $nin(a: any, b: any): boolean; + $keyin(a: any, b: any): boolean; + $nkeyin(a: any, b: any): boolean; + $definedin(a: any, b: any): boolean; + $undefinedin(a: any, b: any): boolean; + $regex(a: any, b: any): boolean; + $containsString(a: any, b: any): boolean; + $containsNone(a: any, b: any): boolean; + $containsAny(a: any, b: any): boolean; + $contains(a: any, b: any): boolean; + $type(a: any, b: any): boolean; + $finite(a: any, b: any): boolean; + $size(a: any, b: any): boolean; + $len(a: any, b: any): boolean; + $where(a: any, b: any): boolean; + // field-level logical operators + // a is the value in the collection + // b is the nested query operation (for '$not') + // or an array of nested query operations (for '$and' and '$or') + $not(a: any, b: any): boolean; + $and(a: any, b: any): boolean; + $or(a: any, b: any): boolean; +}; +declare type LokiOps = typeof LokiOps; - new (filename: string, options: LokiConfigureOptions): Loki; - - // experimental support for browserify's abstract syntax scan to pick up dependency of indexed adapter. - // Hopefully, once this hits npm a browserify require of lokijs should scan the main file and detect this indexed adapter reference. - getIndexedAdapter(): LokiPersistenceInterface; // require("./loki-indexed-adapter.js") +/** if an op is registered in this object, our 'calculateRange' can use it with our binary indices. + * if the op is registered to a function, we will run that function/op as a 2nd pass filter on results. + * those 2nd pass filter functions should be similar to LokiOps functions, accepting 2 vals to compare. + */ +declare var indexedOps: { + $eq: LokiOps["$eq"], + $aeq: true, + $dteq: true, + $gt: true, + $gte: true, + $lt: true, + $lte: true, + $in: true, + $between: true +}; - /** configureOptions - allows reconfiguring database options - * - * @param {object} options - configuration options to apply to loki db object - * @param {boolean} initialConfig - (optional) if this is a reconfig, don't pass this - */ - configureOptions(options: LokiConfigureOptions, initialConfig?: boolean): void; +type PartialModel = { [P in keyof E]?: T | E[P] }; - /** anonym() - shorthand method for quickly creating and populating an anonymous collection. - * This collection is not referenced internally so upon losing scope it will be garbage collected. - * - * Example : var results = new loki().anonym(myDocArray).find({'age': {'$gt': 30} }); - * - * @param {Array} docs - document array to initialize the anonymous collection with - * @param {Array} indexesArray - (Optional) array of property names to index - * @returns {Collection} New collection which you can query or chain - */ - anonym(docs: T | T[], indexesArray?: LokiCollectionOptions): LokiCollection; +type LokiQuery = PartialModel; - addCollection(name: string, options?: LokiCollectionOptions): LokiCollection; - - loadCollection(collection: LokiCollection): void; - - getCollection(collectionName: string): LokiCollection; - - listCollections(): { name: string; type: string; count: number }[]; - - removeCollection(collectionName: string): void; - - getName(): string; - - /** serializeReplacer - used to prevent certain properties from being serialized - */ - serializeReplacer(key: "autosaveHandle", value: T): T; - serializeReplacer(key: "persistenceAdapter", value: T): T; - serializeReplacer(key: "constraints", value: T): T; - serializeReplacer(key: string, value: T): T; - - // toJson - serialize(): string; - - // alias of serialize - toJson(): string; - - /** loadJSON - inflates a loki database from a serialized JSON string - * - * @param {string} serializedDb - a serialized loki database string - * @param {object} options - apply or override collection level settings - */ - loadJSON(serializedDb: string, options?: { [collectionName: string]: { inflate?: (src: any, dst: any) => void; proto: any; } }): void; - - /** loadJSONObject - inflates a loki database from a JS object - * - * @param {object} dbObject - a serialized loki database string - * @param {object} options - apply or override collection level settings - */ - loadJSONObject(dbObject: Loki, options?: { [collectionName: string]: { inflate?: (src: any, dst: any) => void; proto: any; } }): void; - - /** close(callback) - emits the close event with an optional callback. Does not actually destroy the db - * but useful from an API perspective - */ - close(callback?: (...args: any[]) => void): void; - - /**-------------------------+ - | Changes API | - +--------------------------*/ - - /** The Changes API enables the tracking the changes occurred in the collections since the beginning of the session, - * so it's possible to create a differential dataset for synchronization purposes (possibly to a remote db) - */ - - /** generateChangesNotification() - takes all the changes stored in each - * collection and creates a single array for the entire database. If an array of names - * of collections is passed then only the included collections will be tracked. - * - * @param {array} optional array of collection names. No arg means all collections are processed. - * @returns {array} array of changes - * @see private method createChange() in Collection - */ - generateChangesNotification(arrayOfCollectionNames?: string[]): LokiCollectionChange[]; - - /** serializeChanges() - stringify changes for network transmission - * @returns {string} string representation of the changes - */ - serializeChanges(collectionNamesArray?: string[]): string; - - /** clearChanges() - clears all the changes in all collections. - */ - clearChanges(): void; - - /** loadDatabase - Handles loading from file system, local storage, or adapter (indexeddb) - * This method utilizes loki configuration options (if provided) to determine which - * persistence method to use, or environment detection (if configuration was not provided). - * - * @param {object} options - not currently used (remove or allow overrides?) - * @param {function} callback - (Optional) user supplied async callback / error handler - */ - loadDatabase(options: { [collectionName: string]: { inflate?: (src: any, dst: any) => void; proto: any; } }, callback?: (err: any, data: any) => void): void; - - /** saveDatabase - Handles saving to file system, local storage, or adapter (indexeddb) - * This method utilizes loki configuration options (if provided) to determine which - * persistence method to use, or environment detection (if configuration was not provided). - * - * @param {object} options - not currently used (remove or allow overrides?) - * @param {function} callback - (Optional) user supplied async callback / error handler - */ - saveDatabase(callback?: (err: any) => void): void; - - // alias for saveDatabase - save(callback ?: (err: any) => void): void; - - /** deleteDatabase - Handles deleting a database from file system, local - * storage, or adapter (indexeddb) - * This method utilizes loki configuration options (if provided) to determine which - * persistence method to use, or environment detection (if configuration was not provided). - * - * @param {object} options - not currently used (remove or allow overrides?) - * @param {function} callback - user supplied async callback / error handler - */ - deleteDatabase(options: any, callback: (err: any, data: any) => void): void; - - /** autosaveDirty - check whether any collections are 'dirty' meaning we need to save (entire) database - * @returns {boolean} - true if database has changed since last autosave, false if not. - */ - autosaveDirty(): boolean; - - /** autosaveClearFlags - resets dirty flags on all collections. - * Called from saveDatabase() after db is saved. - */ - autosaveClearFlags(): void; - - /** autosaveEnable - begin a javascript interval to periodically save the database. - * - * @param {object} options - not currently used (remove or allow overrides?) - * @param {function} callback - (Optional) user supplied async callback - */ - autosaveEnable(options?: LokiConfigureOptions, callback?: (err: any) => void): void; - - /** autosaveDisable - stop the autosave interval timer. - */ - autosaveDisable(): void; +interface LokiObj { + $loki: number; + meta: { + created: number; // Date().getTime() + revision: number; + updated: number; // Date().getTime() + version: number; + }; } - /** * LokiEventEmitter is a minimalist version of EventEmitter. It enables any * constructor that inherits EventEmitter to emit events and trigger * listeners that have been added to the event through the on(event, callback) method + * + * @constructor LokiEventEmitter */ -interface LokiEventEmitter { - /** - * @prop Events property is a hashmap, with each property being an array of callbacks - */ - events: { [eventName: string]: ((...args: any[]) => void)[] }; +declare class LokiEventEmitter { - new (): LokiEventEmitter; + /** + * @prop events - a hashmap, with each property being an array of callbacks + */ + public events: { [eventName: string]: ((...args: any[]) => any)[] }; /** * @prop asyncListeners - boolean determines whether or not the callbacks associated with each event * should happen in an async fashion or not * Default is false, which means events are synchronous */ - asyncListeners: boolean; + public asyncListeners: boolean; /** - * @prop on(eventName, listener) - adds a listener to the queue of callbacks associated to an event - * @returns {int} the index of the callback in the array of listeners for a particular event + * on(eventName, listener) - adds a listener to the queue of callbacks associated to an event + * @param eventName - the name(s) of the event(s) to listen to + * @param listener - callback function of listener to attach + * @returns the index of the callback in the array of listeners for a particular event */ - on void>(eventName: string, listener: U): U; + on any>(eventName: string | string[], listener: F): F; /** - * @propt emit(eventName, data) - emits a particular event + * emit(eventName, data) - emits a particular event * with the option of passing optional parameters which are going to be processed by the callback * provided signatures match (i.e. if passing emit(event, arg0, arg1) the listener should take two parameters) - * @param {string} eventName - the name of the event - * @param {object} data - optional object passed with the event + * @param eventName - the name of the event + * @param data - optional object passed with the event */ - emit(eventName: string, data?: any): void; + emit(eventName: string, data?: any, arg?: any): void; /** - * @prop remove() - removes the listener at position 'index' from the event 'eventName' + * Alias of LokiEventEmitter.prototype.on + * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event + * @param eventName - the name(s) of the event(s) to listen to + * @param listener - callback function of listener to attach + * @returns the event listener added */ - removeListener(eventName: string, listener: (...args: any[]) => void): void; + public addListener: LokiEventEmitter["on"]; + + /** + * removeListener() - removes the listener at position 'index' from the event 'eventName' + * @param eventName - the name(s) of the event(s) which the listener is attached to + * @param listener - the listener callback function to remove from emitter + */ + public removeListener(eventName: string | string[], listener: (...args: any[]) => any): void; } +interface LokiConstructorOptions { + verbose: boolean; + env: "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "NA"; +} + + +interface LokiConfigOptions { + adapter: LokiPersistenceAdapter | null; + autoload: boolean; + autoloadCallback: (err: any) => void; + autosave: boolean; + autosaveCallback: (err?: any) => void; + autosaveInterval: string | number; + persistenceMethod: "fs" | "localStorage" | "memory" | null; + destructureDelimiter: string; + serializationMethod: "normal" | "pretty" | "destructured" | null; + throttledSaves: boolean; +} + + +type DeserializeOptions = { partitioned?: boolean; delimited: false; delimiter?: string; partition?: number } | { partitioned?: boolean; delimited?: true; delimiter: string; partition?: number }; + + +interface ThrottledSaveDrainOptions { + recursiveWait: boolean; + recursiveWaitLimit: boolean; + recursiveWaitLimitDuration: number; + started: number; +} + + +interface Transform { + type: "find" | "where" | "simplesort" | "compoundsort" | "sort" | "limit" | "offset" | "map" | "eqJoin" | "mapReduce" | "update" | "remove"; + value?: any; + property?: string; + desc?: boolean; + dataOptions?: any; + joinData?: any; + leftJoinKey?: any; + rightJoinKey?: any; + mapFun?: any; + mapFunction?: any; + reduceFunction?: any; +} + + +/** + * Loki: The main database class + * @implements LokiEventEmitter + */ +declare class Loki extends LokiEventEmitter { + collections: Collection[]; + options: Partial & LokiConfigOptions & Partial; + filename: string; + name?: string; + databaseVersion: number; + engineVersion: number; + autosave: boolean; + autosaveInterval: number; + autosaveHandle: number | null; + persistenceAdapter: LokiPersistenceAdapter | null | undefined; + persistenceMethod: "fs" | "localStorage" | "memory" | "adapter" | null | undefined; + throttledCallbacks: ((err?: any) => void)[]; + throttledSavePending: boolean; + throttledSaves: boolean; + verbose: boolean; + ENV: "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "NA"; + + /** + * @param filename - name of the file to be saved to + * @param options - (Optional) config options object + * @param options.env - override environment detection as 'NODEJS', 'BROWSER', 'CORDOVA' + * @param [options.verbose=false] - enable console output + * @param [options.autosave=false] - enables autosave + * @param [options.autosaveInterval=5000] - time interval (in milliseconds) between saves (if dirty) + * @param [options.autoload=false] - enables autoload on loki instantiation + * @param options.autoloadCallback - user callback called after database load + * @param options.adapter - an instance of a loki persistence adapter + * @param [options.serializationMethod='normal'] - ['normal', 'pretty', 'destructured'] + * @param options.destructureDelimiter - string delimiter used for destructured serialization + * @param [options.throttledSaves=true] - debounces multiple calls to to saveDatabase reducing number of disk I/O operations + and guaranteeing proper serialization of the calls. + */ + constructor(filename: string, options?: Partial & Partial & Partial); + + // experimental support for browserify's abstract syntax scan to pick up dependency of indexed adapter. + // Hopefully, once this hits npm a browserify require of lokijs should scan the main file and detect this indexed adapter reference. + public getIndexedAdapter(): any; + + /** + * Allows reconfiguring database options + * + * @param options - configuration options to apply to loki db object + * @param options.env - override environment detection as 'NODEJS', 'BROWSER', 'CORDOVA' + * @param options.verbose - enable console output (default is 'false') + * @param options.autosave - enables autosave + * @param options.autosaveInterval - time interval (in milliseconds) between saves (if dirty) + * @param options.autoload - enables autoload on loki instantiation + * @param options.autoloadCallback - user callback called after database load + * @param options.adapter - an instance of a loki persistence adapter + * @param options.serializationMethod - ['normal', 'pretty', 'destructured'] + * @param options.destructureDelimiter - string delimiter used for destructured serialization + * @param initialConfig - (internal) true is passed when loki ctor is invoking + */ + public configureOptions(options?: Partial & Partial, initialConfig?: boolean): void; + + /** + * Copies 'this' database into a new Loki instance. Object references are shared to make lightweight. + * + * @param options - apply or override collection level settings + * @param options.removeNonSerializable - nulls properties not safe for serialization. + */ + public copy(options?: { removeNonSerializable?: boolean }): Loki; + + /** + * Adds a collection to the database. + * @param name - name of collection to add + * @param options - (optional) options to configure collection with. + * @param [options.unique=[]] - array of property names to define unique constraints for + * @param [options.exact=[]] - array of property names to define exact constraints for + * @param [options.indices=[]] - array property names to define binary indexes for + * @param [options.asyncListeners=false] - whether listeners are called asynchronously + * @param [options.disableChangesApi=true] - set to false to enable Changes Api + * @param [options.autoupdate=false] - use Object.observe to update objects automatically + * @param [options.clone=false] - specify whether inserts and queries clone to/from user + * @param [options.cloneMethod='parse-stringify'] - 'parse-stringify', 'jquery-extend-deep', 'shallow, 'shallow-assign' + * @param options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. + * @returns a reference to the collection which was just added + */ + public addCollection(name: string, options?: Partial>): Collection; + + public loadCollection(collection: Collection): void; + + /** + * Retrieves reference to a collection by name. + * @param collectionName - name of collection to look up + * @returns Reference to collection in database by that name, or null if not found + */ + public getCollection(collectionName: string): Collection; + + /** + * Renames an existing loki collection + * @param oldName - name of collection to rename + * @param newName - new name of collection + * @returns reference to the newly renamed collection + */ + public renameCollection(oldName: string, newName: string): Collection; + + public listCollections(): Collection[]; + + /** + * Removes a collection from the database. + * @param collectionName - name of collection to remove + */ + public removeCollection(collectionName: string): void; + + public getName(): string; + + /** + * serializeReplacer - used to prevent certain properties from being serialized + */ + public serializeReplacer(key: "autosaveHandle" | "persistenceAdapter" | "constraints" | "ttl" | "throttledSavePending" | "throttledCallbacks" | string, value: any): any; + + /** + * Serialize database to a string which can be loaded via {@link Loki#loadJSON} + * + * @returns Stringified representation of the loki database. + */ + public serialize(): string; + public serialize(options: { serializationMethod?: "normal" | "pretty" }): string; + public serialize(options: { serializationMethod: "destructured" }): string[]; + public serialize(options?: { serializationMethod?: string | null }): string | string[]; + public serialize(options?: { serializationMethod?: string | null }): string | string[]; + + // alias of serialize + public toJson: Loki["serialize"]; + + /** + * Database level destructured JSON serialization routine to allow alternate serialization methods. + * Internally, Loki supports destructuring via loki "serializationMethod' option and + * the optional LokiPartitioningAdapter class. It is also available if you wish to do + * your own structured persistence or data exchange. + * + * @param options - output format options for use externally to loki + * @param options.partitioned - (default: false) whether db and each collection are separate + * @param options.partition - can be used to only output an individual collection or db (-1) + * @param options.delimited - (default: true) whether subitems are delimited or subarrays + * @param options.delimiter - override default delimiter + * + * @returns A custom, restructured aggregation of independent serializations. + */ + public serializeDestructured(options?: { delimited?: boolean; delimiter?: string; partitioned?: boolean; partition?: number; }): string | string[]; + + /** + * Collection level utility method to serialize a collection in a 'destructured' format + * + * @param [options] - used to determine output of method + * @param [options.delimited] - whether to return single delimited string or an array + * @param [options.delimiter] - (optional) if delimited, this is delimiter to use + * @param [options.collectionIndex] - specify which collection to serialize data for + * + * @returns A custom, restructured aggregation of independent serializations for a single collection. + */ + public serializeCollection(options?: { delimited?: boolean; collectionIndex?: number; delimiter?: string }): string | string[]; + + /** + * Database level destructured JSON deserialization routine to minimize memory overhead. + * Internally, Loki supports destructuring via loki "serializationMethod' option and + * the optional LokiPartitioningAdapter class. It is also available if you wish to do + * your own structured persistence or data exchange. + * + * @param destructuredSource - destructured json or array to deserialize from + * @param [options] - source format options + * @param [options.partitioned=false] - whether db and each collection are separate + * @param [options.partition] - can be used to deserialize only a single partition + * @param [options.delimited=true] - whether subitems are delimited or subarrays + * @param [options.delimiter] - override default delimiter + * + * @returns An object representation of the deserialized database, not yet applied to 'this' db or document array + */ + public deserializeDestructured(destructuredSource: string | string[] | null, options?: DeserializeOptions): any; + + /** + * Collection level utility function to deserializes a destructured collection. + * + * @param destructuredSource - destructured representation of collection to inflate + * @param [options] - used to describe format of destructuredSource input + * @param [options.delimited=false] - whether source is delimited string or an array + * @param [options.delimiter] - if delimited, this is delimiter to use (if other than default) + * + * @returns an array of documents to attach to collection.data. + */ + public deserializeCollection(destructuredSource: string | string[], options?: { partitioned?: boolean; delimited?: boolean; delimiter?: string; }): any[]; + + /** + * Inflates a loki database from a serialized JSON string + * + * @param serializedDb - a serialized loki database string + * @param [options] - apply or override collection level settings + * @param [options.serializationMethod] - the serialization format to deserialize + */ + public loadJSON(serializedDb: string, options?: { serializationMethod?: "normal" | "pretty" | "destructured" | null } & { retainDirtyFlags?: boolean; throttledSaves?: boolean;[collName: string]: any | { proto?: any; inflate?: (src: object, dest?: object) => void } }): void; + + /** + * Inflates a loki database from a JS object + * + * @param dbObject - a serialized loki database string + * @param options - apply or override collection level settings + * @param options.retainDirtyFlags - whether collection dirty flags will be preserved + */ + public loadJSONObject(dbObject: { name?: string; throttledSaves: boolean; collections: Collection[]; databaseVersion: number }, + options?: { retainDirtyFlags?: boolean; throttledSaves?: boolean;[collName: string]: any | { proto?: any; inflate?: (src: object, dest?: object) => void } }): void; + + /** + * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer. + * Does not actually destroy the db. + * + * @param callback - (Optional) if supplied will be registered with close event before emitting. + */ + public close(callback?: (err?: any) => void): void; + + /**-------------------------+ + | Changes API | + +--------------------------*/ + + /** + * The Changes API enables the tracking the changes occurred in the collections since the beginning of the session, + * so it's possible to create a differential dataset for synchronization purposes (possibly to a remote db) + */ + + /** + * (Changes API) : takes all the changes stored in each + * collection and creates a single array for the entire database. If an array of names + * of collections is passed then only the included collections will be tracked. + * + * @param optional array of collection names. No arg means all collections are processed. + * @returns array of changes + * @see private method createChange() in Collection + */ + public generateChangesNotification(arrayOfCollectionNames?: string[] | null): CollectionChange[]; + + /** + * (Changes API) - stringify changes for network transmission + * @returns string representation of the changes + */ + public serializeChanges(collectionNamesArray?: string[]): string; + + /** + * (Changes API) : clears all the changes in all collections. + */ + public clearChanges(): void; + + /** + * Wait for throttledSaves to complete and invoke your callback when drained or duration is met. + * + * @param callback - callback to fire when save queue is drained, it is passed a sucess parameter value + * @param [options] - configuration options + * @param [options.recursiveWait] - (default: true) if after queue is drained, another save was kicked off, wait for it + * @param [options.recursiveWaitLimit] - (default: false) limit our recursive waiting to a duration + * @param [options.recursiveWaitLimitDelay] - (default: 2000) cutoff in ms to stop recursively re-draining + */ + public throttledSaveDrain(callback: (result?: boolean) => void, options?: Partial): void; + + /** + * Internal load logic, decoupled from throttling/contention logic + * + * @param [options] - not currently used (remove or allow overrides?) + * @param [callback] - (Optional) user supplied async callback / error handler + */ + public loadDatabaseInternal(options?: any, callback?: (err?: any, data?: any) => void): void; + + /** + * Handles manually loading from file system, local storage, or adapter (such as indexeddb) + * This method utilizes loki configuration options (if provided) to determine which + * persistence method to use, or environment detection (if configuration was not provided). + * To avoid contention with any throttledSaves, we will drain the save queue first. + * + * If you are configured with autosave, you do not need to call this method yourself. + * + * @param [options] - if throttling saves and loads, this controls how we drain save queue before loading + * @param [options.recursiveWait] - (default: true) wait recursively until no saves are queued + * @param [options.recursiveWaitLimit] - (default: false) limit our recursive waiting to a duration + * @param [options.recursiveWaitLimitDelay] - (default: 2000) cutoff in ms to stop recursively re-draining + * @param [callback] - (Optional) user supplied async callback / error handler + * @example + * db.loadDatabase({}, function(err) { + * if (err) { + * console.log("error : " + err); + * } + * else { + * console.log("database loaded."); + * } + * }); + */ + public loadDatabase(options?: Partial, callback?: (err: any) => void): void; + + /** + * Internal save logic, decoupled from save throttling logic + */ + public saveDatabaseInternal(callback?: (err: any) => void): void; + + /** + * Handles manually saving to file system, local storage, or adapter (such as indexeddb) + * This method utilizes loki configuration options (if provided) to determine which + * persistence method to use, or environment detection (if configuration was not provided). + * + * If you are configured with autosave, you do not need to call this method yourself. + * + * @param [callback] - (Optional) user supplied async callback / error handler + * @example + * db.saveDatabase(function(err) { + * if (err) { + * console.log("error : " + err); + * } + * else { + * console.log("database saved."); + * } + * }); + */ + public saveDatabase(callback?: (err?: any) => void): void; + + // alias + public save: Loki["saveDatabase"]; + + /** + * Handles deleting a database from file system, local + * storage, or adapter (indexeddb) + * This method utilizes loki configuration options (if provided) to determine which + * persistence method to use, or environment detection (if configuration was not provided). + * + * @param callback - (Optional) user supplied async callback / error handler + */ + public deleteDatabase(callback: (err?: any, data?: any) => void): void; + public deleteDatabase(options?: null, callback?: (err?: any, data?: any) => void): void; + public deleteDatabase(options?: ((err?: any, data?: any) => void) | null, callback?: (err?: any, data?: any) => void): void; + + /** + * autosaveDirty - check whether any collections are 'dirty' meaning we need to save (entire) database + * + * @returns true if database has changed since last autosave, false if not. + */ + public autosaveDirty(): boolean; + + /** + * autosaveClearFlags - resets dirty flags on all collections. + * Called from saveDatabase() after db is saved. + * + */ + public autosaveClearFlags(): void; + + /** + * autosaveEnable - begin a javascript interval to periodically save the database. + * + * @param [options] - not currently used (remove or allow overrides?) + * @param [callback] - (Optional) user supplied async callback + */ + public autosaveEnable(options?: any, callback?: (err?: any) => void): void; + + /** + * autosaveDisable - stop the autosave interval timer. + */ + public autosaveDisable(): void; +} + + /*------------------+ | PERSISTENCE | -------------------*/ /** there are two build in persistence adapters for internal use - * fs for use in Nodejs type environments - * localStorage for use in browser environment - * defined as helper classes here so its easy and clean to use - */ + * fs for use in Nodejs type environments + * localStorage for use in browser environment + * defined as helper classes here so its easy and clean to use + */ -interface LokiPersistenceInterface { - loadDatabase(dbname: string, callback: (dataOrErr: string | Error) => void): void; - saveDatabase(dbname: string, dbstring: string, callback: (resOrErr: void | Error) => void): void; - deleteDatabase(dbname: string, callback?: (resOrErr: void | Error) => void): void; - // optional - mode?: string; // 'reference' - // filename may seem redundant but loadDatabase will need to expect this same filename - exportDatabase?(filename: string, param: any, callback?: (err: any) => void): void; +interface LokiPersistenceAdapter { + mode?: string; + loadDatabase(dbname: string, callback: (value: any) => void): void; + deleteDatabase?(dbnameOrOptions: any, callback: (err?: Error | null, data?: any) => void): void; + exportDatabase?(dbname: string, dbref: Loki, callback: (err: Error | null) => void): void; + saveDatabase?(dbname: string, dbstring: any, callback: (err?: Error | null) => void): void; } -/** constructor for fs +/** + * In in-memory persistence adapter for an in-memory database. + * This simple 'key/value' adapter is intended for unit testing and diagnostics. + * + * @param [options] - memory adapter options + * @param [options.asyncResponses=false] - whether callbacks are invoked asynchronously + * @param [options.asyncTimeout=50] - timeout in ms to queue callbacks + * @constructor LokiMemoryAdapter */ -interface LokiFsAdapter extends LokiPersistenceInterface { - fs: any; //require('fs'); +declare class LokiMemoryAdapter implements LokiPersistenceAdapter { + hashStore: { [name: string]: { savecount: number; lastsave: Date; value: string } }; + options: { asyncResponses?: boolean; asyncTimeout?: number }; - /** loadDatabase() - Load data from file, will throw an error if the file does not exist - * @param {string} dbname - the filename of the database to load - * @param {function} callback - the callback to handle the result + constructor(options?: { asyncResponses?: boolean; asyncTimeout?: number }); + + /** + * Loads a serialized database from its in-memory store. + * (Loki persistence adapter interface function) + * + * @param dbname - name of the database (filename/keyname) + * @param callback - adapter callback to return load result to caller */ - loadDatabase(dbname: string, callback: (err: Error, data: string) => void): void; + public loadDatabase(dbname: string, callback: (value: any) => void): void; - /** saveDatabase() - save data to file, will throw an error if the file can't be saved + /** + * Saves a serialized database to its in-memory store. + * (Loki persistence adapter interface function) + * + * @param dbname - name of the database (filename/keyname) + * @param callback - adapter callback to return load result to caller + */ + public saveDatabase(dbname: string, dbstring: any, callback: (err?: Error | null) => void): void; + + /** + * Deletes a database from its in-memory store. + * + * @param dbname - name of the database (filename/keyname) + * @param callback - function to call when done + */ + public deleteDatabase(dbname: string, callback: (err?: Error | null) => void): void; +} + + + +interface PageIterator { + collection: number; + pageIndex: number; + docIndex: number; +} + + +/** + * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter + * which can perform destructuring and partioning. Each collection will be stored in its own key/save and + * only dirty collections will be saved. If you turn on paging with default page size of 25megs and save + * a 75 meg collection it should use up roughly 3 save slots (key/value pairs sent to inner adapter). + * A dirty collection that spans three pages will save all three pages again + * Paging mode was added mainly because Chrome has issues saving 'too large' of a string within a + * single indexeddb row. If a single document update causes the collection to be flagged as dirty, all + * of that collection's pages will be written on next save. + * + * @param adapter - reference to a 'non-reference' mode loki adapter instance. + * @param options - configuration options for partitioning and paging + * @param [options.paging] - (default: false) set to true to enable paging collection data. + * @param [options.pageSize] - (default : 25MB) you can use this to limit size of strings passed to inner adapter. + * @param [options.delimiter] - allows you to override the default delimeter + * @constructor LokiPartitioningAdapter + */ +declare class LokiPartitioningAdapter implements LokiPersistenceAdapter { + mode: string; + dbref: Loki | null; + dbname: string + adapter: LokiPersistenceAdapter | null; + options: { paging?: boolean; pageSize?: number; delimiter?: string }; + pageIterator: PageIterator | {}; + dirtyPartitions: number[] | undefined; + + constructor(adapter: LokiPersistenceAdapter, options?: { paging?: boolean; pageSize?: number; delimiter?: string }); + + /** + * Loads a database which was partitioned into several key/value saves. + * (Loki persistence adapter interface function) + * + * @param dbname - name of the database (filename/keyname) + * @param callback - adapter callback to return load result to caller + */ + public loadDatabase(dbname: string, callback: (dbOrErr: Loki | null | Error) => void): void; + + /** + * Used to sequentially load each collection partition, one at a time. + * + * @param partition - ordinal collection position to load next + * @param callback - adapter callback to return load result to caller + */ + public loadNextPartition(partition: number, callback: () => void): void; + + /** + * Used to sequentially load the next page of collection partition, one at a time. + * + * @param callback - adapter callback to return load result to caller + */ + public loadNextPage(callback: () => void): void; + + /** + * Saves a database by partioning into separate key/value saves. + * (Loki 'reference mode' persistence adapter interface function) + * + * @param dbname - name of the database (filename/keyname) + * @param dbref - reference to database which we will partition and save. + * @param callback - adapter callback to return load result to caller + */ + public exportDatabase(dbname: string, dbref: Loki, callback: (err: Error | null) => void): void; + + /** + * Helper method used internally to save each dirty collection, one at a time. + * + * @param callback - adapter callback to return load result to caller + */ + public saveNextPartition(callback: (err: Error | null) => void): void; + + /** + * Helper method used internally to generate and save the next page of the current (dirty) partition. + * + * @param callback - adapter callback to return load result to caller + */ + public saveNextPage(callback: (err: Error | null) => void): void; +} + + + +/** + * A loki persistence adapter which persists using node fs module + * @constructor LokiFsAdapter + */ +declare class LokiFsAdapter implements LokiPersistenceAdapter { + + constructor(); + + /** + * loadDatabase() - Load data from file, will throw an error if the file does not exist + * @param dbname - the filename of the database to load + * @param callback - the callback to handle the result + */ + public loadDatabase(dbname: string, callback: (data: any | Error) => void): void; + + /** + * saveDatabase() - save data to file, will throw an error if the file can't be saved * might want to expand this to avoid dataloss on partial save - * @param {string} dbname - the filename of the database to load - * @param {function} callback - the callback to handle the result + * @param dbname - the filename of the database to load + * @param callback - the callback to handle the result */ - saveDatabase(dbname: string, dbstring: string, callback: (err: any) => void): void; + public saveDatabase(dbname: string, dbstring: string | Uint8Array, callback: (err?: Error | null) => void): void; - /** deleteDatabase() - delete the database file, will throw an error if the + /** + * deleteDatabase() - delete the database file, will throw an error if the * file can't be deleted - * @param {string} dbname - the filename of the database to delete - * @param {function} callback - the callback to handle the result + * @param dbname - the filename of the database to delete + * @param callback - the callback to handle the result */ - deleteDatabase(dbname: string, callback: (resOrErr: void | Error) => void): void; + public deleteDatabase(dbname: string, callback: (err?: Error | null) => void): void; } -/** constructor for local storage + +/** + * A loki persistence adapter which persists to web browser's local storage object + * @constructor LokiLocalStorageAdapter */ -interface LokiLocalStorageAdapter extends LokiPersistenceInterface { +declare class LokiLocalStorageAdapter { - /** loadDatabase() - Load data from localstorage - * @param {string} dbname - the name of the database to load - * @param {function} callback - the callback to handle the result + /** + * loadDatabase() - Load data from localstorage + * @param dbname - the name of the database to load + * @param callback - the callback to handle the result */ - loadDatabase(dbname: string, callback: (dataOrErr: string | Error) => void): void; + public loadDatabase(dbname: string, callback: (dataOrError: any | Error) => void): void; - /** saveDatabase() - save data to localstorage, will throw an error if the file can't be saved + /** + * saveDatabase() - save data to localstorage, will throw an error if the file can't be saved * might want to expand this to avoid dataloss on partial save - * @param {string} dbname - the filename of the database to load - * @param {function} callback - the callback to handle the result + * @param dbname - the filename of the database to load + * @param callback - the callback to handle the result */ - saveDatabase(dbname: string, dbstring: string, callback: (resOrErr: void | Error) => void): void; + public saveDatabase(dbname: string, dbstring: string, callback: (err?: Error | null) => void): void; - /** deleteDatabase() - delete the database from localstorage, will throw an error if it + /** + * deleteDatabase() - delete the database from localstorage, will throw an error if it * can't be deleted - * @param {string} dbname - the filename of the database to delete - * @param {function} callback - the callback to handle the result + * @param dbname - the filename of the database to delete + * @param callback - the callback to handle the result */ - deleteDatabase(dbname: string, callback: (resOrErr: void | Error) => void): void; + public deleteDatabase(dbname: string, callback: (err?: Error | null) => void): void; } +interface GetDataOptions { + forceClones: boolean; + forceCloneMethod: ("parse-stringify" | "jquery-extend-deep" | "shallow" | "shallow-assign" | "shallow-recurse-objects") | null; + removeMeta: boolean; +} -/** Resultset class allowing chainable queries. Intended to be instanced internally. + +/** + * Resultset class allowing chainable queries. Intended to be instanced internally. * Collection.find(), Collection.where(), and Collection.chain() instantiate this. * - * Example: + * @example * mycollection.chain() * .find({ 'doors' : 4 }) * .where(function(obj) { return obj.name === 'Toyota' }) * .data(); */ -interface LokiResultset { - // retain reference to collection we are querying against - collection: LokiCollection; +declare class Resultset { + collection: Collection; + filteredrows: number[]; filterInitialized: boolean; - filteredrows: string[]; // technically number[] (e.g. = Object.keys(this.collection.data)) - options: LokiResultsetOptions; - searchIsChained: boolean; - /** - * @constructor - * @param {Collection} collection - The collection which this Resultset will query against. - * @param {Object} options - Object containing one or more options. - * @param {string} options.queryObj - Optional mongo-style query object to initialize resultset with. - * @param {function} options.queryFunc - Optional javascript filter function to initialize resultset with. - * @param {bool} options.firstOnly - Optional boolean used by collection.findOne(). + * @param collection - The collection which this Resultset will query against. + * @param options */ - new (collection: LokiCollection, options: LokiResultsetOptions): LokiResultset | E[]; + constructor(collection: Collection, options?: any); - /** reset() - Reset the resultset to its initial state. + /** + * reset() - Reset the resultset to its initial state. * - * @returns {Resultset} Reference to this resultset, for future chain operations. + * @returns Reference to this resultset, for future chain operations. */ - reset(): LokiResultset; + public reset(): this; - /** toJSON() - Override of toJSON to avoid circular references + /** + * toJSON() - Override of toJSON to avoid circular references */ - toJSON(): LokiResultset; + public toJSON(): Resultset; - /** limit() - Allows you to limit the number of documents passed to next chain operation. + /** + * Allows you to limit the number of documents passed to next chain operation. * A resultset copy() is made to avoid altering original resultset. * - * @param {int} qty - The number of documents to return. - * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops. + * @param qty - The number of documents to return. + * @returns Returns a copy of the resultset, limited by qty, for subsequent chain ops. */ - limit(qty: number): LokiResultset; + public limit(qty: number): Resultset; - /** offset() - Used for skipping 'pos' number of documents in the resultset. + /** + * Used for skipping 'pos' number of documents in the resultset. * - * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. - * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. + * @param pos - Number of documents to skip; all preceding documents are filtered out. + * @returns Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. */ - offset(pos: number): LokiResultset; + public offset(pos: number): Resultset; - /** copy() - To support reuse of resultset in branched query situations. + /** + * copy() - To support reuse of resultset in branched query situations. * - * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same. + * @returns Returns a copy of the resultset (set) but the underlying document references will be the same. */ - copy(): LokiResultset; - // alias of copy() - branch(): LokiResultset; + public copy(): Resultset; + + /** + * Alias of copy() + */ + public branch: Resultset["copy"]; /** * transform() - executes a named collection transform or raw array of transform steps against the resultset. * - * @param transform {string|array} : (Optional) name of collection transform or raw transform array - * @param parameters {object} : (Optional) object property hash of parameters, if the transform requires them. - * @returns {Resultset} : either (this) resultset or a clone of of this resultset (depending on steps) + * @param transform - name of collection transform or raw transform array + * @param parameters - (Optional) object property hash of parameters, if the transform requires them. + * @returns either (this) resultset or a clone of of this resultset (depending on steps) */ - transform(transform?: string | any[], parameters?: any): LokiResultset; + public transform(transform: string | string[] | Transform[], parameters?: object): Resultset; - /** sort() - User supplied compare function is provided two documents to compare. (chainable) - * Example: + /** + * User supplied compare function is provided two documents to compare. (chainable) + * @example * rslt.sort(function(obj1, obj2) { * if (obj1.name === obj2.name) return 0; * if (obj1.name > obj2.name) return 1; * if (obj1.name < obj2.name) return -1; * }); * - * @param {function} comparefun - A javascript compare function used for sorting. - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @param comparefun - A javascript compare function used for sorting. + * @returns Reference to this resultset, sorted, for future chain operations. */ - sort(comparefun: (a: E, b: E) => number): LokiResultset; + public sort(comparefun: (a: E & LokiObj, b: E & LokiObj) => number): this; - /** simplesort() - Simpler, loose evaluation for user to sort based on a property name. (chainable) + /** + * Simpler, loose evaluation for user to sort based on a property name. (chainable). + * Sorting based on the same lt/gt helper functions used for binary indices. * - * @param {string} propname - name of property to sort by. - * @param {bool} isdesc - (Optional) If true, the property will be sorted in descending order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @param propname - name of property to sort by. + * @param isdesc - (Optional) If true, the property will be sorted in descending order + * @returns Reference to this resultset, sorted, for future chain operations. */ - simplesort(propname: string, isdesc?: boolean): LokiResultset; + public simplesort(propname: keyof E, isdesc?: boolean): this; - /** compoundsort() - Allows sorting a resultset based on multiple columns. - * Example : rs.compoundsort(['age', 'name']); to sort by age and then name (both ascending) - * Example : rs.compoundsort(['age', ['name', true]); to sort by age (ascending) and then by name (descending) + /** + * Allows sorting a resultset based on multiple columns. + * @example + * // to sort by age and then name (both ascending) + * rs.compoundsort(['age', 'name']); + * // to sort by age (ascending) and then by name (descending) + * rs.compoundsort(['age', ['name', true]); * - * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @param properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order + * @returns Reference to this resultset, sorted, for future chain operations. */ - compoundsort(properties: ([string, boolean] | [string])[]): LokiResultset; + public compoundsort(properties: [keyof E, boolean][]): this; - /** calculateRange() - Binary Search utility method to find range/segment of values matching criteria. - * this is used for collection.find() and first find filter of resultset/dynview - * slightly different than get() binary search in that get() hones in on 1 value, - * but we have to hone in on many (range) - * @param {string} op - operation, such as $eq - * @param {string} prop - name of property to calculate range for - * @param {object} val - value to use for range calculation. - * @returns {array} [start, end] index array positions - */ - calculateRange(op: "$eq", prop: string, val: any): [number/*start*/, number/*end*/]; - calculateRange(op: "$dteq", prop: string, val: any): [number/*start*/, number/*end*/]; - calculateRange(op: "$gt", prop: string, val: any): [number/*start*/, number/*end*/]; - calculateRange(op: "$gte", prop: string, val: any): [number/*start*/, number/*end*/]; - calculateRange(op: "$lt", prop: string, val: any): [number/*start*/, number/*end*/]; - calculateRange(op: "$lte", prop: string, val: any): [number/*start*/, number/*end*/]; - calculateRange(op: string, prop: string, val: any): [number/*start*/, number/*end*/]; - - /** findOr() - oversee the operation of OR'ed query expressions. + /** + * findOr() - oversee the operation of OR'ed query expressions. * OR'ed expression evaluation runs each expression individually against the full collection, * and finally does a set OR on each expression's results. * Each evaluation can utilize a binary index to prevent multiple linear array scans. * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @param expressionArray - array of expressions + * @returns this resultset for further chain ops. */ - findOr(expressionArray: LokiQuery[]): LokiResultset; - $or(expressionArray: LokiQuery[]): LokiResultset; + public findOr(expressionArray: LokiQuery[]): this; - /** findAnd() - oversee the operation of AND'ed query expressions. + public $or: Resultset["findOr"]; + + /** + * findAnd() - oversee the operation of AND'ed query expressions. * AND'ed expression evaluation runs each expression progressively against the full collection, * internally utilizing existing chained resultset functionality. * Only the first filter can utilize a binary index. * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @param expressionArray - array of expressions + * @returns this resultset for further chain ops. */ - findAnd(expressionArray: LokiQuery[]): LokiResultset; - $and(expressionArray: LokiQuery[]): LokiResultset; + public findAnd(expressionArray: LokiQuery[]): this; - /** find() - Used for querying via a mongo-style query object. + public $and: Resultset["findAnd"]; + + /** + * Used for querying via a mongo-style query object. * - * @param {object} query - A mongo-style query object used for filtering current results. - * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - * @returns {Resultset} this resultset for further chain ops. + * @param query - A mongo-style query object used for filtering current results. + * @param firstOnly - (Optional) Used by collection.findOne() + * @returns this resultset for further chain ops. */ - //find(query: LokiQuery, firstOnly: boolean): E; - //find(query?: any, firstOnly?: boolean): E[]; - find(query: LokiQuery, firstOnly?: boolean): LokiResultset; + public find(query?: LokiQuery, firstOnly?: boolean): this; - /** where() - Used for filtering via a javascript filter function. + /** + * where() - Used for filtering via a javascript filter function. * - * @param {function} fun - A javascript function used for filtering current results by. - * @returns {Resultset} this resultset for further chain ops. + * @param fun - A javascript function used for filtering current results by. + * @returns this resultset for further chain ops. */ - where(fun: (obj: E) => boolean): LokiResultset; + public where(fun: (data: E & LokiObj) => boolean): this; - /** count() - returns the number of documents in the resultset. + /** + * count() - returns the number of documents in the resultset. * - * @returns {number} The number of documents in the resultset. + * @returns The number of documents in the resultset. */ - count(): number; + public count(): number; - /** data() - Terminates the chain and returns array of filtered documents + /** + * Terminates the chain and returns array of filtered documents * - * @param options {object} : allows specifying 'forceClones' and 'forceCloneMethod' options. - * options : - * forceClones {boolean} : Allows forcing the return of cloned objects even when + * @param [options] - allows specifying 'forceClones' and 'forceCloneMethod' options. + * @param [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * forceCloneMethod {string} : Allows overriding the default or collection specified cloning method. - * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow' + * @param [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' + * @param [options.removeMeta] - Will force clones and strip $loki and meta properties from documents * - * @returns {array} Array of documents in the resultset + * @returns Array of documents in the resultset */ - data(options?: { forceClones?: string; forceCloneMethod?: string; }): E[]; + public data(options?: Partial): (E & LokiObj)[]; - /** update() - used to run an update operation on all documents currently in the resultset. + /** + * Used to run an update operation on all documents currently in the resultset. * - * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. - * @returns {Resultset} this resultset for further chain ops. + * @param updateFunction - User supplied updateFunction(obj) will be executed for each document object. + * @returns this resultset for further chain ops. */ - update(updateFunction: (obj: E) => void): LokiResultset; + public update(updateFunction: (obj: E) => void): this; - /** remove() - removes all document objects which are currently in resultset from collection (as well as resultset) + /** + * Removes all document objects which are currently in resultset from collection (as well as resultset) * - * @returns {Resultset} this (empty) resultset for further chain ops. + * @returns this (empty) resultset for further chain ops. */ - remove(): LokiResultset; + public remove(): this; - /** mapReduce() - data transformation via user supplied functions + /** + * data transformation via user supplied functions * - * @param {function} mapFunction - this function accepts a single document for you to transform and return - * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value + * @param mapFunction - this function accepts a single document for you to transform and return + * @param reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns The output of your reduceFunction */ - mapReduce(mapFunction: (value: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + public mapReduce(mapFunction: (value: E, index: number, array: E[]) => U, reduceFunction: (ary: U[]) => R): R; - /** eqJoin() - Left joining two sets of data. Join keys can be defined or calculated properties + /** + * eqJoin() - Left joining two sets of data. Join keys can be defined or calculated properties * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key - * @param {Array} joinData - Data array to join to. - * @param {String,function} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on - * @param {String,function} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on - * @param {function} (optional) mapFun - A function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} - * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}] + * @param joinData - Data array to join to. + * @param leftJoinKey - Property name in this result set to join on or a function to produce a value to join on + * @param rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on + * @param [mapFun] - (Optional) A function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} + * @param [dataOptions] - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * @returns A resultset with data in the format [{left: leftObj, right: rightObj}] */ - eqJoin(joinData: T[] | LokiResultset, leftJoinKey: string | ((obj: E) => string), rightJoinKey: string | ((obj: T) => string)): LokiResultset<{ left: E; right: T; }>; - eqJoin(joinData: T[] | LokiResultset, leftJoinKey: string | ((obj: E) => string), rightJoinKey: string | ((obj: T) => string), mapFun?: (a: E, b: T) => U): LokiResultset; + public eqJoin( + joinData: Collection | Resultset | any[], + leftJoinKey: string | ((obj: any) => string), + rightJoinKey: string | ((obj: any) => string), + mapFun?: (left: any, right: any) => any, + dataOptions?: Partial + ): Resultset; - map(mapFun: (currentValue: E, index: number, array: E[]) => T): LokiResultset; + /** + * Applies a map function into a new collection for further chaining. + * @param mapFun - javascript map function + * @param [dataOptions] - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + */ + public map(mapFun: (value: E, index: number, array: E[]) => U, dataOptions?: Partial): Resultset; } +interface DynamicViewOptions { + persistent: boolean; + sortPriority: "active" | "passive"; + minRebuildInterval: number; +} -/** DynamicView class is a versatile 'live' view class which can have filters and sorts applied. + +/** + * DynamicView class is a versatile 'live' view class which can have filters and sorts applied. * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it * whenever documents are add/updated/removed so it can remain up-to-date. (chainable) * - * Examples: - * var mydv = mycollection.addDynamicView('test'); // default is non-persistent - * mydv.applyWhere(function(obj) { return obj.name === 'Toyota'; }); - * mydv.applyFind({ 'doors' : 4 }); - * var results = mydv.data(); + * @example + * var mydv = mycollection.addDynamicView('test'); // default is non-persistent + * mydv.applyFind({ 'doors' : 4 }); + * mydv.applyWhere(function(obj) { return obj.name === 'Toyota'; }); + * var results = mydv.data(); * + * @implements LokiEventEmitter */ -interface LokiDynamicView extends LokiEventEmitter { - cachedresultset: LokiResultset; - collection: LokiCollection; - events: { [id: string]: ((...args: any[]) => void)[] }; /*{ - 'rebuild': ((...args) => void)[]; - };*/ - // keep ordered filter pipeline - filterPipeline: LokiFilter[]; - minRebuildInterval: number; +declare class DynamicView extends LokiEventEmitter { name: string; - options: LokiDynamicViewOptions; - persistent: boolean; + collection: Collection; rebuildPending: boolean; - resultset: LokiResultset; - resultdata: E[]; + resultset: Resultset; + resultdata: (E & LokiObj)[]; resultsdirty: boolean; - // sorting member variables, we only support one active search, applied using applySort() or applySimpleSort() - sortFunction: (a: E, b: E) => number; - sortCriteria: ([string, boolean] | [string])[]; + cachedresultset: Resultset | null; + filterPipeline: { type: "find" | "where", val: any; uid?: string | number }[]; + sortFunction: ((a: E & LokiObj, b: E & LokiObj) => number) | null; + sortCriteria: [keyof E, boolean][] | null; sortDirty: boolean; - sortPriority: string; // 'persistentSortPriority', 'passive' (will defer the sort phase until they call data(). most efficient overall), 'active' (will sort async whenever next idle. prioritizes read speeds) + options: Partial; /** - * @constructor - * @param {Collection} collection - A reference to the collection to work against - * @param {string} name - The name of this dynamic view - * @param {object} options - (Optional) Pass in object with 'persistent' and/or 'sortPriority' options. + * @param collection - A reference to the collection to work against + * @param name - The name of this dynamic view + * @param [options] - (Optional) Pass in object with 'persistent' and/or 'sortPriority' options. + * @param [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' + * @param [options.sortPriority='passive'] - 'passive' (sorts performed on call to data) or 'active' (after updates) + * @param [options.minRebuildInterval] - minimum rebuild interval (need clarification to docs here) + * @see {@link Collection#addDynamicView} to construct instances of DynamicView */ - new (collection: LokiCollection, name: string, options?: LokiDynamicViewOptions): LokiDynamicView; + constructor(collection: Collection, name: string, options?: Partial); - /** rematerialize() - intended for use immediately after deserialization (loading) + /** + * rematerialize() - internally used immediately after deserialization (loading) * This will clear out and reapply filterPipeline ops, recreating the view. * Since where filters do not persist correctly, this method allows * restoring the view to state where user can re-apply those where filters. * - * @param {Object} options - (Optional) allows specification of 'removeWhereFilters' option - * @returns {DynamicView} This dynamic view for further chained ops. + * @param [options] - (Optional) allows specification of 'removeWhereFilters' option + * @returns This dynamic view for further chained ops. + * @fires DynamicView.rebuild */ - rematerialize(options?: { removeWhereFilters?: boolean; }): LokiDynamicView; + public rematerialize(options?: { removeWhereFilters?: boolean }): this; - /** branchResultset() - Makes a copy of the internal resultset for branched queries. + /** + * branchResultset() - Makes a copy of the internal resultset for branched queries. * Unlike this dynamic view, the branched resultset will not be 'live' updated, * so your branched query should be immediately resolved and not held for future evaluation. * - * @param {string|array} transform: Optional name of collection transform, or an array of transform steps - * @param {object} parameters: optional parameters (if optional transform requires them) - * @returns {Resultset} A copy of the internal resultset for branched queries. + * @param transform - Optional name of collection transform, or an array of transform steps + * @param [parameters] - optional parameters (if optional transform requires them) + * @returns A copy of the internal resultset for branched queries. */ - branchResultset(transform?: string | any[], parameters?: any): LokiResultset; + public branchResultset(transform: string | string[] | Transform[], parameters?: object): Resultset; - /** toJSON() - Override of toJSON to avoid circular references + /** + * toJSON() - Override of toJSON to avoid circular references */ - toJSON(): LokiDynamicView; + public toJSON(): DynamicView; - /** removeFilters() - Used to clear pipeline and reset dynamic view to initial state. + /** + * removeFilters() - Used to clear pipeline and reset dynamic view to initial state. * Existing options should be retained. + * @param [options] - configure removeFilter behavior + * @param [options.queueSortPhase] - (default: false) if true we will async rebuild view (maybe set default to true in future?) */ - removeFilters(): void; + public removeFilters(options?: { queueSortPhase?: boolean }): void; - /** applySort() - Used to apply a sort to the dynamic view + /** + * applySort() - Used to apply a sort to the dynamic view + * @example + * dv.applySort(function(obj1, obj2) { + * if (obj1.name === obj2.name) return 0; + * if (obj1.name > obj2.name) return 1; + * if (obj1.name < obj2.name) return -1; + * }); * - * @param {function} comparefun - a javascript compare function used for sorting - * @returns {DynamicView} this DynamicView object, for further chain ops. + * @param comparefun - a javascript compare function used for sorting + * @returns this DynamicView object, for further chain ops. */ - applySort(comparefun: (a: E, b: E) => number): LokiDynamicView; + public applySort(comparefun: (a: E & LokiObj, b: E & LokiObj) => number): this; - /** applySimpleSort() - Used to specify a property used for view translation. + /** + * applySimpleSort() - Used to specify a property used for view translation. + * @example + * dv.applySimpleSort("name"); * - * @param {string} propname - Name of property by which to sort. - * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order. - * @returns {DynamicView} this DynamicView object, for further chain ops. + * @param propname - Name of property by which to sort. + * @param [isdesc] - (Optional) If true, the sort will be in descending order. + * @returns this DynamicView object, for further chain ops. */ - applySimpleSort(propname: string, isdesc?: boolean): LokiDynamicView; + public applySimpleSort(propname: keyof E, isdesc?: boolean): this; - /** applySortCriteria() - Allows sorting a resultset based on multiple columns. - * Example : dv.applySortCriteria(['age', 'name']); to sort by age and then name (both ascending) - * Example : dv.applySortCriteria(['age', ['name', true]); to sort by age (ascending) and then by name (descending) - * Example : dv.applySortCriteria(['age', true], ['name', true]); to sort by age (descending) and then by name (descending) + /** + * applySortCriteria() - Allows sorting a resultset based on multiple columns. + * @example + * // to sort by age and then name (both ascending) + * dv.applySortCriteria(['age', 'name']); + * // to sort by age (ascending) and then by name (descending) + * dv.applySortCriteria(['age', ['name', true]); + * // to sort by age (descending) and then by name (descending) + * dv.applySortCriteria(['age', true], ['name', true]); * - * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations. + * @param criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order + * @returns Reference to this DynamicView, sorted, for future chain operations. */ - applySortCriteria(criteria: ([string, boolean] | [string])[]): LokiDynamicView; + public applySortCriteria(criteria: [keyof E, boolean][]): this; - /** startTransaction() - marks the beginning of a transaction. + /** + * startTransaction() - marks the beginning of a transaction. * - * @returns {DynamicView} this DynamicView object, for further chain ops. + * @returns this DynamicView object, for further chain ops. */ - startTransaction(): LokiDynamicView; + public startTransaction(): this; - /** commit() - commits a transaction. + /** + * commit() - commits a transaction. * - * @returns {DynamicView} this DynamicView object, for further chain ops. + * @returns this DynamicView object, for further chain ops. */ - commit(): LokiDynamicView; + public commit(): this; - /** rollback() - rolls back a transaction. + /** + * rollback() - rolls back a transaction. * - * @returns {DynamicView} this DynamicView object, for further chain ops. + * @returns this DynamicView object, for further chain ops. */ - rollback(): LokiDynamicView; + public rollback(): this; - /** Implementation detail. + /** + * Implementation detail. * _indexOfFilterWithId() - Find the index of a filter in the pipeline, by that filter's ID. * - * @param {string|number} uid - The unique ID of the filter. - * @returns {number}: index of the referenced filter in the pipeline; -1 if not found. + * @param [uid] - The unique ID of the filter. + * @returns index of the referenced filter in the pipeline; -1 if not found. */ - _indexOfFilterWithId(uid: string | number): number; + public _indexOfFilterWithId(uid?: string | number): number; - /** Implementation detail. + /** + * Implementation detail. * _addFilter() - Add the filter object to the end of view's filter pipeline and apply the filter to the resultset. * - * @param {object} filter - The filter object. Refer to applyFilter() for extra details. + * @param filter - The filter object. Refer to applyFilter() for extra details. */ - _addFilter(filter: LokiFilter): void; + public _addFilter(filter: { type: "find" | "where", val: any; uid?: string | number }): void; - /** reapplyFilters() - Reapply all the filters in the current pipeline. + /** + * reapplyFilters() - Reapply all the filters in the current pipeline. * - * @returns {DynamicView} this DynamicView object, for further chain ops. + * @returns this DynamicView object, for further chain ops. */ - reapplyFilters(): LokiDynamicView; + public reapplyFilters(): this; - /** applyFilter() - Adds or updates a filter in the DynamicView filter pipeline + /** + * applyFilter() - Adds or updates a filter in the DynamicView filter pipeline * - * @param {object} filter - A filter object to add to the pipeline. + * @param filter - A filter object to add to the pipeline. * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id } - * @returns {DynamicView} this DynamicView object, for further chain ops. + * @returns this DynamicView object, for further chain ops. */ - applyFilter(filter: LokiFilter): LokiDynamicView; + public applyFilter(filter: { type: "find" | "where", val: any; uid?: string | number }): this; - /** applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline + /** + * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline * - * @param {object} query - A mongo-style query object to apply to pipeline - * @param {string|number} uid - Optional: The unique ID of this filter, to reference it in the future. - * @returns {DynamicView} this DynamicView object, for further chain ops. + * @param query - A mongo-style query object to apply to pipeline + * @param [uid] - Optional: The unique ID of this filter, to reference it in the future. + * @returns this DynamicView object, for further chain ops. */ - applyFind(query: LokiQuery, uid?: string | number): LokiDynamicView; + public applyFind(query: any, uid?: string | number): this; - /** applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline + /** + * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline * - * @param {function} fun - A javascript filter function to apply to pipeline - * @param {string|number} uid - Optional: The unique ID of this filter, to reference it in the future. - * @returns {DynamicView} this DynamicView object, for further chain ops. + * @param fun - A javascript filter function to apply to pipeline + * @param [uid] - Optional: The unique ID of this filter, to reference it in the future. + * @returns this DynamicView object, for further chain ops. */ - applyWhere(fun: (obj: E) => boolean, uid?: string | number): LokiDynamicView; + public applyWhere(fun: (obj: any) => boolean, uid?: string | number): this; - /** removeFilter() - Remove the specified filter from the DynamicView filter pipeline + /** + * removeFilter() - Remove the specified filter from the DynamicView filter pipeline * - * @param {string|number} uid - The unique ID of the filter to be removed. - * @returns {DynamicView} this DynamicView object, for further chain ops. + * @param uid - The unique ID of the filter to be removed. + * @returns this DynamicView object, for further chain ops. */ - removeFilter(uid: string | number): LokiDynamicView; + public removeFilter(uid: string | number): this; - /** count() - returns the number of documents representing the current DynamicView contents. + /** + * count() - returns the number of documents representing the current DynamicView contents. * - * @returns {number} The number of documents representing the current DynamicView contents. + * @returns The number of documents representing the current DynamicView contents. */ - count(): number; + public count(): number; - /** data() - resolves and pending filtering and sorting, then returns document array as result. + /** + * data() - resolves and pending filtering and sorting, then returns document array as result. * - * @returns {array} An array of documents representing the current DynamicView contents. + * @param [options] - optional parameters to pass to resultset.data() if non-persistent + * @param [options.forceClones] - Allows forcing the return of cloned objects even when + * the collection is not configured for clone object. + * @param [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' + * @param [options.removeMeta] - Will force clones and strip $loki and meta properties from documents + * @returns An array of documents representing the current DynamicView contents. */ - data(): E[]; + public data(options?: Partial): (E & LokiObj)[]; - /** queueRebuildEvent() - When the view is not sorted we may still wish to be notified of rebuild events. + /** + * queueRebuildEvent() - When the view is not sorted we may still wish to be notified of rebuild events. * This event will throttle and queue a single rebuild event when batches of updates affect the view. */ - queueRebuildEvent(): void; + public queueRebuildEvent(): void; - /** queueSortPhase : If the view is sorted we will throttle sorting to either : + /** + * queueSortPhase : If the view is sorted we will throttle sorting to either : * (1) passive - when the user calls data(), or * (2) active - once they stop updating and yield js thread control */ - queueSortPhase(): void; + public queueSortPhase(): void; - /** performSortPhase() - invoked synchronously or asynchronously to perform final sort phase (if needed) + /** + * performSortPhase() - invoked synchronously or asynchronously to perform final sort phase (if needed) */ - performSortPhase(options?: { suppressRebuildEvent?: boolean; }): void; + public performSortPhase(options?: { persistent?: boolean; suppressRebuildEvent?: boolean }): void; - /** evaluateDocument() - internal method for (re)evaluating document inclusion. + /** + * evaluateDocument() - internal method for (re)evaluating document inclusion. * Called by : collection.insert() and collection.update(). * - * @param {int} objIndex - index of document to (re)run through filter pipeline. - * @param {bool} isNew - true if the document was just added to the collection. + * @param objIndex - index of document to (re)run through filter pipeline. + * @param [isNew] - true if the document was just added to the collection. */ - evaluateDocument(objIndex: number, isNew?: boolean): void; + public evaluateDocument(objIndex: number | string, isNew?: boolean): void; - /** removeDocument() - internal function called on collection.delete() + + /** + * removeDocument() - internal function called on collection.delete() */ - removeDocument(objIndex: number): void; + public removeDocument(objIndex: number | string): void; - /** mapReduce() - data transformation via user supplied functions + /** + * mapReduce() - data transformation via user supplied functions * - * @param {function} mapFunction - this function accepts a single document for you to transform and return - * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value + * @param mapFunction - this function accepts a single document for you to transform and return + * @param reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + public mapReduce(mapFunction: (value: E, index: number, array: E[]) => U, reduceFunction: (ary: U[]) => R): R; } - -/** Collection class that handles documents of same type - */ -interface LokiCollection extends LokiEventEmitter { - // option to observe objects and update them automatically, ignored if Object.observe is not supported - autoupdate: boolean; - // option to make event listeners async, default is sync - asyncListeners: boolean; - binaryIndices: { [id: string]: { name: string; dirty: boolean; values: number[] } }; - - cachedIndex: number[]; - cachedBinaryIndex: { [id: string]: { name: string; dirty: boolean; values: number[] } }; - cachedData: E[]; - // changes are tracked by collection and aggregated by the db - changes: LokiCollectionChange[]; - // default clone method (if enabled) is parse-stringify - cloneMethod: string; // 'parse-stringify' - // options to clone objects when inserting them - cloneObjects: boolean; - console: { - log: () => void; - warn: () => void; - error: () => void; - }; - constraints: { - unique: { [id: string]: LokiUniqueIndex }; - exact: { [id: string]: LokiExactIndex }; - }; - data: E[]; - // in autosave scenarios we will use collection level dirty flags to determine whether save is needed. - // currently, if any collection is dirty we will autosave the whole database if autosave is configured. - // defaulting to true since this is called from addCollection and adding a collection should trigger save - dirty: boolean; - // disable track changes - disableChangesApi: boolean; - DynamicViews: LokiDynamicView[]; - events: { [id: string]: ((...args: any[]) => void)[] }; /*{ - 'insert': ((...args) => void)[]; - 'update': ((...args) => void)[]; - 'pre-insert': ((...args) => void)[]; - 'pre-update': ((...args) => void)[]; - 'close': ((...args) => void)[]; - 'flushbuffer': ((...args) => void)[]; - 'error': ((...args) => void)[]; - 'delete': ((...args) => void)[]; - 'warning': ((...args) => void)[]; - };*/ - idIndex: number[]; - maxId: number; // currentMaxId - change manually at your own peril! +interface BinaryIndex { name: string; - // is collection transactional + dirty: boolean; + values: number[]; +} + + +interface CollectionOptions { + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + adaptiveBinaryIndices: boolean; + asyncListeners: boolean; + autoupdate: boolean; + clone: boolean; + cloneMethod: ("parse-stringify" | "jquery-extend-deep" | "shallow" | "shallow-assign" | "shallow-recurse-objects"); + serializableIndices: boolean; transactional: boolean; + ttl: number; + ttlInterval: number; + exact: (keyof E)[]; + unique: (keyof E)[]; + indices: (keyof E) | (keyof E)[]; +} + + +interface CollectionChange { + name: string; + operation: string; + obj: any; +} + + +/** + * Collection class that handles documents of same type + * @implements LokiEventEmitter + * @see {@link Loki#addCollection} for normal creation of collections + */ +declare class Collection extends LokiEventEmitter { + name: string; objType: string; - // transforms will be used to store frequently used query chains as a series of steps - // which itself can be stored along with the database. - transforms: { [id: string]: any }; - // unique contraints contain duplicate object references, so they are not persisted. - // we will keep track of properties which have unique contraint applied here, and regenerate on load - uniqueNames: string[]; + data: E[]; + adaptiveBinaryIndices: boolean; + asyncListeners: boolean; + autoupdate: boolean; + dirty: boolean; + binaryIndices: { [P in keyof E]: BinaryIndex }; + cachedIndex: number[] | null; + cachedBinaryIndex: { [P in keyof E]: BinaryIndex } | null; + cachedData: E[] | null; + changes: CollectionChange[]; + cloneMethod: ("parse-stringify" | "jquery-extend-deep" | "shallow" | "shallow-assign" | "shallow-recurse-objects") | null; + cloneObjects: boolean; + constraints: { + unique: { [P in keyof E]: UniqueIndex }; + exact: { [P in keyof E]: ExactIndex } + }; + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + DynamicViews: DynamicView[]; + idIndex: number[]; + ttl: { age: any; ttlInterval: any; daemon: any; }; + maxId: number; + uniqueNames: (keyof E)[]; + transforms: { [name: string]: Transform[] }; + serializableIndices: boolean; + transactional: boolean; + observerCallback: (changes: { object: any }[]) => void; + getChanges: () => CollectionChange[]; + flushChanges: () => void; + getChangeDelta: (obj: any, old?: any) => any; + getObjectDelta: (oldObject: any, newObject?: any) => any; + setChangesApi: (enabled?: boolean) => void; - options: LokiCollectionOptions; - // option to activate a cleaner daemon - clears "aged" documents at set intervals. - ttl: { - age: number; - ttlInterval: number; - daemon: number; + /** + * @param name - collection name + * @param [options] - (optional) configuration object + * @param [options.unique=[]] - array of property names to define unique constraints for + * @param [options.exact=[]] - array of property names to define exact constraints for + * @param [options.indices=[]] - array property names to define binary indexes for + * @param [options.adaptiveBinaryIndices=true] - collection indices will be actively rebuilt rather than lazily + * @param [options.asyncListeners=false] - whether listeners are invoked asynchronously + * @param [options.disableChangesApi=true] - set to false to enable Changes API + * @param [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) + * @param [options.autoupdate=false] - use Object.observe to update objects automatically + * @param [options.clone=false] - specify whether inserts and queries clone to/from user + * @param [options.serializableIndices=true[]] - converts date values on binary indexed properties to epoch time + * @param [options.cloneMethod='parse-stringify'] - 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' + * @param options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. + * @see {@link Loki#addCollection} for normal creation of collections + */ + constructor(name: string, options?: Partial>); + + public console: { + log(...args: any[]): void; + warn(...args: any[]): void; + error(...args: any[]): void; }; - /** Collection class that handles documents of same type - * @constructor - * @param {string} collection name - * @param {array} array of property names to be indicized - * @param {object} configuration object + public addAutoUpdateObserver(obj: any): void; + + public removeAutoUpdateObserver(obj: any): void; + + /** + * Adds a named collection transform to the collection + * @param name - name to associate with transform + * @param transform - an array of transformation 'step' objects to save into the collection + * @example + * users.addTransform('progeny', [ + * { + * type: 'find', + * value: { + * 'age': {'$lte': 40} + * } + * } + * ]); + * + * var results = users.chain('progeny').data(); */ - new (name: string, options?: LokiCollectionOptions): LokiCollection; + public addTransform(name: string, transform: Transform[]): void; - getChanges(): LokiCollectionChange[]; + /** + * Retrieves a named transform from the collection. + * @param name - name of the transform to lookup. + */ + public getTransform(name: string): Transform[]; - setChangesApi(enabled: boolean): void; + /** + * Updates a named collection transform to the collection + * @param name - name to associate with transform + * @param transform - a transformation object to save into collection + */ + public setTransform(name: string, transform: Transform[]): void; - flushChanges(): void; + /** + * Removes a named collection transform from the collection + * @param name - name of collection transform to remove + */ + public removeTransform(name: string): void; - observerCallback: (changes: { object: any }[]) => void; + public byExample(template: object): { $and: any[] }; - addAutoUpdateObserver(object: any): void; + public findObject(template: object): E | null; - removeAutoUpdateObserver(object: any): void; - - addTransform(name: string, transform: any): void; - - setTransform(name: string, transform: any): void; - - removeTransform(name: string): void; - - byExample(template: any): { '$and': any[] }; - - findObject(template: any): E; - - findObjects(template: any): E[]; + public findObjects(template: object): E[]; /*----------------------------+ | TTL daemon | +----------------------------*/ - ttlDaemonFuncGen(): () => void; + public ttlDaemonFuncGen(): () => void; - setTTL(age: number, interval: number): void; + /** + * Updates or applies collection TTL settings. + * @param age - age (in ms) to expire document from collection + * @param interval - time (in ms) to clear collection of aged documents. + */ + public setTTL(age: number, interval: number): void; /*----------------------------+ | INDEXING | @@ -857,711 +1434,575 @@ interface LokiCollection extends LokiEventEmitter { /** * create a row filter that covers all documents in the collection */ - prepareFullDocIndex(): number[]; + public prepareFullDocIndex(): number[]; - /** Ensure binary index on a certain field + /** + * Will allow reconfiguring certain collection options. + * @param [options.adaptiveBinaryIndices] - collection indices will be actively rebuilt rather than lazily */ - ensureIndex(property: string, force?: boolean): void; + public configureOptions(options?: { adaptiveBinaryIndices?: boolean }): void; - ensureUniqueIndex(field: string): LokiUniqueIndex; - - /** Ensure all binary indices + /** + * Ensure binary index on a certain field + * @param property - name of property to create binary index on + * @param [force] - (Optional) flag indicating whether to construct index immediately */ - ensureAllIndexes(force?: boolean): void; + public ensureIndex(property: keyof E, force?: boolean): void; - flagBinaryIndexesDirty(): void; + public getSequencedIndexValues(property: string): string; - flagBinaryIndexDirty(index: string): void; + public ensureUniqueIndex(field: keyof E): UniqueIndex; - count(query?: LokiQuery): number; - - /** Rebuild idIndex + /** + * Ensure all binary indices */ - ensureId(): void; + public ensureAllIndexes(force?: boolean): void; - /** Rebuild idIndex async with callback - useful for background syncing with a remote server + public flagBinaryIndexesDirty(): void; + + public flagBinaryIndexDirty(index: string): void; + + /** + * Quickly determine number of documents in collection (or query) + * @param [query] - (optional) query object to count results of + * @returns number of documents in the collection */ - ensureIdAsync(callback: () => void): void; + public count(query?: LokiQuery): number; - /** Each collection maintains a list of DynamicViews associated with it + /** + * Rebuild idIndex + */ + public ensureId(): void; + + /** + * Rebuild idIndex async with callback - useful for background syncing with a remote server + */ + public ensureIdAsync(callback: () => void): void; + + /** + * Add a dynamic view to the collection + * @param name - name of dynamic view to add + * @param [options] - options to configure dynamic view with + * @param [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' + * @param [options.sortPriority='passive'] - 'passive' (sorts performed on call to data) or 'active' (after updates) + * @param options.minRebuildInterval - minimum rebuild interval (need clarification to docs here) + * @returns reference to the dynamic view added + * @example + * var pview = users.addDynamicView('progeny'); + * pview.applyFind({'age': {'$lte': 40}}); + * pview.applySimpleSort('name'); + * + * var results = pview.data(); + */ + public addDynamicView(name: string, options?: Partial): DynamicView; + + /** + * Remove a dynamic view from the collection + * @param name - name of dynamic view to remove **/ - addDynamicView(name: string, options?: LokiDynamicViewOptions): LokiDynamicView; + public removeDynamicView(name: string): void; - removeDynamicView(name: string): void; + /** + * Look up dynamic view reference from within the collection + * @param name - name of dynamic view to retrieve reference of + * @returns A reference to the dynamic view with that name + **/ + public getDynamicView(name: string): DynamicView | null; - getDynamicView(name: string): LokiDynamicView; - - /** find and update: pass a filtering function to select elements to be updated - * and apply the updatefunctino to those elements iteratively + /** + * Applies a 'mongo-like' find query object and passes all results to an update function. + * For filter function querying you should migrate to [updateWhere()]{@link Collection#updateWhere}. + * + * @param filterObject - 'mongo-like' query object (or deprecated filterFunction mode) + * @param updateFunction - update function to run against filtered documents */ - findAndUpdate(filterFunction: (obj: E) => boolean, updateFunction: (obj: E) => E): void; + public findAndUpdate(filterObject: ((data: E) => boolean) | LokiQuery, updateFunction: (obj: E & LokiObj) => any): void; - /** generate document method - ensure object(s) have meta properties, clone it if necessary, etc. - * @param {object} doc: the document to be inserted (or an array of objects) - * @returns document or documents (if passed an array of objects) + /** + * Applies a 'mongo-like' find query object removes all documents which match that filter. + * + * @param filterObject - 'mongo-like' query object */ - insert(doc: E): E; - insert(doc: E[]): E[]; + public findAndRemove(filterObject?: LokiQuery): void; - /** generate document method - ensure object has meta properties, clone it if necessary, etc. - * @param {object} the document to be inserted + /** + * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc. + * @param doc - the document (or array of documents) to be inserted + * @returns document or documents inserted + * @example + * users.insert({ + * name: 'Odin', + * age: 50, + * address: 'Asgard' + * }); + * + * // alternatively, insert array of documents + * users.insert([{ name: 'Thor', age: 35}, { name: 'Loki', age: 30}]); + */ + public insert(doc: E): E | undefined; + public insert(doc: E[]): E[] | undefined; + public insert(doc: E | E[]): E | E[] | undefined; + public insert(doc: E | E[]): E | E[] | undefined; + + /** + * Adds a single object, ensures it has meta properties, clone it if necessary, etc. + * @param doc - the document to be inserted + * @param [bulkInsert] - quiet pre-insert and insert event emits * @returns document or 'undefined' if there was a problem inserting it */ - insertOne(doc: E): E; + public insertOne(doc: E, bulkInsert?: boolean): (E & LokiObj) | undefined; - clear(): void; - - /** Update method + /** + * Empties the collection. + * @param [options] - configure clear behavior + * @param [options.removeIndices] - (default: false) */ - update(doc: E): E; - update(doc: E[]): void; + public clear(options?: { removeIndices?: boolean }): void; - /** Add object to collection + /** + * Updates an object and notifies collection that the document has changed. + * @param doc - document to update within the collection */ - add(obj: E): E; + public update(doc: E): E; + public update(doc: E[]): void; + public update(doc: E | E[]): E | void; + public update(doc: E | E[]): E | void; - removeWhere(query: ((obj: E) => boolean) | LokiQuery): void; - - removeDataOnly(): void; - - /** delete wrapped + /** + * Add object to collection */ - remove(doc: E): E; - remove(doc: number): E; - remove(doc: number[]): void; - remove(doc: E[]): void; + public add(obj: E): E & LokiObj; + public add(obj: E & LokiObj): E & LokiObj; + + /** + * Applies a filter function and passes all results to an update function. + * + * @param filterFunction - filter function whose results will execute update + * @param updateFunction - update function to run against filtered documents + */ + public updateWhere(filterFunction: (data: E) => boolean, updateFunction: (obj: E & LokiObj) => any): void; + + /** + * Remove all documents matching supplied filter function. + * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}. + * @param query - query object to filter on + */ + public removeWhere(query: ((value: E, index: number, array: E[]) => boolean) | LokiQuery): void; + + public removeDataOnly(): void; + + /** + * Remove a document from the collection + * @param doc - document to remove from collection + */ + public remove(doc: number | E): E | null; + public remove(doc: number[] | E[]): void; + public remove(doc: number | E | number[] | E[]): E | null | void; + public remove(doc: number | E | number[] | E[]): E | null | void; /*---------------------+ | Finding methods | +----------------------*/ - /** Get by Id - faster than other methods because of the searching algorithm + /** + * Get by Id - faster than other methods because of the searching algorithm + * @param id - $loki id of document you want to retrieve + * @param returnPosition - if 'true' we will return [object, position] + * @returns Object reference if document was found, null if not, + * or an array if 'returnPosition' was passed. */ - get(id: number | string): E; - get(id: number | string, returnPosition?: boolean): E | [E, number]; + public get(id: number): E & LokiObj; + public get(id: number, returnPosition: true): [E & LokiObj, number]; + public get(id: number, returnPosition?: boolean): (E & LokiObj) | [E & LokiObj, number] | null; - by(field: string): (value: any) => E; - by(field: string, value: string): E; - - /** Find one object by index property, by property equal to value + /** + * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value + * Since multiple documents may contain the same value (which the index is sorted on), + * we hone in on range and then linear scan range to find exact index array position. + * @param dataPosition : coll.data array index/position + * @param binaryIndexName : index to search for dataPosition in */ - findOne(query: LokiQuery): E; + public getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof E): number | null; - /** Chain method, used for beginning a series of chained find() and/or view() operations + /** + * Adaptively insert a selected item to the index. + * @param dataPosition : coll.data array index/position + * @param binaryIndexName : index to search for dataPosition in + */ + public adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof E): void; + + /** + * Adaptively update a selected item within an index. + * @param dataPosition : coll.data array index/position + * @param binaryIndexName : index to search for dataPosition in + */ + public adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof E): void; + + /** + * Adaptively remove a selected item from the index. + * @param dataPosition : coll.data array index/position + * @param binaryIndexName : index to search for dataPosition in + */ + public adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof E, removedFromIndexOnly?: boolean): void; + + /** + * Internal method used for index maintenance and indexed searching. + * Calculates the beginning of an index range for a given value. + * For index maintainance (adaptive:true), we will return a valid index position to insert to. + * For querying (adaptive:false/undefined), we will : + * return lower bound/index of range of that value (if found) + * return next lower index position if not found (hole) + * If index is empty it is assumed to be handled at higher level, so + * this method assumes there is at least 1 document in index. + * + * @param prop - name of property which has binary index + * @param val - value to find within index + * @param [adaptive] - if true, we will return insert position + */ + public calculateRangeStart(prop: keyof E, val: any, adaptive?: boolean): number; + + /** + * Internal method used for indexed $between. Given a prop (index name), and a value + * (which may or may not yet exist) this will find the final position of that upper range value. + */ + public calculateRangeEnd(prop: keyof E, val: any): number; + + /** + * calculateRange() - Binary Search utility method to find range/segment of values matching criteria. + * this is used for collection.find() and first find filter of resultset/dynview + * slightly different than get() binary search in that get() hones in on 1 value, + * but we have to hone in on many (range) + * @param op - operation, such as $eq + * @param prop - name of property to calculate range for + * @param val - value to use for range calculation. + * @returns [start, end] index array positions + */ + public calculateRange(op: ("$eq" | "$aeq" | "$dteq" | "$gt" | "$gte" | "$lt" | "$lte" | "$between" | "$in"), prop: keyof E, val: any): number[]; + + /** + * Retrieve doc by Unique index + * @param field - name of uniquely indexed property to use when doing lookup + * @param value - unique value to search for + * @returns document matching the value passed + */ + public by(field: keyof E): (value: any) => E | undefined; + public by(field: keyof E, value: any): E | undefined; + public by(field: keyof E, value?: any): E | ((value: any) => E | undefined) | undefined; + public by(field: keyof E, value?: any): E | ((value: any) => E | undefined) | undefined; + + /** + * Find one object by index property, by property equal to value + * @param query - query object used to perform search with + * @returns First matching document, or null if none + */ + public findOne(query?: LokiQuery): (E & LokiObj) | null; + + /** + * Chain method, used for beginning a series of chained find() and/or view() operations * on a collection. * - * @param {array} transform : Ordered array of transform step objects similar to chain - * @param {object} parameters: Object containing properties representing parameters to substitute - * @returns {Resultset} : (or data array if any map or join functions where called) + * @param [transform] - Ordered array of transform step objects similar to chain + * @param [parameters] - Object containing properties representing parameters to substitute + * @returns (this) resultset, or data array if any map or join functions where called */ - chain(transform?: string | any[], parameters?: any): LokiResultset; + public chain(): Resultset; + public chain(transform?: string | string[] | Transform[], parameters?: object): Resultset; /** - * Find method, api is similar to mongodb except for now it only supports one search parameter. - * for more complex queries use view() and storeView() + * Find method, api is similar to mongodb. + * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}. + * @example {@tutorial Query Examples} + * @param query - 'mongo-like' query object + * @returns Array of matching documents */ - find(): E[]; - find(query: LokiQuery): LokiResultset; + public find(query?: LokiQuery): (E & LokiObj)[]; - /** Find object by unindexed field by property equal to value, + /** + * Find object by unindexed field by property equal to value, * simply iterates and returns the first element matching the query */ - findOneUnindexed(prop: string, value: any): E; - - /** Transaction methods */ - - /** start the transation */ - startTransaction(): void; - - /** commit the transation */ - commit(): void; - - /** roll back the transation */ - rollback(): void; - - // async executor. This is only to enable callbacks at the end of the execution. - async(fun: () => void, callback: () => void): void; - - /** Create view function - filter - */ - where(fun: (obj: E) => boolean): LokiResultset; - - /** Map Reduce - */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => U, reduceFunction: (array: U[]) => V): V; - - /** eqJoin - Join two collections on specified properties - */ - eqJoin(joinData: T[] | LokiResultset, leftJoinProp: string | ((obj: E) => string), rightJoinProp: string | ((obj: T) => string)): LokiResultset<{ left: E; right: T; }>; - eqJoin(joinData: T[] | LokiResultset, leftJoinProp: string | ((obj: E) => string), rightJoinProp: string | ((obj: T) => string), mapFun?: (a: E, b: T) => U): LokiResultset; - - /* ------ STAGING API -------- */ - /** stages: a map of uniquely identified 'stages', which hold copies of objects to be - * manipulated without affecting the data in the original collection - */ - stages: { [id: string]: any }; - - /** create a stage and/or retrieve it - */ - getStage(name: string): E[]; - - /** a collection of objects recording the changes applied through a commmitStage - */ - commitLog: { - timestamp: number; // timestamp (i.e. new Date().getTime()) - message: any; - data: E; - }[]; - - /** create a copy of an object and insert it into a stage - */ - stage(stageName: string, obj: E): E; - - /** re-attach all objects to the original collection, so indexes and views can be rebuilt - * then create a message to be inserted in the commitlog - */ - commitStage(stageName: string, message: any): void; - - no_op(): void; - - extract(field: string): any[]; - - max(field: string): number; - - min(field: string): number; - - maxRecord(field: string): { index: number; value: any; }; - - minRecord(field: string): { index: number; value: any; }; - - extractNumerical(field: string): number[]; - - avg(field: string): number; - - stdDev(field: string): number; - - mode(field: string): string | number; - - median(field: string): number; -} - - - - -/** comparison operators - * a is the value in the collection - * b is the query value - */ -interface LokiOps { - $eq(a: any, b: any): boolean; - $ne(a: any, b: any): boolean; - $dteq(a: any, b: any): boolean; - $gt(a: any, b: any): boolean; - $gte(a: any, b: any): boolean; - $lt(a: any, b: any): boolean; - $lte(a: any, b: any): boolean; - $in(a: any, b: { indexOf: (value: any) => boolean }): boolean; - $nin(a: any, b: { indexOf: (value: any) => boolean }): boolean; - $keyin(a: string, b: any): boolean; - $nkeyin(a: string, b: any): boolean; - $definedin(a: any, b: any): boolean; - $undefinedin(a: any, b: any): boolean; - $regex(a: any, b: RegExp | { test: (str: string) => boolean }): boolean; - $containsString(a: string | any, b: string): boolean; - $containsNone(a: any, b: any): boolean; - $containsAny(a: any, b: any | any[]): boolean; - $contains(a: any, b: any | any[]): boolean; - $type(a: any, b: any): boolean; - $size(a: any, b: any): boolean; - $len(a: any, b: any): boolean; - // field-level logical operators - // a is the value in the collection - // b is the nested query operation (for '$not') - // or an array of nested query operations (for '$and' and '$or') - $not(a: any, b: any): boolean; - $and(a: any, b: any[]): boolean; - $or(a: any, b: any[]): boolean; -} - - -interface LokiKeyValueStore { - keys: K[]; - values: V[]; - - sort(a: any, b: any): number; - setSort(fun: (a: K, b: K) => number): void; - bs(): LokiBSonSort; - set(key: K, value: V): void; - get(key: K): V; -} - - -interface LokiUniqueIndex { - field: string; - keyMap: { [id: string]: E }; - lokiMap: { [id: number]: any }; - - new (uniqueField: string): LokiUniqueIndex; - - set(obj: E): void; - get(key: string): E; - byId(id: number): E; - update(obj: E): void; - remove(key: string): void; - clear(): void; -} - - -interface LokiExactIndex { - index: { [id: string]: E[] }; - field: string; - - new (exactField: string): LokiExactIndex - - /** add the value you want returned to the key in the index */ - set(key: string, val: E): void; - /** remove the value from the index, if the value was the last one, remove the key */ - remove(key: string, val: E): void; - /** get the values related to the key, could be more than one */ - get(key: string): E[]; - /** clear will zap the index */ - clear(key?: any): void; -} - - -interface LokiSortedIndex { - field: string; - keys: K[]; - values: V[][]; - - new (sortedField: string): LokiSortedIndex; - - // set the default sort - sort(a: any, b: any): number; - bs(): LokiBSonSort; - // and allow override of the default sort - setSort(fun: (a: any, b: any) => number): void; - // add the value you want returned to the key in the index - set(key: K, value: V): void; - // get all values which have a key == the given key - get(key: K): V[]; - // get all values which have a key < the given key - getLt(key: K): V[]; - // get all values which have a key > the given key - getGt(key: K): V[]; - // get all vals from start to end - getAll(key: K, start: number, end: number): V[]; - // just in case someone wants to do something smart with ranges - getPos(key: K): { found: boolean; index: number; }; - // remove the value from the index, if the value was the last one, remove the key - remove(key: K, value: V): void; - // clear will zap the index - clear(): void; -} - - -interface LokiConfigureOptions { - adapter?: LokiPersistenceInterface; - autoload?: boolean; - autoloadCallback?: (dataOrErr: any | Error) => void; - autosave?: boolean; - autosaveCallback?: (err: any) => void; - autosaveInterval?: number; // milliseconds between auto-saves - env?: string; /*'NODEJS', 'BROWSER', 'CORDOVA'*/ - persistenceMethod?: string; /*'fs', 'localStorage', 'adapter'*/ - verbose?: boolean; -} - - -interface LokiCollectionOptions { - asyncListeners?: boolean; - autoupdate?: boolean; - clone?: boolean; - cloneMethod?: string; - disableChangesApi?: boolean; - exact?: string[]; - indices?: string | string[]; - transactional?: boolean; - unique?: string | string[]; -} - - -interface LokiDynamicViewOptions { - minRebuildInterval?: number; - persistent?: boolean; - sortPriority: string; /*'active', 'passive'*/ -} - - -interface LokiResultsetOptions { - firstOnly?: boolean; - queryObj?: LokiQuery; - queryFunc?: (item: E) => boolean; -} - - -interface LokiQuery { -} - - -interface LokiFilter { - type: string; /*'find', 'where'*/ - val: LokiQuery | ((obj: E, index: number, array: E[]) => boolean); - uid: number | string; -} - - -interface LokiElementMetaData { - created: number; // unix style timestamp (i.e. new Date().getTime()) - revision: number; -} - - -interface LokiCollectionChange { - name: string; - operation: string;/*'I', 'R', 'U'*/ - obj: any; -} - - -interface LokiBSonSort { - (fun: (a: T, b: T) => number): (array: T[], item: T) => { found: boolean; index: number; }; -} - - -/* -interface LokiUtils { - copyProperties(src: any, dest: any): void; - - // used to recursively scan hierarchical transform step object for param substitution - resolveTransformObject(subObj: U, params: any, depth?: number): U; - - // top level utility to resolve an entire (single) transform (array of steps) for parameter substitution - resolveTransformParams(transform: U[], params: any): U[]; -} - -// Sort helper that support null and undefined -declare function ltHelper(prop1: any, prop2: any, equal?: boolean): boolean; - -declare function gtHelper(prop1: any, prop2: any, equal?: boolean): boolean; - -declare function sortHelper(prop1: any, prop2: any, desc?: boolean): number; - -declare function doQueryOp(val: any, op: any): boolean; - -declare function containsCheckFn(a: T[], b): (curr: T) => boolean; -declare function containsCheckFn(a: string, b): (curr: string) => boolean; -declare function containsCheckFn(a: T, b): (curr: string) => boolean; -*/ - -/** General utils, including statistical functions - */ -/* -declare function isDeepProperty(field: string): boolean; - -declare function parseBase10(num: string | number): number; - -declare function isNotUndefined(obj: any): boolean; - -declare function add(a: string | number, b: string | number): number; - -declare function sub(a: string | number, b: string | number): number; - -declare function median(values: number[]): number; - -declare function average(array: (string | number)[]); - -declare function standardDeviation(values: (string | number)[]): number; - -declare function deepProperty(obj: any, property: string, isDeep?: boolean): any; - -declare function binarySearch(array: U[], item: U, fun: (a: U, b: U) => number): { found: boolean; index: number; }; - -// compoundeval() - helper function for compoundsort(), performing individual object comparisons -// -// @param {array} properties - array of property names, in order, by which to evaluate sort order -// @param {object} obj1 - first object to compare -// @param {object} obj2 - second object to compare -// @returns {integer} 0, -1, or 1 to designate if identical (sortwise) or which should be first -declare function compoundeval(properties: ([string, boolean] | [string])[], obj1: any, obj2: any): number; - -// dotSubScan - helper function used for dot notation queries. -declare function dotSubScan(root: any | any[], propPath: string[], fun: (root, value: V) => boolean, value: V): boolean; - -// making indexing opt-in... our range function knows how to deal with these ops : -//var indexedOpsList = ['$eq', '$dteq', '$gt', '$gte', '$lt', '$lte']; - -declare function clone(data: U, method?: string): U; // stage: 'parse-stringify', 'jquery-extend-deep', 'shallow' - -declare function cloneObjectArray(objarray: U[], method?: string): U; // stage: 'parse-stringify', 'jquery-extend-deep', 'shallow' - -declare function localStorageAvailable(): boolean; -*/ - - - - -/* ======== loki-indexed-adapter.js ======== */ -interface LokiIndexedAdapter { - app: string; - catalog: LokiCatalog; - - /** IndexedAdapter - Loki persistence adapter class for indexedDb. - * This class fulfills abstract adapter interface which can be applied to other storage methods - * Utilizes the included LokiCatalog app/key/value database for actual database persistence. - * @param {string} appname - Application name context can be used to distinguish subdomains or just 'loki' - */ - new (appname: string): LokiIndexedAdapter; - - /** checkAvailability - used to check if adapter is available - * @returns {boolean} true if indexeddb is available, false if not. - */ - checkAvailability(): boolean; - - /** loadDatabase() - Retrieves a serialized db string from the catalog. - * @param {string} dbname - the name of the database to retrieve. - * @param {function} callback - callback should accept string param containing serialized db string. - */ - loadDatabase(dbname: string, callback?: (data: any) => void): void; - - // alias for loadDatabase - loadKey(dbname: string, callback?: (data: any) => void): void; - - /** saveDatabase() - Saves a serialized db to the catalog. - * @param {string} dbname - the name to give the serialized database within the catalog. - * @param {string} dbstring - the serialized db string to save. - * @param {function} callback - (Optional) callback passed obj.success with true or false - */ - saveDatabase(dbname: string, dbstring: string, callback?: (err: Error | void) => void): void; - - // alias for saveDatabase - saveKey(dbname: string, dbstring: string, callback?: (err: Error | void) => void): void; - - /** deleteDatabase() - Deletes a serialized db from the catalog. - * @param {string} dbname - the name of the database to delete from the catalog. - */ - deleteDatabase(dbname: string): void; - - // alias for deleteDatabase - deleteKey(dbname: string): void; - - /** getDatabaseList() - Retrieves object array of catalog entries for current app. - * @param {function} callback - should accept array of database names in the catalog for current app. - */ - getDatabaseList(callback: (names: string[]) => void): void; - - // alias for getDatabaseList - getKeyList(callback: (names: string[]) => void): void; - - /** getCatalogSummary - allows retrieval of list of all keys in catalog along with size - * @param {function} callback - (Optional) callback to accept result array. - */ - getCatalogSummary(callback: (entries: { app: string; key: string; size: number; }) => void): void; -} - - -/** LokiCatalog - underlying App/Key/Value catalog persistence - * This non-interface class implements the actual persistence. - * Used by the IndexedAdapter class. - */ -interface LokiCatalog { - db: IDBDatabase; - - new (callback: (cat: LokiCatalog) => void): LokiCatalog; - - initializeLokiCatalog(callback: (cat: LokiCatalog) => void): void; - - getAppKey(app: string, key: string, callback: (resObj: any) => void): void; - - getAppKeyById(id: any, callback: (result: any, data: T) => void, data: T): void; - - setAppKey(app: string, key: string, val: any, callback: (res: { success: boolean }) => void): void; - - deleteAppKey(id: any, callback: (res: { success: boolean; }) => void): void; - - getAppKeys(app: string, callback: (data: any[]) => void): void; - - // Hide 'cursoring' and return array of { id: id, key: key } - getAllKeys(callback: (data: any[]) => void): void; -} -/* ======== END loki-indexed-adapter.js ======== */ - - - -/* ======== loki-crypted-file-adapter.js ======== */ -/** - * @file lokiCryptedFileAdapter.js - * @author Hans Klunder - */ - -/** require libs */ -//var fs = require('fs'); -//var cryptoLib = require('crypto'); -//var isError = require('util').isError; - -/* The default Loki File adapter uses plain text JSON files. This adapter crypts the database string and wraps the result -* in a JSON including enough info to be able to decrypt it (except for the 'secret' of course !) -* -* The idea is that the 'secret' does not reside in your source code but is supplied by some other source (e.g. the user in node-webkit) -* -* The idea + encrypt/decrypt routines are borrowed from https://github.com/mmoulton/krypt/blob/develop/lib/krypt.js -* not using the krypt module to avoid third party dependencies -*/ -interface LokiCryptedFileAdapter { - secret: string; - - /** The constructor is automatically called on `require` , see examples below - * @constructor - */ - new (): LokiCryptedFileAdapter; - - /** setSecret() - set the secret to be used during encryption and decryption - * - * @param {string} secret - the secret to be used - */ - setSecret(secret: string): void; - - /** loadDatabase() - Retrieves a serialized db string from the catalog. - * - * @example - // LOAD - var cryptedFileAdapter = require('./lokiCryptedFileAdapter'); - cryptedFileAdapter.setSecret('mySecret'); // you should change 'mySecret' to something supplied by the user - var db = new loki('test.crypted', { adapter: cryptedFileAdapter }); //you can use any name, not just '*.crypted' - db.loadDatabase(function(result) { - console.log('done'); - }); - * - * @param {string} dbname - the name of the database to retrieve. - * @param {function} callback - callback should accept string param containing serialized db string. - */ - loadDatabase(dbname: string, callback: (decryptedDataOrErr: string | any) => void): void; + public findOneUnindexed(prop: keyof E, value: any): (E & LokiObj) | null; /** - * - @example - // SAVE : will save database in 'test.crypted' - var cryptedFileAdapter = require('./lokiCryptedFileAdapter'); - cryptedFileAdapter.setSecret('mySecret'); // you should change 'mySecret' to something supplied by the user - var loki=require('lokijs'); - var db = new loki('test.crypted',{ adapter: cryptedFileAdapter }); //you can use any name, not just '*.crypted' - var coll = db.addCollection('testColl'); - coll.insert({test: 'val'}); - db.saveDatabase(); // could pass callback if needed for async complete - - @example - // if you have the krypt module installed you can use: - krypt --decrypt test.crypted --secret mySecret - to view the contents of the database - - * saveDatabase() - Saves a serialized db to the catalog. - * - * @param {string} dbname - the name to give the serialized database within the catalog. - * @param {string} dbstring - the serialized db string to save. - * @param {function} callback - (Optional) callback passed obj.success with true or false + * Transaction methods */ - saveDatabase(dbname: string, dbstring: string, callback: (err: any) => void): void; + + /** start the transation */ + public startTransaction(): void; + + /** commit the transation */ + public commit(): void; + + /** roll back the transation */ + public rollback(): void; + + // async executor. This is only to enable callbacks at the end of the execution. + public async(fun: () => void, callback: () => void): void; + + /** + * Query the collection by supplying a javascript filter function. + * @example + * var results = coll.where(function(obj) { + * return obj.legs === 8; + * }); + * + * @param fun - filter function to run against all collection docs + * @returns all documents which pass your filter function + */ + public where(fun: (data: E) => boolean): (E & LokiObj)[]; + + /** + * Map Reduce operation + * + * @param mapFunction - function to use as map function + * @param reduceFunction - function to use as reduce function + * @returns The result of your mapReduce operation + */ + public mapReduce(mapFunction: (value: E, index: number, array: E[]) => U, reduceFunction: (ary: U[]) => R): R; + + /** + * Join two collections on specified properties + * + * @param joinData - array of documents to 'join' to this collection + * @param leftJoinProp - property name in collection + * @param rightJoinProp - property name in joinData + * @param mapFun - (Optional) map function to use + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * @returns Result of the mapping operation + */ + public eqJoin( + joinData: Collection | Resultset | any[], + leftJoinProp: string | ((obj: any) => string), + rightJoinProp: string | ((obj: any) => string), + mapFun?: (left: any, right: any) => any, + dataOptions?: Partial + ): Resultset; + + /* ------ STAGING API -------- */ + /** + * stages: a map of uniquely identified 'stages', which hold copies of objects to be + * manipulated without affecting the data in the original collection + */ + public stages: { [name: string]: any }; + + /** + * (Staging API) create a stage and/or retrieve it + */ + public getStage(name: string): any; + + /** + * a collection of objects recording the changes applied through a commmitStage + */ + public commitLog: { timestamp: number; message: string; data: any }[]; + + + /** + * (Staging API) create a copy of an object and insert it into a stage + */ + public stage(stageName: string, obj: F): F; + + /** + * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt + * then create a message to be inserted in the commitlog + * @param stageName - name of stage + * @param message + */ + public commitStage(stageName: string, message: string): void; + + public no_op: () => void; + + public extract(field: string): any[]; + + public max(field: string): number; + + public min(field: string): number; + + public maxRecord(field: string): { index: number; value: any }; + + public minRecord(field: string): { index: number; value: any }; + + public extractNumerical(field: string): number[]; + + /** + * Calculates the average numerical value of a property + * + * @param field - name of property in docs to average + * @returns average of property in all docs in the collection + */ + public avg(field: string): number; + + /** + * Calculate standard deviation of a field + * @param field + */ + public stdDev(field: string): number; + + /** + * @param field + */ + public mode(field: string): string | undefined; + + /** + * @param field - property name + */ + public median(field: string): number; } -interface LokiCryptedFileAdapterEncryptResult { - cipher: string; - keyDerivation: string; - keyLength: number; - iterations: number; - iv: string; - salt: string; - value: string; + +declare class KeyValueStore { + keys: any[]; + values: any[]; + + constructor(); + + public sort(a: any, b: any): -1 | 0 | 1; + + public setSort(fun: (target: any, test: any) => any): void; + + public bs(): (array: any[], item: any) => { found: boolean; index: number }; + + public set(key: any, value: any): void; + + public get(key: any): any[]; } -/* ======== END loki-crypted-file-adapter.js ======== */ +declare class UniqueIndex { + field: keyof E; + keyMap: { [fieldValue: string]: E/*{ $loki: number }*/ | undefined }; + lokiMap: { [$loki: number]: string | number | undefined }; -/* ======== loki-angular.js ======== */ -/* introduces a angular module named lokijs that returns the 'lokijs' module - var module = angular.module('lokijs', []) - .factory('Loki', function Loki() { - return lokijs; - }); - return module; -*/ -/* ======== END loki-angular.js ======== */ + constructor(uniqueField: keyof E); + + public set(obj: E/*{ $loki: number }*/): void; + + public get(key: string | number): E | undefined; + + public byId(id: number): E | undefined; + + /** + * Updates a document's unique index given an updated object. + * @param {Object} obj Original document object + * @param {Object} doc New document object (likely the same as obj) + */ + public update(obj: E/*{ $loki: number }*/, doc: any): void; + + public remove(key: string): void; + + public clear(): void; +} +declare class ExactIndex { + field: keyof E; + index: { [key: string]: E[] | undefined }; -/* ======== jquery-sync-adapter.js ======== */ + constructor(exactField: keyof E); -/** LokiJS JquerySyncAdapter - * A remote sync adapter example for LokiJS + // add the value you want returned to the key in the index + public set(key: string | number, val: E): void; + + // remove the value from the index, if the value was the last one, remove the key + public remove(key: string | number, val: E): void; + + // get the values related to the key, could be more than one + public get(key: string | number): E[] | undefined; + + // clear will zap the index + public clear(key?: null): void; +} + + + +declare class SortedIndex { + field: string; + keys: any[]; + values: any[]; + + constructor(sortedField: string); + + // set the default sort + public sort(a: any, b: any): -1 | 0 | 1; + + public bs(): (array: any[], item: any) => { found: boolean; index: number }; + + // and allow override of the default sort + public setSort(fun: (target: any, test: any) => number): void; + + // add the value you want returned to the key in the index + public set(key: any, value: any): void; + + // get all values which have a key == the given key + public get(key: any): any[]; + + // get all values which have a key < the given key + public getLt(key: any): any[]; + + // get all values which have a key > the given key + public getGt(key: any): any[]; + + // get all vals from start to end + public getAll(key: any, start: number, end: number): any[]; + + // just in case someone wants to do something smart with ranges + public getPos(key: any): { found: boolean; index: number }; + + // remove the value from the index, if the value was the last one, remove the key + public remove(key: any, value: any): void; + + // clear will zap the index + public clear(): void; +} + + +// type aliases to allow the nested classes inside LokiConstructor to extend classes sharing them same name(s) as themselves +declare class _Collection extends Collection { } +declare class _KeyValueStore extends KeyValueStore { } +declare class _LokiMemoryAdapter extends LokiMemoryAdapter { } +declare class _LokiPartitioningAdapter extends LokiPartitioningAdapter { } +declare class _LokiLocalStorageAdapter extends LokiLocalStorageAdapter { } +declare class _LokiFsAdapter extends LokiFsAdapter { } + + +/** + * LokiJS + * A lightweight document oriented javascript database * @author Joe Minichino */ - -/** this adapter assumes an object options is passed, - * containing the following properties: - * ajaxLib: jquery or compatible ajax library - * save: { url: the url to save to, dataType [optional]: json|xml|etc., type [optional]: POST|GET|PUT} - * load: { url: the url to load from, dataType [optional]: json|xml| etc., type [optional]: POST|GET|PUT } - */ -interface LokiJquerySyncAdapter { - options: LokiJquerySyncAdapterOptions - - new (options: LokiJquerySyncAdapterOptions): LokiJquerySyncAdapter; - - saveDatabase(name: string, data: any, callback?: (data: any, textStatus: string, xhr: XMLHttpRequest) => any): void; - - loadDatabase(name: string, callback?: (data: any, textStatus: string, xhr: XMLHttpRequest) => any): void; +declare class LokiConstructor extends Loki { + constructor(filename: string, options?: Partial & Partial & Partial); } - - -interface LokiJquerySyncAdapterOptions { - ajaxLib: { ajax(options: any): any; }; - save: { - url: any; - type?: string; /*'GET', 'POST, 'DELETE', etc.*/ - dataType?: string; /*'json', 'xml', etc.*/ +declare module LokiConstructor { + export var persistenceAdapters: { + fs: _LokiFsAdapter, + localStorage: _LokiLocalStorageAdapter }; - load: { - url: any; - type?: string; /*'GET', 'POST, 'DELETE', etc.*/ - dataType?: string; /*'json', 'xml', etc.*/ - }; -} + export function aeq(prop1: any, prop2: any): boolean; -interface LokiJquerySyncAdapterError extends Error { - name: string; // "JquerySyncAdapterError" - message: any; + function lt(prop1: any, prop2: any, equal?: boolean): boolean; - new (message: any): LokiJquerySyncAdapterError; -} -/* ======== END jquery-sync-adapter.js ======== */ + function gt(prop1: any, prop2: any, equal?: boolean): boolean; + export var LokiOps: LokiOps; -declare var LokiCryptedFileAdapterConstructor: { - new (): LokiCryptedFileAdapter; -} + export class Collection extends _Collection { } -declare module "lokiCryptedFileAdapter" { - export = LokiCryptedFileAdapterConstructor; -} + export class KeyValueStore extends _KeyValueStore { } + export class LokiMemoryAdapter extends _LokiMemoryAdapter { } -declare var LokiIndexedAdapterConstructor: { - new (filename: string): LokiIndexedAdapter; -} + export class LokiPartitioningAdapter extends _LokiPartitioningAdapter { } -declare module "loki-indexed-adapter" { - export = LokiIndexedAdapterConstructor; -} + export class LokiLocalStorageAdapter extends _LokiLocalStorageAdapter { } - -declare var LokiConstructor: { - new (filename: string, options?: LokiConfigureOptions): Loki; - LokiOps: LokiOps; - Collection: LokiCollection; - KeyValueStore: LokiKeyValueStore; + export class LokiFsAdapter extends _LokiFsAdapter { } } declare module "lokijs" { diff --git a/types/lokijs/lokijs-tests.ts b/types/lokijs/lokijs-tests.ts index 2e08370c02..167adba4ad 100644 --- a/types/lokijs/lokijs-tests.ts +++ b/types/lokijs/lokijs-tests.ts @@ -37,10 +37,10 @@ class QueenAnt extends Ant { class AntColony { - ants: LokiCollection; - queens: LokiCollection; + ants: Loki.Collection; + queens: Loki.Collection; - constructor(ants?: LokiCollection, queens?: LokiCollection) { + constructor(ants: Loki.Collection, queens: Loki.Collection) { this.ants = ants; this.queens = queens; } diff --git a/types/lokijs/tsconfig.json b/types/lokijs/tsconfig.json index bd01821699..96175c28a4 100644 --- a/types/lokijs/tsconfig.json +++ b/types/lokijs/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ From af67c5568da60edc26bd989cfb29a00a41253aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Sat, 25 Nov 2017 23:54:25 +0100 Subject: [PATCH 145/269] Changing leaflet dependency handling --- types/leaflet.heat/index.d.ts | 7 ++++--- types/leaflet.heat/leaflet.heat-tests.ts | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/types/leaflet.heat/index.d.ts b/types/leaflet.heat/index.d.ts index 66464fcb08..f294080691 100644 --- a/types/leaflet.heat/index.d.ts +++ b/types/leaflet.heat/index.d.ts @@ -1,12 +1,12 @@ -// Type definitions for Leaflet.heat v0.2.0 +// Type definitions for Leaflet.heat 0.2 // Project: https://github.com/Leaflet/Leaflet.heat // Definitions by: Önder Ceylan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// +import * as L from 'leaflet'; -declare namespace L { +declare module 'leaflet' { type HeatLatLngTuple = [number, number, number]; interface ColorGradientConfig { @@ -26,6 +26,7 @@ declare namespace L { setOptions(options: HeatMapOptions): HeatLayer; addLatLng(latlng: LatLng | HeatLatLngTuple): HeatLayer; setLatLngs(latlngs: Array): HeatLayer; + redraw(): TileLayer; } function heatLayer(latlngs: Array, options: HeatMapOptions): HeatLayer; diff --git a/types/leaflet.heat/leaflet.heat-tests.ts b/types/leaflet.heat/leaflet.heat-tests.ts index aead8f1960..cbad005d8d 100644 --- a/types/leaflet.heat/leaflet.heat-tests.ts +++ b/types/leaflet.heat/leaflet.heat-tests.ts @@ -1,11 +1,14 @@ -const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - osmAttrib = '© OpenStreetMap contributors', - osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}), - map = new L.Map('map', { - layers: [osm], - center: new L.LatLng(50.5, 30.5), - zoom: 15, - }); +import * as L from 'leaflet'; +import 'leaflet.heat'; + +const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; +const osmAttrib = '© OpenStreetMap contributors'; +const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}); +const map = new L.Map('map', { + layers: [osm], + center: new L.LatLng(50.5, 30.5), + zoom: 15, +}); // Each point in the input array can be either an array like [50.5, 30.5, 0.5], or a Leaflet LatLng object. const heat: L.HeatLayer = L.heatLayer([ From 13891ce131f28462078c4f16aed3e1370c0ff241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96nder=20Ceylan?= Date: Sat, 25 Nov 2017 23:59:34 +0100 Subject: [PATCH 146/269] Fixed failing tests --- types/leaflet.heat/index.d.ts | 1 - types/leaflet.heat/leaflet.heat-tests.ts | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/leaflet.heat/index.d.ts b/types/leaflet.heat/index.d.ts index f294080691..224b6f7c35 100644 --- a/types/leaflet.heat/index.d.ts +++ b/types/leaflet.heat/index.d.ts @@ -26,7 +26,6 @@ declare module 'leaflet' { setOptions(options: HeatMapOptions): HeatLayer; addLatLng(latlng: LatLng | HeatLatLngTuple): HeatLayer; setLatLngs(latlngs: Array): HeatLayer; - redraw(): TileLayer; } function heatLayer(latlngs: Array, options: HeatMapOptions): HeatLayer; diff --git a/types/leaflet.heat/leaflet.heat-tests.ts b/types/leaflet.heat/leaflet.heat-tests.ts index cbad005d8d..b715255e78 100644 --- a/types/leaflet.heat/leaflet.heat-tests.ts +++ b/types/leaflet.heat/leaflet.heat-tests.ts @@ -32,7 +32,12 @@ const newLatLng = new L.LatLng(50.8, 30.2); heat.addLatLng(newLatLng); // Set new latLng list to the heat layer -heat.setLatLngs([newLatLng, newLatLng, newLatLng, [50.6, 30.4, 0.5],]); +heat.setLatLngs([ + newLatLng, + newLatLng, + newLatLng, + [50.6, 30.4, 0.5], +]); // Redraw the heat layer heat.redraw(); From ef1bff7d81423e45b07c5dcc93c526944ea148de Mon Sep 17 00:00:00 2001 From: Guangda Zhang Date: Sat, 25 Nov 2017 20:56:09 -0800 Subject: [PATCH 147/269] optional third parameters --- types/ember-data/index.d.ts | 4 ++-- types/ember-data/test/adapter.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index 35a291634b..758b7fbde1 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -1035,11 +1035,11 @@ declare namespace DS { /** * Takes a URL, an HTTP method and a hash of data, and makes an HTTP request. */ - ajax(url: string, type: string, options: object): Promise; + ajax(url: string, type: string, options?: object): Promise; /** * Generate ajax options */ - ajaxOptions(url: string, type: string, options: object): object; + ajaxOptions(url: string, type: string, options?: object): object; /** * By default, the RESTAdapter will send the query params sorted alphabetically to the * server. diff --git a/types/ember-data/test/adapter.ts b/types/ember-data/test/adapter.ts index b8d0bed62f..5d9d45fd4b 100644 --- a/types/ember-data/test/adapter.ts +++ b/types/ember-data/test/adapter.ts @@ -44,3 +44,13 @@ const UseAjaxOptions = DS.JSONAPIAdapter.extend({ }); } }); + +const UseAjaxOptionsWithOptionalThirdParams = DS.JSONAPIAdapter.extend({ + query(store: DS.Store, type: string, query: object) { + const url = 'https://api.example.com/my-api'; + const options = this.ajaxOptions(url, 'DELETE'); + return Ember.$.ajax(url, { + ...options + }); + } +}); From f46fe2c18b0d5e5c7a0d62ca6ba8ba7452239b51 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Sun, 26 Nov 2017 07:38:07 +0100 Subject: [PATCH 148/269] feat(commander): remove types --- notNeededPackages.json | 6 + types/commander/commander-tests.ts | 99 ---------- types/commander/index.d.ts | 299 ----------------------------- types/commander/tsconfig.json | 23 --- types/commander/tslint.json | 79 -------- 5 files changed, 6 insertions(+), 500 deletions(-) delete mode 100644 types/commander/commander-tests.ts delete mode 100644 types/commander/index.d.ts delete mode 100644 types/commander/tsconfig.json delete mode 100644 types/commander/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 306865851b..671f8d9d65 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -132,6 +132,12 @@ "sourceRepoURL": "https://github.com/mapbox/cheap-ruler", "asOfVersion": "2.5.0" }, + { + "libraryName": "commander", + "typingsPackageName": "commander", + "sourceRepoURL": "https://github.com/tj/commander.js", + "asOfVersion": "2.12.0" + }, { "libraryName": "constant-case", "typingsPackageName": "constant-case", diff --git a/types/commander/commander-tests.ts b/types/commander/commander-tests.ts deleted file mode 100644 index 46aa77d92c..0000000000 --- a/types/commander/commander-tests.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as program from 'commander'; - -interface ExtendedOptions extends program.CommandOptions { - isNew: any; -} - -const commandInstance = new program.Command('-f'); -const optionsInstance = new program.Option('-f'); - -const name = program.name(); - -program - .name('set name') - .version('0.0.1') - .option('-p, --peppers', 'Add peppers') - .option('-P, --pineapple', 'Add pineapple') - .option('-b, --bbq', 'Add bbq sauce') - .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') - .parse(process.argv); - -console.log('you ordered a pizza with:'); -if (program['peppers']) console.log(' - peppers'); -if (program['pineapple']) console.log(' - pineapple'); -if (program['bbq']) console.log(' - bbq'); -console.log(' - %s cheese', program['cheese']); - -function range(val: string) { - return val.split('..').map(Number); -} - -function list(val: string) { - return val.split(','); -} - -function collect(val: string, memo: string[]) { - memo.push(val); - return memo; -} - -function increaseVerbosity(v: any, total: number) { - return total + 1; -} - -program - .version('0.0.1') - .usage('[options] ') - .option('-i, --integer ', 'An integer argument', parseInt) - .option('-f, --float ', 'A float argument', parseFloat) - .option('-r, --range ..', 'A range', range) - .option('-l, --list ', 'A list', list) - .option('-o, --optional [value]', 'An optional value') - .option('-c, --collect [value]', 'A repeatable value', collect, []) - .option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0) - .parse(process.argv); - -console.log(' int: %j', program['integer']); -console.log(' float: %j', program['float']); -console.log(' optional: %j', program['optional']); -program['range'] = program['range'] || []; -console.log(' range: %j..%j', program['range'][0], program['range'][1]); -console.log(' list: %j', program['list']); -console.log(' collect: %j', program['collect']); -console.log(' verbosity: %j', program['verbose']); -console.log(' args: %j', program['args']); - -program - .version('0.0.1') - .option('-f, --foo', 'enable some foo') - .option('-b, --bar', 'enable some bar') - .option('-B, --baz', 'enable some baz'); - -// must be before .parse() since -// node's emit() is immediate - -program.on('--help', () => { - console.log(' Examples:'); - console.log(''); - console.log(' $ custom-help --help'); - console.log(' $ custom-help -h'); - console.log(''); -}); - -program - .command('allow-unknown-option') - .allowUnknownOption() - .action(() => { - console.log('unknown option is allowed'); - }); - -program - .version('0.0.1') - .arguments(' [env]') - .action((cmd, env) => { - console.log(cmd, env); - }); - -program.parse(process.argv); - -console.log('stuff'); diff --git a/types/commander/index.d.ts b/types/commander/index.d.ts deleted file mode 100644 index c732d43c7c..0000000000 --- a/types/commander/index.d.ts +++ /dev/null @@ -1,299 +0,0 @@ -// Type definitions for commander 2.11 -// Project: https://github.com/visionmedia/commander.js -// Definitions by: Alan Agius , Marcelo Dezem , vvakame -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare class Option { - flags: string; - required: boolean; - optional: boolean; - bool: boolean; - short?: string; - long: string; - description: string; - - /** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {string} flags - * @param {string} [description] - */ - constructor(flags: string, description?: string); -} - -declare class Command extends NodeJS.EventEmitter { - [key: string]: any; - - args: string[]; - - /** - * Initialize a new `Command`. - * - * @param {string} [name] - */ - constructor(name?: string); - - /** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {string} str - * @param {string} [flags] - * @returns {Command} for chaining - */ - version(str: string, flags?: string): Command; - - /** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * @example - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function() { - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd) { - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('teardown [otherDirs...]') - * .description('run teardown commands') - * .action(function(dir, otherDirs) { - * console.log('dir "%s"', dir); - * if (otherDirs) { - * otherDirs.forEach(function (oDir) { - * console.log('dir "%s"', oDir); - * }); - * } - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env) { - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {string} name - * @param {string} [desc] for git-style sub-commands - * @param {CommandOptions} [opts] command options - * @returns {Command} the new command - */ - command(name: string, desc?: string, opts?: commander.CommandOptions): Command; - - /** - * Define argument syntax for the top-level command. - * - * @param {string} desc - * @returns {Command} for chaining - */ - arguments(desc: string): Command; - - /** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {string[]} args - * @returns {Command} for chaining - */ - parseExpectedArgs(args: string[]): Command; - /** - * Register callback `fn` for the command. - * - * @example - * program - * .command('help') - * .description('display verbose help') - * .action(function() { - * // output help here - * }); - * - * @param {(...args: any[]) => void} fn - * @returns {Command} for chaining - */ - action(fn: (...args: any[]) => void): Command; - - /** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * @example - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to true - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => false - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {string} flags - * @param {string} [description] - * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default - * @param {*} [defaultValue] - * @returns {Command} for chaining - */ - option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command; - option(flags: string, description?: string, defaultValue?: any): Command; - - /** - * Allow unknown options on the command line. - * - * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options. - * @returns {Command} for chaining - */ - allowUnknownOption(arg?: boolean): Command; - - /** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {string[]} argv - * @returns {Command} for chaining - */ - parse(argv: string[]): Command; - - /** - * Parse options from `argv` returning `argv` void of these options. - * - * @param {string[]} argv - * @returns {ParseOptionsResult} - */ - parseOptions(argv: string[]): commander.ParseOptionsResult; - - /** - * Return an object containing options as key-value pairs - * - * @returns {{[key: string]: string}} - */ - opts(): { [key: string]: string }; - - /** - * Set the description to `str`. - * - * @param {string} str - * @return {(Command | string)} - */ - description(str: string): Command; - description(): string; - - /** - * Set an alias for the command. - * - * @param {string} alias - * @return {(Command | string)} - */ - alias(alias: string): Command; - alias(): string; - - /** - * Set or get the command usage. - * - * @param {string} str - * @return {(Command | string)} - */ - usage(str: string): Command; - usage(): string; - - /** - * Set the name of the command. - * - * @param {string} str - * @return {Command} - */ - name(str: string): Command; - - /** - * Get the name of the command. - * - * @return {string} - */ - name(): string; - - /** - * Output help information for this command. - * - * @param {(str: string) => string} [cb] - */ - outputHelp(cb?: (str: string) => string): void; - - /** Output help information and exit. */ - help(): void; -} - -declare namespace commander { - - interface CommandOptions { - noHelp?: boolean; - isDefault?: boolean; - } - - interface ParseOptionsResult { - args: string[]; - unknown: string[]; - } - - interface CommanderStatic extends Command { - Command: typeof Command; - Option: typeof Option; - CommandOptions: CommandOptions; - ParseOptionsResult: ParseOptionsResult; - } - -} - -declare const commander: commander.CommanderStatic; -export = commander; diff --git a/types/commander/tsconfig.json b/types/commander/tsconfig.json deleted file mode 100644 index dcb92cc920..0000000000 --- a/types/commander/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "commander-tests.ts" - ] -} \ No newline at end of file diff --git a/types/commander/tslint.json b/types/commander/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/commander/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 0bd13cce3f66140ffba1e01f541780549b35ba3d Mon Sep 17 00:00:00 2001 From: izackhub Date: Sun, 26 Nov 2017 14:23:04 +0100 Subject: [PATCH 149/269] [index.d.ts]: added new declaration Since the library itself is titled 'is_js' on npm, this would solve the problem of the definitions not being found or having to rename the package folder. --- types/is/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/is/index.d.ts b/types/is/index.d.ts index 3c0e279eea..b61bd6deee 100644 --- a/types/is/index.d.ts +++ b/types/is/index.d.ts @@ -1320,4 +1320,8 @@ declare var is: Is; declare module 'is' { export = is; -} \ No newline at end of file +} + +declare module 'is_js' { + export = is; +} From 044be28abb22b0e3a4814db7a6000822f24966e7 Mon Sep 17 00:00:00 2001 From: kennethanCeyer Date: Sun, 26 Nov 2017 22:28:04 +0900 Subject: [PATCH 150/269] fix the wrong type of owl.carousel --- types/owl.carousel/index.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/types/owl.carousel/index.d.ts b/types/owl.carousel/index.d.ts index 21a4dcee71..4d0548fc66 100644 --- a/types/owl.carousel/index.d.ts +++ b/types/owl.carousel/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for owl.carousel 2.2 +// Type definitions for owl.carousel 2.2.1 // Project: https://github.com/OwlCarousel2/OwlCarousel2 // Definitions by: Ismael Gorissen +// Updated by: Kenneth Ceyer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -36,8 +37,8 @@ declare namespace OwlCarousel { autoplay?: boolean; autoplayTimeout?: number; autoplayHoverPause?: boolean; - smartSpeed?: boolean; - fluidSpeed?: boolean; + smartSpeed?: number | boolean; + fluidSpeed?: number | boolean; autoplaySpeed?: number | boolean; navSpeed?: number | boolean; dotsSpeed?: number | boolean; From a49da75063a2e83f9d826e9237839cf65795103b Mon Sep 17 00:00:00 2001 From: kennethanCeyer Date: Sun, 26 Nov 2017 22:38:53 +0900 Subject: [PATCH 151/269] fix dts header, append pr to #21752 --- types/owl.carousel/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/owl.carousel/index.d.ts b/types/owl.carousel/index.d.ts index 4d0548fc66..0295b3fe5b 100644 --- a/types/owl.carousel/index.d.ts +++ b/types/owl.carousel/index.d.ts @@ -1,7 +1,7 @@ -// Type definitions for owl.carousel 2.2.1 +// Type definitions for owl.carousel 2.2 // Project: https://github.com/OwlCarousel2/OwlCarousel2 // Definitions by: Ismael Gorissen -// Updated by: Kenneth Ceyer +// Kenneth Ceyer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 4148e8567522a6988271eee41a22c5423574157b Mon Sep 17 00:00:00 2001 From: Gordon Burgett Date: Sun, 26 Nov 2017 08:46:44 -0700 Subject: [PATCH 152/269] [JSONStream] add stringify(false) overload Package docs allow `false` as a parameter to `stringify`, in addition to `stringify(open, sep, close)`. This is useful for dumping a stream of objects separated by newlines, rather than creating a JSON array of the objects. from https://www.npmjs.com/package/JSONStream > If you call JSONStream.stringify(false) the elements will only be > seperated by a newline. --- types/jsonstream/index.d.ts | 18 ++++++++++++++++++ types/jsonstream/jsonstream-tests.ts | 1 + 2 files changed, 19 insertions(+) diff --git a/types/jsonstream/index.d.ts b/types/jsonstream/index.d.ts index cf0f0fdd43..3e9bdd4b12 100644 --- a/types/jsonstream/index.d.ts +++ b/types/jsonstream/index.d.ts @@ -14,7 +14,25 @@ export interface Options { export declare function parse(pattern: any): NodeJS.ReadWriteStream; export declare function parse(patterns: any[]): NodeJS.ReadWriteStream; + +/** + * Create a writable stream. + * you may pass in custom open, close, and seperator strings. But, by default, + * JSONStream.stringify() will create an array, + * (with default options open='[\n', sep='\n,\n', close='\n]\n') + */ export declare function stringify(): NodeJS.ReadWriteStream; + +/** If you call JSONStream.stringify(false) the elements will only be seperated by a newline. */ +export declare function stringify(newlineOnly: NewlineOnlyIndicator): NodeJS.ReadWriteStream; +type NewlineOnlyIndicator = false + +/** + * Create a writable stream. + * you may pass in custom open, close, and seperator strings. But, by default, + * JSONStream.stringify() will create an array, + * (with default options open='[\n', sep='\n,\n', close='\n]\n') + */ export declare function stringify(open: string, sep: string, close: string): NodeJS.ReadWriteStream; export declare function stringifyObject(): NodeJS.ReadWriteStream; diff --git a/types/jsonstream/jsonstream-tests.ts b/types/jsonstream/jsonstream-tests.ts index d42ab0d845..68c8e858ac 100644 --- a/types/jsonstream/jsonstream-tests.ts +++ b/types/jsonstream/jsonstream-tests.ts @@ -8,6 +8,7 @@ read = read.pipe(json.parse('*')); read = read.pipe(json.parse(['foo/*', 'bar/*'])); read = json.stringify(); +read = json.stringify(false); read = json.stringify('{', ',', '}'); read = json.stringifyObject(); From 92629c37be2403dc19f0b3f0dc784cf7d6b31eea Mon Sep 17 00:00:00 2001 From: Mathias Teier Date: Sun, 26 Nov 2017 18:02:33 +0100 Subject: [PATCH 153/269] FIX: Added missing get_retain Flag to ISubscribeOptions --- types/autobahn/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/autobahn/index.d.ts b/types/autobahn/index.d.ts index 7f01a53e3a..969c703478 100644 --- a/types/autobahn/index.d.ts +++ b/types/autobahn/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for AutobahnJS v0.9.7 // Project: http://autobahn.ws/js/ -// Definitions by: Elad Zelingher , Andy Hawkins , Wladimir Totino +// Definitions by: Elad Zelingher , Andy Hawkins , Wladimir Totino , Mathias Teier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -179,6 +179,7 @@ declare namespace autobahn { interface ISubscribeOptions { match?: string; + get_retained?: boolean; } interface IRegisterOptions { From 59ce8d03df4ceb81fa3d81e1937fa513323afd2d Mon Sep 17 00:00:00 2001 From: Peter Bartha Date: Sun, 26 Nov 2017 21:07:32 +0100 Subject: [PATCH 154/269] Change properties of argument options --- types/codemirror/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index 24e905b8e2..8089bfb2aa 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -536,13 +536,13 @@ declare namespace CodeMirror { setCursor(pos: CodeMirror.Position): void; /** Set a single selection range. anchor and head should be {line, ch} objects. head defaults to anchor when not given. */ - setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position, options?: { bias: number, clearRedo: boolean, origin: string, scroll: boolean }): void; + setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position, options?: { bias?: number, origin?: string, scroll?: boolean }): void; /** Sets a new set of selections. There must be at least one selection in the given array. When primary is a number, it determines which selection is the primary one. When it is not given, the primary index is taken from the previous selection, or set to the last range if the previous selection had less ranges than the new one. Supports the same options as setSelection. */ - setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number, options?: { bias: number, clearRedo: boolean, origin: string, scroll: boolean }): void; + setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number, options?: { bias?: number, origin?: string, scroll?: boolean }): void; /** Similar to setSelection , but will, if shift is held or the extending flag is set, move the head of the selection while leaving the anchor at its current place. From 65c7acb1c03d3c40183705a0b9a7201c1aeb3595 Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Sun, 26 Nov 2017 18:35:40 -0500 Subject: [PATCH 155/269] Add initial typings for react-toastr --- types/react-toastr/index.d.ts | 20 ++++++++++++++++++ types/react-toastr/react-toastr-tests.tsx | 22 ++++++++++++++++++++ types/react-toastr/tsconfig.json | 25 +++++++++++++++++++++++ types/react-toastr/tslint.json | 1 + 4 files changed, 68 insertions(+) create mode 100644 types/react-toastr/index.d.ts create mode 100644 types/react-toastr/react-toastr-tests.tsx create mode 100644 types/react-toastr/tsconfig.json create mode 100644 types/react-toastr/tslint.json diff --git a/types/react-toastr/index.d.ts b/types/react-toastr/index.d.ts new file mode 100644 index 0000000000..2de77a6d7e --- /dev/null +++ b/types/react-toastr/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for react-toastr 3.0 +// Project: https://github.com/tomchentw/react-toastr +// Definitions by: Josh Holmer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Component, ReactHTML } from 'react'; + +export class ToastContainer extends Component<{ + toastMessageFactory: any; + className?: string; +}> { + error: (message: string, title: string, optionsOverride?: {}) => void; + info: (message: string, title: string, optionsOverride?: {}) => void; + success: (message: string, title: string, optionsOverride?: {}) => void; + warning: (message: string, title: string, optionsOverride?: {}) => void; + clear: () => void; +} +export const ToastMessageAnimated: keyof ReactHTML; +export const ToastMessagejQuery: keyof ReactHTML; diff --git a/types/react-toastr/react-toastr-tests.tsx b/types/react-toastr/react-toastr-tests.tsx new file mode 100644 index 0000000000..75d6527730 --- /dev/null +++ b/types/react-toastr/react-toastr-tests.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { ToastContainer, ToastMessageAnimated } from 'react-toastr'; + +const toastMessageFactory = React.createFactory(ToastMessageAnimated); + +class Test extends React.Component { + ref: ToastContainer; + + toastRef = (ref: ToastContainer) => { + this.ref = ref; + } + + render() { + return ( + + ); + } +} diff --git a/types/react-toastr/tsconfig.json b/types/react-toastr/tsconfig.json new file mode 100644 index 0000000000..1fbbfde4af --- /dev/null +++ b/types/react-toastr/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-toastr-tests.tsx" + ] +} diff --git a/types/react-toastr/tslint.json b/types/react-toastr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-toastr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c4df40988192332549420d7d700179873cec5ab4 Mon Sep 17 00:00:00 2001 From: Rodrigo Saboya Date: Sun, 26 Nov 2017 17:21:45 -0200 Subject: [PATCH 156/269] Updating definitions for Nes>=7.0.0. --- types/nes/client.d.ts | 17 ++-- types/nes/index.d.ts | 19 ++-- types/nes/test/broadcast-client.ts | 4 +- types/nes/test/broadcast-server.ts | 5 +- types/nes/test/nes-tests.ts | 99 +++++++++---------- types/nes/test/route-authentication-client.ts | 14 +-- types/nes/test/route-authentication-server.ts | 20 ++-- types/nes/test/route-invocation-client.ts | 14 +-- types/nes/test/route-invocation-server.ts | 9 +- types/nes/test/socket.ts | 10 +- types/nes/test/subscription-filter-client.ts | 12 +-- types/nes/test/subscription-filter-server.ts | 21 ++-- types/nes/test/subscriptions-client.ts | 12 +-- types/nes/test/subscriptions-server.ts | 11 +-- 14 files changed, 120 insertions(+), 147 deletions(-) diff --git a/types/nes/client.d.ts b/types/nes/client.d.ts index 8314894683..5d348b267e 100644 --- a/types/nes/client.d.ts +++ b/types/nes/client.d.ts @@ -1,6 +1,7 @@ -// Type definitions for nes 6.4.2 +// Type definitions for nes 7.0.0 // Project: https://github.com/hapijs/nes // Definitions by: Ivo Stratev +// Rodrigo Saboya // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare class Client { @@ -9,14 +10,14 @@ declare class Client { onConnect: () => void; onDisconnect: () => void; onUpdate: (message: any) => void; - connect(options: Client.ClientConnectOptions, callback: (err?: any) => void): void; - connect(callback: (err?: any) => void): void; - disconnect(): void; + connect(options: Client.ClientConnectOptions): Promise; + connect(): Promise; + disconnect(): Promise; id: any; // can be `null | number` but also the "socket" value from websocket message data. - request(options: string | Client.ClientRequestOptions, callback: (err: any, payload: any, statusCode?: number, headers?: Object) => void): void; - message(message: any, callback: (err: any, message: any) => void): void; - subscribe(path: string, handler: Client.Handler, callback: (err?: any) => void): void; - unsubscribe(path: string, handler: Client.Handler, callback: (err?: any) => void): void; + request(options: string | Client.ClientRequestOptions): Promise; + message(message: any): Promise; + subscribe(path: string, handler: Client.Handler): Promise; + unsubscribe(path: string, handler: Client.Handler): Promise; subscriptions(): string[]; overrideReconnectionAuth(auth: any): void; } diff --git a/types/nes/index.d.ts b/types/nes/index.d.ts index a6ed90a7b7..c4d26ecda0 100644 --- a/types/nes/index.d.ts +++ b/types/nes/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for nes 6.2.1 +// Type definitions for nes 7.0.0 // Project: https://github.com/hapijs/nes // Definitions by: Ivo Stratev +// Rodrigo Saboya // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -62,12 +63,12 @@ declare module nes { index?: boolean; } - export type ServerOnSubscribeWithParams = (socket: Socket, path: string, params: any, next: (err?: any) => void) => void; - export type ServerOnSubscribeWithoutParams = (socket: Socket, path: string, next: (err?: any) => void) => void; + export type ServerOnSubscribeWithParams = (socket: Socket, path: string, params: any) => Promise; + export type ServerOnSubscribeWithoutParams = (socket: Socket, path: string) => Promise; export type ServerOnSubscribe = ServerOnSubscribeWithParams | ServerOnSubscribeWithoutParams; - export type ServerOnUnSubscribeWithParams = (socket: Socket, path: string, params: any, next: () => void) => void; - export type ServerOnUnSubscribeWithoutParams = (socket: Socket, path: string, next: () => void) => void; + export type ServerOnUnSubscribeWithParams = (socket: Socket, path: string, params: any) => void; + export type ServerOnUnSubscribeWithoutParams = (socket: Socket, path: string) => void; export type ServerOnUnSubscribe = ServerOnUnSubscribeWithParams | ServerOnUnSubscribeWithoutParams; interface ServerSubscriptionOptions { @@ -91,10 +92,10 @@ declare module nes { id: string; app: Object; auth: nes.SocketAuthObject; - disconnect(callback?: () => void): void; - send(message: any, callback?: (err?: any) => void): void; - publish(path: string, message: any, callback?: (err?: any) => void): void; - revoke(path: string, message: any, callback?: (err?: any) => void): void; + disconnect(): Promise; + send(message: any): Promise; + publish(path: string, message: any): Promise; + revoke(path: string, message: any): Promise; } /** diff --git a/types/nes/test/broadcast-client.ts b/types/nes/test/broadcast-client.ts index 4c94b8c575..5563a202d3 100644 --- a/types/nes/test/broadcast-client.ts +++ b/types/nes/test/broadcast-client.ts @@ -3,7 +3,7 @@ import Nes = require('nes'); var client = new Nes.Client('ws://localhost'); -client.connect(function (err) { +client.connect().then(() => { client.onUpdate = function (update) { @@ -16,7 +16,7 @@ client.connect(function (err) { import NesClient = require('nes/client'); var client = new NesClient('ws://localhost'); -client.connect(function (err) { +client.connect().then(() => { client.onUpdate = function (update) { diff --git a/types/nes/test/broadcast-server.ts b/types/nes/test/broadcast-server.ts index dcfcb3400e..6ef8f7aafa 100644 --- a/types/nes/test/broadcast-server.ts +++ b/types/nes/test/broadcast-server.ts @@ -4,11 +4,10 @@ import Hapi = require('hapi'); import Nes = require('nes'); var server = new Hapi.Server(); -server.connection(); -server.register(Nes, function (err) { +server.register(Nes).then(() => { - server.start(function (err) { + return server.start().then(() => { server.broadcast('welcome!'); }); diff --git a/types/nes/test/nes-tests.ts b/types/nes/test/nes-tests.ts index 90afe68f3e..85cff1e208 100644 --- a/types/nes/test/nes-tests.ts +++ b/types/nes/test/nes-tests.ts @@ -2,66 +2,55 @@ import Hapi = require('hapi'); import Nes = require('nes'); var server: Hapi.Server = new Hapi.Server(); -server.connection({port: 8080}); -server.register(Nes, (regErr) => { - if(regErr) { - console.log('register err'); - console.log(regErr); - } else { - // No longer need to cast to Nes.Server as Hapi.Server has been modified directly. - // let wsServer: Nes.Server = server as Nes.Server; - let wsServer: Hapi.Server = server; - wsServer.subscription('/item/{id}'); - wsServer.route( { - method: 'GET', - path: '/test', - config: { - handler: (request, reply) => { - reply({test: 'passes ' + request.socket.id}); - } +server.register(Nes).then(() => { + // No longer need to cast to Nes.Server as Hapi.Server has been modified directly. + // let wsServer: Nes.Server = server as Nes.Server; + let wsServer: Hapi.Server = server; + wsServer.subscription('/item/{id}'); + wsServer.route( { + method: 'GET', + path: '/test', + config: { + handler: (request, h) => { + return {test: 'passes ' + request.socket.id}; } - }); - wsServer.start((err: any) => { - if(err) { - console.log('start err'); - console.log(err); - } else { - setTimeout(() => { - wsServer.publish('/item/5', { id: 5, status: 'complete' }); - wsServer.publish('/item/6', { id: 6, status: 'initial' }); - }, 100); - } - }); - } + } + }); + wsServer.start().then(() => { + setTimeout(() => { + wsServer.publish('/item/5', { id: 5, status: 'complete' }); + wsServer.publish('/item/6', { id: 6, status: 'initial' }); + }, 100); + }).catch((err) => { + console.log('start err'); + console.log(err); + }); +}).catch((regErr: any) => { + console.log('register err'); + console.log(regErr); }); let options: Nes.ClientConnectOptions = {delay: 3}; -let wsClient: Nes.Client = new Nes.Client('ws://localhost:8080', options); -wsClient.connect((err: any) => { - if(err) { - console.log('start err'); - console.log(err); - } else { - wsClient.subscribe('/item/5', (update) => { - wsClient.request('/test', (reqErr, payload, statusCode) => { - if(reqErr) { - console.log('request err'); - console.log(reqErr); - } else { - console.log(update); - console.log(payload); - if(payload.test === 'passes') { - process.exit(0); - } - } - }) - }, (subErr) => { - if(subErr) { - console.log('subscribe err'); - console.log(subErr); +let wsClient: Nes.Client = new Nes.Client('ws://localhost', options); +wsClient.connect().then(() => { + wsClient.subscribe('/item/5', (update) => { + wsClient.request('/test').then(({ payload, statusCode }) => { + console.log(update); + console.log(payload); + if(payload.test === 'passes') { + process.exit(0); } - }); - } + }).catch((reqErr: any) => { + console.log('request err'); + console.log(reqErr); + }) + }).catch((subErr: any) => { + console.log('subscribe err'); + console.log(subErr); + }); +}).catch((err: any) => { + console.log('start err'); + console.log(err); }); diff --git a/types/nes/test/route-authentication-client.ts b/types/nes/test/route-authentication-client.ts index fe57eb8d56..f1eb8b9659 100644 --- a/types/nes/test/route-authentication-client.ts +++ b/types/nes/test/route-authentication-client.ts @@ -3,12 +3,9 @@ import Nes = require('nes'); var client = new Nes.Client('ws://localhost'); -client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }, function (err) { +client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }).then(() => { - client.request('hello', function (err, payload) { // Can also request '/h' - - // payload -> 'Hello John Doe' - }); + client.request('hello'); }); // Added in addition to nes doc example code @@ -16,10 +13,7 @@ client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } import NesClient = require('nes/client'); var client = new NesClient('ws://localhost'); -client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }, function (err) { +client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }).then(() => { - client.request('hello', function (err, payload) { // Can also request '/h' - - // payload -> 'Hello John Doe' - }); + return client.request('hello'); }); diff --git a/types/nes/test/route-authentication-server.ts b/types/nes/test/route-authentication-server.ts index 5b4634d77d..2080f04ef4 100644 --- a/types/nes/test/route-authentication-server.ts +++ b/types/nes/test/route-authentication-server.ts @@ -8,7 +8,7 @@ import Nes = require('nes'); var server = new Hapi.Server(); server.connection(); -server.register([Basic, Nes], function (err) { +server.register([Basic, Nes]).then(() => { // Set up HTTP Basic authentication @@ -28,20 +28,20 @@ server.register([Basic, Nes], function (err) { } }; - var validate: Basic.ValidateFunc = function (request, username, password, callback) { + var validate: Basic.Validate = async (request, username, password, h) => { var user = users[username]; if (!user) { - return callback(null, false); + return { credentials: null, isValid: false }; } - Bcrypt.compare(password, user.password, function (err, isValid) { + let isValid = await Bcrypt.compare(password, user.password) - callback(err, isValid, { id: user.id, name: user.name }); - }); + return { isValid, credentials: { id: user.id, name: user.name } }; }; - server.auth.strategy('simple', 'basic', 'required', { validateFunc: validate }); + server.auth.strategy('simple', 'basic', { validateFunc: validate }); + server.auth.default('simple'); // Configure route with authentication @@ -50,12 +50,12 @@ server.register([Basic, Nes], function (err) { path: '/h', config: { id: 'hello', - handler: function (request, reply) { + handler: function (request, h) { - return reply('Hello ' + request.auth.credentials.name); + return 'Hello ' + request.auth.credentials.name; } } }); - server.start(function (err) { /* ... */ }); + return server.start(); }); diff --git a/types/nes/test/route-invocation-client.ts b/types/nes/test/route-invocation-client.ts index 7b144e3a9c..34c40fe151 100644 --- a/types/nes/test/route-invocation-client.ts +++ b/types/nes/test/route-invocation-client.ts @@ -3,12 +3,9 @@ import Nes = require('nes'); var client = new Nes.Client('ws://localhost'); -client.connect(function (err) { +client.connect().then(() => { - client.request('hello', function (err, payload) { // Can also request '/h' - - // payload -> 'world!' - }); + return client.request('hello'); }); // Added in addition to nes doc example code @@ -16,10 +13,7 @@ client.connect(function (err) { import NesClient = require('nes/client'); var client = new NesClient('ws://localhost'); -client.connect(function (err) { +client.connect().then(() => { - client.request('hello', function (err, payload) { // Can also request '/h' - - // payload -> 'world!' - }); + return client.request('hello'); }); diff --git a/types/nes/test/route-invocation-server.ts b/types/nes/test/route-invocation-server.ts index c32780baa9..d6893495c9 100644 --- a/types/nes/test/route-invocation-server.ts +++ b/types/nes/test/route-invocation-server.ts @@ -4,21 +4,20 @@ import Hapi = require('hapi'); import Nes = require('nes'); var server = new Hapi.Server(); -server.connection(); -server.register(Nes, function (err) { +server.register(Nes).then(() => { server.route({ method: 'GET', path: '/h', config: { id: 'hello', - handler: function (request, reply) { + handler: (request, h) => { - return reply('world!'); + return 'world!'; } } }); - server.start(function (err) { /* ... */ }); + return server.start(); }); diff --git a/types/nes/test/socket.ts b/types/nes/test/socket.ts index 7f7617d462..029dbb1d2f 100644 --- a/types/nes/test/socket.ts +++ b/types/nes/test/socket.ts @@ -4,13 +4,11 @@ import Nes = require('nes'); const socket: Nes.Socket = undefined; -const cb = () => { }; -socket.disconnect(cb); +socket.disconnect(); const s: string = socket.id; const o: Object = socket.app; const auth: Nes.SocketAuthObject = socket.auth; -const cb2 = (err?: any) => { }; -socket.send('message', (err?: any) => { }); -socket.publish('path', 'message', cb2); -socket.revoke('path', 'message', cb2); +socket.send('message'); +socket.publish('path', 'message'); +socket.revoke('path', 'message'); diff --git a/types/nes/test/subscription-filter-client.ts b/types/nes/test/subscription-filter-client.ts index 3f8d3ffb8b..05253539a4 100644 --- a/types/nes/test/subscription-filter-client.ts +++ b/types/nes/test/subscription-filter-client.ts @@ -6,15 +6,15 @@ var client = new Nes.Client('ws://localhost'); // Authenticate as 'john' -client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }, function (err) { +client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }).then(() => { - var handler: Nes.Handler = function (err, update) { + var handler: Nes.Handler = (update) => { // First publish is not received (filtered due to updater key) // update -> { id: 6, status: 'initial', updater: 'steve' } }; - client.subscribe('/items', handler, function (err) { }); + return client.subscribe('/items', handler); }); // Added in addition to nes doc example code @@ -25,13 +25,13 @@ var client = new NesClient('ws://localhost'); // Authenticate as 'john' -client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }, function (err) { +client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }).then(() => { - var handler: NesClient.Handler = function (err, update) { + var handler: NesClient.Handler = (update) => { // First publish is not received (filtered due to updater key) // update -> { id: 6, status: 'initial', updater: 'steve' } }; - client.subscribe('/items', handler, function (err) { }); + return client.subscribe('/items', handler); }); diff --git a/types/nes/test/subscription-filter-server.ts b/types/nes/test/subscription-filter-server.ts index be2dda8d7f..7a63abf151 100644 --- a/types/nes/test/subscription-filter-server.ts +++ b/types/nes/test/subscription-filter-server.ts @@ -6,9 +6,8 @@ import Bcrypt = require('bcrypt'); import Nes = require('nes'); var server = new Hapi.Server(); -server.connection(); -server.register([Basic, Nes], function (err) { +server.register([Basic, Nes]).then(() => { // Set up HTTP Basic authentication @@ -28,31 +27,31 @@ server.register([Basic, Nes], function (err) { } }; - var validate: Basic.ValidateFunc = function (request, username, password, callback) { + var validate: Basic.Validate = async (request, username, password, h) => { var user = users[username]; if (!user) { - return callback(null, false); + return { credentials: null, isValid: false }; } - Bcrypt.compare(password, user.password, function (err, isValid) { + let isValid = await Bcrypt.compare(password, user.password) - callback(err, isValid, { id: user.id, name: user.name, username: user.username }); - }); + return { isValid, credentials: { id: user.id, name: user.name, username: user.username } }; }; - server.auth.strategy('simple', 'basic', 'required', { validateFunc: validate }); + server.auth.strategy('simple', 'basic', { validate }); + server.auth.default('simple') // Set up subscription server.subscription('/items', { - filter: function (path, message, options, next) { + filter: (path, message, options) => { - return next(message.updater !== options.credentials.username); + return message.updater !== options.credentials.username; } }); - server.start(function (err) { + server.start().then(() => { server.publish('/items', { id: 5, status: 'complete', updater: 'john' }); server.publish('/items', { id: 6, status: 'initial', updater: 'steve' }); diff --git a/types/nes/test/subscriptions-client.ts b/types/nes/test/subscriptions-client.ts index a9ac55fc6d..9f6150f90c 100644 --- a/types/nes/test/subscriptions-client.ts +++ b/types/nes/test/subscriptions-client.ts @@ -3,15 +3,15 @@ import Nes = require('nes'); var client = new Nes.Client('ws://localhost'); -client.connect(function (err) { + client.connect().then(() => {; - var handler: Nes.Handler = function (update, flags) { + var handler: Nes.Handler = (update, flags) => { // update -> { id: 5, status: 'complete' } // Second publish is not received (doesn't match) }; - client.subscribe('/item/5', handler, function (err) { }); + return client.subscribe('/item/5', handler); }); // Added in addition to nes doc example code @@ -19,13 +19,13 @@ client.connect(function (err) { import NesClient = require('nes/client'); var client = new NesClient('ws://localhost'); -client.connect(function (err) { +client.connect().then(() => { - var handler: NesClient.Handler = function (update, flags) { + var handler: NesClient.Handler = (update, flags) => { // update -> { id: 5, status: 'complete' } // Second publish is not received (doesn't match) }; - client.subscribe('/item/5', handler, function (err) { }); + return client.subscribe('/item/5', handler); }); diff --git a/types/nes/test/subscriptions-server.ts b/types/nes/test/subscriptions-server.ts index 23212f21ea..1280f2afd1 100644 --- a/types/nes/test/subscriptions-server.ts +++ b/types/nes/test/subscriptions-server.ts @@ -4,15 +4,14 @@ import Hapi = require('hapi'); import Nes = require('nes'); var server = new Hapi.Server(); -server.connection(); -server.register(Nes, function (err) { +server.register(Nes).then(() =>{; server.subscription('/item/{id}'); - server.start(function (err) { + return server.start().then(() => { - server.publish('/item/5', { id: 5, status: 'complete' }); - server.publish('/item/6', { id: 6, status: 'initial' }); + server.publish('/item/5', {id: 5, status: 'complete'}); + server.publish('/item/6', {id: 6, status: 'initial'}); }); -}); +}) From e8e3c6a23bdff84aa488a3e0d1ca30a45267c137 Mon Sep 17 00:00:00 2001 From: Rodrigo Saboya Date: Sun, 26 Nov 2017 22:25:04 -0200 Subject: [PATCH 157/269] Updating type definitions for hapi-auth-basic >= 5.0.0. --- types/hapi-auth-basic/hapi-auth-basic-tests.ts | 15 ++++++++------- types/hapi-auth-basic/index.d.ts | 16 +++++++++++----- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/types/hapi-auth-basic/hapi-auth-basic-tests.ts b/types/hapi-auth-basic/hapi-auth-basic-tests.ts index 7f78fe9f65..1a7192af6f 100644 --- a/types/hapi-auth-basic/hapi-auth-basic-tests.ts +++ b/types/hapi-auth-basic/hapi-auth-basic-tests.ts @@ -22,21 +22,22 @@ const users: {[index: string]: User} = { } }; -const validate: Basic.ValidateFunc = function (request, username, password, callback) { +const validate: Basic.Validate = async (request, username, password, h) => { const user = users[username]; if (!user) { - return callback(null, false); + return { isValid: false, credentials: null }; } - Bcrypt.compare(password, user.password, (err, isValid) => { + let isValid = await Bcrypt.compare(password, user.password) - callback(err, isValid, { id: user.id, name: user.name }); - }); + return { isValid, credentials: { id: user.id, name: user.name } }; }; -server.register(Basic, (err) => { +server.register(Basic).then(() => { + + server.auth.strategy('simple', 'basic', { validate }); + server.auth.default('simple'); - server.auth.strategy('simple', 'basic', { validateFunc: validate }); server.route({ method: 'GET', path: '/', config: { auth: 'simple' } }); }); diff --git a/types/hapi-auth-basic/index.d.ts b/types/hapi-auth-basic/index.d.ts index 54d463c2b3..ddf05c348a 100644 --- a/types/hapi-auth-basic/index.d.ts +++ b/types/hapi-auth-basic/index.d.ts @@ -1,18 +1,24 @@ -// Type definitions for hapi 4.2 +// Type definitions for hapi-bauth-basic 5.0.0 // Project: https://github.com/hapijs/hapi-auth-basic // Definitions by: AJP +// Rodrigo Saboya // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 import * as Hapi from 'hapi'; declare namespace Basic { - interface ValidateFuncCallback { - (err: Error | null, isValid: boolean, userCredentials?: any): void; + interface ValidateCustomResponse { + response: any, } - interface ValidateFunc { - (request: Hapi.Request, username: string, password: string, callback: ValidateFuncCallback): void; + interface ValidateResponse { + isValid: boolean, + credentials?: any, + } + + interface Validate { + (request: Hapi.Request, username: string, password: string, h: object): Promise; } } From c8a445c4f1fa33cceee217e4439a54107338a154 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Mon, 27 Nov 2017 13:22:27 +0900 Subject: [PATCH 158/269] feat: add generic type test --- types/react-swipeable/index.d.ts | 4 ++-- types/react-swipeable/react-swipeable-tests.tsx | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/types/react-swipeable/index.d.ts b/types/react-swipeable/index.d.ts index 496f0500cf..1608258c64 100644 --- a/types/react-swipeable/index.d.ts +++ b/types/react-swipeable/index.d.ts @@ -8,7 +8,7 @@ import * as React from 'react'; -declare class ReactSwipeable extends React.Component {} +declare class ReactSwipeable extends React.Component> {} declare namespace ReactSwipeable { type OnSwipingCallback = (event: React.TouchEvent, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void; @@ -17,7 +17,7 @@ declare namespace ReactSwipeable { type OnSwipingDirectionCallback = (event: React.TouchEvent, delta: number) => void; type OnTapCallback = (event: React.TouchEvent) => void; - interface SwipeableProps extends React.ClassAttributes, React.HTMLAttributes { + interface SwipeableProps extends React.ClassAttributes>, React.HTMLAttributes { onSwiped?: OnSwipedCallback; onSwiping?: OnSwipingCallback; onSwipingUp?: OnSwipingDirectionCallback; diff --git a/types/react-swipeable/react-swipeable-tests.tsx b/types/react-swipeable/react-swipeable-tests.tsx index 4fa67abffa..d39f1a1b11 100644 --- a/types/react-swipeable/react-swipeable-tests.tsx +++ b/types/react-swipeable/react-swipeable-tests.tsx @@ -46,3 +46,16 @@ class SampleComponent extends React.PureComponent { ); } } + +class DivSwipeable extends Swipeable {} +const TestComponent: React.StatelessComponent<{}> = (_) => { + const handleSwiped = (event: React.TouchEvent) => {}; + return ( + +
this is sample code.
+
+ ); +}; From c78315abf325ce1f5e10b3ec18a9bb09c3d156d0 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Mon, 27 Nov 2017 13:34:14 +0900 Subject: [PATCH 159/269] fix: tslint error --- types/react-swipeable/react-swipeable-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-swipeable/react-swipeable-tests.tsx b/types/react-swipeable/react-swipeable-tests.tsx index d39f1a1b11..ed5df52e54 100644 --- a/types/react-swipeable/react-swipeable-tests.tsx +++ b/types/react-swipeable/react-swipeable-tests.tsx @@ -48,7 +48,7 @@ class SampleComponent extends React.PureComponent { } class DivSwipeable extends Swipeable {} -const TestComponent: React.StatelessComponent<{}> = (_) => { +const TestComponent: React.StatelessComponent = (_) => { const handleSwiped = (event: React.TouchEvent) => {}; return ( Date: Mon, 27 Nov 2017 02:21:54 -0500 Subject: [PATCH 160/269] GoogleAuth.signIn return Promise by the google reference for this client api, https://developers.google.com/api-client-library/javascript/reference/referencedocs#googleauthsigninoptions, GoogleAuth.signIn should return Promise. --- types/gapi.auth2/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/gapi.auth2/index.d.ts b/types/gapi.auth2/index.d.ts index 4cdef77a80..7dbdb222c3 100644 --- a/types/gapi.auth2/index.d.ts +++ b/types/gapi.auth2/index.d.ts @@ -27,7 +27,7 @@ declare namespace gapi.auth2 { * Signs in the user using the specified options. * If no option specified here, fallback to the options specified to gapi.auth2.init(). */ - signIn(options?: SigninOptions | SigninOptionsBuilder): any; + signIn(options?: SigninOptions | SigninOptionsBuilder): Promise; /** * Signs out all accounts from the application. From b4187f1f44e1a51ba603870a1762fec861824508 Mon Sep 17 00:00:00 2001 From: yasupeke Date: Mon, 27 Nov 2017 17:56:01 +0900 Subject: [PATCH 161/269] =?UTF-8?q?Add=20=E2=80=98events=E2=80=99=20types?= =?UTF-8?q?=20(#21019)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/events/events-tests.ts | 53 ++++++++++++++++++++++++++++++++++++ types/events/index.d.ts | 22 +++++++++++++++ types/events/tsconfig.json | 25 +++++++++++++++++ types/events/tslint.json | 1 + 4 files changed, 101 insertions(+) create mode 100644 types/events/events-tests.ts create mode 100644 types/events/index.d.ts create mode 100644 types/events/tsconfig.json create mode 100644 types/events/tslint.json diff --git a/types/events/events-tests.ts b/types/events/events-tests.ts new file mode 100644 index 0000000000..fe62a6e1a3 --- /dev/null +++ b/types/events/events-tests.ts @@ -0,0 +1,53 @@ +import { EventEmitter } from 'events'; + +const emitter = new EventEmitter(); +const listener = () => { + console.log('once'); +}; +const listener1 = () => { + console.log('listener1'); +}; +const listener2 = () => { + console.log('listener2'); +}; +const listener3 = (arg1: string, arg2: string, arg3: number) => { + console.log('listener3'); +}; + +emitter.setMaxListeners(100); + +emitter.addListener('send', listener1); + +emitter.on('send', listener2); + +emitter.on('send', listener3); + +emitter.once('send', listener); + +emitter.listeners('send'); +emitter.listenerCount('send'); + +EventEmitter.defaultMaxListeners = 100; +console.log(`count(static): ${EventEmitter.listenerCount(emitter, 'send')}`); + +setTimeout(() => { + console.log(`\ncount: ${emitter.listenerCount('send')}`); + emitter.emit('send'); +}, 1000); + +setTimeout(() => { + console.log(`\ncount: ${emitter.listenerCount('send')}`); + emitter.emit('send'); + emitter.removeListener('send', listener2); +}, 2000); + +setTimeout(() => { + console.log(`\ncount: ${emitter.listenerCount('send')}`); + emitter.emit('send'); + emitter.removeAllListeners('send'); +}, 3000); + +setTimeout(() => { + console.log(`\ncount: ${emitter.listenerCount('send')}`); + emitter.emit('send'); +}, 3000); diff --git a/types/events/index.d.ts b/types/events/index.d.ts new file mode 100644 index 0000000000..6907d6f07e --- /dev/null +++ b/types/events/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for events 1.1 +// Project: https://github.com/Gozala/events +// Definitions by: Yasunori Ohoka +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +export type Listener = (...args: any[]) => void; + +export class EventEmitter { + static listenerCount(emitter: EventEmitter, type: string): number; + static defaultMaxListeners: number; + + setMaxListeners(n: number): this; + emit(type: string, ...args: any[]): boolean; + addListener(type: string, listener: Listener): this; + on(type: string, listener: Listener): this; + once(type: string, listener: Listener): this; + removeListener(type: string, listener: Listener): this; + removeAllListeners(type: string): this; + listeners(type: string): Listener[]; + listenerCount(type: string): number; +} diff --git a/types/events/tsconfig.json b/types/events/tsconfig.json new file mode 100644 index 0000000000..f43a926ad8 --- /dev/null +++ b/types/events/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "events-tests.ts" + ] +} diff --git a/types/events/tslint.json b/types/events/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/events/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 49c1c1c69ada73decb5a9fe0cb6f40e1779e9e25 Mon Sep 17 00:00:00 2001 From: yasupeke Date: Mon, 27 Nov 2017 18:17:39 +0900 Subject: [PATCH 162/269] [events]Fix parameter type --- types/events/events-tests.ts | 21 ++++++++++++++------- types/events/index.d.ts | 18 +++++++++--------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/types/events/events-tests.ts b/types/events/events-tests.ts index fe62a6e1a3..ccf89c1402 100644 --- a/types/events/events-tests.ts +++ b/types/events/events-tests.ts @@ -10,8 +10,11 @@ const listener1 = () => { const listener2 = () => { console.log('listener2'); }; -const listener3 = (arg1: string, arg2: string, arg3: number) => { - console.log('listener3'); +const listener3 = (arg1: string) => { + console.log('listener3', arg1); +}; +const listener4 = () => { + console.log('type of number'); }; emitter.setMaxListeners(100); @@ -24,30 +27,34 @@ emitter.on('send', listener3); emitter.once('send', listener); +emitter.once(1, listener4); + emitter.listeners('send'); emitter.listenerCount('send'); EventEmitter.defaultMaxListeners = 100; console.log(`count(static): ${EventEmitter.listenerCount(emitter, 'send')}`); +console.log(`ncount: ${emitter.listenerCount('send')}`); setTimeout(() => { - console.log(`\ncount: ${emitter.listenerCount('send')}`); + console.log('\n'); emitter.emit('send'); }, 1000); setTimeout(() => { - console.log(`\ncount: ${emitter.listenerCount('send')}`); + console.log('\n'); emitter.emit('send'); emitter.removeListener('send', listener2); }, 2000); setTimeout(() => { - console.log(`\ncount: ${emitter.listenerCount('send')}`); - emitter.emit('send'); + console.log('\n'); + emitter.emit('send', 'params1'); emitter.removeAllListeners('send'); }, 3000); setTimeout(() => { - console.log(`\ncount: ${emitter.listenerCount('send')}`); + console.log('\n'); + emitter.emit(1); emitter.emit('send'); }, 3000); diff --git a/types/events/index.d.ts b/types/events/index.d.ts index 6907d6f07e..6214b5cf12 100644 --- a/types/events/index.d.ts +++ b/types/events/index.d.ts @@ -7,16 +7,16 @@ export type Listener = (...args: any[]) => void; export class EventEmitter { - static listenerCount(emitter: EventEmitter, type: string): number; + static listenerCount(emitter: EventEmitter, type: string | number): number; static defaultMaxListeners: number; setMaxListeners(n: number): this; - emit(type: string, ...args: any[]): boolean; - addListener(type: string, listener: Listener): this; - on(type: string, listener: Listener): this; - once(type: string, listener: Listener): this; - removeListener(type: string, listener: Listener): this; - removeAllListeners(type: string): this; - listeners(type: string): Listener[]; - listenerCount(type: string): number; + emit(type: string | number, ...args: any[]): boolean; + addListener(type: string | number, listener: Listener): this; + on(type: string | number, listener: Listener): this; + once(type: string | number, listener: Listener): this; + removeListener(type: string | number, listener: Listener): this; + removeAllListeners(type: string | number): this; + listeners(type: string | number): Listener[]; + listenerCount(type: string | number): number; } From 63c2ba94b2adb6ec908281f839f128c8229f65e8 Mon Sep 17 00:00:00 2001 From: yasupeke Date: Mon, 27 Nov 2017 19:06:02 +0900 Subject: [PATCH 163/269] [events]Deleted TypeScript Version --- types/events/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/events/index.d.ts b/types/events/index.d.ts index 6214b5cf12..85ce0a7b0e 100644 --- a/types/events/index.d.ts +++ b/types/events/index.d.ts @@ -2,7 +2,6 @@ // Project: https://github.com/Gozala/events // Definitions by: Yasunori Ohoka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 export type Listener = (...args: any[]) => void; From b6f4c866ce172223dcae77d34fdb2cd328686c06 Mon Sep 17 00:00:00 2001 From: Andre Wiggins Date: Mon, 27 Nov 2017 02:39:02 -0800 Subject: [PATCH 164/269] Expand gzip-size types for 4.1 --- types/gzip-size/gzip-size-tests.ts | 11 ++++++++- types/gzip-size/index.d.ts | 39 ++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/types/gzip-size/gzip-size-tests.ts b/types/gzip-size/gzip-size-tests.ts index f07d99bd50..f840c39239 100644 --- a/types/gzip-size/gzip-size-tests.ts +++ b/types/gzip-size/gzip-size-tests.ts @@ -1,7 +1,16 @@ -import gzipSize = require('gzip-size'); +import * as fs from 'fs'; +import * as gzipSize from 'gzip-size'; const string = 'Lorem ipsum dolor sit amet.'; console.log(string.length); +gzipSize(string).then(size => console.log(size)); + console.log(gzipSize.sync(string)); + +const stream = fs.createReadStream("index.d.ts"); +const gstream = stream.pipe(gzipSize.stream()).on("gzip-size", size => console.log(size)); +console.log(gstream.gzipSize); // Could be a number or undefined. Recommended to use "gzip-size" event instead + +gzipSize.file("index.d.ts").then(size => console.log(size)); diff --git a/types/gzip-size/index.d.ts b/types/gzip-size/index.d.ts index cab8ec225b..66251e0da8 100644 --- a/types/gzip-size/index.d.ts +++ b/types/gzip-size/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for gzip-size 4.0 +// Type definitions for gzip-size 4.1 // Project: https://github.com/sindresorhus/gzip-size // Definitions by: York Yao // Jimi van der Woning +// Andre Wiggins // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -9,11 +10,45 @@ import * as stream from 'stream'; import * as zlib from 'zlib'; +interface GzipSizeStream extends stream.PassThrough { + on(event: string, listener: (...args: any[]) => void): this; + on(event: "gzip-size", listener: (size: number) => void): this; + + /** + * Contains the gzip size of the stream after it is finished. + * Since this happens asynchronously, it is recommended you use + * the `.on("gzip-size", size => console.log(size))` method instead + */ + gzipSize?: number; +} + +/** + * Returns a Promise for the size. + * @param input A string or Buffer to determine the gzip size of + * @param options Any zlib option + */ declare function gzipSize(input: string | Buffer, options?: zlib.ZlibOptions): Promise; declare namespace gzipSize { + /** + * Returns the size synchronously + * @param input A string or Buffer to determine the gzip size of + * @param options Any zlib option + */ function sync(input: string | Buffer, options?: zlib.ZlibOptions): number; - function stream(options?: zlib.ZlibOptions): stream.PassThrough; + + /** + * Returns a stream.PassThrough. The stream emits a gzip-size event and has a gzipSize property. + * @param options Any zlib option + */ + function stream(options?: zlib.ZlibOptions): GzipSizeStream; + + /** + * Returns a Promise for the size of the file. + * @param path The path to the file + * @param options Any zlib option + */ + function file(path: string, options?: zlib.ZlibOptions): Promise; } export = gzipSize; From b7274857170a6bc986a1ada05e0ed8064f692dd5 Mon Sep 17 00:00:00 2001 From: Mike Woudenberg Date: Mon, 27 Nov 2017 10:55:21 +0100 Subject: [PATCH 165/269] Adds key to location method and adds timeout property to options --- types/cypress/cypress-tests.ts | 2 ++ types/cypress/index.d.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/cypress/cypress-tests.ts b/types/cypress/cypress-tests.ts index 806443474a..9502f1a63d 100644 --- a/types/cypress/cypress-tests.ts +++ b/types/cypress/cypress-tests.ts @@ -12,6 +12,8 @@ cy .get('.query-button') .contains('Save Form').should('have.class', 'btn'); +cy.location('host'); + cy .get('form') .find('input') diff --git a/types/cypress/index.d.ts b/types/cypress/index.d.ts index 808c765e24..f76aad4afb 100644 --- a/types/cypress/index.d.ts +++ b/types/cypress/index.d.ts @@ -249,7 +249,8 @@ declare namespace Cypress { /** * @see https://on.cypress.io/api/location */ - location(options?: Loggable): Chainable; + location(options?: LoggableTimeoutable): Chainable; + location(key: string, options?: LoggableTimeoutable): Chainable; /** * @see https://on.cypress.io/api/log From 4f999a5974494b4c1c328ca53aa5c0328779416f Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Mon, 27 Nov 2017 06:49:17 -0700 Subject: [PATCH 166/269] ember-data: add an overload for `pushPayload`. --- types/ember-data/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index bf273f2f20..1a874e5c64 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -993,6 +993,7 @@ declare namespace DS { * Push some raw data into the store. */ pushPayload(modelName: string, inputPayload: {}): any; + pushPayload(inputPayload: {}): any; /** * `normalize` converts a json payload into the normalized form that * [push](#method_push) expects. From 65398844556f3335c3eb66e13194bc3553c86f1c Mon Sep 17 00:00:00 2001 From: mmatessi Date: Mon, 27 Nov 2017 14:54:28 +0100 Subject: [PATCH 167/269] Added missing types of Plotly --- types/plotly.js/index.d.ts | 249 +++++++++++++++++++++++++++++-------- 1 file changed, 198 insertions(+), 51 deletions(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index a34dbf2ab8..1ca736a46f 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -94,23 +94,30 @@ export function downloadImage(root: Root, opts: DownloadImgopts): Promise; autosize: boolean; showlegend: boolean; - xaxis: Partial; - yaxis: Partial; - yaxis2: Partial; - yaxis3: Partial; - yaxis4: Partial; - yaxis5: Partial; - yaxis6: Partial; - yaxis7: Partial; - yaxis8: Partial; - yaxis9: Partial; + paper_bgcolor: Color; + plot_bgcolor: Color; + separators: string; + hidesources: boolean; + xaxis: Partial; + yaxis: Partial; + yaxis2: Partial; + yaxis3: Partial; + yaxis4: Partial; + yaxis5: Partial; + yaxis6: Partial; + yaxis7: Partial; + yaxis8: Partial; + yaxis9: Partial; margin: Partial; height: number; width: number; - hovermode: "closest" | "x" | "y" | false; - 'xaxis.range': [Datum, Datum]; + hovermode: 'closest' | 'x' | 'y' | false; + hoverlabel: Partial