emzeroit
2018-04-06 15:12:31 -03:00
346 changed files with 78421 additions and 13040 deletions

View File

@@ -1272,6 +1272,12 @@
"sourceRepoURL": "https://github.com/router5/router5",
"asOfVersion": "5.0.0"
},
{
"libraryName": "rrule",
"typingsPackageName": "rrule",
"sourceRepoURL": "https://github.com/jakubroztocil/rrule",
"asOfVersion": "2.2.9"
},
{
"libraryName": "rvo2",
"typingsPackageName": "rvo2",

View File

@@ -1,6 +1,7 @@
import * as express from 'express';
import { BasicCard, Carousel, ImageDisplays, List, OptionItem, RichResponse } from './response-builder';
import { BasicCard, BrowseCarousel, BrowseItem, Carousel, ImageDisplays, List, MediaObject,
MediaResponse, MediaValues, OptionItem, RichResponse, SimpleResponse } from './response-builder';
import { ActionPaymentTransactionConfig, Cart, GooglePaymentTransactionConfig, LineItem,
Location, Order, OrderUpdate, TransactionDecision, TransactionValues } from './transactions';
@@ -30,6 +31,8 @@ export enum StandardIntents {
DELIVERY_ADDRESS,
/** App fires TRANSACTION_DECISION intent when action asks for transaction decision. */
TRANSACTION_DECISION,
/** App fires PLACE intent when action asks for place. */
PLACE,
/** App fires CONFIRMATION intent when requesting affirmation from user. */
CONFIRMATION,
/** App fires DATETIME intent when requesting date/time from user. */
@@ -45,7 +48,11 @@ export enum StandardIntents {
/** App fires REGISTER_UPDATE intent when requesting user to register for proactive updates. */
REGISTER_UPDATE,
/** App receives CONFIGURE_UPDATES intent to indicate a REGISTER_UPDATE intent should be sent. */
CONFIGURE_UPDATES
CONFIGURE_UPDATES,
/** App fires LINK intent to request user to open to link. */
LINK,
/** App receives MEDIA_STATUS intent when the MediaResponse status is updated from user. */
MEDIA_STATUS
}
/**
@@ -101,6 +108,10 @@ export enum BuiltInArgNames {
* Transactions decision argument.
*/
TRANSACTION_DECISION_VALUE,
/**
* Place value argument.
*/
PLACE,
/**
* Confirmation argument.
*/
@@ -126,7 +137,11 @@ export enum BuiltInArgNames {
*/
NEW_SURFACE,
/** Update registration value argument. */
REGISTER_UPDATE
REGISTER_UPDATE,
/** Link request result argument. */
LINK,
/** MediaStatus value argument. */
MEDIA_STATUS
}
/**
@@ -173,6 +188,14 @@ export enum SurfaceCapabilities {
* The ability to output on a screen
*/
SCREEN_OUTPUT,
/**
* The ability to output a MediaResponse
*/
MEDIA_RESPONSE_AUDIO,
/**
* The ability to open a web URL
*/
WEB_BROWSER
}
/**
@@ -223,6 +246,18 @@ export enum SignInStatus {
ERROR
}
/**
* SKU (Stock Keeping Units) types for Play Package Entitlements.
*/
export enum EntitlementSkuTypes {
/** In app purchase */
IN_APP,
/** In app subscription */
SUBSCRIPTION,
/** Paid app. */
APP
}
/**
* Possible update trigger time context frequencies.
*/
@@ -259,10 +294,15 @@ export interface UserName {
familyName: string;
}
export interface LocationCoordinates {
latitude: number;
longitude: number;
}
/**
* User's permissioned device location.
* Location information.
*/
export interface DeviceLocation {
export interface Location {
/** Coordinates: {latitude, longitude}. Requested with SupportedPermissions.DEVICE_PRECISE_LOCATION. */
coordinates: Coordinates;
/** Full, formatted street address. Requested with SupportedPermissions.DEVICE_PRECISE_LOCATION. */
@@ -273,6 +313,22 @@ export interface DeviceLocation {
city: string;
}
/**
* User's permissioned device location.
*/
export type DeviceLocation = Location;
/**
* Place information.
*/
export interface Place extends Location {
/**
* Used with Places API to fetch details of a place.
* See {@link https://developers.google.com/places/web-service/place-id}
*/
placeId: string;
}
/**
* Coordinates containing latitude and longitude
*/
@@ -309,6 +365,33 @@ export interface User {
userStorage: string;
}
/**
* Google Play Android App Package Entitlements.
*/
export interface PackageEntitlement {
/** Name of the Android app package. */
packageName: string;
/** List of entitlements for a given app. */
entitlements: Entitlement[];
}
/**
* A user's digital entitlement.
*/
export interface Entitlement {
/** Product SKU. Matches getSku() in Google Play InApp Billing API. */
sku: string;
/** The type of SKU. One of EntitlementSkuType. */
skuType: string;
/** For in app purchases/subscriptions, relevant details. */
inAppDetails: {
/** JSON data of the in app purchase. */
inAppPurchaseData: object;
/** Matches IN_APP_DATA_SIGNATURE from getPurchases() method in Play InApp Billing API. */
inAppDataSignature: object;
};
}
/**
* Actions on Google Surface.
*/
@@ -437,6 +520,16 @@ export class AssistantApp {
*/
readonly Transactions: typeof TransactionValues;
/**
* Values related to supporting {@link Media}.
*/
readonly Media: typeof MediaValues;
/**
* SKU (Stock Keeping Units) types for Play Package Entitlements.
*/
readonly EntitlementSkuTypes: typeof EntitlementSkuTypes;
/**
* Possible update trigger time context frequencies.
*/
@@ -923,6 +1016,80 @@ export class AssistantApp {
*/
askForDeliveryAddress(reason: string, dialogState?: object): express.Response | null;
/**
* Asks user to provide a geo-located place, possibly using contextual information,
* like a store near the user's location or a contact's address.
*
* Developer provides custom text prompts to tailor the request handled by Google.
*
* @example
* // For DialogflowApp:
*
* // Dialogflow Actions
* const Actions = {
* WELCOME: 'input.welcome',
* PLACE: 'get.place' // Create Dialogflow Action with actions_intent_PLACE event
* };
*
* const app = new DialogflowApp({request, response});
*
* function handleWelcome (app) {
* const requestPrompt = 'Where do you want to get picked up?';
* const permissionContext = 'To find a place to pick you up';
* app.askForPlace(requestPrompt, permissionContext);
* }
*
* function handlePlace (app) {
* const place = app.getPlace();
* if (place) {
* app.tell(`Ah, I see. You want to get picked up at ${place.address}`);
* } else {
* app.tell(`Sorry, I couldn't find where you want to get picked up`);
* }
* }
*
* const actionMap = new Map();
* actionMap.set(Actions.WELCOME, handleWelcome);
* actionMap.set(Actions.PLACE, handlePlace);
* app.handleRequest(actionMap);
*
* // For ActionsSdkApp:
* const app = new ActionsSdkApp({ request, response });
*
* function handleWelcome (app) {
* const requestPrompt = 'Where do you want to get picked up?';
* const permissionContext = 'To find a place to pick you up';
* app.askForPlace(requestPrompt, permissionContext);
* }
*
* function handlePlace (app) {
* const place = app.getPlace();
* if (place) {
* app.tell(`Ah, I see. You want to get picked up at ${place.address}`);
* } else {
* app.tell(`Sorry, I couldn't find where you want to get picked up`);
* }
* }
*
* const actionsMap = new Map();
* actionsMap.set(app.StandardIntents.MAIN, handleWelcome);
* actionsMap.set(app.StandardIntents.PLACE, handlePlace);
* app.handleRequest(actionsMap);
*
* @param requestPrompt This is the initial response by location sub-dialog.
* For example: "Where do you want to get picked up?"
* @param permissionContext This is the context for seeking permissions.
* For example: "To find a place to pick you up"
* Prompt to user: "*To find a place to pick you up*, I just need to check your location.
* Can I get that from Google?".
* @param dialogState JSON object the app uses to hold dialog state that
* will be circulated back by Assistant.
* @return HTTP response.
* @actionssdk
* @dialogflow
*/
askForPlace(requestPrompt: string, permissionContext: string, dialogState?: object): express.Response | null;
/**
* Asks user for a confirmation.
*
@@ -1131,6 +1298,72 @@ export class AssistantApp {
*/
askToRegisterDailyUpdate(intent: string, intentArguments: IntentArgument[], dialogState?: object): express.Response | null;
/**
* Requests the user to transfer to a linked out Android app intent. Using this feature
* requires verifying the linked app in the (Actions console)[console.actions.google.com].
*
* @example
* // For DialogflowApp:
*
* // Dialogflow Actions
* const WELCOME_ACTION = 'input.welcome';
* const HANDLE_LINK = 'handle.link'; // Create Dialogflow Action with actions_intent_LINK event
*
* const app = new DialogflowApp({ request, response });
*
* console.log('Request headers: ' + JSON.stringify(request.headers));
* console.log('Request body: ' + JSON.stringify(request.body));
*
* function requestLink (app) {
* app.askToDeepLink('Great! Looks like we can do that in the app.', 'Google',
* 'example://gizmos', 'com.example.gizmos', 'handle this for you');
* }
*
* function handleLink (app) {
* const linkStatus = app.getLinkStatus();
* app.tell('Okay maybe we can take care of that another time.');
* }
*
* const actionMap = new Map();
* actionMap.set(WELCOME_ACTION, requestLink);
* actionMap.set(HANDLE_LINK, handleLink);
* app.handleRequest(actionMap);
*
* // For ActionsSdkApp
* const app = new ActionsSdkApp({ request, response });
*
* console.log('Request headers: ' + JSON.stringify(request.headers));
* console.log('Request body: ' + JSON.stringify(request.body));
*
* function requestLink (app) {
* app.askToDeepLink('Great! Looks like we can do that in the app.', 'Google',
* 'example://gizmos', 'com.example.gizmos', 'handle this for you.');
* }
*
* function handleLink (app) {
* const linkStatus = app.getLinkStatus();
* app.tell('Okay maybe we can take care of that another time.');
* }
*
* const actionMap = new Map();
* actionMap.set(app.StandardIntents.MAIN, requestLink);
* actionMap.set(app.StandardIntents.LINK, handleLink);
* app.handleRequest(actionMap);
*
* @param prompt A simple response to prepend to the link request.
* @param destinationName The name of the link destination.
* @param url URL of Android deep link.
* @param packageName Android app package name to which to link.
* @param reason The reason to transfer the user. This may be appended to a
* Google-specified prompt.
* @param dialogState JSON object the app uses to hold dialog state that
* will be circulated back by Assistant. Used in {@link ActionsSdkApp}.
* @return HTTP response.
* @dialogflow
* @actionssdk
*/
askToDeepLink(prompt: string | SimpleResponse | null, destinationName: string, url: string, packageName: string, reason?: string | null, dialogState?: object): express.Response | null;
/**
* Gets the {@link User} object.
* The user object contains information about the user, including
@@ -1209,6 +1442,20 @@ export class AssistantApp {
*/
getLastSeen(): Date | null;
/**
* Get the the list of all digital goods that your user purchased from
* your published Android apps. To enable this feature, see the instructions
* in the (documentation)[https://developers.google.com/actions/identity/digital-goods].
*
* @example
* const app = new DialogflowApp({request, response});
* const packageEntitlements = app.getPackageEntitlements();
*
* @return The list of digital goods purchased by the user in
* any verified Android app package. Null if no Package Entitlements present in the request.
*/
getPackageEntitlements(): PackageEntitlement[] | null;
/**
* If granted permission to device's location in previous intent, returns device's
* location (see {@link AssistantApp#askForPermissions|askForPermissions}).
@@ -1273,6 +1520,15 @@ export class AssistantApp {
*/
getTransactionDecision(): TransactionDecision;
/**
* Gets the user provided place. Use after askForPlace.
*
* @return Place information given by the user. Null if no place given.
* @dialogflow
* @actionssdk
*/
getPlace(): Place | null;
/**
* Gets confirmation decision. Use after askForConfirmation.
*
@@ -1304,6 +1560,31 @@ export class AssistantApp {
*/
getSignInStatus(): string;
/**
* Get status of MEDIA_STATUS intent.
*
* @example
* const app = new DialogflowApp({request: request, response: response});
*
* function mediaStatusIntent (app) {
* const status = app.getMediaStatus();
* if (status === app.Media.Status.FINISHED) {
* app.tell('Oh, I see you are done playing the media!');
* } else {
* app.tell(`I don't understand the current media status: ${status}`);
* }
* }
*
* const actionMap = new Map();
* actionMap.set(app.StandardIntents.MEDIA_STATUS, mediaStatusIntent);
* app.handleRequest(actionMap);
*
* @return Result of media status intent.
* @dialogflow
* @actionssdk
*/
getMediaStatus(): MediaValues.Status | null;
/**
* Returns true if user device has a given surface capability.
*
@@ -1464,6 +1745,16 @@ export class AssistantApp {
*/
isUpdateRegistered(): boolean;
/**
* Returns the status of a link request. Used with
* {@link AssistantApp#askToDeepLink}
*
* @return The status code of the request to link.
* @dialogflow
* @actionssdk
*/
getLinkStatus(): number;
// ---------------------------------------------------------------------------
// Response Builders
// ---------------------------------------------------------------------------
@@ -1500,6 +1791,13 @@ export class AssistantApp {
*/
buildCarousel(): Carousel;
/**
* Constructs a Browse Carousel with chainable property setters.
*
* @return Constructed Browse Carousel.
*/
buildBrowseCarousel(): BrowseCarousel;
/**
* Constructs OptionItem with chainable property setters.
*
@@ -1512,6 +1810,15 @@ export class AssistantApp {
*/
buildOptionItem(key?: string, synonyms?: string | string[]): OptionItem;
/**
* Constructs BrowseItem for the Browse Carousel with chainable property setters.
*
* @param title The displayed title of the Browse Carousel card.
* @param url The URL linked to by clicking the card.
* @return Constructed BrowseItem.
*/
buildBrowseItem(title?: string, url?: string): BrowseItem;
// ---------------------------------------------------------------------------
// Transaction Builders
// ---------------------------------------------------------------------------
@@ -1552,4 +1859,24 @@ export class AssistantApp {
* @return Constructed OrderUpdate.
*/
buildOrderUpdate(orderId: string, isGoogleOrderId: boolean): OrderUpdate;
// ---------------------------------------------------------------------------
// Media Builders
// ---------------------------------------------------------------------------
/**
* Constructs Media Response with chainable property setters.
*
* @return Constructed Media Response.
*/
buildMediaResponse(): MediaResponse;
/**
* Constructs MediaObject with chainable property setters.
*
* @param name Name of media file.
* @param contentUrl Location of media file.
* @return Constructed MediaObject.
*/
buildMediaObject(name: string, contentUrl: string): MediaObject;
}

View File

@@ -1,4 +1,4 @@
// Type definitions for actions-on-google 1.8
// Type definitions for actions-on-google 1.10
// Project: https://github.com/actions-on-google/actions-on-google-nodejs
// Definitions by: Joel Hegg <https://github.com/joelhegg>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@@ -27,6 +27,53 @@ export enum ImageDisplays {
CROPPED
}
/**
* Values related to supporting media.
*/
export namespace MediaValues {
/**
* Type of the media within a MediaResponse.
*/
enum Type {
/**
* Unspecified.
*/
MEDIA_TYPE_UNSPECIFIED,
/**
* Audio stream.
*/
AUDIO
}
/**
* List of media control status' returned.
*/
enum Status {
/**
* Unspecified.
*/
UNSPECIFIED,
/**
* Finished.
*/
FINISHED
}
/**
* List of possible item types.
*/
enum ImageType {
/**
* Icon.
*/
ICON,
/**
* Large image.
*/
LARGE
}
}
/**
* Simple Response type.
*/
@@ -155,6 +202,22 @@ export class RichResponse {
*/
addBasicCard(basicCard: BasicCard): RichResponse;
/**
* Adds media to this response.
*
* @param mediaResponse MediaResponse to include in response.
* @return Returns current constructed RichResponse.
*/
addMediaResponse(mediaResponse: MediaResponse): RichResponse;
/**
* Adds a Browse Carousel to list of items.
*
* @param browseCarousel Browse Carousel to present to user
* @return Returns current constructed RichResponse.
*/
addBrowseCarousel(browseCarousel: string | BrowseCarousel): RichResponse;
/**
* Adds a single suggestion or list of suggestions to list of items.
*
@@ -325,6 +388,43 @@ export class List {
addItems(optionItems: OptionItem | OptionItem[]): List;
}
/**
* Class for initializing and constructing BrowseCarousel with chainable interface.
*/
export class BrowseCarousel {
/**
* Constructor for BrowseCarousel. Accepts optional BrowseCarousel to
* clone or list of items to copy.
*
* @param carousel Either a carousel to clone
* or an array of BrowseItem to initialize a new carousel
*/
constructor(carousel?: BrowseCarousel | BrowseItem[]);
/**
* List of 2-20 items to show in this carousel. Required.
*/
items: BrowseItem[];
/**
* Adds a single item or list of items to the carousel.
*
* @param browseItems BrowseItems to add.
* @return Returns current constructed BrowseCarousel.
*/
addItems(browseItems: BrowseItem | BrowseItem[]): BrowseCarousel;
/**
* Sets the display options for the images in this carousel.
* Use one of the image display constants. If none is chosen,
* ImageDisplays.DEFAULT will be enforced.
*
* @param option The option for displaying the image.
* @return Returns current constructed BrowseCarousel.
*/
setImageDisplay(option: ImageDisplays): BrowseCarousel;
}
/**
* Class for initializing and constructing Carousel with chainable interface.
*/
@@ -350,6 +450,120 @@ export class Carousel {
* @return Returns current constructed Carousel.
*/
addItems(optionItems: OptionItem | OptionItem[]): Carousel;
/**
* Sets the display options for the images in this carousel.
* Use one of the image display constants. If none is chosen,
* ImageDisplays.DEFAULT will be enforced.
*
* @param option The option for displaying the image.
* @return Returns current constructed Carousel.
*/
setImageDisplay(option: ImageDisplays): Carousel;
}
/**
* Class for initializing and constructing Option Items with chainable interface.
*/
export class BrowseItem {
/**
* Constructor for BrowseItem. Accepts a title and URL for the Browse Item
* card.
*
* @param title The title of the Browse Item card.
* @param url The URL of the link opened by clicking the Browse Item card.
*/
constructor(title?: string, url?: string);
/**
* Title of the browse item. Required.
*/
title: string;
/**
* Description text of the item. Optional.
*/
description?: string;
/**
* Footer text of the item. Optional.
*/
footer?: string;
/**
* Image to show on item. Optional.
*/
image?: Image;
/**
* Url to that clicking the card opens. Optional.
*/
openUrlAction?: object;
/**
* @return Returns the possible valid values for URL type hints
*/
urlTypeHints(): object;
/**
* Sets the title for this Browse Item.
*
* @param title Title to show on item.
* @return Returns current constructed BrowseItem.
*/
setTitle(title: string): BrowseItem;
/**
* Sets the description for this Browse Item.
*
* @param description Description to show on item.
* @return Returns current constructed BrowseItem.
*/
setDescription(description: string): BrowseItem;
/**
* Sets the footer for this Browse Item.
*
* @param footerText text to show on item.
* @return Returns current constructed BrowseItem.
*/
setFooter(footerText: string): BrowseItem;
/**
* Sets the image for this Browse Item.
*
* @param url Image source URL.
* @param accessibilityText Text to replace for image for accessibility.
* @param width Width of the image.
* @param height Height of the image.
* @return Returns current constructed BrowseItem.
*/
setImage(url: string, accessibilityText: string, width?: number, height?: number): BrowseItem;
/**
* Sets the Open URL action - which includes the url and possibly the typeHint
*
* @param url Image source URL.
* @param urlTypeHint One of the typeHints enumerated by this.urlTypeHints()
* @return Returns the current constructed BrowseItem
*/
setOpenUrlAction(url: string, urlTypeHint?: string): BrowseItem;
/**
* Sets the URL target of the BrowseItem card
*
* @param url Image source URL.
* @return Returns the current constructed BrowseItem
*/
setUrl(url: string): BrowseItem;
/**
* Sets the URL type hint for the BrowseItem card
*
* @param urlTypeHint One of the typeHints enumerated by this.urlTypeHints()
* @return Returns the current constructed BrowseItem
*/
setUrlTypeHint(urlTypeHint: string): BrowseItem;
}
/**
@@ -430,6 +644,90 @@ export class OptionItem {
addSynonyms(synonyms: string | string[]): OptionItem;
}
/**
* Class for initializing and constructing MediaResponse with chainable interface.
*/
export class MediaResponse {
/**
* Constructor for MediaResponse.
* @param mediaType Type of the media which defaults to MediaValues.Type.AUDIO
*/
constructor(mediaType: MediaValues.Type);
/**
* Array of MediaObject held in the MediaResponse.
*/
mediaObjects: MediaObject[];
/**
* Type of the media within this MediaResponse
*/
mediaType: MediaValues.Type;
/**
* Adds a single media file or list of media files to the cart.
*
* @param items Single or Array of MediaObject to add.
* @return Returns current constructed MediaResponse.
*/
addMediaObjects(items: MediaObject | MediaObject[]): MediaResponse;
}
/**
* Class for initializing and constructing MediaObject with chainable interface.
*/
export class MediaObject {
/**
* Constructor for MediaObject.
*
* @param name Name of the MediaObject.
* @param contentUrl URL of the MediaObject.
*/
constructor(name: string, contentUrl: string);
/**
* Name of the MediaObject.
*/
name: string;
/**
* MediaObject URL.
*/
contentUrl: string;
/**
* Description of the MediaObject.
*/
description?: string;
/**
* Large image.
*/
largeImage?: Image;
/**
* Icon image.
*/
icon?: Image;
/**
* Set the description of the item.
*
* @param description Description of the item.
* @return Returns current constructed MediaObject.
*/
setDescription(description: string): MediaObject;
/**
* Sets the image for this item.
*
* @param url Image source URL.
* @param type Type of image (LARGE or ICON).
* @return Returns current constructed MediaObject.
*/
setImage(url: string, type: MediaValues.ImageType): MediaObject;
}
/**
* Check if given text contains SSML.
* @param text Text to check.

View File

@@ -5,8 +5,8 @@ var mongoConnectionString = "mongodb://127.0.0.1/agenda";
var agenda = new Agenda({ db: { address: mongoConnectionString } });
agenda.define('delete old users', (job, done) => {
agenda.define<{ foo: Error }>('delete old users', (job, done) => {
done(job.attrs.data.foo)
});
agenda.on('ready', () => {
@@ -62,7 +62,7 @@ agenda.schedule('tomorrow at noon', ['printAnalyticsReport', 'sendNotifications'
agenda.now('do the hokey pokey');
var job = agenda.create('printAnalyticsReport', { userCount: 100 });
var job = agenda.create<{ userCount: number }>('printAnalyticsReport', { userCount: 100 });
job.save(function(err) {
console.log("Job successfully saved");
});

View File

@@ -1,6 +1,7 @@
// Type definitions for Agenda v1.0.0
// Project: https://github.com/rschmukler/agenda
// Type definitions for Agenda v1.0.3
// Project: https://github.com/agenda/agenda
// Definitions by: Meir Gottlieb <https://github.com/meirgottlieb>
// Jeff Principe <https://github.com/princjef>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -89,14 +90,14 @@ declare class Agenda extends EventEmitter {
* @param name The name of the job.
* @param data Data to associated with the job.
*/
create(name: string, data?: any): Agenda.Job;
create<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, data?: T): Agenda.Job<T>;
/**
* Find all Jobs matching `query` and pass same back in cb().
* @param query
* @param cb
*/
jobs(query: any, cb: ResultCallback<Agenda.Job[]>): void;
jobs<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(query: any, cb: ResultCallback<Agenda.Job<T>[]>): void;
/**
* Removes all jobs in the database without defined behaviors. Useful if you change a definition name and want
@@ -113,8 +114,8 @@ declare class Agenda extends EventEmitter {
* @param options The options for the job.
* @param handler The handler to execute.
*/
define(name: string, handler: (job: Agenda.Job, done: (err?: Error) => void) => void): void;
define(name: string, options: Agenda.JobOptions, handler: (job: Agenda.Job, done: (err?: Error) => void) => void): void;
define<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, handler: (job: Agenda.Job<T>, done: (err?: Error) => void) => void): void;
define<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, options: Agenda.JobOptions, handler: (job: Agenda.Job<T>, done: (err?: Error) => void) => void): void;
/**
* Runs job name at the given interval. Optionally, data and options can be passed in.
@@ -124,8 +125,8 @@ declare class Agenda extends EventEmitter {
* @param options An optional argument that will be passed to job.repeatEvery.
* @param cb An optional callback function which will be called when the job has been persisted in the database.
*/
every(interval: number | string, names: string, data?: any, options?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
every(interval: number | string, names: string[], data?: any, options?: any, cb?: ResultCallback<Agenda.Job[]>): Agenda.Job[];
every<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(interval: number | string, names: string, data?: T, options?: any, cb?: ResultCallback<Agenda.Job<T>>): Agenda.Job<T>;
every<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(interval: number | string, names: string[], data?: T, options?: any, cb?: ResultCallback<Agenda.Job<T>[]>): Agenda.Job<T>[];
/**
* Schedules a job to run name once at a given time.
@@ -134,8 +135,8 @@ declare class Agenda extends EventEmitter {
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
* @param cb An optional callback function which will be called when the job has been persisted in the database.
*/
schedule(when: Date | string, names: string, data?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
schedule(when: Date | string, names: string[], data?: any, cb?: ResultCallback<Agenda.Job[]>): Agenda.Job[];
schedule<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(when: Date | string, names: string, data?: T, cb?: ResultCallback<Agenda.Job<T>>): Agenda.Job<T>;
schedule<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(when: Date | string, names: string[], data?: T, cb?: ResultCallback<Agenda.Job<T>[]>): Agenda.Job<T>[];
/**
* Schedules a job to run name once immediately.
@@ -143,7 +144,7 @@ declare class Agenda extends EventEmitter {
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
* @param cb An optional callback function which will be called when the job has been persisted in the database.
*/
now(name: string, data?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
now<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, data?: T, cb?: ResultCallback<Agenda.Job<T>>): Agenda.Job<T>;
/**
* Cancels any jobs matching the passed mongodb-native query, and removes them from the database.
@@ -242,10 +243,14 @@ declare namespace Agenda {
}
}
interface JobAttributesData {
[key: string]: any;
}
/**
* The database record associated with a job.
*/
interface JobAttributes {
interface JobAttributes<T extends JobAttributesData = JobAttributesData> {
/**
* The record identity.
*/
@@ -264,7 +269,7 @@ declare namespace Agenda {
/**
* The job details.
*/
data: { [name: string]: any };
data: T;
/**
* The priority of the job.
@@ -330,12 +335,12 @@ declare namespace Agenda {
/**
* A scheduled job.
*/
interface Job {
interface Job<T extends JobAttributesData = JobAttributesData> {
/**
* The database record associated with the job.
*/
attrs: JobAttributes;
attrs: JobAttributes<T>;
/**
* The agenda that created the job.
@@ -348,54 +353,54 @@ declare namespace Agenda {
* @param options An optional argument that can include a timezone field. The timezone should be a string as
* accepted by moment-timezone and is considered when using an interval in the cron string format.
*/
repeatEvery(interval: string | number, options?: { timezone?: string }): Job
repeatEvery(interval: string | number, options?: { timezone?: string }): Job<T>
/**
* Specifies a time when the job should repeat. [Possible values](https://github.com/matthewmueller/date#examples).
* @param time
*/
repeatAt(time: string): Job
repeatAt(time: string): Job<T>
/**
* Disables the job.
*/
disable(): Job;
disable(): Job<T>;
/**
* Enables the job.
*/
enable(): Job;
enable(): Job<T>;
/**
* Ensure that only one instance of this job exists with the specified properties
* @param value The properties associated with the job that must be unqiue.
* @param opts
*/
unique(value: any, opts?: { insertOnly?: boolean }): Job;
unique(value: any, opts?: { insertOnly?: boolean }): Job<T>;
/**
* Specifies the next time at which the job should run.
* @param time The next time at which the job should run.
*/
schedule(time: string | Date): Job;
schedule(time: string | Date): Job<T>;
/**
* Specifies the priority weighting of the job.
* @param value The priority of the job (lowest|low|normal|high|highest|number).
*/
priority(value: string | number): Job;
priority(value: string | number): Job<T>;
/**
* Sets job.attrs.failedAt to now, and sets job.attrs.failReason to reason.
* @param reason A message or Error object that indicates why the job failed.
*/
fail(reason: string | Error): Job;
fail(reason: string | Error): Job<T>;
/**
* Runs the given job and calls callback(err, job) upon completion. Normally you never need to call this manually
* @param cb Called when the job is completed.
*/
run(cb?: ResultCallback<Job>): Job;
run(cb?: ResultCallback<Job<T>>): Job<T>;
/**
* Returns true if the job is running; otherwise, returns false.
@@ -406,7 +411,7 @@ declare namespace Agenda {
* Saves the job into the database.
* @param cb Called when the job is saved.
*/
save(cb?: ResultCallback<Job>): Job;
save(cb?: ResultCallback<Job<T>>): Job<T>;
/**
* Removes the job from the database and cancels the job.
@@ -424,7 +429,7 @@ declare namespace Agenda {
/**
* Calculates next time the job should run
*/
computeNextRunAt(): Job;
computeNextRunAt(): Job<T>;
}
interface JobOptions {

View File

@@ -0,0 +1,57 @@
import Message = require('amp-message');
// $ExpectType Message
new Message(new Buffer('aaa'));
// $ExpectType Message
new Message([new Buffer('aaa'), new Buffer('bbb')]);
const message = new Message([new Buffer('aaa'), new Buffer('bbb')]);
// $ExpectType string
message.inspect();
// $ExpectType Buffer
message.toBuffer();
// $ExpectType number
message.push(new Buffer('ccc'));
// $ExpectType Buffer | undefined
message.pop();
// $ExpectType Buffer | undefined
message.shift();
// $ExpectType number
message.unshift(new Buffer('ddd'));
// $ExpectError
new Message();
// $ExpectError
new Message(1);
// $ExpectError
new Message({});
// $ExpectError
new Message('aaa');
// $ExpectError
message.push(1);
// $ExpectError
message.push({});
// $ExpectError
message.push('aaa');
// $ExpectError
message.unshift(1);
// $ExpectError
message.unshift({});
// $ExpectError
message.unshift('aaa');

25
types/amp-message/index.d.ts vendored Normal file
View File

@@ -0,0 +1,25 @@
// Type definitions for amp-message 0.1
// Project: https://github.com/visionmedia/node-amp-message
// Definitions by: Vilim Stubičan <https://github.com/jewbre>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="node" />
declare class Message {
constructor(args: Buffer | Buffer[]);
inspect(): string;
toBuffer(): Buffer;
push(...items: Buffer[]): number;
pop(): Buffer | undefined;
shift(): Buffer | undefined;
unshift(...items: Buffer[]): number;
}
export = Message;

View File

@@ -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",
"amp-message-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

44
types/amp/amp-tests.ts Normal file
View File

@@ -0,0 +1,44 @@
import { decode, encode, Stream } from 'amp';
// $ExpectType Buffer[]
decode(new Buffer('something'));
// $ExpectType Buffer
encode([new Buffer('something'), new Buffer('something')]);
// $ExpectError
decode('');
// $ExpectError
decode(1);
// $ExpectError
decode();
// $ExpectError
encode('');
// $ExpectError
encode(1);
// $ExpectError
encode();
// $ExpectType Stream
new Stream({});
// $ExpectType Stream
new Stream({
highWaterMark: 1,
decodeStrings: true,
objectMode: true,
destroy: (error?: Error) => {
return 'handle error';
},
final: (callback: (error?: Error) => void) => {
// do nothing
}
});
// $ExpectError
new Stream({somethingNoneExisting: true});

19
types/amp/index.d.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
// Type definitions for amp 0.3
// Project: https://github.com/visionmedia/node-amp
// Definitions by: Vilim Stubičan <https://github.com/jewbre>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="node" />
import * as stream from 'stream';
export function decode(buf: Buffer): Buffer[];
export function encode(args: Buffer[]): Buffer;
export class Stream extends stream.Writable {
constructor(opts: stream.WritableOptions);
_write(chunk: any, encoding: string, fn: () => void): void;
}

View File

@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
@@ -18,8 +18,6 @@
},
"files": [
"index.d.ts",
"test/rrule.ts",
"test/commonJs.ts",
"test/global.ts"
"amp-tests.ts"
]
}
}

1
types/amp/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -1,5 +1,5 @@
import * as React from "react";
import { StyleSheet, css, StyleSheetServer, StyleSheetTestUtils } from "aphrodite";
import { StyleSheet, css, StyleSheetServer, StyleSheetTestUtils, FontFamily } from "aphrodite";
const styles = StyleSheet.create({
red: {
@@ -20,7 +20,7 @@ const styles = StyleSheet.create({
}
});
const coolFont = {
const coolFont: FontFamily = {
fontFamily: "CoolFont",
fontStyle: "normal",
fontWeight: "normal",

View File

@@ -6,11 +6,25 @@
import * as React from "react";
type FontFamily =
| React.CSSProperties['fontFamily']
| Pick<React.CSSProperties,
| 'fontFamily'
| 'fontStyle'
| 'fontWeight'
| 'src'
>
/**
* Aphrodite style declaration
*/
export interface StyleDeclaration {
[key: string]: React.CSSProperties;
[key: string]: Pick<React.CSSProperties, (
& React.CSSProperties
& { fontFamily: never }
)[keyof React.CSSProperties]> & {
fontFamily?: FontFamily | FontFamily[];
};
}
interface StyleSheetStatic {

View File

@@ -1,4 +1,4 @@
import arrify = require("arrify");
import * as arrify from 'arrify';
arrify(null);
arrify<number>(null);

View File

@@ -14,4 +14,5 @@
* arrify([2, 3]) // returns [2, 3]
*/
declare function arrify<T>(val: undefined | null | T | T[]): T[];
declare namespace arrify {}
export = arrify;

View File

@@ -1,4 +1,5 @@
import { Options, RetryFunction, retry } from 'async-retry';
import { Options, RetryFunction } from 'async-retry';
import retry = require("async-retry");
const o: Options = {
retries: 1,

View File

@@ -1,17 +1,25 @@
// Type definitions for async-retry 1.1
// Type definitions for async-retry 1.2
// Project: https://github.com/zeit/async-retry#readme
// Definitions by: Albert Wu <https://github.com/albertywu>
// Pablo Rodríguez <https://github.com/MeLlamoPablo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function retry<A>(fn: RetryFunction<A>, opts: Options): Promise<A>;
declare function AsyncRetry<A>(
fn: AsyncRetry.RetryFunction<A>,
opts: AsyncRetry.Options
): Promise<A>;
export interface Options {
retries?: number;
factor?: number;
minTimeout?: number;
maxTimeout?: number;
randomize?: boolean;
onRetry?: (e: Error) => any;
declare namespace AsyncRetry {
interface Options {
retries?: number;
factor?: number;
minTimeout?: number;
maxTimeout?: number;
randomize?: boolean;
onRetry?: (e: Error) => any;
}
type RetryFunction<A> = (bail: (e: Error) => A, attempt: number) => A|Promise<A>;
}
export type RetryFunction<A> = (bail: (e: Error) => A, attempt: number) => A|Promise<A>;
export = AsyncRetry;

View File

@@ -25,7 +25,7 @@ declare namespace autobahn {
leave(reason: string, message: string): void;
call<TResult>(procedure: string, args?: any[], kwargs?: any, options?: ICallOptions): When.Promise<TResult>;
call<TResult>(procedure: string, args?: any[] | any, kwargs?: any, options?: ICallOptions): When.Promise<TResult>;
publish(topic: string, args?: any[], kwargs?: any, options?: IPublishOptions): When.Promise<IPublication>;
@@ -96,7 +96,7 @@ declare namespace autobahn {
kwargs: any;
}
type SubscribeHandler = (args?: any[], kwargs?: any, details?: IEvent) => void;
type SubscribeHandler = (args?: any[] | any, kwargs?: any, details?: IEvent) => void;
interface ISubscription {
topic: string;
@@ -206,7 +206,7 @@ declare namespace autobahn {
type DeferFactory = () => When.Promise<any>;
type OnChallengeHandler = (session: Session, method: string, extra: any) => string;
type OnChallengeHandler = (session: Session, method: string, extra: any) => string | When.Promise<string>;
interface IConnectionOptions {
use_es6_promises?: boolean;

View File

@@ -102,6 +102,12 @@ export interface BigConstructor {
export interface Big {
/** Returns a Big number whose value is the absolute value, i.e. the magnitude, of this Big number. */
abs(): Big;
/**
* Returns a Big number whose value is the value of this Big number plus n - alias for .plus().
*
* @throws `NaN` if n is invalid.
*/
add(n: BigSource): Big;
/**
* Compare the values.
*
@@ -162,6 +168,12 @@ export interface Big {
* @throws `NaN` if n is negative or otherwise invalid.
*/
mod(n: BigSource): Big;
/**
* Returns a Big number whose value is the value of this Big number times n - alias for .times().
*
* @throws `NaN` if n is invalid.
*/
mul(n: BigSource): Big;
/**
* Returns a Big number whose value is the value of this Big number plus n.
*
@@ -196,6 +208,12 @@ export interface Big {
* @throws `NaN` if this Big number is negative.
*/
sqrt(): Big;
/**
* Returns a Big number whose value is the value of this Big number minus n - alias for .minus().
*
* @throws `NaN` if n is invalid.
*/
sub(n: BigSource): Big;
/**
* Returns a Big number whose value is the value of this Big number times n.
*

View File

@@ -86,6 +86,7 @@ function minusTests() {
0.3 - 0.1; // 0.19999999999999998
const x = new Big(0.3);
x.minus(0.1); // '0.2'
x.sub(0.1); // '0.2'
}
function modTests() {
@@ -99,6 +100,7 @@ function plusTests() {
const x = new Big(0.1);
const y = x.plus(0.2); // '0.3'
Big(0.7).plus(x).plus(y); // '1'
Big(0.7).add(x).add(y); // '1'
}
function powTests() {
@@ -138,6 +140,7 @@ function timesTests() {
const x = new Big(0.6);
const y = x.times(3); // '1.8'
Big('7e+500').times(y); // '1.26e+501'
Big('7e+500').mul(y); // '1.26e+501'
}
function toExponentialTests() {

View File

@@ -88,6 +88,7 @@ function minusTests() {
0.3 - 0.1; // 0.19999999999999998
const x = new Big(0.3);
x.minus(0.1); // '0.2'
x.sub(0.1); // '0.2'
}
function modTests() {
@@ -101,6 +102,7 @@ function plusTests() {
const x = new Big(0.1);
const y = x.plus(0.2); // '0.3'
Big(0.7).plus(x).plus(y); // '1'
Big(0.7).add(x).add(y); // '1'
}
function powTests() {
@@ -140,6 +142,7 @@ function timesTests() {
const x = new Big(0.6);
const y = x.times(3); // '1.8'
Big('7e+500').times(y); // '1.26e+501'
Big('7e+500').mul(y); // '1.26e+501'
}
function toExponentialTests() {

View File

@@ -1,6 +1,7 @@
// Type definitions for cassandra-driver v3.2.2
// Type definitions for cassandra-driver v3.4.1
// Project: https://github.com/datastax/nodejs-driver
// Definitions by: Marc Fisher <https://github.com/Svjard>
// Christian D <https://github.com/pc-jedi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -115,7 +116,11 @@ export namespace policies {
interface RetryPolicyStatic {
new (): RetryPolicy;
retryDecision: any;
retryDecision: {
rethrow: number,
retry: number,
ignore: number
};
}
interface RetryPolicy {
@@ -126,15 +131,55 @@ export namespace policies {
retryResult(): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean };
}
}
namespace speculativeExecution {
let NoSpeculativeExecutionPolicy: NoSpeculativeExecutionPolicyStatic
interface SpeculativeExecutionPolicy {
init(client: Client): void;
newPlan(keyspace: string, queryInfo: string | Array<string>): {
nextExecution: Function
}
}
interface NoSpeculativeExecutionPolicyStatic {
new (): NoSpeculativeExecutionPolicy
}
interface NoSpeculativeExecutionPolicy extends SpeculativeExecutionPolicy { }
interface ConstantSpeculativeExecutionPolicyStatic {
new (delay: number, maxSpeculativeExecutions: number): ConstantSpeculativeExecutionPolicy
}
interface ConstantSpeculativeExecutionPolicy extends SpeculativeExecutionPolicy { }
}
namespace timestampGeneration {
let MonotonicTimestampGenerator: MonotonicTimestampGeneratorStatic
interface TimestampGenerator {
next(client: Client): null | number | _Long
}
interface MonotonicTimestampGeneratorStatic {
new (warningThreshold?: number, minLogInterval?: number): MonotonicTimestampGeneratorStatic
}
interface MonotonicTimestampGenerator extends TimestampGenerator {
getDate(): number
}
}
}
export namespace types {
let BigDecimal: BigDecimalStatic;
let Duration: DurationStatic;
let Long: _Long;
let InetAddress: InetAddressStatic;
let Integer: IntegerStatic;
let LocalDate: LocalDateStatic;
let LocalTime: LocalTimeStatic;
let Long: _Long;
let ResultSet: ResultSetStatic;
// let ResultStream: ResultStreamStatic;
let Row: RowStatic;
@@ -221,6 +266,19 @@ export namespace types {
toJSON(): string;
}
interface DurationStatic {
new (month: number, days: number, nanoseconds: number | _Long): Duration;
fromBuffer(buffer: Buffer): Duration;
fromString(input: string): Duration;
}
interface Duration {
equals(other: Duration): boolean;
toBuffer(): Buffer;
toString(): string;
}
interface InetAddressStatic {
new (buffer: Buffer): InetAddress;
@@ -336,13 +394,14 @@ export namespace types {
}
interface ResultSetStatic {
new (response: any, host: string, triedHost: { [key: string]: any }, consistency: consistencies): ResultSet;
new (response: any, host: string, triedHost: { [key: string]: any }, speculativeExecutions: number, consistency: consistencies): ResultSet;
}
interface ResultSet {
info: {
queriedHost: Host,
triedHosts: { [key: string]: string; },
speculativeExecutions: number,
achievedConsistency: consistencies,
traceId: Uuid,
warnings: Array<string>,
@@ -352,11 +411,13 @@ export namespace types {
rowLength: number;
columns: Array<{ [key: string]: string; }>;
pageState: string;
nextPage: any; // function
nextPage: Function;
first(): Row;
getPageState(): string;
getColumns(): Array<{ [key: string]: string; }>;
wasApplied(): boolean;
[Symbol.iterator](): Iterator<Row>;
}
interface ResultStreamStatic {
@@ -442,40 +503,50 @@ export let Encoder: EncoderStatic;
export interface ClientOptions {
contactPoints: Array<string>,
keyspace?: string,
refreshSchemaDelay?: number,
isMetadataSyncEnabled?: boolean,
prepareOnAllHosts?: boolean,
rePrepareOnUp?: boolean,
maxPrepared?: number,
policies?: {
addressResolution?: policies.addressResolution.AddressTranslator,
loadBalancing?: policies.loadBalancing.LoadBalancingPolicy,
retry?: policies.retry.RetryPolicy,
reconnection?: policies.reconnection.ReconnectionPolicy,
retry?: policies.retry.RetryPolicy
addressResolution?: policies.addressResolution.AddressTranslator,
speculativeExecution?: policies.speculativeExecution.SpeculativeExecutionPolicy,
timestampGeneration?: policies.timestampGeneration.TimestampGenerator,
},
queryOptions?: QueryOptions,
pooling?: {
heartBeatInterval: number,
coreConnectionsPerHost: { [key: number]: number; },
warmup: boolean;
heartBeatInterval?: number,
coreConnectionsPerHost?: { [key: number]: number; },
maxRequestsPerConnection?: number,
warmup?: boolean;
},
protocolOptions?: {
port: number,
maxSchemaAgreementWaitSeconds: number,
maxVersion: number
port?: number,
maxSchemaAgreementWaitSeconds?: number,
maxVersion?: number
},
socketOptions?: {
connectTimeout: number,
defunctReadTimeoutThreshold: number,
keepAlive: boolean,
keepAliveDelay: number,
readTimeout: number,
tcpNoDelay: boolean,
coalescingThreshold: number
connectTimeout?: number,
defunctReadTimeoutThreshold?: number,
keepAlive?: boolean,
keepAliveDelay?: number,
readTimeout?: number,
tcpNoDelay?: boolean,
coalescingThreshold?: number
},
authProvider?: auth.AuthProvider,
sslOptions?: tls.ConnectionOptions,
encoding?: {
map: Function,
set: Function,
copyBuffer: boolean,
useUndefinedAsUnset: boolean
}
map?: Function,
set?: Function,
copyBuffer?: boolean,
useUndefinedAsUnset?: boolean
},
profiles?: Array<ExecutionProfile>,
promiseFactory?: Function,
}
export interface QueryOptions {
@@ -483,8 +554,11 @@ export interface QueryOptions {
captureStackTrace?: boolean;
consistency?: number;
customPayload?: any;
executionProfile?: string | ExecutionProfile;
fetchSize?: number;
hints?: Array<string> | Array<Array<string>>;
isIdempotent?: boolean;
keyspace?: string;
logged?: boolean;
pageState?: Buffer | string;
prepare?: boolean;
@@ -520,6 +594,7 @@ export interface Client extends events.EventEmitter {
execute(query: string, callback: ResultCallback): void;
execute(query: string, params?: any, options?: QueryOptions): Promise<types.ResultSet>;
getReplicas(keyspace: string, token: Buffer): Array<any>; // TODO: Should this be a more explicit return?
getState(): metadata.ClientState;
shutdown(callback?: Callback): void;
shutdown(): Promise<void>;
stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): NodeJS.ReadableStream;
@@ -548,6 +623,7 @@ export interface HostMapStatic {
export interface HostMap extends events.EventEmitter {
length: number;
clear(): Array<Host>;
forEach(callback: Callback): void;
get(key: string): Host;
keys(): Array<string>;
@@ -566,6 +642,22 @@ export interface Encoder {
encode(value: any, typeInfo?: string | number | { code: number, info?: any }): Buffer;
}
interface ExecutionProfileOptions {
consistency: number,
loadBalancing: policies.loadBalancing.LoadBalancingPolicy,
name: string,
readTimeout: number,
retry: policies.retry.RetryPolicy,
serialConsistency: number
}
export interface ExecutionProfileStatic {
new (name: string, options: ExecutionProfileOptions): ExecutionProfile
}
export interface ExecutionProfile extends ExecutionProfileOptions {
}
export namespace auth {
let Authenticator: AuthenticatorStatic;
let PlainTextAuthProvider: PlainTextAuthProviderStatic;
@@ -649,6 +741,17 @@ export namespace metadata {
stateFunction: string;
stateType: string;
}
interface ClientStateStatic {
new (): ClientState;
}
interface ClientState {
getConnectedHosts(): Array<Host>;
getInFlightQueries(host: Host): number;
getOpenConnections(host: Host): number;
toString(): string;
}
interface DataTypeInfo {
code: number,

View File

@@ -506,3 +506,9 @@ function test_editor_instance_event() {
}
});
}
function test_dtd() {
var brConsideredEmptyTag = CKEDITOR.dtd.$empty["br"];
var spanCanContainText = CKEDITOR.dtd["span"]["#"];
var divCanContainSpan = CKEDITOR.dtd["div"]["span"];
}

View File

@@ -24,8 +24,8 @@ declare namespace CKEDITOR {
var DIALOG_RESIZE_HEIGHT: number;
var DIALOG_RESIZE_NONE: number;
var DIALOG_RESIZE_WIDTH: number;
var DIALOG_STATE_IDLE: number;
var DIALOG_STATE_BUSY: number;
var DIALOG_STATE_IDLE: number;
var DIALOG_STATE_BUSY: number;
var ELEMENT_MODE_APPENDTO: number;
var ELEMENT_MODE_INLINE: number;
var ELEMENT_MODE_NONE: number;
@@ -44,10 +44,10 @@ declare namespace CKEDITOR {
var NODE_DOCUMENT_FRAGMENT: number;
var NODE_ELEMENT: number;
var NODE_TEXT: number;
var POSITION_BEFORE_START: number;
var POSITION_BEFORE_END: number;
var POSITION_AFTER_START: number;
var POSITION_AFTER_END: number;
var POSITION_BEFORE_START: number;
var POSITION_BEFORE_END: number;
var POSITION_AFTER_START: number;
var POSITION_AFTER_END: number;
var SELECTION_ELEMENT: number;
var SELECTION_NONE: number;
var SELECTION_TEXT: number;
@@ -55,9 +55,9 @@ declare namespace CKEDITOR {
var SHRINK_ELEMENT: number;
var SHRINK_TEXT: number;
var START: number;
var STYLE_BLOCK: string;
var STYLE_INLINE: string;
var STYLE_OBJECT: string;
var STYLE_BLOCK: string;
var STYLE_INLINE: string;
var STYLE_OBJECT: string;
var TRISTATE_DISABLED: number;
var TRISTATE_OFF: number;
var TRISTATE_ON: number;
@@ -288,7 +288,7 @@ declare namespace CKEDITOR {
class elementPath {
constructor(startNode: element, root: element);
constructor(startNode: element);
constructor(startNode: element);
block: element;
blockLimit: element;
root: element;
@@ -342,7 +342,7 @@ declare namespace CKEDITOR {
setStartAt(node: node, position: number): void;
setEndAt(node: node, position: number): void;
fixBlock(isStart: boolean, blockTag: Object): Object;
select(): selection;
select(): selection;
splitBlock(blockTag: Object): Object;
splitElement(toSplit: element): element;
removeEmptyBlocksAtEnd(atEnd: boolean): void;
@@ -836,7 +836,7 @@ declare namespace CKEDITOR {
templates_files?: Object;
templates_replaceContent?: boolean;
title?: string | boolean;
toolbar?: string | (string | string[] | { name: string, items?: string[], groups?: string[] })[] | null;
toolbar?: string | (string | string[] | { name: string, items?: string[], groups?: string[] })[] | null;
toolbarCanCollapse?: boolean;
toolbarGroupCycling?: boolean;
toolbarGroups?: (toolbarGroups | string)[];
@@ -869,19 +869,19 @@ declare namespace CKEDITOR {
}
module skin {
var icons: { [name: string]: { path: string } };
function addIcon(name: string, path: string, offset?: number, bgsize?: string): void;
}
var icons: { [name: string]: { path: string } };
function addIcon(name: string, path: string, offset?: number, bgsize?: string): void;
}
class style {
constructor(something: { element: string, attributes: { [att: string]: string } });
applyToRange(range: Range, editor: editor): void;
}
constructor(something: { element: string, attributes: { [att: string]: string } });
applyToRange(range: Range, editor: editor): void;
}
interface editable extends dom.element {
hasFocus: boolean;
attachListener(obj: event | editable, eventName: string, listenerFunction: (ei: eventInfo) => void,
scopeobj?: {}, listenerData?: any, priority?: number): listenerRegistration;
hasFocus: boolean;
attachListener(obj: event | editable, eventName: string, listenerFunction: (ei: eventInfo) => void,
scopeobj?: {}, listenerData?: any, priority?: number): listenerRegistration;
}
@@ -978,7 +978,7 @@ declare namespace CKEDITOR {
destroy(widget: CKEDITOR.plugins.widget, offline?: boolean): void;
destroyAll(offline?: boolean): void;
finalizeCreation(container: any): void;
focused: widget;
focused: widget;
fire(eventName: string, data: Object, editor: editor): any; // should be boolean | Object
getByElement(element: any, checkWrapperOnly: boolean): CKEDITOR.plugins.widget;
hasListeners(eventName: string): boolean;
@@ -1089,7 +1089,7 @@ declare namespace CKEDITOR {
interface IMenuItemDefinition {
label:string,
command:string,
icon: string
icon: string
group:string,
order:number
}
@@ -1142,7 +1142,7 @@ declare namespace CKEDITOR {
createFakeParserElement(realElement: Object, className: Object, realElementType: Object, isResizable: Object): void;
createRange(): dom.range;
destroy(noUpdate?: boolean): void;
editable(): editable | null;
editable(): editable | null;
editable(elementOrEditable: dom.element): void;
editable(elementOrEditable: editable): void;
elementPath(startNode?: dom.node): dom.elementPath;
@@ -1300,14 +1300,14 @@ declare namespace CKEDITOR {
stop(): void;
}
module filter {
interface allowedContentRules {
module filter {
interface allowedContentRules {
}
}
}
}
class filter {
allow(newRules: CKEDITOR.filter.allowedContentRules, featureName?: string, overrideCustom?: boolean): boolean;
allow(newRules: CKEDITOR.filter.allowedContentRules, featureName?: string, overrideCustom?: boolean): boolean;
}
@@ -1370,10 +1370,28 @@ declare namespace CKEDITOR {
}
class dtd {
interface dtdDefinition {
[outerTagName: string]: {[innerTagName: string]: 1};
$block: {[tagName: string]: 1};
$blockLimit: {[tagName: string]: 1};
$cdata: {[tagName: string]: 1};
$editable: {[tagName: string]: 1};
$empty: {[tagName: string]: 1};
$inline: {[tagName: string]: 1};
$intermediate: {[tagName: string]: 1};
$list: {[tagName: string]: 1};
$listItem: {[tagName: string]: 1};
$nonBodyContent: {[tagName: string]: 1};
$nonEditable: {[tagName: string]: 1};
$object: {[tagName: string]: 1};
$removeEmpty: {[tagName: string]: 1};
$tabIndex: {[tagName: string]: 1};
$tableContent: {[tagName: string]: 1};
$transparent: {[tagName: string]: 1};
}
var dtd: dtdDefinition;
class ui extends event {
constructor(editor: editor);
@@ -1819,7 +1837,7 @@ declare namespace CKEDITOR {
children: any[];
type: number;
add(node: node): number;
add(node: node, index: number): void;
add(node: node, index: number): void;
clone(): element;
filter(filter: filter): boolean;
filterChildren(filter: filter): void;

View File

@@ -0,0 +1,24 @@
import commandLineUsage = require("command-line-usage");
const sections = [
{
header: 'A typical app',
content: 'Generates something {italic very} important.'
},
{
header: 'Options',
optionList: [
{
name: 'input',
typeLabel: '{underline file}',
description: 'The input to process.'
},
{
name: 'help',
description: 'Print this usage guide.'
}
]
}
];
const usage = commandLineUsage(sections);

48
types/command-line-usage/index.d.ts vendored Normal file
View File

@@ -0,0 +1,48 @@
// Type definitions for command-line-usage 5.0
// Project: https://github.com/75lb/command-line-usage#readme
// Definitions by: Andrija Dvorski <https://github.com/Dvorsky>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare namespace commandLineUsage {
interface Section {
list: string[];
add(content: object): void;
emptyLine(): void;
header(text: string): void;
toString(): string;
}
interface SectionData {
optionList?: OptionListData[];
hide?: string[];
group?: string[];
header?: string;
reverseNameOrder?: boolean;
tableOptions?: any;
}
interface OptionListData extends SectionData {
name: string;
typeLabel?: string;
description?: string;
}
interface ContentSectionData extends SectionData {
content: string;
raw?: boolean;
}
type CommandLineUsageInput =
SectionData
| SectionData[]
| OptionListData
| OptionListData[]
| ContentSectionData
| ContentSectionData[];
}
declare function commandLineUsage(sections: commandLineUsage.CommandLineUsageInput): string | undefined | commandLineUsage.Section;
export = commandLineUsage;

View File

@@ -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",
"command-line-usage-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -47,7 +47,12 @@ var job = new CronJob({
start: false,
timeZone: 'America/Los_Angeles'
});
console.log(job.lastDate());
console.log(job.nextDates(1));
console.log(job.running);
job.setTime(new CronTime('00 30 11 * * 1-2'));
job.start();
job.stop();
// How to check if a cron pattern is valid:
try {

125
types/cron/index.d.ts vendored
View File

@@ -1,25 +1,118 @@
// Type definitions for cron 1.2
// Type definitions for cron 1.3
// Project: https://www.npmjs.com/package/cron
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
// Lundarl Gholoi <https://github.com/winup>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export declare class CronTime {
/**
* Create a new ```CronTime```.
* @param source The time to fire off your job. This can be in the form of cron syntax or a JS ```Date``` object.
* @param zone Timezone name. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/).
*/
constructor(source: string | Date, zone?: string);
/**
* Tells you when ```CronTime``` will be run.
* @param i Indicate which turn of run after now. If not given return next run time.
*/
public sendAt(i?: number): Date;
/**
* Get the number of milliseconds in the future at which to fire our callbacks.
*/
public getTimeout(): number;
}
interface CronJobStatic {
new (cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean): CronJob;
new (options: {
cronTime: string | Date; onTick: () => void; onComplete?: () => void; start?: boolean; timeZone?: string; context?: any; runOnInit?: boolean
}): CronJob;
export declare interface CronJobParameters {
/**
* The time to fire off your job. This can be in the form of cron syntax or a JS ```Date``` object.
*/
cronTime: string | Date;
/**
* The function to fire at the specified time.
*/
onTick: () => void;
/**
* A function that will fire when the job is complete, when it is stopped.
*/
onComplete?: () => void;
/**
* Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call ```job.start()``` in order to start the job (assuming ```job``` is the variable you set the cronjob to). This does not immediately fire your onTick function, it just gives you more control over the behavior of your jobs.
*/
start?: boolean;
/**
* Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/).
*/
timeZone?: string;
/**
* The context within which to execute the onTick method. This defaults to the cronjob itself allowing you to call ```this.stop()```. However, if you change this you'll have access to the functions and values within your context object.
*/
context?: any;
/**
* This will immediately fire your ```onTick``` function as soon as the requisit initialization has happened. This option is set to ```false``` by default for backwards compatibility.
*/
runOnInit?: boolean;
}
interface CronJob {
start(): void;
stop(): void;
running: boolean | undefined;
}
export declare var CronJob: CronJobStatic;
interface CronTimeStatic {
new (time: string | Date): CronTime;
export declare class CronJob {
/**
* Return ```true``` if job is running.
*/
public running: boolean | undefined;
/**
* Function using to fire ```onTick```, default set to an inner private function. Overwrite this only if you have a really good reason to do so.
*/
public fireOnTick: Function;
/**
* Create a new ```CronJob```.
* @param cronTime The time to fire off your job. This can be in the form of cron syntax or a JS ```Date``` object.
* @param onTick The function to fire at the specified time.
* @param onComplete A function that will fire when the job is complete, when it is stopped.
* @param start Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call ```job.start()``` in order to start the job (assuming ```job``` is the variable you set the cronjob to). This does not immediately fire your onTick function, it just gives you more control over the behavior of your jobs.
* @param timeZone Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/).
* @param context The context within which to execute the onTick method. This defaults to the cronjob itself allowing you to call ```this.stop()```. However, if you change this you'll have access to the functions and values within your context object.
* @param runOnInit This will immediately fire your ```onTick``` function as soon as the requisit initialization has happened. This option is set to ```false``` by default for backwards compatibility.
*/
constructor(cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean);
/**
* Create a new ```CronJob```.
* @param options Job parameters.
*/
constructor(options: CronJobParameters);
/**
* Runs your job.
*/
public start(): void;
/**
* Stops your job.
*/
public stop(): void;
/**
* Change the time for the ```CronJob```.
* @param time Target time.
*/
public setTime(time: CronTime): void;
/**
* Tells you the last execution date.
*/
public lastDate(): Date;
/**
* Tells you when a ```CronTime``` will be run.
* @param i Indicate which turn of run after now. If not given return next run time.
*/
public nextDates(i?: number): Date;
/**
* Add another ```onTick``` function.
* @param callback Target function.
*/
public addCallback(callback: Function): void;
}
interface CronTime { }
export declare var CronTime: CronTimeStatic;
export declare var job:
((cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean) => CronJob)
| ((options: CronJobParameters) => CronJob);
export declare var time: (source: string | Date, zone?: string) => CronTime;
export declare var sendAt: (cronTime: CronTime) => Date;
export declare var timeout: (cronTime: CronTime) => number;

View File

@@ -51,8 +51,8 @@ promise2 = d3Fetch.tsv<MyType>(url, parseRow);
promise2 = d3Fetch.tsv<MyType>(url, init, parseRow);
let docPromise: Promise<Document>;
docPromise = d3Fetch.hmtl(url);
docPromise = d3Fetch.hmtl(url, init);
docPromise = d3Fetch.html(url);
docPromise = d3Fetch.html(url, init);
docPromise = d3Fetch.svg(url);
docPromise = d3Fetch.svg(url, init);

View File

@@ -154,7 +154,7 @@ export function dsv<ParsedRow extends DSVRowAny>(
* @param url A valid URL string.
* @param init An optional request initialization object.
*/
export function hmtl(url: string, init?: RequestInit): Promise<Document>;
export function html(url: string, init?: RequestInit): Promise<Document>;
/**
* Fetches the image at the specified input URL and returns a promise of an HTML image element.

View File

@@ -95,15 +95,15 @@ export interface NodeConfig {
}
export interface EdgeConfig {
minlen: number;
weight: number;
width: number;
height: number;
lablepos: 'l'|'c'|'r';
labeloffest: number;
minlen?: number;
weight?: number;
width?: number;
height?: number;
lablepos?: 'l'|'c'|'r';
labeloffest?: number;
}
export function layout(graph: graphlib.Graph, layout?: GraphLabel&NodeConfig&EdgeConfig): void;
export function layout(graph: graphlib.Graph, layout?: GraphLabel & NodeConfig & EdgeConfig): void;
export interface Edge {
v: string;

View File

@@ -0,0 +1,8 @@
const config: DataTables.Settings = {
// AutoFill extension options
autoFill: {
alwaysAsk: true,
enable: true,
columns: [1, 2]
}
};

View File

@@ -0,0 +1,33 @@
// Type definitions for datatables.net-autofill 2.2
// Project: https://datatables.net
// Definitions by: Andy Ma <https://github.com/andy-maca>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="jquery" />
/// <reference types="datatables.net"/>
declare namespace DataTables {
interface Settings {
/*
* autoFill extension options
*/
autoFill?: boolean | AutoFillSettings;
}
interface AutoFillSettings {
/*
* Always ask the end user if an action should be taken or not
*/
alwaysAsk?: boolean;
/*
* Select the columns that can be auto filled
*/
columns: string | number[];
/*
*
* Initial enablement state of AutoFill
*/
enable?: boolean;
}
}

View File

@@ -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",
"datatables.net-autofill-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -0,0 +1,12 @@
$(document).ready(() => {
const config: DataTables.Settings = {
// ColReorder extension options
colReorder: {
fixedColumnsLeft: 0,
fixedColumnsRight: 0,
order: [1, 2, 3],
realtime: true,
reorderCallback: () => {},
}
};
});

View File

@@ -0,0 +1,64 @@
// Type definitions for datatables.net-colReorder 1.4
// Project: https://datatables.net/extensions/colreorder/
// Definitions by: Andy Ma <https://github.com/andy-maca>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="jquery" />
/// <reference types="datatables.net"/>
declare namespace DataTables {
interface Settings {
/*
* colReorder extension options
*/
colReorder?: boolean | ColReorderSettings;
}
interface ColReorderSettings {
/*
* Number of columns (counting from the left) to disallow reordering of, '0' in default
*/
fixedColumnsLeft?: number;
/*
* Number of columns (counting from the right) to disallow reordering of, '0' in default
*/
fixedColumnsRight?: number;
/*
* Set a default order for the columns in the table
*/
order?: number[];
/*
* Enable / disable live reordering of columns during a drag, 'true' in default
*/
realtime?: boolean;
/*
* Callback after reorder
*/
reorderCallback: () => void;
}
interface Api {
colReorder: {
/*
* Programmatically reorder columns
*/
move(from: number, to: number, drop: boolean, invalidate: boolean): Api;
/*
* Get / set column order
*/
order(newOrder?: number[], originalIndexes?: boolean): Api;
/*
* Restore the loaded column order
*/
reset(): Api;
/*
* Convert one or more column indexes to and from current and original indexes
*/
transpose(idx?: number | number[], direction?: "toCurrent" | "toOriginal" | "fromOriginal" | "fromCurrent"): Api;
};
}
}

View File

@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"datatables.net-colreorder-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -44,6 +44,41 @@ declare namespace DataTables {
/*
* Set the selection style for end user interaction with the table
*/
style?: string;
style?: "api" | "single" | "multi" | "os" | "multi+shift";
}
interface Api {
select: {
/*
* Get the current selection style applied to the table
*/
style(): string;
/*
* Set the table's selection style
*/
style(s: "api" | "single" | "multi" | "os"): Api;
};
}
interface RowMethods {
/**
* Select a row
*/
select(): Api;
/**
* Deselect a row
*/
deselect(): Api;
}
interface RowsMethods {
/**
* Select multiple rows
*/
select(): Api;
/**
* Deselect a row
*/
deselect(): Api;
}
}

View File

@@ -225,7 +225,7 @@ let config: DataTables.Settings = {
],
// Data
ajax: "url",
data: {},
data: [],
// Features
autoWidth: true,
deferRender: true,

View File

@@ -28,6 +28,10 @@ declare namespace DataTables {
}
interface Api extends CoreMethods {
/**
* API should be array-like
*/
[key: number]: any;
/**
* Returns DataTables API instance
*
@@ -221,7 +225,7 @@ declare namespace DataTables {
* @param event Event name to remove.
* @param callback Specific callback function to remove if you want to unbind a single event listener.
*/
off(event: string, callback?: ((e: Event, settings: Settings, json: any) => void)): Api;
off(event: string, callback?: ((e: Event, ...args: any[]) => void)): Api;
/**
* Table events listener.
@@ -229,7 +233,7 @@ declare namespace DataTables {
* @param event Event to listen for.
* @param callback Specific callback function to remove if you want to unbind a single event listener.
*/
on(event: string, callback: ((e: Event, settings: Settings, json: any) => void)): Api;
on(event: string, callback: ((e: Event, ...args: any[]) => void)): Api;
/**
* Listen for a table event once and then remove the listener.
@@ -237,7 +241,7 @@ declare namespace DataTables {
* @param event Event to listen for.
* @param callback Specific callback function to remove if you want to unbind a single event listener.
*/
one(event: string, callback: ((e: Event, settings: Settings, json: any) => void)): Api;
one(event: string, callback: ((e: Event, ...args: any[]) => void)): Api;
/**
* Page Methods / object
@@ -1297,7 +1301,7 @@ declare namespace DataTables {
/**
* Data to use as the display data for the table. Since: 1.10
*/
data?: object;
data?: any[];
//#endregion "Data"
@@ -1931,6 +1935,7 @@ declare namespace DataTables {
}
interface ColumnLegacy {
idx: number;
aDataSort: any;
asSorting: string[];
bSearchable: boolean;

View File

@@ -11,6 +11,8 @@ dotenv.config({
encoding: 'utf8'
});
dotenv.load();
const parsed = dotenv.parse("ENVIRONMENT=production\nDEBUG=no\n");
const debug: string = parsed['DEBUG'];

View File

@@ -20,6 +20,7 @@ export function parse(src: string | Buffer): {[name: string]: string};
* Example: 'KEY=value' becomes { parsed: { KEY: 'value' } }
*/
export function config(options?: DotenvOptions): DotenvResult;
export const load: typeof config;
export interface DotenvOptions {
/**

View File

@@ -1,4 +1,5 @@
/*!
* Dynamsoft WebTwain PDF Addon
* Based on Dynamsoft WebTwain JavaScript Intellisense
* Product: Dynamsoft Web Twain
* Web Site: http://www.dynamsoft.com
@@ -8,9 +9,9 @@
* Version: 13.4
*/
declare enum EnumDWT_ConverMode {
declare enum EnumDWT_ConvertMode {
CM_DEFAULT = 0,
TWPT_CM_RENDERALLGRAY = 1
CM_RENDERALL = 1
}
/**
@@ -42,10 +43,10 @@ interface PDF {
/**
* Set the image convert mode for PDF Rasterizer in Dynamic Web TWAIN.
* @method Dynamsoft.WebTwain#SetConvertMode
* @param {EnumDWT_ConverMode} convertMode Specifies the image convert mode.
* @param {EnumDWT_ConvertMode} convertMode Specifies the image convert mode.
* @return {boolean}
*/
SetConvertMode(convertMode: EnumDWT_ConverMode): boolean;
SetConvertMode(convertMode: EnumDWT_ConvertMode): boolean;
/**
* Set the output resolution for the PDF Rasterizer in Dynamic Web TWAIN.

94
types/dwt/index.d.ts vendored
View File

@@ -27,7 +27,19 @@ declare namespace Dynamsoft {
Errors Events IntToColorStr LS OnGetImageByURL OnGetImageFromServer Path ProgressBar UI Uri
addEventListener ajax all appendMessage appendRichMessage aryControlLoadImage attachAddon attachProperty
base64 bio cancelFrome clearMessage closeAll closeProgress colorStrToInt config css currentStyle
debug detect detectButton dialog dialogShowStatus dlgProgress dlgRef drawBoxBorder drawImageWithHermite
debug*/
let detect: {
/*ignored
OnCreatWS OnDetectNext OnWebTwainPostExecute OnWebTwainPreExecute StartWSByIPTimeoutId StartWSTimeoutId
aryReconnectSTwains arySTwains arySTwainsByIP bFirst bNeedUpgradeEvent bNoControlEvent bOK bPromptJSOrServerOutdated
cUrlIndex dcpCallbackType dcpStatus detectType getVersionArray global_dlg hideMask isDWTVersionLatest onNoControl
onNotAllowedForChrome ports scriptLoaded showMask starting tryTimes*/
ssl: boolean;
};
/*ignored
detectButton dialog dialogShowStatus dlgProgress dlgRef drawBoxBorder drawImageWithHermite
each empty endsWith
*/
@@ -53,44 +65,47 @@ declare namespace Dynamsoft {
*/
}
namespace WebTwainEnv {
let JSVersion: string;
let PluginVersion: string;
let ActiveXVersion: string;
let ServerVersionInfo: string;
let Trial: boolean;
let AutoLoad: boolean;
let ProductKey: string;
let ResourcesPath: string;
let IfUpdateService: boolean;
let IfUseActiveXForIE10Plus: boolean;
let UseDefaultInstallUI: string;
let ActiveXInstallWithCAB: boolean;
let Debug: boolean;
let ActiveXVersion: string;
let AutoLoad: boolean;
function CloseDialog(): void;
let ContainerMap: {};
let Containers: Container[];
function CreateDWTObject(newObjID: string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void;
function CreateDWTObject(newObjID: string, ip: number | string, port: number | string, portSSL: number | string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void;
let Debug: boolean;
function DeleteDWTObject(objID: string): void;
let DynamicContainers: string[];
let DynamicDWTMap: {};
function CreateDWTObject(newObjID: string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void;
function GetWebTwain(cid: string): WebTwain;
function DeleteDWTObject(objID: string): void;
let IfUpdateService: boolean;
let IfUseActiveXForIE10Plus: boolean;
let JSVersion: string;
function Load(): void;
function Unload(): void;
function RegisterEvent(event: string, fn: (...args: any[]) => void): void;
/*ignored
initQueue inited UseDefaultInstallUI
OnWebTwainInitMessage OnWebTwainNeedUpgrade OnWebTwainNeedUpgradeWebJavascript OnWebTwainNotFound OnWebTwainOldPluginNotAllowed OnWebTwainReady
OnWebTwainInitMessage OnWebTwainNeedUpgrade OnWebTwainNeedUpgradeWebJavascript OnWebTwainNotFound OnWebTwainOldPluginNotAllowed
*/
function OnWebTwainPostExecute(): void;
function OnWebTwainPreExecute(): void;
/*ignored
OnWebTwainReady
*/
let PluginVersion: string;
let ProductKey: string;
function RegisterEvent(event: string, fn: (...args: any[]) => void): void;
function RemoveAllAuthorizations(): void;
let ResourcesPath: string;
let ServerVersionInfo: string;
function ShowDialog(_dialogWidth: number, _dialogHeight: number, _strDialogMessageWithHtmlFormat: string, _bChangeImage: boolean, bHideCloseButton: boolean): void;
function CloseDialog(): void;
let Trial: boolean;
function Unload(): void;
let UseDefaultInstallUI: string;
let initQueue: number[];
let inited: boolean;
}
}
@@ -2244,10 +2259,15 @@ interface WebTwain {
*/
Zoom: number;
/** ignored
/* ignored
style
_AutoCropMethod
*/
/*
*Methods
*/
/**
* Displays the source's built-in interface to acquire image.
* @method WebTwain#AcquireImage
@@ -2916,7 +2936,7 @@ interface WebTwain {
* @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
* @return {boolean}
*/
HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean;
/**
* Uploads the images specified by the indices to the HTTP server.
@@ -2929,7 +2949,7 @@ interface WebTwain {
* @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
* @return {boolean}
*/
HTTPUpload(url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
HTTPUpload(url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean;
/**
* Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF.
@@ -2941,7 +2961,7 @@ interface WebTwain {
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
* @return {boolean}
*/
HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean;
/**
* Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF.
@@ -2953,7 +2973,7 @@ interface WebTwain {
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
* @return {boolean}
*/
HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean;
/**
* [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF.
@@ -2992,7 +3012,7 @@ interface WebTwain {
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
* @return {boolean}
*/
HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean;
/**
* Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF.
@@ -3004,7 +3024,7 @@ interface WebTwain {
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
* @return {boolean}
*/
HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean;
/**
* Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF.
@@ -3016,7 +3036,7 @@ interface WebTwain {
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
* @return {boolean}
*/
HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean;
/**
* Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN.
@@ -3029,7 +3049,7 @@ interface WebTwain {
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
* @return {boolean}
*/
HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean;
/**
* Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method.
@@ -3043,7 +3063,7 @@ interface WebTwain {
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure.
* @return {boolean}
*/
HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean;
/**
* [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method.
@@ -3244,10 +3264,10 @@ interface WebTwain {
* Binds a specified function to an event, so that the function gets called whenever the event fires.
* @method WebTwain#RegisterEvent
* @param {string} name the name of the event that the function is bound to.
* @param {object} evt specifies the function to call when event fires.
* @param {any} evt specifies the function to call when event fires.
* @return {boolean}
*/
RegisterEvent(name: string, evt: object): boolean;
RegisterEvent(name: string, evt: any): boolean;
/**
* Removes all images in buffer.
@@ -3415,7 +3435,7 @@ interface WebTwain {
/**
* Saves the selected images in buffer to base64 string.
* @method WebTwain#SaveSelectedImagesToBase64Binary
* @return {string|bool}
* @return {string|boolean}
*/
SaveSelectedImagesToBase64Binary(optionalAsyncSuccessFunc?: (result: string[]) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): string | boolean;

View File

@@ -8,7 +8,7 @@
/*!
* filename: ej.web.all.d.ts
* version : 16.1.0.24
* version : 16.1.0.32
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
@@ -378,7 +378,7 @@ declare namespace ej {
update(dm: ej.DataManager, keyField: string, value: any, tableName: string): any;
}
class ForeignKeyAdaptor extends ej.JsonAdaptor {
constructor();
constructor(data: any, type: string);
processQuery(ds: any, query: ej.Query): any;
insert(dm: ej.DataManager, data: any, tableName: string): { url: string; data: any };
update(dm: ej.DataManager, keyField: string, value: any, tableName: string): { url: string; type: string; data: any };
@@ -9567,8 +9567,8 @@ declare namespace ej {
*/
cssClass?: string;
/** Sets the separator when the multiSelectMode with delimiter option or checkbox is enabled.When you enter the delimiter value, the text after the delimiter is considered as a
* separateword or query. The delimiter string is a single character and must be a symbol. Mostly,the delimiter symbol is used as comma (,), semi-colon (;), or any other special
/** Sets the separator when the multiSelectMode with delimiter option or checkbox is enabled. When you enter the delimiter value, the text after the delimiter is considered as a
* separate word or query. The delimiter string is a single character and must be a symbol. Mostly, the delimiter symbol is used as comma (,), semi-colon (;), or any other special
* character.
* @Default {,}
*/
@@ -9628,12 +9628,12 @@ declare namespace ej {
*/
readOnly?: boolean;
/** The DropDownTreeâs textbox is displayed with rounded corner style.
/** The DropDownTree's textbox is displayed with rounded corner style.
* @Default {false}
*/
showRoundedCorner?: boolean;
/** Specifies the targetID for the DropDownTreeâs items.
/** Specifies the targetID for the DropDownTree's items.
* @Default {null}
*/
targetID?: string;
@@ -9653,8 +9653,8 @@ declare namespace ej {
*/
validationRules?: any;
/** Specifies the value (text content) for the DropDownTree control. For the single selection mode, the selected itemâs value will be returned in its data type, and for
* MultiSelectMode, returns the selected itemsâ values separated by delimiter in string type.
/** Specifies the value (text content) for the DropDownTree control. For the single selection mode, the selected item's value will be returned in its data type, and for
* MultiSelectMode, returns the selected items values separated by delimiter in string type.
* @Default {null}
*/
value?: string;
@@ -9678,7 +9678,7 @@ declare namespace ej {
*/
blur?(e: BlurEventArgs): void;
/** Fires the action when the DropDownTree controlâs value is changed.
/** Fires the action when the DropDownTree control's value is changed.
*/
change?(e: ChangeEventArgs): void;
@@ -9744,15 +9744,15 @@ declare namespace ej {
*/
model?: any;
/** Selected itemâs text.
/** Selected item's text.
*/
selectedText?: string;
/** Selected itemâs text.
/** Selected item's text.
*/
text?: string;
/** Selected itemâs value.
/** Selected item's value.
*/
value?: string;
@@ -9779,11 +9779,11 @@ declare namespace ej {
*/
model?: any;
/** Selected itemâs text.
/** Selected item's text.
*/
text?: string;
/** Selected itemâs value.
/** Selected item's value.
*/
value?: string;
@@ -9810,11 +9810,11 @@ declare namespace ej {
*/
model?: any;
/** Selected itemâs text.
/** Selected item's text.
*/
text?: string;
/** Selected itemâs value.
/** Selected item's value.
*/
value?: string;
}
@@ -9863,7 +9863,7 @@ declare namespace ej {
*/
model?: any;
/** Selected itemâs text.
/** Selected item's text.
*/
selectedText?: string;
@@ -9905,11 +9905,11 @@ declare namespace ej {
*/
model?: any;
/** Selected itemâs text.
/** Selected item's text.
*/
text?: string;
/** Selected itemâs value.
/** Selected item's value.
*/
value?: string;
}
@@ -9928,11 +9928,11 @@ declare namespace ej {
*/
model?: any;
/** Selected itemâs text.
/** Selected item's text.
*/
text?: string;
/** Selected itemâs value.
/** Selected item's value.
*/
value?: string;
@@ -9961,7 +9961,7 @@ declare namespace ej {
}
}
enum Textmode {
//When TextMode property is set to none, only selected/checked node’s text is presented.
//When TextMode property is set to none, only selected/checked node's text is presented.
None,
//When FullPath option is selected, the full path of the selected node is shown in the control.
FullPath,
@@ -19622,6 +19622,11 @@ declare namespace ej {
*/
value?: string|Date;
/** Specifies the water mark text to be displayed in input text.
* @Default {select a time}
*/
watermarkText?: string;
/** Defines the width of the TimePicker textbox.
*/
width?: string|number;
@@ -30758,6 +30763,11 @@ declare namespace ej {
*/
operationalMode?: ej.Pivot.OperationalMode|string;
/** To override x axis for particular series, create an axis object by providing unique name by using name property and add it to axes array.
* @Default {[]}
*/
axes?: any[];
/** This is a horizontal axis that contains options to configure the axis and it is the primary x-axis for all series in the series array. To override x-axis for particular series,
* create an axis object by providing a unique name by using the name property and add it to the axes array. Then, assign the name to the seriesâs xAxisName property to link both
* the axis and the series.
@@ -30818,10 +30828,6 @@ declare namespace ej {
*/
beforeServiceInvoke?(e: BeforeServiceInvokeEventArgs): void;
/** Triggers before the pivot engine starts to populate.
*/
beforePivotEnginePopulate?(e: BeforePivotEnginePopulateEventArgs): void;
/** Triggers when performing drill up/down operation in the pivot chart control.
*/
drillSuccess?(e: DrillSuccessEventArgs): void;
@@ -30888,13 +30894,6 @@ declare namespace ej {
element?: any;
}
export interface BeforePivotEnginePopulateEventArgs {
/** returns the current instance of PivotChart.
*/
chartObj?: any;
}
export interface DrillSuccessEventArgs {
/** returns the current instance of PivotChart.
@@ -33505,6 +33504,11 @@ declare namespace ej {
*/
allowInline?: boolean;
/** When set to false, disables the appointment delete option on the Scheduler.
* @Default {true}
*/
allowDelete?: boolean;
/** When set to true, Scheduler allows interaction through keyboard shortcut keys.
* @Default {true}
*/
@@ -37077,6 +37081,11 @@ declare namespace ej {
* @Default {0}
*/
weekStartDay?: number;
/** Enable or disable the automatic timescale update on cell editing, dialog editing and taskbar editing.
* @Default {true}
*/
updateTimescaleView?: boolean;
}
export interface SelectedCellIndex {
@@ -38114,6 +38123,14 @@ declare namespace ej {
*/
sortColumn(fieldName: string, columnSortDirection: string): void;
/** To move the TreeGrid rows programmatically with from index ,to index and position.
* @param {number} you can pass drag Index of the row
* @param {number} you can pass target Index of the row.
* @param {string} you can pass the drop position as above,below,child
* @returns {void}
*/
moveRow(fromIndex: number, toIndex: number, position: string): void;
/** To reorder the column with field name and target index values
* @param {string} you can pass a name of column to reorder.
* @param {string} you can pass a target column index to be inserted.
@@ -38651,6 +38668,10 @@ declare namespace ej {
*/
rowDragStop?(e: RowDragStopEventArgs): void;
/** Triggered before row drop action begins.
*/
rowDropActionBegin?(e: RowDropActionBeginEventArgs): void;
/** Triggered before selecting a cell
*/
cellSelecting?(e: CellSelectingEventArgs): void;
@@ -39378,6 +39399,45 @@ declare namespace ej {
type?: string;
}
export interface RowDropActionBeginEventArgs {
/** Returns the cancel option value.
*/
cancel?: boolean;
/** Returns the row which we start to drag.
*/
draggedRow?: any;
/** Returns the row index which we start to drag.
*/
draggedRowIndex?: number;
/** Returns the multiple dragged row collection for multiple reorder
*/
draggedRecords?: any[];
/** Returns the drop position.
*/
dropPosition?: string;
/** Returns the row which we are dropped to row.
*/
targetRow?: any;
/** Returns the row index which we are dropped to row.
*/
targetRowIndex?: number;
/** Returns the TreeGrid model.
*/
model?: any;
/** Returns the name of the event.
*/
type?: string;
}
export interface CellSelectingEventArgs {
/** Returns the cancel option value.
@@ -42693,6 +42753,8 @@ declare namespace ej {
XLSort: Spreadsheet.XLSort;
XLSparkline: Spreadsheet.XLSparkline;
XLValidate: Spreadsheet.XLValidate;
}
export namespace Spreadsheet {
@@ -43547,6 +43609,35 @@ declare namespace ej {
sortByRange(range: any[]|string, columnName: string, direction: any): boolean;
}
export interface XLSparkline {
/** This method used for creating the sparkline chart for specified range in spreadsheet.
* @param {string} Pass the data range
* @param {string} Pass the location range
* @param {string} Pass the sparkline chart type
* @param {any} Pass the sparkline chart options
* @param {number} Pass the sheetIndex
* @returns {void}
*/
createSparkline(dataRange: string, locationRange: string, type: string, options: any, sheetIndex: number): void;
/** This method used to change the sparkline color and marker point color in the spreadsheet.
* @param {string} Pass the sparkline ID
* @param {any} Pass the sparkline options
* @param {number} Optional. Pass the sheet index
* @returns {void}
*/
changePointColor(sparklineId: string, option: any, sheetIdx: number): void;
/** This method used to change the sparkline type in the spreadsheet.
* @param {string} Pass the sparkline ID
* @param {string} Pass the sparkline type
* @param {number} Optional. Pass the sheet index
* @returns {void}
*/
changeType(sparklineId: string, type: string, sheetIdx: number): void;
}
export interface XLValidate {
/** This method is used to apply data validation rules in a selected range of cells based on the defined condition in the Spreadsheet.
@@ -43737,6 +43828,11 @@ declare namespace ej {
*/
allowSorting?: boolean;
/** Gets or sets a value that indicates whether to enable the sparkline feature in the Spreadsheet.
* @Default {false}
*/
allowSparkline?: boolean;
/** Gets or sets a value that indicates whether to enable or disable undo and redo feature in the Spreadsheet.
* @Default {true}
*/

View File

@@ -6,6 +6,7 @@
// Chris Krycho <https://github.com/chriskrycho>
// Theron Cross <https://github.com/theroncross>
// Martin Feckie <https://github.com/mfeckie>
// Alex LaFroscia <https://github.com/alexlafroscia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -3408,6 +3409,7 @@ declare module '@ember/application/resolver' {
declare module '@ember/array' {
import Ember from 'ember';
type EmberArray<T> = Ember.Array<T>;
const EmberArray: typeof Ember.Array;
export default EmberArray;
export const A: typeof Ember.A;
@@ -3417,6 +3419,7 @@ declare module '@ember/array' {
declare module '@ember/array/mutable' {
import Ember from 'ember';
type MutableArray<T> = Ember.MutableArray<T>;
const MutableArray: typeof Ember.MutableArray;
export default MutableArray;
}
@@ -3496,6 +3499,7 @@ declare module '@ember/engine/instance' {
declare module '@ember/enumerable' {
import Ember from 'ember';
type Enumerable<T> = Ember.Enumerable<T>;
const Enumerable: typeof Ember.Enumerable;
export default Enumerable;
}
@@ -3584,6 +3588,7 @@ declare module '@ember/object/core' {
declare module '@ember/object/evented' {
import Ember from 'ember';
type Evented = Ember.Evented;
const Evented: typeof Ember.Evented;
export default Evented;
export const on: typeof Ember.on;
@@ -3610,6 +3615,7 @@ declare module '@ember/object/mixin' {
declare module '@ember/object/observable' {
import Ember from 'ember';
type Observable = Ember.Observable;
const Observable: typeof Ember.Observable;
export default Observable;
}
@@ -3622,6 +3628,7 @@ declare module '@ember/object/observers' {
declare module '@ember/object/promise-proxy-mixin' {
import Ember from 'ember';
type PromiseProxyMixin<T> = Ember.PromiseProxyMixin<T>;
const PromiseProxyMixin: typeof Ember.PromiseProxyMixin;
export default PromiseProxyMixin;
}

View File

@@ -0,0 +1,22 @@
import escapeRegExp = require('escape-regexp');
// $ExpectType string
escapeRegExp('aaa');
// $ExpectError
escapeRegExp();
// $ExpectError
escapeRegExp({});
// $ExpectError
escapeRegExp(1);
// $ExpectError
escapeRegExp([]);
// $ExpectError
escapeRegExp(null);
// $ExpectError
escapeRegExp(undefined);

9
types/escape-regexp/index.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// Type definitions for escape-regexp 0.0
// Project: https://www.npmjs.com/package/escape-regexp
// Definitions by: Vilim Stubičan <https://github.com/jewbre>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
declare function escapeRegExp(str: string): string;
export = escapeRegExp;

View File

@@ -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",
"escape-regexp-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -0,0 +1,29 @@
import { ElementHandle, Page } from "puppeteer";
const testGlobal = async (instance: ElementHandle | Page) => {
await expect(instance).toClick("selector");
await expect(instance).toClick("selector", { polling: "mutation", text: "text" });
await expect(instance).toClick("selector", { polling: "raf", timeout: 777 });
await expect(instance).toDisplayDialog(async () => {});
await expect(instance).toFill("selector", "value");
await expect(instance).toFill("selector", "value", { polling: 777 });
await expect(instance).toMatchElement("selector", "value");
await expect(instance).toMatchElement("selector", "value", { polling: "mutation" });
await expect(instance).toSelect("selector", "valueOrText");
await expect(instance).toSelect("selector", "valueOrText", { polling: "raf" });
await expect(instance).toUploadFile("selector", "filePath");
await expect(instance).toUploadFile("selector", "filePath", { timeout: 777 });
};
const testImported = async (instance: ElementHandle | Page) => {
const expectPuppeteer = await import("expect-puppeteer");
await expectPuppeteer(instance).toClick("selector");
await expect(instance).toClick("selector", { polling: "mutation", text: "text" });
await expect(instance).toClick("selector", { polling: "raf", timeout: 777 });
};

55
types/expect-puppeteer/index.d.ts vendored Normal file
View File

@@ -0,0 +1,55 @@
// Type definitions for expect-puppeteer 2.2
// Project: https://github.com/smooth-code/jest-puppeteer/tree/master/packages/expect-puppeteer
// Definitions by: Josh Goldberg <https://github.com/JoshuaKGoldberg>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="jest" />
import { ElementHandle, Page } from "puppeteer";
/**
* Interval at which pageFunctions may be executed.
*/
type ExpectPolling = number | "mutation" | "raf";
/**
* Configures how to poll for an element.
*/
interface ExpectTimingActions {
/**
* An interval at which the pageFunction is executed. Defaults to "raf".
*/
polling?: ExpectPolling;
/**
* Maximum time to wait for in milliseconds. Defaults to 500.
*/
timeout?: number;
}
interface ExpectToClickOptions extends ExpectTimingActions {
/**
* A text or a RegExp to match in element textContent.
*/
text?: string | RegExp;
}
interface ExpectPuppeteer {
toClick(selector: string, options?: ExpectToClickOptions): Promise<void>;
toDisplayDialog(block: () => Promise<void>): Promise<void>;
toFill(selector: string, value: string, options?: ExpectTimingActions): Promise<void>;
toMatchElement(selector: string, value: string, options?: ExpectTimingActions): Promise<void>;
toSelect(selector: string, valueOrText: string, options?: ExpectTimingActions): Promise<void>;
toUploadFile(selector: string, filePath: string, options?: ExpectTimingActions): Promise<void>;
}
declare global {
namespace jest {
// tslint:disable-next-line no-empty-interface
interface Matchers<R> extends ExpectPuppeteer { }
}
}
declare function expectPuppeteer(instance: ElementHandle | Page): ExpectPuppeteer;
export = expectPuppeteer;

View File

@@ -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",
"expect-puppeteer-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -1701,7 +1701,7 @@ export namespace Pedometer {
*/
export namespace Permissions {
type PermissionType = 'remoteNotifications' | 'location' |
'camera' | 'contacts' | 'audioRecording';
'camera' | 'contacts' | 'audioRecording' | 'calendar';
type PermissionStatus = 'undetermined' | 'granted' | 'denied';
type PermissionExpires = 'never';
@@ -1733,6 +1733,7 @@ export namespace Permissions {
const NOTIFICATIONS: RemoteNotificationPermission;
const CONTACTS: 'contacts';
const SYSTEM_BRIGHTNESS: 'systemBrightness';
const CALENDAR: 'calendar';
}
/**

View File

@@ -0,0 +1,12 @@
import express = require('express');
import flash = require('express-flash');
const app = express();
app.use(flash());
app.use((req) => {
req.flash();
req.flash('message');
req.flash('event', 'message');
});

11
types/express-flash/index.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
// Type definitions for express-flash 0.0
// Project: https://github.com/RGBboy/express-flash
// Definitions by: Ian Mobley <https://github.com/iMobs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="connect-flash" />
import express = require('express');
declare function flash(): express.RequestHandler;
export = flash;

View File

@@ -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",
"express-flash-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -1427,6 +1427,11 @@ export class Canvas {
* @return active object
*/
getActiveObject(): Object;
/**
* Returns an array with the current selected objects
* @return {Object[]} array of active objects
*/
getActiveObjects(): Object[];
/**
* Returns pointer coordinates relative to canvas.
* @return object with "x" and "y" number values

View File

@@ -4,6 +4,7 @@
// Joseph Livecchi <https://github.com/joewashear007>
// Michael Randolph <https://github.com/mrand01>
// Tiger Oakes <https://github.com/NotWoods>
// Brian Martinson <https://github.com/bmartinson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export import fabric = require("./fabric-impl");

View File

@@ -1032,3 +1032,32 @@ function sample9() {
canvas.setBackgroundImage('yolo.jpg', () => { "a"; }, { opacity: 45 });
canvas.setBackgroundImage('yolo.jpg', () => { "a"; });
}
function sample10() {
const canvas = new fabric.Canvas('c');
const objR = new fabric.Rect({
top: 10,
left: 10,
width: 10,
height: 10,
fill: "#FF0000",
});
const objG = new fabric.Rect({
top: 15,
left: 15,
width: 10,
height: 10,
fill: "#00FF00",
});
const objB = new fabric.Rect({
top: 20,
left: 20,
width: 10,
height: 10,
fill: "#0000FF",
});
canvas.add(objR);
canvas.add(objG);
canvas.add(objB);
const objArray = canvas.getActiveObjects();
}

31
types/gitlab/ApiBase.d.ts vendored Normal file
View File

@@ -0,0 +1,31 @@
import { ApiBaseOptions } from './ApiBase';
import { Labels } from './Models/Labels';
import { Users } from './Models/Users';
import { Notes } from './Models/Notes';
import { Issues } from './Models/Issues';
import { Projects } from './Models/Projects';
import { Groups } from './Models/Groups';
export interface ApiBaseOptions {
url?: string;
token?: string;
oauth_token?: string;
base_url?: string;
auth?: any;
[key: string]: any;
}
export class ApiBase {
constructor(options: ApiBaseOptions);
readonly client: this;
readonly groups: Groups
readonly projects: Projects
readonly issues: Issues
readonly notes: Notes
readonly users: Users
readonly labels: Labels
options: ApiBaseOptions;
handleOptions(): void;
init(): object;
}

12
types/gitlab/ApiBaseHTTP.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
import { ApiBase } from './ApiBase';
export class ApiBaseHTTP extends ApiBase {
prepare_opts<T>(opts: T): T;
fn_wrapper<T extends Function>(fn: T): T;
get(path: string, fn?: Function): any;
get(path: string, query?: object, fn?: Function): any;
delete(path: string, fn?: Function): any;
post(path: string, data?: object, fn?: Function): any;
put(path: string, data?: object, fn?: Function): any;
patch(path: string, data?: object, fn?: Function): any;
}

5
types/gitlab/ApiV3.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
import { ApiBaseHTTP } from './ApiBaseHTTP';
export class ApiV3 extends ApiBaseHTTP {
}

17
types/gitlab/BaseModel.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
export class BaseModel {
load(model: string): object;
get(path: string, fn?: Function): any;
get(path: string, query?: object, fn?: Function): any;
delete(path: string, fn?: Function): any;
post(path: string, data?: object, fn?: Function): any;
put(path: string, data?: object, fn?: Function): any;
patch(path: string, data?: object, fn?: Function): any;
}
export interface DefParams {
page?: number;
per_page?: number;
[key: string]: any;
}
export type TId = number | string;

27
types/gitlab/Models/Groups.d.ts vendored Normal file
View File

@@ -0,0 +1,27 @@
import { BaseModel, DefParams } from "../BaseModel";
interface IAccessLevels {
GUEST: number
REPORTER: number
DEVELOPER: number
MASTER: number
OWNER: number
}
export class Groups extends BaseModel {
readonly access_levels: IAccessLevels;
init(): object;
all(fn?: Function): any;
all(params?: DefParams, fn?: Function): any;
show(groupId: number, fn?: Function): any;
listProjects(groupId: number, fn?: Function): any;
listMembers(groupId: number, fn?: Function): any;
addMember(groupId: number, userId: number, accessLevel: IAccessLevels[keyof IAccessLevels], fn?: Function): any;
editMember(groupId: number, userId: number, accessLevel: IAccessLevels[keyof IAccessLevels], fn?: Function): any;
removeMember(groupId: number, userId: number, fn?: Function): any;
create(params?: object, fn?: Function): any;
addProject(groupId: number, projectId: number, fn?: Function): any;
deleteGroup(groupId: number, fn?: Function): any;
search(nameOrPath: string, fn?: Function): any;
}

6
types/gitlab/Models/IssueNotes.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
import { BaseModel, TId, DefParams } from '../BaseModel';
export class IssueNotes extends BaseModel{
all(projectId: TId, issueId: number, fn?: Function): any
all(projectId: TId, issueId: number, params?: DefParams, fn?: Function): any
}

12
types/gitlab/Models/Issues.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
import { BaseModel, TId } from '../BaseModel';
export class Issues extends BaseModel {
all(fn?: Function): any;
all(params?: object, fn?: Function): any;
show(projectId: TId, issueId: TId, fn?: Function): any;
create(projectId: TId, params?: object, fn?: Function): any;
edit(projectId: TId, issueId: TId, params?: object, fn?: Function): any;
remove(projectId: TId, issueId: TId, fn?: Function): any;
subscribe(projectId: TId, issueId: TId, params?: object, fn?: Function): any;
unsubscribe(projectId: TId, issueId: TId, fn?: Function): any;
}

5
types/gitlab/Models/Labels.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
import { BaseModel, TId } from '../BaseModel';
export class Labels extends BaseModel {
create(projectId: TId, params?: object, fn?: Function): any;
}

5
types/gitlab/Models/Notes.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
import { BaseModel, TId } from '../BaseModel';
export class Notes extends BaseModel {
create(projectId: TId, issueId: number, params?: object, fn?: Function): any;
}

5
types/gitlab/Models/Pipelines.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
import { BaseModel, TId } from '../BaseModel';
export class Pipelines extends BaseModel {
all(projectId: TId, fn?: Function): any;
}

13
types/gitlab/Models/ProjectBuilds.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
import { BaseModel, TId, DefParams } from '../BaseModel';
interface IShowBuildParam {
projectId: TId;
[key: string]: any;
}
export class ProjectBuilds extends BaseModel {
listBuilds(projectId: TId, fn?: Function): any;
listBuilds(projectId: TId, params?: DefParams, fn?: Function): any;
showBuild(projectId: TId, buildId: string, fn?: Function): any;
triggerBuild(params?: IShowBuildParam, fn?: Function): any;
}

View File

@@ -0,0 +1,7 @@
import { BaseModel, TId } from '../BaseModel';
export class ProjectKeys extends BaseModel {
listKeys(projectId: TId, fn?: Function): any;
getKey(projectId: TId, keyId: number, fn?: Function): any;
addKey(projectId: TId, params?: object, fn?: Function): any;
}

16
types/gitlab/Models/ProjectHooks.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
import { BaseModel, TId } from '../BaseModel';
interface IAddParam {
url: string;
[key: string]: any;
}
type HooksCb = (hooks: any[]) => any;
export class ProjectHooks extends BaseModel {
list(projectId: TId, fn?: HooksCb): any;
show(projectId: TId, hookId: number, fn?: Function): any;
add(projectId: TId, params: IAddParam | string, fn?: Function): any;
update(projectId: TId, hookId: number, url: string, fn?: Function): any;
remove(projectId: TId, hookId: number, fn?: Function): any;
}

View File

@@ -0,0 +1,9 @@
import { IssueNotes } from './IssueNotes';
import { BaseModel, TId, DefParams } from '../BaseModel';
export class ProjectIssues extends BaseModel {
readonly notes: IssueNotes;
list(projectId: TId, fn?: Function): any;
list(projectId: TId, params?: DefParams, fn?: Function): any;
}

View File

@@ -0,0 +1,6 @@
import { BaseModel, TId, DefParams } from '../BaseModel';
export class ProjectLabels extends BaseModel {
all(projectId: TId, fn?: Function): any;
all(projectId: TId, params?: DefParams, fn?: Function): any;
}

12
types/gitlab/Models/ProjectMembers.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
import { BaseModel, TId } from '../BaseModel';
type MenberCb = (menber: any) => any;
type MenbersCb = (menbers: any[]) => any;
export class ProjectMembers extends BaseModel {
list(projectId: TId, fn?: MenbersCb): any;
show(projectId: TId, userId: number, fn?: MenberCb): any;
add(projectId: TId, userId: number, accessLevel: number,fn?: Function): any;
update(projectId: TId, userId: number, accessLevel: number, fn?: Function): any;
remove(projectId: TId, userId: number, fn?: Function): any;
}

View File

@@ -0,0 +1,11 @@
import { BaseModel, TId, DefParams } from '../BaseModel';
export class ProjectMergeRequests extends BaseModel {
list(projectId: TId, fn?: Function): any;
list(projectId: TId, params?: DefParams, fn?: Function): any;
show(projectId: TId, mergerequestId: number, fn?: Function): any;
add(projectId: TId, sourceBranch: string, targetBranch: string, assigneeId: number, title: string, fn?: Function): any;
update(projectId: TId, mergerequestId: number, params: object, fn?: Function): any;
comment(projectId: TId, mergerequestId: number, note: any, fn?: Function): any;
merge(projectId: TId, mergerequestId: number, params: object, fn?: Function): any;
}

View File

@@ -0,0 +1,12 @@
import { BaseModel, TId } from '../BaseModel';
type MilestonesCb = (milestones: any[]) => any;
type MilestoneCb = (milestones: any) => any;
export class ProjectMilestones extends BaseModel {
list(projectId: TId, fn?: MilestonesCb): any;
all(projectId: TId, fn?: MilestonesCb): any;
show(projectId: TId, milestoneId: number, fn?: MilestoneCb): any;
add(projectId: TId, title: string, description: string, due_date: any, fn?: Function): any;
update(projectId: TId, milestoneId: number, title: string, description: string, due_date: any, state_event: any, fn?: Function): any;
}

View File

@@ -0,0 +1,39 @@
import { BaseModel, TId } from '../BaseModel';
interface ShowFileParams {
file_path: string;
ref?: any;
file_id?: any;
[key: string]: any;
}
interface AddTagParams {
id: TId;
tag_name: string;
ref: string;
message?: string;
release_description?: string;
}
export class ProjectRepository extends BaseModel {
listBranches(projectId: TId, fn?: Function): any;
showBranch(projectId: TId, branchId: string, fn?: Function): any;
protectBranch(projectId: TId, branchId: string, params: object, fn?: Function): any;
unprotectBranch(projectId: TId, branchId: string, fn?: Function): any;
createBranch(params: object, fn?: Function): any;
deleteBranch(projectId: TId, branchId: string, fn?: Function): any;
addTag(params: AddTagParams, fn?: Function): any;
deleteTag(projectId: TId, tagName: string, fn?: Function): any;
showTag(projectId: TId, tagName: string, fn?: Function): any;
listTags(projectId: TId, fn?: Function): any;
listCommits(projectId: TId, fn?: Function): any;
showCommit(projectId: TId, sha: string, fn?: Function): any;
diffCommit(projectId: TId, sha: string, fn?: Function): any;
listTree(projectId: TId, fn?: Function): any;
listTree(projectId: TId, params?: object, fn?: Function): any;
showFile(projectId: TId, fn?: Function): any;
showFile(projectId: TId, params?: ShowFileParams, fn?: Function): any;
createFile(params?: object, fn?: Function): any;
updateFile(params?: object, fn?: Function): any;
compare(params?: object, fn?: Function): any;
}

View File

@@ -0,0 +1,9 @@
import { BaseModel, TId } from './../BaseModel';
type ServiceCb = (service: any) => any;
export class ProjectServices extends BaseModel {
show(projectId: TId, serviceName: string, fn?: ServiceCb): any;
update(projectId: TId, serviceName: string, params: object, fn?: ServiceCb): any;
remove(projectId: TId, serviceName: string, fn?: ServiceCb): any;
}

55
types/gitlab/Models/Projects.d.ts vendored Normal file
View File

@@ -0,0 +1,55 @@
import { Runners } from './Runners';
import { Pipelines } from './Pipelines';
import { ProjectBuilds } from './ProjectBuilds';
import { ProjectMergeRequests } from './ProjectMergeRequests';
import { ProjectKeys } from './ProjectDeployKeys';
import { ProjectMilestones } from './ProjectMilestones';
import { ProjectRepository } from './ProjectRepository';
import { ProjectLabels } from './ProjectLabels';
import { ProjectIssues } from './ProjectIssues';
import { ProjectHooks } from './ProjectHooks';
import { ProjectMembers } from './ProjectMembers';
import { BaseModel, DefParams, TId } from '../BaseModel';
import { ProjectServices } from './ProjectServices';
type ProjectsCb = (projects: any[]) => any;
export class Projects extends BaseModel {
readonly members: ProjectMembers;
readonly hooks: ProjectHooks;
readonly issues: ProjectIssues;
readonly labels: ProjectLabels;
readonly repository: ProjectRepository;
readonly milestones: ProjectMilestones;
readonly deploy_keys: ProjectKeys;
readonly merge_requests: ProjectMergeRequests;
readonly services: ProjectServices;
readonly builds: ProjectBuilds;
readonly pipelines: Pipelines;
readonly runners: Runners;
all(fn?: ProjectsCb): any;
all(params?: DefParams, fn?: ProjectsCb): any;
allAdmin(fn?: Function): any;
allAdmin(params?: DefParams, fn?: Function): any;
show(projectId: TId, fn?: Function): any;
create(params: object, fn?: Function): any;
create_for_user(params: object, fn?: Function): any;
edit(projectId: TId, params: object, fn?: Function): any;
addMember(params?: object, fn?: Function): any;
editMember(params?: object, fn?: Function): any;
listMembers(params?: object, fn?: Function): any;
listCommits(params?: object, fn?: Function): any;
listTags(params?: object, fn?: Function): any;
remove(projectId: TId, fn?: Function): any;
fork(params?: object, fn?: Function): any;
share(params?: object, fn?: Function): any;
search(projectName: string, fn?: Function): any;
search(projectName: string, params?: object, fn?: Function): any;
listTriggers(projectId: TId, fn?: Function): any;
showTrigger(projectId: TId, token: string, fn?: Function): any;
createTrigger(params?: object, fn?: Function): any;
removeTrigger(projectId: TId, token: string, fn?: Function): any;
}

11
types/gitlab/Models/Runners.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
import { BaseModel, DefParams, TId } from '../BaseModel';
export class Runners extends BaseModel {
all(projectId?: TId, fn?: Function): any;
all(projectId?: TId, params?: object, fn?: Function): any;
show(runnerId: number, fn?: Function): any;
update(runnerId: number, attributes: any, fn?: Function): any;
remove(runnerId: number, projectId: any, enable: any, fn?: Function): any;
enable(projectId: TId, runnerId: number, fn?: Function): any;
disable(projectId: TId, runnerId: number, fn?: Function): any;
}

6
types/gitlab/Models/UserKeys.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
import { BaseModel, DefParams, TId } from '../BaseModel';
export class UserKeys extends BaseModel {
all(userId?: TId, fn?: Function): any;
addKey(userId: string, title: string, key: any, fn?: Function): any;
}

17
types/gitlab/Models/Users.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
import { BaseModel, DefParams, TId } from '../BaseModel';
import { UserKeys } from './UserKeys';
type UsersCb = (users: any[]) => any;
type UserCb = (user: any) => any;
export class Users extends BaseModel {
readonly keys: UserKeys;
all(fn?: UsersCb): any;
all(params?: DefParams, fn?: UsersCb): any;
current(fn?: Function): any;
show(userId: number, fn?: UserCb): any;
create(params?: DefParams, fn?: Function): any;
session(email: string, password: string, fn?: Function): any;
search(emailOrUsername: string, fn?: Function): any;
}

View File

@@ -0,0 +1,20 @@
import * as lib from "gitlab";
const gitlab = lib({
url: 'http://example.com',
token: 'abcdefghij123456'
});
const v3 = new lib.ApiV3({ });
// From README
// Listing users
gitlab.users.all((users) => { });
// Listing projects
gitlab.projects.all((projects) => { });
// From examples/delet-service
gitlab.projects.services.remove("pid", "name", (service) => { });

17
types/gitlab/index.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
// Type definitions for gitlab 1.8
// Project: https://github.com/node-gitlab/node-gitlab#readme
// Definitions by: sam <https://github.com/yanqing6628780>
// AryloYeung <https://github.com/Arylo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { ApiV3 } from "./ApiV3";
import { ApiBaseOptions } from "./ApiBase";
declare namespace Gitlib {
const ApiV3: new(options: ApiBaseOptions) => ApiV3;
}
declare function Gitlib(options: ApiBaseOptions): ApiV3;
export = Gitlib;

View File

@@ -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",
"gitlab-tests.ts"
]
}

1
types/gitlab/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -44,7 +44,7 @@ backwardConnectionArgs.before = "b";
backwardConnectionArgs.last = 10;
// connectionDefinitions returns a connectionType and its associated edgeType, given a node type.
const resolve: GraphQLFieldResolver<any, any> = (source, args, context, info) => {
info.fieldName = "f";
context.flag = "f";
};
const fields: GraphQLFieldConfigMap<any, any> = {};
let t: GraphQLObjectType;
@@ -118,10 +118,10 @@ const resolver: GraphQLTypeResolver<any, any> = () => {
fields: {},
});
};
const idFetcher = (id: string, context: number, info: GraphQLResolveInfo) => {
info.fieldName = "f";
const idFetcher = (id: string, context: any, info: GraphQLResolveInfo) => {
context.flag = "f";
};
const nodeDef = nodeDefinitions<number>(idFetcher, resolver);
const nodeDef = nodeDefinitions<any>(idFetcher, resolver);
const nodeFieldConfig: GraphQLFieldConfig<any, any> = nodeDef.nodeField;
const nodesFieldConfig: GraphQLFieldConfig<any, any> = nodeDef.nodesField;
const interfaceType: GraphQLInterfaceType = nodeDef.nodeInterface;
@@ -183,10 +183,10 @@ mutationWithClientMutationId({
inputFields: gifcm,
mutateAndGetPayload: (
object: any,
ctx: any,
context: any,
info: GraphQLResolveInfo) => {
return new Promise<string>((resolve) => {
resolve(info.fieldName);
resolve(context.flag);
});
},
outputFields: gfcm,

View File

@@ -1,6 +1,7 @@
import { getLocation } from "../language";
import { ASTNode } from "../language/ast";
import { Source } from "../language/source";
import { SourceLocation } from "../language/location";
/**
* A GraphQLError describes an Error found during the parse, validate, or
@@ -13,6 +14,8 @@ export class GraphQLError extends Error {
* A message describing the Error for debugging purposes.
*
* Enumerable, and appears in the result of JSON.stringify().
*
* Note: should be treated as readonly, despite invariant usage.
*/
message: string;
@@ -26,7 +29,7 @@ export class GraphQLError extends Error {
*
* Enumerable, and appears in the result of JSON.stringify().
*/
locations?: Array<{ line: number; column: number }> | undefined;
readonly locations: ReadonlyArray<SourceLocation> | undefined;
/**
* An array describing the JSON-path into the execution response which
@@ -34,41 +37,41 @@ export class GraphQLError extends Error {
*
* Enumerable, and appears in the result of JSON.stringify().
*/
path?: Array<string | number> | undefined;
readonly path: ReadonlyArray<string | number> | undefined;
/**
* An array of GraphQL AST Nodes corresponding to this error.
*/
nodes?: ASTNode[] | undefined;
readonly nodes: ReadonlyArray<ASTNode> | undefined;
/**
* The source GraphQL document corresponding to this error.
*/
source?: Source | undefined;
readonly source: Source | undefined;
/**
* An array of character offsets within the source GraphQL document
* which correspond to this error.
*/
positions?: number[] | undefined;
readonly positions: ReadonlyArray<number> | undefined;
/**
* The original error thrown from a field resolver during execution.
*/
originalError?: Error;
readonly originalError: Error | void;
/**
* Extension fields to add to the formatted error.
*/
extensions?: { [key: string]: any } | undefined;
readonly extensions: { [key: string]: any } | void;
constructor(
message: string,
nodes?: any[],
source?: Source,
positions?: number[],
path?: Array<string | number>,
originalError?: Error,
extensions?: { [key: string]: any }
nodes?: ReadonlyArray<ASTNode> | ASTNode | undefined,
source?: Source | void,
positions?: ReadonlyArray<number> | void,
path?: ReadonlyArray<string | number> | void,
originalError?: Error | void,
extensions?: { [key: string]: any } | void
);
}

View File

@@ -1,4 +1,5 @@
import { GraphQLError } from "./GraphQLError";
import { SourceLocation } from "../language/location";
/**
* Given a GraphQLError, format it according to the rules described by the
@@ -7,12 +8,9 @@ import { GraphQLError } from "./GraphQLError";
export function formatError(error: GraphQLError): GraphQLFormattedError;
export interface GraphQLFormattedError {
message: string;
locations?: GraphQLErrorLocation[];
path?: Array<string | number>;
}
export interface GraphQLErrorLocation {
line: number;
column: number;
readonly message: string;
readonly locations: ReadonlyArray<SourceLocation> | undefined;
readonly path: ReadonlyArray<string | number> | undefined;
// Extensions
readonly [key: string]: any;
}

Some files were not shown because too many files have changed in this diff Show More