mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped
This commit is contained in:
@@ -38,5 +38,6 @@ node_modules
|
||||
.sublimets
|
||||
.settings/launch.json
|
||||
|
||||
.vs
|
||||
.vscode
|
||||
yarn.lock
|
||||
|
||||
@@ -110,7 +110,9 @@ Your package should have this structure:
|
||||
| tsconfig.json | This allows you to run `tsc` within the package. |
|
||||
| tslint.json | Enables linting. |
|
||||
|
||||
Generate these by running `npm run new-package -- new-package-name`.
|
||||
Generate these by running `npm run new-package -- --name my-package-name --template module`.
|
||||
(Other templates are `module-class`, `module-function`, `module-plugin`, `global`, `global-plugin`, and `global-modifying-module`.
|
||||
This just wraps [dts-gen](https://github.com/Microsoft/dts-gen), so it supports all options from that.)
|
||||
|
||||
You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option.
|
||||
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
import * as Ably from 'ably';
|
||||
|
||||
declare var console: { log(message: any): void };
|
||||
|
||||
const ApiKey = 'appId.keyId:secret';
|
||||
const client = new Ably.Realtime(ApiKey);
|
||||
const restClient = new Ably.Rest(ApiKey);
|
||||
|
||||
// Connection
|
||||
// Successful connection:
|
||||
|
||||
client.connection.on('connected', function() {
|
||||
// successful connection
|
||||
});
|
||||
|
||||
// Failed connection:
|
||||
|
||||
client.connection.on('failed', function() {
|
||||
// failed connection
|
||||
});
|
||||
|
||||
|
||||
// Subscribing to a channel
|
||||
|
||||
var channel = client.channels.get('test');
|
||||
channel.subscribe(function(message) {
|
||||
message.name; // 'greeting'
|
||||
message.data; // 'Hello World!'
|
||||
});
|
||||
|
||||
// Only certain events:
|
||||
|
||||
channel.subscribe('myEvent', function(message) {
|
||||
message.name; // 'myEvent'
|
||||
message.data; // 'myData'
|
||||
});
|
||||
|
||||
// Publishing to a channel
|
||||
|
||||
// Publish a single message with name and data
|
||||
channel.publish('greeting', 'Hello World!');
|
||||
|
||||
// Optionally, you can use a callback to be notified of success or failure
|
||||
channel.publish('greeting', 'Hello World!', function(err) {
|
||||
if(err) {
|
||||
console.log('publish failed with error ' + err);
|
||||
} else {
|
||||
console.log('publish succeeded');
|
||||
}
|
||||
})
|
||||
|
||||
// Publish several messages at once
|
||||
channel.publish([{name: 'greeting', data: 'Hello World!'}], function() { });
|
||||
|
||||
// Querying the History
|
||||
|
||||
channel.history(function(err, messagesPage) {
|
||||
messagesPage.items; // array of Message
|
||||
messagesPage.items[0].data; // payload for first message
|
||||
messagesPage.items.length; // number of messages in the current page of history
|
||||
messagesPage.hasNext(); // true if there are further pages
|
||||
messagesPage.isLast(); // true if this page is the last page
|
||||
messagesPage.next(function(nextPage) { nextPage; }); // retrieves the next page as PaginatedResult
|
||||
});
|
||||
|
||||
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
|
||||
channel.history({ start: Date.now()-10000, end: Date.now(), limit: 100, direction: 'forwards'}, function(err, messagesPage) {
|
||||
console.log(messagesPage.items.length);
|
||||
});
|
||||
|
||||
|
||||
// Presence on a channel
|
||||
// Getting presence:
|
||||
|
||||
channel.presence.get(function(presenceSet) {
|
||||
presenceSet; // array of PresenceMessages
|
||||
});
|
||||
|
||||
// Note that presence#get on a realtime channel does not return a PaginatedResult, as the library maintains a local copy of the presence set.
|
||||
|
||||
// Entering (and leaving) the presence set:
|
||||
|
||||
channel.presence.enter('my status', function(err) {
|
||||
// now I am entered
|
||||
});
|
||||
|
||||
channel.presence.update('new status', function(err) {
|
||||
// my presence data is updated
|
||||
});
|
||||
|
||||
channel.presence.leave(null, function(err) {
|
||||
// I've left the presence set
|
||||
});
|
||||
|
||||
channel.presence.enterClient('myClientId', 'status', function(err) {
|
||||
});
|
||||
|
||||
// and similiarly, updateClient and leaveClient
|
||||
// Querying the Presence History
|
||||
|
||||
channel.presence.history(function(err, messagesPage) { // PaginatedResult
|
||||
messagesPage.items; // array of PresenceMessage
|
||||
messagesPage.items[0].data; // payload for first message
|
||||
messagesPage.items.length; // number of messages in the current page of history
|
||||
messagesPage.hasNext(); // true if there are further pages
|
||||
messagesPage.isLast(); // true if this page is the last page
|
||||
messagesPage.next(function(nextPage) { }); // retrieves the next page as PaginatedResult
|
||||
});
|
||||
|
||||
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
|
||||
channel.history({ start: Date.now()-10000, end: Date.now(), limit: 100, direction: 'forwards' }, function(err, messagesPage) {});
|
||||
|
||||
// Symmetrical end-to-end encrypted payloads on a channel
|
||||
|
||||
// When a 128 bit or 256 bit key is provided to the library, the data attributes of all messages are encrypted and decrypted automatically using that key. The secret key is never transmitted to Ably. See https://www.ably.io/documentation/realtime/encryption
|
||||
|
||||
// Generate a random 256-bit key for demonstration purposes (in
|
||||
// practice you need to create one and distribute it to clients yourselves)
|
||||
Ably.Realtime.Crypto.generateRandomKey(function(err, key) {
|
||||
var channel = client.channels.get('channelName', { cipher: { key: key } });
|
||||
|
||||
channel.subscribe(function(message) {
|
||||
message.name; // 'name is not encrypted'
|
||||
message.data; // 'sensitive data is encrypted'
|
||||
});
|
||||
|
||||
channel.publish('name is not encrypted', 'sensitive data is encrypted');
|
||||
});
|
||||
|
||||
// You can also change the key on an existing channel using setOptions (which takes a callback which is called after the new encryption settings have taken effect):
|
||||
|
||||
channel.setOptions({cipher: {key: '<KEY>'}}, function() {
|
||||
// New encryption settings are in effect
|
||||
});
|
||||
|
||||
// Using the REST API
|
||||
|
||||
var restChannel = restClient.channels.get('test');
|
||||
|
||||
// Publishing to a channel
|
||||
|
||||
// Publish a single message with name and data
|
||||
restChannel.publish('greeting', 'Hello World!');
|
||||
|
||||
// Optionally, you can use a callback to be notified of success or failure
|
||||
restChannel.publish('greeting', 'Hello World!', function(err) {
|
||||
if(err) {
|
||||
console.log('publish failed with error ' + err);
|
||||
} else {
|
||||
console.log('publish succeeded');
|
||||
}
|
||||
})
|
||||
|
||||
// Publish several messages at once
|
||||
restChannel.publish([{name: 'greeting', data: 'Hello World!'}], function() {});
|
||||
|
||||
// Querying the History
|
||||
|
||||
restChannel.history(function(err, messagesPage) {
|
||||
messagesPage; // PaginatedResult
|
||||
messagesPage.items; // array of Message
|
||||
messagesPage.items[0].data; // payload for first message
|
||||
messagesPage.items.length; // number of messages in the current page of history
|
||||
messagesPage.hasNext(); // true if there are further pages
|
||||
messagesPage.isLast(); // true if this page is the last page
|
||||
messagesPage.next(function(nextPage) {}); // retrieves the next page as PaginatedResult
|
||||
});
|
||||
|
||||
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
|
||||
restChannel.history({ start: Date.now()-10000, end: Date.now(), limit: 100, direction: 'forwards' }, function(err, messagesPage) {});
|
||||
|
||||
// Presence on a channel
|
||||
|
||||
restChannel.presence.get(function(err, presencePage) { // PaginatedResult
|
||||
presencePage.items; // array of PresenceMessage
|
||||
presencePage.items[0].data; // payload for first message
|
||||
presencePage.items.length; // number of messages in the current page of members
|
||||
presencePage.hasNext(); // true if there are further pages
|
||||
presencePage.isLast(); // true if this page is the last page
|
||||
presencePage.next(function(nextPage) {}); // retrieves the next page as PaginatedResult
|
||||
});
|
||||
|
||||
// Querying the Presence History
|
||||
|
||||
restChannel.presence.history(function(err, messagesPage) { // PaginatedResult
|
||||
messagesPage.items; // array of PresenceMessage
|
||||
messagesPage.items[0].data; // payload for first message
|
||||
messagesPage.items.length; // number of messages in the current page of history
|
||||
messagesPage.hasNext(); // true if there are further pages
|
||||
messagesPage.isLast(); // true if this page is the last page
|
||||
messagesPage.next(function(nextPage) { }); // retrieves the next page as PaginatedResult
|
||||
});
|
||||
|
||||
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
|
||||
restChannel.history({ start: Date.now()-10000, end: Date.now(), limit: 100, direction: 'forwards' }, function(err, messagesPage) {});
|
||||
|
||||
|
||||
// Generate Token and Token Request
|
||||
// See https://www.ably.io/documentation/general/authentication for an explanation of Ably's authentication mechanism.
|
||||
|
||||
// Requesting a token:
|
||||
|
||||
client.auth.requestToken(function(err, tokenDetails) {
|
||||
// tokenDetails is instance of TokenDetails
|
||||
// see https://www.ably.io/documentation/rest/authentication/#token-details for its properties
|
||||
|
||||
// Now we have the token, we can send it to someone who can instantiate a client with it:
|
||||
var clientUsingToken = new Ably.Realtime(tokenDetails.token);
|
||||
});
|
||||
|
||||
// requestToken can take two optional params
|
||||
// tokenParams: https://www.ably.io/documentation/rest/authentication/#token-params
|
||||
// authOptions: https://www.ably.io/documentation/rest/authentication/#auth-options
|
||||
client.auth.requestToken({}, {}, function(err, tokenDetails) { });
|
||||
|
||||
// Creating a token request (for example, on a server in response to a request by a client using the authCallback or authUrl mechanisms):
|
||||
|
||||
client.auth.createTokenRequest(function(err, tokenRequest) {
|
||||
// now send the tokenRequest back to the client, which will
|
||||
// use it to request a token and connect to Ably
|
||||
});
|
||||
|
||||
// createTokenRequest can take two optional params
|
||||
// tokenParams: https://www.ably.io/documentation/rest/authentication/#token-params
|
||||
// authOptions: https://www.ably.io/documentation/rest/authentication/#auth-options
|
||||
client.auth.createTokenRequest({}, {}, function(err, tokenRequest) { });
|
||||
|
||||
// Fetching your application's stats
|
||||
|
||||
client.stats({ limit: 50 }, function(err, statsPage) { // statsPage as PaginatedResult
|
||||
statsPage.items; // array of Stats
|
||||
statsPage.items[0].inbound.rest.messages.count; // total messages published over REST
|
||||
statsPage.items.length; // number of stats in the current page of history
|
||||
statsPage.hasNext(); // true if there are further pages
|
||||
statsPage.isLast(); // true if this page is the last page
|
||||
statsPage.next(function(nextPage) {}); // retrieves the next page as PaginatedResult
|
||||
});
|
||||
|
||||
// Fetching the Ably service time
|
||||
|
||||
client.time({}, function(err, time) {}); // time is in ms since epoch
|
||||
|
||||
// Getting decoded Message objects from JSON
|
||||
var messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]);
|
||||
console.log(messages[0].id);
|
||||
|
||||
var message = Ably.Rest.Message.fromEncoded({ id: 'foo' });
|
||||
console.log(message.id);
|
||||
|
||||
// Getting decoded PresenceMessage objects from JSON
|
||||
var presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]);
|
||||
console.log(presenceMessages[0].action);
|
||||
|
||||
var presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' });
|
||||
console.log(presenceMessage.action);
|
||||
Vendored
+471
@@ -0,0 +1,471 @@
|
||||
// Type definitions for Ably Realtime and Rest client library 0.9
|
||||
// Project: https://www.ably.io/
|
||||
// Definitions by: Ably <https://github.com/ably/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace ablyLib {
|
||||
namespace ChannelState {
|
||||
type INITIALIZED = 'initialized';
|
||||
type ATTACHING = 'attaching';
|
||||
type ATTACHED = "attached";
|
||||
type DETACHING = "detaching";
|
||||
type DETACHED = "detached";
|
||||
type SUSPENDED = "suspended";
|
||||
type FAILED = "failed";
|
||||
}
|
||||
type ChannelState = ChannelState.FAILED | ChannelState.INITIALIZED | ChannelState.SUSPENDED | ChannelState.ATTACHED | ChannelState.ATTACHING | ChannelState.DETACHED | ChannelState.DETACHING;
|
||||
|
||||
namespace ConnectionState {
|
||||
type INITIALIZED = "initialized";
|
||||
type CONNECTING = "connecting";
|
||||
type CONNECTED = "connected";
|
||||
type DISCONNECTED = "disconnected";
|
||||
type SUSPENDED = "suspended";
|
||||
type CLOSING = "closing";
|
||||
type CLOSED = "closed";
|
||||
type FAILED = "failed";
|
||||
}
|
||||
type ConnectionState = ConnectionState.INITIALIZED | ConnectionState.CONNECTED | ConnectionState.CONNECTING | ConnectionState.DISCONNECTED | ConnectionState.SUSPENDED | ConnectionState.CLOSED | ConnectionState.CLOSING | ConnectionState.FAILED;
|
||||
|
||||
namespace ConnectionEvent {
|
||||
type INITIALIZED = "initialized";
|
||||
type CONNECTING = "connecting";
|
||||
type CONNECTED = "connected";
|
||||
type DISCONNECTED = "disconnected";
|
||||
type SUSPENDED = "suspended";
|
||||
type CLOSING = "closing";
|
||||
type CLOSED = "closed";
|
||||
type FAILED = "failed";
|
||||
type UPDATE = "update";
|
||||
}
|
||||
type ConnectionEvent = ConnectionEvent.INITIALIZED | ConnectionEvent.CONNECTED | ConnectionEvent.CONNECTING | ConnectionEvent.DISCONNECTED | ConnectionEvent.SUSPENDED | ConnectionEvent.CLOSED | ConnectionEvent.CLOSING | ConnectionEvent.FAILED | ConnectionEvent.UPDATE;
|
||||
|
||||
namespace PresenceAction {
|
||||
type ABSENT = "absent";
|
||||
type PRESENT = "present";
|
||||
type ENTER = "enter";
|
||||
type LEAVE = "leave";
|
||||
type UPDATE = "update";
|
||||
}
|
||||
type PresenceAction = PresenceAction.ABSENT | PresenceAction.PRESENT | PresenceAction.ENTER | PresenceAction.LEAVE | PresenceAction.UPDATE;
|
||||
|
||||
namespace StatsIntervalGranularity {
|
||||
type MINUTE = "minute";
|
||||
type HOUR = "hour";
|
||||
type DAY = "day";
|
||||
type MONTH = "month";
|
||||
}
|
||||
type StatsIntervalGranularity = StatsIntervalGranularity.MINUTE | StatsIntervalGranularity.HOUR | StatsIntervalGranularity.DAY | StatsIntervalGranularity.MONTH;
|
||||
|
||||
namespace HTTPMethods {
|
||||
type POST = "POST";
|
||||
type GET = "GET";
|
||||
}
|
||||
type HTTPMethods = HTTPMethods.GET | HTTPMethods.POST;
|
||||
|
||||
// Interfaces
|
||||
interface ClientOptions extends AuthOptions {
|
||||
/**
|
||||
* When true will automatically connect to Ably when library is instanced. This is true by default
|
||||
*/
|
||||
autoConnect?: boolean;
|
||||
|
||||
/**
|
||||
* Optional clientId that can be used to specify the identity for this client. In most cases
|
||||
* it is preferable to instead specift a clientId in the token issued to this client.
|
||||
*/
|
||||
clientId?: string;
|
||||
|
||||
defaultTokenParams?: TokenParams;
|
||||
|
||||
/**
|
||||
* When true, messages published on channels by this client will be echoed back to this client.
|
||||
* This is true by default
|
||||
*/
|
||||
echoMessages?: boolean;
|
||||
|
||||
/**
|
||||
* Use this only if you have been provided a dedicated environment by Ably
|
||||
*/
|
||||
environment?: string;
|
||||
|
||||
/**
|
||||
* Logger configuration
|
||||
*/
|
||||
log?: LogInfo;
|
||||
port?: number;
|
||||
|
||||
/**
|
||||
* When true, messages will be queued whilst the connection is disconnected. True by default.
|
||||
*/
|
||||
queueMessages?: boolean;
|
||||
|
||||
restHost?: string;
|
||||
realtimeHost?: string;
|
||||
fallbackHosts?: string[];
|
||||
|
||||
/**
|
||||
* Can be used to explicitly recover a connection.
|
||||
* See https://www.ably.io/documentation/realtime/connection#connection-state-recovery
|
||||
*/
|
||||
recover?: standardCallback | string;
|
||||
|
||||
/**
|
||||
* Use a non-secure connection connection. By default, a TLS connection is used to connect to Ably
|
||||
*/
|
||||
tls?: boolean;
|
||||
tlsPort?: number;
|
||||
|
||||
/**
|
||||
* When true, the more efficient MsgPack binary encoding is used.
|
||||
* When false, JSON text encoding is used.
|
||||
*/
|
||||
useBinaryProtocol?: boolean;
|
||||
}
|
||||
|
||||
interface AuthOptions {
|
||||
/**
|
||||
* A function which is called when a new token is required.
|
||||
* The role of the callback is to either generate a signed TokenRequest which may then be submitted automatically
|
||||
* by the library to the Ably REST API requestToken; or to provide a valid token in as a TokenDetails object.
|
||||
**/
|
||||
authCallback?: (data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void) => void;
|
||||
authHeaders?: { [index: string]: string };
|
||||
authMethod?: HTTPMethods;
|
||||
authParams?: { [index: string]: string };
|
||||
|
||||
/**
|
||||
* A URL that the library may use to obtain a token string (in plain text format), or a signed TokenRequest or TokenDetails (in JSON format).
|
||||
**/
|
||||
authUrl?: string;
|
||||
key?: string;
|
||||
queryTime?: boolean;
|
||||
token?: TokenDetails | string;
|
||||
tokenDetails?: TokenDetails;
|
||||
useTokenAuth?: boolean;
|
||||
}
|
||||
|
||||
interface TokenParams {
|
||||
capability?: string;
|
||||
clientId?: string;
|
||||
nonce?: string;
|
||||
timestamp?: number;
|
||||
ttl?: number;
|
||||
}
|
||||
|
||||
interface CipherParams {
|
||||
algorithm: string;
|
||||
key: any;
|
||||
keyLength: number;
|
||||
mode: string;
|
||||
}
|
||||
|
||||
interface ErrorInfo {
|
||||
code: number;
|
||||
message: string;
|
||||
statusCode: number;
|
||||
}
|
||||
|
||||
interface StatsMessageCount {
|
||||
count: number;
|
||||
data: number;
|
||||
}
|
||||
|
||||
interface StatsMessageTypes {
|
||||
all: StatsMessageCount;
|
||||
messages: StatsMessageCount;
|
||||
presence: StatsMessageCount;
|
||||
}
|
||||
|
||||
interface StatsRequestCount {
|
||||
failed: number;
|
||||
refused: number;
|
||||
succeeded: number;
|
||||
}
|
||||
|
||||
interface StatsResourceCount {
|
||||
mean: number;
|
||||
min: number;
|
||||
opened: number;
|
||||
peak: number;
|
||||
refused: number;
|
||||
}
|
||||
|
||||
interface StatsConnectionTypes {
|
||||
all: StatsResourceCount;
|
||||
plain: StatsResourceCount;
|
||||
tls: StatsResourceCount;
|
||||
}
|
||||
|
||||
interface StatsMessageTraffic {
|
||||
all: StatsMessageTypes;
|
||||
realtime: StatsMessageTypes;
|
||||
rest: StatsMessageTypes;
|
||||
webhook: StatsMessageTypes;
|
||||
}
|
||||
|
||||
interface TokenDetails {
|
||||
capability: string;
|
||||
clientId?: string;
|
||||
expires: number;
|
||||
issued: number;
|
||||
token: string;
|
||||
}
|
||||
|
||||
interface TokenRequest {
|
||||
capability: string;
|
||||
clientId?: string;
|
||||
keyName: string;
|
||||
mac: string;
|
||||
nonce: string;
|
||||
timestamp: number;
|
||||
ttl?: number;
|
||||
}
|
||||
|
||||
interface ChannelOptions {
|
||||
cipher: any;
|
||||
}
|
||||
|
||||
interface RestPresenceHistoryParams {
|
||||
start?: number;
|
||||
end?: number;
|
||||
direction?: string;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
interface RestPresenceParams {
|
||||
limit?: number;
|
||||
clientId?: string;
|
||||
connectionId?: string;
|
||||
}
|
||||
|
||||
interface RealtimePresenceParams {
|
||||
waitForSync?: boolean;
|
||||
clientId?: string;
|
||||
connectionId?: string;
|
||||
}
|
||||
|
||||
interface RealtimePresenceHistoryParams {
|
||||
start?: number;
|
||||
end?: number;
|
||||
direction?: string;
|
||||
limit?: number;
|
||||
untilAttach?: boolean;
|
||||
}
|
||||
|
||||
interface LogInfo {
|
||||
/**
|
||||
* A number controlling the verbosity of the output. Valid values are: 0 (no logs), 1 (errors only),
|
||||
* 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output).
|
||||
**/
|
||||
level?: number;
|
||||
|
||||
/**
|
||||
* A function to handle each line of log output. If handler is not specified, console.log is used.
|
||||
**/
|
||||
handler?: (...args: any[]) => void;
|
||||
}
|
||||
|
||||
interface ChannelEvent {
|
||||
state: ChannelState;
|
||||
}
|
||||
|
||||
interface ChannelStateChange {
|
||||
current: ChannelState;
|
||||
previous: ChannelState;
|
||||
reason?: ErrorInfo;
|
||||
resumed: boolean;
|
||||
}
|
||||
|
||||
interface ConnectionStateChange {
|
||||
current: ConnectionState;
|
||||
previous: ConnectionState;
|
||||
reason?: ErrorInfo;
|
||||
retryIn?: number;
|
||||
}
|
||||
|
||||
// Common Listeners
|
||||
type paginatedResultCallback<T> = (error: ErrorInfo, results: PaginatedResult<T> ) => void;
|
||||
type standardCallback = (error: ErrorInfo, results: any) => void;
|
||||
type messageCallback<T> = (message: T) => void;
|
||||
type errorCallback = (error: ErrorInfo) => void;
|
||||
type channelEventCallback = (channelEvent: ChannelEvent, changeStateChange: ChannelStateChange) => void;
|
||||
type connectionEventCallback = (connectionEvent: ConnectionEvent, connectionStateChange: ConnectionStateChange) => void;
|
||||
type timeCallback = (error: ErrorInfo, time: number) => void;
|
||||
type realtimePresenceGetCallback = (error: ErrorInfo, messages: PresenceMessage[]) => void;
|
||||
type tokenDetailsCallback = (error: ErrorInfo, Results: TokenDetails) => void;
|
||||
type tokenRequestCallback = (error: ErrorInfo, Results: TokenRequest) => void;
|
||||
type fromEncoded<T> = (JsonObject: any, channelOptions?: ChannelOptions) => T;
|
||||
type fromEncodedArray<T> = (JsonArray: any[], channelOptions?: ChannelOptions) => T[];
|
||||
|
||||
// Internal Classes
|
||||
class EventEmitter<T> {
|
||||
on: (eventOrCallback: string | T, callback?: T) => void;
|
||||
once: (eventOrCallback: string | T, callback?: T) => void;
|
||||
off: (eventOrCallback?: string | T, callback?: T) => void;
|
||||
}
|
||||
|
||||
// Classes
|
||||
class Auth {
|
||||
clientId: string;
|
||||
authorize: (tokenParams?: TokenParams | tokenDetailsCallback, authOptions?: AuthOptions | tokenDetailsCallback, callback?: tokenDetailsCallback) => void;
|
||||
createTokenRequest: (tokenParams?: TokenParams | tokenRequestCallback, authOptions?: AuthOptions | tokenRequestCallback, callback?: tokenRequestCallback) => void;
|
||||
requestToken: (TokenParams?: TokenParams | tokenDetailsCallback, authOptions?: AuthOptions | tokenDetailsCallback, callback?: tokenDetailsCallback) => void;
|
||||
}
|
||||
|
||||
class Presence {
|
||||
get: (params: RestPresenceParams | paginatedResultCallback<PresenceMessage>, callback?: paginatedResultCallback<PresenceMessage>) => void;
|
||||
history: (params: RestPresenceHistoryParams | paginatedResultCallback<PresenceMessage>, callback?: paginatedResultCallback<PresenceMessage>) => void;
|
||||
}
|
||||
|
||||
class RealtimePresence {
|
||||
syncComplete: () => boolean;
|
||||
get: (Params: realtimePresenceGetCallback | RealtimePresenceParams, callback?: realtimePresenceGetCallback) => void;
|
||||
history: (ParamsOrCallback: RealtimePresenceHistoryParams | paginatedResultCallback<PresenceMessage>, callback?: paginatedResultCallback<PresenceMessage>) => void;
|
||||
subscribe: (presenceOrCallback: PresenceAction | messageCallback<PresenceMessage>, listener?: messageCallback<PresenceMessage>) => void;
|
||||
unsubscribe: (presence?: PresenceAction, listener?: messageCallback<PresenceMessage>) => void;
|
||||
enter: (data?: errorCallback | any, callback?: errorCallback) => void;
|
||||
update: (data?: errorCallback | any, callback?: errorCallback) => void;
|
||||
leave: (data?: errorCallback | any, callback?: errorCallback) => void;
|
||||
enterClient: (clientId: string, data?: errorCallback | any, callback?: errorCallback) => void;
|
||||
updateClient: (clientId: string, data?: errorCallback | any, callback?: errorCallback) => void;
|
||||
leaveClient: (clientId: string, data?: errorCallback | any, callback?: errorCallback) => void;
|
||||
}
|
||||
|
||||
class Channel {
|
||||
name: string;
|
||||
presence: Presence;
|
||||
history: (paramsOrCallback?: RestPresenceHistoryParams | paginatedResultCallback<Message>, callback?: paginatedResultCallback<Message>) => void;
|
||||
publish: (messagesOrName: any, messagedataOrCallback?: errorCallback | any, callback?: errorCallback) => void;
|
||||
}
|
||||
|
||||
class RealtimeChannel extends EventEmitter<channelEventCallback> {
|
||||
name: string;
|
||||
errorReason: ErrorInfo;
|
||||
state: ChannelState;
|
||||
presence: RealtimePresence;
|
||||
attach: (callback?: standardCallback) => void;
|
||||
detach: (callback?: standardCallback) => void;
|
||||
history: (paramsOrCallback?: RealtimePresenceHistoryParams | paginatedResultCallback<Message>, callback?: paginatedResultCallback<Message>) => void;
|
||||
subscribe: (eventOrCallback: messageCallback<Message> | string, listener?: messageCallback<Message>) => void;
|
||||
unsubscribe: (eventOrCallback?: messageCallback<Message> | string, listener?: messageCallback<Message>) => void;
|
||||
publish: (messagesOrName: any, messageDataOrCallback?: errorCallback | any, callback?: errorCallback) => void;
|
||||
setOptions: (options: any, callback?: errorCallback) => void;
|
||||
}
|
||||
|
||||
class Channels<T> {
|
||||
get: (name: string, channelOptions?: ChannelOptions) => T;
|
||||
release: (name: string) => void;
|
||||
}
|
||||
|
||||
class Message {
|
||||
constructor();
|
||||
static fromEncoded: fromEncoded<Message>;
|
||||
static fromEncodedArray: fromEncodedArray<Message>;
|
||||
clientId: string;
|
||||
connectionId: string;
|
||||
data: any;
|
||||
encoding: string;
|
||||
extras: any;
|
||||
id: string;
|
||||
name: string;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
interface MessageStatic {
|
||||
fromEncoded: fromEncoded<Message>;
|
||||
fromEncodedArray: fromEncodedArray<Message>;
|
||||
}
|
||||
|
||||
class PresenceMessage {
|
||||
constructor();
|
||||
static fromEncoded: fromEncoded<PresenceMessage>;
|
||||
static fromEncodedArray: fromEncodedArray<PresenceMessage>;
|
||||
action: PresenceAction;
|
||||
clientId: string;
|
||||
connectionId: string;
|
||||
data: any;
|
||||
encoding: string;
|
||||
id: string;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
interface PresenceMessageStatic {
|
||||
fromEncoded: fromEncoded<PresenceMessage>;
|
||||
fromEncodedArray: fromEncodedArray<PresenceMessage>;
|
||||
}
|
||||
|
||||
interface Crypto {
|
||||
generateRandomKey: (callback: (error: ErrorInfo, key: string) => void) => void;
|
||||
}
|
||||
|
||||
class Connection extends EventEmitter<connectionEventCallback> {
|
||||
errorReason: ErrorInfo;
|
||||
id: string;
|
||||
key: string;
|
||||
recoveryKey: string;
|
||||
serial: number;
|
||||
state: ConnectionState;
|
||||
close: () => void;
|
||||
connect: () => void;
|
||||
ping: (callback?: (error: ErrorInfo, responseTime: number ) => void ) => void;
|
||||
}
|
||||
|
||||
class Stats {
|
||||
all: StatsMessageTypes;
|
||||
apiRequests: StatsRequestCount;
|
||||
channels: StatsResourceCount;
|
||||
connections: StatsConnectionTypes;
|
||||
inbound: StatsMessageTraffic;
|
||||
intervalId: string;
|
||||
outbound: StatsMessageTraffic;
|
||||
persisted: StatsMessageTypes;
|
||||
tokenRequests: StatsRequestCount;
|
||||
}
|
||||
|
||||
class PaginatedResult<T> {
|
||||
items: T[];
|
||||
first: (results: paginatedResultCallback<T>) => void;
|
||||
next: (results: paginatedResultCallback<T>) => void;
|
||||
current: (results: paginatedResultCallback<T>) => void;
|
||||
hasNext: () => boolean;
|
||||
isLast: () => boolean;
|
||||
}
|
||||
|
||||
class HttpPaginatedResponse extends PaginatedResult<any> {
|
||||
items: string[];
|
||||
statusCode: number;
|
||||
success: boolean;
|
||||
errorCode: number;
|
||||
errorMessage: string;
|
||||
headers: any;
|
||||
}
|
||||
}
|
||||
|
||||
export declare class Rest {
|
||||
constructor(options: ablyLib.ClientOptions | string);
|
||||
static Crypto: ablyLib.Crypto;
|
||||
static Message: ablyLib.MessageStatic;
|
||||
static PresenceMessage: ablyLib.PresenceMessageStatic;
|
||||
auth: ablyLib.Auth;
|
||||
channels: ablyLib.Channels<ablyLib.Channel>;
|
||||
request: (method: string, path: string, params?: any, body?: any[] | any, headers?: any, callback?: (error: ablyLib.ErrorInfo, response: ablyLib.HttpPaginatedResponse) => void) => void;
|
||||
stats: (paramsOrCallback?: ablyLib.paginatedResultCallback<ablyLib.Stats> | any, callback?: ablyLib.paginatedResultCallback<ablyLib.Stats>) => void;
|
||||
time: (paramsOrCallback?: ablyLib.timeCallback | any, callback?: ablyLib.timeCallback) => void;
|
||||
}
|
||||
|
||||
export declare class Realtime {
|
||||
constructor(options: ablyLib.ClientOptions | string);
|
||||
static Crypto: ablyLib.Crypto;
|
||||
static Message: ablyLib.MessageStatic;
|
||||
static PresenceMessage: ablyLib.PresenceMessageStatic;
|
||||
auth: ablyLib.Auth;
|
||||
channels: ablyLib.Channels<ablyLib.RealtimeChannel>;
|
||||
clientId: string;
|
||||
connection: ablyLib.Connection;
|
||||
request: (method: string, path: string, params?: any, body?: any[] | any, headers?: any, callback?: (error: ablyLib.ErrorInfo, response: ablyLib.HttpPaginatedResponse) => void) => void;
|
||||
stats: (paramsOrCallback?: ablyLib.paginatedResultCallback<ablyLib.Stats> | any, callback?: ablyLib.paginatedResultCallback<ablyLib.Stats>) => void;
|
||||
close: () => void;
|
||||
connect: () => void;
|
||||
time: (paramsOrCallback?: ablyLib.timeCallback | any, callback?: ablyLib.timeCallback) => void;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ably-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+1
@@ -106,6 +106,7 @@ declare module 'angular' {
|
||||
onComplete?: Function;
|
||||
onRemoving?: Function;
|
||||
skipHide?: boolean;
|
||||
multiple?: boolean;
|
||||
fullscreen?: boolean; // default: false
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -51,8 +51,8 @@ declare module 'angular' {
|
||||
cloakClassName(name: string): ITranslateProvider;
|
||||
fallbackLanguage(langKey?: string): string;
|
||||
fallbackLanguage(langKey?: string[]): string;
|
||||
instant(translationId: string, interpolateParams?: any, interpolationId?: string): string;
|
||||
instant(translationId: string[], interpolateParams?: any, interpolationId?: string): { [key: string]: string };
|
||||
instant(translationId: string, interpolateParams?: any, interpolationId?: string, forceLanguage?: string, sanitizeStrategy?: string): string;
|
||||
instant(translationId: string[], interpolateParams?: any, interpolationId?: string, forceLanguage?: string, sanitizeStrategy?: string): { [key: string]: string };
|
||||
isPostCompilingEnabled(): boolean;
|
||||
preferredLanguage(langKey?: string): string;
|
||||
proposedLanguage(): string;
|
||||
|
||||
@@ -155,6 +155,7 @@ testApp.config((
|
||||
placement: 'bottom',
|
||||
animation: false,
|
||||
popupDelay: 1000,
|
||||
popupCloseDelay: 1000,
|
||||
appendToBody: true,
|
||||
trigger: 'mouseenter hover',
|
||||
useContentExp: true,
|
||||
|
||||
Vendored
+9
-2
@@ -161,7 +161,7 @@ declare module 'angular' {
|
||||
|
||||
/**
|
||||
* Defines the initial date, when no model value is specified.
|
||||
*
|
||||
*
|
||||
* @default null
|
||||
*/
|
||||
initDate?: any;
|
||||
@@ -834,12 +834,19 @@ declare module 'angular' {
|
||||
animation?: boolean;
|
||||
|
||||
/**
|
||||
* For how long should the user have to have the mouse over the element before the tooltip shows (in milliseconds)?
|
||||
* Popup delay in milliseconds until it opens.
|
||||
*
|
||||
* @default 0
|
||||
*/
|
||||
popupDelay?: number;
|
||||
|
||||
/**
|
||||
* For how long should the tooltip remain open after the close trigger event?
|
||||
*
|
||||
* @default 0
|
||||
*/
|
||||
popupCloseDelay?: number;
|
||||
|
||||
/**
|
||||
* Should the tooltip be appended to `$body` instead of the parent element?
|
||||
*
|
||||
|
||||
@@ -143,7 +143,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
private $state: ng.ui.IStateService
|
||||
) {
|
||||
$rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event));
|
||||
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
|
||||
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
|
||||
this.onStateNotFound(event, unfoundState, fromState, fromParams));
|
||||
}
|
||||
|
||||
@@ -157,8 +157,8 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
|
||||
// Note that we do not concern ourselves with what to do if this request fails,
|
||||
// because if it fails, the web page will be redirected away to the login screen.
|
||||
this.$http({ url: "/api/me", method: "GET" }).success((user: any) => {
|
||||
this.currentUser = user;
|
||||
this.$http({ url: "/api/me", method: "GET" }).then((response: ng.IHttpPromiseCallbackArg<any>) => {
|
||||
this.currentUser = response.data;
|
||||
|
||||
// sync the ui-state with the location in the browser, which effectively
|
||||
// restarts the state change that was stopped previously
|
||||
@@ -166,14 +166,14 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private onStateNotFound(event: ng.IAngularEvent,
|
||||
unfoundState: ng.ui.IUnfoundState,
|
||||
fromState: ng.ui.IState,
|
||||
fromParams: {}) {
|
||||
var unfoundTo: string = unfoundState.to;
|
||||
var unfoundToParams: {} = unfoundState.toParams;
|
||||
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
|
||||
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
|
||||
}
|
||||
|
||||
private stateServiceTest() {
|
||||
|
||||
@@ -108,11 +108,6 @@ namespace HttpAndRegularPromiseTests {
|
||||
}
|
||||
|
||||
function someController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) {
|
||||
$http.get<ExpectedResponse>('http://somewhere/some/resource')
|
||||
.success((data: ExpectedResponse) => {
|
||||
$scope.person = data;
|
||||
});
|
||||
|
||||
$http.get<ExpectedResponse>('http://somewhere/some/resource')
|
||||
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
|
||||
// typing lost, so something like
|
||||
@@ -156,21 +151,6 @@ namespace HttpAndRegularPromiseTests {
|
||||
$scope.nothing = 'really nothing';
|
||||
});
|
||||
}
|
||||
|
||||
// Test that we can pass around a type-checked success/error Promise Callback
|
||||
function anotherController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) {
|
||||
function buildFooData(): ng.IRequestShortcutConfig {
|
||||
return {};
|
||||
}
|
||||
|
||||
function doFoo(callback: ng.IHttpPromiseCallback<ExpectedResponse>) {
|
||||
$http
|
||||
.get<ExpectedResponse>('/foo', buildFooData())
|
||||
.success(callback);
|
||||
};
|
||||
|
||||
doFoo((data: any) => console.log(data));
|
||||
};
|
||||
}
|
||||
|
||||
// Test for AngularJS Syntax
|
||||
@@ -441,10 +421,10 @@ httpFoo.then((x) => {
|
||||
x.toFixed();
|
||||
});
|
||||
|
||||
httpFoo.success((data, status, headers, config) => {
|
||||
const h = headers('test');
|
||||
httpFoo.then((response: ng.IHttpPromiseCallbackArg<any>) => {
|
||||
const h = response.headers('test');
|
||||
h.charAt(0);
|
||||
const hs = headers();
|
||||
const hs = response.headers();
|
||||
hs['content-type'].charAt(1);
|
||||
});
|
||||
|
||||
|
||||
Vendored
-12
@@ -1505,18 +1505,6 @@ declare namespace angular {
|
||||
}
|
||||
|
||||
interface IHttpPromise<T> extends IPromise<IHttpPromiseCallbackArg<T>> {
|
||||
/**
|
||||
* The $http legacy promise methods success and error have been deprecated. Use the standard then method instead.
|
||||
* If $httpProvider.useLegacyPromiseExtensions is set to false then these methods will throw $http/legacy error.
|
||||
* @deprecated
|
||||
*/
|
||||
success?(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
|
||||
/**
|
||||
* The $http legacy promise methods success and error have been deprecated. Use the standard then method instead.
|
||||
* If $httpProvider.useLegacyPromiseExtensions is set to false then these methods will throw $http/legacy error.
|
||||
* @deprecated
|
||||
*/
|
||||
error?(callback: IHttpPromiseCallback<any>): IHttpPromise<T>;
|
||||
}
|
||||
|
||||
// See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference types="auth0-js" />
|
||||
import 'auth0-js';
|
||||
|
||||
let webAuth = new auth0.WebAuth({
|
||||
domain: 'mine.auth0.com',
|
||||
|
||||
Vendored
+3
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Auth0.js v8.1.3
|
||||
// Type definitions for Auth0.js 8.1
|
||||
// Project: https://github.com/auth0/auth0.js
|
||||
// Definitions by: Adrian Chia <https://github.com/adrianchia>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -409,7 +409,7 @@ declare namespace auth0 {
|
||||
|
||||
interface Auth0Error {
|
||||
error: any;
|
||||
errorDescription: string
|
||||
errorDescription: string;
|
||||
}
|
||||
|
||||
interface Auth0DecodedHash {
|
||||
@@ -442,7 +442,7 @@ declare namespace auth0 {
|
||||
connection: string;
|
||||
send: string;
|
||||
phoneNumber?: string;
|
||||
email?: string,
|
||||
email?: string;
|
||||
authParams?: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"auth0-js-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/// <reference types="auth0-js/v7" />
|
||||
import 'auth0-js';
|
||||
|
||||
var auth0 = new Auth0({
|
||||
domain: 'mine.auth0.com',
|
||||
clientID: 'dsa7d77dsa7d7',
|
||||
|
||||
Vendored
+7
-7
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Auth0.js v7.x
|
||||
// Type definitions for Auth0.js 7.0
|
||||
// Project: https://github.com/auth0/auth0.js
|
||||
// Definitions by: Robert McLaws <https://github.com/advancedrei>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -13,20 +13,20 @@ interface Window {
|
||||
interface Auth0Static {
|
||||
|
||||
new(options: Auth0ClientOptions): Auth0Static;
|
||||
changePassword(options: any, callback?: Function): void;
|
||||
changePassword(options: any, callback?: (error?: Auth0Error, valid?: any) => void): void;
|
||||
decodeJwt(jwt: string): any;
|
||||
login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
|
||||
loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
|
||||
loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void;
|
||||
loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
|
||||
logout(query: string): void;
|
||||
getConnections(callback?: Function): void;
|
||||
getConnections(callback?: (error?: Auth0Error, valid?: any) => void): void;
|
||||
refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
|
||||
getDelegationToken(options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
|
||||
getProfile(id_token: string, callback?: Function): Auth0UserProfile;
|
||||
getSSOData(withActiveDirectories: any, callback?: Function): void;
|
||||
getProfile(id_token: string, callback?: (error?: Auth0Error, valid?: any) => void): Auth0UserProfile;
|
||||
getSSOData(withActiveDirectories: any, callback?: (error?: Auth0Error, valid?: any) => void): void;
|
||||
parseHash(hash: string): Auth0DecodedHash;
|
||||
signup(options: Auth0SignupOptions, callback: Function): void;
|
||||
signup(options: Auth0SignupOptions, callback: (error?: Auth0Error, valid?: any) => void): void;
|
||||
validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void;
|
||||
}
|
||||
|
||||
@@ -132,5 +132,5 @@ interface Auth0DelegationToken {
|
||||
declare const Auth0: Auth0Static;
|
||||
|
||||
declare module "auth0-js" {
|
||||
export = Auth0
|
||||
export = Auth0;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"auth0-js": [
|
||||
"auth0-js/v7"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"paths": {
|
||||
"auth0-js": ["auth0-js/v7"],
|
||||
"auth0-js/*": ["auth0-js/v7/*"]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/// <reference types="auth0-js/v7" />
|
||||
/// <reference path="index.d.ts" />
|
||||
import 'auth0-js/v7';
|
||||
import Auth0Lock from 'auth0-lock';
|
||||
|
||||
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";
|
||||
const DOMAIN = "YOUR_DOMAIN_AT.auth0.com";
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@types/auth0-js": "latest"
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"auth0-lock-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// <reference types="auth0-js/v7" />
|
||||
|
||||
import 'auth0-js/v7';
|
||||
|
||||
var widget: Auth0WidgetStatic = new Auth0Widget({
|
||||
domain: 'mine.auth0.com',
|
||||
|
||||
Vendored
-1
@@ -5,7 +5,6 @@
|
||||
|
||||
/// <reference types="auth0-js/v7" />
|
||||
|
||||
|
||||
interface Auth0WidgetStatic {
|
||||
new(params: Auth0Constructor): Auth0WidgetStatic;
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@types/auth0-js": "latest"
|
||||
}
|
||||
}
|
||||
@@ -19,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"auth0.widget-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+341
-22
@@ -1,6 +1,6 @@
|
||||
// Type definitions for auth0 v2.3.1
|
||||
// Type definitions for auth0 2.4
|
||||
// Project: https://github.com/auth0/node-auth0
|
||||
// Definitions by: Seth Westphal <https://github.com/westy92>
|
||||
// Definitions by: Wilson Hobbs <https://github.com/wbhob>, Seth Westphal <https://github.com/westy92>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as Promise from 'bluebird';
|
||||
@@ -10,8 +10,8 @@ export interface ManagementClientOptions {
|
||||
domain?: string;
|
||||
}
|
||||
|
||||
export type UserMetadata = {};
|
||||
export type AppMetadata = {};
|
||||
export interface UserMetadata { }
|
||||
export interface AppMetadata { }
|
||||
|
||||
export interface UserData {
|
||||
connection: string;
|
||||
@@ -71,34 +71,353 @@ export interface UpdateUserParameters {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export class ManagementClient {
|
||||
constructor(options: ManagementClientOptions);
|
||||
|
||||
getUsers(params?: GetUsersData): Promise<User[]>;
|
||||
getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
|
||||
createUser(data: UserData): Promise<User>;
|
||||
createUser(data: UserData, cb: (err: Error, data: User) => void): void;
|
||||
updateUser(params: UpdateUserParameters, data: User): Promise<User>;
|
||||
updateUser(params: UpdateUserParameters, data: User, cb: (err: Error, data: User) => void): void;
|
||||
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata): Promise<User>;
|
||||
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata, cb: (err: Error, data: User) => void): void
|
||||
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata): Promise<User>;
|
||||
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata, cb: (err: Error, data: User) => void): void
|
||||
}
|
||||
|
||||
export interface AuthenticationClientOptions {
|
||||
clientId?: string;
|
||||
domain: string;
|
||||
}
|
||||
|
||||
export interface RequestChangePasswordEmailData {
|
||||
interface Environment {
|
||||
name: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface ClientInfo {
|
||||
name: string;
|
||||
version: string;
|
||||
dependencies: any[];
|
||||
environment: Environment[];
|
||||
}
|
||||
|
||||
export interface RequestEmailOptions {
|
||||
email: string;
|
||||
authParams: {};
|
||||
}
|
||||
|
||||
export interface RequestSMSOptions {
|
||||
phone_number: string;
|
||||
}
|
||||
|
||||
export interface VerifyOptions {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface DelegationTokenOptions {
|
||||
id_token: string;
|
||||
api_type: string;
|
||||
scope: string;
|
||||
target: string;
|
||||
grant_type: string;
|
||||
}
|
||||
|
||||
export interface ResetPasswordOptions {
|
||||
connection: string;
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface ResetPasswordEmailOptions {
|
||||
email: string;
|
||||
connection: string;
|
||||
}
|
||||
|
||||
export interface ObjectWithId {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface Data {
|
||||
name?: string;
|
||||
[propName: string]: any;
|
||||
}
|
||||
|
||||
export interface ClientParams {
|
||||
client_id: string;
|
||||
}
|
||||
|
||||
export interface DeleteMultifactorParams {
|
||||
id: string;
|
||||
provider: string;
|
||||
}
|
||||
|
||||
export interface LinkAccountsParams {
|
||||
id: string;
|
||||
provider: string;
|
||||
user_id: string;
|
||||
}
|
||||
|
||||
export interface LinkAccountsData {
|
||||
user_id: string;
|
||||
connection_id: string;
|
||||
}
|
||||
|
||||
export interface Token {
|
||||
aud: string;
|
||||
jti: string;
|
||||
}
|
||||
|
||||
export interface StatsParams {
|
||||
from: string;
|
||||
to: string;
|
||||
}
|
||||
|
||||
export interface ImportUsersOptions {
|
||||
connection_id: string;
|
||||
users: string;
|
||||
}
|
||||
|
||||
export interface UserIdParams {
|
||||
user_id: string;
|
||||
}
|
||||
|
||||
export interface PasswordChangeTicketParams {
|
||||
result_url: string;
|
||||
user_id: string;
|
||||
email: string;
|
||||
new_password: string;
|
||||
}
|
||||
|
||||
export interface EmailVerificationTicketOptions {
|
||||
user_id: string;
|
||||
result_url: string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export class AuthenticationClient {
|
||||
constructor(options: AuthenticationClientOptions);
|
||||
getClientInfo(): ClientInfo;
|
||||
|
||||
requestMagicLink(data: RequestEmailOptions): Promise<any>;
|
||||
requestMagicLink(data: RequestEmailOptions, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
requestEmailCode(data: RequestEmailOptions): Promise<any>;
|
||||
requestEmailCode(data: RequestEmailOptions, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
requestSMSCode(data: RequestSMSOptions): Promise<any>;
|
||||
requestSMSCode(data: RequestSMSOptions, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
verifyEmailCode(data: VerifyOptions): Promise<any>;
|
||||
verifyEmailCode(data: VerifyOptions, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
verifySMSCode(data: VerifyOptions): Promise<any>;
|
||||
verifySMSCode(data: VerifyOptions, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
getDelegationToken(data: DelegationTokenOptions): Promise<any>;
|
||||
getDelegationToken(data: DelegationTokenOptions, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
changePassword(data: ResetPasswordOptions): Promise<any>;
|
||||
changePassword(data: ResetPasswordOptions, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
requestChangePasswordEmail(data: ResetPasswordEmailOptions): Promise<any>;
|
||||
requestChangePasswordEmail(data: ResetPasswordEmailOptions, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
getProfile(accessToken: string): Promise<any>;
|
||||
getProfile(accessToken: string, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
getCredentialsGrant(scope: string): Promise<any>;
|
||||
getCredentialsGrant(scope: string, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
export class ManagementClient {
|
||||
constructor(options: ManagementClientOptions);
|
||||
|
||||
getClientInfo(): ClientInfo;
|
||||
|
||||
// Connections
|
||||
getConnections(): Promise<User>;
|
||||
getConnections(cb: (err: Error, data: any) => void): void;
|
||||
|
||||
createConnection(data: ObjectWithId): Promise<User>;
|
||||
createConnection(data: ObjectWithId, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
getConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
|
||||
getConnection(params: ObjectWithId): Promise<User>;
|
||||
|
||||
deleteConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
|
||||
deleteConnection(params: ObjectWithId): Promise<User>;
|
||||
|
||||
deleteConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
|
||||
deleteConnection(params: ObjectWithId): Promise<User>;
|
||||
|
||||
updateConnection(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void;
|
||||
updateConnection(params: ObjectWithId, data: Data): Promise<User>;
|
||||
|
||||
|
||||
// Clients
|
||||
getClients(): Promise<User>;
|
||||
getClients(cb: (err: Error, data: any) => void): void;
|
||||
|
||||
getClient(params: ClientParams): Promise<User>;
|
||||
getClient(params: ClientParams, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
createClient(data: Data): Promise<User>;
|
||||
createClient(data: Data, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
updateClient(params: ClientParams, data: Data): Promise<User>;
|
||||
updateClient(params: ClientParams, data: Data, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
deleteClient(params: ClientParams): Promise<User>;
|
||||
deleteClient(params: ClientParams, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
// Client Grants
|
||||
getClientGrants(): Promise<User>;
|
||||
getClientGrants(cb: (err: Error, data: any) => void): void;
|
||||
|
||||
createClientGrant(data: Data): Promise<User>;
|
||||
createClientGrant(data: Data, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
updateClientGrant(params: ObjectWithId, data: Data): Promise<User>;
|
||||
updateClientGrant(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
deleteClientGrant(params: ObjectWithId): Promise<User>;
|
||||
deleteClientGrant(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
|
||||
// Device Keys
|
||||
getDeviceCredentials(): Promise<User>;
|
||||
getDeviceCredentials(cb: (err: Error, data: any) => void): void;
|
||||
|
||||
createDevicePublicKey(data: Data): Promise<User>;
|
||||
createDevicePublicKey(data: Data, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
deleteDeviceCredential(params: ClientParams): Promise<User>;
|
||||
deleteDeviceCredential(params: ClientParams, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
|
||||
// Rules
|
||||
getRules(): Promise<User>;
|
||||
getRules(cb: (err: Error, data: any) => void): void;
|
||||
|
||||
getRule(params: ClientParams): Promise<User>;
|
||||
getRule(params: ClientParams, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
createRules(data: Data): Promise<User>;
|
||||
createRules(data: Data, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
updateRule(params: ObjectWithId, data: Data): Promise<User>;
|
||||
updateRule(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
deleteRule(params: ObjectWithId): Promise<User>;
|
||||
deleteRule(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
|
||||
// Users
|
||||
getUsers(params?: GetUsersData): Promise<User[]>;
|
||||
getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
|
||||
|
||||
getUser(params?: ObjectWithId): Promise<User[]>;
|
||||
getUser(params?: ObjectWithId, cb?: (err: Error, users: User[]) => void): void;
|
||||
|
||||
createUser(data: UserData): Promise<User>;
|
||||
createUser(data: UserData, cb: (err: Error, data: User) => void): void;
|
||||
|
||||
updateUser(params: UpdateUserParameters, data: User): Promise<User>;
|
||||
updateUser(params: UpdateUserParameters, data: User, cb: (err: Error, data: User) => void): void;
|
||||
|
||||
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata): Promise<User>;
|
||||
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata, cb: (err: Error, data: User) => void): void;
|
||||
|
||||
deleteAllUsers(): Promise<User>;
|
||||
deleteAllUsers(cb: (err: Error, data: any) => void): void;
|
||||
|
||||
deleteUser(params?: ObjectWithId): Promise<any>;
|
||||
deleteUser(params?: ObjectWithId, cb?: (err: Error, users: User[]) => void): void;
|
||||
|
||||
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata): Promise<User>;
|
||||
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata, cb: (err: Error, data: User) => void): void;
|
||||
|
||||
deleteUserMultifactor(params: DeleteMultifactorParams): Promise<any>;
|
||||
deleteUserMultifactor(params: DeleteMultifactorParams, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
unlinkUsers(params: LinkAccountsParams): Promise<any>;
|
||||
unlinkUsers(params: LinkAccountsParams, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
linkUsers(params: ObjectWithId, data: LinkAccountsData): Promise<any>;
|
||||
linkUsers(params: ObjectWithId, data: LinkAccountsData, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
|
||||
// Tokens
|
||||
getBlacklistedTokens(): Promise<any>;
|
||||
getBlacklistedTokens(cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
blacklistToken(token: Token): Promise<any>;
|
||||
blacklistToken(token: Token, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
|
||||
// Providers
|
||||
getEmailProvider(): Promise<any>;
|
||||
getEmailProvider(cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
configureEmailProvider(data: Data): Promise<any>;
|
||||
configureEmailProvider(data: Data, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
deleteEmailProvider(): Promise<any>;
|
||||
deleteEmailProvider(cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
updateEmailProvider(data: Data): Promise<any>;
|
||||
updateEmailProvider(data: Data, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
|
||||
// Statistics
|
||||
getActiveUsersCount(): Promise<any>;
|
||||
getActiveUsersCount(cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
getDailyStats(data: StatsParams): Promise<any>;
|
||||
getDailyStats(data: StatsParams, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
|
||||
// Tenant
|
||||
getTenantSettings(): Promise<any>;
|
||||
getTenantSettings(cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
updateTenantSettings(data: Data): Promise<any>;
|
||||
updateTenantSettings(data: Data, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
|
||||
// Jobs
|
||||
getJob(params: ObjectWithId): Promise<any>;
|
||||
getJob(params: ObjectWithId, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
importUsers(data: ImportUsersOptions): Promise<any>;
|
||||
importUsers(data: ImportUsersOptions, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
sendEmailVerification(data: UserIdParams): Promise<any>;
|
||||
sendEmailVerification(data: UserIdParams, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
// Tickets
|
||||
createPasswordChangeTicket(params: PasswordChangeTicketParams): Promise<any>;
|
||||
createPasswordChangeTicket(params: PasswordChangeTicketParams, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
createEmailVerificationTicket(data: EmailVerificationTicketOptions): Promise<any>;
|
||||
createEmailVerificationTicket(data: EmailVerificationTicketOptions, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
// Logs
|
||||
getLog(params: ObjectWithId): Promise<any>;
|
||||
getLog(params: ObjectWithId, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
getLogs(): Promise<any>;
|
||||
getLogs(cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
|
||||
// Resource Server
|
||||
createResourceServer(data: Data): Promise<any>;
|
||||
createResourceServer(data: Data, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
getResourceServers(): Promise<any>;
|
||||
getResourceServers(cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
getResourceServer(data: ObjectWithId): Promise<any>;
|
||||
getResourceServer(data: ObjectWithId, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
deleteResourceServer(params: ObjectWithId): Promise<any>;
|
||||
deleteResourceServer(params: ObjectWithId, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
updateResourceServer(params: ObjectWithId, data: Data): Promise<any>;
|
||||
updateResourceServer(params: ObjectWithId, data: Data, cb?: (err: Error, data: any) => void): void;
|
||||
|
||||
|
||||
|
||||
|
||||
requestChangePasswordEmail(data: RequestChangePasswordEmailData): Promise<string>;
|
||||
requestChangePasswordEmail(data: RequestChangePasswordEmailData, cb: (err: Error, message: string) => void): void;
|
||||
}
|
||||
|
||||
@@ -109,3 +109,16 @@ const v1: Visitor = {
|
||||
path.scope.rename("n");
|
||||
}
|
||||
};
|
||||
|
||||
// Binding.kind
|
||||
const BindingKindTest: Visitor = {
|
||||
Identifier(path) {
|
||||
const kind = path.scope.getBinding("str").kind;
|
||||
kind === 'module';
|
||||
kind === 'const';
|
||||
kind === 'let';
|
||||
kind === 'var';
|
||||
// The following should fail when uncommented
|
||||
// kind === 'anythingElse';
|
||||
},
|
||||
};
|
||||
|
||||
Vendored
+1
-1
@@ -126,7 +126,7 @@ export class Binding {
|
||||
identifier: t.Identifier;
|
||||
scope: Scope;
|
||||
path: NodePath<Node>;
|
||||
kind: 'var' | 'let' | 'const';
|
||||
kind: 'var' | 'let' | 'const' | 'module';
|
||||
referenced: boolean;
|
||||
references: number;
|
||||
referencePaths: NodePath<Node>[];
|
||||
|
||||
Vendored
+4
-2
@@ -3,9 +3,11 @@
|
||||
// Definitions by: Clément Bourgeois <https://github.com/moonpyk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as Express from 'express';
|
||||
/// <reference types="node" />
|
||||
|
||||
declare function auth(req: Express.Request): auth.BasicAuthResult;
|
||||
import * as http from 'http';
|
||||
|
||||
declare function auth(req: http.IncomingMessage): auth.BasicAuthResult;
|
||||
|
||||
declare namespace auth {
|
||||
interface BasicAuthResult {
|
||||
|
||||
@@ -10,7 +10,7 @@ function test() {
|
||||
var utils = bezier.getUtils();
|
||||
var line: BezierJs.Line = { p1: { x: 0, y: 0 }, p2: { x: 1, y: 1 } };
|
||||
var abc: BezierJs.ABC = { A: null, B: null, C: null };
|
||||
var arc: BezierJs.Arc = { e: 0, s: 0, x: 0, y: 0, r: 1 };
|
||||
var arc: BezierJs.Arc = { e: 0, s: 0, x: 0, y: 0, r: 1, interval:{ start: 0, end: 1 } };
|
||||
var bbox: BezierJs.BBox = bezier.bbox();
|
||||
var closest: BezierJs.Closest = { mdist: 1, mpos: 0 };
|
||||
var inflection: BezierJs.Inflection = { values: null, x: [0], y: [0], z: [0] };
|
||||
@@ -95,4 +95,4 @@ function test() {
|
||||
utils.round(.999, .001);
|
||||
utils.shapeintersections(shape, bbox, shape, bbox);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -51,6 +51,7 @@ declare namespace BezierJs {
|
||||
e: number;
|
||||
r: number;
|
||||
s: number;
|
||||
interval: { start: number; end: number; };
|
||||
}
|
||||
interface Shape {
|
||||
startcap: BezierCap;
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bittorrent-protocol-tests.ts"
|
||||
]
|
||||
}
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bittorrent-protocol-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"no-misused-new": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+74
-9
@@ -1,6 +1,6 @@
|
||||
// Type definitions for body-parser
|
||||
// Project: http://expressjs.com
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>, VILIC VANE <https://vilic.info>, Jonathan Häberle <https://github.com/dreampulse/>
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>, VILIC VANE <https://vilic.info>, Jonathan Häberle <https://github.com/dreampulse/>, Gevik Babakhani <https://github.com/blendsdk/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -41,7 +41,14 @@ declare function bodyParser(options?: {
|
||||
}): express.RequestHandler;
|
||||
|
||||
declare namespace bodyParser {
|
||||
export function json(options?: {
|
||||
|
||||
/**
|
||||
* Interface for defining the options for the json() middleware
|
||||
*
|
||||
* @export
|
||||
* @interface JsonOptions
|
||||
*/
|
||||
export interface JsonOptions {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
@@ -66,9 +73,15 @@ declare namespace bodyParser {
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
reviver?: (key: string, value: any) => any;
|
||||
}): express.RequestHandler;
|
||||
}
|
||||
|
||||
export function raw(options?: {
|
||||
/**
|
||||
* Interface for defining the options the raw() middleware
|
||||
*
|
||||
* @export
|
||||
* @interface RawOptions
|
||||
*/
|
||||
export interface RawOptions {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
@@ -85,9 +98,15 @@ declare namespace bodyParser {
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
}): express.RequestHandler;
|
||||
}
|
||||
|
||||
export function text(options?: {
|
||||
/**
|
||||
* Interface for defining the options for the text() middleware
|
||||
*
|
||||
* @export
|
||||
* @interface TextOptions
|
||||
*/
|
||||
export interface TextOptions {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
@@ -108,9 +127,15 @@ declare namespace bodyParser {
|
||||
* the default charset to parse as, if not specified in content-type. (default: 'utf-8')
|
||||
*/
|
||||
defaultCharset?: string;
|
||||
}): express.RequestHandler;
|
||||
}
|
||||
|
||||
export function urlencoded(options: {
|
||||
/**
|
||||
* Interface for defining the options for the urlencoded() middleware
|
||||
*
|
||||
* @export
|
||||
* @interface UrlEncodedOptions
|
||||
*/
|
||||
export interface UrlEncodedOptions {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
@@ -131,7 +156,47 @@ declare namespace bodyParser {
|
||||
* parse extended syntax with the qs module.
|
||||
*/
|
||||
extended: boolean;
|
||||
}): express.RequestHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns middleware that only parses json. This parser accepts any Unicode encoding
|
||||
* of the body and supports automatic inflation of gzip and deflate encodings.
|
||||
*
|
||||
* @export
|
||||
* @param {JsonOptions} [options]
|
||||
* @returns {express.RequestHandler}
|
||||
*/
|
||||
export function json(options?: JsonOptions): express.RequestHandler;
|
||||
|
||||
/**
|
||||
* Returns middleware that parses all bodies as a Buffer. This parser supports automatic
|
||||
* inflation of gzip and deflate encodings.
|
||||
*
|
||||
* @export
|
||||
* @param {RawOptions} [options]
|
||||
* @returns {express.RequestHandler}
|
||||
*/
|
||||
export function raw(options?: RawOptions): express.RequestHandler;
|
||||
|
||||
/**
|
||||
* Returns middleware that parses all bodies as a string. This parser supports
|
||||
* automatic inflation of gzip and deflate encodings.
|
||||
*
|
||||
* @export
|
||||
* @param {TextOptions} [options]
|
||||
* @returns {express.RequestHandler}
|
||||
*/
|
||||
export function text(options?: TextOptions): express.RequestHandler;
|
||||
|
||||
/**
|
||||
* Returns middleware that only parses urlencoded bodies. This parser accepts only
|
||||
* UTF-8 encoding of the body and supports automatic inflation of gzip and deflate encodings.
|
||||
*
|
||||
* @export
|
||||
* @param {UrlEncodedOptions} [options]
|
||||
* @returns {express.RequestHandler}
|
||||
*/
|
||||
export function urlencoded(options?: UrlEncodedOptions): express.RequestHandler;
|
||||
}
|
||||
|
||||
export = bodyParser;
|
||||
|
||||
Vendored
+1
-1
@@ -147,7 +147,7 @@ export namespace types {
|
||||
three,
|
||||
quorum,
|
||||
all,
|
||||
localQuorm,
|
||||
localQuorum,
|
||||
eachQuorum,
|
||||
serial,
|
||||
localSerial,
|
||||
|
||||
Vendored
+1
@@ -358,6 +358,7 @@ declare namespace Chai {
|
||||
sameMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
sameDeepMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
includeMembers(superset: any[], subset: any[], msg?: string): void;
|
||||
includeDeepMembers(superset: any[], subset: any[], msg?: string): void;
|
||||
|
||||
ifError(val: any, msg?: string): void;
|
||||
|
||||
|
||||
Vendored
+3
-2
@@ -71,7 +71,7 @@ declare namespace Chart {
|
||||
}
|
||||
|
||||
export interface ChartPoint {
|
||||
x?: number;
|
||||
x?: number | string | Date;
|
||||
y?: number;
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ declare namespace Chart {
|
||||
animation?: ChartAnimationOptions;
|
||||
elements?: ChartElementsOptions;
|
||||
scales?: ChartScales;
|
||||
cutoutPercentage?: number;
|
||||
}
|
||||
|
||||
export interface ChartFontOptions {
|
||||
@@ -430,4 +431,4 @@ declare namespace Chart {
|
||||
}
|
||||
|
||||
export = Chart;
|
||||
export as namespace Chart;
|
||||
export as namespace Chart;
|
||||
|
||||
Vendored
+6
-6
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Chrome extension development
|
||||
// Project: http://developer.chrome.com/extensions/
|
||||
// Definitions by: Matthew Kimber <https://github.com/matthewkimber>, otiai10 <https://github.com/otiai10>, couven92 <https://github.com/couven92>, RReverser <https://github.com/rreverser>
|
||||
// Definitions by: Matthew Kimber <https://github.com/matthewkimber>, otiai10 <https://github.com/otiai10>, couven92 <https://github.com/couven92>, RReverser <https://github.com/rreverser>, sreimer15 <https://github.com/sreimer15>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="filesystem" />
|
||||
@@ -7062,13 +7062,12 @@ declare namespace chrome.webNavigation {
|
||||
transitionQualifiers: string[];
|
||||
}
|
||||
|
||||
interface WebNavigationEventFilter {
|
||||
/** Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event. */
|
||||
url: chrome.events.UrlFilter[];
|
||||
interface WebNavigationRequestFilter extends chrome.webRequest.RequestFilter {
|
||||
/** fulfills the webRequest.RequestFilter interface even though it is under web navigation **/
|
||||
}
|
||||
|
||||
interface WebNavigationEvent<T extends WebNavigationCallbackDetails> extends chrome.events.Event<(details: T) => void> {
|
||||
addListener(callback: (details: T) => void, filters?: WebNavigationEventFilter): void;
|
||||
addListener(callback: (details: T) => void, filters?: WebNavigationRequestFilter): void;
|
||||
}
|
||||
|
||||
interface WebNavigationFramedEvent extends WebNavigationEvent<WebNavigationFramedCallbackDetails> {}
|
||||
@@ -7178,7 +7177,8 @@ declare namespace chrome.webRequest {
|
||||
*/
|
||||
types?: string[];
|
||||
/** A list of URLs or URL patterns. Requests that cannot match any of the URLs will be filtered out. */
|
||||
urls: string[];
|
||||
urls: string[] | RegExp[] | "<all_urls>";
|
||||
|
||||
/** Optional. */
|
||||
windowId?: number;
|
||||
}
|
||||
|
||||
@@ -171,6 +171,29 @@ function catBlock () {
|
||||
["blocking"]);
|
||||
}
|
||||
|
||||
// webNavigation.onBeforeNavigate.addListener example similar api to onBeforeRequest but without extra spec
|
||||
function beforeRedditNavigation() {
|
||||
chrome.webNavigation.onBeforeNavigate.addListener(function (requestDetails) {
|
||||
console.log("URL we want to redirect to: " + requestDetails.url);
|
||||
// NOTE: This will search for top level frames with the value -1.
|
||||
if (requestDetails.parentFrameId != -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
let url = new URL(requestDetails.url);
|
||||
let splitUrl = url.hostname.split('.');
|
||||
//` Note: Does not cover the XX.co.uk type edge case
|
||||
let host = (splitUrl[(splitUrl.length -1) - 1]);
|
||||
|
||||
if (host === null) {
|
||||
return;
|
||||
} else if (host === "reddit") {
|
||||
alert("Were you trying to go on reddit, during working hours? :(")
|
||||
return;
|
||||
}
|
||||
},{urls: ["http://*/*"], types: ["image"]});
|
||||
}
|
||||
|
||||
// contrived settings example
|
||||
function proxySettings() {
|
||||
chrome.proxy.settings.get({ incognito: true }, (details) => {
|
||||
|
||||
Vendored
+11
-2
@@ -16,7 +16,7 @@ declare module "codemirror" {
|
||||
and return a {list, from, to} object, where list is an array of strings or objects (the completions), and
|
||||
from and to give the start and end of the token that is being completed as {line, ch} objects. An optional
|
||||
selectedHint property (an integer) can be added to the completion object to control the initially selected hint. */
|
||||
function showHint(cm: CodeMirror.Doc, hinter?: (doc: CodeMirror.Doc) => Hints, options?: ShowHintOptions): void;
|
||||
function showHint(cm: CodeMirror.Doc, hinter?: HintFunction, options?: ShowHintOptions): void;
|
||||
|
||||
interface Hints {
|
||||
from: Position;
|
||||
@@ -47,9 +47,18 @@ declare module "codemirror" {
|
||||
showHint: (options: ShowHintOptions) => void;
|
||||
}
|
||||
|
||||
interface HintFunction {
|
||||
(doc: CodeMirror.Doc): Hints;
|
||||
}
|
||||
|
||||
interface AsyncHintFunction {
|
||||
(doc: CodeMirror.Doc, callback: (hints: Hints) => any): any;
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
interface ShowHintOptions {
|
||||
completeSingle: boolean;
|
||||
hint: (doc: CodeMirror.Doc) => Hints;
|
||||
hint: HintFunction | AsyncHintFunction;
|
||||
}
|
||||
|
||||
/** The Handle used to interact with the autocomplete dialog box.*/
|
||||
|
||||
Vendored
+7
-3
@@ -118,6 +118,8 @@ declare namespace CodeMirror {
|
||||
The other arguments and the returned value have the same interpretation as they have in findPosH. */
|
||||
findPosV(start: CodeMirror.Position, amount: number, unit: string): { line: number; ch: number; hitSide?: boolean; };
|
||||
|
||||
/** Returns the start and end of the 'word' (the stretch of letters, whitespace, or punctuation) at the given position. */
|
||||
findWordAt(pos: CodeMirror.Position): CodeMirror.Range;
|
||||
|
||||
/** Change the configuration of the editor. option should the name of an option, and value should be a valid value for that option. */
|
||||
setOption(option: string, value: any): void;
|
||||
@@ -672,9 +674,11 @@ declare namespace CodeMirror {
|
||||
(line: number, ch?: number): Position;
|
||||
}
|
||||
|
||||
interface Range{
|
||||
from: CodeMirror.Position;
|
||||
to: CodeMirror.Position;
|
||||
interface Range {
|
||||
anchor: CodeMirror.Position;
|
||||
head: CodeMirror.Position;
|
||||
from(): CodeMirror.Position;
|
||||
to(): CodeMirror.Position;
|
||||
}
|
||||
|
||||
interface Position {
|
||||
|
||||
@@ -7,6 +7,12 @@ var myCodeMirror2: CodeMirror.Editor = CodeMirror(document.body, {
|
||||
mode: "javascript"
|
||||
});
|
||||
|
||||
var range = myCodeMirror2.findWordAt(CodeMirror.Pos(0, 2));
|
||||
var anchor = range.anchor;
|
||||
var head = range.head;
|
||||
var from = range.from();
|
||||
var to = range.to();
|
||||
|
||||
var myTextArea: HTMLTextAreaElement;
|
||||
var myCodeMirror3: CodeMirror.Editor = CodeMirror(function (elt) {
|
||||
myTextArea.parentNode.replaceChild(elt, myTextArea);
|
||||
|
||||
@@ -31,3 +31,17 @@ CodeMirror.showHint(doc, function (cm) {
|
||||
to: pos
|
||||
};
|
||||
});
|
||||
var asyncHintFunc : CodeMirror.AsyncHintFunction =
|
||||
(doc: CodeMirror.Doc, callback: (hints: CodeMirror.Hints) => any) => {
|
||||
callback({
|
||||
from: pos,
|
||||
list: ["one", "two"],
|
||||
to: pos
|
||||
});
|
||||
};
|
||||
asyncHintFunc.async = true;
|
||||
|
||||
doc.showHint({
|
||||
completeSingle: false,
|
||||
hint: asyncHintFunc
|
||||
})
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
@@ -17,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"comment-json-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -29,3 +29,8 @@ var hidden1: any = config.util.makeHidden({}, "");
|
||||
var hidden2: any = config.util.makeHidden({}, "", "");
|
||||
|
||||
var env: string = config.util.getEnv("");
|
||||
|
||||
var configSources: config.IConfigSource[] = config.util.getConfigSources();
|
||||
var configSource: config.IConfigSource = configSources[0];
|
||||
var configSourceName: string = configSource.name;
|
||||
var configSourceOriginal: string | undefined = configSource.original;
|
||||
|
||||
Vendored
+9
@@ -34,6 +34,9 @@ declare namespace c {
|
||||
|
||||
// Return the config for the project based on directory param if not directory then return default one (config).
|
||||
loadFileConfigs(configDir: string): any;
|
||||
|
||||
// Return the sources for the configurations
|
||||
getConfigSources(): IConfigSource[];
|
||||
}
|
||||
|
||||
interface IConfig {
|
||||
@@ -41,6 +44,12 @@ declare namespace c {
|
||||
has(setting: string): boolean;
|
||||
util: IUtil;
|
||||
}
|
||||
|
||||
interface IConfigSource {
|
||||
name: string;
|
||||
original?: string;
|
||||
parsed: any;
|
||||
}
|
||||
}
|
||||
|
||||
export = c;
|
||||
|
||||
Vendored
+5
-1
@@ -951,10 +951,14 @@ declare namespace Consul {
|
||||
}
|
||||
|
||||
namespace Watch {
|
||||
|
||||
interface WatchOptions {
|
||||
key?: string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
method: Function;
|
||||
options?: CommonOptions;
|
||||
options?: CommonOptions & WatchOptions;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import * as cookie from "cookie-signature";
|
||||
|
||||
let val = cookie.sign('hello', 'tobiiscool');
|
||||
|
||||
val = cookie.sign('hello', 'tobiiscool');
|
||||
cookie.unsign(val, 'tobiiscool');
|
||||
cookie.unsign(val, 'luna');
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for cookie-signature 1.0
|
||||
// Project: https://github.com/tj/node-cookie-signature
|
||||
// Definitions by: François Nguyen <https://github.com/lith-light-g>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Sign the given `val` with `secret`.
|
||||
* @param {string} val
|
||||
* @param {string} secret
|
||||
* @return {string}
|
||||
*/
|
||||
export function sign(value: string, secret: string): string;
|
||||
|
||||
/**
|
||||
* Unsign and decode the given `val` with `secret`,
|
||||
* returning `false` if the signature is invalid.
|
||||
* @param {string} val
|
||||
* @param {string} secret
|
||||
* @return {string|boolean}
|
||||
*/
|
||||
export function unsign(value: string, secret: string): string | boolean;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cookie-signature-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -1,23 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-app-version-tests.ts"
|
||||
]
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-app-version-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
# Installation
|
||||
> `npm install --save @types/cordova-plugin-device-name`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for cordova-plugin-device-name (https://www.npmjs.com/package/cordova-plugin-device-name)
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/cordova-plugin-device-name
|
||||
@@ -0,0 +1,4 @@
|
||||
/// <reference types="cordova" />
|
||||
|
||||
var deviceName = cordova.plugins.deviceName;
|
||||
console.log(deviceName.name) // e.g: Becvert's iPad
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for cordova-plugin-device-name v1.1.0
|
||||
// Project: https://www.npmjs.com/package/cordova-plugin-device-name
|
||||
// Definitions by: Larry Bahr <https://github.com/larrybahr>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
//
|
||||
// Licensed under the MIT license.
|
||||
|
||||
interface CordovaPlugins {
|
||||
/**
|
||||
* cordova-plugin-device-name interface
|
||||
*/
|
||||
deviceName: CordovaPluginDeviceName.CordovaPluginDeviceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep the type global namespace clean by using a module
|
||||
*/
|
||||
declare module CordovaPluginDeviceName {
|
||||
interface CordovaPluginDeviceName {
|
||||
/**
|
||||
* User-friendly name of the device.
|
||||
* @example cordova.plugins.deviceName.name // e.g: Larry's Android
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-device-name-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -529,4 +529,56 @@ cordova.plugins.diagnostic.requestAndCheckMotionAuthorization(function(status){
|
||||
console.log("Motion authorization is " +status);
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isExternalStorageAuthorized(function(authorized){
|
||||
console.log("Location authorization is " + (authorized ? "authorized" : "unauthorized"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getExternalStorageAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("External storage authorization allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestExternalStorageAuthorization(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("External storage authorization allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getExternalSdCardDetails(function(details){
|
||||
console.log("External SD card details: " + JSON.stringify(details));
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNFCPresent(function(present){
|
||||
console.log("NFC hardware is " + (present ? "present" : "absent"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNFCEnabled(function(enabled){
|
||||
console.log("NFC is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNFCAvailable(function(available){
|
||||
console.log("NFC is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.registerNFCStateChangeHandler(function(state){
|
||||
if(state === cordova.plugins.diagnostic.NFCState.POWERED_ON){
|
||||
console.log("NFC is ready to use");
|
||||
}
|
||||
});
|
||||
+98
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for cordova.plugins.diagnostic v3.3.0
|
||||
// Type definitions for cordova.plugins.diagnostic v3.4.x
|
||||
// Project: https://github.com/dpa99c/cordova-diagnostic-plugin
|
||||
// Definitions by: Dave Alden <https://github.com/dpa99c/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -56,6 +56,14 @@ interface Diagnostic {
|
||||
bluetoothState?: any;
|
||||
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Constants for the various NFC power states.
|
||||
* @type {Object}
|
||||
*/
|
||||
NFCState?: any;
|
||||
|
||||
|
||||
/**
|
||||
* Checks if app is able to access device location.
|
||||
* @param successCallback
|
||||
@@ -164,8 +172,8 @@ interface Diagnostic {
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns true if the device setting for location is on.
|
||||
* On Android this returns true if Location Mode is switched on.
|
||||
* Returns true if the device setting for location is on.
|
||||
* On Android this returns true if Location Mode is switched on.
|
||||
* On iOS this returns true if Location Services is switched on.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
@@ -567,6 +575,93 @@ interface Diagnostic {
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the application is authorized to use external storage.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isExternalStorageAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns the authorisation status for runtime permission to use the external storage.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getExternalStorageAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Requests authorisation for runtime permission to use the external storage.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestExternalStorageAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns details of external SD card(s): absolute path, is writable, free space
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getExternalSdCardDetails?: (
|
||||
successCallback: (status: any) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if NFC hardware is present on device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNFCPresent?: (
|
||||
successCallback: (present: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device setting for NFC is switched on.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNFCEnabled?: (
|
||||
successCallback: (present: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if NFC is available to the app.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNFCAvailable?: (
|
||||
successCallback: (present: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Registers a function to be called when a change in NFC state occurs.
|
||||
* Pass in a falsey value to de-register the currently registered function.
|
||||
* @param successCallback
|
||||
*/
|
||||
registerNFCStateChangeHandler?: (
|
||||
successCallback: (state: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if the application is authorized to use the Camera Roll in Photos app.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# Installation
|
||||
> `npm install --save-dev @types/cordova_app_version_plugin`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for cordova_app_version_plugin (https://www.npmjs.com/package/cordova_app_version_plugin)
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/cordova_app_version_plugin
|
||||
@@ -0,0 +1,3 @@
|
||||
/// <reference types="cordova" />
|
||||
|
||||
var appVersion = window.cordova.plugins.version.getAppVersion(); // e.g. "1.5.0"
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for cordova_app_version_plugin v0.2.6
|
||||
// Project: https://www.npmjs.com/package/cordova_app_version_plugin
|
||||
// Definitions by: Larry Bahr <https://github.com/larrybahr>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
//
|
||||
// Licensed under the MIT license.
|
||||
|
||||
interface CordovaPlugins {
|
||||
/**
|
||||
* cordova_app_version_plugin interface
|
||||
*/
|
||||
version: CordovaAppVersionPlugin.CordovaAppVersionPlugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep the type global namespace clean by using a module
|
||||
*/
|
||||
declare module CordovaAppVersionPlugin {
|
||||
interface CordovaAppVersionPlugin {
|
||||
/**
|
||||
* App version from config.xml's version (e.g. <widget id="my.app.id" version="1.5.0">)
|
||||
* @example window.cordova.plugins.version.getAppVersion() // e.g: "1.5.0"
|
||||
*/
|
||||
getAppVersion(): string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova_app_version_plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -9,6 +9,12 @@ function StepSample() {
|
||||
var step = <cucumber.StepDefinitions>this;
|
||||
var hook = <cucumber.Hooks>this;
|
||||
|
||||
hook.setWorldConstructor(function() {
|
||||
this.visit = function(url: string, callback: Callback) {
|
||||
callback(null, 'pending');
|
||||
}
|
||||
})
|
||||
|
||||
hook.Before(function(scenario: HookScenario, callback: Callback){
|
||||
scenario.isFailed() && callback.pending();
|
||||
});
|
||||
|
||||
Vendored
+2
-1
@@ -69,6 +69,7 @@ declare namespace cucumber {
|
||||
After(code: HookCode): void;
|
||||
Around(code: AroundCode):void;
|
||||
setDefaultTimeout(time:number): void;
|
||||
setWorldConstructor(world: () => void): void;
|
||||
registerHandler(handlerOption:string, code:(event:any, callback:CallbackStepDefinition) =>void): void;
|
||||
registerListener(listener: EventListener): void;
|
||||
}
|
||||
@@ -207,7 +208,7 @@ declare namespace cucumber {
|
||||
}
|
||||
|
||||
export interface SupportCodeConsumer {
|
||||
(stepDefinitions:StepDefinitions | Hooks):void;
|
||||
(stepDefinitions:StepDefinitions & Hooks):void;
|
||||
}
|
||||
|
||||
export function defineSupportCode(consumer:SupportCodeConsumer): void;
|
||||
|
||||
+112
-150
@@ -25,7 +25,6 @@ class NumCoercible {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MixedObject {
|
||||
|
||||
public num: number;
|
||||
@@ -40,18 +39,23 @@ class MixedObject {
|
||||
this.date = date;
|
||||
}
|
||||
}
|
||||
|
||||
let num: number;
|
||||
let str: string;
|
||||
let numeric: NumCoercible;
|
||||
let date: Date;
|
||||
let extentNum: [number, number];
|
||||
let extentStr: [string, string];
|
||||
let extentNumeric: [NumCoercible, NumCoercible];
|
||||
let extentDateMixed: [d3Array.Primitive, d3Array.Primitive];
|
||||
let extentMixed: [d3Array.Primitive | NumCoercible, d3Array.Primitive | NumCoercible];
|
||||
let extentDate: [Date, Date];
|
||||
|
||||
let numOrUndefined: number | undefined;
|
||||
let strOrUndefined: string | undefined;
|
||||
let numericOrUndefined: NumCoercible | undefined;
|
||||
let dateOrUndefined: Date | undefined;
|
||||
let numOrUndefinedExtent: [number, number] | [undefined, undefined];
|
||||
let strOrUndefinedExtent: [string, string] | [undefined, undefined];
|
||||
let numericOrUndefinedExtent: [NumCoercible, NumCoercible] | [undefined, undefined];
|
||||
let dateMixedOrUndefined: [Date , Date] | [undefined, undefined];
|
||||
let mixedOrUndefinedExtent: [d3Array.Primitive | NumCoercible, d3Array.Primitive | NumCoercible] | [undefined, undefined];
|
||||
let dateOrUndefinedExtent: [Date, Date] | [undefined, undefined];
|
||||
|
||||
let numbersArray = [10, 20, 30, 40, 50];
|
||||
let numbersOrUndefinedArray = [10, 20, undefined, null, 40, 50];
|
||||
let stringyNumbersArray = ['10', '20', '30', '40', '50'];
|
||||
let numericArray = [new NumCoercible(10), new NumCoercible(20), new NumCoercible(30), new NumCoercible(40), new NumCoercible(50)];
|
||||
let dateArray = [new Date(2016, 6, 1), new Date(2016, 7, 30), new Date(2015, 3, 15)];
|
||||
@@ -62,7 +66,31 @@ let mixedObjectArray = [
|
||||
new MixedObject(40, new Date(2014, 3, 15)),
|
||||
new MixedObject(50, new Date(2017, 4, 15))
|
||||
];
|
||||
let mixedObjectOrUndefinedArray = [...mixedObjectArray, undefined]
|
||||
|
||||
function accessorMixedObjectToNum(datum: MixedObject, index: number, array: Array<MixedObject>): number {
|
||||
return datum.num;
|
||||
}
|
||||
|
||||
function accessorMixedObjectToStr(datum: MixedObject, index: number, array: Array<MixedObject>): string {
|
||||
return datum.str;
|
||||
}
|
||||
|
||||
function accessorMixedObjectToNumeric(datum: MixedObject, index: number, array: Array<MixedObject>): NumCoercible {
|
||||
return datum.numeric;
|
||||
}
|
||||
|
||||
function accessorMixedObjectToDate(datum: MixedObject, index: number, array: Array<MixedObject>): Date {
|
||||
return datum.date;
|
||||
}
|
||||
|
||||
function accessorMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: Array<MixedObject | undefined>): number | undefined | null {
|
||||
return datum ? datum.num : undefined;
|
||||
}
|
||||
|
||||
function accessorMixedObjectToStrOrUndefined(datum: MixedObject | undefined, index: number, array: Array<MixedObject>): string | undefined | null {
|
||||
return datum ? datum.str : undefined;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Test Statistics
|
||||
@@ -72,186 +100,109 @@ let mixedObjectArray = [
|
||||
|
||||
// without accessors
|
||||
|
||||
num = d3Array.max(numbersArray);
|
||||
str = d3Array.max(stringyNumbersArray);
|
||||
numeric = d3Array.max(numericArray);
|
||||
date = d3Array.max(dateArray);
|
||||
numOrUndefined = d3Array.max(numbersArray);
|
||||
strOrUndefined = d3Array.max(stringyNumbersArray);
|
||||
numericOrUndefined = d3Array.max(numericArray);
|
||||
dateOrUndefined = d3Array.max(dateArray);
|
||||
|
||||
// with accessors
|
||||
|
||||
num = d3Array.max(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.num;
|
||||
});
|
||||
|
||||
str = d3Array.max(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.str;
|
||||
});
|
||||
|
||||
numeric = d3Array.max(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.numeric;
|
||||
});
|
||||
|
||||
date = d3Array.max(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.date;
|
||||
});
|
||||
numOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNum);
|
||||
strOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToStr);
|
||||
numericOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNumeric);
|
||||
dateOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToDate);
|
||||
numOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
|
||||
strOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
|
||||
|
||||
// min() -----------------------------------------------------------------------
|
||||
|
||||
// without accessors
|
||||
|
||||
num = d3Array.min(numbersArray);
|
||||
str = d3Array.min(stringyNumbersArray);
|
||||
numeric = d3Array.min(numericArray);
|
||||
date = d3Array.min(dateArray);
|
||||
numOrUndefined = d3Array.min(numbersArray);
|
||||
strOrUndefined = d3Array.min(stringyNumbersArray);
|
||||
numericOrUndefined = d3Array.min(numericArray);
|
||||
dateOrUndefined = d3Array.min(dateArray);
|
||||
|
||||
// with accessors
|
||||
|
||||
num = d3Array.min(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.num;
|
||||
});
|
||||
|
||||
str = d3Array.min(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.str;
|
||||
});
|
||||
|
||||
numeric = d3Array.min(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.numeric;
|
||||
});
|
||||
|
||||
date = d3Array.min(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.date;
|
||||
});
|
||||
numOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNum);
|
||||
strOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToStr);
|
||||
numericOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNumeric);
|
||||
dateOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToDate);
|
||||
numOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
|
||||
strOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
|
||||
|
||||
// extent() --------------------------------------------------------------------
|
||||
|
||||
// without accessors
|
||||
|
||||
extentNum = d3Array.extent(numbersArray);
|
||||
extentStr = d3Array.extent(stringyNumbersArray);
|
||||
extentNumeric = d3Array.extent(numericArray);
|
||||
extentDate = d3Array.extent(dateArray);
|
||||
extentMixed = d3Array.extent<NumCoercible>([new NumCoercible(10), 13, '12', true]);
|
||||
numOrUndefinedExtent = d3Array.extent(numbersArray);
|
||||
strOrUndefinedExtent = d3Array.extent(stringyNumbersArray);
|
||||
numericOrUndefinedExtent = d3Array.extent(numericArray);
|
||||
dateOrUndefinedExtent = d3Array.extent(dateArray);
|
||||
|
||||
// with accessors
|
||||
|
||||
extentNum = d3Array.extent(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.num;
|
||||
});
|
||||
|
||||
extentStr = d3Array.extent(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.str;
|
||||
});
|
||||
|
||||
extentMixed = d3Array.extent(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.numeric;
|
||||
});
|
||||
|
||||
extentDateMixed = d3Array.extent(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.date;
|
||||
});
|
||||
numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNum);
|
||||
strOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToStr);
|
||||
mixedOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNumeric);
|
||||
dateMixedOrUndefined = d3Array.extent(mixedObjectArray, accessorMixedObjectToDate);
|
||||
numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNumOrUndefined);
|
||||
strOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToStrOrUndefined);
|
||||
|
||||
// mean() ----------------------------------------------------------------------
|
||||
|
||||
num = d3Array.mean(numbersArray);
|
||||
numOrUndefined = d3Array.mean(numbersArray);
|
||||
numOrUndefined = d3Array.mean(numericArray);
|
||||
numOrUndefined = d3Array.mean(numbersOrUndefinedArray);
|
||||
|
||||
num = d3Array.mean(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.num;
|
||||
});
|
||||
numOrUndefined = d3Array.mean(mixedObjectArray, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.mean(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// median() --------------------------------------------------------------------
|
||||
|
||||
num = d3Array.median(numbersArray);
|
||||
numOrUndefined = d3Array.median(numbersArray);
|
||||
numOrUndefined = d3Array.median(numericArray);
|
||||
numOrUndefined = d3Array.median(numbersOrUndefinedArray);
|
||||
|
||||
num = d3Array.median(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.num;
|
||||
});
|
||||
numOrUndefined = d3Array.median(mixedObjectArray, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.median(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// quantile() ------------------------------------------------------------------
|
||||
|
||||
num = d3Array.quantile(numbersArray, 0.5);
|
||||
numOrUndefined = d3Array.quantile(numbersArray, 0.5);
|
||||
numOrUndefined = d3Array.quantile(numericArray, 0.5);
|
||||
numOrUndefined = d3Array.quantile(numbersOrUndefinedArray, 0.5);
|
||||
|
||||
num = d3Array.quantile(mixedObjectArray, 0.5, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.num;
|
||||
});
|
||||
numOrUndefined = d3Array.quantile(mixedObjectArray, 0.5, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.quantile(mixedObjectOrUndefinedArray, 0.5, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// sum() -----------------------------------------------------------------------
|
||||
|
||||
numOrUndefined = d3Array.sum(numbersArray);
|
||||
numOrUndefined = d3Array.sum(numericArray);
|
||||
numOrUndefined = d3Array.sum(numbersOrUndefinedArray);
|
||||
|
||||
num = d3Array.sum(numbersArray);
|
||||
|
||||
num = d3Array.sum(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.num;
|
||||
});
|
||||
numOrUndefined = d3Array.sum(mixedObjectArray, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.sum(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// deviation() -----------------------------------------------------------------
|
||||
|
||||
num = d3Array.deviation(numbersArray);
|
||||
numOrUndefined = d3Array.deviation(numbersArray);
|
||||
numOrUndefined = d3Array.deviation(numericArray);
|
||||
numOrUndefined = d3Array.deviation(numbersOrUndefinedArray);
|
||||
|
||||
num = d3Array.deviation(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.num;
|
||||
});
|
||||
numOrUndefined = d3Array.deviation(mixedObjectArray, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.deviation(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// variance() ------------------------------------------------------------------
|
||||
|
||||
num = d3Array.variance(numbersArray);
|
||||
numOrUndefined = d3Array.variance(numbersArray);
|
||||
numOrUndefined = d3Array.variance(numericArray);
|
||||
numOrUndefined = d3Array.variance(numbersOrUndefinedArray);
|
||||
|
||||
num = d3Array.variance(mixedObjectArray, function (datum, index, array) {
|
||||
let d: MixedObject = datum;
|
||||
let i: number = index;
|
||||
let arr: Array<MixedObject> = array;
|
||||
return datum.num;
|
||||
});
|
||||
numOrUndefined = d3Array.variance(mixedObjectArray, accessorMixedObjectToNum);
|
||||
numOrUndefined = d3Array.variance(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Test Searching Arrays
|
||||
@@ -259,8 +210,18 @@ num = d3Array.variance(mixedObjectArray, function (datum, index, array) {
|
||||
|
||||
// scan() ----------------------------------------------------------------------
|
||||
|
||||
num = d3Array.scan(mixedObjectArray, function (a, b) {
|
||||
return a.num - b.num; // a and b are of type MixedObject
|
||||
numOrUndefined = d3Array.scan(numbersArray)
|
||||
|
||||
numOrUndefined = d3Array.scan(mixedObjectArray, function (a, b) {
|
||||
let aElem: MixedObject = a;
|
||||
let bElem: MixedObject = b;
|
||||
return a.num - b.num;
|
||||
});
|
||||
|
||||
numOrUndefined = d3Array.scan(mixedObjectOrUndefinedArray, function (a, b) {
|
||||
let aElem: MixedObject | undefined = a;
|
||||
let bElem: MixedObject | undefined = b;
|
||||
return a && b ? a.num - b.num : NaN;
|
||||
});
|
||||
|
||||
// bisectLeft() ----------------------------------------------------------------
|
||||
@@ -334,12 +295,14 @@ num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14
|
||||
|
||||
// ascending() -----------------------------------------------------------------
|
||||
|
||||
num = d3Array.ascending(undefined, 20);
|
||||
num = d3Array.ascending(10, 20);
|
||||
num = d3Array.ascending('10', '20');
|
||||
num = d3Array.ascending(new Date(2016, 6, 13), new Date(2016, 6, 14));
|
||||
|
||||
// descending() ----------------------------------------------------------------
|
||||
|
||||
num = d3Array.descending(undefined, 20);
|
||||
num = d3Array.descending(10, 20);
|
||||
num = d3Array.descending('10', '20');
|
||||
num = d3Array.descending(new Date(2016, 6, 13), new Date(2016, 6, 14));
|
||||
@@ -364,12 +327,11 @@ let testArrays: MixedObject[][] = [
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
let mergedArray: MixedObject[];
|
||||
|
||||
mergedArray = d3Array.merge(testArrays); // inferred type
|
||||
mergedArray = d3Array.merge<MixedObject>(testArrays); // explicit type
|
||||
// mergedArray = d3.merge<MixedObject>([[10, 40, 30], [15, 30]]); // fails, type mismatch
|
||||
// mergedArray = d3Array.merge<MixedObject>([[10, 40, 30], [15, 30]]); // fails, type mismatch
|
||||
|
||||
// pairs() ---------------------------------------------------------------------
|
||||
|
||||
|
||||
Vendored
+26
-60
@@ -1,8 +1,10 @@
|
||||
// Type definitions for D3JS d3-array module v1.0.1
|
||||
// Type definitions for D3JS d3-array module 1.0
|
||||
// Project: https://github.com/d3/d3-array
|
||||
// Definitions by: Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>, Tom Wanzek <https://github.com/tomwanzek>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.0.2
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Shared Types and Interfaces
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -20,17 +22,11 @@ interface Numeric {
|
||||
valueOf(): number;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Descriptive Statistics
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Return the maximum value in the array of numbers using natural order.
|
||||
*/
|
||||
export function max(array: number[]): number | undefined;
|
||||
|
||||
/**
|
||||
* Return the maximum value in the array of strings using natural order.
|
||||
*/
|
||||
@@ -41,25 +37,15 @@ export function max(array: string[]): string | undefined;
|
||||
*/
|
||||
export function max<T extends Numeric>(array: T[]): T | undefined;
|
||||
|
||||
/**
|
||||
* Return the maximum value in the array using natural order and a projection function to map values to numbers.
|
||||
*/
|
||||
export function max<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number | undefined;
|
||||
|
||||
/**
|
||||
* Return the maximum value in the array using natural order and a projection function to map values to strings.
|
||||
*/
|
||||
export function max<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string): string | undefined;
|
||||
export function max<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string | undefined | null): string | undefined;
|
||||
|
||||
/**
|
||||
* Return the maximum value in the array using natural order and a projection function to map values to easily-sorted values.
|
||||
*/
|
||||
export function max<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U): U | undefined;
|
||||
|
||||
/**
|
||||
* Return the minimum value in the array using natural order.
|
||||
*/
|
||||
export function min(array: number[]): number | undefined;
|
||||
export function max<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U | undefined | null): U | undefined;
|
||||
|
||||
/**
|
||||
* Return the minimum value in the array using natural order.
|
||||
@@ -74,25 +60,15 @@ export function min<T extends Numeric>(array: T[]): T | undefined;
|
||||
/**
|
||||
* Return the minimum value in the array using natural order.
|
||||
*/
|
||||
export function min<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number | undefined;
|
||||
export function min<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string | undefined | null): string | undefined;
|
||||
|
||||
/**
|
||||
* Return the minimum value in the array using natural order.
|
||||
*/
|
||||
export function min<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string): string | undefined;
|
||||
|
||||
/**
|
||||
* Return the minimum value in the array using natural order.
|
||||
*/
|
||||
export function min<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U): U | undefined;
|
||||
export function min<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U | undefined | null): U | undefined;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
export function extent(array: number[]): [number, number] | [undefined, undefined];
|
||||
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
@@ -106,79 +82,70 @@ export function extent<T extends Numeric>(array: T[]): [T, T] | [undefined, unde
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
export function extent<T extends Numeric>(array: Array<T | Primitive>): [T | Primitive, T | Primitive] | [undefined, undefined];
|
||||
export function extent<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string | undefined | null): [string, string] | [undefined, undefined];
|
||||
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
export function extent<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): [number, number] | [undefined, undefined];
|
||||
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
export function extent<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => string): [string, string] | [undefined, undefined];
|
||||
|
||||
/**
|
||||
* Return the min and max simultaneously.
|
||||
*/
|
||||
export function extent<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U): [U, U ] | [undefined, undefined];
|
||||
export function extent<T, U extends Numeric>(array: T[], accessor: (datum: T, index: number, array: T[]) => U | undefined | null): [U, U] | [undefined, undefined];
|
||||
|
||||
/**
|
||||
* Return the mean of an array of numbers
|
||||
*/
|
||||
export function mean(array: number[]): number | undefined;
|
||||
export function mean<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number | undefined;
|
||||
export function mean<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
|
||||
export function mean<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number | undefined;
|
||||
|
||||
/**
|
||||
* Return the median of an array of numbers
|
||||
*/
|
||||
export function median(array: number[]): number | undefined;
|
||||
export function median<T>(array: T[], accessor: (element: T, i: number, array: T[]) => number): number | undefined;
|
||||
export function median<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
|
||||
export function median<T>(array: T[], accessor: (element: T, i: number, array: T[]) => number | undefined | null): number | undefined;
|
||||
|
||||
/**
|
||||
* Returns the p-quantile of an array of numbers
|
||||
*/
|
||||
export function quantile(array: number[], p: number): number | undefined;
|
||||
export function quantile<T>(array: T[], p: number, accessor: (element: T, i: number, array: T[]) => number): number | undefined;
|
||||
export function quantile<T extends Numeric>(array: Array<T | undefined | null>, p: number): number | undefined;
|
||||
export function quantile<T>(array: T[], p: number, accessor: (element: T, i: number, array: T[]) => number | undefined | null): number | undefined;
|
||||
|
||||
/**
|
||||
* Compute the sum of an array of numbers.
|
||||
*/
|
||||
export function sum(array: number[]): number;
|
||||
export function sum<T extends Numeric>(array: Array<T | undefined | null>): number;
|
||||
|
||||
/**
|
||||
* Compute the sum of an array, using the given accessor to convert values to numbers.
|
||||
*/
|
||||
export function sum<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number;
|
||||
export function sum<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number;
|
||||
|
||||
/**
|
||||
* Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array of numbers.
|
||||
*/
|
||||
export function deviation(array: number[]): number | undefined;
|
||||
export function deviation<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
|
||||
|
||||
/**
|
||||
* Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array,
|
||||
* using the given accessor to convert values to numbers.
|
||||
*/
|
||||
export function deviation<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number | undefined;
|
||||
export function deviation<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number | undefined;
|
||||
|
||||
/**
|
||||
* Compute an unbiased estimator of the population variance of the given array of numbers.
|
||||
*/
|
||||
export function variance(array: number[]): number | undefined;
|
||||
export function variance<T extends Numeric>(array: Array<T | undefined | null>): number | undefined;
|
||||
|
||||
/**
|
||||
* Compute an unbiased estimator of the population variance of the given array,
|
||||
* using the given accessor to convert values to numbers.
|
||||
*/
|
||||
export function variance<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number): number | undefined;
|
||||
export function variance<T>(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number | undefined;
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Searching Arrays
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
export function scan<T>(array: T[], comparator: (a: T, b: T) => number): number;
|
||||
export function scan(array: number[], comparator?: (a: number, b: number) => number): number | undefined;
|
||||
export function scan<T>(array: T[], comparator: (a: T, b: T) => number): number | undefined;
|
||||
|
||||
export function bisectLeft(array: number[], x: number, lo?: number, hi?: number): number;
|
||||
export function bisectLeft(array: string[], x: string, lo?: number, hi?: number): number;
|
||||
@@ -202,16 +169,16 @@ export function bisector<T, U>(accessor: (x: T) => U): Bisector<T, U>;
|
||||
/**
|
||||
* Compares two primitive values for sorting (in ascending order).
|
||||
*/
|
||||
export function ascending(a: Primitive, b: Primitive): number;
|
||||
export function ascending(a: Primitive | undefined, b: Primitive | undefined): number;
|
||||
|
||||
// NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances.
|
||||
/**
|
||||
* Compares two primitive values for sorting (in ascending order).
|
||||
*/
|
||||
export function descending(a: Primitive, b: Primitive): number;
|
||||
export function descending(a: Primitive | undefined, b: Primitive | undefined): number;
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Transforming Arrays
|
||||
// Transforming Arrays
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -236,7 +203,6 @@ export function permute<T>(array: { [key: number]: T }, keys: number[]): T[];
|
||||
*/
|
||||
export function permute<T>(object: { [key: string]: T }, keys: string[]): T[];
|
||||
|
||||
|
||||
/**
|
||||
* Generates a 0-based numeric sequence. The output range does not include 'stop'.
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
Vendored
+2
-2
@@ -578,7 +578,7 @@ declare class Dockerode {
|
||||
|
||||
getTask(id: string): Dockerode.Task;
|
||||
|
||||
getNode(id: string): Node;
|
||||
getNode(id: string): Dockerode.Node;
|
||||
|
||||
getNetwork(id: string): Dockerode.Network;
|
||||
|
||||
@@ -640,4 +640,4 @@ declare class Dockerode {
|
||||
modem: any;
|
||||
}
|
||||
|
||||
export = Dockerode;
|
||||
export = Dockerode;
|
||||
|
||||
+20
-18
@@ -1,20 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dockerode-tests.ts"
|
||||
]
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dockerode-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
@@ -17,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"dookie-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
+16
-5
@@ -3,10 +3,21 @@
|
||||
// Definitions by: Zsolt Kovacs <https://github.com/zskovacs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Dragster {
|
||||
constructor(elem: HTMLElement);
|
||||
removeListeners(): void;
|
||||
reset(): void;
|
||||
declare namespace Dragster {
|
||||
interface Dragster {
|
||||
removeListeners(): void;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
interface DragsterStatic {
|
||||
(elem: HTMLElement): Dragster;
|
||||
new (elem: HTMLElement): Dragster;
|
||||
}
|
||||
}
|
||||
|
||||
export = Dragster;
|
||||
// Support through imports.
|
||||
declare var Dragster: Dragster.DragsterStatic;
|
||||
export = Dragster;
|
||||
|
||||
// Support as a global
|
||||
export as namespace Dragster;
|
||||
@@ -0,0 +1,91 @@
|
||||
/// <reference path="index.d.ts"/>
|
||||
|
||||
//constructor
|
||||
var constructorNoOptions = new Dropkick('#my-select');
|
||||
var constructorNoOptions2 = new Dropkick(new HTMLSelectElement());
|
||||
var constructorOptions = new Dropkick('#my-select', {});
|
||||
var constructorOptions2 = new Dropkick(new HTMLSelectElement(), {});
|
||||
|
||||
//options
|
||||
var options : DropkickOptions = {
|
||||
disabled: true,
|
||||
form: new HTMLFormElement(),
|
||||
length: 1,
|
||||
mobile: true,
|
||||
multiple: true,
|
||||
options: ['test'],
|
||||
selectedIndex: 0,
|
||||
selectedOptions: ['test'],
|
||||
value: 'test',
|
||||
change() { },
|
||||
close() { },
|
||||
open() { },
|
||||
initialize: () => { }
|
||||
}
|
||||
var withFullOptions = new Dropkick('#test', options);
|
||||
|
||||
var dk = new Dropkick('#test');
|
||||
|
||||
//fields (same as options)
|
||||
var o1 = dk.disabled;
|
||||
var o2 = dk.form;
|
||||
var o3 = dk.length;
|
||||
var o4 = dk.mobile;
|
||||
var o5 = dk.multiple;
|
||||
var o6 = dk.options;
|
||||
var o7 = dk.selectedIndex;
|
||||
var o8 = dk.selectedOptions;
|
||||
var o9 = dk.value;
|
||||
|
||||
//methods
|
||||
dk.add('new');
|
||||
dk.add(new HTMLSelectElement());
|
||||
dk.add('new', 'old');
|
||||
dk.add('new', 1);
|
||||
|
||||
dk.disable();
|
||||
dk.disable(false);
|
||||
dk.disable(4, true);
|
||||
dk.disable(4);
|
||||
|
||||
dk.dispose();
|
||||
|
||||
dk.focus();
|
||||
|
||||
dk.hide(4);
|
||||
dk.hide(4, false);
|
||||
|
||||
var node = dk.item(4);
|
||||
|
||||
dk.open();
|
||||
|
||||
dk.refresh();
|
||||
|
||||
dk.remove(4);
|
||||
|
||||
dk.reset();
|
||||
dk.reset(true);
|
||||
|
||||
var words = dk.search("qwer", "fuzzy");
|
||||
|
||||
var node2 = dk.select(4);
|
||||
var node3 = dk.select("AL");
|
||||
var node4 = dk.select(4, true);
|
||||
|
||||
var node5 = dk.selectOne(4);
|
||||
var node6 = dk.selectOne(4, true);
|
||||
|
||||
//real life example
|
||||
var fieldValue = '';
|
||||
var selectOptions : DropkickOptions = {
|
||||
open(this: Dropkick) {
|
||||
const optionsList = (<any>this).data.elem.lastChild; //undocumented but useful data field
|
||||
if (optionsList.scrollWidth > optionsList.offsetWidth) {
|
||||
optionsList.style.width = optionsList.scrollWidth + 25 + 'px';
|
||||
}
|
||||
},
|
||||
change: () => {
|
||||
fieldValue = select.value;
|
||||
}
|
||||
};
|
||||
var select = new Dropkick('#select', options);
|
||||
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
// Type definitions for dropkickjs 2.1
|
||||
// Project: http://dropkickjs.com/
|
||||
// Definitions by: Dmitry Pesterev <https://github.com/VorobeY1326/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface DropkickOptions {
|
||||
disabled?: boolean;
|
||||
form?: Node;
|
||||
length?: number;
|
||||
mobile?: boolean;
|
||||
multiple?: boolean;
|
||||
options?: string[];
|
||||
selectedIndex?: number;
|
||||
selectedOptions?: string[];
|
||||
value?: string;
|
||||
|
||||
change?: () => void;
|
||||
close?: () => void;
|
||||
initialize?: () => void;
|
||||
open?: () => void;
|
||||
}
|
||||
|
||||
declare class Dropkick {
|
||||
constructor(id: string|HTMLElement, options?: DropkickOptions);
|
||||
|
||||
add(value: string | Node, before?: number | string): void;
|
||||
close(): void;
|
||||
disable(disabled?: boolean): void;
|
||||
disable(index: number, disabled?: boolean): void;
|
||||
dispose(): void;
|
||||
focus(): void;
|
||||
hide(index: number, hidden?: boolean): void;
|
||||
item(index: number): Node;
|
||||
open(): void;
|
||||
refresh(): void;
|
||||
remove(index: number): void;
|
||||
reset(clear?: boolean): void;
|
||||
search(string: string, mode?: string): string[];
|
||||
select(element: number|string, selectDisabled?: boolean): Node;
|
||||
selectOne(element: number, selectDisabled?: boolean): Node;
|
||||
|
||||
disabled: boolean;
|
||||
form: Node;
|
||||
length: number;
|
||||
mobile: boolean;
|
||||
multiple: boolean;
|
||||
options: string[];
|
||||
selectedIndex: number;
|
||||
selectedOptions: string[];
|
||||
value: string;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dropkickjs-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Vendored
+1
@@ -735,6 +735,7 @@ declare namespace createjs {
|
||||
intersection(rect: Rectangle): Rectangle;
|
||||
intersects(rect: Rectangle): boolean;
|
||||
isEmpty(): boolean;
|
||||
pad(top: number, left: number, bottom: number, right: number): Rectangle;
|
||||
setValues(x?: number, y?: number, width?: number, height?: number): Rectangle;
|
||||
toString(): string;
|
||||
union(rect: Rectangle): Rectangle;
|
||||
|
||||
Vendored
+1
-1
@@ -2779,7 +2779,7 @@ declare namespace Electron {
|
||||
* The protocol scheme in the form ‘scheme:’. Currently supported values are ‘http:’ or ‘https:’.
|
||||
* Defaults to ‘http:’.
|
||||
*/
|
||||
Protocol?: 'http:' | 'https:';
|
||||
protocol?: 'http:' | 'https:';
|
||||
/**
|
||||
* The server host provided as a concatenation of the hostname and the port number ‘hostname:port’.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import * as envToObject from 'env-to-object';
|
||||
|
||||
const map = {
|
||||
'NODE_ENV': {
|
||||
'keypath': 'env',
|
||||
'type': 'string'
|
||||
},
|
||||
'PORT': {
|
||||
'keypath': 'server.port',
|
||||
'type': 'number'
|
||||
},
|
||||
'SSL': {
|
||||
'keypath': 'server.ssl',
|
||||
'type': 'boolean'
|
||||
},
|
||||
'LOG_LEVEL': {
|
||||
'keypath': 'logger.level',
|
||||
'type': 'string'
|
||||
},
|
||||
'INT': {
|
||||
'keypath': 'int',
|
||||
'type': 'integer',
|
||||
'radix': '2'
|
||||
}
|
||||
};
|
||||
|
||||
const result1:any = envToObject(map);
|
||||
const result2:any = envToObject(map, {
|
||||
parsers: {
|
||||
'my-custom-type': (str: string, opts: any) => {
|
||||
let foo: any = JSON.parse(str);
|
||||
return foo;
|
||||
}
|
||||
}
|
||||
});
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for env-to-object 1.1
|
||||
// Project: https://github.com/kgryte/node-env-to-object#readme
|
||||
// Definitions by: TANAKA Koichi <https://github.com/MugeSo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace env {
|
||||
export interface Mappings {
|
||||
[enviromentVariableName: string]: Mapping;
|
||||
}
|
||||
|
||||
export type Mapping = IntegerMapping | BooleanMapping | GenericMapping;
|
||||
|
||||
interface GenericMapping {
|
||||
keypath: string;
|
||||
type?: string;
|
||||
[opt: string]: any;
|
||||
}
|
||||
|
||||
interface IntegerMapping extends GenericMapping {
|
||||
type: "integer";
|
||||
radix: number;
|
||||
}
|
||||
|
||||
interface BooleanMapping {
|
||||
type: "boolean";
|
||||
strict: boolean;
|
||||
}
|
||||
|
||||
export interface Parsers {
|
||||
[parserName: string]: (str: string, opts: any) => any;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
parsers: Parsers;
|
||||
}
|
||||
}
|
||||
|
||||
declare function env(map: env.Mappings, options?: env.Options): any;
|
||||
export = env;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"env-to-object-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -0,0 +1,18 @@
|
||||
import WeakMap = require('es6-weak-map');
|
||||
|
||||
new WeakMap<{}, string>();
|
||||
|
||||
var tuples: [number, string][] = [ [0, 'foo'], [1, 'bar'] ];
|
||||
new WeakMap<number, string>(tuples);
|
||||
|
||||
var map = new WeakMap<{}, string>();
|
||||
var obj = {};
|
||||
|
||||
map.set(obj, 'foo');
|
||||
map.get(obj);
|
||||
map.has(obj);
|
||||
map.delete(obj);
|
||||
map.get(obj);
|
||||
map.has(obj);
|
||||
map.set(obj, 'bar');
|
||||
map.has(obj);
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for es6-weak-map 1.2
|
||||
// Project: https://github.com/medikoo/es6-weak-map
|
||||
// Definitions by: Pine Mizune <https://github.com/pine>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = WeakMap;
|
||||
export as namespace WeakMap;
|
||||
|
||||
interface Iterable<T> {
|
||||
[Symbol.iterator](): Iterator<T>;
|
||||
}
|
||||
|
||||
declare class WeakMap<K, V> {
|
||||
constructor();
|
||||
constructor(iterable: Iterable<[K, V]>);
|
||||
|
||||
delete(key: K): boolean;
|
||||
get(key: K): V;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value?: V): WeakMap<K, V>;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"es6-weak-map-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
@@ -17,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"express-mysql-session-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
@@ -17,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"forever-monitor-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
+11
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for FullCalendar 2.7.2
|
||||
// Project: http://fullcalendar.io/
|
||||
// Definitions by: Neil Stalker <https://github.com/nestalk>, Marcelo Camargo <https://github.com/hasellcamargo>
|
||||
// Definitions by: Neil Stalker <https://github.com/nestalk>, Marcelo Camargo <https://github.com/hasellcamargo>, Patrick Niemann <https://github.com/panic175>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="jquery"/>
|
||||
@@ -363,6 +363,11 @@ declare global {
|
||||
*/
|
||||
fullCalendar(method: 'updateEvent', event: EventObject): void;
|
||||
|
||||
/**
|
||||
* Reports changes for multiple events and renders them on the calendar.
|
||||
*/
|
||||
fullCalendar(method: 'updateEvents', events: Array<EventObject>): void;
|
||||
|
||||
/**
|
||||
* Retrieves events that FullCalendar has in memory.
|
||||
*/
|
||||
@@ -402,6 +407,11 @@ declare global {
|
||||
* Renders a new event on the calendar.
|
||||
*/
|
||||
fullCalendar(method: 'renderEvent', event: EventObject, stick?: boolean): void;
|
||||
|
||||
/**
|
||||
* Renders new events on the calendar.
|
||||
*/
|
||||
fullCalendar(method: 'renderEvents', events: Array<EventObject>, stick?: boolean): void;
|
||||
|
||||
/**
|
||||
* Rerenders all events on the calendar.
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
function nameSpaceTest() {
|
||||
let components = {} as GaeaModel.ViewportComponentInfo
|
||||
// insert into parent
|
||||
components.props = {
|
||||
gaeaUniqueKey: '123',
|
||||
gaeaName: 'componentName'
|
||||
}
|
||||
}
|
||||
Vendored
-493
@@ -1,493 +0,0 @@
|
||||
// Type definitions for gaea-model 1.0
|
||||
// Project: https://github.com/ascoders/gaea-model
|
||||
// Definitions by: ascoders <https://github.com/ascoders>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export as namespace GaeaModel;
|
||||
|
||||
export type Component = React.ComponentClass<ComponentProps>;
|
||||
|
||||
/**
|
||||
* 组件信息
|
||||
*/
|
||||
export interface ComponentProps extends React.HTMLProps<any> {
|
||||
/**
|
||||
* 唯一的 key,用来唯一标识这个组件,所有盖亚内部组件都以 gaea-old- 为前缀
|
||||
*/
|
||||
gaeaUniqueKey: string;
|
||||
/**
|
||||
* 组件的中文名
|
||||
*/
|
||||
gaeaName: string;
|
||||
/**
|
||||
* 组件图标,为 fontAwesome
|
||||
*/
|
||||
gaeaIcon?: string;
|
||||
/**
|
||||
* 编辑信息
|
||||
*/
|
||||
gaeaEdit?: ComponentPropsGaeaEdit[];
|
||||
/**
|
||||
* 事件定义
|
||||
*/
|
||||
gaeaEvent?: GaeaEvent;
|
||||
/**
|
||||
* 是否在预览模式,preivew 会传入 true
|
||||
*/
|
||||
gaeaPreview?: boolean;
|
||||
/**
|
||||
* 是否可以拖入子元素
|
||||
*/
|
||||
canDragIn?: boolean;
|
||||
/**
|
||||
* 存储事件设置
|
||||
*/
|
||||
gaeaEventData?: EventData[];
|
||||
/**
|
||||
* 存储native事件设置
|
||||
*/
|
||||
gaeaNativeEventData?: EventData[];
|
||||
/**
|
||||
* 存储变量信息
|
||||
*/
|
||||
gaeaVariables?: {
|
||||
[field: string]: VariableData;
|
||||
};
|
||||
|
||||
[x: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组件配置中数组配置
|
||||
*/
|
||||
export interface ComponentPropsOptionsArray extends ComponentPropsGaeaEdit {
|
||||
key: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组件配置中数组配置的值
|
||||
*/
|
||||
export interface ComponentPropsOptionsArrayValue {
|
||||
/**
|
||||
* ComponentPropsOptionsArray 设置的 key
|
||||
*/
|
||||
key: string;
|
||||
/**
|
||||
* 用户填入的值
|
||||
*/
|
||||
value: number | string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组件配置 选择器配置
|
||||
*/
|
||||
export interface ComponentPropsOptionsSelector {
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* number 配置项
|
||||
*/
|
||||
export interface Number {
|
||||
// 为空时,是数字,否则会以字符串加后缀形式赋值
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组件的值
|
||||
*/
|
||||
export type ComponentPropsOptionValue = number | string | boolean | ComponentPropsOptionsArrayValue[] | any;
|
||||
|
||||
/**
|
||||
* 组件配置
|
||||
*/
|
||||
export interface ComponentPropsGaeaEdit {
|
||||
/**
|
||||
* 对应字段名
|
||||
*/
|
||||
field: string;
|
||||
/**
|
||||
* 选项名称
|
||||
*/
|
||||
label: string;
|
||||
/**
|
||||
* 编辑器类型
|
||||
*/
|
||||
editor: string;
|
||||
/**
|
||||
* 是否可被编辑
|
||||
*/
|
||||
editable: boolean;
|
||||
/**
|
||||
* 是否隐藏编辑工具
|
||||
*/
|
||||
hideTool: boolean;
|
||||
/**
|
||||
* 当 editor 为 array 时的数组配置
|
||||
* 数组中的 key,和填入的值,会作为 Array<key:value> 填入到 value 中
|
||||
*/
|
||||
array?: ComponentPropsOptionsArrayValue[];
|
||||
/**
|
||||
* 当 editor 为 selector 时的数组配置
|
||||
*/
|
||||
selector?: ComponentPropsOptionsSelector[];
|
||||
/**
|
||||
* 值类型, 默认为字符串
|
||||
*/
|
||||
type?: string;
|
||||
/**
|
||||
* 为空时的值,默认为 null
|
||||
*/
|
||||
emptyValue?: any;
|
||||
/**
|
||||
* 控制 number 单位
|
||||
*/
|
||||
number?: {
|
||||
units: number[];
|
||||
currentUnit: string;
|
||||
max?: number;
|
||||
min?: number;
|
||||
step?: number;
|
||||
speed?: number;
|
||||
inputRange?: number[];
|
||||
outputRange?: number[];
|
||||
slider?: boolean;
|
||||
};
|
||||
/**
|
||||
* 枚举实例
|
||||
*/
|
||||
instance?: Array<{
|
||||
[key: string]: ComponentPropsOptionValue;
|
||||
}>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组合信息
|
||||
*/
|
||||
export interface ComboComponentInfo extends ViewportComponentFullInfo {
|
||||
// 组合名
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发布列表的返回值
|
||||
*/
|
||||
export interface GetPublishListResult {
|
||||
// 版本
|
||||
version: string;
|
||||
// 描述
|
||||
description: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 版本信息
|
||||
*/
|
||||
export interface VersionInfo {
|
||||
content: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件设置
|
||||
*/
|
||||
export interface GaeaEvent {
|
||||
triggers: EventTriggerCondition[];
|
||||
effects: EventAction[];
|
||||
}
|
||||
|
||||
export interface EventData {
|
||||
type: string;
|
||||
event: string;
|
||||
/**
|
||||
* 因为事件可能 type 相同,因此记录是第几个
|
||||
*/
|
||||
typeIndex: number;
|
||||
eventIndex: number;
|
||||
typeData?: EventTriggerEvent;
|
||||
eventData?: EventActionJumpUrl | EventActionCall | EventActionEvent;
|
||||
}
|
||||
|
||||
export interface EventTriggerCondition {
|
||||
name: string;
|
||||
// 触发类型
|
||||
type: string;
|
||||
// 是否由自己的生命周期触发
|
||||
selfCallback?: boolean;
|
||||
}
|
||||
|
||||
export interface EventAction {
|
||||
name: string;
|
||||
// 动作类型
|
||||
// call: 调用传进来的方法
|
||||
// jumpUrl: 跳转一个网址
|
||||
type: string;
|
||||
call?: EventCallType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件定义类型
|
||||
*/
|
||||
export interface EventCallType {
|
||||
// 调用函数名称
|
||||
functionName: string;
|
||||
// 调用参数
|
||||
param?: EventCallTypeParam[];
|
||||
}
|
||||
|
||||
export interface EventCallTypeParam {
|
||||
label: string;
|
||||
field: string;
|
||||
editor: string; // text
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件触发数据类型
|
||||
*/
|
||||
export interface EventTriggerEvent {
|
||||
listen?: string;
|
||||
}
|
||||
|
||||
export interface EventUpdatePropsEvent {
|
||||
/**
|
||||
* 修改后的 props
|
||||
*/
|
||||
props: ComponentProps;
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件动作数据类型
|
||||
*/
|
||||
export interface EventActionJumpUrl {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface EventActionCall {
|
||||
// 函数在 map 里的 key
|
||||
key?: string;
|
||||
}
|
||||
|
||||
export interface EventActionEvent {
|
||||
emit?: string;
|
||||
}
|
||||
|
||||
export interface ExternalParameter {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* 类型
|
||||
* number string boolean
|
||||
*/
|
||||
type: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标识哪些字段用什么变量
|
||||
*/
|
||||
export interface VariableData {
|
||||
// 变量类型
|
||||
// 比如是外部传参,还是全局变量
|
||||
variableType: string;
|
||||
// 变量的哪个字段
|
||||
variableField: string;
|
||||
// 值类型 string number boolean
|
||||
valueType: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件信息
|
||||
*/
|
||||
export interface Plugin extends React.ComponentClass<any> {
|
||||
// 插件安放位置
|
||||
position: string;
|
||||
Action?: any;
|
||||
Store?: any;
|
||||
}
|
||||
|
||||
/********************************************************************************************************
|
||||
* DIff
|
||||
********************************************************************************************************/
|
||||
export interface Diff {
|
||||
// 操作类型
|
||||
type: 'add' | 'move' | 'remove' | 'exchange' | 'update' | 'paste' | 'reset' | 'addCombo' | 'addSource';
|
||||
// 操作组件的 mapUniqueKey
|
||||
mapUniqueKey: string;
|
||||
// 新增操作
|
||||
add?: {
|
||||
// 新增组件的唯一标识 id
|
||||
uniqueId: string;
|
||||
// 父级 mapKey
|
||||
parentMapUniqueKey: string;
|
||||
// 插入的位置
|
||||
index: number;
|
||||
};
|
||||
// 移动到另一个父元素
|
||||
move?: {
|
||||
// 移动到的父级 mapKey
|
||||
targetParentMapUniqueKey: string;
|
||||
// 移动前父级 mapKey
|
||||
sourceParentMapUniqueKey: string;
|
||||
// 插入的位置
|
||||
targetIndex: number;
|
||||
// 移除的位置
|
||||
sourceIndex: number;
|
||||
};
|
||||
// 删除组件
|
||||
remove?: DiffRemove;
|
||||
// 内部交换顺序
|
||||
exchange?: {
|
||||
oldIndex: number;
|
||||
newIndex: number;
|
||||
};
|
||||
// 更新操作
|
||||
update?: {
|
||||
oldValue: ComponentProps;
|
||||
newValue: ComponentProps;
|
||||
};
|
||||
// 粘贴操作
|
||||
paste?: DiffRemove;
|
||||
// 重置组件
|
||||
reset?: {
|
||||
// 重置前的信息
|
||||
beforeProps: ComponentProps;
|
||||
beforeName: string;
|
||||
};
|
||||
// 新增组合
|
||||
addCombo?: {
|
||||
// 父级 mapKey
|
||||
parentMapUniqueKey: string;
|
||||
// 父级的 index
|
||||
index: number;
|
||||
// 组合的完整信息(不是 copy 的, 是真正对应的 mapUniqueKey)
|
||||
componentInfo: ViewportComponentFullInfo;
|
||||
};
|
||||
// 新增模板
|
||||
addSource?: {
|
||||
// 父级 mapKey
|
||||
parentMapUniqueKey: string;
|
||||
// 父级的 index
|
||||
index: number;
|
||||
// 组合的完整信息(不是 copy 的, 是真正对应的 mapUniqueKey)
|
||||
componentInfo: ViewportComponentFullInfo;
|
||||
};
|
||||
}
|
||||
|
||||
export interface DiffRemove extends ViewportComponentFullInfo {
|
||||
// 父级元素 mapKey
|
||||
parentMapUniqueKey: string;
|
||||
// 删除的位置
|
||||
index: number;
|
||||
}
|
||||
|
||||
/********************************************************************************************************
|
||||
* Viewport
|
||||
********************************************************************************************************/
|
||||
/**
|
||||
* 在视图中的组件属性
|
||||
*/
|
||||
export interface ViewportComponentInfo {
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
props: ComponentProps;
|
||||
/**
|
||||
* 子元素(canDragIn才有)
|
||||
* 只存子元素在 map 中的 key
|
||||
*/
|
||||
layoutChilds?: string[];
|
||||
/**
|
||||
* 父级 mapUniqueKey, 这样不但方便寻找父级,还能根据是否为 null 判断是否为根元素
|
||||
*/
|
||||
parentMapUniqueKey: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前正在移动元素的信息
|
||||
*/
|
||||
export interface MovingComponent {
|
||||
// 在编辑区域的组件信息
|
||||
mapUniqueKey: string;
|
||||
// 是否是新拖拽的
|
||||
isNew: boolean;
|
||||
// 组件的唯一标识, 新建的时候采用
|
||||
uniqueKey: string;
|
||||
// 直接给 source 就直接用
|
||||
source: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* hover 元素的信息
|
||||
*/
|
||||
export interface HoverComponentSpec {
|
||||
left: number;
|
||||
top: number;
|
||||
width: number;
|
||||
height: number;
|
||||
hovering: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 一个独立组件的完整信息
|
||||
*/
|
||||
export interface ViewportComponentFullInfo {
|
||||
// 组件的 mapUniqueKey
|
||||
mapUniqueKey: string;
|
||||
// 组件信息
|
||||
componentInfo: ViewportComponentInfo;
|
||||
// 子元素列表 (包括非直接子集)
|
||||
childs: {
|
||||
[mapUniqueKey: string]: ViewportComponentInfo;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前拖拽元素信息
|
||||
*/
|
||||
export interface CurrentDragComponentInfo {
|
||||
// 类型
|
||||
type: 'new' | 'combo' | 'viewport';
|
||||
// 开始拖拽父级的 dom
|
||||
dragStartParentElement: HTMLElement;
|
||||
// 开始拖拽在父级中的位置
|
||||
dragStartIndex: number;
|
||||
newInfo?: {
|
||||
// 唯一 key,用来实例化组件
|
||||
uniqueKey: string;
|
||||
};
|
||||
comboInfo?: {
|
||||
// combo 信息
|
||||
source: string;
|
||||
};
|
||||
viewportInfo?: {
|
||||
// 当前拖拽组件的 mapUniqueKey
|
||||
mapUniqueKey: string;
|
||||
// 拖拽目标的 mapUniqueKey
|
||||
targetMapUniqueKey?: string;
|
||||
// 拖拽目标的 index
|
||||
targetIndex?: number;
|
||||
};
|
||||
}
|
||||
|
||||
/********************************************************************************************************
|
||||
* Event
|
||||
********************************************************************************************************/
|
||||
/**
|
||||
* 鼠标移动到组件上/树对应的组件上
|
||||
*/
|
||||
export interface MouseHoverComponentEvent {
|
||||
mapUniqueKey: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改某个组件选中状态
|
||||
*/
|
||||
export interface ComponentSelectStatusEvent {
|
||||
mapUniqueKey: string;
|
||||
selected: boolean;
|
||||
}
|
||||
@@ -19,6 +19,28 @@ function test_getAuthInstance(){
|
||||
var auth = gapi.auth2.getAuthInstance();
|
||||
}
|
||||
|
||||
function test_signIn(){
|
||||
gapi.auth2.getAuthInstance().signIn({
|
||||
scope: 'email profile',
|
||||
prompt: 'content'
|
||||
});
|
||||
}
|
||||
|
||||
function test_signInOptionsBuild(){
|
||||
var options = new gapi.auth2.SigninOptionsBuilder();
|
||||
options.setAppPackageName('com.example.app');
|
||||
options.setFetchBasicProfile(true);
|
||||
options.setPrompt('select_account');
|
||||
options.setScope('profile').setScope('email');
|
||||
gapi.auth2.getAuthInstance().signIn(options);
|
||||
}
|
||||
|
||||
function test_getAuthResponse(){
|
||||
var user = gapi.auth2.getAuthInstance().currentUser.get();
|
||||
var authResponse = user.getAuthResponse();
|
||||
var authResponseWithAuth = user.getAuthResponse(true);
|
||||
}
|
||||
|
||||
function test_render(){
|
||||
var success = (googleUser: gapi.auth2.GoogleUser): void => {
|
||||
console.log(googleUser);
|
||||
|
||||
Vendored
+33
-26
@@ -31,12 +31,7 @@ declare namespace gapi.auth2 {
|
||||
/**
|
||||
* Signs in the user using the specified options.
|
||||
*/
|
||||
signIn(options?: {
|
||||
app_package_name?: string;
|
||||
fetch_basic_profile?: boolean;
|
||||
prompt?: boolean;
|
||||
scope?: string;
|
||||
}, optionBuilder?: SigninOptionsBuilder): any;
|
||||
signIn(options?: SigninOptions | SigninOptionsBuilder): any;
|
||||
|
||||
/**
|
||||
* Signs out all accounts from the application.
|
||||
@@ -59,12 +54,8 @@ declare namespace gapi.auth2 {
|
||||
/**
|
||||
* Attaches the sign-in flow to the specified container's click handler.
|
||||
*/
|
||||
attachClickHandler(container: any, options: {
|
||||
app_package_name?: string;
|
||||
fetch_basic_profile?: boolean;
|
||||
prompt?: boolean;
|
||||
scope?: string;
|
||||
}, onsuccess: (googleUser: GoogleUser) => any, onfailure: (reason: string) => any): any;
|
||||
attachClickHandler(container: any, options: SigninOptions,
|
||||
onsuccess: (googleUser: GoogleUser) => any, onfailure: (reason: string) => any): any;
|
||||
}
|
||||
|
||||
export interface IsSignedIn{
|
||||
@@ -93,6 +84,32 @@ declare namespace gapi.auth2 {
|
||||
listen(listener: (user: GoogleUser) => any): void;
|
||||
}
|
||||
|
||||
export interface SigninOptions {
|
||||
/**
|
||||
* The package name of the Android app to install over the air.
|
||||
* See Android app installs from your web site:
|
||||
* https://developers.google.com/identity/sign-in/web/android-app-installs
|
||||
*/
|
||||
app_package_name?: string;
|
||||
/**
|
||||
* Fetch users' basic profile information when they sign in.
|
||||
* Adds 'profile', 'email' and 'openid' to the requested scopes.
|
||||
* True if unspecified.
|
||||
*/
|
||||
fetch_basic_profile?: boolean;
|
||||
/**
|
||||
* Specifies whether to prompt the user for re-authentication.
|
||||
* See OpenID Connect Request Parameters:
|
||||
* https://openid.net/specs/openid-connect-basic-1_0.html#RequestParameters
|
||||
*/
|
||||
prompt?: string;
|
||||
/**
|
||||
* The scopes to request, as a space-delimited string.
|
||||
* Optional if fetch_basic_profile is not set to false.
|
||||
*/
|
||||
scope?: string;
|
||||
}
|
||||
|
||||
export class SigninOptionsBuilder {
|
||||
setAppPackageName(name: string): any;
|
||||
setFetchBasicProfile(fetch: boolean): any;
|
||||
@@ -151,7 +168,7 @@ declare namespace gapi.auth2 {
|
||||
/**
|
||||
* Get the response object from the user's auth session.
|
||||
*/
|
||||
getAuthResponse(): AuthResponse;
|
||||
getAuthResponse(includeAuthorizationData?: boolean): AuthResponse;
|
||||
|
||||
/**
|
||||
* Returns true if the user granted the specified scopes.
|
||||
@@ -164,22 +181,12 @@ declare namespace gapi.auth2 {
|
||||
* When you use GoogleUser.signIn(), the sign-in flow skips the account chooser step.
|
||||
* See GoogleAuth.signIn().
|
||||
*/
|
||||
signIn(options?: {
|
||||
app_package_name?: string;
|
||||
fetch_basic_profile?: boolean;
|
||||
prompt?: boolean;
|
||||
scope?: string;
|
||||
}, optionBuilder?: SigninOptionsBuilder): any;
|
||||
signIn(options?: SigninOptions | SigninOptionsBuilder): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* See GoogleUser.signIn()
|
||||
*/
|
||||
grant(options?: {
|
||||
app_package_name?: string;
|
||||
fetch_basic_profile?: boolean;
|
||||
prompt?: boolean;
|
||||
scope?: string;
|
||||
}, optionBuilder?: SigninOptionsBuilder): any;
|
||||
grant(options?: SigninOptions | SigninOptionsBuilder): any;
|
||||
|
||||
/**
|
||||
* Get permission from the user to access the specified scopes offline.
|
||||
|
||||
Vendored
+4
-4
@@ -61,22 +61,22 @@ interface GlobuleStatic {
|
||||
*/
|
||||
find(pattern: string, pattern2: string, pattern3: string | string[], options?: FindOptions): string[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Given a set of source file paths, returns an array of src-dest file mapping objects
|
||||
*/
|
||||
mapping(filepaths: string[], options?: MappingOptions): OneMapping[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Given a set of source file paths, returns an array of src-dest file mapping objects
|
||||
*/
|
||||
mapping(options: MappingOptions): OneMapping[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Given a set of source file paths, returns an array of src-dest file mapping objects
|
||||
*/
|
||||
mapping(filepaths: string[], filepaths2: string[], options?: MappingOptions): OneMapping[];
|
||||
|
||||
/**
|
||||
/**
|
||||
* Given a set of source file paths, returns an array of src-dest file mapping objects
|
||||
*/
|
||||
mapping(filepaths: string[], filepaths2: string[], filepaths3: string[], options?: MappingOptions): OneMapping[];
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
@@ -17,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"hapi-auth-jwt2-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -39,3 +39,18 @@ class TestController implements Controller {
|
||||
const server = new hapi.Server();
|
||||
|
||||
server.route(new TestController().routes());
|
||||
|
||||
@controller('/test')
|
||||
class SimpleTestController implements Controller {
|
||||
|
||||
foo: string;
|
||||
|
||||
constructor(foo: string) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
baseUrl: string;
|
||||
routes: () => hapi.IRouteConfiguration[];
|
||||
}
|
||||
|
||||
server.route(new SimpleTestController('bar').routes());
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as hapi from 'hapi';
|
||||
interface ControllerStatic {
|
||||
new (): Controller;
|
||||
new (...args: any[]): Controller;
|
||||
}
|
||||
export interface Controller {
|
||||
baseUrl: string;
|
||||
|
||||
Vendored
+7
@@ -701,6 +701,13 @@ declare namespace Highcharts {
|
||||
* @default false
|
||||
*/
|
||||
reversed?: boolean;
|
||||
/**
|
||||
* If true, the first series in a stack will be drawn on top in a positive, non-reversed Y axis. If false, the first series is in the base of the stack.
|
||||
* Only used for yAxis
|
||||
* @default true
|
||||
* @since 3.0.10
|
||||
*/
|
||||
reversedStacks?: boolean;
|
||||
/**
|
||||
* Whether to show the axis line and title when the axis has no data.
|
||||
* @default true
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user