mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge branch 'master' of git://github.com/DefinitelyTyped/DefinitelyTyped
This commit is contained in:
@@ -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",
|
||||
@@ -132,6 +138,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.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "constant-case",
|
||||
"typingsPackageName": "constant-case",
|
||||
@@ -558,6 +570,12 @@
|
||||
"sourceRepoURL": "https://github.com/gpbl/react-day-picker",
|
||||
"asOfVersion": "5.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-native-elements",
|
||||
"typingsPackageName": "react-native-elements",
|
||||
"sourceRepoURL": "https://github.com/react-native-training/react-native-elements",
|
||||
"asOfVersion": "0.18.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "realm",
|
||||
"typingsPackageName": "realm",
|
||||
|
||||
Vendored
+779
-18
@@ -4,15 +4,85 @@
|
||||
// Huw <https://github.com/hoo29>
|
||||
// pascalwhoop <https://github.com/pascalwhoop>
|
||||
// Ben <https://github.com/blforce>
|
||||
// rk-7 <https://github.com/rk-7>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export function handler<T>(event: RequestBody<T>, context: Context, callback?: (err: any, response: any) => void): AlexaObject<T>;
|
||||
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 {
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* 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?: ImageSourceSize;
|
||||
}
|
||||
export interface Image {
|
||||
contentDescription: string;
|
||||
sources: ImageSource[];
|
||||
}
|
||||
export interface TextField {
|
||||
text: string;
|
||||
type: string;
|
||||
}
|
||||
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;
|
||||
/**
|
||||
* Visibility of the back button.
|
||||
*/
|
||||
backButton?: TemplateBackButtonVisibility;
|
||||
/**
|
||||
* Template type.
|
||||
*/
|
||||
type: TemplateType;
|
||||
image?: Image;
|
||||
listItems?: ListItem[];
|
||||
}
|
||||
|
||||
export interface AlexaObject<T> extends Handler<T> {
|
||||
_event: any;
|
||||
@@ -38,12 +108,16 @@ export interface Handler<T> {
|
||||
emitWithState: any;
|
||||
state: any;
|
||||
handler: any;
|
||||
i18n: any;
|
||||
locale: any;
|
||||
event: RequestBody<T>;
|
||||
attributes: any;
|
||||
context: any;
|
||||
callback: (param: any) => void;
|
||||
name: any;
|
||||
isOverriden: any;
|
||||
t: (token: string, ...args: any[]) => void;
|
||||
response: ResponseBuilder;
|
||||
}
|
||||
|
||||
export interface Context {
|
||||
@@ -55,8 +129,28 @@ export interface Context {
|
||||
functionVersion: string;
|
||||
invokeid: string;
|
||||
awsRequestId: string;
|
||||
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;
|
||||
/**
|
||||
* Player activity
|
||||
*/
|
||||
playerActivity: AudioPlayerActivity;
|
||||
}
|
||||
|
||||
export interface RequestBody<T> {
|
||||
version: string;
|
||||
session: Session;
|
||||
@@ -66,20 +160,22 @@ export interface RequestBody<T> {
|
||||
export interface Session {
|
||||
new: boolean;
|
||||
sessionId: string;
|
||||
attributes: any;
|
||||
application: SessionApplication;
|
||||
attributes: { [key: string]: any };
|
||||
application: Application;
|
||||
user: SessionUser;
|
||||
}
|
||||
|
||||
export interface SessionApplication {
|
||||
applicationId: string;
|
||||
}
|
||||
|
||||
export interface SessionUser {
|
||||
userId: string;
|
||||
accessToken?: string;
|
||||
permissions: Permissions;
|
||||
}
|
||||
export interface Permissions {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
consentToken: string;
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export interface LaunchRequest extends Request { }
|
||||
|
||||
export interface IntentRequest extends Request {
|
||||
@@ -144,7 +240,8 @@ export interface Response {
|
||||
outputSpeech?: OutputSpeech;
|
||||
card?: Card;
|
||||
reprompt?: Reprompt;
|
||||
shouldEndSession: boolean;
|
||||
directives?: any;
|
||||
shouldEndSession?: boolean;
|
||||
}
|
||||
|
||||
export interface OutputSpeech {
|
||||
@@ -154,18 +251,682 @@ export interface OutputSpeech {
|
||||
}
|
||||
|
||||
export interface Card {
|
||||
type: "Simple" | "Standard" | "LinkAccount";
|
||||
type: CardType;
|
||||
title?: string;
|
||||
content?: string;
|
||||
text?: string;
|
||||
image?: Image;
|
||||
}
|
||||
|
||||
export interface Image {
|
||||
smallImageUrl: string;
|
||||
largeImageUrl: string;
|
||||
image?: CardImage;
|
||||
}
|
||||
|
||||
export interface Reprompt {
|
||||
outputSpeech: OutputSpeech;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* Todo-ListItem class
|
||||
* Refer https://developer.amazon.com/docs/custom-skills/access-the-alexa-shopping-and-to-do-lists.html
|
||||
*/
|
||||
export interface ListItemObject {
|
||||
/**
|
||||
* item id (String, limit 60 characters)
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* item value (String, limit is 256 characters)
|
||||
*/
|
||||
value: string;
|
||||
/**
|
||||
* item status
|
||||
*/
|
||||
status?: ListItemObjectStatus;
|
||||
/**
|
||||
* item version (Positive integer)
|
||||
*/
|
||||
version?: number | string;
|
||||
/**
|
||||
* 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 {
|
||||
/**
|
||||
* list id (String)
|
||||
*/
|
||||
listId: string;
|
||||
/**
|
||||
* list name (String)
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* state
|
||||
* "active" or "archived" (Enum)
|
||||
*/
|
||||
state?: ListObjectState;
|
||||
/**
|
||||
* 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 (Positive integer)
|
||||
*/
|
||||
version?: number;
|
||||
/**
|
||||
* 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: ListItemObjectStatus; };
|
||||
/**
|
||||
* Items that belong to this list.
|
||||
*/
|
||||
items: ListItemObject[];
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region templateBuilders
|
||||
/**
|
||||
* Generates templates for Echo Show device.
|
||||
*/
|
||||
export namespace templateBuilders {
|
||||
interface SetTextContent<T extends TemplateBuilder<T>> {
|
||||
setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T;
|
||||
}
|
||||
interface SetListItems<T extends TemplateBuilder<T>> {
|
||||
setListItems(listItems: ListItem[]): T;
|
||||
}
|
||||
/**
|
||||
* Refer https://developer.amazon.com/docs/custom-skills/display-interface-reference.html#image-sizes
|
||||
*/
|
||||
abstract class TemplateBuilder<T extends TemplateBuilder<T>> {
|
||||
template: Template;
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Sets the title of the template
|
||||
* @param title title
|
||||
* @returns TemplateBuilder
|
||||
*/
|
||||
setTitle(title: string): T;
|
||||
|
||||
/**
|
||||
* Sets the token of the template
|
||||
* @param token token
|
||||
* @returns TemplateBuilder
|
||||
*/
|
||||
setToken(token: string): T;
|
||||
|
||||
/**
|
||||
* Sets the background image of the template
|
||||
* @param image image
|
||||
* @returns TemplateBuilder
|
||||
*/
|
||||
setBackgroundImage(image: Image): T;
|
||||
|
||||
/**
|
||||
* Sets the backButton behavior
|
||||
* @param backButtonBehavior "VISIBLE" or "HIDDEN"
|
||||
* @returns TemplateBuilder
|
||||
*/
|
||||
setBackButtonBehavior(backButtonBehavior: string): T;
|
||||
|
||||
/**
|
||||
* Builds the template JSON object
|
||||
* @returns Template
|
||||
*/
|
||||
build(): Template;
|
||||
}
|
||||
/**
|
||||
* Used to build a list of ListItems for ListTemplate
|
||||
*/
|
||||
class ListItemBuilder {
|
||||
constructor();
|
||||
items: ListItem[];
|
||||
/**
|
||||
* Add an item to the list of template
|
||||
* @param image image
|
||||
* @param token token
|
||||
* @param primaryText primaryText
|
||||
* @param secondaryText secondaryText
|
||||
* @param tertiaryText tertiaryText
|
||||
*/
|
||||
addItem(image: Image, token: string, primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): ListItemBuilder;
|
||||
|
||||
build(): ListItem[];
|
||||
}
|
||||
/**
|
||||
* Used to create BodyTemplate1 objects
|
||||
*/
|
||||
class BodyTemplate1Builder extends TemplateBuilder<BodyTemplate1Builder> implements SetTextContent<BodyTemplate1Builder> {
|
||||
constructor();
|
||||
/**
|
||||
* Sets the text content for the template
|
||||
* @param primaryText primaryText
|
||||
* @param secondaryText secondaryText
|
||||
* @param tertiaryText tertiaryText
|
||||
* @returns BodyTemplate1Builder
|
||||
*/
|
||||
setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate1Builder;
|
||||
}
|
||||
/**
|
||||
* Used to create BodyTemplate2 objects
|
||||
*/
|
||||
class BodyTemplate2Builder extends TemplateBuilder<BodyTemplate2Builder> implements SetTextContent<BodyTemplate2Builder> {
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Sets the image for the template
|
||||
* @param image image
|
||||
* @returns BodyTemplate2Builder
|
||||
*/
|
||||
setImage(image: Image): BodyTemplate2Builder;
|
||||
|
||||
/**
|
||||
* Sets the text content for the template
|
||||
* @param primaryText primaryText
|
||||
* @param secondaryText secondaryText
|
||||
* @param tertiaryText tertiaryText
|
||||
* @returns BodyTemplate2Builder
|
||||
*/
|
||||
setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate2Builder;
|
||||
}
|
||||
/**
|
||||
* Used to create BodyTemplate3 objects
|
||||
*/
|
||||
class BodyTemplate3Builder extends TemplateBuilder<BodyTemplate3Builder> implements SetTextContent<BodyTemplate3Builder> {
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Sets the image for the template
|
||||
* @param image image
|
||||
* @returns BodyTemplate3Builder
|
||||
*/
|
||||
setImage(image: Image): BodyTemplate3Builder;
|
||||
|
||||
/**
|
||||
* Sets the text content for the template
|
||||
* @param primaryText primaryText
|
||||
* @param secondaryText secondaryText
|
||||
* @param tertiaryText tertiaryText
|
||||
* @returns BodyTemplate3Builder
|
||||
*/
|
||||
setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate3Builder;
|
||||
}
|
||||
/**
|
||||
* Used to create BodyTemplate6 objects
|
||||
*/
|
||||
class BodyTemplate6Builder extends TemplateBuilder<BodyTemplate6Builder> implements SetTextContent<BodyTemplate6Builder> {
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Sets the image for the template
|
||||
* @param image image
|
||||
* @returns BodyTemplate6Builder
|
||||
*/
|
||||
setImage(image: Image): BodyTemplate6Builder;
|
||||
|
||||
/**
|
||||
* Sets the text content for the template
|
||||
* @param primaryText primaryText
|
||||
* @param secondaryText secondaryText
|
||||
* @param tertiaryText tertiaryText
|
||||
* @returns BodyTemplate6Builder
|
||||
*/
|
||||
setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate6Builder;
|
||||
}
|
||||
/**
|
||||
* Used to create BodyTemplate7 objects
|
||||
*/
|
||||
class BodyTemplate7Builder extends TemplateBuilder<BodyTemplate7Builder> {
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Sets the image for the template
|
||||
* @param image image
|
||||
* @returns BodyTemplate7Builder
|
||||
*/
|
||||
setImage(image: Image): BodyTemplate7Builder;
|
||||
}
|
||||
/**
|
||||
* Used to create ListTemplate1 objects
|
||||
*/
|
||||
class ListTemplate1Builder extends TemplateBuilder<ListTemplate1Builder> implements SetListItems<ListTemplate1Builder> {
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Set the items for the list
|
||||
* @param listItems listItems
|
||||
* @returns ListTemplate1Builder
|
||||
*/
|
||||
setListItems(listItems: ListItem[]): ListTemplate1Builder;
|
||||
}
|
||||
/**
|
||||
* Used to create ListTemplate2 objects
|
||||
*/
|
||||
class ListTemplate2Builder extends TemplateBuilder<ListTemplate2Builder> implements SetListItems<ListTemplate2Builder> {
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Set the items for the list
|
||||
* @param listItems listItems
|
||||
* @returns ListTemplate2Builder
|
||||
*/
|
||||
setListItems(listItems: ListItem[]): ListTemplate2Builder;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region services
|
||||
export namespace services {
|
||||
interface ApiClient {
|
||||
/**
|
||||
* Make a POST API call to the specified uri with headers and optional body
|
||||
* @param uri http(s?) endpoint to call
|
||||
* @param headers Key value pair of headers
|
||||
* @param body post body to send
|
||||
* @returns Promise<ApiClientResponse>
|
||||
*/
|
||||
post(uri: string, headers: object, body?: string): Promise<ApiClientResponse>;
|
||||
/**
|
||||
* Make a PUT API call to the specified uri with headers and optional body
|
||||
* @param uri http(s?) endpoint to call
|
||||
* @param headers Key value pair of headers
|
||||
* @param body post body to send
|
||||
* @returns Promise<ApiClientResponse>
|
||||
*/
|
||||
put(uri: string, headers: object, body?: string): Promise<ApiClientResponse>;
|
||||
/**
|
||||
* Make a GET API call to the specified uri with headers
|
||||
* @param uri http(s?) endpoint to call
|
||||
* @param headers key value pair of headers
|
||||
* @returns Promise<ApiClientResponse>
|
||||
*/
|
||||
get(uri: string, headers: object): Promise<ApiClientResponse>;
|
||||
/**
|
||||
* 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<ApiClientResponse>
|
||||
*/
|
||||
delete(uri: string, headers: object): Promise<ApiClientResponse>;
|
||||
}
|
||||
class DeviceAddressService {
|
||||
/**
|
||||
* Create an instance of DeviceAddressService
|
||||
* @param [apiClient=new ApiClient()] ApiClient
|
||||
*/
|
||||
constructor(apiClient: ApiClient);
|
||||
|
||||
/**
|
||||
* Get full address information from Alexa Device Address API
|
||||
* @param deviceId deviceId from Alexa request
|
||||
* @param apiEndpoint API apiEndpoint from Alexa request
|
||||
* @param token bearer token for device address permission
|
||||
* @returns Promise<object>
|
||||
*/
|
||||
getFullAddress(deviceId: string, apiEndpoint: string, token: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* Get country and postal information from Alexa Device Address API
|
||||
* @param deviceId deviceId from Alexa request
|
||||
* @param apiEndpoint API apiEndpoint from Alexa request
|
||||
* @param token bearer token for device address permission
|
||||
* @returns Promise<object>
|
||||
*/
|
||||
getCountryAndPostalCode(deviceId: string, apiEndpoint: string, token: string): Promise<object>;
|
||||
}
|
||||
class DirectiveService {
|
||||
/**
|
||||
* Creates an instance of DirectiveService.
|
||||
* @param [apiClient=new ApiClient()] ApiClient
|
||||
*/
|
||||
constructor(apiClient: ApiClient);
|
||||
|
||||
/**
|
||||
* Send the specified directiveObj to Alexa directive service
|
||||
*
|
||||
* @param directive directive to send to service
|
||||
* @param apiEndpoint API endpoint from Alexa request
|
||||
* @param token bearer token for directive service
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
enqueue(directive: object, apiEndpoint: string, token: string): Promise<void>;
|
||||
}
|
||||
class ListManagementService {
|
||||
/**
|
||||
* Create an instance of ListManagementService
|
||||
* @param apiClient apiClient
|
||||
*/
|
||||
constructor(apiClient: ApiClient);
|
||||
|
||||
/**
|
||||
* Set apiEndpoint address, default is "https://api.amazonalexa.com"
|
||||
* @param apiEndpoint apiEndpoint
|
||||
* @returns void
|
||||
*/
|
||||
setApiEndpoint(apiEndpoint: string): void;
|
||||
|
||||
/**
|
||||
* Get currently set apiEndpoint address
|
||||
* @returns string
|
||||
*/
|
||||
getApiEndpoint(): string;
|
||||
|
||||
/**
|
||||
* Retrieve the metadata for all customer lists, including the customer's default lists
|
||||
* @param token bearer token for list management permission
|
||||
* @returns Promise<object>
|
||||
*/
|
||||
getListsMetadata(token: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* Create a custom list. The new list name must be different than any existing list name
|
||||
* @param listObject listObject
|
||||
* @param token bearer token for list management permission
|
||||
* @returns Promise<object>
|
||||
*/
|
||||
createList(listObject: ListObject, token: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* 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 token bearer token for list management permission
|
||||
* @returns Promise<object>
|
||||
*/
|
||||
getList(listId: string, itemStatus: ListItemObjectStatus, token: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* Update a custom list. Only the list name or state can be updated
|
||||
* @param listId unique Id associated with the list
|
||||
* @param listObject listObject
|
||||
* @param token bearer token for list management permission
|
||||
* @returns Promise<object>
|
||||
*/
|
||||
updateList(listId: string, listObject: ListObject, token: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* Delete a custom list
|
||||
* @param listId unique Id associated with the list
|
||||
* @param token bearer token for list management permission
|
||||
* @returns Promise<object>
|
||||
*/
|
||||
deleteList(listId: string, token: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* Create an item in an active list or in a default list
|
||||
* @param listId unique Id associated with the list
|
||||
* @param listItemObject listItemObject
|
||||
* @param token bearer token for list management permission
|
||||
* @returns Promise<object>
|
||||
*/
|
||||
createListItem(listId: string, listItemObject: ListItemObject, token: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* Retrieve single item within any list by listId and itemId
|
||||
* @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<object>
|
||||
*/
|
||||
getListItem(listId: string, itemId: string, token: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* Update an item value or item status
|
||||
* @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<object>
|
||||
*/
|
||||
updateListItem(listId: string, itemId: string, listItemObject: ListItemObject, token: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* Delete an item in the specified list
|
||||
* @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<object>
|
||||
*/
|
||||
deleteListItem(listId: string, itemId: string, token: string): Promise<object>;
|
||||
}
|
||||
}
|
||||
//#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
|
||||
*/
|
||||
export class ResponseBuilder {
|
||||
constructor(alexaHandler: Handler<Request>);
|
||||
|
||||
/**
|
||||
* Have Alexa say the provided speechOutput to the user
|
||||
* @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 repromptSpeech repromptSpeech
|
||||
* @returns ResponseBuilder
|
||||
*/
|
||||
listen(repromptSpeech: string): ResponseBuilder;
|
||||
|
||||
/**
|
||||
* Render a card with the following title, content and image
|
||||
* @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 ResponseBuilder
|
||||
*/
|
||||
linkAccountCard(): ResponseBuilder;
|
||||
|
||||
/**
|
||||
* Render a askForPermissionsConsent card
|
||||
* @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 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 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 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 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 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 ResponseBuilder
|
||||
*/
|
||||
audioPlayerPlay(behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder;
|
||||
|
||||
/**
|
||||
* Creates an AudioPlayer Stop directive - Stops the current audio Playback
|
||||
* @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 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 ResponseBuilder
|
||||
*/
|
||||
audioPlayerClearQueue(clearBehavior: string): ResponseBuilder;
|
||||
|
||||
/**
|
||||
* Creates a Display RenderTemplate Directive
|
||||
* Use a template builder to generate a template object
|
||||
* @param template template
|
||||
* @returns ResponseBuilder
|
||||
*/
|
||||
renderTemplate(template: Template): ResponseBuilder;
|
||||
|
||||
/**
|
||||
* Creates a hint directive - show a hint on the screen of the echo show
|
||||
* @param hintText text to show on the hint
|
||||
* @param hintType (optional) Default value : PlainText
|
||||
* @returns ResponseBuilder
|
||||
*/
|
||||
hint(hintText: string, hintType?: HintType): ResponseBuilder;
|
||||
|
||||
/**
|
||||
* Creates a VideoApp play directive to play a video
|
||||
* @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 metadata (optional) Contains an object that provides the
|
||||
* information that can be displayed on VideoApp.
|
||||
* @returns ResponseBuilder
|
||||
*/
|
||||
playVideo(source: string, metadata?: { title: string, subtitle: string }): ResponseBuilder;
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region directives
|
||||
export namespace directives {
|
||||
class VoicePlayerSpeakDirective {
|
||||
header: { requestId: string };
|
||||
directive: { type: string, speech: string };
|
||||
/**
|
||||
* Creates an instance of VoicePlayerSpeakDirective.
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region utils
|
||||
export namespace utils {
|
||||
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,
|
||||
* 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")
|
||||
* @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
|
||||
*/
|
||||
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.
|
||||
* 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: ImageSourceSize }>, description: string): Image;
|
||||
}
|
||||
/**
|
||||
* Utility methods for building TextField objects
|
||||
*/
|
||||
namespace TextUtils {
|
||||
/**
|
||||
* Creates a plain TextField object with contents : text
|
||||
* @param text contents of plain text object
|
||||
* @returns TextField
|
||||
*/
|
||||
function makePlainText(text: string): TextField;
|
||||
|
||||
/**
|
||||
* Creates a rich TextField object with contents : text
|
||||
* @param text text
|
||||
* @returns TextField
|
||||
*/
|
||||
function makeRichText(text: string): TextField;
|
||||
|
||||
/**
|
||||
* Creates a textContent
|
||||
* @param primaryText primary Text
|
||||
* @param secondaryText secondary Text
|
||||
* @param tertiaryText tertiary Text
|
||||
* @returns TextContent
|
||||
*/
|
||||
function makeTextContent(primaryText: { type: TextContentType, text: string },
|
||||
secondaryText: { type: TextContentType, text: string }, tertiaryText: { type: TextContentType, text: string }): TextContent;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"alexa-sdk-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +1,62 @@
|
||||
let dummySocket: ng.websocket.IWebSocket;
|
||||
let dummyPromise: ng.IPromise<void>;
|
||||
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<void>, 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;
|
||||
};
|
||||
|
||||
Vendored
+40
-35
@@ -1,39 +1,45 @@
|
||||
// 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 <https://github.com/nickveys>
|
||||
// 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 {
|
||||
|
||||
/**
|
||||
* Options available to be specified for IWebSocketProvider.
|
||||
*/
|
||||
type IWebSocketConfigOptions = {
|
||||
scope?: ng.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.
|
||||
@@ -44,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: ng.IPromise<void>;
|
||||
interface IWebSocketQueueItem {
|
||||
message: any;
|
||||
defered: IPromise<void>;
|
||||
}
|
||||
|
||||
interface IWebSocket {
|
||||
|
||||
/**
|
||||
* Adds a callback to be executed each time a socket connection is opened for
|
||||
* this instance.
|
||||
@@ -108,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 | {}): ng.IPromise<any>;
|
||||
send(data: string | {}): IPromise<any>;
|
||||
|
||||
/**
|
||||
* WebSocket instance.
|
||||
@@ -123,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.
|
||||
@@ -133,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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-websocket-tests.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import ansiRegex = require("ansi-regex");
|
||||
|
||||
ansiRegex(); // $ExpectType RegExp
|
||||
|
||||
// From the ansi-regex README.md
|
||||
ansiRegex().test('\u001B[4mcake\u001B[0m'); // $ExpectType boolean
|
||||
// => true
|
||||
|
||||
ansiRegex().test('cake'); // $ExpectType boolean
|
||||
// => false
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex()); // $ExpectType RegExpMatchArray | null
|
||||
// => ['\u001B[4m', '\u001B[0m']
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Type definitions for ansi-regex 3.0
|
||||
// Project: https://github.com/chalk/ansi-regex#readme
|
||||
// Definitions by: Manish Vachharajani <https://github.com/mvachhar>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function r(): RegExp;
|
||||
export = r;
|
||||
@@ -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",
|
||||
"ansi-regex-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -22,7 +22,7 @@ describe("ApplePaySession", () => {
|
||||
});
|
||||
it("can create a new instance", () => {
|
||||
const version = 1;
|
||||
const paymentRequest = {
|
||||
const paymentRequest: ApplePayJS.ApplePayPaymentRequest = {
|
||||
countryCode: "US",
|
||||
currencyCode: "USD",
|
||||
supportedNetworks: [
|
||||
@@ -57,8 +57,8 @@ describe("ApplePaySession", () => {
|
||||
});
|
||||
});
|
||||
it("can call instance methods", () => {
|
||||
const version = 1;
|
||||
const paymentRequest = {
|
||||
const version = 3;
|
||||
const paymentRequest: ApplePayJS.ApplePayPaymentRequest = {
|
||||
countryCode: "US",
|
||||
currencyCode: "USD",
|
||||
supportedNetworks: [
|
||||
@@ -66,7 +66,9 @@ describe("ApplePaySession", () => {
|
||||
"visa"
|
||||
],
|
||||
merchantCapabilities: [
|
||||
"supports3DS"
|
||||
"supports3DS",
|
||||
"supportsCredit",
|
||||
"supportsDebit"
|
||||
],
|
||||
total: {
|
||||
label: "My Store",
|
||||
@@ -80,15 +82,29 @@ describe("ApplePaySession", () => {
|
||||
session.completeMerchantValidation({
|
||||
foo: "bar"
|
||||
});
|
||||
|
||||
session.completePayment(ApplePaySession.STATUS_SUCCESS);
|
||||
|
||||
const total = {
|
||||
const authorizationResult: ApplePayJS.ApplePayPaymentAuthorizationResult = {
|
||||
status: ApplePaySession.STATUS_FAILURE,
|
||||
errors: [
|
||||
{
|
||||
code: "addressUnserviceable",
|
||||
contactField: "postalCode",
|
||||
message: "The specified postal code cannot be delivered to."
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
session.completePayment(authorizationResult);
|
||||
|
||||
const total: ApplePayJS.ApplePayLineItem = {
|
||||
label: "Subtotal",
|
||||
type: "final",
|
||||
amount: "35.00"
|
||||
};
|
||||
|
||||
const lineItems = [
|
||||
const lineItems: ApplePayJS.ApplePayLineItem[] = [
|
||||
{
|
||||
label: "Subtotal",
|
||||
type: "final",
|
||||
@@ -97,11 +113,12 @@ describe("ApplePaySession", () => {
|
||||
{
|
||||
label: "Free Shipping",
|
||||
amount: "0.00",
|
||||
type: "pending"
|
||||
type: "final"
|
||||
},
|
||||
{
|
||||
label: "Estimated Tax",
|
||||
amount: "3.06"
|
||||
amount: "3.06",
|
||||
type: "pending"
|
||||
}
|
||||
];
|
||||
|
||||
@@ -120,17 +137,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;
|
||||
};
|
||||
@@ -201,7 +236,9 @@ describe("ApplePayPaymentRequest", () => {
|
||||
"1 Infinite Loop"
|
||||
],
|
||||
locality: "Cupertino",
|
||||
subLocality: "",
|
||||
administrativeArea: "CA",
|
||||
subAdministrativeArea: "",
|
||||
postalCode: "95014",
|
||||
country: "United States",
|
||||
countryCode: "US"
|
||||
@@ -233,7 +270,7 @@ describe("ApplePayPaymentRequest", () => {
|
||||
"postalAddress",
|
||||
"name",
|
||||
"phone",
|
||||
"email"
|
||||
"name"
|
||||
];
|
||||
|
||||
paymentRequest.shippingContact = {
|
||||
@@ -241,11 +278,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 +306,6 @@ describe("ApplePayPaymentRequest", () => {
|
||||
];
|
||||
|
||||
paymentRequest.shippingType = "storePickup";
|
||||
paymentRequest.shippingType = "delivery";
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+322
-52
@@ -1,26 +1,26 @@
|
||||
// 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 <https://martincostello.com/>
|
||||
// Definitions by: Martin Costello <https://github.com/martincostello>
|
||||
// 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<boolean>;
|
||||
|
||||
/**
|
||||
* 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<boolean>;
|
||||
|
||||
/**
|
||||
* 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,33 @@ 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;
|
||||
|
||||
/**
|
||||
* Call when a payment has been authorized.
|
||||
* @param status - The status of the payment.
|
||||
* 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;
|
||||
completePayment(result: number | ApplePayJS.ApplePayPaymentAuthorizationResult): void;
|
||||
|
||||
/**
|
||||
* Call after a payment method has been selected.
|
||||
* 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 +121,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 +182,78 @@ declare class ApplePaySession extends EventTarget {
|
||||
}
|
||||
|
||||
declare namespace ApplePayJS {
|
||||
/**
|
||||
* Field names used for requesting contact information in a payment request.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
type ApplePayErrorCode =
|
||||
/**
|
||||
* Shipping address or contact information is invalid or missing.
|
||||
*/
|
||||
'shippingContactInvalid' |
|
||||
|
||||
/**
|
||||
* Billing address information is invalid or missing.
|
||||
*/
|
||||
'billingContactInvalid' |
|
||||
|
||||
/**
|
||||
* The merchant cannot provide service to the shipping address (for example, can't deliver to a P.O. Box).
|
||||
*/
|
||||
'addressUnserviceable' |
|
||||
|
||||
/**
|
||||
* An unknown but nonfatal error occurred during payment processing. The user can attempt authorization again.
|
||||
*/
|
||||
'unknown';
|
||||
|
||||
/**
|
||||
* Names of the fields in the shipping or billing contact information, used to locate errors in the payment sheet.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -180,15 +271,53 @@ declare namespace ApplePayJS {
|
||||
/**
|
||||
* A value that indicates if the line item is final or pending.
|
||||
*/
|
||||
type?: string;
|
||||
type?: ApplePayLineItemType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A type that indicates whether a line item is final or pending.
|
||||
*/
|
||||
type ApplePayLineItemType =
|
||||
/**
|
||||
* A line item representing the known, final cost.
|
||||
*/
|
||||
'final' |
|
||||
|
||||
/**
|
||||
* A line item representing an estimated or unknown cost.
|
||||
*/
|
||||
'pending';
|
||||
|
||||
/**
|
||||
* The payment capabilities supported by the merchant.
|
||||
*/
|
||||
type ApplePayMerchantCapability =
|
||||
/**
|
||||
* Required. This value must be supplied.
|
||||
*/
|
||||
'supports3DS' |
|
||||
|
||||
/**
|
||||
* Include this value only if you support China Union Pay transactions.
|
||||
*/
|
||||
'supportsEMV' |
|
||||
|
||||
/**
|
||||
* Optional. If present, only transactions that are categorized as credit cards are allowed.
|
||||
*/
|
||||
'supportsCredit' |
|
||||
|
||||
/**
|
||||
* Optional. If present, only transactions that are categorized as debit cards are allowed.
|
||||
*/
|
||||
'supportsDebit';
|
||||
|
||||
/**
|
||||
* Represents the result of authorizing a payment request and contains encrypted payment information.
|
||||
*/
|
||||
interface ApplePayPayment {
|
||||
/**
|
||||
* The encrypted token for an authorized payment.
|
||||
* The encrypted information for an authorized payment.
|
||||
*/
|
||||
token: ApplePayPaymentToken;
|
||||
|
||||
@@ -208,11 +337,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.
|
||||
*/
|
||||
@@ -220,56 +364,76 @@ 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 address for the contact.
|
||||
* The phonetic spelling of the contact's family name.
|
||||
*/
|
||||
addressLines: string[];
|
||||
phoneticFamilyName?: string;
|
||||
|
||||
/**
|
||||
* The phonetic spelling of the contact's given name.
|
||||
*/
|
||||
phoneticGivenName?: string;
|
||||
|
||||
/**
|
||||
* The street portion of the address for the contact.
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* The state for the contact.
|
||||
*/
|
||||
administrativeArea: string;
|
||||
administrativeArea?: string;
|
||||
|
||||
/**
|
||||
* The zip code, where applicable, for the contact.
|
||||
* The subadministrative area (such as a county or other region) in a postal address.
|
||||
*/
|
||||
postalCode: string;
|
||||
subAdministrativeArea?: string;
|
||||
|
||||
/**
|
||||
* The colloquial country name for the contact.
|
||||
* The zip code or postal code, where applicable, for the contact.
|
||||
*/
|
||||
country: string;
|
||||
postalCode?: string;
|
||||
|
||||
/**
|
||||
* The contact's ISO country code.
|
||||
* The name of the country for the contact.
|
||||
*/
|
||||
countryCode: string;
|
||||
country?: string;
|
||||
|
||||
/**
|
||||
* 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 +443,29 @@ 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: 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.
|
||||
*/
|
||||
type ApplePayPaymentMethodType =
|
||||
'debit' |
|
||||
'credit' |
|
||||
'prepaid' |
|
||||
'store';
|
||||
|
||||
/**
|
||||
* The ApplePayPaymentMethodSelectedEvent class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function.
|
||||
*/
|
||||
@@ -304,6 +476,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,9 +518,38 @@ declare namespace ApplePayJS {
|
||||
/**
|
||||
* The activation state of the pass.
|
||||
*/
|
||||
activationState: string;
|
||||
activationState: ApplePayPaymentPassActivationState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment pass activation states.
|
||||
*/
|
||||
type ApplePayPaymentPassActivationState =
|
||||
/**
|
||||
* Active and ready to be used for payment.
|
||||
*/
|
||||
'activated' |
|
||||
|
||||
/**
|
||||
* Not active but may be activated by the issuer.
|
||||
*/
|
||||
'requiresActivation' |
|
||||
|
||||
/**
|
||||
* Not ready for use but activation is in progress.
|
||||
*/
|
||||
'activating' |
|
||||
|
||||
/**
|
||||
* Not active and can't be activated.
|
||||
*/
|
||||
'suspended' |
|
||||
|
||||
/**
|
||||
* Not active because the issuer has disabled the account associated with the device.
|
||||
*/
|
||||
'deactivated';
|
||||
|
||||
/**
|
||||
* Encapsulates a request for payment, including information about payment processing capabilities, the payment amount, and shipping information.
|
||||
*/
|
||||
@@ -357,7 +573,7 @@ declare namespace ApplePayJS {
|
||||
* The payment capabilities supported by the merchant.
|
||||
* The value must at least contain ApplePayMerchantCapability.supports3DS.
|
||||
*/
|
||||
merchantCapabilities: string[];
|
||||
merchantCapabilities: ApplePayMerchantCapability[];
|
||||
|
||||
/**
|
||||
* The payment networks supported by the merchant.
|
||||
@@ -377,12 +593,12 @@ declare namespace ApplePayJS {
|
||||
/**
|
||||
* The billing information that you require from the user in order to process the transaction.
|
||||
*/
|
||||
requiredBillingContactFields?: string[];
|
||||
requiredBillingContactFields?: ApplePayContactField[];
|
||||
|
||||
/**
|
||||
* The shipping information that you require from the user in order to fulfill the order.
|
||||
*/
|
||||
requiredShippingContactFields?: string[];
|
||||
requiredShippingContactFields?: ApplePayContactField[];
|
||||
|
||||
/**
|
||||
* Shipping contact information for the user.
|
||||
@@ -397,7 +613,12 @@ declare namespace ApplePayJS {
|
||||
/**
|
||||
* How the items are to be shipped.
|
||||
*/
|
||||
shippingType?: string;
|
||||
shippingType?: ApplePayShippingType;
|
||||
|
||||
/**
|
||||
* A list of ISO 3166 country codes for limiting payments to cards from specific countries.
|
||||
*/
|
||||
supportedCountries?: string[];
|
||||
|
||||
/**
|
||||
* Optional user-defined data.
|
||||
@@ -406,7 +627,7 @@ declare namespace ApplePayJS {
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains the user's payment credentials.
|
||||
* An object that contains the user's payment credentials.
|
||||
*/
|
||||
interface ApplePayPaymentToken {
|
||||
/**
|
||||
@@ -426,7 +647,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 +656,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 +717,35 @@ 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.
|
||||
*/
|
||||
type ApplePayShippingType =
|
||||
'shipping' |
|
||||
'delivery' |
|
||||
'storePickup' |
|
||||
'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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
Vendored
+63
-2
@@ -1,7 +1,8 @@
|
||||
// Type definitions for Auth0.js 8.10
|
||||
// Type definitions for Auth0.js 8.11
|
||||
// Project: https://github.com/auth0/auth0.js
|
||||
// Definitions by: Adrian Chia <https://github.com/adrianchia>
|
||||
// Matt Durrant <https://github.com/mdurrant>
|
||||
// Peter Blazejewicz <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace auth0;
|
||||
@@ -525,14 +526,19 @@ export interface Auth0Error {
|
||||
statusText?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The contents of the authResult object returned by {@link WebAuth#parseHash }
|
||||
*/
|
||||
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. */
|
||||
@@ -667,17 +673,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 {
|
||||
|
||||
Vendored
+2
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for AutobahnJS v0.9.7
|
||||
// Project: http://autobahn.ws/js/
|
||||
// Definitions by: Elad Zelingher <https://github.com/darkl>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>, Wladimir Totino <https://github.com/valepu>
|
||||
// Definitions by: Elad Zelingher <https://github.com/darkl>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>, Wladimir Totino <https://github.com/valepu>, Mathias Teier <https://github.com/glenroy37/,http://kagent.at>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="when" />
|
||||
@@ -179,6 +179,7 @@ declare namespace autobahn {
|
||||
|
||||
interface ISubscribeOptions {
|
||||
match?: string;
|
||||
get_retained?: boolean;
|
||||
}
|
||||
|
||||
interface IRegisterOptions {
|
||||
|
||||
@@ -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'
|
||||
Vendored
-10
@@ -1,10 +0,0 @@
|
||||
// Type definitions for autobind-decorator v1.3.3
|
||||
// Project: https://github.com/andreypopp/autobind-decorator
|
||||
// Definitions by: Ivo Stratev <https://github.com/NoHomey>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'autobind-decorator' {
|
||||
function autobind<TFunction extends Function>(target: TFunction): TFunction | void;
|
||||
function autobind<T extends Function>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
|
||||
export = autobind;
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -294,6 +294,9 @@ function callback(cb: AWSLambda.Callback) {
|
||||
cb(null);
|
||||
cb(error);
|
||||
cb(null, anyObj);
|
||||
cb(null, b);
|
||||
cb(null, str);
|
||||
cb(null, num);
|
||||
}
|
||||
|
||||
/* Proxy Callback */
|
||||
|
||||
Vendored
+2
-1
@@ -9,6 +9,7 @@
|
||||
// wwwy3y3 <https://github.com/wwwy3y3>
|
||||
// Ishaan Malhi <https://github.com/OrthoDex>
|
||||
// Daniel Cottone <https://github.com/daniel-cottone>
|
||||
// Kostya Misura <https://github.com/kostya-misura>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -364,7 +365,7 @@ export type CustomAuthorizerHandler = (event: CustomAuthorizerEvent, context: Co
|
||||
* @param error – an optional parameter that you can use to provide results of the failed Lambda function execution.
|
||||
* @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible.
|
||||
*/
|
||||
export type Callback = (error?: Error | null, result?: object) => void;
|
||||
export type Callback = (error?: Error | null, result?: object | boolean | number | string) => void;
|
||||
export type ProxyCallback = (error?: Error | null, result?: ProxyResult) => void;
|
||||
export type CustomAuthorizerCallback = (error?: Error | null, result?: AuthResponse) => void;
|
||||
|
||||
|
||||
Vendored
+178
-178
@@ -600,185 +600,185 @@ export class NodePath<T = Node> {
|
||||
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<t.ArrayExpression> ;
|
||||
isAssignmentExpression(opts?: object): this is NodePath<t.AssignmentExpression>;
|
||||
isBinaryExpression(opts?: object): this is NodePath<t.BinaryExpression>;
|
||||
isDirective(opts?: object): this is NodePath<t.Directive>;
|
||||
isDirectiveLiteral(opts?: object): this is NodePath<t.DirectiveLiteral>;
|
||||
isBlockStatement(opts?: object): this is NodePath<t.BlockStatement>;
|
||||
isBreakStatement(opts?: object): this is NodePath<t.BreakStatement>;
|
||||
isCallExpression(opts?: object): this is NodePath<t.CallExpression>;
|
||||
isCatchClause(opts?: object): this is NodePath<t.CatchClause>;
|
||||
isConditionalExpression(opts?: object): this is NodePath<t.ConditionalExpression>;
|
||||
isContinueStatement(opts?: object): this is NodePath<t.ContinueStatement>;
|
||||
isDebuggerStatement(opts?: object): this is NodePath<t.DebuggerStatement>;
|
||||
isDoWhileStatement(opts?: object): this is NodePath<t.DoWhileStatement>;
|
||||
isEmptyStatement(opts?: object): this is NodePath<t.EmptyStatement>;
|
||||
isExpressionStatement(opts?: object): this is NodePath<t.ExpressionStatement>;
|
||||
isFile(opts?: object): this is NodePath<t.File>;
|
||||
isForInStatement(opts?: object): this is NodePath<t.ForInStatement>;
|
||||
isForStatement(opts?: object): this is NodePath<t.ForStatement>;
|
||||
isFunctionDeclaration(opts?: object): this is NodePath<t.FunctionDeclaration>;
|
||||
isFunctionExpression(opts?: object): this is NodePath<t.FunctionExpression>;
|
||||
isIdentifier(opts?: object): this is NodePath<t.Identifier>;
|
||||
isIfStatement(opts?: object): this is NodePath<t.IfStatement>;
|
||||
isLabeledStatement(opts?: object): this is NodePath<t.LabeledStatement>;
|
||||
isStringLiteral(opts?: object): this is NodePath<t.StringLiteral>;
|
||||
isNumericLiteral(opts?: object): this is NodePath<t.NumericLiteral>;
|
||||
isNullLiteral(opts?: object): this is NodePath<t.NullLiteral>;
|
||||
isBooleanLiteral(opts?: object): this is NodePath<t.BooleanLiteral>;
|
||||
isRegExpLiteral(opts?: object): this is NodePath<t.RegExpLiteral>;
|
||||
isLogicalExpression(opts?: object): this is NodePath<t.LogicalExpression>;
|
||||
isMemberExpression(opts?: object): this is NodePath<t.MemberExpression>;
|
||||
isNewExpression(opts?: object): this is NodePath<t.NewExpression>;
|
||||
isProgram(opts?: object): this is NodePath<t.Program>;
|
||||
isObjectExpression(opts?: object): this is NodePath<t.ObjectExpression>;
|
||||
isObjectMethod(opts?: object): this is NodePath<t.ObjectMethod>;
|
||||
isObjectProperty(opts?: object): this is NodePath<t.ObjectProperty>;
|
||||
isRestElement(opts?: object): this is NodePath<t.RestElement>;
|
||||
isReturnStatement(opts?: object): this is NodePath<t.ReturnStatement>;
|
||||
isSequenceExpression(opts?: object): this is NodePath<t.SequenceExpression>;
|
||||
isSwitchCase(opts?: object): this is NodePath<t.SwitchCase>;
|
||||
isSwitchStatement(opts?: object): this is NodePath<t.SwitchStatement>;
|
||||
isThisExpression(opts?: object): this is NodePath<t.ThisExpression>;
|
||||
isThrowStatement(opts?: object): this is NodePath<t.ThrowStatement>;
|
||||
isTryStatement(opts?: object): this is NodePath<t.TryStatement>;
|
||||
isUnaryExpression(opts?: object): this is NodePath<t.UnaryExpression>;
|
||||
isUpdateExpression(opts?: object): this is NodePath<t.UpdateExpression>;
|
||||
isVariableDeclaration(opts?: object): this is NodePath<t.VariableDeclaration>;
|
||||
isVariableDeclarator(opts?: object): this is NodePath<t.VariableDeclarator>;
|
||||
isWhileStatement(opts?: object): this is NodePath<t.WhileStatement>;
|
||||
isWithStatement(opts?: object): this is NodePath<t.WithStatement>;
|
||||
isAssignmentPattern(opts?: object): this is NodePath<t.AssignmentPattern>;
|
||||
isArrayPattern(opts?: object): this is NodePath<t.ArrayPattern>;
|
||||
isArrowFunctionExpression(opts?: object): this is NodePath<t.ArrowFunctionExpression>;
|
||||
isClassBody(opts?: object): this is NodePath<t.ClassBody>;
|
||||
isClassDeclaration(opts?: object): this is NodePath<t.ClassDeclaration>;
|
||||
isClassExpression(opts?: object): this is NodePath<t.ClassExpression>;
|
||||
isExportAllDeclaration(opts?: object): this is NodePath<t.ExportAllDeclaration>;
|
||||
isExportDefaultDeclaration(opts?: object): this is NodePath<t.ExportDefaultDeclaration>;
|
||||
isExportNamedDeclaration(opts?: object): this is NodePath<t.ExportNamedDeclaration>;
|
||||
isExportSpecifier(opts?: object): this is NodePath<t.ExportSpecifier>;
|
||||
isForOfStatement(opts?: object): this is NodePath<t.ForOfStatement>;
|
||||
isImportDeclaration(opts?: object): this is NodePath<t.ImportDeclaration>;
|
||||
isImportDefaultSpecifier(opts?: object): this is NodePath<t.ImportDefaultSpecifier>;
|
||||
isImportNamespaceSpecifier(opts?: object): this is NodePath<t.ImportNamespaceSpecifier>;
|
||||
isImportSpecifier(opts?: object): this is NodePath<t.ImportSpecifier>;
|
||||
isMetaProperty(opts?: object): this is NodePath<t.MetaProperty>;
|
||||
isClassMethod(opts?: object): this is NodePath<t.ClassMethod>;
|
||||
isObjectPattern(opts?: object): this is NodePath<t.ObjectPattern>;
|
||||
isSpreadElement(opts?: object): this is NodePath<t.SpreadElement>;
|
||||
isSuper(opts?: object): this is NodePath<t.Super>;
|
||||
isTaggedTemplateExpression(opts?: object): this is NodePath<t.TaggedTemplateExpression>;
|
||||
isTemplateElement(opts?: object): this is NodePath<t.TemplateElement>;
|
||||
isTemplateLiteral(opts?: object): this is NodePath<t.TemplateLiteral>;
|
||||
isYieldExpression(opts?: object): this is NodePath<t.YieldExpression>;
|
||||
isAnyTypeAnnotation(opts?: object): this is NodePath<t.AnyTypeAnnotation>;
|
||||
isArrayTypeAnnotation(opts?: object): this is NodePath<t.ArrayTypeAnnotation>;
|
||||
isBooleanTypeAnnotation(opts?: object): this is NodePath<t.BooleanTypeAnnotation>;
|
||||
isBooleanLiteralTypeAnnotation(opts?: object): this is NodePath<t.BooleanLiteralTypeAnnotation>;
|
||||
isNullLiteralTypeAnnotation(opts?: object): this is NodePath<t.NullLiteralTypeAnnotation>;
|
||||
isClassImplements(opts?: object): this is NodePath<t.ClassImplements>;
|
||||
isClassProperty(opts?: object): this is NodePath<t.ClassProperty>;
|
||||
isDeclareClass(opts?: object): this is NodePath<t.DeclareClass>;
|
||||
isDeclareFunction(opts?: object): this is NodePath<t.DeclareFunction>;
|
||||
isDeclareInterface(opts?: object): this is NodePath<t.DeclareInterface>;
|
||||
isDeclareModule(opts?: object): this is NodePath<t.DeclareModule>;
|
||||
isDeclareTypeAlias(opts?: object): this is NodePath<t.DeclareTypeAlias>;
|
||||
isDeclareVariable(opts?: object): this is NodePath<t.DeclareVariable>;
|
||||
isExistentialTypeParam(opts?: object): this is NodePath<t.ExistentialTypeParam>;
|
||||
isFunctionTypeAnnotation(opts?: object): this is NodePath<t.FunctionTypeAnnotation>;
|
||||
isFunctionTypeParam(opts?: object): this is NodePath<t.FunctionTypeParam>;
|
||||
isGenericTypeAnnotation(opts?: object): this is NodePath<t.GenericTypeAnnotation>;
|
||||
isInterfaceExtends(opts?: object): this is NodePath<t.InterfaceExtends>;
|
||||
isInterfaceDeclaration(opts?: object): this is NodePath<t.InterfaceDeclaration>;
|
||||
isIntersectionTypeAnnotation(opts?: object): this is NodePath<t.IntersectionTypeAnnotation>;
|
||||
isMixedTypeAnnotation(opts?: object): this is NodePath<t.MixedTypeAnnotation>;
|
||||
isNullableTypeAnnotation(opts?: object): this is NodePath<t.NullableTypeAnnotation>;
|
||||
isNumericLiteralTypeAnnotation(opts?: object): this is NodePath<t.NumericLiteralTypeAnnotation>;
|
||||
isNumberTypeAnnotation(opts?: object): this is NodePath<t.NumberTypeAnnotation>;
|
||||
isStringLiteralTypeAnnotation(opts?: object): this is NodePath<t.StringLiteralTypeAnnotation>;
|
||||
isStringTypeAnnotation(opts?: object): this is NodePath<t.StringTypeAnnotation>;
|
||||
isThisTypeAnnotation(opts?: object): this is NodePath<t.ThisTypeAnnotation>;
|
||||
isTupleTypeAnnotation(opts?: object): this is NodePath<t.TupleTypeAnnotation>;
|
||||
isTypeofTypeAnnotation(opts?: object): this is NodePath<t.TypeofTypeAnnotation>;
|
||||
isTypeAlias(opts?: object): this is NodePath<t.TypeAlias>;
|
||||
isTypeAnnotation(opts?: object): this is NodePath<t.TypeAnnotation>;
|
||||
isTypeCastExpression(opts?: object): this is NodePath<t.TypeCastExpression>;
|
||||
isTypeParameterDeclaration(opts?: object): this is NodePath<t.TypeParameterDeclaration>;
|
||||
isTypeParameterInstantiation(opts?: object): this is NodePath<t.TypeParameterInstantiation>;
|
||||
isObjectTypeAnnotation(opts?: object): this is NodePath<t.ObjectTypeAnnotation>;
|
||||
isObjectTypeCallProperty(opts?: object): this is NodePath<t.ObjectTypeCallProperty>;
|
||||
isObjectTypeIndexer(opts?: object): this is NodePath<t.ObjectTypeIndexer>;
|
||||
isObjectTypeProperty(opts?: object): this is NodePath<t.ObjectTypeProperty>;
|
||||
isQualifiedTypeIdentifier(opts?: object): this is NodePath<t.QualifiedTypeIdentifier>;
|
||||
isUnionTypeAnnotation(opts?: object): this is NodePath<t.UnionTypeAnnotation>;
|
||||
isVoidTypeAnnotation(opts?: object): this is NodePath<t.VoidTypeAnnotation>;
|
||||
isJSXAttribute(opts?: object): this is NodePath<t.JSXAttribute>;
|
||||
isJSXClosingElement(opts?: object): this is NodePath<t.JSXClosingElement>;
|
||||
isJSXElement(opts?: object): this is NodePath<t.JSXElement>;
|
||||
isJSXEmptyExpression(opts?: object): this is NodePath<t.JSXEmptyExpression>;
|
||||
isJSXExpressionContainer(opts?: object): this is NodePath<t.JSXExpressionContainer>;
|
||||
isJSXIdentifier(opts?: object): this is NodePath<t.JSXIdentifier>;
|
||||
isJSXMemberExpression(opts?: object): this is NodePath<t.JSXMemberExpression>;
|
||||
isJSXNamespacedName(opts?: object): this is NodePath<t.JSXNamespacedName>;
|
||||
isJSXOpeningElement(opts?: object): this is NodePath<t.JSXOpeningElement>;
|
||||
isJSXSpreadAttribute(opts?: object): this is NodePath<t.JSXSpreadAttribute>;
|
||||
isJSXText(opts?: object): this is NodePath<t.JSXText>;
|
||||
isNoop(opts?: object): this is NodePath<t.Noop>;
|
||||
isParenthesizedExpression(opts?: object): this is NodePath<t.ParenthesizedExpression>;
|
||||
isAwaitExpression(opts?: object): this is NodePath<t.AwaitExpression>;
|
||||
isBindExpression(opts?: object): this is NodePath<t.BindExpression>;
|
||||
isDecorator(opts?: object): this is NodePath<t.Decorator>;
|
||||
isDoExpression(opts?: object): this is NodePath<t.DoExpression>;
|
||||
isExportDefaultSpecifier(opts?: object): this is NodePath<t.ExportDefaultSpecifier>;
|
||||
isExportNamespaceSpecifier(opts?: object): this is NodePath<t.ExportNamespaceSpecifier>;
|
||||
isRestProperty(opts?: object): this is NodePath<t.RestProperty>;
|
||||
isSpreadProperty(opts?: object): this is NodePath<t.SpreadProperty>;
|
||||
isExpression(opts?: object): this is NodePath<t.Expression>;
|
||||
isBinary(opts?: object): this is NodePath<t.Binary>;
|
||||
isScopable(opts?: object): this is NodePath<t.Scopable>;
|
||||
isBlockParent(opts?: object): this is NodePath<t.BlockParent>;
|
||||
isBlock(opts?: object): this is NodePath<t.Block>;
|
||||
isStatement(opts?: object): this is NodePath<t.Statement>;
|
||||
isTerminatorless(opts?: object): this is NodePath<t.Terminatorless>;
|
||||
isCompletionStatement(opts?: object): this is NodePath<t.CompletionStatement>;
|
||||
isConditional(opts?: object): this is NodePath<t.Conditional>;
|
||||
isLoop(opts?: object): this is NodePath<t.Loop>;
|
||||
isWhile(opts?: object): this is NodePath<t.While>;
|
||||
isExpressionWrapper(opts?: object): this is NodePath<t.ExpressionWrapper>;
|
||||
isFor(opts?: object): this is NodePath<t.For>;
|
||||
isForXStatement(opts?: object): this is NodePath<t.ForXStatement>;
|
||||
isFunction(opts?: object): this is NodePath<t.Function>;
|
||||
isFunctionParent(opts?: object): this is NodePath<t.FunctionParent>;
|
||||
isPureish(opts?: object): this is NodePath<t.Pureish>;
|
||||
isDeclaration(opts?: object): this is NodePath<t.Declaration>;
|
||||
isLVal(opts?: object): this is NodePath<t.LVal>;
|
||||
isLiteral(opts?: object): this is NodePath<t.Literal>;
|
||||
isImmutable(opts?: object): this is NodePath<t.Immutable>;
|
||||
isUserWhitespacable(opts?: object): this is NodePath<t.UserWhitespacable>;
|
||||
isMethod(opts?: object): this is NodePath<t.Method>;
|
||||
isObjectMember(opts?: object): this is NodePath<t.ObjectMember>;
|
||||
isProperty(opts?: object): this is NodePath<t.Property>;
|
||||
isUnaryLike(opts?: object): this is NodePath<t.UnaryLike>;
|
||||
isPattern(opts?: object): this is NodePath<t.Pattern>;
|
||||
isClass(opts?: object): this is NodePath<t.Class>;
|
||||
isModuleDeclaration(opts?: object): this is NodePath<t.ModuleDeclaration>;
|
||||
isExportDeclaration(opts?: object): this is NodePath<t.ExportDeclaration>;
|
||||
isModuleSpecifier(opts?: object): this is NodePath<t.ModuleSpecifier>;
|
||||
isFlow(opts?: object): this is NodePath<t.Flow>;
|
||||
isFlowBaseAnnotation(opts?: object): this is NodePath<t.FlowBaseAnnotation>;
|
||||
isFlowDeclaration(opts?: object): this is NodePath<t.FlowDeclaration>;
|
||||
isJSX(opts?: object): this is NodePath<t.JSX>;
|
||||
isNumberLiteral(opts?: object): this is NodePath<t.NumericLiteral>;
|
||||
isRegexLiteral(opts?: object): this is NodePath<t.RegExpLiteral>;
|
||||
isReferencedIdentifier(opts?: object): this is NodePath<t.Identifier | t.JSXIdentifier>;
|
||||
isReferencedMemberExpression(opts?: object): this is NodePath<t.MemberExpression>;
|
||||
isBindingIdentifier(opts?: object): this is NodePath<t.Identifier>;
|
||||
isScope(opts?: object): this is NodePath<t.Scopable>;
|
||||
isReferenced(opts?: object): boolean;
|
||||
isBlockScoped(opts?: object): boolean;
|
||||
isVar(opts?: object): boolean;
|
||||
isBlockScoped(opts?: object): this is NodePath<t.FunctionDeclaration | t.ClassDeclaration | t.VariableDeclaration>;
|
||||
isVar(opts?: object): this is NodePath<t.VariableDeclaration>;
|
||||
isUser(opts?: object): boolean;
|
||||
isGenerated(opts?: object): boolean;
|
||||
isPure(opts?: object): boolean;
|
||||
|
||||
Vendored
+6
-6
@@ -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;
|
||||
|
||||
Vendored
+1
-1
@@ -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;
|
||||
|
||||
Vendored
+31
-10
@@ -1,12 +1,14 @@
|
||||
// Type definitions for better-scroll.js 1.3
|
||||
// Type definitions for better-scroll.js 1.4
|
||||
// Project: https://github.com/ustbhuangyi/better-scroll
|
||||
// Definitions by: linxiaowu66 <https://github.com/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<WheelOption> | boolean;
|
||||
/**
|
||||
* for slide
|
||||
* snap: {
|
||||
@@ -77,14 +88,14 @@ interface BsOption {
|
||||
* listenFlick: true
|
||||
* }
|
||||
*/
|
||||
snap?: SlideOption | boolean;
|
||||
snap?: Partial<SlideOption> | boolean;
|
||||
/**
|
||||
* for scrollbar
|
||||
* scrollbar: {
|
||||
* fade: true
|
||||
* }
|
||||
*/
|
||||
scrollbar?: ScrollBarOption | boolean;
|
||||
scrollbar?: Partial<ScrollBarOption> | boolean;
|
||||
/**
|
||||
* for pull down and refresh
|
||||
* pullDownRefresh: {
|
||||
@@ -92,20 +103,30 @@ interface BsOption {
|
||||
* stop: 20
|
||||
* }
|
||||
*/
|
||||
pullDownRefresh?: PullDownOption | boolean;
|
||||
pullDownRefresh?: Partial<PullDownOption> | boolean;
|
||||
/**
|
||||
* for pull up and load
|
||||
* pullUpLoad: {
|
||||
* threshold: 50
|
||||
* }
|
||||
*/
|
||||
pullUpLoad?: PullUpOption | boolean;
|
||||
pullUpLoad?: Partial<PullUpOption> | 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 数据已加载
|
||||
|
||||
Vendored
+3
@@ -39,6 +39,9 @@ export class Binary {
|
||||
|
||||
constructor(buffer: Buffer, subType?: number);
|
||||
|
||||
/** The underlying Buffer which stores the binary data. */
|
||||
readonly buffer: Buffer;
|
||||
|
||||
/** The length of the binary. */
|
||||
length(): number;
|
||||
/** Updates this binary with byte_value */
|
||||
|
||||
+87
-40
@@ -1,3 +1,4 @@
|
||||
/// <reference types="node" />
|
||||
import * as chai from "chai";
|
||||
|
||||
const expect = chai.expect;
|
||||
@@ -132,7 +133,9 @@ function _typeof() {
|
||||
expect(5).to.be.a('number');
|
||||
(5).should.be.a('number');
|
||||
|
||||
// tslint:disable-next-line:no-construct
|
||||
expect(new Number(1)).to.be.a('number');
|
||||
// tslint:disable-next-line:no-construct
|
||||
(new Number(1)).should.be.a('number');
|
||||
expect(Number(1)).to.be.a('number');
|
||||
Number(1).should.be.a('number');
|
||||
@@ -348,10 +351,6 @@ function eql() {
|
||||
(4).should.eql(3, 'blah');
|
||||
}
|
||||
|
||||
class Buffer {
|
||||
constructor(arr: number[]) {
|
||||
}
|
||||
}
|
||||
function buffer() {
|
||||
expect(new Buffer([1])).to.eql(new Buffer([1]));
|
||||
(new Buffer([1])).should.eql(new Buffer([1]));
|
||||
@@ -726,7 +725,6 @@ function frozen() {
|
||||
Object.freeze({}).should.be.frozen;
|
||||
}
|
||||
|
||||
|
||||
class PoorlyConstructedError { }
|
||||
function _throw() {
|
||||
// See GH-45: some poorly-constructed custom errors don't have useful names
|
||||
@@ -736,11 +734,11 @@ function _throw() {
|
||||
|
||||
const specificError = new RangeError('boo');
|
||||
|
||||
const goodFn = () => { }
|
||||
, badFn = () => { throw new Error('testing'); }
|
||||
, refErrFn = () => { throw new ReferenceError('hello'); }
|
||||
, ickyErrFn = () => { throw new PoorlyConstructedError(); }
|
||||
, specificErrFn = () => { throw specificError; };
|
||||
const goodFn = () => { };
|
||||
const badFn = () => { throw new Error('testing'); };
|
||||
const refErrFn = () => { throw new ReferenceError('hello'); };
|
||||
const ickyErrFn = () => { throw new PoorlyConstructedError(); };
|
||||
const specificErrFn = () => { throw specificError; };
|
||||
|
||||
expect(goodFn).to.not.throw();
|
||||
goodFn.should.not.throw();
|
||||
@@ -891,7 +889,7 @@ function use() {
|
||||
_chai.can.use.any();
|
||||
});
|
||||
|
||||
let expect = chai
|
||||
const expect = chai
|
||||
.use((_chai, util) => {})
|
||||
.use((_chai, util) => {})
|
||||
.expect;
|
||||
@@ -1090,7 +1088,7 @@ function oneOf() {
|
||||
expect(obj).to.not.be.oneOf([{ z: 3 }]);
|
||||
}
|
||||
|
||||
//tdd
|
||||
// tdd
|
||||
declare function suite(description: string, action: Function): void;
|
||||
declare function test(description: string, action: Function): void;
|
||||
|
||||
@@ -1105,9 +1103,8 @@ class CrashyObject {
|
||||
}
|
||||
|
||||
suite('assert', () => {
|
||||
|
||||
test('assert', () => {
|
||||
const foo: string = 'bar';
|
||||
const foo = 'bar' as string;
|
||||
assert(foo === 'bar', 'expected foo to equal `bar`');
|
||||
|
||||
assert(foo === 'baz', 'expected foo to equal `bar`');
|
||||
@@ -1207,26 +1204,26 @@ suite('assert', () => {
|
||||
assert.deepEqual({ tea: 'chai' }, { tea: 'chai' });
|
||||
assert.deepEqual({ tea: 'chai' }, { tea: 'black' });
|
||||
|
||||
const obja = Object.create({ tea: 'chai' })
|
||||
, objb = Object.create({ tea: 'chai' });
|
||||
const obja = Object.create({ tea: 'chai' });
|
||||
const objb = Object.create({ tea: 'chai' });
|
||||
|
||||
assert.deepEqual(obja, objb);
|
||||
|
||||
const obj1 = Object.create({ tea: 'chai' })
|
||||
, obj2 = Object.create({ tea: 'black' });
|
||||
const obj1 = Object.create({ tea: 'chai' });
|
||||
const obj2 = Object.create({ tea: 'black' });
|
||||
|
||||
assert.deepEqual(obj1, obj2);
|
||||
});
|
||||
|
||||
test('deepEqual (ordering)', () => {
|
||||
const a = { a: 'b', c: 'd' }
|
||||
, b = { c: 'd', a: 'b' };
|
||||
const a = { a: 'b', c: 'd' };
|
||||
const b = { c: 'd', a: 'b' };
|
||||
assert.deepEqual(a, b);
|
||||
});
|
||||
|
||||
test('deepEqual (circular)', () => {
|
||||
const circularObject: any = {}
|
||||
, secondCircularObject: any = {};
|
||||
const circularObject: any = {};
|
||||
const secondCircularObject: any = {};
|
||||
circularObject.field = circularObject;
|
||||
secondCircularObject.field = secondCircularObject;
|
||||
|
||||
@@ -1242,8 +1239,8 @@ suite('assert', () => {
|
||||
});
|
||||
|
||||
test('notDeepEqual (circular)', () => {
|
||||
const circularObject: any = {}
|
||||
, secondCircularObject: any = { tea: 'jasmine' };
|
||||
const circularObject: any = {};
|
||||
const secondCircularObject: any = { tea: 'jasmine' };
|
||||
circularObject.field = circularObject;
|
||||
secondCircularObject.field = secondCircularObject;
|
||||
|
||||
@@ -1309,6 +1306,7 @@ suite('assert', () => {
|
||||
|
||||
test('isString', () => {
|
||||
assert.isString('Foo');
|
||||
// tslint:disable-next-line:no-construct
|
||||
assert.isString(new String('foo'));
|
||||
assert.isString(1);
|
||||
});
|
||||
@@ -1357,6 +1355,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);
|
||||
@@ -1498,7 +1546,6 @@ suite('assert', () => {
|
||||
assert.sameMembers([1, 54], [6, 1, 54]);
|
||||
});
|
||||
|
||||
|
||||
test('isAbove', () => {
|
||||
assert.isAbove(10, 5);
|
||||
assert.isAbove(1, 5);
|
||||
@@ -1688,7 +1735,7 @@ suite('assert', () => {
|
||||
test('hasAllKeys', () => {
|
||||
assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']);
|
||||
assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337});
|
||||
assert.hasAllKeys(new Map<any,any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
|
||||
assert.hasAllKeys(new Map<any, any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
|
||||
assert.hasAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']);
|
||||
});
|
||||
|
||||
@@ -1697,8 +1744,8 @@ suite('assert', () => {
|
||||
assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']);
|
||||
assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, baz: 1337});
|
||||
assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337});
|
||||
assert.containsAllKeys(new Map<any,any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}]);
|
||||
assert.containsAllKeys(new Map<any,any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
|
||||
assert.containsAllKeys(new Map<any, any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}]);
|
||||
assert.containsAllKeys(new Map<any, any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']);
|
||||
assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}]);
|
||||
assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']);
|
||||
});
|
||||
@@ -1706,21 +1753,21 @@ suite('assert', () => {
|
||||
test('doesNotHaveAnyKeys', () => {
|
||||
assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']);
|
||||
assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'});
|
||||
assert.doesNotHaveAnyKeys(new Map<any,any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
|
||||
assert.doesNotHaveAnyKeys(new Map<any, any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
|
||||
assert.doesNotHaveAnyKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{one: 'two'}, 'example']);
|
||||
});
|
||||
|
||||
test('doesNotHaveAllKeys', () => {
|
||||
assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']);
|
||||
assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'});
|
||||
assert.doesNotHaveAllKeys(new Map<any,any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
|
||||
assert.doesNotHaveAllKeys(new Map<any, any>([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']);
|
||||
assert.doesNotHaveAllKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{one: 'two'}, 'example']);
|
||||
});
|
||||
|
||||
test('hasAnyDeepKeys', () => {
|
||||
assert.hasAnyDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});
|
||||
assert.hasAnyDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [1, 2]]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAnyDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAnyDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});
|
||||
assert.hasAnyDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [1, 2]]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAnyDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'});
|
||||
assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {three: 'three'}]);
|
||||
assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
|
||||
@@ -1728,28 +1775,28 @@ suite('assert', () => {
|
||||
|
||||
test('hasAllDeepKeys', () => {
|
||||
assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne']]), {one: 'one'});
|
||||
assert.hasAllDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAllDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.hasAllDeepKeys(new Set([{one: 'one'}]), {one: 'one'});
|
||||
assert.hasAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
|
||||
});
|
||||
|
||||
test('containsAllDeepKeys', () => {
|
||||
assert.containsAllDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});
|
||||
assert.containsAllDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.containsAllDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'});
|
||||
assert.containsAllDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]);
|
||||
assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'});
|
||||
assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]);
|
||||
});
|
||||
|
||||
test('doesNotHaveAnyDeepKeys', () => {
|
||||
assert.doesNotHaveAnyDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});
|
||||
assert.doesNotHaveAnyDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {fifty: 'fifty'}]);
|
||||
assert.doesNotHaveAnyDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});
|
||||
assert.doesNotHaveAnyDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {fifty: 'fifty'}]);
|
||||
assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'});
|
||||
assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{twenty: 'twenty'}, {fifty: 'fifty'}]);
|
||||
});
|
||||
|
||||
test('doesNotHaveAllDeepKeys', () => {
|
||||
assert.doesNotHaveAllDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});
|
||||
assert.doesNotHaveAllDeepKeys(new Map<any,any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {one: 'one'}]);
|
||||
assert.doesNotHaveAllDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'});
|
||||
assert.doesNotHaveAllDeepKeys(new Map<any, any>([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {one: 'one'}]);
|
||||
assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'});
|
||||
assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {fifty: 'fifty'}]);
|
||||
});
|
||||
|
||||
Vendored
+134
-39
@@ -1,4 +1,4 @@
|
||||
// Type definitions for chai 4.0.0
|
||||
// Type definitions for chai 4.0
|
||||
// Project: http://chaijs.com/
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao>,
|
||||
// Bart van der Schoor <https://github.com/Bartvds>,
|
||||
@@ -7,12 +7,12 @@
|
||||
// Matt Wistrand <https://github.com/mwistrand>,
|
||||
// Josh Goldberg <https://github.com/joshuakgoldberg>
|
||||
// Shaun Luttin <https://github.com/shaunluttin>
|
||||
// Gintautas Miselis <https://github.com/Naktibalda>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// <reference types="assertion-error"/>
|
||||
|
||||
declare namespace Chai {
|
||||
|
||||
interface ChaiStatic {
|
||||
expect: ExpectStatic;
|
||||
should(): Should;
|
||||
@@ -54,8 +54,7 @@ declare namespace Chai {
|
||||
}
|
||||
|
||||
interface ShouldThrow {
|
||||
(actual: Function): void;
|
||||
(actual: Function, expected: string|RegExp, message?: string): void;
|
||||
(actual: Function, expected?: string|RegExp, message?: string): void;
|
||||
(actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void;
|
||||
}
|
||||
|
||||
@@ -218,9 +217,7 @@ declare namespace Chai {
|
||||
}
|
||||
|
||||
interface Include {
|
||||
(value: Object, message?: string): Assertion;
|
||||
(value: string, message?: string): Assertion;
|
||||
(value: number, message?: string): Assertion;
|
||||
(value: Object | string | number, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
deep: Deep;
|
||||
ordered: Ordered;
|
||||
@@ -235,18 +232,12 @@ declare namespace Chai {
|
||||
|
||||
interface Keys {
|
||||
(...keys: string[]): Assertion;
|
||||
(keys: any[]): Assertion;
|
||||
(keys: Object): Assertion;
|
||||
(keys: any[]|Object): Assertion;
|
||||
}
|
||||
|
||||
interface Throw {
|
||||
(): Assertion;
|
||||
(expected: string, message?: string): Assertion;
|
||||
(expected: RegExp, message?: string): Assertion;
|
||||
(constructor: Error, expected?: string, message?: string): Assertion;
|
||||
(constructor: Error, expected?: RegExp, message?: string): Assertion;
|
||||
(constructor: Function, expected?: string, message?: string): Assertion;
|
||||
(constructor: Function, expected?: RegExp, message?: string): Assertion;
|
||||
(expected?: string|RegExp, message?: string): Assertion;
|
||||
(constructor: Error|Function, expected?: string|RegExp, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface RespondTo {
|
||||
@@ -697,21 +688,134 @@ declare namespace Chai {
|
||||
/**
|
||||
* Asserts that haystack does not include needle.
|
||||
*
|
||||
* @param haystack Container string or array.
|
||||
* @param needle Potential expected substring of haystack.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
notInclude(haystack: string | 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.
|
||||
*/
|
||||
notInclude(haystack: string, needle: any, message?: string): void;
|
||||
deepInclude(haystack: string, needle: string, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that haystack does not include needle.
|
||||
* 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.
|
||||
*
|
||||
* @type T Type of values in haystack.
|
||||
* @param haystack Container array.
|
||||
* @param needle Potential value contained in haystack.
|
||||
* @param haystack
|
||||
* @param needle
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
notInclude(haystack: any[], needle: any, message?: string): void;
|
||||
deepInclude<T>(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 or array.
|
||||
* @param needle Potential expected substring of haystack.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
notDeepInclude(haystack: string | 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.
|
||||
@@ -881,19 +985,10 @@ declare namespace Chai {
|
||||
* Asserts that function will throw an error with message matching regexp.
|
||||
*
|
||||
* @param fn Function that may throw.
|
||||
* @param regExp Potential expected message match.
|
||||
* @param errType Potential expected message match or error constructor.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
throws(fn: Function, regExp: RegExp, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that function will throw an error that is an instance of constructor.
|
||||
*
|
||||
* @param fn Function that may throw.
|
||||
* @param constructor Potential expected error constructor.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
throws(fn: Function, errType: Function, message?: string): void;
|
||||
throws(fn: Function, errType: RegExp|Function, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that function will throw an error that is an instance of constructor
|
||||
@@ -1156,7 +1251,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected to be modified.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
changes<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
changes<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that a function does not change the value of a property.
|
||||
@@ -1167,7 +1262,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected not to be modified.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
doesNotChange<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
doesNotChange<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that a function increases an object property.
|
||||
@@ -1178,7 +1273,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected to be increased.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
increases<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
increases<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that a function does not increase an object property.
|
||||
@@ -1189,7 +1284,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected not to be increased.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
doesNotIncrease<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
doesNotIncrease<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that a function decreases an object property.
|
||||
@@ -1200,7 +1295,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected to be decreased.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
decreases<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
decreases<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts that a function does not decrease an object property.
|
||||
@@ -1211,7 +1306,7 @@ declare namespace Chai {
|
||||
* @param property Property of object expected not to be decreased.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
doesNotDecrease<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void
|
||||
doesNotDecrease<T>(modifier: Function, object: T, property: string /* keyof T */, message?: string): void;
|
||||
|
||||
/**
|
||||
* Asserts if value is not a false value, and throws if it is a true value.
|
||||
|
||||
+1
-66
@@ -1,79 +1,14 @@
|
||||
{
|
||||
"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
|
||||
"strict-export-declare-modifiers": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,8 @@ const chart: Chart = new Chart(new CanvasRenderingContext2D(), {
|
||||
zeroLineBorderDashOffset: 2
|
||||
}
|
||||
}]
|
||||
}
|
||||
},
|
||||
plugins: { arbitraryPlugin: {option: "value"} }
|
||||
}
|
||||
});
|
||||
chart.update();
|
||||
|
||||
Vendored
+3
@@ -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;
|
||||
@@ -175,6 +176,8 @@ declare namespace Chart {
|
||||
cutoutPercentage?: number;
|
||||
circumference?: number;
|
||||
rotation?: number;
|
||||
// Plugins can require any options
|
||||
plugins?: any;
|
||||
}
|
||||
|
||||
interface ChartFontOptions {
|
||||
|
||||
Vendored
+1
@@ -263,6 +263,7 @@ interface CheerioElement {
|
||||
parent: CheerioElement;
|
||||
parentNode: CheerioElement;
|
||||
nodeValue: string;
|
||||
data?: string;
|
||||
}
|
||||
|
||||
interface CheerioAPI extends CheerioSelector, CheerioStatic {
|
||||
|
||||
Vendored
+17
-11
@@ -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<string>;
|
||||
|
||||
@@ -535,8 +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, 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, 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.
|
||||
@@ -779,7 +785,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.
|
||||
|
||||
Vendored
+1
-1
@@ -35,7 +35,7 @@ declare namespace Combokeys {
|
||||
* @param {handler} optional - one of "keypress", "keydown", or "keyup"
|
||||
* @returns void
|
||||
*/
|
||||
bind(keys: string | string[], callback: () => void, action?: string): void;
|
||||
bind(keys: string | string[], callback: (event: KeyboardEvent) => void, action?: string): void;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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] <file ...>')
|
||||
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||
.option('-r, --range <a>..<b>', 'A range', range)
|
||||
.option('-l, --list <items>', '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('<cmd> [env]')
|
||||
.action((cmd, env) => {
|
||||
console.log(cmd, env);
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
console.log('stuff');
|
||||
Vendored
-299
@@ -1,299 +0,0 @@
|
||||
// Type definitions for commander 2.11
|
||||
// Project: https://github.com/visionmedia/commander.js
|
||||
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
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 <path>', 'change the working directory')
|
||||
* .option('-c, --config <path>', '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 <cmd>')
|
||||
* .description('run the given remote command')
|
||||
* .action(function(cmd) {
|
||||
* console.log('exec "%s"', cmd);
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('teardown <dir> [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 <path>', '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;
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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: CordovaKeyboardEvent) => console.log(`keyboardHeightWillChange - keyboard height: ${event.keyboardHeight}`));
|
||||
|
||||
+99
-88
@@ -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 <https://github.com/danmana>
|
||||
// Type definitions for Apache Cordova Keyboard plugin v1.2.0
|
||||
// Project: https://github.com/cjpearson/cordova-plugin-keyboard
|
||||
// Definitions by: Dan Manastireanu <https://github.com/danmana>
|
||||
// Jochen Becker <https://github.com/jkfb>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* The Keyboard object provides some functions to customize the iOS keyboard.
|
||||
*
|
||||
* <i>Supported Platforms: iOS</i>
|
||||
*
|
||||
* 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
|
||||
* <code>
|
||||
* <feature name="Keyboard">
|
||||
* <param name="ios-package" value="CDVKeyboard" onload="true" />
|
||||
* </feature>
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
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:
|
||||
* <code>
|
||||
* Keyboard.shrinkView(true);
|
||||
* Keyboard.shrinkView(false);
|
||||
* Keyboard.shrinkView(null, function (currentValue) { console.log(currentValue); });
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* Keyboard.hideFormAccessoryBar(true);
|
||||
* Keyboard.hideFormAccessoryBar(false);
|
||||
* Keyboard.hideFormAccessoryBar(null, function (currentValue) { console.log(currentValue); });
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* Keyboard.disableScrollingInShrinkView(true);
|
||||
@@ -77,8 +67,40 @@ interface Keyboard {
|
||||
* </code>
|
||||
*
|
||||
* @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:
|
||||
* <code>
|
||||
* Keyboard.hide();
|
||||
* </code>
|
||||
*/
|
||||
hide(): void,
|
||||
|
||||
/**
|
||||
* Show the keyboard
|
||||
*
|
||||
* Call this method to show the keyboard.
|
||||
*
|
||||
* Supported Platforms:
|
||||
* - Android
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.show();
|
||||
* </code>
|
||||
*/
|
||||
show(): void,
|
||||
|
||||
// Properties
|
||||
|
||||
@@ -87,6 +109,9 @@ interface Keyboard {
|
||||
*
|
||||
* Read this property to determine if the keyboard is visible.
|
||||
*
|
||||
* Supported Platforms:
|
||||
* - iOS
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* if (Keyboard.isVisible) {
|
||||
@@ -102,6 +127,9 @@ 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:
|
||||
* <code>
|
||||
* Keyboard.automaticScrollToTopOnHiding = true;
|
||||
@@ -110,65 +138,48 @@ interface Keyboard {
|
||||
*/
|
||||
automaticScrollToTopOnHiding: boolean,
|
||||
|
||||
// Events
|
||||
/**
|
||||
* Deprecated Events
|
||||
*/
|
||||
onshow(): void,
|
||||
|
||||
/**
|
||||
* 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:
|
||||
* <code>
|
||||
* Keyboard.onshow = function () {
|
||||
* // Describe your logic which will be run each time keyboard is shown.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
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:
|
||||
* <code>
|
||||
* Keyboard.onhide = function () {
|
||||
* // Describe your logic which will be run each time keyboard is closed.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
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:
|
||||
* <code>
|
||||
* Keyboard.onshowing = function () {
|
||||
* // Describe your logic which will be run each time when keyboard is about to be shown.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
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:
|
||||
* <code>
|
||||
* Keyboard.onhiding = function () {
|
||||
* // Describe your logic which will be run each time when keyboard is about to be closed.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
onhiding():void,
|
||||
onhide(): void,
|
||||
|
||||
onhiding(): void,
|
||||
|
||||
onshowing(): void
|
||||
}
|
||||
|
||||
declare var Keyboard:Keyboard;
|
||||
interface CordovaKeyboardEvent extends Event {
|
||||
/** The height of the keyboard */
|
||||
keyboardHeight: number;
|
||||
}
|
||||
|
||||
interface WindowEventMap {
|
||||
/**
|
||||
* This event is fired when keyboard fully shown.
|
||||
*/
|
||||
'keyboardDidShow': Event,
|
||||
|
||||
/**
|
||||
* This event is fired when the keyboard is fully closed.
|
||||
*/
|
||||
'keyboardDidHide': Event,
|
||||
|
||||
/**
|
||||
* This event fires before keyboard will be shown.
|
||||
*/
|
||||
'keyboardWillShow': Event,
|
||||
|
||||
/**
|
||||
* This event is fired when the keyboard is fully closed.
|
||||
*/
|
||||
'keyboardWillHide': Event,
|
||||
|
||||
/**
|
||||
* This event is fired when the keyboard is fully closed.
|
||||
*/
|
||||
'keyboardHeightWillChange': CordovaKeyboardEvent
|
||||
}
|
||||
|
||||
declare var Keyboard: Keyboard;
|
||||
|
||||
Vendored
+23
-18
@@ -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<Declaration | Comment>;
|
||||
}
|
||||
@@ -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<Rule | Comment | AtRule>;
|
||||
}
|
||||
@@ -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<KeyFrame | Comment>;
|
||||
}
|
||||
|
||||
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<string>;
|
||||
/** 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<string>;
|
||||
/** 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<Rule | Comment | AtRule>;
|
||||
/** Array of Errors. Errors collected during parsing when option silent is true. */
|
||||
parsingErrors?: Array<ParserError>
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<Rule | Comment | AtRule>;
|
||||
/** Array of Errors. Errors collected during parsing when option silent is true. */
|
||||
parsingErrors?: Array<ParserError>
|
||||
};
|
||||
stylesheet?: StyleRules;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
Vendored
+2
-4
@@ -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 <https://github.com/abraaoalves>
|
||||
// Jan Molak <https://github.com/jan-molak>
|
||||
@@ -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> | any | void;
|
||||
export type StepDefinitionCode = (this: World, ...stepArgs: any[]) => any;
|
||||
|
||||
export interface StepDefinitionOptions {
|
||||
timeout?: number;
|
||||
|
||||
@@ -12,6 +12,8 @@ cy
|
||||
.get('.query-button')
|
||||
.contains('Save Form').should('have.class', 'btn');
|
||||
|
||||
cy.location('host');
|
||||
|
||||
cy
|
||||
.get('form')
|
||||
.find('input')
|
||||
|
||||
Vendored
+5
-4
@@ -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
|
||||
@@ -317,9 +318,9 @@ declare namespace Cypress {
|
||||
/**
|
||||
* @see https://on.cypress.io/api/route
|
||||
*/
|
||||
route(url: string, response?: any): Chainable;
|
||||
route(method: string, url: string, response?: any): Chainable;
|
||||
route(fn: () => RouteOptions | RouteOptions): Chainable;
|
||||
route(url: string | RegExp, response?: any): Chainable;
|
||||
route(method: string, url: string | RegExp, response?: any): Chainable;
|
||||
route(fn: (() => RouteOptions) | RouteOptions): Chainable;
|
||||
|
||||
/**
|
||||
* @see https://on.cypress.io/api/screenshot
|
||||
|
||||
Vendored
+4
-1
@@ -36,7 +36,10 @@ export type GeoGeometryObjects = GeoJSON.GeometryObject | GeoSphere;
|
||||
export interface ExtendedGeometryCollection<GeometryType extends GeoGeometryObjects> {
|
||||
type: string;
|
||||
bbox?: number[];
|
||||
crs?: GeoJSON.CoordinateReferenceSystem;
|
||||
crs?: {
|
||||
type: string;
|
||||
properties: any;
|
||||
};
|
||||
geometries: GeometryType[];
|
||||
}
|
||||
|
||||
|
||||
+50
-19
@@ -1051,7 +1051,7 @@ namespace forceCollapsable {
|
||||
var force = d3.layout.force<Node>()
|
||||
.on("tick", tick)
|
||||
.charge(function (d) { return d._children ? -d.size / 100 : -30; } )
|
||||
.linkDistance(function (d) { return d.target._children ? 80 : 30; } )
|
||||
.linkDistance(function (d) { return (d.target as Node)._children ? 80 : 30; } )
|
||||
.size([w, h - 160]);
|
||||
|
||||
var vis = d3.select("body").append("svg:svg")
|
||||
@@ -1083,10 +1083,10 @@ namespace forceCollapsable {
|
||||
// Enter any new links.
|
||||
link.enter().insert("svg:line", ".node")
|
||||
.attr("class", "link")
|
||||
.attr("x1", function (d) { return d.source.x; } )
|
||||
.attr("y1", function (d) { return d.source.y; } )
|
||||
.attr("x2", function (d) { return d.target.x; } )
|
||||
.attr("y2", function (d) { return d.target.y; } );
|
||||
.attr("x1", function (d) { return (d.source as Node).x; } )
|
||||
.attr("y1", function (d) { return (d.source as Node).y; } )
|
||||
.attr("x2", function (d) { return (d.target as Node).x; } )
|
||||
.attr("y2", function (d) { return (d.target as Node).y; } );
|
||||
|
||||
// Exit any old links.
|
||||
link.exit().remove();
|
||||
@@ -1114,10 +1114,10 @@ namespace forceCollapsable {
|
||||
}
|
||||
|
||||
function tick() {
|
||||
link.attr("x1", function (d) { return d.source.x; } )
|
||||
.attr("y1", function (d) { return d.source.y; } )
|
||||
.attr("x2", function (d) { return d.target.x; } )
|
||||
.attr("y2", function (d) { return d.target.y; } );
|
||||
link.attr("x1", function (d) { return (d.source as Node).x; } )
|
||||
.attr("y1", function (d) { return (d.source as Node).y; } )
|
||||
.attr("x2", function (d) { return (d.target as Node).x; } )
|
||||
.attr("y2", function (d) { return (d.target as Node).y; } );
|
||||
|
||||
node.attr("cx", function (d) { return d.x; } )
|
||||
.attr("cy", function (d) { return d.y; } );
|
||||
@@ -1738,7 +1738,7 @@ namespace forceCollapsable2 {
|
||||
var force = d3.layout.force<Node>()
|
||||
.on("tick", tick)
|
||||
.charge(function (d) { return d._children ? -d.size / 100 : -30; } )
|
||||
.linkDistance(function (d) { return d.target._children ? 80 : 30; } )
|
||||
.linkDistance(function (d) { return (d.target as Node)._children ? 80 : 30; } )
|
||||
.size([w, h - 160]);
|
||||
|
||||
var vis = d3.select("body").append("svg:svg")
|
||||
@@ -1770,10 +1770,10 @@ namespace forceCollapsable2 {
|
||||
// Enter any new links.
|
||||
link.enter().insert("svg:line", ".node")
|
||||
.attr("class", "link")
|
||||
.attr("x1", function (d) { return d.source.x; } )
|
||||
.attr("y1", function (d) { return d.source.y; } )
|
||||
.attr("x2", function (d) { return d.target.x; } )
|
||||
.attr("y2", function (d) { return d.target.y; } );
|
||||
.attr("x1", function (d) { return (d.source as Node).x; } )
|
||||
.attr("y1", function (d) { return (d.source as Node).y; } )
|
||||
.attr("x2", function (d) { return (d.target as Node).x; } )
|
||||
.attr("y2", function (d) { return (d.target as Node).y; } );
|
||||
|
||||
// Exit any old links.
|
||||
link.exit().remove();
|
||||
@@ -1801,11 +1801,11 @@ namespace forceCollapsable2 {
|
||||
}
|
||||
|
||||
function tick() {
|
||||
link.attr("x1", function (d) { return d.source.x; } )
|
||||
.attr("y1", function (d) { return d.source.y; } )
|
||||
.attr("x2", function (d) { return d.target.x; } )
|
||||
.attr("y2", function (d) { return d.target.y; } );
|
||||
|
||||
link.attr("x1", function (d) { return (d.source as Node).x; } )
|
||||
.attr("y1", function (d) { return (d.source as Node).y; } )
|
||||
.attr("x2", function (d) { return (d.target as Node).x; } )
|
||||
.attr("y2", function (d) { return (d.target as Node).y; } );
|
||||
|
||||
node.attr("cx", function (d) { return d.x; } )
|
||||
.attr("cy", function (d) { return d.y; } );
|
||||
}
|
||||
@@ -2720,3 +2720,34 @@ function testEnterSizeEmpty() {
|
||||
selectionSize = newNodes.size();
|
||||
|
||||
}
|
||||
|
||||
// Example from Matthias Jobst http://github.com/MatthiasJobst
|
||||
// Checks the brush with different Axis types
|
||||
class BrushAxisTest {
|
||||
brush: d3.svg.Brush<any,Date,Date>;
|
||||
constructor() {
|
||||
let scale = d3.time.scale<Date,Date>();
|
||||
this.brush = d3.svg.brush<any,Date>()
|
||||
.x(scale) // the x accessor accepts time scales
|
||||
.y(scale); // as does y
|
||||
}
|
||||
brushes = () => {
|
||||
let extent = this.brush.extent();
|
||||
let brush = d3.svg.brush();
|
||||
brush.x(d3.scale.linear()); // Linear scale
|
||||
brush.y(d3.scale.log()); // Logarithmic scale
|
||||
// Does not work:
|
||||
// brush.extent(this.brush.extent());
|
||||
// From https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md#ordinal_rangePoints
|
||||
let ordinalScale = d3.scale.ordinal<number,number>()
|
||||
.domain([1, 2, 3, 4])
|
||||
.rangePoints([0, 100]);
|
||||
let ordinalBrush = d3.svg.brush()
|
||||
.x(ordinalScale) // Ordinal scale
|
||||
.y(d3.scale.linear());
|
||||
let colorScale = d3.scale.category10();
|
||||
let colorBrush = d3.svg.brush<any,string,number>()
|
||||
.x(colorScale) // Color scale
|
||||
.y(d3.scale.pow());
|
||||
}
|
||||
}
|
||||
Vendored
+77
-66
@@ -1,6 +1,8 @@
|
||||
// Type definitions for d3JS 3.5
|
||||
// Project: http://d3js.org/
|
||||
// Definitions by: Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions by: Alex Ford <https://github.com/gustavderdrache>
|
||||
// Boris Yankov <https://github.com/borisyankov>
|
||||
// Matthias Jobst <https://github.com/MatthiasJobst>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Latest patch version of module validated against: 3.5.17
|
||||
@@ -233,28 +235,30 @@ declare namespace d3 {
|
||||
* @param name the element name to append. May be prefixed (see d3.ns.prefix).
|
||||
* @param before the selector to determine position (e.g., ":first-child")
|
||||
*/
|
||||
insert(name: string, before: string): Update<Datum>;
|
||||
// https://github.com/d3/d3-3.x-api-reference/blob/master/Selections.md#insert
|
||||
insert(name: string, before?: string): Update<Datum>;
|
||||
|
||||
/**
|
||||
* Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children.
|
||||
* @param name the element name to append. May be prefixed (see d3.ns.prefix).
|
||||
* @param before a function to determine the node to use as the next sibling
|
||||
*/
|
||||
insert(name: string, before: (datum: Datum, index: number, outerIndex: number) => EventTarget): Update<Datum>;
|
||||
// https://github.com/d3/d3-3.x-api-reference/blob/master/Selections.md#insert
|
||||
insert(name: string, before?: (datum: Datum, index: number, outerIndex: number) => EventTarget): Update<Datum>;
|
||||
|
||||
/**
|
||||
* Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children.
|
||||
* @param name the function to compute a new child
|
||||
* @param before the selector to determine position (e.g., ":first-child")
|
||||
*/
|
||||
insert(name: (datum: Datum, index: number, outerIndex: number) => EventTarget, before: string): Update<Datum>;
|
||||
insert(name: (datum: Datum, index: number, outerIndex: number) => EventTarget, before?: string): Update<Datum>;
|
||||
|
||||
/**
|
||||
* Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children.
|
||||
* @param name the function to compute a new child
|
||||
* @param before a function to determine the node to use as the next sibling
|
||||
*/
|
||||
insert(name: (datum: Datum, index: number, outerIndex: number) => EventTarget, before: (datum: Datum, index: number, outerIndex: number) => EventTarget): Update<Datum>;
|
||||
insert(name: (datum: Datum, index: number, outerIndex: number) => EventTarget, before?: (datum: Datum, index: number, outerIndex: number) => EventTarget): Update<Datum>;
|
||||
|
||||
/**
|
||||
* Removes the elements from the DOM. They are in a detached state and may be re-added (though there is currently no dedicated API for doing so).
|
||||
@@ -429,7 +433,7 @@ declare namespace d3 {
|
||||
/**
|
||||
* Administrivia: JavaScript primitive types, or "things that toString() predictably".
|
||||
*/
|
||||
export type Primitive = number | string | boolean;
|
||||
export type Primitive = number | string | boolean ;
|
||||
|
||||
/**
|
||||
* Administrivia: anything with a valueOf(): number method is comparable, so we allow it in numeric operations
|
||||
@@ -626,28 +630,28 @@ declare namespace d3 {
|
||||
* @param name the element name to append. May be prefixed (see d3.ns.prefix).
|
||||
* @param before the selector to determine position (e.g., ":first-child")
|
||||
*/
|
||||
insert(name: string, before: string): Selection<Datum>;
|
||||
insert(name: string, before?: string): Selection<Datum>;
|
||||
|
||||
/**
|
||||
* Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children.
|
||||
* @param name the element name to append. May be prefixed (see d3.ns.prefix).
|
||||
* @param before a function to determine the node to use as the next sibling
|
||||
*/
|
||||
insert(name: string, before: (datum: Datum, index: number, outerIndex: number) => EventTarget): Selection<Datum>;
|
||||
insert(name: string, before?: (datum: Datum, index: number, outerIndex: number) => EventTarget): Selection<Datum>;
|
||||
|
||||
/**
|
||||
* Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children.
|
||||
* @param name the function to compute a new child
|
||||
* @param before the selector to determine position (e.g., ":first-child")
|
||||
*/
|
||||
insert(name: (datum: Datum, index: number, outerIndex: number) => EventTarget, before: string): Selection<Datum>;
|
||||
insert(name: (datum: Datum, index: number, outerIndex: number) => EventTarget, before?: string): Selection<Datum>;
|
||||
|
||||
/**
|
||||
* Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children.
|
||||
* @param name the function to compute a new child
|
||||
* @param before a function to determine the node to use as the next sibling
|
||||
*/
|
||||
insert(name: (datum: Datum, index: number, outerIndex: number) => EventTarget, before: (datum: Datum, index: number, outerIndex: number) => EventTarget): Selection<Datum>;
|
||||
insert(name: (datum: Datum, index: number, outerIndex: number) => EventTarget, before?: (datum: Datum, index: number, outerIndex: number) => EventTarget): Selection<Datum>;
|
||||
|
||||
/**
|
||||
* Removes the elements from the DOM. They are in a detached state and may be re-added (though there is currently no dedicated API for doing so).
|
||||
@@ -928,28 +932,28 @@ declare namespace d3 {
|
||||
export function flush(): void;
|
||||
}
|
||||
|
||||
interface BaseEvent {
|
||||
type: string;
|
||||
sourceEvent?: Event;
|
||||
}
|
||||
interface BaseEvent {
|
||||
type: string;
|
||||
sourceEvent?: Event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a D3-specific ZoomEvent per https://github.com/mbostock/d3/wiki/Zoom-Behavior#event
|
||||
*/
|
||||
interface ZoomEvent extends BaseEvent {
|
||||
scale: number;
|
||||
translate: [number, number];
|
||||
}
|
||||
/**
|
||||
* Define a D3-specific ZoomEvent per https://github.com/mbostock/d3/wiki/Zoom-Behavior#event
|
||||
*/
|
||||
interface ZoomEvent extends BaseEvent {
|
||||
scale: number;
|
||||
translate: [number, number];
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a D3-specific DragEvent per https://github.com/mbostock/d3/wiki/Drag-Behavior#on
|
||||
*/
|
||||
interface DragEvent extends BaseEvent {
|
||||
x: number;
|
||||
y: number;
|
||||
dx: number;
|
||||
dy: number;
|
||||
}
|
||||
/**
|
||||
* Define a D3-specific DragEvent per https://github.com/mbostock/d3/wiki/Drag-Behavior#on
|
||||
*/
|
||||
interface DragEvent extends BaseEvent {
|
||||
x: number;
|
||||
y: number;
|
||||
dx: number;
|
||||
dy: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current event's value. Use this variable in a handler registered with `selection.on`.
|
||||
@@ -1387,8 +1391,8 @@ declare namespace d3 {
|
||||
export function requote(string: string): string;
|
||||
|
||||
export var rgb: {
|
||||
new (r: number, g: number, b: number): Rgb;
|
||||
new (color: string): Rgb;
|
||||
new(r: number, g: number, b: number): Rgb;
|
||||
new(color: string): Rgb;
|
||||
|
||||
(r: number, g: number, b: number): Rgb;
|
||||
(color: string): Rgb;
|
||||
@@ -1408,8 +1412,8 @@ declare namespace d3 {
|
||||
}
|
||||
|
||||
export var hsl: {
|
||||
new (h: number, s: number, l: number): Hsl;
|
||||
new (color: string): Hsl;
|
||||
new(h: number, s: number, l: number): Hsl;
|
||||
new(color: string): Hsl;
|
||||
|
||||
(h: number, s: number, l: number): Hsl;
|
||||
(color: string): Hsl;
|
||||
@@ -1429,8 +1433,8 @@ declare namespace d3 {
|
||||
}
|
||||
|
||||
export var hcl: {
|
||||
new (h: number, c: number, l: number): Hcl;
|
||||
new (color: string): Hcl;
|
||||
new(h: number, c: number, l: number): Hcl;
|
||||
new(color: string): Hcl;
|
||||
|
||||
(h: number, c: number, l: number): Hcl;
|
||||
(color: string): Hcl;
|
||||
@@ -1446,8 +1450,8 @@ declare namespace d3 {
|
||||
}
|
||||
|
||||
export var lab: {
|
||||
new (l: number, a: number, b: number): Lab;
|
||||
new (color: string): Lab;
|
||||
new(l: number, a: number, b: number): Lab;
|
||||
new(color: string): Lab;
|
||||
|
||||
(l: number, a: number, b: number): Lab;
|
||||
(color: string): Lab;
|
||||
@@ -1467,7 +1471,7 @@ declare namespace d3 {
|
||||
|
||||
export var color: {
|
||||
(): Color;
|
||||
new (): Color;
|
||||
new(): Color;
|
||||
};
|
||||
|
||||
interface Color {
|
||||
@@ -1681,7 +1685,7 @@ declare namespace d3 {
|
||||
export function category20<Domain extends { toString(): string }>(): Ordinal<Domain, string>;
|
||||
export function category20b(): Ordinal<string, string>;
|
||||
export function category20b<Domain extends { toString(): string }>(): Ordinal<Domain, string>;
|
||||
export function category20c(): Ordinal<string,string>;
|
||||
export function category20c(): Ordinal<string, string>;
|
||||
export function category20c<Domain extends { toString(): string }>(): Ordinal<Domain, string>;
|
||||
|
||||
interface Ordinal<Domain extends { toString(): string }, Range> {
|
||||
@@ -1818,10 +1822,10 @@ declare namespace d3 {
|
||||
export function format(specifier: string): Format;
|
||||
|
||||
export module format {
|
||||
export function multi(formats: Array<[string, (d: Date) => boolean|number]>): Format;
|
||||
export function multi(formats: Array<[string, (d: Date) => boolean | number]>): Format;
|
||||
export function utc(specifier: string): Format;
|
||||
namespace utc {
|
||||
export function multi(formats: Array<[string, (d: Date) => boolean|number]>): Format;
|
||||
export function multi(formats: Array<[string, (d: Date) => boolean | number]>): Format;
|
||||
}
|
||||
|
||||
export var iso: Format;
|
||||
@@ -2574,42 +2578,47 @@ declare namespace d3 {
|
||||
|
||||
tickFormat(): (t: any) => string;
|
||||
tickFormat(format: (t: any) => string): Axis;
|
||||
tickFormat(format:string): Axis;
|
||||
tickFormat(format: string): Axis;
|
||||
}
|
||||
|
||||
export function brush(): Brush<any>;
|
||||
export function brush<T>(): Brush<T>;
|
||||
export function brush(): Brush<any, number, number>;
|
||||
export function brush<T>(): Brush<T, number, number>;
|
||||
export function brush<T,X>(): Brush<T, X, X>;
|
||||
export function brush<T, X, Y>(): Brush<T, X, Y>;
|
||||
|
||||
namespace brush {
|
||||
interface Scale {
|
||||
domain(): number[];
|
||||
domain(domain: number[]): Scale;
|
||||
interface Scale<S> {
|
||||
domain(): S[];
|
||||
domain(domain: S[]): Scale<S>;
|
||||
|
||||
range(): number[];
|
||||
range(range: number[]): Scale;
|
||||
range(): S[];
|
||||
range(range: number[]): Scale<S>;
|
||||
|
||||
invert?(y: number): number;
|
||||
invert?(y: number): S;
|
||||
}
|
||||
}
|
||||
|
||||
interface Brush<T> {
|
||||
interface Brush<T, X, Y> {
|
||||
(selection: Selection<T>): void;
|
||||
(selection: Transition<T>): void;
|
||||
|
||||
event(selection: Selection<T>): void;
|
||||
event(selection: Transition<T>): void;
|
||||
|
||||
x(): brush.Scale;
|
||||
x(x: brush.Scale): Brush<T>;
|
||||
x(): brush.Scale<X>;
|
||||
x(x: brush.Scale<X>): Brush<T, X, Y>;
|
||||
x<A, B extends X>(x: d3.scale.Ordinal<A, B> | d3.time.Scale<A, B>): Brush<T, X, Y>;
|
||||
|
||||
y(): brush.Scale;
|
||||
y(y: brush.Scale): Brush<T>;
|
||||
y(): brush.Scale<Y>;
|
||||
y(y: brush.Scale<Y>): Brush<T, X, Y>;
|
||||
y<A, B extends Y>(x: d3.scale.Ordinal<A, B> | d3.time.Scale<A, B>): Brush<T, X, Y>;
|
||||
|
||||
extent(): [number, number] | [[number, number], [number, number]];
|
||||
extent(extent: [number, number] | [[number, number], [number, number]]): Brush<T>;
|
||||
// https://github.com/d3/d3-3.x-api-reference/blob/master/SVG-Controls.md#brush_extent
|
||||
extent(): [X, X] | [Y, Y] | [[X, Y], [X, Y]] | null;
|
||||
extent(extent: [X, X] | [Y, Y] | [[X, Y], [X, Y]]): Brush<T, X, Y>;
|
||||
|
||||
clamp(): boolean | [boolean, boolean];
|
||||
clamp(clamp: boolean | [boolean, boolean]): Brush<T>;
|
||||
clamp(clamp: boolean | [boolean, boolean]): Brush<T, X, Y>;
|
||||
|
||||
clear(): void;
|
||||
|
||||
@@ -2620,10 +2629,10 @@ declare namespace d3 {
|
||||
on(type: 'brushend'): (datum: T, index: number) => void;
|
||||
on(type: string): (datum: T, index: number) => void;
|
||||
|
||||
on(type: 'brushstart', listener: (datum: T, index: number) => void): Brush<T>;
|
||||
on(type: 'brush', listener: (datum: T, index: number) => void): Brush<T>;
|
||||
on(type: 'brushend', listener: (datum: T, index: number) => void): Brush<T>;
|
||||
on(type: string, listener: (datum: T, index: number) => void): Brush<T>;
|
||||
on(type: 'brushstart', listener: (datum: T, index: number) => void): Brush<T, X, Y>;
|
||||
on(type: 'brush', listener: (datum: T, index: number) => void): Brush<T, X ,Y>;
|
||||
on(type: 'brushend', listener: (datum: T, index: number) => void): Brush<T, X, Y>;
|
||||
on(type: string, listener: (datum: T, index: number) => void): Brush<T, X, Y>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2759,7 +2768,7 @@ declare namespace d3 {
|
||||
timeFormat: {
|
||||
(specifier: string): time.Format;
|
||||
utc(specifier: string): time.Format;
|
||||
multi(formats: Array<[string, (d: Date) => boolean|number]>): time.Format;
|
||||
multi(formats: Array<[string, (d: Date) => boolean | number]>): time.Format;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2874,10 +2883,12 @@ declare namespace d3 {
|
||||
export function force<Node extends force.Node>(): Force<force.Link<Node>, Node>;
|
||||
export function force<Link extends force.Link<force.Node>, Node extends force.Node>(): Force<Link, Node>;
|
||||
|
||||
// https://github.com/d3/d3-3.x-api-reference/blob/master/Force-Layout.md#links
|
||||
// Read the note at the end of the section where it talks about initial numbering
|
||||
namespace force {
|
||||
interface Link<T extends Node> {
|
||||
source: T;
|
||||
target: T;
|
||||
source: T | number;
|
||||
target: T | number;
|
||||
}
|
||||
|
||||
interface Node {
|
||||
|
||||
@@ -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"
|
||||
|
||||
Vendored
+69
-2
@@ -1,6 +1,9 @@
|
||||
// Type definitions for JQuery DataTables 1.10
|
||||
// Project: http://www.datatables.net
|
||||
// Definitions by: Kiarash Ghiaseddin <https://github.com/Silver-Connection>, Omid Rad <https://github.com/omidkrad>, Armin Sander <https://github.com/pragmatrix>
|
||||
// Definitions by: Kiarash Ghiaseddin <https://github.com/Silver-Connection>
|
||||
// Omid Rad <https://github.com/omidkrad>
|
||||
// Armin Sander <https://github.com/pragmatrix>
|
||||
// Craig Boland <https://github.com/CNBoland>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -329,6 +332,16 @@ declare namespace DataTables {
|
||||
(order?: Array<(string | number)> | Array<Array<(string | number)>>): 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"
|
||||
|
||||
Vendored
+26
-17
@@ -1,6 +1,8 @@
|
||||
// Type definitions for DCJS
|
||||
// Project: https://github.com/dc-js/dc.js
|
||||
// Definitions by: hans windhoff <https://github.com/hansrwindhoff>, matt traynham <https://github.com/mtraynham>
|
||||
// Definitions by: hans windhoff <https://github.com/hansrwindhoff>
|
||||
// matt traynham <https://github.com/mtraynham>
|
||||
// matthias jobst <https://github.com/MatthiasJobst>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// this makes only sense together with d3 and crossfilter so you need the d3.d.ts and crossfilter.d.ts files
|
||||
@@ -49,8 +51,9 @@ declare namespace dc {
|
||||
format: Accessor<any, string>;
|
||||
}
|
||||
|
||||
// http://dc-js.github.io/dc.js/docs/html/dc.units.html
|
||||
export interface UnitFunction {
|
||||
(start: number, end: number, domain?: Array<any>): number|Array<any>;
|
||||
(start: number|Date, end: number|Date, domain?: number|Array<string>): number | Array<number|Date|string>;
|
||||
}
|
||||
|
||||
export interface FloatPointUnits {
|
||||
@@ -135,12 +138,13 @@ declare namespace dc {
|
||||
minHeight: IGetSet<number, T>;
|
||||
dimension: IGetSet<any, T>;
|
||||
data: IGetSetComputed<(group: any) => Array<any>, Array<any>, T>;
|
||||
group: IGetSet<any, T>;
|
||||
// http://dc-js.github.io/dc.js/docs/html/dc.baseMixin.html#group__anchor
|
||||
group: IBiGetSet<any, string, T>;
|
||||
ordering: IGetSet<Accessor<any, any>, T>;
|
||||
filterAll(): void;
|
||||
select(selector: d3.Selection<any>|string): d3.Selection<any>;
|
||||
selectAll(selector: d3.Selection<any>|string): d3.Selection<any>;
|
||||
anchor(anchor: BaseMixin<any>|d3.Selection<any>|string, chartGroup?: string): d3.Selection<any>;
|
||||
select(selector: d3.Selection<any> | string): d3.Selection<any>;
|
||||
selectAll(selector: d3.Selection<any> | string): d3.Selection<any>;
|
||||
anchor(anchor: BaseMixin<any> | d3.Selection<any> | string, chartGroup?: string): d3.Selection<any>;
|
||||
anchorName(): string;
|
||||
svg: IGetSet<d3.Selection<any>, d3.Selection<any>>;
|
||||
resetSvg(): void;
|
||||
@@ -196,10 +200,11 @@ declare namespace dc {
|
||||
}
|
||||
|
||||
export interface ColorMixin<T> {
|
||||
colors: IGetSet<Array<string> | Scale<string | d3.Color>, T>;
|
||||
ordinalColors(r: Array<string>): void;
|
||||
linearColors(r: Array<string>): void;
|
||||
colorAccessor: IGetSet<Accessor<any, string>, T>;
|
||||
// http://dc-js.github.io/dc.js/docs/html/dc.colorMixin.html
|
||||
colors: IGetSet<Array<string> | Scale<string | d3.Color> | string, T>;
|
||||
ordinalColors(r: Array<string>): T;
|
||||
linearColors(r: Array<string>): T;
|
||||
colorAccessor: IGetSet<Accessor<any, number>, T>;
|
||||
colorDomain: IGetSet<Array<any>, T>;
|
||||
calculateColorDomain(): void;
|
||||
getColor(datum: any, index?: number): string;
|
||||
@@ -291,7 +296,7 @@ declare namespace dc {
|
||||
dashStyle: IGetSet<Array<number>, LineChart>;
|
||||
renderArea: IGetSet<boolean, LineChart>;
|
||||
dotRadius: IGetSet<number, LineChart>;
|
||||
renderDataPoints: IGetSet<RenderDataPointOptions|any, LineChart>;
|
||||
renderDataPoints: IGetSet<RenderDataPointOptions | any, LineChart>;
|
||||
}
|
||||
|
||||
export interface DataCountWidgetHTML {
|
||||
@@ -307,7 +312,7 @@ declare namespace dc {
|
||||
export interface DataTableWidget extends BaseMixin<DataTableWidget> {
|
||||
size: IGetSet<number, DataTableWidget>;
|
||||
showGroups: IGetSet<boolean, DataTableWidget>;
|
||||
columns: IGetSet<Array<string|Accessor<any, any>|Columns>, DataTableWidget>;
|
||||
columns: IGetSet<Array<string | Accessor<any, any> | Columns>, DataTableWidget>;
|
||||
sortBy: IGetSet<Accessor<any, any>, DataTableWidget>;
|
||||
order: IGetSet<(a: any, b: any) => number, DataTableWidget>;
|
||||
}
|
||||
@@ -336,7 +341,7 @@ declare namespace dc {
|
||||
rightYAxis: IGetSet<d3.svg.Axis, ICompositeChart<T>>;
|
||||
}
|
||||
|
||||
export interface CompositeChart extends ICompositeChart<CompositeChart> {}
|
||||
export interface CompositeChart extends ICompositeChart<CompositeChart> { }
|
||||
|
||||
export interface SeriesChart extends ICompositeChart<SeriesChart> {
|
||||
chart: IGetSet<(c: any) => BaseMixin<any>, SeriesChart>;
|
||||
@@ -444,11 +449,16 @@ declare namespace dc {
|
||||
round: Round;
|
||||
utils: Utils;
|
||||
|
||||
// http://dc-js.github.io/dc.js/docs/html/core.js.html, Line 20
|
||||
version: string;
|
||||
|
||||
legend(): Legend;
|
||||
|
||||
pieChart(parent: string, chartGroup?: string): PieChart;
|
||||
barChart(parent: string, chartGroup?: string): BarChart;
|
||||
lineChart(parent: string, chartGroup?: string): LineChart;
|
||||
// http://dc-js.github.io/dc.js/docs/html/dc.barChart.html
|
||||
barChart(parent: string | CompositeChart, chartGroup?: string): BarChart;
|
||||
// http://dc-js.github.io/dc.js/docs/html/dc.lineChart.html
|
||||
lineChart(parent: string | CompositeChart, chartGroup?: string): LineChart;
|
||||
dataCount(parent: string, chartGroup?: string): DataCountWidget;
|
||||
dataTable(parent: string, chartGroup?: string): DataTableWidget;
|
||||
dataGrid(parent: string, chartGroup?: string): DataGridWidget;
|
||||
@@ -463,5 +473,4 @@ declare namespace dc {
|
||||
heatMap(parent: string, chartGroup?: string): HeatMap;
|
||||
boxPlot(parent: string, chartGroup?: string): BoxPlot;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Vendored
+1605
-1554
File diff suppressed because it is too large
Load Diff
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +1,7 @@
|
||||
{
|
||||
"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
|
||||
"no-empty-interface": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+9
@@ -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.
|
||||
@@ -1032,6 +1033,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<any>;
|
||||
/**
|
||||
* 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.
|
||||
|
||||
@@ -23,3 +23,34 @@ 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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
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) => {
|
||||
console.log('listener3', arg1);
|
||||
};
|
||||
const listener4 = () => {
|
||||
console.log('type of number');
|
||||
};
|
||||
|
||||
emitter.setMaxListeners(100);
|
||||
|
||||
emitter.addListener('send', listener1);
|
||||
|
||||
emitter.on('send', listener2);
|
||||
|
||||
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('\n');
|
||||
emitter.emit('send');
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('\n');
|
||||
emitter.emit('send');
|
||||
emitter.removeListener('send', listener2);
|
||||
}, 2000);
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('\n');
|
||||
emitter.emit('send', 'params1');
|
||||
emitter.removeAllListeners('send');
|
||||
}, 3000);
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('\n');
|
||||
emitter.emit(1);
|
||||
emitter.emit('send');
|
||||
}, 3000);
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for events 1.1
|
||||
// Project: https://github.com/Gozala/events
|
||||
// Definitions by: Yasunori Ohoka <https://github.com/yasupeke>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export type Listener = (...args: any[]) => void;
|
||||
|
||||
export class EventEmitter {
|
||||
static listenerCount(emitter: EventEmitter, type: string | number): number;
|
||||
static defaultMaxListeners: number;
|
||||
|
||||
setMaxListeners(n: number): this;
|
||||
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;
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+22
-8
@@ -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;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import formatDuration = require("format-duration");
|
||||
|
||||
const milliseconds = 12345;
|
||||
|
||||
const duration: string = formatDuration(milliseconds);
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for format-duration 1.0
|
||||
// Project: https://github.com/ungoldman/format-duration
|
||||
// Definitions by: Giles Roadnight <https://github.com/Roaders>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function formatDuration(ms: number): string;
|
||||
|
||||
export = formatDuration;
|
||||
@@ -1,17 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"experimentalDecorators": true,
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
@@ -21,6 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"autobind-decorator-tests.ts"
|
||||
"format-duration-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,20 @@
|
||||
import { match, filter, score } from 'fuzzaldrin';
|
||||
|
||||
let number = 0;
|
||||
const string = '' as string;
|
||||
let strings: string[] = [];
|
||||
let objects: Array<{name: string, speed: number}> = [];
|
||||
|
||||
strings = filter(strings, string);
|
||||
strings = filter(strings, string, {maxResults: number});
|
||||
objects = filter(objects, string, {key: 'name'});
|
||||
objects = filter(objects, string, {key: 'name', maxResults: number});
|
||||
|
||||
number = score(string, string);
|
||||
|
||||
match(string, string);
|
||||
|
||||
// These should be type errors! Uncomment to verify.
|
||||
// objects = filter(objects, string);
|
||||
// objects = filter(objects, string, {key: 'speed'});
|
||||
// strings = filter(strings, string, {key: 'speed'});
|
||||
Vendored
+3
-1
@@ -2,7 +2,9 @@
|
||||
// Project: https://github.com/atom/fuzzaldrin
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export function filter<T>(candidates: T[], query: string, options?: { key?: string, maxResults?: number }): T[];
|
||||
export function filter(candidates: string[], query: string, options?: {maxResults?: number}): string[];
|
||||
export function filter<T, K extends keyof T>(candidates: T[], query: string & T[K], options: {key: K, maxResults?: number}): T[];
|
||||
export function match(string: string, query: string): any;
|
||||
export function score(string: string, query: string): number;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
"index.d.ts",
|
||||
"fuzzaldrin-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -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<GoogleUser>;
|
||||
|
||||
/**
|
||||
* Signs out all accounts from the application.
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
let featureCollection: GeoJSON.FeatureCollection<any> = {
|
||||
import {
|
||||
BBox,
|
||||
Feature, FeatureCollection, GeometryCollection, LineString,
|
||||
MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, GeometryObject
|
||||
} from "geojson";
|
||||
|
||||
let featureCollection: FeatureCollection<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon | GeometryCollection> = {
|
||||
type: "FeatureCollection",
|
||||
features: [
|
||||
{
|
||||
@@ -34,7 +40,7 @@ let featureCollection: GeoJSON.FeatureCollection<any> = {
|
||||
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: {
|
||||
@@ -44,17 +50,10 @@ let featureCollection: GeoJSON.FeatureCollection<any> = {
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
crs: {
|
||||
type: "link",
|
||||
properties: {
|
||||
href: "http://example.com/crs/42",
|
||||
type: "proj4"
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
let featureWithPolygon: GeoJSON.Feature<GeoJSON.Polygon> = {
|
||||
const featureWithPolygon: Feature<Polygon> = {
|
||||
type: "Feature",
|
||||
bbox: [-180.0, -90.0, 180.0, 90.0],
|
||||
geometry: {
|
||||
@@ -66,57 +65,57 @@ let featureWithPolygon: GeoJSON.Feature<GeoJSON.Polygon> = {
|
||||
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,16 +124,17 @@ 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<GeoJSON.GeometryObject> = {
|
||||
let feature: Feature<GeometryObject> = {
|
||||
type: "Feature",
|
||||
geometry: lineString,
|
||||
properties: null
|
||||
};
|
||||
|
||||
feature = {
|
||||
type: "Feature",
|
||||
geometry: polygon,
|
||||
@@ -172,44 +172,37 @@ 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: {
|
||||
type: "link",
|
||||
properties: {
|
||||
href: "http://example.com/crs/42",
|
||||
type: "proj4"
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Allow access to custom properties
|
||||
const pt: GeoJSON.Feature<GeoJSON.Point> = {
|
||||
const pt: Feature<Point> = {
|
||||
type: "Feature",
|
||||
properties: {
|
||||
foo: "bar",
|
||||
@@ -221,9 +214,14 @@ const pt: GeoJSON.Feature<GeoJSON.Point> = {
|
||||
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 +230,21 @@ interface TestProperty {
|
||||
hello: string;
|
||||
}
|
||||
|
||||
const typedPropertiesFeature: GeoJSON.Feature<GeoJSON.Point, TestProperty> = {
|
||||
const testProps: TestProperty = {
|
||||
foo: "bar",
|
||||
hello: "world"
|
||||
};
|
||||
|
||||
const typedPropertiesFeature: Feature<Point> = {
|
||||
type: "Feature",
|
||||
properties: {
|
||||
foo: "bar",
|
||||
hello: "world",
|
||||
},
|
||||
properties: testProps,
|
||||
geometry: {
|
||||
type: "Point",
|
||||
coordinates: [0, 0]
|
||||
}
|
||||
};
|
||||
|
||||
const typedPropertiesFeatureCollection: GeoJSON.FeatureCollection<GeoJSON.Point, TestProperty> = {
|
||||
const typedPropertiesFeatureCollection: FeatureCollection<Point> = {
|
||||
type: "FeatureCollection",
|
||||
features: [typedPropertiesFeature]
|
||||
};
|
||||
|
||||
Vendored
+108
-66
@@ -1,123 +1,165 @@
|
||||
// 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 <https://github.com/cobster>
|
||||
// Arne Schubert <https://github.com/atd-schubert>
|
||||
// Jeff Jacobson <https://github.com/JeffJacobson>
|
||||
// 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 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 GeoJsonTypes = "FeatureCollection" | "Feature" | GeoJsonGeometryTypes;
|
||||
|
||||
/**
|
||||
* Bounding box
|
||||
* https://tools.ietf.org/html/rfc7946#section-5
|
||||
*/
|
||||
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, number];
|
||||
|
||||
/**
|
||||
* The base GeoJSON object.
|
||||
* 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 {
|
||||
type: string;
|
||||
bbox?: number[];
|
||||
crs?: CoordinateReferenceSystem;
|
||||
// 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: 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?: BBox;
|
||||
}
|
||||
|
||||
/***
|
||||
* 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: GeoJsonGeometryTypes;
|
||||
}
|
||||
|
||||
/***
|
||||
* 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[];
|
||||
geometries: Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>;
|
||||
}
|
||||
|
||||
/***
|
||||
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<G extends GeometryObject, P = any> extends GeoJsonObject {
|
||||
export interface Feature<G extends GeometryObject, P = GeoJsonProperties> extends GeoJsonObject {
|
||||
type: "Feature";
|
||||
geometry: G;
|
||||
properties: P;
|
||||
/**
|
||||
* The feature's geometry
|
||||
*/
|
||||
geometry: G | 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: P | 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<G extends GeometryObject, P = any> extends GeoJsonObject {
|
||||
type: "FeatureCollection";
|
||||
export interface FeatureCollection<G extends GeometryObject, P = GeoJsonProperties> extends GeoJsonObject {
|
||||
features: Array<Feature<G, P>>;
|
||||
}
|
||||
|
||||
/***
|
||||
* 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 };
|
||||
}
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Vendored
+37
-13
@@ -1,6 +1,7 @@
|
||||
// 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 <https://github.com/Bartvds>
|
||||
// mrmlnc <https://github.com/mrmlnc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -8,17 +9,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;
|
||||
|
||||
Vendored
+1
@@ -455,6 +455,7 @@ export class GraphQLEnumType {
|
||||
constructor(config: GraphQLEnumTypeConfig);
|
||||
getValues(): GraphQLEnumValue[];
|
||||
getValue(name: string): GraphQLEnumValue;
|
||||
isValidValue(value: any): boolean;
|
||||
serialize(value: any): string;
|
||||
parseValue(value: any): any;
|
||||
parseLiteral(valueNode: ValueNode): any;
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
import fs = require('fs');
|
||||
import gzipSize = require('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));
|
||||
|
||||
Vendored
+37
-2
@@ -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 <https://github.com/plantain-00>
|
||||
// Jimi van der Woning <https://github.com/jimivdw>
|
||||
// Andre Wiggins <https://github.com/andrewiggins>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -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<number>;
|
||||
|
||||
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<number>;
|
||||
}
|
||||
|
||||
export = gzipSize;
|
||||
|
||||
@@ -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' } });
|
||||
});
|
||||
|
||||
Vendored
+11
-5
@@ -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 <https://github.com/AJamesPhillips>
|
||||
// Rodrigo Saboya <https://github.com/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<ValidateResponse | ValidateCustomResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+5
-1
@@ -1,10 +1,14 @@
|
||||
// Type definitions for highlight.js v9.12
|
||||
// Project: https://github.com/isagalaev/highlight.js
|
||||
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee>, Jeremy Hull <https://github.com/sourrust>
|
||||
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee>
|
||||
// Jeremy Hull <https://github.com/sourrust>
|
||||
// Josh Goldberg <https://github.com/joshuakgoldberg>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace hljs
|
||||
{
|
||||
interface Node { }
|
||||
|
||||
export function highlight(
|
||||
name: string,
|
||||
value: string,
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/TheDeveloper/http-aws-es#readme
|
||||
// Definitions by: Marco Gonzalez <https://github.com/marcogrcr>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
@@ -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
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for ignore-styles 5.0
|
||||
// Project: https://github.com/bkonkle/ignore-styles
|
||||
// Definitions by: Taiju Muto <https://github.com/tai2>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types='node' />
|
||||
|
||||
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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+5
-1
@@ -1320,4 +1320,8 @@ declare var is: Is;
|
||||
|
||||
declare module 'is' {
|
||||
export = is;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'is_js' {
|
||||
export = is;
|
||||
}
|
||||
|
||||
Vendored
+14
@@ -8,6 +8,7 @@
|
||||
// Rytis Alekna <https://github.com/ralekna>
|
||||
// Pavel Ivanov <https://github.com/schfkt>
|
||||
// Youngrok Kim <https://github.com/rokoroku>
|
||||
// Dan Kraus <https://github.com/dankraus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -127,6 +128,13 @@ export interface UriOptions {
|
||||
scheme?: string | RegExp | Array<string | RegExp>;
|
||||
}
|
||||
|
||||
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).
|
||||
*/
|
||||
|
||||
+54
-45
@@ -1,51 +1,52 @@
|
||||
import Joi = require('joi');
|
||||
import { GuidVersions } from 'joi';
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var x: any = null;
|
||||
var value: any = null;
|
||||
var num: number = 0;
|
||||
var str: string = '';
|
||||
var bool: boolean = false;
|
||||
var exp: RegExp = null;
|
||||
var obj: object = null;
|
||||
var date: Date = null;
|
||||
var err: Error = null;
|
||||
var func: Function = null;
|
||||
let x: any = null;
|
||||
let value: any = null;
|
||||
let num: number = 0;
|
||||
let str: string = '';
|
||||
let bool: boolean = false;
|
||||
let exp: RegExp = null;
|
||||
let obj: object = null;
|
||||
let date: Date = null;
|
||||
let err: Error = null;
|
||||
let func: Function = null;
|
||||
|
||||
var anyArr: any[] = [];
|
||||
var numArr: number[] = [];
|
||||
var strArr: string[] = [];
|
||||
var boolArr: boolean[] = [];
|
||||
var expArr: RegExp[] = [];
|
||||
var objArr: object[] = [];
|
||||
var errArr: Error[] = [];
|
||||
var funcArr: Function[] = [];
|
||||
let anyArr: any[] = [];
|
||||
let numArr: number[] = [];
|
||||
let strArr: string[] = [];
|
||||
let boolArr: boolean[] = [];
|
||||
let expArr: RegExp[] = [];
|
||||
let objArr: object[] = [];
|
||||
let errArr: Error[] = [];
|
||||
let funcArr: Function[] = [];
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var schema: Joi.Schema = null;
|
||||
var schemaLike: Joi.SchemaLike = null;
|
||||
let schema: Joi.Schema = null;
|
||||
let schemaLike: Joi.SchemaLike = null;
|
||||
|
||||
var anySchema: Joi.AnySchema = null;
|
||||
var numSchema: Joi.NumberSchema = null;
|
||||
var strSchema: Joi.StringSchema = null;
|
||||
var arrSchema: Joi.ArraySchema = null;
|
||||
var boolSchema: Joi.BooleanSchema = null;
|
||||
var binSchema: Joi.BinarySchema = null;
|
||||
var dateSchema: Joi.DateSchema = null;
|
||||
var funcSchema: Joi.FunctionSchema = null;
|
||||
var objSchema: Joi.ObjectSchema = null;
|
||||
var altSchema: Joi.AlternativesSchema = null;
|
||||
let anySchema: Joi.AnySchema = null;
|
||||
let numSchema: Joi.NumberSchema = null;
|
||||
let strSchema: Joi.StringSchema = null;
|
||||
let arrSchema: Joi.ArraySchema = null;
|
||||
let boolSchema: Joi.BooleanSchema = null;
|
||||
let binSchema: Joi.BinarySchema = null;
|
||||
let dateSchema: Joi.DateSchema = null;
|
||||
let funcSchema: Joi.FunctionSchema = null;
|
||||
let objSchema: Joi.ObjectSchema = null;
|
||||
let altSchema: Joi.AlternativesSchema = null;
|
||||
|
||||
var schemaArr: Joi.Schema[] = [];
|
||||
let schemaArr: Joi.Schema[] = [];
|
||||
|
||||
var ref: Joi.Reference = null;
|
||||
var description: Joi.Description = null;
|
||||
let ref: Joi.Reference = null;
|
||||
let description: Joi.Description = null;
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var validOpts: Joi.ValidationOptions = null;
|
||||
let validOpts: Joi.ValidationOptions = null;
|
||||
|
||||
validOpts = { abortEarly: bool };
|
||||
validOpts = { convert: bool };
|
||||
@@ -77,7 +78,7 @@ validOpts = {
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var renOpts: Joi.RenameOptions = null;
|
||||
let renOpts: Joi.RenameOptions = null;
|
||||
|
||||
renOpts = { alias: bool };
|
||||
renOpts = { multiple: bool };
|
||||
@@ -86,7 +87,7 @@ renOpts = { ignoreUndefined: bool };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var emailOpts: Joi.EmailOptions = null;
|
||||
let emailOpts: Joi.EmailOptions = null;
|
||||
|
||||
emailOpts = { errorLevel: num };
|
||||
emailOpts = { errorLevel: bool };
|
||||
@@ -96,7 +97,7 @@ emailOpts = { minDomainAtoms: num };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var ipOpts: Joi.IpOptions = null;
|
||||
let ipOpts: Joi.IpOptions = null;
|
||||
|
||||
ipOpts = { version: str };
|
||||
ipOpts = { version: strArr };
|
||||
@@ -104,7 +105,7 @@ ipOpts = { cidr: str };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var uriOpts: Joi.UriOptions = null;
|
||||
let uriOpts: Joi.UriOptions = null;
|
||||
|
||||
uriOpts = { scheme: str };
|
||||
uriOpts = { scheme: exp };
|
||||
@@ -113,7 +114,13 @@ uriOpts = { scheme: expArr };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var whenOpts: Joi.WhenOptions = null;
|
||||
let base64Opts: Joi.Base64Options = null;
|
||||
|
||||
base64Opts = { paddingRequired: bool };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
let whenOpts: Joi.WhenOptions = null;
|
||||
|
||||
whenOpts = { is: x };
|
||||
whenOpts = { is: schema, then: schema };
|
||||
@@ -122,16 +129,16 @@ whenOpts = { is: schemaLike, then: schemaLike, otherwise: schemaLike };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var refOpts: Joi.ReferenceOptions = null;
|
||||
let refOpts: Joi.ReferenceOptions = null;
|
||||
|
||||
refOpts = { separator: str };
|
||||
refOpts = { contextPrefix: str };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var validErr: Joi.ValidationError = null;
|
||||
var validErrItem: Joi.ValidationErrorItem;
|
||||
var validErrFunc: Joi.ValidationErrorFunction;
|
||||
let validErr: Joi.ValidationError = null;
|
||||
let validErrItem: Joi.ValidationErrorItem;
|
||||
let validErrFunc: Joi.ValidationErrorFunction;
|
||||
|
||||
validErrItem = {
|
||||
message: str,
|
||||
@@ -176,7 +183,7 @@ anySchema = objSchema;
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var schemaMap: Joi.SchemaMap = null;
|
||||
let schemaMap: Joi.SchemaMap = null;
|
||||
|
||||
schemaMap = {
|
||||
a: numSchema,
|
||||
@@ -765,7 +772,7 @@ strSchema = strSchema.ip(ipOpts);
|
||||
strSchema = strSchema.uri();
|
||||
strSchema = strSchema.uri(uriOpts);
|
||||
strSchema = strSchema.guid();
|
||||
strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] });
|
||||
strSchema = strSchema.guid({ version: ['uuidv1' as GuidVersions, 'uuidv2' as GuidVersions, 'uuidv3' as GuidVersions, 'uuidv4' as GuidVersions, 'uuidv5' as GuidVersions]});
|
||||
strSchema = strSchema.guid({ version: 'uuidv4' });
|
||||
strSchema = strSchema.hex();
|
||||
strSchema = strSchema.hostname();
|
||||
@@ -777,6 +784,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);
|
||||
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
// Type definitions for jschannel 1.0
|
||||
// Project: https://github.com/yochannah/jschannel
|
||||
// Definitions by: Yitzchok Gottlieb <https://github.com/yitzchok>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
export as namespace Channel;
|
||||
|
||||
export function build(config: ChannelConfiguration): MessagingChannel;
|
||||
|
||||
export interface MessagingChannel {
|
||||
unbind: (method: string, doNotPublish?: boolean) => boolean;
|
||||
bind: (method: string, callback?: (transaction: MessageTransaction, params: any) => void, doNotPublish?: boolean) => MessagingChannel;
|
||||
call: (message: Message) => void;
|
||||
notify: (message: Message) => void;
|
||||
destroy: () => void;
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
method: string;
|
||||
success?: (result: any) => void;
|
||||
params?: any;
|
||||
timeout?: number;
|
||||
error?: (error: any, message: string) => void;
|
||||
}
|
||||
|
||||
export interface ChannelConfiguration {
|
||||
window: any;
|
||||
origin: string;
|
||||
scope: string;
|
||||
debugOutput?: boolean;
|
||||
postMessageObserver?: (origin: string, message: Message) => void;
|
||||
gotMessageObserver?: (origin: string, message: Message) => void;
|
||||
onReady?: (channel: MessagingChannel) => void;
|
||||
reconnect?: boolean;
|
||||
publish?: boolean;
|
||||
remote?: string | ReadonlyArray<string>;
|
||||
}
|
||||
|
||||
export interface MessageTransaction {
|
||||
delayReturn: (delay: boolean) => boolean;
|
||||
complete: (result: any) => void;
|
||||
error: (error: any, message: string) => void;
|
||||
invoke: (callbackName: string, params: any) => void;
|
||||
completed: () => boolean;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { build } from 'jschannel';
|
||||
|
||||
build({ window: null, origin: "*", scope: "testScope"});
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
@@ -18,6 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"commander-tests.ts"
|
||||
"jschannel-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+276
-3
@@ -1,10 +1,10 @@
|
||||
// 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 <https://github.com/bcherny>
|
||||
// Definitions by: Boris Cherny <https://github.com/bcherny>, Cyrille Tuzi <https://github.com/cyrilletuzi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node"/>
|
||||
/* JSON Schema 4 */
|
||||
|
||||
/**
|
||||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
|
||||
@@ -198,3 +198,276 @@ export interface JSONSchema4 {
|
||||
*/
|
||||
[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[]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName } from 'json-schema'
|
||||
import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName, JSONSchema6, JSONSchema6Type, JSONSchema6TypeName } from 'json-schema'
|
||||
|
||||
/* JSON Schema 4 */
|
||||
|
||||
// SimpleType
|
||||
() => {
|
||||
@@ -56,7 +58,7 @@ import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName } from 'json-schema'
|
||||
baz: { type: 'integer' }
|
||||
},
|
||||
enum: ['foo', 42],
|
||||
type: ['string', 'array'],
|
||||
type: 'string',
|
||||
allOf: [{}],
|
||||
anyOf: [{}],
|
||||
oneOf: [{}],
|
||||
@@ -65,3 +67,73 @@ import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName } from 'json-schema'
|
||||
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',
|
||||
allOf: [{}],
|
||||
anyOf: [{}],
|
||||
oneOf: [{}],
|
||||
not: {},
|
||||
const: 'foo',
|
||||
contains: {},
|
||||
examples: [{}],
|
||||
propertyNames: {}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+18
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Vendored
+1
-1
@@ -156,7 +156,7 @@ declare namespace Knex {
|
||||
delete(returning?: string | string[]): QueryBuilder;
|
||||
truncate(): QueryBuilder;
|
||||
|
||||
transacting(trx: Transaction): QueryBuilder;
|
||||
transacting(trx?: Transaction): QueryBuilder;
|
||||
connection(connection: any): QueryBuilder;
|
||||
|
||||
clone(): QueryBuilder;
|
||||
|
||||
@@ -672,6 +672,9 @@ knex.transaction<{ length: number }>(function(trx) {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
// transacting handles undefined
|
||||
knex.insert({ name: 'Old Books'}).transacting(undefined);
|
||||
|
||||
knex.schema.withSchema("public").hasTable("table") as Promise<boolean>;
|
||||
|
||||
knex.schema.createTable('users', function (table) {
|
||||
|
||||
Vendored
+1
-1
@@ -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
|
||||
|
||||
Vendored
+54
-18
@@ -1,6 +1,8 @@
|
||||
// Type definitions for Koa 2.x
|
||||
// Project: http://koajs.com
|
||||
// Definitions by: DavidCai1993 <https://github.com/DavidCai1993>, jKey Lu <https://github.com/jkeylu>
|
||||
// Definitions by: DavidCai1993 <https://github.com/DavidCai1993>
|
||||
// jKey Lu <https://github.com/jkeylu>
|
||||
// Brice Bernard <https://github.com/brikou>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -15,20 +17,22 @@
|
||||
|
||||
=============================================== */
|
||||
/// <reference types="node" />
|
||||
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
|
||||
@@ -388,7 +396,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;
|
||||
|
||||
/**
|
||||
@@ -440,15 +448,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*/
|
||||
|
||||
@@ -482,7 +511,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.
|
||||
@@ -578,7 +610,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.
|
||||
@@ -626,6 +660,8 @@ declare namespace Application {
|
||||
* Default error handling.
|
||||
*/
|
||||
onerror(err: Error): void;
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface Request extends BaseRequest {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user