mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-30 02:01:46 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
+257
-121
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ Please fill in this template.
|
||||
Select one of these and delete the others:
|
||||
|
||||
If adding a new definition:
|
||||
- [ ] The package does not provide its own types, and you can not add them.
|
||||
- [ ] The package does not already provide its own types, or cannot have its `.d.ts` files generated via `--declaration`
|
||||
- [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
|
||||
- [ ] Create it with `dts-gen --dt`, not by basing it on an existing project.
|
||||
- [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, `strictNullChecks`, and `strictFunctionTypes` set to `true`.
|
||||
|
||||
@@ -105,7 +105,7 @@ If it doesn't, you can do so yourself in the comment associated with the PR.
|
||||
|
||||
#### Create a new package
|
||||
|
||||
If you are the library author, or can make a pull request to the library, [bundle types](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) instead of publishing to DefinitelyTyped.
|
||||
If you are the library author and your package is written in TypeScript, [bundle the autogenerated declaration files](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) in your package instead of publishing to DefinitelyTyped.
|
||||
|
||||
If you are adding typings for an NPM package, create a directory with the same name.
|
||||
If the package you are adding typings for is not on NPM, make sure the name you choose for it does not conflict with the name of a package on NPM.
|
||||
@@ -239,7 +239,8 @@ If types are part of a web standard, they should be contributed to [TSJS-lib-gen
|
||||
|
||||
#### A package uses `export =`, but I prefer to use default imports. Can I change `export =` to `export default`?
|
||||
|
||||
If default imports work in your environment, consider turning on the [`--allowSyntheticDefaultImports`](http://www.typescriptlang.org/docs/handbook/compiler-options.html) compiler option.
|
||||
If you are using TypeScript 2.7 or later, use `--esModuleInterop` in your project.
|
||||
Otherwise, if default imports work in your environment (e.g. Webpack, SystemJS, esm), consider turning on the [`--allowSyntheticDefaultImports`](http://www.typescriptlang.org/docs/handbook/compiler-options.html) compiler option.
|
||||
Do not change the type definition if it is accurate.
|
||||
For an NPM package, `export =` is accurate if `node -p 'require("foo")'` is the export, and `export default` is accurate if `node -p 'require("foo").default'` is the export.
|
||||
|
||||
|
||||
@@ -210,6 +210,12 @@
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/camel-case",
|
||||
"asOfVersion": "1.2.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "catalog",
|
||||
"typingsPackageName": "catalog",
|
||||
"sourceRepoURL": "https://github.com/interactivethings/catalog",
|
||||
"asOfVersion": "3.5.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "chalk",
|
||||
"typingsPackageName": "chalk",
|
||||
@@ -1146,6 +1152,12 @@
|
||||
"sourceRepoURL": "https://github.com/react-ga/react-ga",
|
||||
"asOfVersion": "2.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-native-collapsible",
|
||||
"typingsPackageName": "react-native-collapsible",
|
||||
"sourceRepoURL": "https://github.com/oblador/react-native-collapsible",
|
||||
"asOfVersion": "0.11.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-native-elements",
|
||||
"typingsPackageName": "react-native-elements",
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import AuthenticationContext, {
|
||||
AuthenticationContextOptions,
|
||||
TokenCallback,
|
||||
UserCallback
|
||||
} from "adal-angular";
|
||||
import AuthenticationContext = require("adal-angular");
|
||||
|
||||
const onLogin: TokenCallback = (errorDescription, idToken, error) => {
|
||||
const onLogin: AuthenticationContext.TokenCallback = (errorDescription, idToken, error) => {
|
||||
if (error) {
|
||||
console.error(errorDescription, error);
|
||||
return;
|
||||
@@ -14,7 +10,7 @@ const onLogin: TokenCallback = (errorDescription, idToken, error) => {
|
||||
}
|
||||
};
|
||||
|
||||
const onToken: TokenCallback = (errorDesc, token, error) => {
|
||||
const onToken: AuthenticationContext.TokenCallback = (errorDesc, token, error) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
return;
|
||||
@@ -22,7 +18,7 @@ const onToken: TokenCallback = (errorDesc, token, error) => {
|
||||
console.log('Making request with token:', token);
|
||||
};
|
||||
|
||||
const onUser: UserCallback = (error, user) => {
|
||||
const onUser: AuthenticationContext.UserCallback = (error, user) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
return;
|
||||
@@ -57,7 +53,7 @@ const acquireAnAccessToken = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const config: AuthenticationContextOptions = {
|
||||
const config: AuthenticationContext.Options = {
|
||||
clientId: "7cee0f68-5051-41f6-9e45-80463d21d65d",
|
||||
redirectUri: "http://localhost:16969/",
|
||||
instance: "https://login.microsoftonline.com/",
|
||||
@@ -70,6 +66,7 @@ const config: AuthenticationContextOptions = {
|
||||
};
|
||||
|
||||
const authenticationContext = new AuthenticationContext(config);
|
||||
window.Logging.level = authenticationContext.CONSTANTS.LOGGING_LEVEL.ERROR;
|
||||
|
||||
if (authenticationContext.isCallback(window.location.hash)) {
|
||||
authenticationContext.handleWindowCallback();
|
||||
@@ -79,6 +76,11 @@ if (authenticationContext.isCallback(window.location.hash)) {
|
||||
acquireAnAccessToken();
|
||||
}
|
||||
|
||||
const injectedContext = AuthenticationContext.inject({
|
||||
clientId: "7cee0f68-5051-41f6-9e45-80463d21d65d",
|
||||
});
|
||||
injectedContext.handleWindowCallback();
|
||||
|
||||
setTimeout(() => {
|
||||
authenticationContext.logOut();
|
||||
}, 60000);
|
||||
|
||||
Vendored
+242
-139
@@ -1,142 +1,28 @@
|
||||
// Type definitions for adal-angular 1.0
|
||||
// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js#readme
|
||||
// Definitions by: Daniel Perez Alvarez <https://github.com/unindented>
|
||||
// Anthony Ciccarello <https://github.com/aciccarello>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export enum LoggingLevel {
|
||||
ERROR = 0,
|
||||
WARNING = 1,
|
||||
INFO = 2,
|
||||
VERBOSE = 3
|
||||
}
|
||||
// In module contexts the class constructor function is the exported object
|
||||
export = AuthenticationContext;
|
||||
|
||||
export type RequestType = "LOGIN" | "RENEW_TOKEN" | "UNKNOWN";
|
||||
// This class is defined globally in not in a module context
|
||||
declare class AuthenticationContext {
|
||||
instance: string;
|
||||
config: AuthenticationContext.Options;
|
||||
callback: AuthenticationContext.TokenCallback;
|
||||
popUp: boolean;
|
||||
isAngular: boolean;
|
||||
|
||||
export type ResponseType = "id_token token" | "token";
|
||||
/**
|
||||
* Enum for request type
|
||||
*/
|
||||
REQUEST_TYPE: AuthenticationContext.RequestType;
|
||||
RESPONSE_TYPE: AuthenticationContext.ResponseType;
|
||||
CONSTANTS: AuthenticationContext.Constants;
|
||||
|
||||
export interface RequestInfo {
|
||||
/**
|
||||
* Object comprising of fields such as id_token/error, session_state, state, e.t.c.
|
||||
*/
|
||||
parameters: any;
|
||||
/**
|
||||
* Request type.
|
||||
*/
|
||||
requestType: RequestType;
|
||||
/**
|
||||
* Whether state is valid.
|
||||
*/
|
||||
stateMatch: boolean;
|
||||
/**
|
||||
* Unique guid used to match the response with the request.
|
||||
*/
|
||||
stateResponse: string;
|
||||
/**
|
||||
* Whether `requestType` contains `id_token`, `access_token` or error.
|
||||
*/
|
||||
valid: boolean;
|
||||
}
|
||||
|
||||
export interface UserInfo {
|
||||
/**
|
||||
* Username assigned from UPN or email.
|
||||
*/
|
||||
userName: string;
|
||||
/**
|
||||
* Properties parsed from `id_token`.
|
||||
*/
|
||||
profile: any;
|
||||
}
|
||||
|
||||
export type TokenCallback = (
|
||||
errorDesc: string | null,
|
||||
token: string,
|
||||
error: any
|
||||
) => void;
|
||||
|
||||
export type UserCallback = (errorDesc: string | null, user: UserInfo) => void;
|
||||
|
||||
export interface AuthenticationContextOptions {
|
||||
/**
|
||||
* Client ID assigned to your app by Azure Active Directory.
|
||||
*/
|
||||
clientId: string;
|
||||
/**
|
||||
* Endpoint at which you expect to receive tokens.Defaults to `window.location.href`.
|
||||
*/
|
||||
redirectUri: string;
|
||||
/**
|
||||
* Azure Active Directory instance. Defaults to `https://login.microsoftonline.com/`.
|
||||
*/
|
||||
instance?: string;
|
||||
/**
|
||||
* Your target tenant. Defaults to `common`.
|
||||
*/
|
||||
tenant?: string;
|
||||
/**
|
||||
* Query parameters to add to the authentication request.
|
||||
*/
|
||||
extraQueryParameter?: string;
|
||||
/**
|
||||
* Unique identifier used to map the request with the response. Defaults to RFC4122 version 4 guid (128 bits).
|
||||
*/
|
||||
correlationId?: string;
|
||||
/**
|
||||
* User defined function of handling the navigation to Azure AD authorization endpoint in case of login.
|
||||
*/
|
||||
displayCall?: (url: string) => void;
|
||||
/**
|
||||
* Set this to true to enable login in a popup winodow instead of a full redirect. Defaults to `false`.
|
||||
*/
|
||||
popUp?: boolean;
|
||||
/**
|
||||
* Set this to the resource to request on login. Defaults to `clientId`.
|
||||
*/
|
||||
loginResource?: string;
|
||||
/**
|
||||
* Set this to redirect the user to a custom login page.
|
||||
*/
|
||||
localLoginUrl?: string;
|
||||
/**
|
||||
* Redirects to start page after login. Defaults to `true`.
|
||||
*/
|
||||
navigateToLoginRequestUrl?: boolean;
|
||||
/**
|
||||
* Set this to redirect the user to a custom logout page.
|
||||
*/
|
||||
logOutUri?: string;
|
||||
/**
|
||||
* Redirects the user to postLogoutRedirectUri after logout. Defaults to `redirectUri`.
|
||||
*/
|
||||
postLogoutRedirectUri?: string;
|
||||
/**
|
||||
* Sets browser storage to either 'localStorage' or sessionStorage'. Defaults to `sessionStorage`.
|
||||
*/
|
||||
cacheLocation?: "localStorage" | "sessionStorage";
|
||||
/**
|
||||
* Array of keywords or URIs. Adal will attach a token to outgoing requests that have these keywords or URIs.
|
||||
*/
|
||||
endpoints?: { [resource: string]: string };
|
||||
/**
|
||||
* Array of keywords or URIs. Adal will not attach a token to outgoing requests that have these keywords or URIs.
|
||||
*/
|
||||
anonymousEndpoints?: string[];
|
||||
/**
|
||||
* If the cached token is about to be expired in the expireOffsetSeconds (in seconds), Adal will renew the token instead of using the cached token. Defaults to 300 seconds.
|
||||
*/
|
||||
expireOffsetSeconds?: number;
|
||||
/**
|
||||
* The number of milliseconds of inactivity before a token renewal response from AAD should be considered timed out. Defaults to 6 seconds.
|
||||
*/
|
||||
loadFrameTimeout?: number;
|
||||
/**
|
||||
* Callback to be invoked when a token is acquired.
|
||||
*/
|
||||
callback?: TokenCallback;
|
||||
}
|
||||
|
||||
export default class AuthenticationContext {
|
||||
constructor(options: AuthenticationContextOptions);
|
||||
constructor(options: AuthenticationContext.Options);
|
||||
/**
|
||||
* Initiates the login process by redirecting the user to Azure AD authorization endpoint.
|
||||
*/
|
||||
@@ -153,7 +39,7 @@ export default class AuthenticationContext {
|
||||
/**
|
||||
* If user object exists, returns it. Else creates a new user object by decoding `id_token` from the cache.
|
||||
*/
|
||||
getCachedUser(): UserInfo;
|
||||
getCachedUser(): AuthenticationContext.UserInfo;
|
||||
/**
|
||||
* Adds the passed callback to the array of callbacks for the specified resource.
|
||||
* @param resource A URI that identifies the resource for which the token is requested.
|
||||
@@ -163,14 +49,14 @@ export default class AuthenticationContext {
|
||||
registerCallback(
|
||||
expectedState: string,
|
||||
resource: string,
|
||||
callback: TokenCallback
|
||||
callback: AuthenticationContext.TokenCallback
|
||||
): void;
|
||||
/**
|
||||
* Acquires token from the cache if it is not expired. Otherwise sends request to AAD to obtain a new token.
|
||||
* @param resource Resource URI identifying the target resource.
|
||||
* @param callback The callback provided by the caller. It will be called with token or error.
|
||||
*/
|
||||
acquireToken(resource: string, callback: TokenCallback): void;
|
||||
acquireToken(resource: string, callback: AuthenticationContext.TokenCallback): void;
|
||||
/**
|
||||
* Acquires token (interactive flow using a popup window) by sending request to AAD to obtain a new token.
|
||||
* @param resource Resource URI identifying the target resource.
|
||||
@@ -182,7 +68,7 @@ export default class AuthenticationContext {
|
||||
resource: string,
|
||||
extraQueryParameters: string | null | undefined,
|
||||
claims: string | null | undefined,
|
||||
callback: TokenCallback
|
||||
callback: AuthenticationContext.TokenCallback
|
||||
): void;
|
||||
/**
|
||||
* Acquires token (interactive flow using a redirect) by sending request to AAD to obtain a new token. In this case the callback passed in the authentication request constructor will be called.
|
||||
@@ -217,7 +103,7 @@ export default class AuthenticationContext {
|
||||
* Calls the passed in callback with the user object or error message related to the user.
|
||||
* @param callback The callback provided by the caller. It will be called with user or error.
|
||||
*/
|
||||
getUser(callback: UserCallback): void;
|
||||
getUser(callback: AuthenticationContext.UserCallback): void;
|
||||
/**
|
||||
* Checks if the URL fragment contains access token, id token or error description.
|
||||
* @param hash Hash passed from redirect page.
|
||||
@@ -230,11 +116,11 @@ export default class AuthenticationContext {
|
||||
/**
|
||||
* Creates a request info object from the URL fragment and returns it.
|
||||
*/
|
||||
getRequestInfo(hash: string): RequestInfo;
|
||||
getRequestInfo(hash: string): AuthenticationContext.RequestInfo;
|
||||
/**
|
||||
* Saves token or error received in the response from AAD in the cache. In case of `id_token`, it also creates the user object.
|
||||
*/
|
||||
saveTokenFromHash(requestInfo: RequestInfo): void;
|
||||
saveTokenFromHash(requestInfo: AuthenticationContext.RequestInfo): void;
|
||||
/**
|
||||
* Gets resource for given endpoint if mapping is provided with config.
|
||||
* @param endpoint Resource URI identifying the target resource.
|
||||
@@ -252,7 +138,7 @@ export default class AuthenticationContext {
|
||||
* @param message Message to log.
|
||||
* @param error Error to log.
|
||||
*/
|
||||
log(level: LoggingLevel, message: string, error: any): void;
|
||||
log(level: AuthenticationContext.LoggingLevel, message: string, error: any): void;
|
||||
/**
|
||||
* Logs messages when logging level is set to 0.
|
||||
* @param message Message to log.
|
||||
@@ -274,4 +160,221 @@ export default class AuthenticationContext {
|
||||
* @param message Message to log.
|
||||
*/
|
||||
verbose(message: string): void;
|
||||
|
||||
/**
|
||||
* Logs Pii messages when Logging Level is set to 0 and window.piiLoggingEnabled is set to true.
|
||||
* @param message Message to log.
|
||||
* @param error Error to log.
|
||||
*/
|
||||
errorPii(message: string, error: any): void;
|
||||
|
||||
/**
|
||||
* Logs Pii messages when Logging Level is set to 1 and window.piiLoggingEnabled is set to true.
|
||||
* @param message Message to log.
|
||||
*/
|
||||
warnPii(message: string): void;
|
||||
|
||||
/**
|
||||
* Logs messages when Logging Level is set to 2 and window.piiLoggingEnabled is set to true.
|
||||
* @param message Message to log.
|
||||
*/
|
||||
infoPii(message: string): void;
|
||||
|
||||
/**
|
||||
* Logs messages when Logging Level is set to 3 and window.piiLoggingEnabled is set to true.
|
||||
* @param message Message to log.
|
||||
*/
|
||||
verbosePii(message: string): void;
|
||||
}
|
||||
|
||||
declare namespace AuthenticationContext {
|
||||
function inject(config: Options): AuthenticationContext;
|
||||
|
||||
type LoggingLevel = 0 | 1 | 2 | 3;
|
||||
|
||||
type RequestType = "LOGIN" | "RENEW_TOKEN" | "UNKNOWN";
|
||||
|
||||
type ResponseType = "id_token token" | "token";
|
||||
|
||||
interface RequestInfo {
|
||||
/**
|
||||
* Object comprising of fields such as id_token/error, session_state, state, e.t.c.
|
||||
*/
|
||||
parameters: any;
|
||||
/**
|
||||
* Request type.
|
||||
*/
|
||||
requestType: RequestType;
|
||||
/**
|
||||
* Whether state is valid.
|
||||
*/
|
||||
stateMatch: boolean;
|
||||
/**
|
||||
* Unique guid used to match the response with the request.
|
||||
*/
|
||||
stateResponse: string;
|
||||
/**
|
||||
* Whether `requestType` contains `id_token`, `access_token` or error.
|
||||
*/
|
||||
valid: boolean;
|
||||
}
|
||||
|
||||
interface UserInfo {
|
||||
/**
|
||||
* Username assigned from UPN or email.
|
||||
*/
|
||||
userName: string;
|
||||
/**
|
||||
* Properties parsed from `id_token`.
|
||||
*/
|
||||
profile: any;
|
||||
}
|
||||
|
||||
type TokenCallback = (
|
||||
errorDesc: string | null,
|
||||
token: string | null,
|
||||
error: any
|
||||
) => void;
|
||||
|
||||
type UserCallback = (errorDesc: string | null, user: UserInfo | null) => void;
|
||||
|
||||
/**
|
||||
* Configuration options for Authentication Context
|
||||
*/
|
||||
interface Options {
|
||||
/**
|
||||
* Client ID assigned to your app by Azure Active Directory.
|
||||
*/
|
||||
clientId: string;
|
||||
/**
|
||||
* Endpoint at which you expect to receive tokens.Defaults to `window.location.href`.
|
||||
*/
|
||||
redirectUri?: string;
|
||||
/**
|
||||
* Azure Active Directory instance. Defaults to `https://login.microsoftonline.com/`.
|
||||
*/
|
||||
instance?: string;
|
||||
/**
|
||||
* Your target tenant. Defaults to `common`.
|
||||
*/
|
||||
tenant?: string;
|
||||
/**
|
||||
* Query parameters to add to the authentication request.
|
||||
*/
|
||||
extraQueryParameter?: string;
|
||||
/**
|
||||
* Unique identifier used to map the request with the response. Defaults to RFC4122 version 4 guid (128 bits).
|
||||
*/
|
||||
correlationId?: string;
|
||||
/**
|
||||
* User defined function of handling the navigation to Azure AD authorization endpoint in case of login.
|
||||
*/
|
||||
displayCall?: (url: string) => void;
|
||||
/**
|
||||
* Set this to true to enable login in a popup winodow instead of a full redirect. Defaults to `false`.
|
||||
*/
|
||||
popUp?: boolean;
|
||||
/**
|
||||
* Set this to the resource to request on login. Defaults to `clientId`.
|
||||
*/
|
||||
loginResource?: string;
|
||||
/**
|
||||
* Set this to redirect the user to a custom login page.
|
||||
*/
|
||||
localLoginUrl?: string;
|
||||
/**
|
||||
* Redirects to start page after login. Defaults to `true`.
|
||||
*/
|
||||
navigateToLoginRequestUrl?: boolean;
|
||||
/**
|
||||
* Set this to redirect the user to a custom logout page.
|
||||
*/
|
||||
logOutUri?: string;
|
||||
/**
|
||||
* Redirects the user to postLogoutRedirectUri after logout. Defaults to `redirectUri`.
|
||||
*/
|
||||
postLogoutRedirectUri?: string;
|
||||
/**
|
||||
* Sets browser storage to either 'localStorage' or sessionStorage'. Defaults to `sessionStorage`.
|
||||
*/
|
||||
cacheLocation?: "localStorage" | "sessionStorage";
|
||||
/**
|
||||
* Array of keywords or URIs. Adal will attach a token to outgoing requests that have these keywords or URIs.
|
||||
*/
|
||||
endpoints?: { [resource: string]: string };
|
||||
/**
|
||||
* Array of keywords or URIs. Adal will not attach a token to outgoing requests that have these keywords or URIs.
|
||||
*/
|
||||
anonymousEndpoints?: string[];
|
||||
/**
|
||||
* If the cached token is about to be expired in the expireOffsetSeconds (in seconds), Adal will renew the token instead of using the cached token. Defaults to 300 seconds.
|
||||
*/
|
||||
expireOffsetSeconds?: number;
|
||||
/**
|
||||
* The number of milliseconds of inactivity before a token renewal response from AAD should be considered timed out. Defaults to 6 seconds.
|
||||
*/
|
||||
loadFrameTimeout?: number;
|
||||
/**
|
||||
* Callback to be invoked when a token is acquired.
|
||||
*/
|
||||
callback?: TokenCallback;
|
||||
}
|
||||
|
||||
interface LoggingConfig {
|
||||
level: LoggingLevel;
|
||||
log: (message: string) => void;
|
||||
piiLoggingEnabled: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum for storage constants
|
||||
*/
|
||||
interface Constants {
|
||||
ACCESS_TOKEN: 'access_token';
|
||||
EXPIRES_IN: 'expires_in';
|
||||
ID_TOKEN: 'id_token';
|
||||
ERROR_DESCRIPTION: 'error_description';
|
||||
SESSION_STATE: 'session_state';
|
||||
STORAGE: {
|
||||
TOKEN_KEYS: 'adal.token.keys';
|
||||
ACCESS_TOKEN_KEY: 'adal.access.token.key';
|
||||
EXPIRATION_KEY: 'adal.expiration.key';
|
||||
STATE_LOGIN: 'adal.state.login';
|
||||
STATE_RENEW: 'adal.state.renew';
|
||||
NONCE_IDTOKEN: 'adal.nonce.idtoken';
|
||||
SESSION_STATE: 'adal.session.state';
|
||||
USERNAME: 'adal.username';
|
||||
IDTOKEN: 'adal.idtoken';
|
||||
ERROR: 'adal.error';
|
||||
ERROR_DESCRIPTION: 'adal.error.description';
|
||||
LOGIN_REQUEST: 'adal.login.request';
|
||||
LOGIN_ERROR: 'adal.login.error';
|
||||
RENEW_STATUS: 'adal.token.renew.status';
|
||||
};
|
||||
RESOURCE_DELIMETER: '|';
|
||||
LOADFRAME_TIMEOUT: '6000';
|
||||
TOKEN_RENEW_STATUS_CANCELED: 'Canceled';
|
||||
TOKEN_RENEW_STATUS_COMPLETED: 'Completed';
|
||||
TOKEN_RENEW_STATUS_IN_PROGRESS: 'In Progress';
|
||||
LOGGING_LEVEL: {
|
||||
ERROR: 0;
|
||||
WARN: 1;
|
||||
INFO: 2;
|
||||
VERBOSE: 3;
|
||||
};
|
||||
LEVEL_STRING_MAP: {
|
||||
0: 'ERROR:';
|
||||
1: 'WARNING:';
|
||||
2: 'INFO:';
|
||||
3: 'VERBOSE:';
|
||||
};
|
||||
POPUP_WIDTH: 483;
|
||||
POPUP_HEIGHT: 600;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
Logging: AuthenticationContext.LoggingConfig;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"adal-angular-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ var mongoConnectionString = "mongodb://127.0.0.1/agenda";
|
||||
|
||||
var agenda = new Agenda({ db: { address: mongoConnectionString } });
|
||||
|
||||
agenda.define('delete old users', (job, done) => {
|
||||
|
||||
agenda.define<{ foo: Error }>('delete old users', (job, done) => {
|
||||
done(job.attrs.data.foo)
|
||||
});
|
||||
|
||||
agenda.on('ready', () => {
|
||||
@@ -62,7 +62,7 @@ agenda.schedule('tomorrow at noon', ['printAnalyticsReport', 'sendNotifications'
|
||||
|
||||
agenda.now('do the hokey pokey');
|
||||
|
||||
var job = agenda.create('printAnalyticsReport', { userCount: 100 });
|
||||
var job = agenda.create<{ userCount: number }>('printAnalyticsReport', { userCount: 100 });
|
||||
job.save(function(err) {
|
||||
console.log("Job successfully saved");
|
||||
});
|
||||
|
||||
Vendored
+31
-26
@@ -1,6 +1,7 @@
|
||||
// Type definitions for Agenda v1.0.0
|
||||
// Project: https://github.com/rschmukler/agenda
|
||||
// Type definitions for Agenda v1.0.3
|
||||
// Project: https://github.com/agenda/agenda
|
||||
// Definitions by: Meir Gottlieb <https://github.com/meirgottlieb>
|
||||
// Jeff Principe <https://github.com/princjef>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -89,14 +90,14 @@ declare class Agenda extends EventEmitter {
|
||||
* @param name The name of the job.
|
||||
* @param data Data to associated with the job.
|
||||
*/
|
||||
create(name: string, data?: any): Agenda.Job;
|
||||
create<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, data?: T): Agenda.Job<T>;
|
||||
|
||||
/**
|
||||
* Find all Jobs matching `query` and pass same back in cb().
|
||||
* @param query
|
||||
* @param cb
|
||||
*/
|
||||
jobs(query: any, cb: ResultCallback<Agenda.Job[]>): void;
|
||||
jobs<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(query: any, cb: ResultCallback<Agenda.Job<T>[]>): void;
|
||||
|
||||
/**
|
||||
* Removes all jobs in the database without defined behaviors. Useful if you change a definition name and want
|
||||
@@ -113,8 +114,8 @@ declare class Agenda extends EventEmitter {
|
||||
* @param options The options for the job.
|
||||
* @param handler The handler to execute.
|
||||
*/
|
||||
define(name: string, handler: (job: Agenda.Job, done: (err?: Error) => void) => void): void;
|
||||
define(name: string, options: Agenda.JobOptions, handler: (job: Agenda.Job, done: (err?: Error) => void) => void): void;
|
||||
define<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, handler: (job: Agenda.Job<T>, done: (err?: Error) => void) => void): void;
|
||||
define<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, options: Agenda.JobOptions, handler: (job: Agenda.Job<T>, done: (err?: Error) => void) => void): void;
|
||||
|
||||
/**
|
||||
* Runs job name at the given interval. Optionally, data and options can be passed in.
|
||||
@@ -124,8 +125,8 @@ declare class Agenda extends EventEmitter {
|
||||
* @param options An optional argument that will be passed to job.repeatEvery.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
every(interval: number | string, names: string, data?: any, options?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
|
||||
every(interval: number | string, names: string[], data?: any, options?: any, cb?: ResultCallback<Agenda.Job[]>): Agenda.Job[];
|
||||
every<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(interval: number | string, names: string, data?: T, options?: any, cb?: ResultCallback<Agenda.Job<T>>): Agenda.Job<T>;
|
||||
every<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(interval: number | string, names: string[], data?: T, options?: any, cb?: ResultCallback<Agenda.Job<T>[]>): Agenda.Job<T>[];
|
||||
|
||||
/**
|
||||
* Schedules a job to run name once at a given time.
|
||||
@@ -134,8 +135,8 @@ declare class Agenda extends EventEmitter {
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
schedule(when: Date | string, names: string, data?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
|
||||
schedule(when: Date | string, names: string[], data?: any, cb?: ResultCallback<Agenda.Job[]>): Agenda.Job[];
|
||||
schedule<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(when: Date | string, names: string, data?: T, cb?: ResultCallback<Agenda.Job<T>>): Agenda.Job<T>;
|
||||
schedule<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(when: Date | string, names: string[], data?: T, cb?: ResultCallback<Agenda.Job<T>[]>): Agenda.Job<T>[];
|
||||
|
||||
/**
|
||||
* Schedules a job to run name once immediately.
|
||||
@@ -143,7 +144,7 @@ declare class Agenda extends EventEmitter {
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
now(name: string, data?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
|
||||
now<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, data?: T, cb?: ResultCallback<Agenda.Job<T>>): Agenda.Job<T>;
|
||||
|
||||
/**
|
||||
* Cancels any jobs matching the passed mongodb-native query, and removes them from the database.
|
||||
@@ -242,10 +243,14 @@ declare namespace Agenda {
|
||||
}
|
||||
}
|
||||
|
||||
interface JobAttributesData {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* The database record associated with a job.
|
||||
*/
|
||||
interface JobAttributes {
|
||||
interface JobAttributes<T extends JobAttributesData = JobAttributesData> {
|
||||
/**
|
||||
* The record identity.
|
||||
*/
|
||||
@@ -264,7 +269,7 @@ declare namespace Agenda {
|
||||
/**
|
||||
* The job details.
|
||||
*/
|
||||
data: { [name: string]: any };
|
||||
data: T;
|
||||
|
||||
/**
|
||||
* The priority of the job.
|
||||
@@ -330,12 +335,12 @@ declare namespace Agenda {
|
||||
/**
|
||||
* A scheduled job.
|
||||
*/
|
||||
interface Job {
|
||||
interface Job<T extends JobAttributesData = JobAttributesData> {
|
||||
|
||||
/**
|
||||
* The database record associated with the job.
|
||||
*/
|
||||
attrs: JobAttributes;
|
||||
attrs: JobAttributes<T>;
|
||||
|
||||
/**
|
||||
* The agenda that created the job.
|
||||
@@ -348,54 +353,54 @@ declare namespace Agenda {
|
||||
* @param options An optional argument that can include a timezone field. The timezone should be a string as
|
||||
* accepted by moment-timezone and is considered when using an interval in the cron string format.
|
||||
*/
|
||||
repeatEvery(interval: string | number, options?: { timezone?: string }): Job
|
||||
repeatEvery(interval: string | number, options?: { timezone?: string }): Job<T>
|
||||
|
||||
/**
|
||||
* Specifies a time when the job should repeat. [Possible values](https://github.com/matthewmueller/date#examples).
|
||||
* @param time
|
||||
*/
|
||||
repeatAt(time: string): Job
|
||||
repeatAt(time: string): Job<T>
|
||||
|
||||
/**
|
||||
* Disables the job.
|
||||
*/
|
||||
disable(): Job;
|
||||
disable(): Job<T>;
|
||||
|
||||
/**
|
||||
* Enables the job.
|
||||
*/
|
||||
enable(): Job;
|
||||
enable(): Job<T>;
|
||||
|
||||
/**
|
||||
* Ensure that only one instance of this job exists with the specified properties
|
||||
* @param value The properties associated with the job that must be unqiue.
|
||||
* @param opts
|
||||
*/
|
||||
unique(value: any, opts?: { insertOnly?: boolean }): Job;
|
||||
unique(value: any, opts?: { insertOnly?: boolean }): Job<T>;
|
||||
|
||||
/**
|
||||
* Specifies the next time at which the job should run.
|
||||
* @param time The next time at which the job should run.
|
||||
*/
|
||||
schedule(time: string | Date): Job;
|
||||
schedule(time: string | Date): Job<T>;
|
||||
|
||||
/**
|
||||
* Specifies the priority weighting of the job.
|
||||
* @param value The priority of the job (lowest|low|normal|high|highest|number).
|
||||
*/
|
||||
priority(value: string | number): Job;
|
||||
priority(value: string | number): Job<T>;
|
||||
|
||||
/**
|
||||
* Sets job.attrs.failedAt to now, and sets job.attrs.failReason to reason.
|
||||
* @param reason A message or Error object that indicates why the job failed.
|
||||
*/
|
||||
fail(reason: string | Error): Job;
|
||||
fail(reason: string | Error): Job<T>;
|
||||
|
||||
/**
|
||||
* Runs the given job and calls callback(err, job) upon completion. Normally you never need to call this manually
|
||||
* @param cb Called when the job is completed.
|
||||
*/
|
||||
run(cb?: ResultCallback<Job>): Job;
|
||||
run(cb?: ResultCallback<Job<T>>): Job<T>;
|
||||
|
||||
/**
|
||||
* Returns true if the job is running; otherwise, returns false.
|
||||
@@ -406,7 +411,7 @@ declare namespace Agenda {
|
||||
* Saves the job into the database.
|
||||
* @param cb Called when the job is saved.
|
||||
*/
|
||||
save(cb?: ResultCallback<Job>): Job;
|
||||
save(cb?: ResultCallback<Job<T>>): Job<T>;
|
||||
|
||||
/**
|
||||
* Removes the job from the database and cancels the job.
|
||||
@@ -424,7 +429,7 @@ declare namespace Agenda {
|
||||
/**
|
||||
* Calculates next time the job should run
|
||||
*/
|
||||
computeNextRunAt(): Job;
|
||||
computeNextRunAt(): Job<T>;
|
||||
}
|
||||
|
||||
interface JobOptions {
|
||||
|
||||
Vendored
+2
-11
@@ -805,11 +805,7 @@ declare namespace algoliasearch {
|
||||
* @param err() error callback
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/
|
||||
*/
|
||||
searchForFacetValues({
|
||||
facetName,
|
||||
facetQuery,
|
||||
...qp,
|
||||
}: {
|
||||
searchForFacetValues(options: {
|
||||
facetName: string;
|
||||
facetQuery: string;
|
||||
} & AlgoliaQueryParameters): Promise<any>;
|
||||
@@ -820,12 +816,7 @@ declare namespace algoliasearch {
|
||||
* @param err() error callback
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/
|
||||
*/
|
||||
searchForFacetValues(
|
||||
{
|
||||
facetName,
|
||||
facetQuery,
|
||||
...qp,
|
||||
}: {
|
||||
searchForFacetValues(options: {
|
||||
facetName: string;
|
||||
facetQuery: string;
|
||||
} & AlgoliaQueryParameters,
|
||||
|
||||
@@ -8,7 +8,8 @@ myApp.config((
|
||||
$mdAriaProvider: ng.material.IAriaProvider,
|
||||
$mdThemingProvider: ng.material.IThemingProvider,
|
||||
$mdIconProvider: ng.material.IIconProvider,
|
||||
$mdProgressCircularProvider: ng.material.IProgressCircularProvider) => {
|
||||
$mdProgressCircularProvider: ng.material.IProgressCircularProvider,
|
||||
$mdDialogProvider: ng.material.IDialogProvider) => {
|
||||
$mdThemingProvider.alwaysWatchTheme(true);
|
||||
const neonRedMap: ng.material.IPalette = $mdThemingProvider.extendPalette('red', {
|
||||
500: 'ff0000'
|
||||
@@ -56,6 +57,23 @@ myApp.config((
|
||||
|
||||
// Globally disables all ARIA warnings.
|
||||
$mdAriaProvider.disableWarnings();
|
||||
|
||||
// Add custom dialog preset
|
||||
$mdDialogProvider.addPreset('testPreset', {
|
||||
methods: ['entityName'],
|
||||
options: () => {
|
||||
return {
|
||||
template:
|
||||
'<md-dialog>' +
|
||||
'This is a custom preset' +
|
||||
'</md-dialog>',
|
||||
controllerAs: 'dialog',
|
||||
bindToController: true,
|
||||
clickOutsideToClose: true,
|
||||
escapeToClose: true
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
myApp.controller('BottomSheetController', ($scope: TestScope, $mdBottomSheet: ng.material.IBottomSheetService, $q: ng.IQService) => {
|
||||
@@ -192,6 +210,11 @@ myApp.controller('DialogController', ($scope: TestScope, $mdDialog: ng.material.
|
||||
onComplete: (scope, element) => { },
|
||||
onRemoving: (element, removePromise) => { },
|
||||
});
|
||||
|
||||
// Show custom dialog preset
|
||||
$mdDialog.show(
|
||||
$mdDialog['testPreset']().entityName('Product #6')
|
||||
);
|
||||
});
|
||||
|
||||
class IconDirective implements ng.IDirective {
|
||||
|
||||
Vendored
+10
-1
@@ -125,6 +125,11 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
interface IDialogService {
|
||||
// indexer used to call preset dialog created with $mdDialogProvider
|
||||
// see: https://material.angularjs.org/latest/api/service/$mdDialog#custom-presets
|
||||
// tslint:disable-next-line:ban-types
|
||||
[presetName: string]: Function;
|
||||
|
||||
show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog | IPromptDialog): IPromise<any>;
|
||||
confirm(): IConfirmDialog;
|
||||
alert(): IAlertDialog;
|
||||
@@ -133,6 +138,10 @@ declare module 'angular' {
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
|
||||
interface IDialogProvider {
|
||||
addPreset(presetName: string, presetOptions: { methods?: ReadonlyArray<string>, options: () => IDialogOptions }): IDialogProvider;
|
||||
}
|
||||
|
||||
type IIcon = (id: string) => IPromise<Element>; // id is a unique ID or URL
|
||||
|
||||
interface IIconProvider {
|
||||
@@ -223,7 +232,7 @@ declare module 'angular' {
|
||||
contrastDefaultColor?: string;
|
||||
contrastDarkColors?: string | string[];
|
||||
contrastLightColors?: string | string[];
|
||||
contrastStrongLightColors?: string|string[];
|
||||
contrastStrongLightColors?: string | string[];
|
||||
}
|
||||
|
||||
interface IThemeHues {
|
||||
|
||||
Vendored
+23
-14
@@ -4,27 +4,36 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import * as React from "react";
|
||||
import * as CSS from "csstype";
|
||||
|
||||
type BaseCSSProperties = CSS.Properties<number | string>;
|
||||
|
||||
type FontFamily =
|
||||
| React.CSSProperties['fontFamily']
|
||||
| Pick<React.CSSProperties,
|
||||
| 'fontFamily'
|
||||
| 'fontStyle'
|
||||
| 'fontWeight'
|
||||
| 'src'
|
||||
>
|
||||
| BaseCSSProperties['fontFamily']
|
||||
| CSS.FontFace;
|
||||
|
||||
// Replace with Exclude once on 2.8+
|
||||
type Diff<T extends string, U extends string> = (
|
||||
& { [P in T]: P }
|
||||
& { [P in U]: never }
|
||||
& { [x: string]: never }
|
||||
)[T];
|
||||
type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
|
||||
|
||||
type CSSProperties = Omit<BaseCSSProperties, 'fontFamily'> & {
|
||||
fontFamily?: FontFamily | FontFamily[];
|
||||
};
|
||||
|
||||
// For pseudo selectors and media queries
|
||||
interface OpenCSSProperties extends CSSProperties {
|
||||
[k: string]: CSSProperties[keyof CSSProperties] | CSSProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aphrodite style declaration
|
||||
*/
|
||||
export interface StyleDeclaration {
|
||||
[key: string]: Pick<React.CSSProperties, (
|
||||
& React.CSSProperties
|
||||
& { fontFamily: never }
|
||||
)[keyof React.CSSProperties]> & {
|
||||
fontFamily?: FontFamily | FontFamily[];
|
||||
};
|
||||
[key: string]: OpenCSSProperties;
|
||||
}
|
||||
|
||||
interface StyleSheetStatic {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"csstype": "^2.2.0"
|
||||
}
|
||||
}
|
||||
Vendored
+2
-2
@@ -168,8 +168,8 @@ export function forever<E>(next: (next : ErrorCallback<E>) => void, errBack: Err
|
||||
export function waterfall<T, E>(tasks: Function[], callback?: AsyncResultCallback<T, E | Error>): void;
|
||||
export function compose(...fns: Function[]): Function;
|
||||
export function seq(...fns: Function[]): Function;
|
||||
export function applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
|
||||
export function applyEachSeries(fns: Function[], argsAndCallback: any[]): void; // applyEachSeries(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
|
||||
export function applyEach(fns: Function[], ...argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
|
||||
export function applyEachSeries(fns: Function[], ...argsAndCallback: any[]): void; // applyEachSeries(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
|
||||
export function queue<T, E>(worker: AsyncWorker<T, E>, concurrency?: number): AsyncQueue<T>;
|
||||
export function queue<T, R, E>(worker: AsyncResultIterator<T, R, E>, concurrency?: number): AsyncQueue<T>;
|
||||
export function priorityQueue<T, E>(worker: AsyncWorker<T, E>, concurrency: number): AsyncPriorityQueue<T>;
|
||||
|
||||
@@ -3310,7 +3310,7 @@ const pathWatcherPromise = Atom.watchPath("/var/test", {}, (events) => {
|
||||
for (const event of events) {
|
||||
str = event.path;
|
||||
str = event.action;
|
||||
if (event.oldPath) str = event.oldPath;
|
||||
if (event.action === "renamed") str = event.oldPath;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+29
-4
@@ -30,11 +30,20 @@ export interface SuggestionInsertedEvent {
|
||||
suggestion: TextSuggestion|SnippetSuggestion;
|
||||
}
|
||||
|
||||
/**
|
||||
* COMPATIBILITY STUB. WILL BE REMOVED
|
||||
*/
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
export interface Suggestion<
|
||||
T extends { text: string }|{ snippet: string }
|
||||
> extends SuggestionBase {}
|
||||
// TODO: Remove on next minor version
|
||||
|
||||
/**
|
||||
* An autocompletion suggestion for the user.
|
||||
* Primary data type for the Atom Autocomplete+ service.
|
||||
*/
|
||||
export interface Suggestion<T extends { text: string }|{ snippet: string }> {
|
||||
export interface SuggestionBase {
|
||||
/**
|
||||
* A string that will show in the UI for this suggestion.
|
||||
* When not set, snippet || text is displayed.
|
||||
@@ -91,14 +100,20 @@ export interface Suggestion<T extends { text: string }|{ snippet: string }> {
|
||||
* When specified, a More.. link will be displayed in the description area.
|
||||
*/
|
||||
descriptionMoreURL?: string;
|
||||
|
||||
/**
|
||||
* (experimental) Description with Markdown formatting.
|
||||
* Takes precedence over plaintext description.
|
||||
*/
|
||||
descriptionMarkdown?: string;
|
||||
}
|
||||
|
||||
export interface TextSuggestion extends Suggestion<TextSuggestion> {
|
||||
export interface TextSuggestion extends SuggestionBase {
|
||||
/** The text which will be inserted into the editor, in place of the prefix. */
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface SnippetSuggestion extends Suggestion<SnippetSuggestion> {
|
||||
export interface SnippetSuggestion extends SuggestionBase {
|
||||
/**
|
||||
* A snippet string. This will allow users to tab through function arguments
|
||||
* or other options.
|
||||
@@ -106,7 +121,8 @@ export interface SnippetSuggestion extends Suggestion<SnippetSuggestion> {
|
||||
snippet: string;
|
||||
}
|
||||
|
||||
export type Suggestions = Array<TextSuggestion|SnippetSuggestion>;
|
||||
export type AnySuggestion = TextSuggestion|SnippetSuggestion;
|
||||
export type Suggestions = AnySuggestion[];
|
||||
|
||||
/** The interface that all Autocomplete+ providers must implement. */
|
||||
export interface AutocompleteProvider {
|
||||
@@ -154,4 +170,13 @@ export interface AutocompleteProvider {
|
||||
|
||||
/** Will be called if your provider is being destroyed by autocomplete+ */
|
||||
dispose?(): void;
|
||||
|
||||
/**
|
||||
* (experimental) Is called when a suggestion is selected by the user for
|
||||
* the purpose of loading more information about the suggestion. Return a
|
||||
* Promise of the new suggestion to replace it with or return null if
|
||||
* no change is needed.
|
||||
*/
|
||||
getSuggestionDetailsOnSelect?:
|
||||
(suggestion: AnySuggestion) => Promise<AnySuggestion | null> | AnySuggestion | null;
|
||||
}
|
||||
|
||||
Vendored
+13
-4
@@ -5647,19 +5647,28 @@ export interface FileSavedEvent {
|
||||
path: string;
|
||||
}
|
||||
|
||||
export type FilesystemChangeEvent = Array<{
|
||||
export interface FilesystemChangeBasic<
|
||||
Action extends "created"|"modified"|"deleted"|"renamed"
|
||||
= "created"|"modified"|"deleted"
|
||||
> {
|
||||
/** A string describing the filesystem action that occurred. */
|
||||
action: "created"|"modified"|"deleted"|"renamed";
|
||||
action: Action;
|
||||
|
||||
/** The absolute path to the filesystem entry that was acted upon. */
|
||||
path: string;
|
||||
}
|
||||
|
||||
export interface FilesystemChangeRename extends FilesystemChangeBasic<"renamed"> {
|
||||
/**
|
||||
* For rename events, a string containing the filesystem entry's former
|
||||
* absolute path.
|
||||
*/
|
||||
oldPath?: string;
|
||||
}>;
|
||||
oldPath: string;
|
||||
}
|
||||
|
||||
export type FilesystemChange = FilesystemChangeBasic|FilesystemChangeRename;
|
||||
|
||||
export type FilesystemChangeEvent = FilesystemChange[];
|
||||
|
||||
export interface FullKeybindingMatchEvent {
|
||||
/** The string of keystrokes that matched the binding. */
|
||||
|
||||
@@ -124,7 +124,9 @@ const otherOptions : Auth0LockConstructorOptions = {
|
||||
configurationBaseUrl: "https://cdn.auth0.com",
|
||||
languageBaseUrl: "http://www.example.com",
|
||||
hashCleanup: false,
|
||||
leeway: 30
|
||||
leeway: 30,
|
||||
_enableImpersonation: true,
|
||||
_enableIdPInitiatedLogin: false
|
||||
};
|
||||
|
||||
new Auth0Lock(CLIENT_ID, DOMAIN, otherOptions);
|
||||
|
||||
Vendored
+2
-1
@@ -118,7 +118,7 @@ interface Auth0LockConstructorOptions {
|
||||
auth?: Auth0LockAuthOptions;
|
||||
autoclose?: boolean;
|
||||
autofocus?: boolean;
|
||||
avatar?: Auth0LockAvatarOptions;
|
||||
avatar?: Auth0LockAvatarOptions | null;
|
||||
clientBaseUrl?: string;
|
||||
closable?: boolean;
|
||||
configurationBaseUrl?: string;
|
||||
@@ -144,6 +144,7 @@ interface Auth0LockConstructorOptions {
|
||||
theme?: Auth0LockThemeOptions;
|
||||
usernameStyle?: string;
|
||||
_enableImpersonation?: boolean;
|
||||
_enableIdPInitiatedLogin?: boolean;
|
||||
}
|
||||
|
||||
interface Auth0LockFlashMessageOptions {
|
||||
|
||||
Vendored
+3
-3
@@ -25,7 +25,7 @@ declare namespace autobahn {
|
||||
|
||||
leave(reason: string, message: string): void;
|
||||
|
||||
call<TResult>(procedure: string, args?: any[], kwargs?: any, options?: ICallOptions): When.Promise<TResult>;
|
||||
call<TResult>(procedure: string, args?: any[] | any, kwargs?: any, options?: ICallOptions): When.Promise<TResult>;
|
||||
|
||||
publish(topic: string, args?: any[], kwargs?: any, options?: IPublishOptions): When.Promise<IPublication>;
|
||||
|
||||
@@ -96,7 +96,7 @@ declare namespace autobahn {
|
||||
kwargs: any;
|
||||
}
|
||||
|
||||
type SubscribeHandler = (args?: any[], kwargs?: any, details?: IEvent) => void;
|
||||
type SubscribeHandler = (args?: any[] | any, kwargs?: any, details?: IEvent) => void;
|
||||
|
||||
interface ISubscription {
|
||||
topic: string;
|
||||
@@ -206,7 +206,7 @@ declare namespace autobahn {
|
||||
|
||||
type DeferFactory = () => When.Promise<any>;
|
||||
|
||||
type OnChallengeHandler = (session: Session, method: string, extra: any) => string;
|
||||
type OnChallengeHandler = (session: Session, method: string, extra: any) => string | When.Promise<string>;
|
||||
|
||||
interface IConnectionOptions {
|
||||
use_es6_promises?: boolean;
|
||||
|
||||
@@ -260,9 +260,27 @@ statement = {
|
||||
};
|
||||
|
||||
statement = {
|
||||
Sid: str,
|
||||
Action: [str, str],
|
||||
Effect: str,
|
||||
Resource: [str, str]
|
||||
Resource: [str, str],
|
||||
Condition: {
|
||||
condition1: { key: "value" },
|
||||
condition2: [{
|
||||
key1: "value",
|
||||
key2: "value"
|
||||
}, {
|
||||
key3: "value"
|
||||
}]
|
||||
},
|
||||
Principal: [str, str],
|
||||
NotPrincipal: [str, str]
|
||||
};
|
||||
|
||||
statement = {
|
||||
Effect: str,
|
||||
NotAction: str,
|
||||
NotResource: str
|
||||
};
|
||||
|
||||
policyDocument = {
|
||||
@@ -270,6 +288,11 @@ policyDocument = {
|
||||
Statement: [statement]
|
||||
};
|
||||
|
||||
policyDocument = {
|
||||
Version: str,
|
||||
Statement: [statement, statement]
|
||||
};
|
||||
|
||||
authResponse = {
|
||||
principalId: str,
|
||||
policyDocument,
|
||||
@@ -572,6 +595,28 @@ const CloudFrontResponseEvent: AWSLambda.CloudFrontResponseEvent = {
|
||||
]
|
||||
};
|
||||
|
||||
/* Kinesis Data Stream Events */
|
||||
declare let kinesisStreamEvent: AWSLambda.KinesisStreamEvent;
|
||||
declare let kinesisStreamRecord: AWSLambda.KinesisStreamRecord;
|
||||
declare let kinesisStreamRecordPayload: AWSLambda.KinesisStreamRecordPayload;
|
||||
|
||||
kinesisStreamRecord = kinesisStreamEvent.Records[0];
|
||||
|
||||
str = kinesisStreamRecord.awsRegion;
|
||||
str = kinesisStreamRecord.eventID;
|
||||
str = kinesisStreamRecord.eventName;
|
||||
str = kinesisStreamRecord.eventSource;
|
||||
str = kinesisStreamRecord.eventSourceARN;
|
||||
str = kinesisStreamRecord.eventVersion;
|
||||
str = kinesisStreamRecord.invokeIdentityArn;
|
||||
kinesisStreamRecordPayload = kinesisStreamRecord.kinesis;
|
||||
|
||||
num = kinesisStreamRecordPayload.approximateArrivalTimestamp;
|
||||
str = kinesisStreamRecordPayload.data;
|
||||
str = kinesisStreamRecordPayload.kinesisSchemaVersion;
|
||||
str = kinesisStreamRecordPayload.partitionKey;
|
||||
str = kinesisStreamRecordPayload.sequenceNumber;
|
||||
|
||||
/* Compatibility functions */
|
||||
context.done();
|
||||
context.done(error);
|
||||
@@ -585,8 +630,27 @@ context.fail(str);
|
||||
/* Handler */
|
||||
let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { };
|
||||
|
||||
// async methods return Promise, test assignability
|
||||
let asyncHandler: AWSLambda.Handler = async (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { };
|
||||
/* In node8.10 runtime, handlers may return a promise for the result value, so existing async
|
||||
* handlers that return Promise<void> before calling the callback will now have a `null` result.
|
||||
* Be safe and make that badly typed with a major verson bump to 8.10 so users expect the breaking change,
|
||||
* since the upgrade effort should be pretty low in most cases, and it points them at a nicer solution.
|
||||
*/
|
||||
// $ExpectError
|
||||
let legacyAsyncHandler: AWSLambda.APIGatewayProxyHandler = async (
|
||||
event: AWSLambda.APIGatewayProxyEvent,
|
||||
context: AWSLambda.Context,
|
||||
cb: AWSLambda.Callback<AWSLambda.APIGatewayProxyResult>,
|
||||
) => {
|
||||
cb(null, { statusCode: 200, body: 'No longer valid' });
|
||||
};
|
||||
|
||||
let node8AsyncHandler: AWSLambda.APIGatewayProxyHandler = async (
|
||||
event: AWSLambda.APIGatewayProxyEvent,
|
||||
context: AWSLambda.Context,
|
||||
cb: AWSLambda.Callback<AWSLambda.APIGatewayProxyResult>,
|
||||
) => {
|
||||
return { statusCode: 200, body: 'Is now valid!' };
|
||||
};
|
||||
|
||||
let inferredHandler: AWSLambda.S3Handler = (event, context, cb) => {
|
||||
// $ExpectType S3Event
|
||||
@@ -661,3 +725,5 @@ let customHandler: AWSLambda.Handler<CustomEvent, CustomResult> = (event, contex
|
||||
// $ExpectError
|
||||
cb(null, { resultString: bool });
|
||||
};
|
||||
|
||||
let kinesisStreamHandler: AWSLambda.KinesisStreamHandler = (event: AWSLambda.KinesisStreamEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => { };
|
||||
|
||||
Vendored
+67
-9
@@ -1,4 +1,4 @@
|
||||
// Type definitions for AWS Lambda
|
||||
// Type definitions for AWS Lambda 8.10
|
||||
// Project: http://docs.aws.amazon.com/lambda
|
||||
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>
|
||||
// Michael Skarum <https://github.com/skarum>
|
||||
@@ -16,6 +16,8 @@
|
||||
// Danilo Raisi <https://github.com/daniloraisi>
|
||||
// Simon Buchan <https://github.com/simonbuchan>
|
||||
// David Hayden <https://github.com/Haydabase>
|
||||
// Chris Redekop <https://github.com/repl-chris>
|
||||
// Aneil Mallavarapu <https://github.com/aneilbaboo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -437,28 +439,52 @@ export interface CustomAuthorizerResult {
|
||||
principalId: string;
|
||||
policyDocument: PolicyDocument;
|
||||
context?: AuthResponseContext;
|
||||
usageIdentifierKey?: string;
|
||||
}
|
||||
export type AuthResponse = CustomAuthorizerResult;
|
||||
|
||||
/**
|
||||
* API Gateway CustomAuthorizer AuthResponse.PolicyDocument.
|
||||
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
|
||||
* https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html
|
||||
* https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#Condition
|
||||
*/
|
||||
export interface PolicyDocument {
|
||||
Version: string;
|
||||
Statement: [Statement];
|
||||
Id?: string;
|
||||
Statement: Statement[];
|
||||
}
|
||||
|
||||
/**
|
||||
* API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Condition.
|
||||
* https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-control-access-policy-language-overview.html
|
||||
* https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html
|
||||
*/
|
||||
export interface ConditionBlock {
|
||||
[condition: string]: Condition | Condition[];
|
||||
}
|
||||
|
||||
export interface Condition {
|
||||
[key: string]: string | string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement.
|
||||
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
|
||||
* https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-control-access-policy-language-overview.html
|
||||
* https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html
|
||||
*/
|
||||
export interface Statement {
|
||||
Action: string | string[];
|
||||
export type Statement = BaseStatement & StatementAction & StatementResource;
|
||||
|
||||
export interface BaseStatement {
|
||||
Effect: string;
|
||||
Resource: string | string[];
|
||||
Sid?: string;
|
||||
Condition?: ConditionBlock;
|
||||
Principal?: string | string[];
|
||||
NotPrincipal?: string | string[];
|
||||
}
|
||||
|
||||
export type StatementAction = { Action: string | string[] } | { NotAction: string | string[] };
|
||||
export type StatementResource = { Resource: string | string[] } | { NotResource: string | string[] };
|
||||
|
||||
/**
|
||||
* API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement.
|
||||
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
|
||||
@@ -529,6 +555,31 @@ export interface CloudFrontRequestEvent {
|
||||
|
||||
export type CloudFrontResponseResult = undefined | null | CloudFrontResultResponse;
|
||||
|
||||
// Kinesis Streams
|
||||
// https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-kinesis-streams
|
||||
export interface KinesisStreamRecordPayload {
|
||||
approximateArrivalTimestamp: number;
|
||||
data: string;
|
||||
kinesisSchemaVersion: string;
|
||||
partitionKey: string;
|
||||
sequenceNumber: string;
|
||||
}
|
||||
|
||||
export interface KinesisStreamRecord {
|
||||
awsRegion: string;
|
||||
eventID: string;
|
||||
eventName: string;
|
||||
eventSource: string;
|
||||
eventSourceARN: string;
|
||||
eventVersion: string;
|
||||
invokeIdentityArn: string;
|
||||
kinesis: KinesisStreamRecordPayload;
|
||||
}
|
||||
|
||||
export interface KinesisStreamEvent {
|
||||
Records: KinesisStreamRecord[];
|
||||
}
|
||||
|
||||
/**
|
||||
* AWS Lambda handler function.
|
||||
* http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
|
||||
@@ -536,8 +587,13 @@ export type CloudFrontResponseResult = undefined | null | CloudFrontResultRespon
|
||||
* @param event – event data.
|
||||
* @param context – runtime information of the Lambda function that is executing.
|
||||
* @param callback – optional callback to return information to the caller, otherwise return value is null.
|
||||
* @return In the node8.10 runtime, a promise for the lambda result.
|
||||
*/
|
||||
export type Handler<TEvent = any, TResult = any> = (event: TEvent, context: Context, callback: Callback<TResult>) => void;
|
||||
export type Handler<TEvent = any, TResult = any> = (
|
||||
event: TEvent,
|
||||
context: Context,
|
||||
callback: Callback<TResult>,
|
||||
) => void | Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Optional callback parameter.
|
||||
@@ -595,7 +651,9 @@ export type CloudFrontRequestCallback = Callback<CloudFrontRequestResult>;
|
||||
export type CloudFrontResponseHandler = Handler<CloudFrontResponseEvent, CloudFrontResponseResult>;
|
||||
export type CloudFrontResponseCallback = Callback<CloudFrontResponseResult>;
|
||||
|
||||
// TODO: Kinesis (should be very close to DynamoDB stream?)
|
||||
export type KinesisStreamHandler = Handler<KinesisStreamEvent, void>;
|
||||
|
||||
// TODO: Kinesis Firehose
|
||||
|
||||
export type CustomAuthorizerHandler = Handler<CustomAuthorizerEvent, CustomAuthorizerResult>;
|
||||
export type CustomAuthorizerCallback = Callback<CustomAuthorizerResult>;
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
import * as axon from 'axon';
|
||||
import { Socket as NetSocket } from 'net';
|
||||
|
||||
const PubEmitterSocket = axon.PubEmitterSocket;
|
||||
const PubSocket = axon.PubSocket;
|
||||
const RepSocket = axon.RepSocket;
|
||||
const ReqSocket = axon.ReqSocket;
|
||||
const Socket = axon.Socket;
|
||||
const SubSocket = axon.SubSocket;
|
||||
|
||||
const pubSocket = new PubSocket();
|
||||
const pubEmitterSocket = new PubEmitterSocket();
|
||||
const repSocket = new RepSocket();
|
||||
const reqSocket = new ReqSocket();
|
||||
const netSocket = new NetSocket();
|
||||
const socket = new Socket();
|
||||
const subSocket = new SubSocket();
|
||||
|
||||
// $ExpectType PubSocket
|
||||
pubSocket.send('anything');
|
||||
|
||||
// $ExpectType PubSocket
|
||||
pubSocket.send('anything', {w: 100, h: 200});
|
||||
|
||||
// $ExpectType PubSocket
|
||||
pubEmitterSocket.send('anything');
|
||||
|
||||
// $ExpectType PubSocket
|
||||
pubEmitterSocket.send('anything', {w: 100, h: 200});
|
||||
|
||||
// $ExpectType Socket
|
||||
pubEmitterSocket.bind(3000);
|
||||
|
||||
// $ExpectError
|
||||
pubEmitterSocket.bind({a, b, c});
|
||||
|
||||
// $ExpectError
|
||||
pubEmitterSocket.bind();
|
||||
|
||||
// $ExpectType Socket
|
||||
pubEmitterSocket.connect(3000);
|
||||
|
||||
// $ExpectError
|
||||
pubEmitterSocket.connect({a, b, c});
|
||||
|
||||
// $ExpectError
|
||||
pubEmitterSocket.connect();
|
||||
|
||||
// $ExpectType (args: Buffer | Buffer[]) => void
|
||||
repSocket.onmessage(netSocket);
|
||||
|
||||
// $ExpectError
|
||||
repSocket.onmessage();
|
||||
|
||||
// $ExpectError
|
||||
repSocket.onmessage('');
|
||||
|
||||
// $ExpectError
|
||||
repSocket.onmessage(1);
|
||||
|
||||
// $ExpectError
|
||||
repSocket.onmessage({});
|
||||
|
||||
// $ExpectType string
|
||||
reqSocket.id();
|
||||
|
||||
// $ExpectType (args: Buffer | Buffer[]) => void
|
||||
reqSocket.onmessage();
|
||||
|
||||
// $ExpectType void
|
||||
reqSocket.send('anything');
|
||||
|
||||
// $ExpectType void
|
||||
reqSocket.send('anything', {w: 100, h: 200});
|
||||
|
||||
// $ExpectType Socket
|
||||
socket.set('name', 'aaa');
|
||||
|
||||
// $ExpectError
|
||||
socket.set(1, 'aaa');
|
||||
|
||||
// $ExpectError
|
||||
socket.set({}, 'aaa');
|
||||
|
||||
// $ExpectError
|
||||
socket.set('name');
|
||||
|
||||
// $ExpectType any
|
||||
socket.get('name');
|
||||
|
||||
// $ExpectError
|
||||
socket.get(1);
|
||||
|
||||
// $ExpectError
|
||||
socket.get({});
|
||||
|
||||
// $ExpectType Socket
|
||||
socket.enable('name');
|
||||
|
||||
// $ExpectError
|
||||
socket.enable(1);
|
||||
|
||||
// $ExpectError
|
||||
socket.enable({});
|
||||
|
||||
// $ExpectType Socket
|
||||
socket.disable('name');
|
||||
|
||||
// $ExpectError
|
||||
socket.disable(1);
|
||||
|
||||
// $ExpectError
|
||||
socket.disable({});
|
||||
|
||||
// $ExpectType boolean
|
||||
socket.enabled('name');
|
||||
|
||||
// $ExpectError
|
||||
socket.enabled(1);
|
||||
|
||||
// $ExpectError
|
||||
socket.enabled({});
|
||||
|
||||
// $ExpectType boolean
|
||||
socket.disabled('name');
|
||||
|
||||
// $ExpectError
|
||||
socket.disabled(1);
|
||||
|
||||
// $ExpectError
|
||||
socket.disabled({});
|
||||
|
||||
// $ExpectType boolean
|
||||
subSocket.hasSubscriptions();
|
||||
|
||||
// $ExpectType boolean
|
||||
subSocket.matches('name');
|
||||
|
||||
// $ExpectError
|
||||
subSocket.matches(1);
|
||||
|
||||
// $ExpectError
|
||||
subSocket.matches({});
|
||||
|
||||
// $ExpectType RegExp
|
||||
subSocket.subscribe(/some regex/);
|
||||
|
||||
// $ExpectType RegExp
|
||||
subSocket.subscribe('some string');
|
||||
|
||||
// $ExpectError
|
||||
subSocket.subscribe(1);
|
||||
|
||||
// $ExpectError
|
||||
subSocket.subscribe({});
|
||||
|
||||
// $ExpectError
|
||||
subSocket.subscribe();
|
||||
|
||||
// $ExpectType void
|
||||
subSocket.unsubscribe(/some regex/);
|
||||
|
||||
// $ExpectType void
|
||||
subSocket.unsubscribe('some string');
|
||||
|
||||
// $ExpectError
|
||||
subSocket.unsubscribe(1);
|
||||
|
||||
// $ExpectError
|
||||
subSocket.unsubscribe({});
|
||||
|
||||
// $ExpectError
|
||||
subSocket.unsubscribe();
|
||||
Vendored
+134
@@ -0,0 +1,134 @@
|
||||
// Type definitions for axon 2.0
|
||||
// Project: https://github.com/visionmedia/axon#readme
|
||||
// Definitions by: Vilim Stubičan <https://github.com/jewbre>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { EventEmitter } from "events";
|
||||
import { Socket as NetSocket } from "net";
|
||||
|
||||
export class Socket extends EventEmitter {
|
||||
set(name: string, val: any): Socket;
|
||||
|
||||
get(name: string): any;
|
||||
|
||||
enable(name: string): Socket;
|
||||
|
||||
disable(name: string): Socket;
|
||||
|
||||
enabled(name: string): boolean;
|
||||
|
||||
disabled(name: string): boolean;
|
||||
|
||||
use(plugin: (socket: Socket) => any): Socket;
|
||||
|
||||
pack(args: Buffer | Buffer[]): Buffer;
|
||||
|
||||
closeSockets(): void;
|
||||
|
||||
close(): void;
|
||||
|
||||
closeServer(fn: () => any): void;
|
||||
|
||||
address(): { port: number; family: string; address: string; string: string } | undefined;
|
||||
|
||||
removeSocket(sock: Socket): void;
|
||||
|
||||
addSocket(sock: Socket): void;
|
||||
|
||||
handleErrors(sock: Socket): void;
|
||||
|
||||
onmessage(sock: NetSocket): (args: Buffer | Buffer[]) => void;
|
||||
|
||||
connect(port: ConnectionPort, host?: string | (() => void), fn?: () => void): Socket;
|
||||
|
||||
onconnect(sock: Socket): void;
|
||||
|
||||
bind(port: ConnectionPort, host?: string | (() => void), fn?: () => void): Socket;
|
||||
}
|
||||
|
||||
export class SubSocket extends Socket {
|
||||
hasSubscriptions(): boolean;
|
||||
|
||||
matches(topic: string): boolean;
|
||||
|
||||
onmessage(sock: NetSocket): (args: Buffer | Buffer[]) => void;
|
||||
|
||||
subscribe(re: RegExp | string): RegExp;
|
||||
|
||||
unsubscribe(re: RegExp | string): void;
|
||||
|
||||
clearSubscriptions(): void;
|
||||
|
||||
/**
|
||||
* @throws {Error}
|
||||
*/
|
||||
send(): void;
|
||||
}
|
||||
|
||||
export class SubEmitterSocket {
|
||||
onmessage(): (args: Buffer | Buffer[]) => void;
|
||||
|
||||
on(event: string, fn: (...args: any[]) => void): SubEmitterSocket;
|
||||
|
||||
off(event: string): SubEmitterSocket;
|
||||
|
||||
bind(port: ConnectionPort, host?: string | (() => void), fn?: () => void): Socket;
|
||||
|
||||
connect(port: ConnectionPort, host?: string | (() => void), fn?: () => void): Socket;
|
||||
|
||||
close(): void;
|
||||
}
|
||||
|
||||
export class PubSocket extends Socket {
|
||||
send(...args: any[]): PubSocket;
|
||||
}
|
||||
|
||||
export class PubEmitterSocket {
|
||||
sock: PubSocket;
|
||||
|
||||
send(...args: any[]): PubSocket;
|
||||
|
||||
bind(port: ConnectionPort, host?: string | (() => void), fn?: () => void): Socket;
|
||||
|
||||
connect(port: ConnectionPort, host?: string | (() => void), fn?: () => void): Socket;
|
||||
|
||||
close(): void;
|
||||
}
|
||||
|
||||
export class PushSocket extends Socket {
|
||||
send(...args: any[]): void;
|
||||
enqueue(msg: any): void;
|
||||
}
|
||||
|
||||
export class ReqSocket extends Socket {
|
||||
id(): string;
|
||||
|
||||
onmessage(): (args: Buffer | Buffer[]) => void;
|
||||
|
||||
send(...args: any[]): void;
|
||||
}
|
||||
|
||||
export class RepSocket extends Socket {
|
||||
onmessage(sock: NetSocket): (args: Buffer | Buffer[]) => void;
|
||||
}
|
||||
|
||||
export class PullSocket extends Socket {
|
||||
/**
|
||||
* @throws {Error}
|
||||
*/
|
||||
send(): void;
|
||||
}
|
||||
|
||||
export type ConnectionPort =
|
||||
number
|
||||
| string
|
||||
| { protocol?: string, hostname?: string, pathname: string, port: string | number };
|
||||
|
||||
export function socket(type: string, options?: any): Socket;
|
||||
|
||||
export const types: {
|
||||
[propName: string]: { new(): PubEmitterSocket | SubEmitterSocket | PushSocket | PullSocket | PubSocket | SubSocket | ReqSocket | RepSocket | Socket };
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"axon-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+1
-1
@@ -11,7 +11,7 @@ import stream = require('stream');
|
||||
declare class BufferList extends stream.Duplex {
|
||||
constructor(callback?: (err: Error, buffer: Buffer) => void);
|
||||
|
||||
append(buffer: Buffer): void;
|
||||
append(buffer: Buffer | Buffer[] | BufferList | BufferList[] | string): void;
|
||||
get(index: number): number;
|
||||
slice(start?: number, end?: number): Buffer;
|
||||
copy(dest: Buffer, destStart?: number, srcStart?: number, srcEnd?: number): void;
|
||||
|
||||
+14
-1
@@ -10,7 +10,20 @@ type DatepickerEvents = "show"|"hide"|"clearDate"|"changeDate"|"changeMonth"|"ch
|
||||
|
||||
type DatepickerViewModes = 0|"days"|1|"months"|2|"years"|3|"decades"|4|"centuries"|"millenium";
|
||||
|
||||
type DatepickerOrientations = "auto"|"left top"|"left bottom"|"right top"|"right bottom";
|
||||
type DatepickerOrientations =
|
||||
"auto"
|
||||
| "left top"
|
||||
| "left bottom"
|
||||
| "right top"
|
||||
| "right bottom"
|
||||
| "top auto"
|
||||
| "bottom auto"
|
||||
| "auto left"
|
||||
| "top left"
|
||||
| "bottom left"
|
||||
| "auto right"
|
||||
| "top right"
|
||||
| "bottom right"
|
||||
|
||||
/**
|
||||
* All options that take a “Date” can handle a Date object; a String
|
||||
|
||||
@@ -43,10 +43,15 @@ $("#carousel").on("slide.bs.carousel", function(ev) {
|
||||
$("#carousel").carousel({
|
||||
interval: 5000,
|
||||
keyboard: true,
|
||||
slide: false,
|
||||
pause: "hover",
|
||||
wrap: true,
|
||||
});
|
||||
|
||||
$("#carousel").carousel({
|
||||
slide: "prev",
|
||||
});
|
||||
|
||||
$("#carousel").carousel({
|
||||
pause: false,
|
||||
});
|
||||
@@ -96,6 +101,8 @@ $("#dropdown").dropdown({
|
||||
offset: 10,
|
||||
flip: false,
|
||||
boundary: "window",
|
||||
reference: "toggle",
|
||||
display: "dynamic",
|
||||
});
|
||||
|
||||
$("#dropdown").dropdown({
|
||||
@@ -114,6 +121,10 @@ $("#dropdown").dropdown({
|
||||
boundary: document.body,
|
||||
});
|
||||
|
||||
$("#dropdown").dropdown({
|
||||
reference: document.body,
|
||||
});
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Modal
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
Vendored
+27
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Bootstrap 4.0
|
||||
// Type definitions for Bootstrap 4.1
|
||||
// Project: https://github.com/twbs/bootstrap/
|
||||
// Definitions by: denisname <https://github.com/denisname>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -55,6 +55,14 @@ export interface CarouselOption {
|
||||
*/
|
||||
keyboard?: boolean;
|
||||
|
||||
/**
|
||||
* Use to easily control the position of the carousel. It accepts the keywords prev or next, which alters the slide position
|
||||
* relative to its current position. Alternatively, use `data-slide-to` to pass a raw slide index to the carousel.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
slide?: "next" | "prev" | false;
|
||||
|
||||
/**
|
||||
* If set to "hover", pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave.
|
||||
* If set to false, hovering over the carousel won't pause it.
|
||||
@@ -116,6 +124,21 @@ export interface DropdownOption {
|
||||
* @default "scrollParent"
|
||||
*/
|
||||
boundary?: Popper.Boundary | HTMLElement;
|
||||
|
||||
/**
|
||||
* Reference element of the dropdown menu. Accepts the values of 'toggle', 'parent', or an HTMLElement reference.
|
||||
* For more information refer to Popper.js's referenceObject docs.
|
||||
*
|
||||
* @default "toggle"
|
||||
*/
|
||||
reference?: "toggle" | "parent" | HTMLElement;
|
||||
|
||||
/**
|
||||
* By default, we use Popper.js for dynamic positioning. Disable this with 'static'.
|
||||
*
|
||||
* @default "dynamic"
|
||||
*/
|
||||
display?: "dynamic" | "static";
|
||||
}
|
||||
|
||||
export interface ModalOption {
|
||||
@@ -154,6 +177,8 @@ export interface PopoverOption extends TooltipOption {
|
||||
* Default content value if data-content attribute isn't present.
|
||||
* If a function is given, it will be called with its this reference
|
||||
* set to the element that the popover is attached to.
|
||||
*
|
||||
* @default ""
|
||||
*/
|
||||
content?: string | Element | ((this: Element) => string | Element);
|
||||
}
|
||||
@@ -226,7 +251,7 @@ export interface TooltipOption {
|
||||
* the tooltip or popover DOM node as its first argument and the triggering element DOM node as its second.
|
||||
* The this context is set to the tooltip or popover instance.
|
||||
*
|
||||
* @default "top"
|
||||
* @default tooltip: "top", popover: "right"
|
||||
*/
|
||||
placement?: Placement | ((this: TooltipInstance<this>, node: HTMLElement, trigger: Element) => Placement);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ bson.ObjectID.cacheHexString = true
|
||||
let BSON = new bson.BSON();
|
||||
let Long = bson.Long;
|
||||
|
||||
let doc = {long: Long.fromNumber(100)}
|
||||
let doc = { long: Long.fromNumber(100) }
|
||||
|
||||
// Serialize a document
|
||||
let data = BSON.serialize(doc, false, true, false);
|
||||
@@ -19,3 +19,10 @@ console.log("doc_2:", doc_2);
|
||||
BSON = new bson.BSON();
|
||||
data = BSON.serialize(doc);
|
||||
doc_2 = BSON.deserialize(data);
|
||||
|
||||
|
||||
// Calculate Object Size
|
||||
BSON = new bson.BSON();
|
||||
console.log("Calculated Object size - no options object:", BSON.calculateObjectSize(doc));
|
||||
console.log("Calculated Object size - empty options object:", BSON.calculateObjectSize(doc, {}));
|
||||
console.log("Calculated Object size - custom options object:", BSON.calculateObjectSize(doc, { ignoreUndefined: false, serializeFunctions: true }));
|
||||
|
||||
Vendored
+16
@@ -16,6 +16,14 @@ export interface DeserializeOptions {
|
||||
/** {Boolean, default:false}, deserialize Binary data directly into node.js Buffer object. */
|
||||
promoteBuffers?: boolean;
|
||||
}
|
||||
|
||||
export interface CalculateObjectSizeOptions {
|
||||
/** {Boolean, default:false}, serialize the javascript functions */
|
||||
serializeFunctions?: boolean;
|
||||
/** {Boolean, default:true}, ignore undefined fields. */
|
||||
ignoreUndefined?: boolean;
|
||||
}
|
||||
|
||||
export class BSON {
|
||||
/**
|
||||
* @param {Object} object the Javascript object to serialize.
|
||||
@@ -26,6 +34,14 @@ export class BSON {
|
||||
*/
|
||||
serialize(object: any, checkKeys?: boolean, asBuffer?: boolean, serializeFunctions?: boolean): Buffer;
|
||||
deserialize(buffer: Buffer, options?: DeserializeOptions, isArray?: boolean): any;
|
||||
/**
|
||||
* Calculate the bson size for a passed in Javascript object.
|
||||
*
|
||||
* @param {Object} object the Javascript object to calculate the BSON byte size for.
|
||||
* @param {CalculateObjectSizeOptions} Options
|
||||
* @return {Number} returns the number of bytes the BSON object will take up.
|
||||
*/
|
||||
calculateObjectSize(object: any, options?: CalculateObjectSizeOptions): number;
|
||||
}
|
||||
|
||||
export class Binary {
|
||||
|
||||
@@ -1798,6 +1798,26 @@ function legend_custom() {
|
||||
});
|
||||
}
|
||||
|
||||
function legend_tiles() {
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 250]
|
||||
]
|
||||
},
|
||||
legend: {
|
||||
// amount of padding to put between each legend element
|
||||
padding: 5,
|
||||
// define custom height and width for the legend item tile
|
||||
item: {
|
||||
tile: {
|
||||
width: 15,
|
||||
height: 2
|
||||
}
|
||||
}
|
||||
}});
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
// Tooltip Tests
|
||||
/////////////////////
|
||||
|
||||
Vendored
+19
-1
@@ -1,9 +1,10 @@
|
||||
// Type definitions for C3js 0.5
|
||||
// Type definitions for C3js 0.6
|
||||
// Project: http://c3js.org/
|
||||
// Definitions by: Marc Climent <https://github.com/mcliment>
|
||||
// Gerin Jacob <https://github.com/gerinjacob>
|
||||
// Bernd Hacker <https://github.com/denyo>
|
||||
// Dzmitry Shyndzin <https://github.com/dmitryshindin>
|
||||
// Tim Niemueller <https://github.com/timn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -700,6 +701,10 @@ export interface LegendOptions {
|
||||
y?: number;
|
||||
step?: number;
|
||||
};
|
||||
/**
|
||||
* Padding between legend elements.
|
||||
*/
|
||||
padding?: number;
|
||||
|
||||
item?: {
|
||||
/**
|
||||
@@ -714,6 +719,19 @@ export interface LegendOptions {
|
||||
* Set mouseout event handler to the legend item.
|
||||
*/
|
||||
onmouseout?(id: any): void;
|
||||
/**
|
||||
* Tile settings for legend color display.
|
||||
*/
|
||||
tile?: {
|
||||
/**
|
||||
* Tile width.
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* Tile height
|
||||
*/
|
||||
height?: number;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Vendored
+128
-25
@@ -1,6 +1,7 @@
|
||||
// Type definitions for cassandra-driver v3.2.2
|
||||
// Type definitions for cassandra-driver v3.4.1
|
||||
// Project: https://github.com/datastax/nodejs-driver
|
||||
// Definitions by: Marc Fisher <https://github.com/Svjard>
|
||||
// Christian D <https://github.com/pc-jedi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -115,7 +116,11 @@ export namespace policies {
|
||||
interface RetryPolicyStatic {
|
||||
new (): RetryPolicy;
|
||||
|
||||
retryDecision: any;
|
||||
retryDecision: {
|
||||
rethrow: number,
|
||||
retry: number,
|
||||
ignore: number
|
||||
};
|
||||
}
|
||||
|
||||
interface RetryPolicy {
|
||||
@@ -126,15 +131,55 @@ export namespace policies {
|
||||
retryResult(): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean };
|
||||
}
|
||||
}
|
||||
|
||||
namespace speculativeExecution {
|
||||
let NoSpeculativeExecutionPolicy: NoSpeculativeExecutionPolicyStatic
|
||||
|
||||
interface SpeculativeExecutionPolicy {
|
||||
init(client: Client): void;
|
||||
newPlan(keyspace: string, queryInfo: string | Array<string>): {
|
||||
nextExecution: Function
|
||||
}
|
||||
}
|
||||
|
||||
interface NoSpeculativeExecutionPolicyStatic {
|
||||
new (): NoSpeculativeExecutionPolicy
|
||||
}
|
||||
|
||||
interface NoSpeculativeExecutionPolicy extends SpeculativeExecutionPolicy { }
|
||||
|
||||
interface ConstantSpeculativeExecutionPolicyStatic {
|
||||
new (delay: number, maxSpeculativeExecutions: number): ConstantSpeculativeExecutionPolicy
|
||||
}
|
||||
|
||||
interface ConstantSpeculativeExecutionPolicy extends SpeculativeExecutionPolicy { }
|
||||
}
|
||||
|
||||
namespace timestampGeneration {
|
||||
let MonotonicTimestampGenerator: MonotonicTimestampGeneratorStatic
|
||||
|
||||
interface TimestampGenerator {
|
||||
next(client: Client): null | number | _Long
|
||||
}
|
||||
|
||||
interface MonotonicTimestampGeneratorStatic {
|
||||
new (warningThreshold?: number, minLogInterval?: number): MonotonicTimestampGeneratorStatic
|
||||
}
|
||||
|
||||
interface MonotonicTimestampGenerator extends TimestampGenerator {
|
||||
getDate(): number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export namespace types {
|
||||
let BigDecimal: BigDecimalStatic;
|
||||
let Duration: DurationStatic;
|
||||
let Long: _Long;
|
||||
let InetAddress: InetAddressStatic;
|
||||
let Integer: IntegerStatic;
|
||||
let LocalDate: LocalDateStatic;
|
||||
let LocalTime: LocalTimeStatic;
|
||||
let Long: _Long;
|
||||
let ResultSet: ResultSetStatic;
|
||||
// let ResultStream: ResultStreamStatic;
|
||||
let Row: RowStatic;
|
||||
@@ -221,6 +266,19 @@ export namespace types {
|
||||
toJSON(): string;
|
||||
}
|
||||
|
||||
interface DurationStatic {
|
||||
new (month: number, days: number, nanoseconds: number | _Long): Duration;
|
||||
|
||||
fromBuffer(buffer: Buffer): Duration;
|
||||
fromString(input: string): Duration;
|
||||
}
|
||||
|
||||
interface Duration {
|
||||
equals(other: Duration): boolean;
|
||||
toBuffer(): Buffer;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
interface InetAddressStatic {
|
||||
new (buffer: Buffer): InetAddress;
|
||||
|
||||
@@ -336,13 +394,14 @@ export namespace types {
|
||||
}
|
||||
|
||||
interface ResultSetStatic {
|
||||
new (response: any, host: string, triedHost: { [key: string]: any }, consistency: consistencies): ResultSet;
|
||||
new (response: any, host: string, triedHost: { [key: string]: any }, speculativeExecutions: number, consistency: consistencies): ResultSet;
|
||||
}
|
||||
|
||||
interface ResultSet {
|
||||
info: {
|
||||
queriedHost: Host,
|
||||
triedHosts: { [key: string]: string; },
|
||||
speculativeExecutions: number,
|
||||
achievedConsistency: consistencies,
|
||||
traceId: Uuid,
|
||||
warnings: Array<string>,
|
||||
@@ -352,11 +411,13 @@ export namespace types {
|
||||
rowLength: number;
|
||||
columns: Array<{ [key: string]: string; }>;
|
||||
pageState: string;
|
||||
nextPage: any; // function
|
||||
nextPage: Function;
|
||||
|
||||
first(): Row;
|
||||
getPageState(): string;
|
||||
getColumns(): Array<{ [key: string]: string; }>;
|
||||
wasApplied(): boolean;
|
||||
[Symbol.iterator](): Iterator<Row>;
|
||||
}
|
||||
|
||||
interface ResultStreamStatic {
|
||||
@@ -442,40 +503,50 @@ export let Encoder: EncoderStatic;
|
||||
export interface ClientOptions {
|
||||
contactPoints: Array<string>,
|
||||
keyspace?: string,
|
||||
refreshSchemaDelay?: number,
|
||||
isMetadataSyncEnabled?: boolean,
|
||||
prepareOnAllHosts?: boolean,
|
||||
rePrepareOnUp?: boolean,
|
||||
maxPrepared?: number,
|
||||
policies?: {
|
||||
addressResolution?: policies.addressResolution.AddressTranslator,
|
||||
loadBalancing?: policies.loadBalancing.LoadBalancingPolicy,
|
||||
retry?: policies.retry.RetryPolicy,
|
||||
reconnection?: policies.reconnection.ReconnectionPolicy,
|
||||
retry?: policies.retry.RetryPolicy
|
||||
addressResolution?: policies.addressResolution.AddressTranslator,
|
||||
speculativeExecution?: policies.speculativeExecution.SpeculativeExecutionPolicy,
|
||||
timestampGeneration?: policies.timestampGeneration.TimestampGenerator,
|
||||
},
|
||||
queryOptions?: QueryOptions,
|
||||
pooling?: {
|
||||
heartBeatInterval: number,
|
||||
coreConnectionsPerHost: { [key: number]: number; },
|
||||
warmup: boolean;
|
||||
heartBeatInterval?: number,
|
||||
coreConnectionsPerHost?: { [key: number]: number; },
|
||||
maxRequestsPerConnection?: number,
|
||||
warmup?: boolean;
|
||||
},
|
||||
protocolOptions?: {
|
||||
port: number,
|
||||
maxSchemaAgreementWaitSeconds: number,
|
||||
maxVersion: number
|
||||
port?: number,
|
||||
maxSchemaAgreementWaitSeconds?: number,
|
||||
maxVersion?: number
|
||||
},
|
||||
socketOptions?: {
|
||||
connectTimeout: number,
|
||||
defunctReadTimeoutThreshold: number,
|
||||
keepAlive: boolean,
|
||||
keepAliveDelay: number,
|
||||
readTimeout: number,
|
||||
tcpNoDelay: boolean,
|
||||
coalescingThreshold: number
|
||||
connectTimeout?: number,
|
||||
defunctReadTimeoutThreshold?: number,
|
||||
keepAlive?: boolean,
|
||||
keepAliveDelay?: number,
|
||||
readTimeout?: number,
|
||||
tcpNoDelay?: boolean,
|
||||
coalescingThreshold?: number
|
||||
},
|
||||
authProvider?: auth.AuthProvider,
|
||||
sslOptions?: tls.ConnectionOptions,
|
||||
encoding?: {
|
||||
map: Function,
|
||||
set: Function,
|
||||
copyBuffer: boolean,
|
||||
useUndefinedAsUnset: boolean
|
||||
}
|
||||
map?: Function,
|
||||
set?: Function,
|
||||
copyBuffer?: boolean,
|
||||
useUndefinedAsUnset?: boolean
|
||||
},
|
||||
profiles?: Array<ExecutionProfile>,
|
||||
promiseFactory?: Function,
|
||||
}
|
||||
|
||||
export interface QueryOptions {
|
||||
@@ -483,8 +554,11 @@ export interface QueryOptions {
|
||||
captureStackTrace?: boolean;
|
||||
consistency?: number;
|
||||
customPayload?: any;
|
||||
executionProfile?: string | ExecutionProfile;
|
||||
fetchSize?: number;
|
||||
hints?: Array<string> | Array<Array<string>>;
|
||||
isIdempotent?: boolean;
|
||||
keyspace?: string;
|
||||
logged?: boolean;
|
||||
pageState?: Buffer | string;
|
||||
prepare?: boolean;
|
||||
@@ -520,6 +594,7 @@ export interface Client extends events.EventEmitter {
|
||||
execute(query: string, callback: ResultCallback): void;
|
||||
execute(query: string, params?: any, options?: QueryOptions): Promise<types.ResultSet>;
|
||||
getReplicas(keyspace: string, token: Buffer): Array<any>; // TODO: Should this be a more explicit return?
|
||||
getState(): metadata.ClientState;
|
||||
shutdown(callback?: Callback): void;
|
||||
shutdown(): Promise<void>;
|
||||
stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): NodeJS.ReadableStream;
|
||||
@@ -548,6 +623,7 @@ export interface HostMapStatic {
|
||||
export interface HostMap extends events.EventEmitter {
|
||||
length: number;
|
||||
|
||||
clear(): Array<Host>;
|
||||
forEach(callback: Callback): void;
|
||||
get(key: string): Host;
|
||||
keys(): Array<string>;
|
||||
@@ -566,6 +642,22 @@ export interface Encoder {
|
||||
encode(value: any, typeInfo?: string | number | { code: number, info?: any }): Buffer;
|
||||
}
|
||||
|
||||
interface ExecutionProfileOptions {
|
||||
consistency: number,
|
||||
loadBalancing: policies.loadBalancing.LoadBalancingPolicy,
|
||||
name: string,
|
||||
readTimeout: number,
|
||||
retry: policies.retry.RetryPolicy,
|
||||
serialConsistency: number
|
||||
}
|
||||
|
||||
export interface ExecutionProfileStatic {
|
||||
new (name: string, options: ExecutionProfileOptions): ExecutionProfile
|
||||
}
|
||||
|
||||
export interface ExecutionProfile extends ExecutionProfileOptions {
|
||||
}
|
||||
|
||||
export namespace auth {
|
||||
let Authenticator: AuthenticatorStatic;
|
||||
let PlainTextAuthProvider: PlainTextAuthProviderStatic;
|
||||
@@ -649,6 +741,17 @@ export namespace metadata {
|
||||
stateFunction: string;
|
||||
stateType: string;
|
||||
}
|
||||
|
||||
interface ClientStateStatic {
|
||||
new (): ClientState;
|
||||
}
|
||||
|
||||
interface ClientState {
|
||||
getConnectedHosts(): Array<Host>;
|
||||
getInFlightQueries(host: Host): number;
|
||||
getOpenConnections(host: Host): number;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
interface DataTypeInfo {
|
||||
code: number,
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import * as React from "react";
|
||||
import { Config, render, markdown, Catalog, ReactSpecimen, Page } from "catalog";
|
||||
|
||||
const config: Config = {
|
||||
title: 'Test',
|
||||
pages: [
|
||||
{
|
||||
path: '/',
|
||||
title: 'Introduction',
|
||||
content: '/patd/to/file.md',
|
||||
},
|
||||
{
|
||||
path: '/materials',
|
||||
title: 'Materials',
|
||||
pages: [
|
||||
{
|
||||
path: '/materials/typeface',
|
||||
title: 'Typeface',
|
||||
component: <Page />,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
useBrowserHistory: true,
|
||||
basePath: '/doc',
|
||||
responsiveSizes: [
|
||||
{ name: 'large', width: 978, height: 1100 },
|
||||
{ name: 'medium', width: 640, height: 900 },
|
||||
{ name: 'small', width: 471, height: 700 },
|
||||
],
|
||||
};
|
||||
|
||||
render(config, document.body);
|
||||
<Catalog {...config} />;
|
||||
|
||||
markdown`
|
||||
# Test
|
||||
|
||||
${<ReactSpecimen sourceText='.'>
|
||||
<div />
|
||||
</ReactSpecimen>}
|
||||
`;
|
||||
Vendored
-109
@@ -1,109 +0,0 @@
|
||||
// Type definitions for catalog 3.2
|
||||
// Project: https://github.com/interactivethings/catalog/
|
||||
// Definitions by: Peter Gassner <https://github.com/grossbart>, Tomas Carnecky <https://github.com/wereHamster>
|
||||
// Definitions: https://github.com/interactivethings/catalog/
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
// Configuration
|
||||
|
||||
// XXX: Can not name this 'Page' because there's already a 'Page'
|
||||
// component here.
|
||||
export interface ConfigPage {
|
||||
path: string;
|
||||
title: string;
|
||||
|
||||
content?: any;
|
||||
component?: any;
|
||||
pages?: ConfigPage[];
|
||||
}
|
||||
|
||||
export interface ConfigResponsiveSize {
|
||||
name: string;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
title: string;
|
||||
pages: ConfigPage[];
|
||||
|
||||
useBrowserHistory?: boolean;
|
||||
basePath?: string;
|
||||
responsiveSizes?: ConfigResponsiveSize[];
|
||||
}
|
||||
|
||||
export function render(config: Config, element: HTMLElement): void;
|
||||
export function configure(config: any): any;
|
||||
export function configureRoutes(config: any): any;
|
||||
export function configureJSXRoutes(config: any): any;
|
||||
|
||||
export function pageLoader(f: () => Promise<any>): any;
|
||||
export function markdown(...x: any[]): JSX.Element;
|
||||
|
||||
// Components
|
||||
export interface DefaultCatalogProps extends React.Props<{}> {
|
||||
span?: number;
|
||||
theme?: any;
|
||||
}
|
||||
|
||||
export class Card extends React.Component<DefaultCatalogProps> {}
|
||||
export class Page extends React.Component<DefaultCatalogProps> {}
|
||||
export interface SpanProps extends DefaultCatalogProps {
|
||||
style?: any;
|
||||
}
|
||||
export class Span extends React.Component<SpanProps> {}
|
||||
|
||||
// Specimens
|
||||
export class AudioSpecimen extends React.Component<DefaultCatalogProps> {}
|
||||
|
||||
export interface CodeSpecimenProps extends DefaultCatalogProps {
|
||||
rawBody: string;
|
||||
collapsed: boolean;
|
||||
lang: string;
|
||||
raw: boolean;
|
||||
}
|
||||
export class CodeSpecimen extends React.Component<CodeSpecimenProps> {}
|
||||
|
||||
export interface ColorSpecimenProps extends DefaultCatalogProps {
|
||||
value: string;
|
||||
name: string;
|
||||
}
|
||||
export class ColorSpecimen extends React.Component<ColorSpecimenProps> {}
|
||||
|
||||
export interface ColorPaletteSpecimenProps extends DefaultCatalogProps {
|
||||
colors: Array<{name?: string, value: string}>;
|
||||
horizontal?: boolean;
|
||||
}
|
||||
export class ColorPaletteSpecimen extends React.Component<ColorPaletteSpecimenProps> {}
|
||||
|
||||
export class HtmlSpecimen extends React.Component<DefaultCatalogProps> {}
|
||||
export class HintSpecimen extends React.Component<DefaultCatalogProps> {}
|
||||
export class ImageSpecimen extends React.Component<DefaultCatalogProps> {}
|
||||
|
||||
export interface TypeSpecimenProps extends DefaultCatalogProps {
|
||||
color?: string;
|
||||
font: string;
|
||||
headings: string[] | number[];
|
||||
style?: string;
|
||||
weight: string;
|
||||
}
|
||||
export class TypeSpecimen extends React.Component<TypeSpecimenProps> {}
|
||||
export class DownloadSpecimen extends React.Component<DefaultCatalogProps> {}
|
||||
|
||||
export interface ReactSpecimenProps extends DefaultCatalogProps {
|
||||
noSource?: boolean;
|
||||
plain?: boolean;
|
||||
light?: boolean;
|
||||
dark?: boolean;
|
||||
frame?: boolean;
|
||||
state?: any;
|
||||
responsive?: boolean | string | string[];
|
||||
sourceText?: string;
|
||||
}
|
||||
export class ReactSpecimen extends React.Component<ReactSpecimenProps> {}
|
||||
|
||||
export class VideoSpecimen extends React.Component<DefaultCatalogProps> {}
|
||||
|
||||
export class Catalog extends React.Component<Config> {}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+1
@@ -49,4 +49,5 @@ declare global {
|
||||
}
|
||||
|
||||
declare function chaiString(chai: any, utils: any): void;
|
||||
declare namespace chaiString { }
|
||||
export = chaiString;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
|
||||
import chai = require('chai');
|
||||
import chaiThings = require('chai-things');
|
||||
|
||||
import * as chai from 'chai';
|
||||
import * as chaiThings from 'chai-things';
|
||||
chai.use(chaiThings);
|
||||
|
||||
function test_somethingSyntax() {
|
||||
|
||||
Vendored
+1
@@ -60,5 +60,6 @@ interface Array<T> {
|
||||
|
||||
declare module "chai-things" {
|
||||
function chaiThings(chai: any, utils: any): void;
|
||||
namespace chaiThings { }
|
||||
export = chaiThings;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,12 @@ const chart: Chart = new Chart(new CanvasRenderingContext2D(), {
|
||||
hover: {
|
||||
intersect: true
|
||||
},
|
||||
onHover(ev: MouseEvent, points: any[]) {
|
||||
return;
|
||||
},
|
||||
title: {
|
||||
text: ["foo", "bar"]
|
||||
},
|
||||
tooltips: {
|
||||
filter: data => Number(data.yLabel) > 0,
|
||||
intersect: true,
|
||||
@@ -52,6 +58,7 @@ const chart: Chart = new Chart(new CanvasRenderingContext2D(), {
|
||||
padding: 40
|
||||
}
|
||||
},
|
||||
devicePixelRatio: 2,
|
||||
}
|
||||
});
|
||||
chart.update();
|
||||
|
||||
Vendored
+22
-19
@@ -9,6 +9,7 @@
|
||||
// Dan Manastireanu <https://github.com/danmana>
|
||||
// Guillaume Rodriguez <https://github.com/guillaume-ro-fr>
|
||||
// Sergey Rubanov <https://github.com/chicoxyzzy>
|
||||
// Simon Archer <https://github.com/archy-bold>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -126,6 +127,10 @@ declare namespace Chart {
|
||||
pointStyle?: PointStyle;
|
||||
}
|
||||
|
||||
interface ChartLegendLabelItem extends ChartLegendItem {
|
||||
datasetIndex: number;
|
||||
}
|
||||
|
||||
interface ChartTooltipItem {
|
||||
xLabel?: string;
|
||||
yLabel?: string;
|
||||
@@ -184,6 +189,7 @@ declare namespace Chart {
|
||||
aspectRatio?: number;
|
||||
maintainAspectRatio?: boolean;
|
||||
events?: string[];
|
||||
onHover?(this: Chart, event: MouseEvent, activeElements: Array<{}>): any;
|
||||
onClick?(event?: MouseEvent, activeElements?: Array<{}>): any;
|
||||
title?: ChartTitleOptions;
|
||||
legend?: ChartLegendOptions;
|
||||
@@ -198,6 +204,7 @@ declare namespace Chart {
|
||||
cutoutPercentage?: number;
|
||||
circumference?: number;
|
||||
rotation?: number;
|
||||
devicePixelRatio?: number;
|
||||
// Plugins can require any options
|
||||
plugins?: { [plugin: string]: any };
|
||||
}
|
||||
@@ -218,15 +225,15 @@ declare namespace Chart {
|
||||
fontColor?: ChartColor;
|
||||
fontStyle?: string;
|
||||
padding?: number;
|
||||
text?: string;
|
||||
text?: string | string[];
|
||||
}
|
||||
|
||||
interface ChartLegendOptions {
|
||||
display?: boolean;
|
||||
position?: PositionType;
|
||||
fullWidth?: boolean;
|
||||
onClick?(event: MouseEvent, legendItem: ChartLegendItem): void;
|
||||
onHover?(event: MouseEvent, legendItem: ChartLegendItem): void;
|
||||
onClick?(event: MouseEvent, legendItem: ChartLegendLabelItem): void;
|
||||
onHover?(event: MouseEvent, legendItem: ChartLegendLabelItem): void;
|
||||
labels?: ChartLegendLabelOptions;
|
||||
reverse?: boolean;
|
||||
}
|
||||
@@ -239,7 +246,7 @@ declare namespace Chart {
|
||||
fontFamily?: string;
|
||||
padding?: number;
|
||||
generateLabels?(chart: any): any;
|
||||
filter?(item: ChartLegendItem, data: ChartData): any;
|
||||
filter?(legendItem: ChartLegendLabelItem, data: ChartData): any;
|
||||
usePointStyle?: boolean;
|
||||
}
|
||||
|
||||
@@ -291,7 +298,7 @@ declare namespace Chart {
|
||||
mode?: string;
|
||||
animationDuration?: number;
|
||||
intersect?: boolean;
|
||||
onHover?(active: any): void;
|
||||
onHover?(this: Chart, event: MouseEvent, activeElements: Array<{}>): any;
|
||||
}
|
||||
|
||||
interface ChartAnimationObject {
|
||||
@@ -395,6 +402,10 @@ declare namespace Chart {
|
||||
interface TickOptions {
|
||||
autoSkip?: boolean;
|
||||
autoSkipPadding?: number;
|
||||
backdropColor?: ChartColor;
|
||||
backdropPaddingX?: number;
|
||||
backdropPaddingY?: number;
|
||||
beginAtZero?: boolean;
|
||||
callback?(value: any, index: any, values: any): string|number;
|
||||
display?: boolean;
|
||||
fontColor?: ChartColor;
|
||||
@@ -402,14 +413,17 @@ declare namespace Chart {
|
||||
fontSize?: number;
|
||||
fontStyle?: string;
|
||||
labelOffset?: number;
|
||||
max?: any;
|
||||
maxRotation?: number;
|
||||
maxTicksLimit?: number;
|
||||
min?: any;
|
||||
minRotation?: number;
|
||||
mirror?: boolean;
|
||||
padding?: number;
|
||||
reverse?: boolean;
|
||||
min?: any;
|
||||
max?: any;
|
||||
showLabelBackdrop?: boolean;
|
||||
}
|
||||
|
||||
interface AngleLineOptions {
|
||||
display?: boolean;
|
||||
color?: ChartColor;
|
||||
@@ -424,26 +438,15 @@ declare namespace Chart {
|
||||
fontStyle?: string;
|
||||
}
|
||||
|
||||
interface TickOptions {
|
||||
backdropColor?: ChartColor;
|
||||
backdropPaddingX?: number;
|
||||
backdropPaddingY?: number;
|
||||
maxTicksLimit?: number;
|
||||
showLabelBackdrop?: boolean;
|
||||
}
|
||||
interface LinearTickOptions extends TickOptions {
|
||||
beginAtZero?: boolean;
|
||||
min?: number;
|
||||
max?: number;
|
||||
maxTicksLimit?: number;
|
||||
stepSize?: number;
|
||||
suggestedMin?: number;
|
||||
suggestedMax?: number;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
interface LogarithmicTickOptions extends TickOptions {
|
||||
min?: number;
|
||||
max?: number;
|
||||
}
|
||||
|
||||
type ChartColor = string | CanvasGradient | CanvasPattern | string[];
|
||||
|
||||
@@ -37,6 +37,13 @@ function test_CKEDITOR() {
|
||||
CKEDITOR.replaceAll((textarea, config) => false);
|
||||
}
|
||||
|
||||
function test_CKEDITOR_events() {
|
||||
CKEDITOR.on('instanceCreated', function(event) {
|
||||
// $ExpectType editor
|
||||
event.editor;
|
||||
});
|
||||
}
|
||||
|
||||
function test_config() {
|
||||
var config1: CKEDITOR.config = {
|
||||
toolbar: 'basic',
|
||||
@@ -55,18 +62,18 @@ function test_config() {
|
||||
var config3: CKEDITOR.config = {
|
||||
toolbarGroups: [
|
||||
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
|
||||
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
|
||||
{ name: 'links', groups: [ 'links' ] },
|
||||
{ name: 'insert', groups: [ 'insert' ] },
|
||||
{ name: 'tools', groups: [ 'tools' ] },
|
||||
{ name: 'document', groups: [ 'mode' ] },
|
||||
{ name: 'about', groups: [ 'about' ] },
|
||||
'/',
|
||||
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
|
||||
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'paragraph' ] },
|
||||
'/',
|
||||
{ name: 'styles', groups: [ 'styles' ] },
|
||||
{ name: 'colors', groups: [ 'colors' ] },
|
||||
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
|
||||
{ name: 'links', groups: [ 'links' ] },
|
||||
{ name: 'insert', groups: [ 'insert' ] },
|
||||
{ name: 'tools', groups: [ 'tools' ] },
|
||||
{ name: 'document', groups: [ 'mode' ] },
|
||||
{ name: 'about', groups: [ 'about' ] },
|
||||
'/',
|
||||
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
|
||||
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'paragraph' ] },
|
||||
'/',
|
||||
{ name: 'styles', groups: [ 'styles' ] },
|
||||
{ name: 'colors', groups: [ 'colors' ] },
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -211,7 +218,7 @@ function test_dom_event() {
|
||||
domEvent.getTarget().addClass('clicked');
|
||||
});
|
||||
element.on('click', ev=> {
|
||||
var domEvent = ev.data;
|
||||
var domEvent = ev.data as CKEDITOR.dom.event;
|
||||
domEvent.preventDefault();
|
||||
});
|
||||
}
|
||||
@@ -323,7 +330,11 @@ function test_adding_dialog_by_definition() {
|
||||
title: 'Abbreviation Properties',
|
||||
minWidth: 400,
|
||||
minHeight: 200,
|
||||
|
||||
onLoad: () => {},
|
||||
onOk: () => {},
|
||||
onCancel: () => {},
|
||||
onShow: () => {},
|
||||
onHide: () => {},
|
||||
contents: [
|
||||
{
|
||||
id: 'tab-basic',
|
||||
@@ -340,12 +351,14 @@ function test_adding_dialog_by_definition() {
|
||||
});
|
||||
}
|
||||
|
||||
function test_adding_plugin() {
|
||||
function test_plugins() {
|
||||
CKEDITOR.plugins.add( 'abbr', {
|
||||
init: function( editor: CKEDITOR.editor ) {
|
||||
// empty logic
|
||||
}
|
||||
});
|
||||
|
||||
console.log(CKEDITOR.plugins.registered['abbr']);
|
||||
}
|
||||
|
||||
function test_adding_widget() {
|
||||
@@ -508,7 +521,80 @@ function test_editor_instance_event() {
|
||||
}
|
||||
|
||||
function test_dtd() {
|
||||
var brConsideredEmptyTag = CKEDITOR.dtd.$empty["br"];
|
||||
var spanCanContainText = CKEDITOR.dtd["span"]["#"];
|
||||
var divCanContainSpan = CKEDITOR.dtd["div"]["span"];
|
||||
var brConsideredEmptyTag = CKEDITOR.dtd.$empty['br'];
|
||||
var spanCanContainText = CKEDITOR.dtd['span']['#'];
|
||||
var divCanContainSpan = CKEDITOR.dtd['div']['span'];
|
||||
}
|
||||
|
||||
function test_getSelectedHtml() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var editor = CKEDITOR.replace(textarea);
|
||||
|
||||
// $ExpectType documentFragment
|
||||
var sel1 = editor.getSelectedHtml();
|
||||
console.log(sel1);
|
||||
|
||||
// $ExpectType documentFragment
|
||||
var sel2 = editor.getSelectedHtml(false);
|
||||
console.log(sel2);
|
||||
|
||||
// $ExpectType string
|
||||
var sel3 = editor.getSelectedHtml(true);
|
||||
console.log(sel3);
|
||||
|
||||
// $ExpectType string | documentFragment
|
||||
var sel4 = editor.getSelectedHtml(Math.random() > 0.5);
|
||||
console.log(sel4);
|
||||
}
|
||||
|
||||
function test_element() {
|
||||
var el = CKEDITOR.document.getById('myElement');
|
||||
el.addClass('class');
|
||||
console.log(el.hasClass('class'));
|
||||
el.removeClass('class');
|
||||
}
|
||||
|
||||
function test_selection() {
|
||||
var editor = new CKEDITOR.editor();
|
||||
var testNode = CKEDITOR.document.getById('myElement');
|
||||
|
||||
var selection = editor.getSelection();
|
||||
var ranges = selection.getRanges();
|
||||
for (var i = 0, c = ranges.length; i < c; i++) {
|
||||
var range = ranges[i];
|
||||
range.setStartBefore(testNode);
|
||||
range.setStartAfter(testNode);
|
||||
range.setEndBefore(testNode);
|
||||
range.setEndAfter(testNode);
|
||||
}
|
||||
}
|
||||
|
||||
function test_tools() {
|
||||
var obj = { key: 'value' };
|
||||
CKEDITOR.tools.clone(obj);
|
||||
CKEDITOR.tools.copy(obj);
|
||||
CKEDITOR.tools.prototypedCopy(obj);
|
||||
|
||||
console.log(CKEDITOR.tools.isArray([1])); // true
|
||||
console.log(CKEDITOR.tools.isArray(obj)); // false
|
||||
console.log(CKEDITOR.tools.isArray(null)); // false
|
||||
console.log(CKEDITOR.tools.isArray(undefined)); // false
|
||||
|
||||
CKEDITOR.tools.override(parseInt, function(_parseInt) {
|
||||
return function(value: any, radix?: number) {
|
||||
return _parseInt(value, radix);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function test_htmlParser() {
|
||||
var html = '<div><span>text</span></div>';
|
||||
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
|
||||
fragment.forEach(function(node) {
|
||||
if (node instanceof CKEDITOR.htmlParser.element) {
|
||||
node.forEach(function(node) {
|
||||
console.log(node);
|
||||
});
|
||||
}
|
||||
}, CKEDITOR.NODE_ELEMENT, true);
|
||||
}
|
||||
|
||||
Vendored
+38
-13
@@ -80,7 +80,6 @@ declare namespace CKEDITOR {
|
||||
var version: string;
|
||||
var config: config;
|
||||
|
||||
|
||||
// Methods
|
||||
function add(editor: editor): void;
|
||||
function addCss(css: string): void;
|
||||
@@ -101,6 +100,17 @@ declare namespace CKEDITOR {
|
||||
function replaceAll(className?: string): void;
|
||||
function replaceAll(assertionFunction: (textarea: HTMLTextAreaElement, config: config) => boolean): void;
|
||||
|
||||
// Event interface
|
||||
function capture(): void;
|
||||
function define(name: string, meta: Object): void;
|
||||
function fire(eventName: string, data?: Object, editor?: editor): any;
|
||||
function fireOnce(eventName: string, data?: Object, editor?: editor): any;
|
||||
function hasListeners(eventName: string): boolean;
|
||||
function on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): void;
|
||||
function once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): void;
|
||||
function removeAllListeners(): void;
|
||||
function removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void;
|
||||
|
||||
type listenerRegistration = {
|
||||
removeListener: () => void;
|
||||
}
|
||||
@@ -321,11 +331,11 @@ declare namespace CKEDITOR {
|
||||
deleteContents(mergeThen?: boolean): void;
|
||||
extractContents(mergeThen?: boolean): documentFragment;
|
||||
createBookmark(serializable?: boolean): bookmark;
|
||||
createBookmark2(normalized: boolean): Object;
|
||||
createBookmark2(normalized?: boolean): Object;
|
||||
createIterator(): iterator;
|
||||
moveToBookmark(bookmark: Object): void;
|
||||
getBoundaryNodes(): { startNode: node; endNode: node; };
|
||||
getCommonAncestor(includeSelf: boolean, ignoreTextNode: boolean): element;
|
||||
getCommonAncestor(includeSelf?: boolean, ignoreTextNode?: boolean): element;
|
||||
optimize(): void;
|
||||
optimizeBookmark(): void;
|
||||
trim(ignoreStart?: boolean, ignoreEnd?: boolean): void;
|
||||
@@ -337,6 +347,8 @@ declare namespace CKEDITOR {
|
||||
selectNodeContents(node: node): void;
|
||||
setStart(startNode: node, startOffset: number): void;
|
||||
setEnd(endNode: node, endOffset: number): void;
|
||||
setEndAfter(node: node): void;
|
||||
setEndBefore(node: node): void;
|
||||
setStartAfter(node: node): void;
|
||||
setStartBefore(node: node): void;
|
||||
setStartAt(node: node, position: number): void;
|
||||
@@ -380,8 +392,8 @@ declare namespace CKEDITOR {
|
||||
constructor(target: document);
|
||||
constructor(target: element);
|
||||
constructor(target: selection);
|
||||
createBookmarks(serializable: Object): any[];
|
||||
createBookmarks2(normalized?: Object): any[];
|
||||
createBookmarks(serializable: Object): bookmark[];
|
||||
createBookmarks2(normalized: Object): Object[];
|
||||
fake(element: element): void;
|
||||
getCommonAncestor(): element;
|
||||
getNative(): Object;
|
||||
@@ -406,8 +418,8 @@ declare namespace CKEDITOR {
|
||||
constructor(ranges: range[]);
|
||||
constructor(range: range);
|
||||
createIterator(): rangeListIterator;
|
||||
createBokmark(serializable: boolean): Object[];
|
||||
createBookmark2(normalized: boolean): Object[];
|
||||
createBokmarks(serializable?: boolean): bookmark[];
|
||||
createBookmarks2(normalized?: boolean): Object[];
|
||||
moveToBookmark(bookmarks: Object[]): void;
|
||||
}
|
||||
|
||||
@@ -431,7 +443,7 @@ declare namespace CKEDITOR {
|
||||
insertAfter(node: node): node;
|
||||
insertBefore(node: node): node;
|
||||
insertBeforeMe(node: node): node;
|
||||
getAddress(normalized: boolean): Object[];
|
||||
getAddress(normalized?: boolean): Object[];
|
||||
getDocument(): document;
|
||||
getIndex(normalized?: boolean): number;
|
||||
getNextSourceNode(startFromSibling: Object, nodeType: Object, guard: Object): void;
|
||||
@@ -444,7 +456,7 @@ declare namespace CKEDITOR {
|
||||
getPosition(otherNode: Object): void;
|
||||
getAscendant(reference: string, includeSelf?: boolean): node;
|
||||
hasAscendant(name: Object, includeSelf: any): boolean;
|
||||
move(preserveChildren?: boolean): node;
|
||||
remove(preserveChildren?: boolean): node;
|
||||
replace(nodeToReplace: node): void;
|
||||
trim(): void;
|
||||
ltrim(): void;
|
||||
@@ -464,7 +476,7 @@ declare namespace CKEDITOR {
|
||||
constructor(domEvent: Event);
|
||||
getKey(): number;
|
||||
getKeystroke(): number;
|
||||
preventDefault(stopPropagation: boolean): void;
|
||||
preventDefault(stopPropagation?: boolean): void;
|
||||
stopPropagation(): void;
|
||||
getTarget(): node;
|
||||
getPhase(): number;
|
||||
@@ -878,7 +890,8 @@ declare namespace CKEDITOR {
|
||||
applyToRange(range: Range, editor: editor): void;
|
||||
}
|
||||
|
||||
interface editable extends dom.element {
|
||||
class editable extends dom.element {
|
||||
constructor(editor: editor, element: HTMLElement | dom.element);
|
||||
hasFocus: boolean;
|
||||
attachListener(obj: event | editable, eventName: string, listenerFunction: (ei: eventInfo) => void,
|
||||
scopeobj?: {}, listenerData?: any, priority?: number): listenerRegistration;
|
||||
@@ -1077,13 +1090,13 @@ declare namespace CKEDITOR {
|
||||
|
||||
function add(name: string, definition: IPluginDefinition): void;
|
||||
function add(name: string): void;
|
||||
function addExternal(name: string, path: string, fileName: string): void;
|
||||
function addExternal(name: string, path: string, fileName?: string): void;
|
||||
function get(name: string): any;
|
||||
function getFilePath(name: string): string;
|
||||
function getPath(name: string): string;
|
||||
function load(name: string, callback: Function, scope?: Object): void;
|
||||
function setLang(pluginName: string, languageCode: string, languageEntries: any): void;
|
||||
|
||||
var registered: {[key: string]: IPluginDefinition};
|
||||
}
|
||||
|
||||
interface IMenuItemDefinition {
|
||||
@@ -1155,6 +1168,9 @@ declare namespace CKEDITOR {
|
||||
getData(noEvents?: Object): string;
|
||||
getMenuItem(name: string): Object;
|
||||
getResizable(forContents: boolean): dom.element;
|
||||
getSelectedHtml(toString?: false): dom.documentFragment;
|
||||
getSelectedHtml(toString: true): string;
|
||||
getSelectedHtml(toString?: boolean): CKEDITOR.dom.documentFragment | string;
|
||||
getSelection(forceRealSelection?: boolean): dom.selection;
|
||||
getSnapshot(): string;
|
||||
getStylesSet(callback: Function): void;
|
||||
@@ -1735,6 +1751,7 @@ declare namespace CKEDITOR {
|
||||
onLoad?: Function;
|
||||
onOk?: Function;
|
||||
onShow?: Function;
|
||||
onHide?: Function;
|
||||
resizable?: number;
|
||||
title?: string;
|
||||
width?: number;
|
||||
@@ -1838,9 +1855,11 @@ declare namespace CKEDITOR {
|
||||
type: number;
|
||||
add(node: node): number;
|
||||
add(node: node, index: number): void;
|
||||
addClass(className: string): void;
|
||||
clone(): element;
|
||||
filter(filter: filter): boolean;
|
||||
filterChildren(filter: filter): void;
|
||||
forEach(callback: (node: node, type?: number) => void|false, type?: number, skipRoot?: boolean): void;
|
||||
writeHtml(writer: basicWriter, filter: filter): void;
|
||||
writeChildrenHtml(writer: basicWriter, filter: filter): void;
|
||||
replaceWithChildren(): void;
|
||||
@@ -1871,6 +1890,7 @@ declare namespace CKEDITOR {
|
||||
add(node: node, index?: number): void;
|
||||
filter(filter: filter): void;
|
||||
filterChildren(filter: filter, filterRoot?: boolean): void;
|
||||
forEach(callback: (node: node, type?: number) => void|false, type?: number, skipRoot?: boolean): void;
|
||||
writeHtml(writer: basicWriter, filter?: filter): void;
|
||||
writeChildrenHtml(writer: basicWriter, filter?: filter, filterRoot?: boolean): void;
|
||||
forEach(callback: (node: node, type?: number) => boolean, type?: number, skipRoot?: boolean): void;
|
||||
@@ -1908,8 +1928,13 @@ declare namespace CKEDITOR {
|
||||
|
||||
namespace tools {
|
||||
var callFunction: Function;
|
||||
function clone(source: Object): Object;
|
||||
function copy(source: Object): Object;
|
||||
function enableHtml5Elements(doc: Object, withAppend?: Boolean): void;
|
||||
function isArray<T>(object: any|null|undefined): object is T[];
|
||||
function override<T extends Function>(originalFunction: T, functionBuilder: (originalFunction: T) => T): T;
|
||||
function parseCssText(styleText: string, normalize?: Boolean, nativeNormalize?: Boolean): { [key: string]: string }
|
||||
function prototypedCopy(source: Object): Object;
|
||||
function writeCssText(style: { [key: string]: string }, sort?: Boolean): string;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
// Testing type definitions for clearbladejs-client 1.0
|
||||
// Project: https://github.com/ClearBlade/JavaScript-API
|
||||
// Definitions by: Jim Bouquet <https://github.com/ClearBlade>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
let genericCallback = (error: boolean, response: Resp) => {};
|
||||
|
||||
///////////////////////////////////////
|
||||
// ClearBlade object API invocations
|
||||
///////////////////////////////////////
|
||||
ClearBlade.init({
|
||||
systemKey: "abcdef",
|
||||
systemSecret: "abcdefg",
|
||||
callback: genericCallback
|
||||
});
|
||||
|
||||
ClearBlade.setUser("test@test.com", "password");
|
||||
ClearBlade.registerUser("test@test.com", "password", genericCallback);
|
||||
ClearBlade.isCurrentUserAuthenticated(genericCallback);
|
||||
ClearBlade.logoutUser(genericCallback);
|
||||
ClearBlade.loginAnon(genericCallback);
|
||||
ClearBlade.loginUser("test@test.com", "password", genericCallback);
|
||||
ClearBlade.loginUserMqtt("test@test.com", "password", genericCallback);
|
||||
ClearBlade.sendPush(["user1", "user2"], {data: "Test"}, "appId: string", genericCallback);
|
||||
ClearBlade.getAllCollections(genericCallback);
|
||||
|
||||
let coll1 = ClearBlade.Collection("collectionID");
|
||||
let coll2 = ClearBlade.Collection({ collectionName: "collectionName" });
|
||||
let coll3 = ClearBlade.Collection({ collectionID: "collectionID" });
|
||||
|
||||
let query1 = ClearBlade.Query("collectionID");
|
||||
let query2 = ClearBlade.Query({ offset: 5, limit: 5, collectionID: "collectionID" });
|
||||
let query3 = ClearBlade.Query({ collectionName: "collectionName" });
|
||||
|
||||
let item1 = ClearBlade.Item({}, "collectionID");
|
||||
let item2 = ClearBlade.Item({}, { collectionID: "collectionID" });
|
||||
|
||||
let code = ClearBlade.Code();
|
||||
let user = ClearBlade.User();
|
||||
|
||||
let messaging = ClearBlade.Messaging({}, genericCallback);
|
||||
let stats = ClearBlade.MessagingStats();
|
||||
|
||||
let edge = ClearBlade.Edge();
|
||||
let metrics = ClearBlade.Metrics();
|
||||
let device = ClearBlade.Device();
|
||||
let analytics = ClearBlade.Analytics();
|
||||
let portal = ClearBlade.Portal("MyPortal");
|
||||
let triggers = ClearBlade.Triggers();
|
||||
|
||||
ClearBlade.getEdges(query1.query, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Collection API invocations
|
||||
///////////////////////////////////////
|
||||
coll1.fetch(query1.query, genericCallback);
|
||||
coll1.create(ClearBlade.Item({}, ""), genericCallback);
|
||||
coll1.update(query1.query, {}, genericCallback);
|
||||
coll1.remove(query1.query, genericCallback);
|
||||
coll1.columns(genericCallback);
|
||||
coll1.count(query1.query, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Query API invocations
|
||||
///////////////////////////////////////
|
||||
query1.addSortToQuery(
|
||||
query1,
|
||||
QuerySortDirections.QUERY_SORT_ASCENDING,
|
||||
"column1"
|
||||
);
|
||||
query1.addFilterToQuery(
|
||||
query1,
|
||||
QueryConditions.QUERY_GREATERTHAN,
|
||||
"key",
|
||||
"value"
|
||||
);
|
||||
query1.ascending("string");
|
||||
query1.descending("string");
|
||||
query1.equalTo("string", "string");
|
||||
query1.greaterThan("string", 2);
|
||||
query1.greaterThanEqualTo("string", false);
|
||||
query1.lessThan("string", "string");
|
||||
query1.lessThanEqualTo("string", "string");
|
||||
query1.notEqualTo("string", "string");
|
||||
query1.matches("string", new RegExp(/.*/));
|
||||
query1.or(query2);
|
||||
query1.setPage(1, 1);
|
||||
query1.fetch(genericCallback);
|
||||
query1.update({}, genericCallback);
|
||||
query1.columns([]);
|
||||
query1.remove(genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Item API invocations
|
||||
///////////////////////////////////////
|
||||
item1.save(genericCallback);
|
||||
item1.refresh(genericCallback);
|
||||
item1.destroy(genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Code API invocations
|
||||
///////////////////////////////////////
|
||||
code.create("codeName", "body: string", genericCallback);
|
||||
code.update("codeName", "body: string", genericCallback);
|
||||
code.delete("codeName", genericCallback);
|
||||
code.execute("codeName", {}, genericCallback);
|
||||
code.getCompletedServices(genericCallback);
|
||||
code.getFailedServices(genericCallback);
|
||||
code.getAllServices(genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// User API invocations
|
||||
///////////////////////////////////////
|
||||
user.getUser(genericCallback);
|
||||
user.setUser({}, genericCallback);
|
||||
user.allUsers(query1.query, genericCallback);
|
||||
user.setPassword("old_password", "new_password", genericCallback);
|
||||
user.count(query1.query, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Messaging API invocations
|
||||
///////////////////////////////////////
|
||||
messaging.getMessageHistoryWithTimeFrame("topic", 5, 10, 15, 20, genericCallback);
|
||||
messaging.getMessageHistory("topic", 5, 15, genericCallback);
|
||||
messaging.getAndDeleteMessageHistory("topic", 5, 10, 1, 20, genericCallback);
|
||||
messaging.currentTopics(genericCallback);
|
||||
messaging.publish("topic", {});
|
||||
messaging.publishREST("topic", { payload: Object }, genericCallback);
|
||||
let mcb = (message: string) => {};
|
||||
messaging.subscribe("topic", {}, mcb);
|
||||
messaging.unsubscribe("topic", {});
|
||||
messaging.disconnect();
|
||||
|
||||
///////////////////////////////////////
|
||||
// MessagingStats API invocations
|
||||
///////////////////////////////////////
|
||||
stats.getAveragePayloadSize("topic: string", 5, 5, genericCallback);
|
||||
stats.getOpenConnections(genericCallback);
|
||||
stats.getCurrentSubscribers("topic: string", genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Edge API invocations
|
||||
///////////////////////////////////////
|
||||
edge.updateEdgeByName("edgename", {changedColumn: "New value"}, genericCallback);
|
||||
edge.deleteEdgeByName("edgename", genericCallback);
|
||||
edge.create({newEdge: Object}, "edgename", genericCallback);
|
||||
edge.columns(genericCallback);
|
||||
edge.count(query1.query, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Metrics API invocations
|
||||
///////////////////////////////////////
|
||||
metrics.setQuery(query1.query);
|
||||
metrics.getStatistics(genericCallback);
|
||||
metrics.getStatisticsHistory(genericCallback);
|
||||
metrics.getDBConnections(genericCallback);
|
||||
metrics.getLogs(genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Device API invocations
|
||||
///////////////////////////////////////
|
||||
device.getDeviceByName("devicename", genericCallback);
|
||||
device.updateDeviceByName("devicename", { object: Object }, true, genericCallback);
|
||||
device.deleteDeviceByName("devicename", genericCallback);
|
||||
device.fetch(query1.query, genericCallback);
|
||||
device.update(query1.query, { object: Object }, false, genericCallback);
|
||||
device.delete(query1.query, genericCallback);
|
||||
device.create({ newDevice: Object }, genericCallback);
|
||||
device.columns(genericCallback);
|
||||
device.count(query1.query, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Analytics API invocations
|
||||
///////////////////////////////////////
|
||||
analytics.getStorage({}, genericCallback);
|
||||
analytics.getCount({}, genericCallback);
|
||||
analytics.getEventList({}, genericCallback);
|
||||
analytics.getEventTotals({}, genericCallback);
|
||||
analytics.getUserEvents({}, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Portal API invocations
|
||||
///////////////////////////////////////
|
||||
portal.fetch(genericCallback);
|
||||
portal.update({data: Object}, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Triggers API invocations
|
||||
///////////////////////////////////////
|
||||
triggers.fetchDefinitions(genericCallback);
|
||||
triggers.create("triggername", {data: Object}, genericCallback);
|
||||
triggers.update("triggername", {data: Object}, genericCallback);
|
||||
triggers.delete("triggername", genericCallback);
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
declare global {
|
||||
var ClearBlade: ClearBladeGlobal;
|
||||
}
|
||||
|
||||
export {};
|
||||
Vendored
+436
@@ -0,0 +1,436 @@
|
||||
// Type definitions for clearbladejs-client 1.0
|
||||
// Project: https://github.com/ClearBlade/JavaScript-API
|
||||
// Definitions by: Jim Bouquet <https://github.com/ClearBlade>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="paho-mqtt" />
|
||||
|
||||
interface Resp {
|
||||
error(msg: any): never; // todo: figure out if we can have the compiler throw an error if someone adds code after this
|
||||
success(msg: any): never;
|
||||
}
|
||||
|
||||
declare enum MessagingQOS {
|
||||
MESSAGING_QOS_AT_MOST_ONCE = 0,
|
||||
MESSAGING_QOS_AT_LEAST_ONCE = 1,
|
||||
MESSAGING_QOS_EXACTLY_ONCE = 2
|
||||
}
|
||||
|
||||
interface InitOptions {
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
masterSecret?: string;
|
||||
logging?: boolean;
|
||||
callback?: CbCallback;
|
||||
email?: string;
|
||||
password?: string;
|
||||
registerUser?: boolean;
|
||||
useUser?: APIUser;
|
||||
URI?: string;
|
||||
messagingURI?: string;
|
||||
messagingPort?: number;
|
||||
defaultQoS?: MessagingQOS;
|
||||
callTimeout?: number;
|
||||
messagingAuthPort?: number;
|
||||
}
|
||||
|
||||
interface RequestOptions {
|
||||
method?: string;
|
||||
endpoint?: string;
|
||||
body?: string;
|
||||
qs?: string;
|
||||
URI?: string;
|
||||
useUser?: boolean;
|
||||
authToken?: string;
|
||||
timeout?: number;
|
||||
user?: APIUser;
|
||||
}
|
||||
|
||||
interface APIUser {
|
||||
email: string;
|
||||
authToken: string;
|
||||
}
|
||||
|
||||
type CbCallback = (error: boolean, response: Resp) => void;
|
||||
|
||||
interface ClearBladeGlobal extends ClearBladeInt {
|
||||
MESSAGING_QOS_AT_MOST_ONCE: MessagingQOS.MESSAGING_QOS_AT_MOST_ONCE;
|
||||
MESSAGING_QOS_AT_LEAST_ONCE: MessagingQOS.MESSAGING_QOS_AT_LEAST_ONCE;
|
||||
MESSAGING_QOS_EXACTLY_ONCE: MessagingQOS.MESSAGING_QOS_EXACTLY_ONCE;
|
||||
|
||||
request(options: RequestOptions, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface ClearBladeInt {
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
masterSecret: string;
|
||||
URI: string;
|
||||
messagingURI: string;
|
||||
messagingPort: number;
|
||||
logging: boolean;
|
||||
defaultQoS: MessagingQOS;
|
||||
|
||||
init(options: InitOptions): void;
|
||||
setUser(email: string, password: string): void;
|
||||
registerUser(email: string, password: string, callback: CbCallback): void;
|
||||
isCurrentUserAuthenticated(callback: CbCallback): void;
|
||||
logoutUser(callback: CbCallback): void;
|
||||
loginAnon(callback: CbCallback): void;
|
||||
loginUser(email: string, password: string, callback: CbCallback): void;
|
||||
loginUserMqtt(email: string, password: string, callback: CbCallback): void;
|
||||
registerMasterCallback(callback: CbCallback): void;
|
||||
Collection(options: string | CollectionOptionsWithName | CollectionOptionsWithID): Collection;
|
||||
Query(
|
||||
options: string | QueryOptionsWithName | QueryOptionsWithID
|
||||
): QueryObj;
|
||||
Item(data: object, collectionID: string | ItemOptions): Item;
|
||||
Code(): Code;
|
||||
User(): AppUser;
|
||||
Messaging(options: MessagingOptions, callback: CbCallback): Messaging;
|
||||
MessagingStats(): MessagingStats;
|
||||
sendPush(
|
||||
users: string[],
|
||||
payload: object,
|
||||
appId: string,
|
||||
callback: CbCallback
|
||||
): void;
|
||||
getEdges(query: Query, callback: CbCallback): void;
|
||||
Edge(): Edge;
|
||||
Metrics(): Metrics;
|
||||
Device(): Device;
|
||||
Analytics(): Analytics;
|
||||
Portal(name: string): Portal;
|
||||
Triggers(): Triggers;
|
||||
|
||||
getAllCollections(callback: CbCallback): void;
|
||||
}
|
||||
interface CollectionOptionsWithName {
|
||||
collectionName: string;
|
||||
}
|
||||
|
||||
interface CollectionOptionsWithID {
|
||||
collectionID: string;
|
||||
}
|
||||
|
||||
interface Collection {
|
||||
name: string;
|
||||
endpoint: string;
|
||||
isUsingCollectionName: boolean;
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
fetch(query: Query, callback: CbCallback): void;
|
||||
create(newItem: Item, callback: CbCallback): void;
|
||||
update(query: Query, changes: object, callback: CbCallback): void;
|
||||
remove(query: Query, callback: CbCallback): void;
|
||||
columns(callback: CbCallback): void;
|
||||
count(query: Query, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
declare enum QuerySortDirections {
|
||||
QUERY_SORT_ASCENDING = "ASC",
|
||||
QUERY_SORT_DESCENDING = "DESC"
|
||||
}
|
||||
|
||||
declare enum QueryConditions {
|
||||
QUERY_EQUAL = "EQ",
|
||||
QUERY_NOTEQUAL = "NEQ",
|
||||
QUERY_GREATERTHAN = "GT",
|
||||
QUERY_GREATERTHAN_EQUAL = "GTE",
|
||||
QUERY_LESSTHAN = "LT",
|
||||
QUERY_LESSTHAN_EQUAL = "LTE",
|
||||
QUERY_MATCHES = "RE"
|
||||
}
|
||||
|
||||
type QueryValue = string | number | boolean;
|
||||
|
||||
interface QueryOptions {
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
interface QueryOptionsWithName
|
||||
extends CollectionOptionsWithName,
|
||||
QueryOptions {}
|
||||
interface QueryOptionsWithID extends CollectionOptionsWithID, QueryOptions {}
|
||||
|
||||
interface Query {
|
||||
SELECTCOLUMNS?: string[];
|
||||
SORT?: QuerySortDirections;
|
||||
FILTERS?: QueryFilter[];
|
||||
PAGESIZE?: number;
|
||||
PAGENUM?: number;
|
||||
}
|
||||
|
||||
interface QueryFilter {
|
||||
[QueryConditions: string]: QueryFilterValue;
|
||||
}
|
||||
|
||||
interface QueryFilterValue {
|
||||
[name: string]: QueryValue;
|
||||
}
|
||||
|
||||
interface QueryObj {
|
||||
endpoint: string;
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
query: Query;
|
||||
OR: Query[];
|
||||
offset: number;
|
||||
limit: number;
|
||||
|
||||
addSortToQuery(
|
||||
query: QueryObj,
|
||||
direction: QuerySortDirections,
|
||||
column: string
|
||||
): void;
|
||||
addFilterToQuery(
|
||||
query: QueryObj,
|
||||
condition: QueryConditions,
|
||||
key: string,
|
||||
value: QueryValue
|
||||
): void;
|
||||
ascending(field: string): void;
|
||||
descending(field: string): void;
|
||||
equalTo(field: string, value: QueryValue): void;
|
||||
greaterThan(field: string, value: QueryValue): void;
|
||||
greaterThanEqualTo(field: string, value: QueryValue): void;
|
||||
lessThan(field: string, value: QueryValue): void;
|
||||
lessThanEqualTo(field: string, value: QueryValue): void;
|
||||
notEqualTo(field: string, value: QueryValue): void;
|
||||
matches(field: string, pattern: RegExp): void;
|
||||
or(query: QueryObj): void;
|
||||
setPage(pageSize: number, pageNum: number): void;
|
||||
fetch(callback: CbCallback): void;
|
||||
update(changes: object, callback: CbCallback): void;
|
||||
columns(columnsArray: string[]): void;
|
||||
remove(callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface ItemOptions extends CollectionOptionsWithID {}
|
||||
|
||||
interface Item {
|
||||
data: object;
|
||||
|
||||
save(callback: CbCallback): void;
|
||||
refresh(callback: CbCallback): void;
|
||||
destroy(callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface Code {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
callTimeout: number;
|
||||
|
||||
create(name: string, body: string, callback: CbCallback): void;
|
||||
update(name: string, body: string, callback: CbCallback): void;
|
||||
delete(name: string, callback: CbCallback): void;
|
||||
execute(name: string, params: object, callback: CbCallback): void;
|
||||
getCompletedServices(callback: CbCallback): void;
|
||||
getFailedServices(callback: CbCallback): void;
|
||||
getAllServices(callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface AppUser {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
endpoint: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
callTimeout: number;
|
||||
|
||||
getUser(callback: CbCallback): void;
|
||||
setUser(data: object, callback: CbCallback): void;
|
||||
allUsers(query: Query, callback: CbCallback): void;
|
||||
setPassword(
|
||||
old_password: string,
|
||||
new_password: string,
|
||||
callback: CbCallback
|
||||
): void;
|
||||
count(query: Query, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface Messaging {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
endpoint: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
callTimeout: number;
|
||||
client: Paho.MQTT.Client;
|
||||
|
||||
getMessageHistoryWithTimeFrame(
|
||||
topic: string,
|
||||
count: number,
|
||||
last: number,
|
||||
start: number,
|
||||
stop: number,
|
||||
callback: CbCallback
|
||||
): void;
|
||||
getMessageHistory(
|
||||
topic: string,
|
||||
last: number,
|
||||
count: number,
|
||||
callback: CbCallback
|
||||
): void;
|
||||
getAndDeleteMessageHistory(
|
||||
topic: string,
|
||||
count: number,
|
||||
last: number,
|
||||
start: number,
|
||||
stop: number,
|
||||
callback: CbCallback
|
||||
): void;
|
||||
currentTopics(callback: CbCallback): void;
|
||||
publish(topic: string, payload: object): void;
|
||||
publishREST(topic: string, payload: object, callback: CbCallback): void;
|
||||
subscribe(
|
||||
topic: string,
|
||||
options: MessagingSubscribeOptions,
|
||||
messageCallback: MessageCallback
|
||||
): void;
|
||||
unsubscribe(topic: string, options: MessagingSubscribeOptions): void;
|
||||
disconnect(): void;
|
||||
}
|
||||
|
||||
interface CommonMessagingProperties {
|
||||
cleanSession?: boolean;
|
||||
useSSL?: boolean;
|
||||
hosts?: string;
|
||||
ports?: string;
|
||||
onSuccess?: Function;
|
||||
onFailure?: Function;
|
||||
}
|
||||
|
||||
interface MessagingOptions extends CommonMessagingProperties {
|
||||
qos?: MessagingQOS;
|
||||
}
|
||||
|
||||
interface MessagingConfiguration extends CommonMessagingProperties {
|
||||
userName: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
type MessageCallback = (message: string) => void;
|
||||
|
||||
interface MessagingSubscribeOptions {
|
||||
qos?: MessagingQOS;
|
||||
invocationContext?: object;
|
||||
onSuccess?: Function;
|
||||
onFailure?: Function;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
interface MessagingStats {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
endpoint: string;
|
||||
systemKey: string;
|
||||
|
||||
getAveragePayloadSize(
|
||||
topic: string,
|
||||
start: number,
|
||||
stop: number,
|
||||
callback: CbCallback
|
||||
): void;
|
||||
getOpenConnections(callback: CbCallback): void;
|
||||
getCurrentSubscribers(topic: string, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface Edge {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
updateEdgeByName(name: string, object: object, callback: CbCallback): void;
|
||||
deleteEdgeByName(name: string, callback: CbCallback): void;
|
||||
create(newEdge: object, name: string, callback: CbCallback): void;
|
||||
columns(callback: CbCallback): void;
|
||||
count(query: Query, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface Metrics {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
|
||||
setQuery(query: Query): void;
|
||||
getStatistics(callback: CbCallback): void;
|
||||
getStatisticsHistory(callback: CbCallback): void;
|
||||
getDBConnections(callback: CbCallback): void;
|
||||
getLogs(callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface Device {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
getDeviceByName(name: string, callback: CbCallback): void;
|
||||
updateDeviceByName(
|
||||
name: string,
|
||||
object: object,
|
||||
trigger: boolean,
|
||||
callback: CbCallback
|
||||
): void;
|
||||
deleteDeviceByName(name: string, callback: CbCallback): void;
|
||||
fetch(query: Query, callback: CbCallback): void;
|
||||
update(
|
||||
query: Query,
|
||||
object: object,
|
||||
trigger: boolean,
|
||||
callback: CbCallback
|
||||
): void;
|
||||
delete(query: Query, callback: CbCallback): void;
|
||||
create(newDevice: object, callback: CbCallback): void;
|
||||
columns(callback: CbCallback): void;
|
||||
count(query: Query, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface Analytics {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
getStorage(filter: QueryFilter, callback: CbCallback): void;
|
||||
getCount(filter: QueryFilter, callback: CbCallback): void;
|
||||
getEventList(filter: QueryFilter, callback: CbCallback): void;
|
||||
getEventTotals(filter: QueryFilter, callback: CbCallback): void;
|
||||
getUserEvents(filter: QueryFilter, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface Portal {
|
||||
name: string;
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
fetch(callback: CbCallback): void;
|
||||
update(data: object, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface Triggers {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
fetchDefinitions(callback: CbCallback): void;
|
||||
create(name: string, data: object, callback: CbCallback): void;
|
||||
update(name: string, data: object, callback: CbCallback): void;
|
||||
delete(name: string, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
declare var ClearBlade: ClearBladeGlobal;
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES5",
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"clearbladejs-client-tests.ts",
|
||||
"global.d.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"**/clearbladejs-node/*",
|
||||
"**/clearbladejs-server/*"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"no-empty-interface": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
// Testing type definitions for clearbladejs-node 1.0
|
||||
// Project: https://github.com/ClearBlade/Node-SDK
|
||||
// Definitions by: Jim Bouquet <https://github.com/ClearBlade>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { ClearBlade, Resp, QuerySortDirections, QueryConditions } from ".";
|
||||
|
||||
// Sample code for clearbladejs Node SDK v1.0.0 used to test typescript definitions
|
||||
|
||||
const genericCallback = (error: boolean, response: Resp) => {};
|
||||
|
||||
///////////////////////////////////////
|
||||
// ClearBlade object API invocations
|
||||
///////////////////////////////////////
|
||||
ClearBlade.init({
|
||||
email: "a@a.com",
|
||||
password: "a",
|
||||
systemKey: "testkey",
|
||||
systemSecret: "testsecret",
|
||||
URI: "https://mycbplatform.com",
|
||||
messagingURI: "mycbplatform.com",
|
||||
callback: genericCallback
|
||||
});
|
||||
|
||||
ClearBlade.setUser("test@test.com", "password");
|
||||
ClearBlade.registerUser("test@test.com", "password", genericCallback);
|
||||
ClearBlade.isCurrentUserAuthenticated(genericCallback);
|
||||
if (!ClearBlade.isObjectEmpty({prop: "test"})) {
|
||||
ClearBlade.logger("Object is not empty");
|
||||
}
|
||||
|
||||
ClearBlade.validateEmailPassword("test@test.com", "password");
|
||||
|
||||
ClearBlade.logoutUser(genericCallback);
|
||||
ClearBlade.loginAnon(genericCallback);
|
||||
ClearBlade.loginUser("test@test.com", "password", genericCallback);
|
||||
|
||||
ClearBlade.sendPush([], {}, "appId: string", genericCallback);
|
||||
|
||||
// execute(error: Object, response: Object, callback: ClearBladeCallback): void;
|
||||
// makeKVPair(key: string, value: string): KeyValuePair;
|
||||
// request(options: RequestOptions, callback: RequestCallback): void;
|
||||
|
||||
const coll1 = ClearBlade.Collection("collectionID");
|
||||
const coll2 = ClearBlade.Collection({collectionName: "collectionName"});
|
||||
const coll3 = ClearBlade.Collection({collectionID: "collectionID"});
|
||||
|
||||
const query1 = ClearBlade.Query("collectionID");
|
||||
const query2 = ClearBlade.Query({offset: 5, limit: 5, collectionID: "collectionID"});
|
||||
const query3 = ClearBlade.Query({collectionName: "collectionName"});
|
||||
const query4 = ClearBlade.Query({collection: "collectionID"});
|
||||
|
||||
ClearBlade.addToQuery(query1, "key", "value");
|
||||
ClearBlade.addFilterToQuery(query1, QueryConditions.QUERY_GREATERTHAN, "key", "value");
|
||||
ClearBlade.addSortToQuery(query1, QuerySortDirections.QUERY_SORT_ASCENDING, "column1");
|
||||
|
||||
const opQueryStr = ClearBlade.parseOperationQuery(query1.query);
|
||||
const parse1: string = ClearBlade.parseQuery(query1.query);
|
||||
const parse2: string = ClearBlade.parseQuery(query1);
|
||||
|
||||
const item1 = ClearBlade.Item({}, "hello");
|
||||
const item2 = ClearBlade.Item({}, {collectionID: "hello"});
|
||||
|
||||
const code = ClearBlade.Code();
|
||||
const user = ClearBlade.User();
|
||||
|
||||
const messaging = ClearBlade.Messaging({}, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Collection API invocations
|
||||
///////////////////////////////////////
|
||||
coll1.fetch(query1, genericCallback);
|
||||
coll1.create(ClearBlade.Item({}, ""), genericCallback);
|
||||
coll1.update(query1.query, {}, genericCallback);
|
||||
coll1.remove(query1.query, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Query API invocations
|
||||
///////////////////////////////////////
|
||||
query1.ascending("string");
|
||||
query1.descending("string");
|
||||
query1.equalTo("string", "string");
|
||||
query1.greaterThan("string", 2);
|
||||
query1.greaterThanEqualTo("string", false);
|
||||
query1.lessThan("string", "string");
|
||||
query1.lessThanEqualTo("string", "string");
|
||||
query1.notEqualTo("string", "string");
|
||||
query1.or(query2);
|
||||
query1.setPage(1, 1);
|
||||
query1.fetch(genericCallback);
|
||||
query1.update({}, genericCallback);
|
||||
query1.remove(genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Item API invocations
|
||||
///////////////////////////////////////
|
||||
item1.save();
|
||||
item1.refresh();
|
||||
item1.destroy();
|
||||
|
||||
///////////////////////////////////////
|
||||
// Code API invocations
|
||||
///////////////////////////////////////
|
||||
code.execute("codeName", {}, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// User API invocations
|
||||
///////////////////////////////////////
|
||||
user.getUser(genericCallback);
|
||||
user.setUser({}, genericCallback);
|
||||
user.allUsers(query1.query, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Messaging API invocations
|
||||
///////////////////////////////////////
|
||||
messaging.getMessageHistory("topic: string", 5, 15, genericCallback);
|
||||
|
||||
messaging.publish("topic: string", {});
|
||||
|
||||
messaging.subscribe("my/topic", {}, messageReceivedCb);
|
||||
|
||||
function messageReceivedCb(message: string) {
|
||||
messaging.unsubscribe("my/topic");
|
||||
}
|
||||
Vendored
+249
@@ -0,0 +1,249 @@
|
||||
// Type definitions for clearbladejs-node 1.0
|
||||
// Project: https://github.com/ClearBlade/Node-SDK
|
||||
// Definitions by: Jim Bouquet <https://github.com/ClearBlade>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="request" />
|
||||
|
||||
import { Response, RequestCallback } from "request/index";
|
||||
// import {//PacketCallback } from "mqtt";
|
||||
|
||||
export enum MessagingQOS {
|
||||
MESSAGING_QOS_AT_MOST_ONCE = 0,
|
||||
MESSAGING_QOS_AT_LEAST_ONCE = 1,
|
||||
MESSAGING_QOS_EXACTLY_ONCE = 2
|
||||
}
|
||||
|
||||
export interface Resp {
|
||||
error(msg: any): never;
|
||||
success(msg: any): never;
|
||||
}
|
||||
|
||||
export interface InitOptions {
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
logging?: boolean;
|
||||
callback?: CbCallback;
|
||||
email?: string;
|
||||
password?: string;
|
||||
registerUser?: boolean;
|
||||
useUser?: APIUser;
|
||||
URI?: string;
|
||||
messagingURI?: string;
|
||||
messagingPort?: number;
|
||||
defaultQoS?: MessagingQOS;
|
||||
callTimeout?: number;
|
||||
}
|
||||
|
||||
export interface RequestOptions {
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
method?: string;
|
||||
endpoint?: string;
|
||||
body?: string;
|
||||
qs?: string;
|
||||
URI?: string;
|
||||
useUser?: boolean;
|
||||
authToken?: string;
|
||||
user?: APIUser;
|
||||
}
|
||||
|
||||
export interface APIUser {
|
||||
email: string;
|
||||
authToken: string;
|
||||
}
|
||||
|
||||
export interface KeyValuePair {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export type CbCallback = (error: boolean, response: Resp) => void;
|
||||
|
||||
export default interface ClearBladeGlobal extends ClearBladeInt {
|
||||
isCurrentUserAuthenticated(callback: CbCallback): void;
|
||||
}
|
||||
|
||||
export interface ClearBladeInt {
|
||||
addToQuery(queryObj: QueryObj, key: string, value: string): void;
|
||||
addFilterToQuery(queryObj: QueryObj, condition: QueryConditions, key: string, value: QueryValue): void;
|
||||
addSortToQuery(queryObj: QueryObj, direction: QuerySortDirections, column: string): void;
|
||||
Code(): Code;
|
||||
Collection(options: string | CollectionOptionsWithName | CollectionOptionsWithID): Collection;
|
||||
execute(error: object, response: object, callback: CbCallback): void;
|
||||
init(options: InitOptions): void;
|
||||
isObjectEmpty(obj: object): boolean;
|
||||
Item(data: object, options: string | ItemOptions): Item;
|
||||
logger(message: string): void;
|
||||
loginAnon(callback: CbCallback): void;
|
||||
loginUser(email: string, password: string, callback: CbCallback): void;
|
||||
logoutUser(callback: CbCallback): void;
|
||||
makeKVPair(key: string, value: string): KeyValuePair;
|
||||
parseOperationQuery(query: Query): string;
|
||||
parseQuery(query: Query | QueryObj): string;
|
||||
Query(options: string | QueryOptionsWithCollection | QueryOptionsWithName | QueryOptionsWithID): QueryObj;
|
||||
registerUser(email: string, password: string, callback: CbCallback): void;
|
||||
request(options: RequestOptions, callback: RequestCallback): void;
|
||||
setUser(email: string, password: string): void;
|
||||
User(): AppUser;
|
||||
Messaging(options: MessagingOptions, callback: CbCallback): Messaging;
|
||||
sendPush(users: string[], payload: object, appId: string, callback: CbCallback): void;
|
||||
validateEmailPassword(email: string, password: string): void;
|
||||
}
|
||||
|
||||
export interface CollectionOptionsWithName {
|
||||
collectionName: string;
|
||||
}
|
||||
|
||||
export interface CollectionOptionsWithID {
|
||||
collectionID: string;
|
||||
}
|
||||
|
||||
export interface Collection {
|
||||
endpoint: string;
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
fetch(query: QueryObj, callback: CbCallback): void;
|
||||
create(newItem: Item, callback: CbCallback): void;
|
||||
update(query: Query, changes: object, callback: CbCallback): void;
|
||||
remove(query: Query, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
export enum QuerySortDirections {
|
||||
QUERY_SORT_ASCENDING = 'ASC',
|
||||
QUERY_SORT_DESCENDING = 'DESC'
|
||||
}
|
||||
|
||||
export enum QueryConditions {
|
||||
QUERY_EQUAL = 'EQ',
|
||||
QUERY_NOTEQUAL = 'NEQ',
|
||||
QUERY_GREATERTHAN = 'GT',
|
||||
QUERY_GREATERTHAN_EQUAL = 'GTE',
|
||||
QUERY_LESSTHAN = 'LT',
|
||||
QUERY_LESSTHAN_EQUAL = 'LTE',
|
||||
QUERY_MATCHES = 'RE'
|
||||
}
|
||||
|
||||
export type QueryValue = string|number|boolean;
|
||||
|
||||
export interface QueryOptions {
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface QueryOptionsWithCollection extends QueryOptions {
|
||||
collection: string;
|
||||
}
|
||||
|
||||
export interface QueryOptionsWithName extends CollectionOptionsWithName, QueryOptions {}
|
||||
|
||||
export interface QueryOptionsWithID extends CollectionOptionsWithID, QueryOptions {}
|
||||
|
||||
export interface Query {
|
||||
SELECTCOLUMNS?: string[];
|
||||
SORT?: QuerySortDirections;
|
||||
FILTERS?: QueryFilter[];
|
||||
PAGESIZE?: number;
|
||||
PAGENUM?: number;
|
||||
}
|
||||
|
||||
export interface QueryFilter {
|
||||
[QueryConditions: string]: QueryFilterValue;
|
||||
}
|
||||
|
||||
export interface QueryFilterValue {
|
||||
[name: string]: QueryValue;
|
||||
}
|
||||
|
||||
export interface QueryObj {
|
||||
endpoint: string;
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
query: Query;
|
||||
OR: Query[];
|
||||
offset: number;
|
||||
limit: number;
|
||||
|
||||
ascending(field: string): Query;
|
||||
descending(field: string): Query;
|
||||
equalTo(field: string, value: QueryValue): Query;
|
||||
greaterThan(field: string, value: QueryValue): Query;
|
||||
greaterThanEqualTo(field: string, value: QueryValue): Query;
|
||||
lessThan(field: string, value: QueryValue): Query;
|
||||
lessThanEqualTo(field: string, value: QueryValue): Query;
|
||||
notEqualTo(field: string, value: QueryValue): Query;
|
||||
matches(field: string, pattern: string): Query;
|
||||
or(query: QueryObj): Query;
|
||||
setPage(pageSize: number, pageNum: number): Query;
|
||||
fetch(callback: CbCallback): void;
|
||||
update(changes: object, callback: CbCallback): void;
|
||||
remove(callback: CbCallback): void;
|
||||
}
|
||||
|
||||
export interface ItemOptions extends CollectionOptionsWithID {}
|
||||
|
||||
export interface Item {
|
||||
data: object;
|
||||
|
||||
save(): void;
|
||||
refresh(): void;
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
export interface Code {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
callTimeout: number;
|
||||
URIPrefix: string;
|
||||
|
||||
execute(name: string, params: object, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
export interface AppUser {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
getUser(callback: CbCallback): void;
|
||||
setUser(data: object, callback: CbCallback): void;
|
||||
allUsers(query: Query, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
export interface Messaging {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
client: object;
|
||||
|
||||
getMessageHistory(topic: string, startTime: number, count: number, callback: CbCallback): void;
|
||||
publish(topic: string, payload: object): void;
|
||||
subscribe(topic: string, options: MessagingSubscribeOptions, messageCallback: MessageCallback): void;
|
||||
unsubscribe(topic: string, callback?: (error?: Error, packet?: object) => any): void;
|
||||
}
|
||||
|
||||
export interface CommonMessagingProperties {
|
||||
hosts?: string;
|
||||
ports?: string;
|
||||
}
|
||||
|
||||
export interface MessagingOptions extends CommonMessagingProperties {
|
||||
qos?: MessagingQOS;
|
||||
}
|
||||
|
||||
export interface MessagingSubscribeOptions {
|
||||
qos?: MessagingQOS;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
export type MessageCallback = (message: string) => void;
|
||||
|
||||
export let ClearBlade: ClearBladeGlobal;
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "ES5",
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"clearbladejs-node-tests.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"**/clearbladejs-client/*",
|
||||
"**/clearbladejs-server/*"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-empty-interface": false,
|
||||
"no-relative-import-in-test": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
// Testing type definitions for clearbladejs-server 1.0
|
||||
// Project: https://github.com/ClearBlade/JavaScript-API
|
||||
// Definitions by: Jim Bouquet <https://github.com/ClearBlade>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
const genericCallback = (error: boolean, response: Resp) => {};
|
||||
|
||||
///////////////////////////////////////
|
||||
// ClearBlade object API invocations
|
||||
///////////////////////////////////////
|
||||
ClearBlade.init({
|
||||
systemKey: "abcdef",
|
||||
systemSecret: "abcdefg",
|
||||
callback: genericCallback
|
||||
});
|
||||
|
||||
ClearBlade.init({request: {
|
||||
isLogging: false,
|
||||
params: {
|
||||
param1: "1",
|
||||
param2: 2
|
||||
},
|
||||
systemKey: "abcdef",
|
||||
systemSecret: "abcdef",
|
||||
userEmail: "test@test.com",
|
||||
userToken: "abcdef",
|
||||
userid: "abcdef",
|
||||
}});
|
||||
|
||||
const about = ClearBlade.about();
|
||||
ClearBlade.setUser("test@test.com", "authtoken", "userId");
|
||||
ClearBlade.registerUser("test@test.com", "password", genericCallback);
|
||||
ClearBlade.isCurrentUserAuthenticated(genericCallback);
|
||||
ClearBlade.logoutUser(genericCallback);
|
||||
ClearBlade.loginAnon(genericCallback);
|
||||
ClearBlade.loginUser("test@test.com", "password", genericCallback);
|
||||
|
||||
ClearBlade.getAllCollections(genericCallback);
|
||||
const edgeID = ClearBlade.edgeId();
|
||||
const isEdge = ClearBlade.isEdge(genericCallback);
|
||||
if (ClearBlade.isObjectEmpty({test: "test"})) {
|
||||
ClearBlade.logger("Object is empty");
|
||||
}
|
||||
const kvPair = ClearBlade.makeKVPair("key", "value");
|
||||
|
||||
const coll1 = ClearBlade.Collection("collectionID");
|
||||
const coll2 = ClearBlade.Collection({ collectionName: "collectionName" });
|
||||
const coll3 = ClearBlade.Collection({ collectionID: "collectionID" });
|
||||
const coll4 = ClearBlade.Collection({ collection: "collectionID" });
|
||||
|
||||
const query1 = ClearBlade.Query({ collectionID: "collectionID" });
|
||||
const query2 = ClearBlade.Query({ collectionName: "collectionName" });
|
||||
const query3 = ClearBlade.Query({ collection: "collectionID" });
|
||||
|
||||
const item1 = ClearBlade.Item({}, "collectionID");
|
||||
const item2 = ClearBlade.Item({}, { collectionID: "collectionID" });
|
||||
|
||||
const code = ClearBlade.Code();
|
||||
const deployment = ClearBlade.Deployment();
|
||||
const user = ClearBlade.User();
|
||||
|
||||
const messaging = ClearBlade.Messaging({}, genericCallback);
|
||||
|
||||
const device = ClearBlade.Device();
|
||||
|
||||
ClearBlade.addToQuery(query1, "key", "value");
|
||||
ClearBlade.addSortToQuery(
|
||||
query1,
|
||||
QuerySortDirections.QUERY_SORT_ASCENDING,
|
||||
"column1"
|
||||
);
|
||||
ClearBlade.addFilterToQuery(
|
||||
query1,
|
||||
QueryConditions.QUERY_GREATERTHAN,
|
||||
"key",
|
||||
"value"
|
||||
);
|
||||
|
||||
ClearBlade.newCollection("collectionName", genericCallback);
|
||||
|
||||
const parseOperation = ClearBlade.parseOperationQuery(query1.query);
|
||||
const parseQuery1 = ClearBlade.parseQuery(query1);
|
||||
const parseQuery2 = ClearBlade.parseQuery(query1.query);
|
||||
|
||||
ClearBlade.createDevice("devicename", {type: "devicetype"}, false, genericCallback);
|
||||
ClearBlade.deleteDevice("devicename", true, genericCallback);
|
||||
ClearBlade.updateDevice("devicename", {type: "devicetype"}, true, genericCallback);
|
||||
ClearBlade.getDeviceByName("devicename", genericCallback);
|
||||
ClearBlade.getAllDevicesForSystem(genericCallback);
|
||||
ClearBlade.validateEmailPassword("test@test.com", "password");
|
||||
|
||||
///////////////////////////////////////
|
||||
// Collection API invocations
|
||||
///////////////////////////////////////
|
||||
coll1.addColumn({name: "column1"}, genericCallback);
|
||||
coll1.dropColumn("column1", genericCallback);
|
||||
coll1.deleteCollection(genericCallback);
|
||||
coll1.fetch(query1.query, genericCallback);
|
||||
coll1.create(ClearBlade.Item({}, ""), genericCallback);
|
||||
coll1.update(query1.query, {}, genericCallback);
|
||||
coll1.remove(query1.query, genericCallback);
|
||||
coll1.columns(genericCallback);
|
||||
coll1.count(query1.query, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Query API invocations
|
||||
///////////////////////////////////////
|
||||
query2.ascending("string");
|
||||
query1.descending("string");
|
||||
query1.equalTo("string", "string");
|
||||
query1.greaterThan("string", 2);
|
||||
query1.greaterThanEqualTo("string", false);
|
||||
query1.lessThan("string", "string");
|
||||
query1.lessThanEqualTo("string", "string");
|
||||
query1.notEqualTo("string", "string");
|
||||
query1.matches("string", ".*");
|
||||
query1.or(query2);
|
||||
query1.setPage(1, 1);
|
||||
query1.fetch(genericCallback);
|
||||
query1.update({}, genericCallback);
|
||||
query1.columns([]);
|
||||
query1.remove(genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Item API invocations
|
||||
///////////////////////////////////////
|
||||
item1.save();
|
||||
item1.refresh();
|
||||
item1.destroy();
|
||||
|
||||
///////////////////////////////////////
|
||||
// Code API invocations
|
||||
///////////////////////////////////////
|
||||
code.execute("codeName", {}, true, genericCallback);
|
||||
code.getAllServices(genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Deployment API invocations
|
||||
///////////////////////////////////////
|
||||
deployment.create("deploymentname", "deployment description", {}, genericCallback);
|
||||
deployment.update("deploymentname", {}, genericCallback);
|
||||
deployment.delete("deploymentname", genericCallback);
|
||||
deployment.read("deploymentname", genericCallback);
|
||||
deployment.readAll(query1, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// User API invocations
|
||||
///////////////////////////////////////
|
||||
user.getUser(genericCallback);
|
||||
user.setUser({}, genericCallback);
|
||||
user.setUsers(query2, {name: "Fred"}, genericCallback);
|
||||
user.allUsers(query1, genericCallback);
|
||||
user.count(query1, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Messaging API invocations
|
||||
///////////////////////////////////////
|
||||
messaging.getMessageHistoryWithTimeFrame("topic", 5, 10, 15, 20, genericCallback);
|
||||
messaging.getMessageHistory("topic", 5, 15, genericCallback);
|
||||
messaging.getAndDeleteMessageHistory("topic", 5, 10, 1, 20, genericCallback);
|
||||
messaging.getCurrentTopics(genericCallback);
|
||||
messaging.publish("topic", "payload");
|
||||
|
||||
///////////////////////////////////////
|
||||
// Device API invocations
|
||||
///////////////////////////////////////
|
||||
device.fetch(query1.query, genericCallback);
|
||||
device.update(query1.query, { object: Object }, genericCallback);
|
||||
device.delete(query1.query, genericCallback);
|
||||
device.create({ newDevice: Object }, genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Triggers API invocations
|
||||
///////////////////////////////////////
|
||||
ClearBlade.Trigger.Create(
|
||||
"triggername",
|
||||
{
|
||||
system_key: "key",
|
||||
name: "triggername",
|
||||
def_module: TriggerModule.DEVICE,
|
||||
def_name: "someName",
|
||||
key_value_pairs: [],
|
||||
service_name: "ServiceName"
|
||||
},
|
||||
genericCallback);
|
||||
ClearBlade.Trigger.Fetch("triggername", genericCallback);
|
||||
|
||||
///////////////////////////////////////
|
||||
// Timers API invocations
|
||||
///////////////////////////////////////
|
||||
ClearBlade.Timer.Create("timername", {}, genericCallback);
|
||||
ClearBlade.Timer.Fetch("timername", genericCallback);
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
declare global {
|
||||
var ClearBlade: ClearBladeGlobal;
|
||||
}
|
||||
|
||||
export {};
|
||||
Vendored
+335
@@ -0,0 +1,335 @@
|
||||
// Type definitions for clearbladejs-server 1.0
|
||||
// Project: https://docs.clearblade.com/v/3/4-developer_reference/platformsdk/ClearBlade.js/
|
||||
// Definitions by: Jim Bouquet <https://github.com/ClearBlade>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="paho-mqtt" />
|
||||
|
||||
interface BasicReq {
|
||||
readonly isLogging: boolean;
|
||||
readonly params: {
|
||||
[id: string]: any;
|
||||
};
|
||||
readonly systemKey: string;
|
||||
readonly systemSecret: string;
|
||||
readonly userEmail: string;
|
||||
readonly userToken: string;
|
||||
readonly userid: string;
|
||||
}
|
||||
type ReqTypes = BasicReq;
|
||||
declare var req: ReqTypes;
|
||||
interface Resp {
|
||||
error(msg: any): never;
|
||||
success(msg: any): never;
|
||||
}
|
||||
declare var resp: Resp;
|
||||
|
||||
declare enum MessagingQOS {
|
||||
MESSAGING_QOS_AT_MOST_ONCE = 0,
|
||||
MESSAGING_QOS_AT_LEAST_ONCE = 1,
|
||||
MESSAGING_QOS_EXACTLY_ONCE = 2
|
||||
}
|
||||
|
||||
interface InitOptions {
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
logging?: boolean;
|
||||
callback?: CbCallback;
|
||||
authToken?: string;
|
||||
userToken?: string;
|
||||
email?: string;
|
||||
password?: string;
|
||||
registerUser?: boolean;
|
||||
useUser?: APIUser;
|
||||
URI?: string;
|
||||
messagingURI?: string;
|
||||
messagingPort?: number;
|
||||
defaultQoS?: MessagingQOS;
|
||||
callTimeout?: number;
|
||||
}
|
||||
|
||||
interface APIUser {
|
||||
email: string;
|
||||
authToken: string;
|
||||
user_id?: string;
|
||||
}
|
||||
|
||||
interface KeyValuePair {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
type CbCallback = (error: boolean, response: Resp) => void;
|
||||
|
||||
interface ClearBladeGlobal extends ClearBladeInt {
|
||||
user: APIUser;
|
||||
}
|
||||
|
||||
interface ClearBladeInt {
|
||||
Trigger: TriggerClass;
|
||||
Timer: TimerClass;
|
||||
|
||||
about(): string;
|
||||
addToQuery(queryObj: QueryObj, key: string, value: string): void;
|
||||
addFilterToQuery(queryObj: QueryObj, condition: QueryConditions, key: string, value: QueryValue): void;
|
||||
addSortToQuery(queryObj: QueryObj, direction: QuerySortDirections, column: string): void;
|
||||
Code(): Code;
|
||||
Collection(options: string | CollectionOptionsWithName | CollectionOptionsWithID | CollectionOptionsWithCollection): Collection;
|
||||
Deployment(): Deployment;
|
||||
Device(): Device;
|
||||
edgeId(): string;
|
||||
execute(error: object, response: object, callback: CbCallback): any;
|
||||
getAllCollections(callback: CbCallback): void;
|
||||
http(): object;
|
||||
init(options: InitOptions | {request: BasicReq}): void;
|
||||
isEdge(callback: CbCallback): boolean;
|
||||
isCurrentUserAuthenticated(callback: CbCallback): void;
|
||||
isObjectEmpty(obj: object): boolean;
|
||||
Item(data: object, options: string | ItemOptions): Item;
|
||||
logger(message: string): void;
|
||||
loginAnon(callback: CbCallback): void;
|
||||
loginUser(email: string, password: string, callback: CbCallback): void;
|
||||
logoutUser(callback: CbCallback): void;
|
||||
makeKVPair(key: string, value: string): KeyValuePair;
|
||||
Messaging(options: MessagingOptions, callback: CbCallback): Messaging;
|
||||
newCollection(name: string, callback: CbCallback): void;
|
||||
Query(options: QueryOptionsWithCollection | QueryOptionsWithName | QueryOptionsWithID): QueryObj;
|
||||
parseOperationQuery(query: Query): string;
|
||||
parseQuery(query: Query | QueryObj): string;
|
||||
registerUser(email: string, password: string, callback: CbCallback): void;
|
||||
setUser(email: string, authToken: string, userId: string): void;
|
||||
User(): AppUser;
|
||||
|
||||
createDevice(name: string, data: object, causeTrigger: boolean, callback: CbCallback): void;
|
||||
deleteDevice(name: string, causeTrigger: boolean, callback: CbCallback): void;
|
||||
updateDevice(name: string, data: object, causeTrigger: boolean, callback: CbCallback): void;
|
||||
getDeviceByName(name: string, callback: CbCallback): void;
|
||||
getAllDevicesForSystem(callback: CbCallback): void;
|
||||
validateEmailPassword(email: string, password: string): void;
|
||||
}
|
||||
|
||||
interface CollectionOptionsWithCollection {
|
||||
collection: string;
|
||||
}
|
||||
|
||||
interface CollectionOptionsWithName {
|
||||
collectionName: string;
|
||||
}
|
||||
|
||||
interface CollectionOptionsWithID {
|
||||
collectionID: string;
|
||||
}
|
||||
|
||||
interface Collection {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
addColumn(options: object, callback: CbCallback): void;
|
||||
dropColumn(name: string, callback: CbCallback): void;
|
||||
deleteCollection(callback: CbCallback): void;
|
||||
fetch(query: Query, callback: CbCallback): void;
|
||||
create(newItem: Item, callback: CbCallback): void;
|
||||
update(query: Query, changes: object, callback: CbCallback): void;
|
||||
remove(query: Query, callback: CbCallback): void;
|
||||
columns(callback: CbCallback): void;
|
||||
count(query: Query, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
declare enum QuerySortDirections {
|
||||
QUERY_SORT_ASCENDING = 'ASC',
|
||||
QUERY_SORT_DESCENDING = 'DESC'
|
||||
}
|
||||
|
||||
declare enum QueryConditions {
|
||||
QUERY_EQUAL = 'EQ',
|
||||
QUERY_NOTEQUAL = 'NEQ',
|
||||
QUERY_GREATERTHAN = 'GT',
|
||||
QUERY_GREATERTHAN_EQUAL = 'GTE',
|
||||
QUERY_LESSTHAN = 'LT',
|
||||
QUERY_LESSTHAN_EQUAL = 'LTE',
|
||||
QUERY_MATCHES = 'RE'
|
||||
}
|
||||
|
||||
type QueryValue = string|number|boolean;
|
||||
|
||||
interface QueryOptions {
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
interface QueryOptionsWithCollection extends CollectionOptionsWithCollection, QueryOptions {}
|
||||
|
||||
interface QueryOptionsWithName extends CollectionOptionsWithName, QueryOptions {}
|
||||
|
||||
interface QueryOptionsWithID extends CollectionOptionsWithID, QueryOptions {}
|
||||
|
||||
interface Query {
|
||||
SELECTCOLUMNS?: string[];
|
||||
SORT?: QuerySortDirections;
|
||||
FILTERS?: QueryFilter[];
|
||||
PAGESIZE?: number;
|
||||
PAGENUM?: number;
|
||||
}
|
||||
|
||||
interface QueryFilter {
|
||||
[QueryConditions: string]: QueryFilterValue;
|
||||
}
|
||||
|
||||
interface QueryFilterValue {
|
||||
[name: string]: QueryValue;
|
||||
}
|
||||
|
||||
interface QueryObj {
|
||||
id: string;
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
query: Query;
|
||||
OR: Query[];
|
||||
offset: number;
|
||||
limit: number;
|
||||
|
||||
ascending(field: string): void;
|
||||
descending(field: string): void;
|
||||
equalTo(field: string, value: QueryValue): void;
|
||||
greaterThan(field: string, value: QueryValue): void;
|
||||
greaterThanEqualTo(field: string, value: QueryValue): void;
|
||||
lessThan(field: string, value: QueryValue): void;
|
||||
lessThanEqualTo(field: string, value: QueryValue): void;
|
||||
notEqualTo(field: string, value: QueryValue): void;
|
||||
matches(field: string, pattern: QueryValue): void;
|
||||
or(query: QueryObj): void;
|
||||
setPage(pageSize: number, pageNum: number): void;
|
||||
fetch(callback: CbCallback): void;
|
||||
update(changes: object, callback: CbCallback): void;
|
||||
columns(columnsArray: string[]): void;
|
||||
remove(callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface ItemOptions extends CollectionOptionsWithID {}
|
||||
|
||||
interface Item {
|
||||
data: object;
|
||||
|
||||
save(): void;
|
||||
refresh(): void;
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
interface Code {
|
||||
user: APIUser;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
execute(name: string, params: object, loggingEnabled: boolean, callback: CbCallback): void;
|
||||
getAllServices(callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface DeploymentOptions {}
|
||||
|
||||
interface Deployment {
|
||||
user: APIUser;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
create(name: string, description: string, options: DeploymentOptions, callback: CbCallback): void;
|
||||
update(name: string, options: DeploymentOptions, callback: CbCallback): void;
|
||||
delete(name: string, callback: CbCallback): void;
|
||||
read(name: string, callback: CbCallback): void;
|
||||
readAll(query: QueryObj, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface AppUser {
|
||||
user: APIUser;
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
getUser(callback: CbCallback): void;
|
||||
setUser(data: object, callback: CbCallback): void;
|
||||
setUsers(query: QueryObj, data: object, callback: CbCallback): void;
|
||||
allUsers(query: QueryObj, callback: CbCallback): void;
|
||||
count(query: QueryObj, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface Messaging {
|
||||
user: APIUser;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
getMessageHistoryWithTimeFrame(topic: string, count: number, last: number, start: number, stop: number, callback: CbCallback): void;
|
||||
getMessageHistory(topic: string, start: number, count: number, callback: CbCallback): void;
|
||||
getAndDeleteMessageHistory(topic: string, count: number, last: number, start: number, stop: number, callback: CbCallback): void;
|
||||
getCurrentTopics(callback: CbCallback): void;
|
||||
publish(topic: string, payload: string | ArrayBuffer): void;
|
||||
}
|
||||
|
||||
interface MessagingOptions {}
|
||||
|
||||
interface Device {
|
||||
URI: string;
|
||||
systemKey: string;
|
||||
systemSecret: string;
|
||||
|
||||
fetch(query: Query, callback: CbCallback): void;
|
||||
update(query: Query, changes: object, callback: CbCallback): void;
|
||||
delete(query: Query, callback: CbCallback): void;
|
||||
create(newDevice: object, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
declare enum TriggerModule {
|
||||
DEVICE = "Device",
|
||||
Data = "Data",
|
||||
MESSAGING = "Messaging",
|
||||
USER = "User"
|
||||
}
|
||||
|
||||
interface TriggerCreateOptions {
|
||||
system_key: string;
|
||||
name: string;
|
||||
def_module: TriggerModule;
|
||||
def_name: string;
|
||||
key_value_pairs: KeyValuePair[];
|
||||
service_name: string;
|
||||
}
|
||||
|
||||
interface TriggerClass {
|
||||
Create(name: string, options: TriggerCreateOptions, callback: CbCallback): void;
|
||||
Fetch(name: string, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface TimerCreateOptions {
|
||||
description?: string;
|
||||
start_time?: Date;
|
||||
repeats?: number;
|
||||
frequency?: number;
|
||||
service_name?: string;
|
||||
user_id?: string;
|
||||
user_token?: string;
|
||||
}
|
||||
|
||||
interface TimerClass {
|
||||
Create(name: string, options: TimerCreateOptions, callback: CbCallback): void;
|
||||
Fetch(name: string, callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface TriggerInstance {
|
||||
name: string;
|
||||
systemKey: string;
|
||||
|
||||
Update(options: object, callback: CbCallback): void;
|
||||
Delete(callback: CbCallback): void;
|
||||
}
|
||||
|
||||
interface TimerInstance {
|
||||
name: string;
|
||||
systemKey: string;
|
||||
|
||||
Update(options: object, callback: CbCallback): void;
|
||||
Delete(callback: CbCallback): void;
|
||||
}
|
||||
|
||||
declare var ClearBlade: ClearBladeGlobal;
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES5",
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"clearbladejs-server-tests.ts",
|
||||
"global.d.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"**/clearbladejs-client/*",
|
||||
"**/clearbladejs-node/*"
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO
|
||||
"no-any-union": false
|
||||
"no-empty-interface": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import clm from "clmtrackr";
|
||||
|
||||
const ctracker = new clm.tracker();
|
||||
|
||||
console.log(clm.version);
|
||||
|
||||
ctracker.init({
|
||||
constantVelocity: true,
|
||||
searchWindow: 11,
|
||||
useWebGL: true,
|
||||
scoreThreshold: 0.50,
|
||||
stopOnConvergence: false,
|
||||
/** object with parameters for facedetection : */
|
||||
faceDetection: { useWebWorkers: true}
|
||||
});
|
||||
|
||||
const video = document.getElementsByTagName("video")[0];
|
||||
ctracker.start(video);
|
||||
const positions = ctracker.getCurrentPosition();
|
||||
if (positions) {
|
||||
const canvas = document.getElementsByTagName("canvas")[0];
|
||||
ctracker.draw(canvas);
|
||||
positions.forEach(([x, y]) => {
|
||||
const sum: number = x + y;
|
||||
});
|
||||
}
|
||||
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
// Type definitions for clmtrackr 1.1
|
||||
// Project: https://github.com/auduno/clmtrackr
|
||||
// Definitions by: hellochar <https://github.com/hellochar>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface TrackerParams {
|
||||
/** whether to use constant velocity model when fitting (default is true) */
|
||||
constantVelocity?: boolean;
|
||||
/** the size of the searchwindow around each point (default is 11) */
|
||||
searchWindow?: number;
|
||||
/** whether to use webGL if it is available (default is true) */
|
||||
useWebGL?: boolean;
|
||||
/** threshold for when to assume we've lost tracking (default is 0.50) */
|
||||
scoreThreshold?: number;
|
||||
/** whether to stop tracking when the fitting has converged (default is false) */
|
||||
stopOnConvergence?: boolean;
|
||||
/** object with parameters for facedetection : */
|
||||
faceDetection?: {
|
||||
/** whether to use web workers for face detection (default is true) */
|
||||
useWebWorkers?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
type IPosition = [number, number];
|
||||
|
||||
type Model = any;
|
||||
|
||||
declare namespace _default {
|
||||
class tracker {
|
||||
constructor(params?: TrackerParams);
|
||||
|
||||
init(model?: Model): void;
|
||||
|
||||
start(element: HTMLVideoElement | HTMLCanvasElement): void;
|
||||
|
||||
track(element: HTMLVideoElement | HTMLCanvasElement): IPosition[] | false;
|
||||
|
||||
reset(): void;
|
||||
|
||||
getConvergence(): number;
|
||||
|
||||
getCurrentParameters(): number[];
|
||||
|
||||
getCurrentPosition(): IPosition[] | false;
|
||||
|
||||
getScore(): number;
|
||||
|
||||
draw(canvas: HTMLCanvasElement): void;
|
||||
|
||||
setResponseMode(type: "single" | "cycle" | "blend", list: Array<"raw" | "sobel" | "lbp">): void;
|
||||
}
|
||||
const version: string;
|
||||
}
|
||||
|
||||
export default _default;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"clmtrackr-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+2
-2
@@ -13,9 +13,9 @@ interface Emitter {
|
||||
hasListeners(event: string): boolean;
|
||||
}
|
||||
|
||||
declare const constructor: {
|
||||
declare const Emitter: {
|
||||
(obj?: any): Emitter;
|
||||
new (obj?: any): Emitter;
|
||||
};
|
||||
|
||||
export = constructor;
|
||||
export = Emitter;
|
||||
|
||||
@@ -4,13 +4,23 @@ import connect = require("connect");
|
||||
const app = connect();
|
||||
|
||||
// log all requests
|
||||
app.use((req: http.IncomingMessage, res: http.ServerResponse, next: Function) => {
|
||||
app.use((req: http.IncomingMessage, res: http.ServerResponse, next: connect.NextFunction) => {
|
||||
console.log(req, res);
|
||||
next();
|
||||
});
|
||||
|
||||
// "Throw" an Error
|
||||
app.use((req: http.IncomingMessage, res: http.ServerResponse, next: connect.NextFunction) => {
|
||||
next(new Error("Something went wrong!"));
|
||||
});
|
||||
|
||||
// "Throw" a number
|
||||
app.use((req: http.IncomingMessage, res: http.ServerResponse, next: connect.NextFunction) => {
|
||||
next(404);
|
||||
});
|
||||
|
||||
// Stop on errors
|
||||
app.use((err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => {
|
||||
app.use((err: any, req: http.IncomingMessage, res: http.ServerResponse, next: connect.NextFunction) => {
|
||||
if (err) {
|
||||
return res.end(`Error: ${err}`);
|
||||
}
|
||||
@@ -18,6 +28,11 @@ app.use((err: Error, req: http.IncomingMessage, res: http.ServerResponse, next:
|
||||
next();
|
||||
});
|
||||
|
||||
// Use legacy `Function` for `next` parameter.
|
||||
app.use((req: http.IncomingMessage, res: http.ServerResponse, next: Function) => {
|
||||
next();
|
||||
});
|
||||
|
||||
// respond to all requests
|
||||
app.use((req: http.IncomingMessage, res: http.ServerResponse) => {
|
||||
res.end("Hello from Connect!\n");
|
||||
|
||||
Vendored
+5
-2
@@ -1,6 +1,7 @@
|
||||
// Type definitions for connect v3.4.0
|
||||
// Project: https://github.com/senchalabs/connect
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
|
||||
// Evan Hahn <https://github.com/EvanHahn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -17,9 +18,11 @@ declare function createServer(): createServer.Server;
|
||||
declare namespace createServer {
|
||||
export type ServerHandle = HandleFunction | http.Server;
|
||||
|
||||
type NextFunction = (err?: any) => void;
|
||||
|
||||
export type SimpleHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse) => void;
|
||||
export type NextHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
|
||||
export type ErrorHandleFunction = (err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
|
||||
export type NextHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse, next: NextFunction) => void;
|
||||
export type ErrorHandleFunction = (err: any, req: http.IncomingMessage, res: http.ServerResponse, next: NextFunction) => void;
|
||||
export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
|
||||
|
||||
export interface ServerStackItem {
|
||||
|
||||
@@ -11,7 +11,7 @@ interface State {
|
||||
bar: number;
|
||||
}
|
||||
|
||||
const props: Props & React.ClassAttributes<{}> = {
|
||||
const props: Props = {
|
||||
foo: "foo"
|
||||
};
|
||||
|
||||
|
||||
Vendored
+6
-1
@@ -95,7 +95,7 @@ export namespace pickle {
|
||||
locations: Location[];
|
||||
name: string;
|
||||
steps: Step[];
|
||||
tags: string[];
|
||||
tags: Tag[];
|
||||
}
|
||||
|
||||
interface Location {
|
||||
@@ -117,6 +117,11 @@ export namespace pickle {
|
||||
location: Location;
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface Tag {
|
||||
name: string;
|
||||
location: Location;
|
||||
}
|
||||
}
|
||||
|
||||
export type HookCode = (this: World, scenario: HookScenarioResult, callback?: CallbackStepDefinition) => void;
|
||||
|
||||
Vendored
+3
-3
@@ -8,7 +8,7 @@
|
||||
//
|
||||
// Translation from Objects in help to Typescript interface.
|
||||
// http://js.cytoscape.org/#notation/functions
|
||||
//
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/**
|
||||
* cy --> Cy.Core
|
||||
@@ -3145,7 +3145,7 @@ declare namespace cytoscape {
|
||||
/**
|
||||
* http://js.cytoscape.org/#style/node-body
|
||||
*/
|
||||
interface Node extends PaddingNode {
|
||||
interface Node extends Partial<Overlay>, PaddingNode {
|
||||
"label"?: string;
|
||||
/**
|
||||
* The width of the node’s body.
|
||||
@@ -3320,7 +3320,7 @@ declare namespace cytoscape {
|
||||
"pie-i-background-opacity": number;
|
||||
}
|
||||
|
||||
interface Edge extends EdgeLine, EdgeArror { }
|
||||
interface Edge extends EdgeLine, EdgeArror, Partial<Overlay> { }
|
||||
|
||||
/**
|
||||
* These properties affect the styling of an edge’s line:
|
||||
|
||||
@@ -12,6 +12,20 @@ import * as d3Format from 'd3-format';
|
||||
// Preparatory Steps
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
class NumCoercible {
|
||||
a: number;
|
||||
|
||||
constructor(a: number) {
|
||||
this.a = a;
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
||||
|
||||
const numeric: NumCoercible = new NumCoercible(10);
|
||||
|
||||
let num: number;
|
||||
|
||||
let formatFn: (n: number) => string;
|
||||
@@ -30,6 +44,12 @@ formatFn = d3Format.format('.0%');
|
||||
|
||||
formatFn = d3Format.formatPrefix(',.0', 1e-6);
|
||||
|
||||
d3Format.format('.0%')(10);
|
||||
d3Format.format('.0%')(numeric);
|
||||
|
||||
d3Format.formatPrefix(',.0', 1e-6)(10);
|
||||
d3Format.formatPrefix(',.0', 1e-6)(numeric);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Test Format Specifier
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -43,7 +63,7 @@ const symbol: '$' | '#' | '' = specifier.symbol;
|
||||
const zero: boolean = specifier.zero;
|
||||
const width: number | undefined = specifier.width;
|
||||
const comma: boolean = specifier.comma;
|
||||
const precision: number = specifier.precision;
|
||||
const precision: number | undefined = specifier.precision;
|
||||
const type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n' = specifier.type;
|
||||
|
||||
const formatString: string = specifier.toString();
|
||||
@@ -63,10 +83,10 @@ num = d3Format.precisionRound(0.0005, 3000);
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
localeDef = {
|
||||
decimal: ',',
|
||||
thousands: '.',
|
||||
grouping: [3],
|
||||
currency: ['EUR', '']
|
||||
decimal: ',',
|
||||
thousands: '.',
|
||||
grouping: [3],
|
||||
currency: ['EUR', '']
|
||||
};
|
||||
|
||||
localeDef = {
|
||||
|
||||
Vendored
+27
-19
@@ -1,6 +1,9 @@
|
||||
// Type definitions for D3JS d3-format module 1.2
|
||||
// Project: https://github.com/d3/d3-format/
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
|
||||
// Alex Ford <https://github.com/gustavderdrache>
|
||||
// Boris Yankov <https://github.com/borisyankov>
|
||||
// denisname <https://github.com/denisname>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.2.0
|
||||
@@ -23,7 +26,7 @@ export interface FormatLocaleDefinition {
|
||||
*/
|
||||
grouping: number[];
|
||||
/**
|
||||
* The currency prefix and suffix (e.g., ["$", ""])
|
||||
* The currency prefix and suffix (e.g., ["$", ""]).
|
||||
*/
|
||||
currency: [string, string];
|
||||
/**
|
||||
@@ -31,7 +34,7 @@ export interface FormatLocaleDefinition {
|
||||
*/
|
||||
numerals?: string[];
|
||||
/**
|
||||
* An optional symbol to replace the `percent` suffix; the percent suffix (defaults to "%")
|
||||
* An optional symbol to replace the `percent` suffix; the percent suffix (defaults to "%").
|
||||
*/
|
||||
percent?: string;
|
||||
}
|
||||
@@ -44,9 +47,10 @@ export interface FormatLocaleObject {
|
||||
* Returns a new format function for the given string specifier. The returned function
|
||||
* takes a number as the only argument, and returns a string representing the formatted number.
|
||||
*
|
||||
* @param specifier A Specifier string
|
||||
* @param specifier A Specifier string.
|
||||
* @throws Error on invalid format specifier.
|
||||
*/
|
||||
format(specifier: string): (n: number) => string;
|
||||
format(specifier: string): (n: number | { valueOf(): number }) => string;
|
||||
|
||||
/**
|
||||
* Returns a new format function for the given string specifier. The returned function
|
||||
@@ -54,10 +58,11 @@ export interface FormatLocaleObject {
|
||||
* The returned function will convert values to the units of the appropriate SI prefix for the
|
||||
* specified numeric reference value before formatting in fixed point notation.
|
||||
*
|
||||
* @param specifier A Specifier string
|
||||
* @param specifier A Specifier string.
|
||||
* @param value The reference value to determine the appropriate SI prefix.
|
||||
* @throws Error on invalid format specifier.
|
||||
*/
|
||||
formatPrefix(specifier: string, value: number): (n: number) => string;
|
||||
formatPrefix(specifier: string, value: number): (n: number | { valueOf(): number }) => string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +76,7 @@ export interface FormatSpecifier {
|
||||
*/
|
||||
fill: string;
|
||||
/**
|
||||
* Alignment used for format, as set by choosing one of the following
|
||||
* Alignment used for format, as set by choosing one of the following:
|
||||
*
|
||||
* '>' - Forces the field to be right-aligned within the available space. (Default behavior).
|
||||
* '<' - Forces the field to be left-aligned within the available space.
|
||||
@@ -83,9 +88,9 @@ export interface FormatSpecifier {
|
||||
* The sign can be:
|
||||
*
|
||||
* '-' - nothing for positive and a minus sign for negative. (Default behavior.)
|
||||
* '+' - a plus sign for positive and a minus sign for negative.
|
||||
* '+' - a plus sign for positive and a minus sign for negative.
|
||||
* '(' - nothing for positive and parentheses for negative.
|
||||
* ' '(space) - a space for positive and a minus sign for negative.
|
||||
* ' ' (space) - a space for positive and a minus sign for negative.
|
||||
*
|
||||
*/
|
||||
sign: '-' | '+' | '(' | ' ';
|
||||
@@ -94,7 +99,7 @@ export interface FormatSpecifier {
|
||||
*
|
||||
* '$' - apply currency symbols per the locale definition.
|
||||
* '#' - for binary, octal, or hexadecimal notation, prefix by 0b, 0o, or 0x, respectively.
|
||||
* ''(none) - no symbol.
|
||||
* '' (none) - no symbol. (Default behavior.)
|
||||
*/
|
||||
symbol: '$' | '#' | '';
|
||||
/**
|
||||
@@ -116,9 +121,9 @@ export interface FormatSpecifier {
|
||||
* it defaults to 6 for all types except '' (none), which defaults to 12.
|
||||
* Precision is ignored for integer formats (types 'b', 'o', 'd', 'x', 'X' and 'c').
|
||||
*
|
||||
* See precisionFixed and precisionRound for help picking an appropriate precision
|
||||
* See precisionFixed and precisionRound for help picking an appropriate precision.
|
||||
*/
|
||||
precision: number;
|
||||
precision: number | undefined;
|
||||
/**
|
||||
* The available type values are:
|
||||
*
|
||||
@@ -137,7 +142,7 @@ export interface FormatSpecifier {
|
||||
* 'c' - converts the integer to the corresponding unicode character before printing.
|
||||
* '' (none) - like g, but trim insignificant trailing zeros.
|
||||
*
|
||||
* The type 'n' is also supported as shorthand for ',g'. For the 'g', 'n' and ''(none) types,
|
||||
* The type 'n' is also supported as shorthand for ',g'. For the 'g', 'n' and '' (none) types,
|
||||
* decimal notation is used if the resulting string would have precision or fewer digits; otherwise, exponent notation is used.
|
||||
*/
|
||||
type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n';
|
||||
@@ -173,9 +178,10 @@ export function formatDefaultLocale(defaultLocale: FormatLocaleDefinition): Form
|
||||
* The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type].
|
||||
* For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties.
|
||||
*
|
||||
* @param specifier A Specifier string
|
||||
* @param specifier A Specifier string.
|
||||
* @throws Error on invalid format specifier.
|
||||
*/
|
||||
export function format(specifier: string): (n: number) => string;
|
||||
export function format(specifier: string): (n: number | { valueOf(): number }) => string;
|
||||
|
||||
/**
|
||||
* Returns a new format function for the given string specifier. The returned function
|
||||
@@ -183,15 +189,16 @@ export function format(specifier: string): (n: number) => string;
|
||||
* The returned function will convert values to the units of the appropriate SI prefix for the
|
||||
* specified numeric reference value before formatting in fixed point notation.
|
||||
*
|
||||
* Uses the current default locale.
|
||||
* Uses the current default locale.
|
||||
*
|
||||
* The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type].
|
||||
* For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties.
|
||||
*
|
||||
* @param specifier A Specifier string
|
||||
* @param specifier A Specifier string.
|
||||
* @param value The reference value to determine the appropriate SI prefix.
|
||||
* @throws Error on invalid format specifier.
|
||||
*/
|
||||
export function formatPrefix(specifier: string, value: number): (n: number) => string;
|
||||
export function formatPrefix(specifier: string, value: number): (n: number | { valueOf(): number }) => string;
|
||||
|
||||
/**
|
||||
* Parses the specified specifier, returning an object with exposed fields that correspond to the
|
||||
@@ -201,6 +208,7 @@ export function formatPrefix(specifier: string, value: number): (n: number) => s
|
||||
* For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties.
|
||||
*
|
||||
* @param specifier A specifier string.
|
||||
* @throws Error on invalid format specifier.
|
||||
*/
|
||||
export function formatSpecifier(specifier: string): FormatSpecifier;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
|
||||
+114
-12
@@ -89,7 +89,33 @@ const sampleExtendedFeatureCollection: d3Geo.ExtendedFeatureCollection<d3Geo.Ext
|
||||
sampleExtendedFeature2
|
||||
]
|
||||
};
|
||||
const sampleNullableFeature: GeoJSON.Feature<null> = {
|
||||
type: 'Feature',
|
||||
geometry: null,
|
||||
properties: null
|
||||
};
|
||||
|
||||
const sampleExtendedNullableFeature: d3Geo.ExtendedFeature = {
|
||||
type: 'Feature',
|
||||
geometry: null,
|
||||
properties: null
|
||||
};
|
||||
|
||||
const sampleNullableFeatureCollection: GeoJSON.FeatureCollection<null> = {
|
||||
type: 'FeatureCollection',
|
||||
features: [
|
||||
sampleNullableFeature,
|
||||
sampleNullableFeature
|
||||
]
|
||||
};
|
||||
|
||||
const sampleExtendedNullableFeatureCollection: d3Geo.ExtendedFeatureCollection = {
|
||||
type: 'FeatureCollection',
|
||||
features: [
|
||||
sampleExtendedNullableFeature,
|
||||
sampleExtendedNullableFeature
|
||||
]
|
||||
};
|
||||
// ----------------------------------------------------------------------
|
||||
// Spherical Math
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -101,10 +127,14 @@ area = d3Geo.geoArea(sampleSphere);
|
||||
area = d3Geo.geoArea(sampleGeometryCollection);
|
||||
area = d3Geo.geoArea(sampleExtendedGeometryCollection);
|
||||
area = d3Geo.geoArea(sampleFeature);
|
||||
area = d3Geo.geoArea(sampleNullableFeature);
|
||||
area = d3Geo.geoArea(sampleExtendedFeature1);
|
||||
area = d3Geo.geoArea(sampleExtendedFeature2);
|
||||
area = d3Geo.geoArea(sampleExtendedNullableFeature);
|
||||
area = d3Geo.geoArea(sampleFeatureCollection);
|
||||
area = d3Geo.geoArea(sampleNullableFeatureCollection);
|
||||
area = d3Geo.geoArea(sampleExtendedFeatureCollection);
|
||||
area = d3Geo.geoArea(sampleExtendedNullableFeatureCollection);
|
||||
|
||||
// geoBounds(...) =========================================================
|
||||
|
||||
@@ -113,10 +143,14 @@ bounds = d3Geo.geoBounds(sampleSphere);
|
||||
bounds = d3Geo.geoBounds(sampleGeometryCollection);
|
||||
bounds = d3Geo.geoBounds(sampleExtendedGeometryCollection);
|
||||
bounds = d3Geo.geoBounds(sampleFeature);
|
||||
bounds = d3Geo.geoBounds(sampleNullableFeature);
|
||||
bounds = d3Geo.geoBounds(sampleExtendedFeature1);
|
||||
bounds = d3Geo.geoBounds(sampleExtendedFeature2);
|
||||
bounds = d3Geo.geoBounds(sampleExtendedNullableFeature);
|
||||
bounds = d3Geo.geoBounds(sampleFeatureCollection);
|
||||
bounds = d3Geo.geoBounds(sampleNullableFeatureCollection);
|
||||
bounds = d3Geo.geoBounds(sampleExtendedFeatureCollection);
|
||||
bounds = d3Geo.geoBounds(sampleExtendedNullableFeatureCollection);
|
||||
|
||||
// geoCentroid(...) =======================================================
|
||||
|
||||
@@ -125,10 +159,14 @@ centroid = d3Geo.geoCentroid(sampleSphere);
|
||||
centroid = d3Geo.geoCentroid(sampleGeometryCollection);
|
||||
centroid = d3Geo.geoCentroid(sampleExtendedGeometryCollection);
|
||||
centroid = d3Geo.geoCentroid(sampleFeature);
|
||||
centroid = d3Geo.geoCentroid(sampleNullableFeature);
|
||||
centroid = d3Geo.geoCentroid(sampleExtendedFeature1);
|
||||
centroid = d3Geo.geoCentroid(sampleExtendedFeature2);
|
||||
centroid = d3Geo.geoCentroid(sampleExtendedNullableFeature);
|
||||
centroid = d3Geo.geoCentroid(sampleFeatureCollection);
|
||||
centroid = d3Geo.geoCentroid(sampleNullableFeatureCollection);
|
||||
centroid = d3Geo.geoCentroid(sampleExtendedFeatureCollection);
|
||||
centroid = d3Geo.geoCentroid(sampleExtendedNullableFeatureCollection);
|
||||
|
||||
// geoContains(...) =======================================================
|
||||
|
||||
@@ -137,10 +175,14 @@ contained = d3Geo.geoContains(sampleSphere, [0, 0]);
|
||||
contained = d3Geo.geoContains(sampleGeometryCollection, [0, 0]);
|
||||
contained = d3Geo.geoContains(sampleExtendedGeometryCollection, [0, 0]);
|
||||
contained = d3Geo.geoContains(sampleFeature, [0, 0]);
|
||||
contained = d3Geo.geoContains(sampleNullableFeature, [0, 0]);
|
||||
contained = d3Geo.geoContains(sampleExtendedFeature1, [0, 0]);
|
||||
contained = d3Geo.geoContains(sampleExtendedFeature2, [0, 0]);
|
||||
contained = d3Geo.geoContains(sampleExtendedNullableFeature, [0, 0]);
|
||||
contained = d3Geo.geoContains(sampleFeatureCollection, [0, 0]);
|
||||
contained = d3Geo.geoContains(sampleNullableFeatureCollection, [0, 0]);
|
||||
contained = d3Geo.geoContains(sampleExtendedFeatureCollection, [0, 0]);
|
||||
contained = d3Geo.geoContains(sampleExtendedNullableFeatureCollection, [0, 0]);
|
||||
|
||||
// geoDistance(...) =======================================================
|
||||
|
||||
@@ -153,10 +195,14 @@ length = d3Geo.geoLength(sampleSphere);
|
||||
length = d3Geo.geoLength(sampleGeometryCollection);
|
||||
length = d3Geo.geoLength(sampleExtendedGeometryCollection);
|
||||
length = d3Geo.geoLength(sampleFeature);
|
||||
length = d3Geo.geoLength(sampleNullableFeature);
|
||||
length = d3Geo.geoLength(sampleExtendedFeature1);
|
||||
length = d3Geo.geoLength(sampleExtendedFeature2);
|
||||
length = d3Geo.geoLength(sampleExtendedNullableFeature);
|
||||
length = d3Geo.geoLength(sampleFeatureCollection);
|
||||
length = d3Geo.geoLength(sampleNullableFeatureCollection);
|
||||
length = d3Geo.geoLength(sampleExtendedFeatureCollection);
|
||||
length = d3Geo.geoLength(sampleExtendedNullableFeatureCollection);
|
||||
|
||||
// geoInterpolate(...) ====================================================
|
||||
|
||||
@@ -181,7 +227,7 @@ const inverted: [number, number] = rotation.invert([54, 2]);
|
||||
// Create GeoCircleGenerator ============================================
|
||||
|
||||
// simple use case
|
||||
let circleGeneratorSimple: d3Geo.GeoCircleGenerator<any, any> = d3Geo.geoCircle();
|
||||
let circleGeneratorSimple: d3Geo.GeoCircleGenerator = d3Geo.geoCircle();
|
||||
|
||||
// complex use as part of object
|
||||
class Circulator {
|
||||
@@ -331,8 +377,9 @@ const naturalEart1Raw: d3Geo.GeoRawProjection = d3Geo.geoNaturalEarth1Raw();
|
||||
// Use Raw Projection =====================================================
|
||||
|
||||
const rawProjectionPoint: [number, number] = azimuthalEqualAreaRaw(54, 2);
|
||||
const rawProjectionInvertedPoint: [number, number] = azimuthalEqualAreaRaw.invert(180, 6);
|
||||
|
||||
if (azimuthalEqualAreaRaw.invert) {
|
||||
const rawProjectionInvertedPoint: [number, number] = azimuthalEqualAreaRaw.invert(180, 6);
|
||||
}
|
||||
// ----------------------------------------------------------------------
|
||||
// Pre-Defined Projections
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -365,8 +412,10 @@ let constructedProjection: d3Geo.GeoProjection = mutate();
|
||||
|
||||
// Use Projection ==========================================================
|
||||
|
||||
const projected: [number, number] = constructedProjection([54, 2]);
|
||||
const inverted2: [number, number] = constructedProjection.invert([54, 2]);
|
||||
const projected: [number, number] | null = constructedProjection([54, 2]);
|
||||
if (constructedProjection.invert) {
|
||||
const inverted2: [number, number] | null = constructedProjection.invert([54, 2]);
|
||||
}
|
||||
|
||||
// TODO ?????
|
||||
// let stream: d3Geo.Stream = constructedProjection.stream([54, 2]);
|
||||
@@ -378,7 +427,7 @@ constructedProjection = constructedProjection.preclip(d3Geo.geoClipCircle(45));
|
||||
const postClip: (stream: d3Geo.GeoStream) => d3Geo.GeoStream = constructedProjection.postclip();
|
||||
constructedProjection = constructedProjection.postclip(d3Geo.geoClipRectangle(0, 0, 1, 1));
|
||||
|
||||
const clipAngle: number = constructedProjection.clipAngle();
|
||||
const clipAngle: number | null = constructedProjection.clipAngle();
|
||||
constructedProjection = constructedProjection.clipAngle(null);
|
||||
constructedProjection = constructedProjection.clipAngle(45);
|
||||
|
||||
@@ -410,40 +459,56 @@ constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sa
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sampleGeometryCollection);
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sampleExtendedGeometryCollection);
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sampleFeature);
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sampleNullableFeature);
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sampleExtendedFeature1);
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sampleExtendedFeature2);
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sampleExtendedNullableFeature);
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sampleFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sampleNullableFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sampleExtendedFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], sampleExtendedNullableFeatureCollection);
|
||||
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], samplePolygon);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleSphere);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleGeometryCollection);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleExtendedGeometryCollection);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleFeature);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleNullableFeature);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleExtendedFeature1);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleExtendedFeature2);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleExtendedNullableFeature);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleNullableFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleExtendedFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitSize([960, 500], sampleExtendedNullableFeatureCollection);
|
||||
|
||||
constructedProjection = constructedProjection.fitWidth(960, samplePolygon);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleSphere);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleGeometryCollection);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleExtendedGeometryCollection);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleFeature);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleNullableFeature);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleExtendedFeature1);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleExtendedFeature2);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleExtendedNullableFeature);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleNullableFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleExtendedFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitWidth(960, sampleExtendedNullableFeatureCollection);
|
||||
|
||||
constructedProjection = constructedProjection.fitHeight(500, samplePolygon);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleSphere);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleGeometryCollection);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleExtendedGeometryCollection);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleFeature);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleNullableFeature);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleExtendedFeature1);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleExtendedFeature2);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleExtendedNullableFeature);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleNullableFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleExtendedFeatureCollection);
|
||||
constructedProjection = constructedProjection.fitHeight(500, sampleExtendedNullableFeatureCollection);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// GeoConicProjection interface
|
||||
@@ -471,7 +536,7 @@ const minimalRenderingContextMockUp: d3Geo.GeoContext = {
|
||||
|
||||
// Create geoPath Generator =============================================
|
||||
|
||||
let geoPathCanvas: d3Geo.GeoPath<any, d3Geo.GeoPermissibleObjects>;
|
||||
let geoPathCanvas: d3Geo.GeoPath;
|
||||
geoPathCanvas = d3Geo.geoPath();
|
||||
geoPathCanvas = d3Geo.geoPath(null);
|
||||
geoPathCanvas = d3Geo.geoPath(null, null);
|
||||
@@ -487,8 +552,8 @@ geoPathSVG = d3Geo.geoPath<SVGPathElement, d3Geo.ExtendedFeature<GeoJSON.Polygon
|
||||
// projection(...) ------------------------------------------------------
|
||||
|
||||
geoPathCanvas = geoPathCanvas.projection(azimuthalEqualArea);
|
||||
const geoPathProjectionMinimal: d3Geo.GeoStreamWrapper = geoPathCanvas.projection();
|
||||
const geoPathProjectionUnion: d3Geo.GeoProjection | d3Geo.GeoConicProjection | d3Geo.GeoStreamWrapper = geoPathCanvas.projection();
|
||||
const geoPathProjectionMinimal: d3Geo.GeoStreamWrapper | null = geoPathCanvas.projection();
|
||||
const geoPathProjectionUnion: d3Geo.GeoProjection | d3Geo.GeoConicProjection | d3Geo.GeoStreamWrapper | null = geoPathCanvas.projection();
|
||||
const geoPathProjection: d3Geo.GeoProjection = geoPathCanvas.projection<d3Geo.GeoProjection>();
|
||||
|
||||
geoPathSVG = geoPathSVG.projection(conicConformal);
|
||||
@@ -501,13 +566,13 @@ const geoPathConicProjection: d3Geo.GeoConicProjection = geoPathSVG.projection<d
|
||||
// minimal context interface (mockup)
|
||||
geoPathCanvas = geoPathCanvas.context(minimalRenderingContextMockUp);
|
||||
|
||||
const geoPathContext: d3Geo.GeoContext = geoPathCanvas.context();
|
||||
const geoPathContext: d3Geo.GeoContext | null = geoPathCanvas.context();
|
||||
|
||||
// reset
|
||||
geoPathCanvas = geoPathCanvas.context(null);
|
||||
|
||||
// With canvas 2D rendering context
|
||||
let canvasContext: CanvasRenderingContext2D;
|
||||
let canvasContext: CanvasRenderingContext2D = {} as any;
|
||||
|
||||
geoPathCanvas = geoPathCanvas.context(canvasContext);
|
||||
|
||||
@@ -540,12 +605,17 @@ geoPathArea = geoPathCanvas.area(sampleSphere);
|
||||
geoPathArea = geoPathCanvas.area(sampleGeometryCollection);
|
||||
geoPathArea = geoPathCanvas.area(sampleExtendedGeometryCollection);
|
||||
geoPathArea = geoPathCanvas.area(sampleFeature);
|
||||
geoPathArea = geoPathCanvas.area(sampleNullableFeature);
|
||||
geoPathArea = geoPathCanvas.area(sampleExtendedFeature1);
|
||||
geoPathArea = geoPathCanvas.area(sampleExtendedFeature2);
|
||||
geoPathArea = geoPathCanvas.area(sampleExtendedNullableFeature);
|
||||
geoPathArea = geoPathCanvas.area(sampleFeatureCollection);
|
||||
geoPathArea = geoPathCanvas.area(sampleNullableFeatureCollection);
|
||||
geoPathArea = geoPathCanvas.area(sampleExtendedFeatureCollection);
|
||||
geoPathArea = geoPathCanvas.area(sampleExtendedNullableFeatureCollection);
|
||||
|
||||
// geoPathArea = geoPathSVG.area(sampleExtendedFeatureCollection); // fails, wrong data object type
|
||||
// geoPathArea = geoPathSVG.area(sampleExtendedNullableFeatureCollection); // fails, wrong data object type
|
||||
|
||||
// bounds(...) ------------------------------------------------------
|
||||
|
||||
@@ -554,12 +624,17 @@ geoPathBounds = geoPathCanvas.bounds(sampleSphere);
|
||||
geoPathBounds = geoPathCanvas.bounds(sampleGeometryCollection);
|
||||
geoPathBounds = geoPathCanvas.bounds(sampleExtendedGeometryCollection);
|
||||
geoPathBounds = geoPathCanvas.bounds(sampleFeature);
|
||||
geoPathBounds = geoPathCanvas.bounds(sampleNullableFeature);
|
||||
geoPathBounds = geoPathCanvas.bounds(sampleExtendedFeature1);
|
||||
geoPathBounds = geoPathCanvas.bounds(sampleExtendedFeature2);
|
||||
geoPathBounds = geoPathCanvas.bounds(sampleExtendedNullableFeature);
|
||||
geoPathBounds = geoPathCanvas.bounds(sampleFeatureCollection);
|
||||
geoPathBounds = geoPathCanvas.bounds(sampleNullableFeatureCollection);
|
||||
geoPathBounds = geoPathCanvas.bounds(sampleExtendedFeatureCollection);
|
||||
geoPathBounds = geoPathCanvas.bounds(sampleExtendedNullableFeatureCollection);
|
||||
|
||||
// geoPathBounds = geoPathSVG.bounds(sampleExtendedFeatureCollection); // fails, wrong data object type
|
||||
// geoPathBounds = geoPathSVG.bounds(sampleExtendedNullableFeatureCollection); // fails, wrong data object type
|
||||
|
||||
// centroid(...) ------------------------------------------------------
|
||||
|
||||
@@ -568,12 +643,17 @@ geoPathCentroid = geoPathCanvas.centroid(sampleSphere);
|
||||
geoPathCentroid = geoPathCanvas.centroid(sampleGeometryCollection);
|
||||
geoPathCentroid = geoPathCanvas.centroid(sampleExtendedGeometryCollection);
|
||||
geoPathCentroid = geoPathCanvas.centroid(sampleFeature);
|
||||
geoPathCentroid = geoPathCanvas.centroid(sampleNullableFeature);
|
||||
geoPathCentroid = geoPathCanvas.centroid(sampleExtendedFeature1);
|
||||
geoPathCentroid = geoPathCanvas.centroid(sampleExtendedFeature2);
|
||||
geoPathCentroid = geoPathCanvas.centroid(sampleExtendedNullableFeature);
|
||||
geoPathCentroid = geoPathCanvas.centroid(sampleFeatureCollection);
|
||||
geoPathCentroid = geoPathCanvas.centroid(sampleNullableFeatureCollection);
|
||||
geoPathCentroid = geoPathCanvas.centroid(sampleExtendedFeatureCollection);
|
||||
geoPathCentroid = geoPathCanvas.centroid(sampleExtendedNullableFeatureCollection);
|
||||
|
||||
// geoPathCentroid = geoPathSVG.centroid(sampleExtendedFeatureCollection); // fails, wrong data object type
|
||||
// geoPathCentroid = geoPathSVG.centroid(sampleExtendedNullableFeatureCollection); // fails, wrong data object type
|
||||
|
||||
// measure(...) ------------------------------------------------------
|
||||
|
||||
@@ -582,10 +662,14 @@ geoPathMeasure = geoPathCanvas.measure(sampleSphere);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleGeometryCollection);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleExtendedGeometryCollection);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleFeature);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleNullableFeature);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleExtendedFeature1);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleExtendedFeature2);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleExtendedNullableFeature);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleFeatureCollection);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleNullableFeatureCollection);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleExtendedFeatureCollection);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleExtendedNullableFeatureCollection);
|
||||
|
||||
// render path to context of get path string----------------------------
|
||||
|
||||
@@ -596,10 +680,14 @@ geoPathCanvas(sampleSphere);
|
||||
geoPathCanvas(sampleGeometryCollection);
|
||||
geoPathCanvas(sampleExtendedGeometryCollection);
|
||||
geoPathCanvas(sampleFeature);
|
||||
geoPathCanvas(sampleNullableFeature);
|
||||
geoPathCanvas(sampleExtendedFeature1);
|
||||
geoPathCanvas(sampleExtendedFeature2);
|
||||
geoPathCanvas(sampleExtendedNullableFeature);
|
||||
geoPathCanvas(sampleFeatureCollection);
|
||||
geoPathCanvas(sampleNullableFeatureCollection);
|
||||
geoPathCanvas(sampleExtendedFeatureCollection);
|
||||
geoPathCanvas(sampleExtendedNullableFeatureCollection);
|
||||
|
||||
// Use path string generator for SVGPathElement
|
||||
|
||||
@@ -667,20 +755,28 @@ identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleSphe
|
||||
identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleGeometryCollection);
|
||||
identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedGeometryCollection);
|
||||
identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleFeature);
|
||||
identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleNullableFeature);
|
||||
identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedFeature1);
|
||||
identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedFeature2);
|
||||
identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedNullableFeature);
|
||||
identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleFeatureCollection);
|
||||
identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleNullableFeatureCollection);
|
||||
identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedFeatureCollection);
|
||||
identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedNullableFeatureCollection);
|
||||
|
||||
identityTransform = identityTransform.fitSize([960, 500], samplePolygon);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleSphere);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleGeometryCollection);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleExtendedGeometryCollection);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleFeature);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleNullableFeature);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleExtendedFeature1);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleExtendedFeature2);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleExtendedNullableFeature);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleFeatureCollection);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleNullableFeatureCollection);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleExtendedFeatureCollection);
|
||||
identityTransform = identityTransform.fitSize([960, 500], sampleExtendedNullableFeatureCollection);
|
||||
|
||||
let reflecting: boolean;
|
||||
|
||||
@@ -703,7 +799,9 @@ stream.lineStart();
|
||||
stream.lineEnd();
|
||||
stream.polygonStart();
|
||||
stream.polygonEnd();
|
||||
stream.sphere();
|
||||
if (stream.sphere) {
|
||||
stream.sphere();
|
||||
}
|
||||
|
||||
// geoStream(...) ========================================================
|
||||
|
||||
@@ -712,10 +810,14 @@ d3Geo.geoStream(sampleSphere, stream);
|
||||
d3Geo.geoStream(sampleGeometryCollection, stream);
|
||||
d3Geo.geoStream(sampleExtendedGeometryCollection, stream);
|
||||
d3Geo.geoStream(sampleFeature, stream);
|
||||
d3Geo.geoStream(sampleNullableFeature, stream);
|
||||
d3Geo.geoStream(sampleExtendedFeature1, stream);
|
||||
d3Geo.geoStream(sampleExtendedFeature2, stream);
|
||||
d3Geo.geoStream(sampleExtendedNullableFeature, stream);
|
||||
d3Geo.geoStream(sampleFeatureCollection, stream);
|
||||
d3Geo.geoStream(sampleNullableFeatureCollection, stream);
|
||||
d3Geo.geoStream(sampleExtendedFeatureCollection, stream);
|
||||
d3Geo.geoStream(sampleExtendedNullableFeatureCollection, stream);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Clipping Function
|
||||
|
||||
Vendored
+59
-47
@@ -31,9 +31,11 @@ export type GeoGeometryObjects = GeoJSON.GeometryObject | GeoSphere;
|
||||
|
||||
/**
|
||||
* A GeoJSON-style GeometryCollection which supports GeoJSON geometry objects
|
||||
* and additionally GeoSphere
|
||||
* and additionally GeoSphere.
|
||||
*
|
||||
* The generic refers to the type(s) of d3-geo geometry objects contained in the collection.
|
||||
*/
|
||||
export interface ExtendedGeometryCollection<GeometryType extends GeoGeometryObjects> {
|
||||
export interface ExtendedGeometryCollection<GeometryType extends GeoGeometryObjects = GeoGeometryObjects> {
|
||||
type: string;
|
||||
bbox?: number[];
|
||||
crs?: {
|
||||
@@ -45,9 +47,18 @@ export interface ExtendedGeometryCollection<GeometryType extends GeoGeometryObje
|
||||
|
||||
/**
|
||||
* A GeoJSON-style Feature which support features built on GeoJSON GeometryObjects
|
||||
* or GeoSphere
|
||||
* or GeoSphere.
|
||||
*
|
||||
* The first generic refers to the type(s) of d3-geo geometry objects underlying the ExtendedFeature.
|
||||
* Unless explicitly ruled out, the geometry value is nullable.
|
||||
*
|
||||
* The second generic refers to the data type of the properties of the ExtendedFeature. Unless explicitly ruled out,
|
||||
* the properties value is nullable.
|
||||
*/
|
||||
export interface ExtendedFeature<GeometryType extends GeoGeometryObjects, Properties> extends GeoJSON.GeoJsonObject {
|
||||
export interface ExtendedFeature<
|
||||
GeometryType extends GeoGeometryObjects | null = GeoGeometryObjects | null,
|
||||
Properties extends GeoJSON.GeoJsonProperties = GeoJSON.GeoJsonProperties
|
||||
> extends GeoJSON.GeoJsonObject {
|
||||
geometry: GeometryType;
|
||||
properties: Properties;
|
||||
id?: string | number;
|
||||
@@ -56,8 +67,10 @@ export interface ExtendedFeature<GeometryType extends GeoGeometryObjects, Proper
|
||||
/**
|
||||
* A GeoJSON-style FeatureCollection which supports GeoJSON features
|
||||
* and features built on GeoSphere
|
||||
*
|
||||
* The generic refers to the type of ExtendedFeature contained in the ExtendedFeatureCollection.
|
||||
*/
|
||||
export interface ExtendedFeatureCollection<FeatureType extends ExtendedFeature<GeoGeometryObjects, any>> extends GeoJSON.GeoJsonObject {
|
||||
export interface ExtendedFeatureCollection<FeatureType extends ExtendedFeature = ExtendedFeature> extends GeoJSON.GeoJsonObject {
|
||||
features: FeatureType[];
|
||||
}
|
||||
|
||||
@@ -65,8 +78,7 @@ export interface ExtendedFeatureCollection<FeatureType extends ExtendedFeature<G
|
||||
* Type Alias for permissible objects which can be used with d3-geo
|
||||
* methods
|
||||
*/
|
||||
export type GeoPermissibleObjects = GeoGeometryObjects | ExtendedGeometryCollection<GeoGeometryObjects>
|
||||
| ExtendedFeature<GeoGeometryObjects, any> | ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>;
|
||||
export type GeoPermissibleObjects = GeoGeometryObjects | ExtendedGeometryCollection | ExtendedFeature | ExtendedFeatureCollection;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Spherical Math
|
||||
@@ -78,14 +90,14 @@ export type GeoPermissibleObjects = GeoGeometryObjects | ExtendedGeometryCollect
|
||||
*
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
export function geoArea(object: ExtendedFeature<GeoGeometryObjects, any>): number;
|
||||
export function geoArea(object: ExtendedFeature): number;
|
||||
/**
|
||||
* Returns the spherical area of the specified feature collection in steradians.
|
||||
* This is the spherical equivalent of path.area.
|
||||
*
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
export function geoArea(object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): number;
|
||||
export function geoArea(object: ExtendedFeatureCollection): number;
|
||||
/**
|
||||
* Returns the spherical area of the specified GeoJson Geometry Object or GeoSphere object in steradians.
|
||||
* This is the spherical equivalent of path.area.
|
||||
@@ -99,7 +111,7 @@ export function geoArea(object: GeoGeometryObjects): number;
|
||||
*
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
export function geoArea(object: ExtendedGeometryCollection<GeoGeometryObjects>): number;
|
||||
export function geoArea(object: ExtendedGeometryCollection): number;
|
||||
|
||||
/**
|
||||
* Returns the spherical bounding box for the specified feature. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]],
|
||||
@@ -109,7 +121,7 @@ export function geoArea(object: ExtendedGeometryCollection<GeoGeometryObjects>):
|
||||
*
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
export function geoBounds(object: ExtendedFeature<GeoGeometryObjects, any>): [[number, number], [number, number]];
|
||||
export function geoBounds(object: ExtendedFeature): [[number, number], [number, number]];
|
||||
/**
|
||||
* Returns the spherical bounding box for the specified feature collection. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]],
|
||||
* where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees.
|
||||
@@ -118,7 +130,7 @@ export function geoBounds(object: ExtendedFeature<GeoGeometryObjects, any>): [[n
|
||||
*
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
export function geoBounds(object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): [[number, number], [number, number]];
|
||||
export function geoBounds(object: ExtendedFeatureCollection): [[number, number], [number, number]];
|
||||
/**
|
||||
* Returns the spherical bounding box for the specified GeoJson Geometry Object or GeoSphere object. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]],
|
||||
* where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees.
|
||||
@@ -136,7 +148,7 @@ export function geoBounds(object: GeoGeometryObjects): [[number, number], [numbe
|
||||
*
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
export function geoBounds(object: ExtendedGeometryCollection<GeoGeometryObjects>): [[number, number], [number, number]];
|
||||
export function geoBounds(object: ExtendedGeometryCollection): [[number, number], [number, number]];
|
||||
|
||||
/**
|
||||
* Returns the spherical centroid of the specified feature in steradians.
|
||||
@@ -144,14 +156,14 @@ export function geoBounds(object: ExtendedGeometryCollection<GeoGeometryObjects>
|
||||
*
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
export function geoCentroid(object: ExtendedFeature<GeoGeometryObjects, any>): [number, number];
|
||||
export function geoCentroid(object: ExtendedFeature): [number, number];
|
||||
/**
|
||||
* Returns the spherical centroid of the specified feature collection in steradians.
|
||||
* This is the spherical equivalent of path.centroid.
|
||||
*
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
export function geoCentroid(object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): [number, number];
|
||||
export function geoCentroid(object: ExtendedFeatureCollection): [number, number];
|
||||
/**
|
||||
* Returns the spherical centroid of the specified GeoJson Geometry Object or GeoSphere object in steradians.
|
||||
* This is the spherical equivalent of path.centroid.
|
||||
@@ -165,7 +177,7 @@ export function geoCentroid(object: GeoGeometryObjects): [number, number];
|
||||
*
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
export function geoCentroid(object: ExtendedGeometryCollection<GeoGeometryObjects>): [number, number];
|
||||
export function geoCentroid(object: ExtendedGeometryCollection): [number, number];
|
||||
|
||||
/**
|
||||
* Returns true if and only if the specified GeoJSON object contains the specified point, or false if the object does not contain the point.
|
||||
@@ -175,7 +187,7 @@ export function geoCentroid(object: ExtendedGeometryCollection<GeoGeometryObject
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
* @param point Point specified as a two-element array [longitude, latitude] in degrees.
|
||||
*/
|
||||
export function geoContains(object: ExtendedFeature<GeoGeometryObjects, any>, point: [number, number]): boolean;
|
||||
export function geoContains(object: ExtendedFeature, point: [number, number]): boolean;
|
||||
/**
|
||||
* Returns true if and only if the specified GeoJSON object contains the specified point, or false if the object does not contain the point.
|
||||
* The point must be specified as a two-element array [longitude, latitude] in degrees. For Point and MultiPoint geometries, an exact test is used;
|
||||
@@ -184,7 +196,7 @@ export function geoContains(object: ExtendedFeature<GeoGeometryObjects, any>, po
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature).
|
||||
* @param point Point specified as a two-element array [longitude, latitude] in degrees.
|
||||
*/
|
||||
export function geoContains(object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>, point: [number, number]): boolean;
|
||||
export function geoContains(object: ExtendedFeatureCollection, point: [number, number]): boolean;
|
||||
/**
|
||||
* Returns true if and only if the specified GeoJSON object contains the specified point, or false if the object does not contain the point.
|
||||
* The point must be specified as a two-element array [longitude, latitude] in degrees. For Point and MultiPoint geometries, an exact test is used;
|
||||
@@ -202,7 +214,7 @@ export function geoContains(object: GeoGeometryObjects, point: [number, number])
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
* @param point Point specified as a two-element array [longitude, latitude] in degrees.
|
||||
*/
|
||||
export function geoContains(object: ExtendedGeometryCollection<GeoGeometryObjects>, point: [number, number]): boolean;
|
||||
export function geoContains(object: ExtendedGeometryCollection, point: [number, number]): boolean;
|
||||
|
||||
/**
|
||||
* Returns the great-arc distance in radians between the two points a and b.
|
||||
@@ -219,14 +231,14 @@ export function geoDistance(a: [number, number], b: [number, number]): number;
|
||||
*
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
export function geoLength(object: ExtendedFeature<GeoGeometryObjects, any>): number;
|
||||
export function geoLength(object: ExtendedFeature): number;
|
||||
/**
|
||||
* Returns the great-arc length of the specified feature collection in radians. For polygons, returns the perimeter of the exterior ring plus that of any interior rings.
|
||||
* This is the spherical equivalent of path.measure.
|
||||
*
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
export function geoLength(object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): number;
|
||||
export function geoLength(object: ExtendedFeatureCollection): number;
|
||||
/**
|
||||
* Returns the great-arc length of the specified GeoJson Geometry Object or GeoSphere object in radians. For polygons, returns the perimeter of the exterior ring plus that of any interior rings.
|
||||
* This is the spherical equivalent of path.measure.
|
||||
@@ -240,7 +252,7 @@ export function geoLength(object: GeoGeometryObjects): number;
|
||||
*
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
export function geoLength(object: ExtendedGeometryCollection<GeoGeometryObjects>): number;
|
||||
export function geoLength(object: ExtendedGeometryCollection): number;
|
||||
|
||||
/**
|
||||
* Returns an interpolator function given two points a and b.
|
||||
@@ -291,7 +303,7 @@ export function geoRotation(angles: [number, number] | [number, number, number])
|
||||
*
|
||||
* The second generic corresponds to the type of the Datum which will be passed into the geo circle generator.
|
||||
*/
|
||||
export interface GeoCircleGenerator<This, Datum> {
|
||||
export interface GeoCircleGenerator<This = any, Datum = any> {
|
||||
/**
|
||||
* Returns a new GeoJSON geometry object of type “Polygon” approximating a circle on the surface of a sphere,
|
||||
* with the current center, radius and precision. Any arguments are passed to the accessors.
|
||||
@@ -362,7 +374,7 @@ export interface GeoCircleGenerator<This, Datum> {
|
||||
/**
|
||||
* Returns a new geo circle generator
|
||||
*/
|
||||
export function geoCircle(): GeoCircleGenerator<any, any>;
|
||||
export function geoCircle(): GeoCircleGenerator;
|
||||
/**
|
||||
* Returns a new geo circle generator
|
||||
*
|
||||
@@ -547,7 +559,7 @@ export interface GeoStream {
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
* @param stream A projection stream.
|
||||
*/
|
||||
export function geoStream(object: ExtendedFeature<GeoGeometryObjects, any>, stream: GeoStream): void;
|
||||
export function geoStream(object: ExtendedFeature, stream: GeoStream): void;
|
||||
|
||||
/**
|
||||
* Streams the specified GeoJSON object to the specified projection stream. While both features and geometry objects are supported as input,
|
||||
@@ -556,7 +568,7 @@ export function geoStream(object: ExtendedFeature<GeoGeometryObjects, any>, stre
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature).
|
||||
* @param stream A projection stream.
|
||||
*/
|
||||
export function geoStream(object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>, stream: GeoStream): void;
|
||||
export function geoStream(object: ExtendedFeatureCollection, stream: GeoStream): void;
|
||||
|
||||
/**
|
||||
* Streams the specified GeoJSON object to the specified projection stream. While both features and geometry objects are supported as input,
|
||||
@@ -574,7 +586,7 @@ export function geoStream(object: GeoGeometryObjects, stream: GeoStream): void;
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
* @param stream A projection stream.
|
||||
*/
|
||||
export function geoStream(object: ExtendedGeometryCollection<GeoGeometryObjects>, stream: GeoStream): void;
|
||||
export function geoStream(object: ExtendedGeometryCollection, stream: GeoStream): void;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Projections
|
||||
@@ -736,7 +748,7 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature<GeoGeometryObjects, any>): this;
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent.
|
||||
* Returns the projection.
|
||||
@@ -746,7 +758,7 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): this;
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent.
|
||||
* Returns the projection.
|
||||
@@ -766,7 +778,7 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this;
|
||||
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature in the center of an extent with the given size and top-left corner of [0, 0].
|
||||
@@ -777,7 +789,7 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
* @param size The size of the extent, specified as an array [width, height].
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
fitSize(size: [number, number], object: ExtendedFeature<GeoGeometryObjects, any>): this;
|
||||
fitSize(size: [number, number], object: ExtendedFeature): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of an extent with the given size and top-left corner of [0, 0].
|
||||
* Returns the projection.
|
||||
@@ -787,7 +799,7 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
* @param size The size of the extent, specified as an array [width, height].
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
|
||||
*/
|
||||
fitSize(size: [number, number], object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): this;
|
||||
fitSize(size: [number, number], object: ExtendedFeatureCollection): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of an extent with the given size and top-left corner of [0, 0].
|
||||
* Returns the projection.
|
||||
@@ -807,7 +819,7 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
* @param size The size of the extent, specified as an array [width, height].
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
fitSize(size: [number, number], object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
|
||||
fitSize(size: [number, number], object: ExtendedGeometryCollection): this;
|
||||
|
||||
/**
|
||||
* A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width.
|
||||
@@ -815,14 +827,14 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
* @param width The width of the extent.
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
fitWidth(width: number, object: ExtendedFeature<GeoGeometryObjects, any>): this;
|
||||
fitWidth(width: number, object: ExtendedFeature): this;
|
||||
/**
|
||||
* A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width.
|
||||
*
|
||||
* @param width The width of the extent.
|
||||
* @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON).
|
||||
*/
|
||||
fitWidth(width: number, object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): this;
|
||||
fitWidth(width: number, object: ExtendedFeatureCollection): this;
|
||||
/**
|
||||
* A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width.
|
||||
*
|
||||
@@ -836,7 +848,7 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
* @param width The width of the extent.
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
fitWidth(width: number, object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
|
||||
fitWidth(width: number, object: ExtendedGeometryCollection): this;
|
||||
|
||||
/**
|
||||
* A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height.
|
||||
@@ -844,14 +856,14 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
* @param height The height of the extent.
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
fitHeight(height: number, object: ExtendedFeature<GeoGeometryObjects, any>): this;
|
||||
fitHeight(height: number, object: ExtendedFeature): this;
|
||||
/**
|
||||
* A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height.
|
||||
*
|
||||
* @param height The height of the extent.
|
||||
* @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON).
|
||||
*/
|
||||
fitHeight(height: number, object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): this;
|
||||
fitHeight(height: number, object: ExtendedFeatureCollection): this;
|
||||
/**
|
||||
* A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height.
|
||||
*
|
||||
@@ -865,7 +877,7 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
* @param height The height of the extent.
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
fitHeight(height: number, object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
|
||||
fitHeight(height: number, object: ExtendedGeometryCollection): this;
|
||||
|
||||
/**
|
||||
* Returns a new array [longitude, latitude] in degrees representing the unprojected point of the given projected point.
|
||||
@@ -1012,7 +1024,7 @@ export interface GeoContext {
|
||||
*
|
||||
* The second generic corresponds to the type of the DatumObject which will be passed into the geo path generator for rendering.
|
||||
*/
|
||||
export interface GeoPath<This, DatumObject extends GeoPermissibleObjects> {
|
||||
export interface GeoPath<This = any, DatumObject extends GeoPermissibleObjects = GeoPermissibleObjects> {
|
||||
/**
|
||||
* Renders the given object, which may be any GeoJSON feature or geometry object:
|
||||
*
|
||||
@@ -1222,7 +1234,7 @@ export interface GeoPath<This, DatumObject extends GeoPermissibleObjects> {
|
||||
* @param context An (optional) rendering context to be used. If a context is provided, it must at least implement the interface described by GeoContext, a subset of the CanvasRenderingContext2D API.
|
||||
* Setting the context to "null" means that the path generator will return an SVG path string representing the to be rendered object. The default is "null".
|
||||
*/
|
||||
export function geoPath(projection?: GeoProjection | GeoStreamWrapper | null, context?: GeoContext | null): GeoPath<any, GeoPermissibleObjects>;
|
||||
export function geoPath(projection?: GeoProjection | GeoStreamWrapper | null, context?: GeoContext | null): GeoPath;
|
||||
/**
|
||||
* Creates a new geographic path generator with the default settings.
|
||||
*
|
||||
@@ -1525,7 +1537,7 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature<GeoGeometryObjects, any>): this;
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent.
|
||||
* Returns the projection.
|
||||
@@ -1535,7 +1547,7 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): this;
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent.
|
||||
* Returns the projection.
|
||||
@@ -1555,7 +1567,7 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this;
|
||||
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature in the center of an extent with the given size and top-left corner of [0, 0].
|
||||
@@ -1566,7 +1578,7 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
* @param size The size of the extent, specified as an array [width, height].
|
||||
* @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature).
|
||||
*/
|
||||
fitSize(size: [number, number], object: ExtendedFeature<GeoGeometryObjects, any>): this;
|
||||
fitSize(size: [number, number], object: ExtendedFeature): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of an extent with the given size and top-left corner of [0, 0].
|
||||
* Returns the projection.
|
||||
@@ -1576,7 +1588,7 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
* @param size The size of the extent, specified as an array [width, height].
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
|
||||
*/
|
||||
fitSize(size: [number, number], object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): this;
|
||||
fitSize(size: [number, number], object: ExtendedFeatureCollection): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of an extent with the given size and top-left corner of [0, 0].
|
||||
* Returns the projection.
|
||||
@@ -1596,7 +1608,7 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
* @param size The size of the extent, specified as an array [width, height].
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
fitSize(size: [number, number], object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
|
||||
fitSize(size: [number, number], object: ExtendedGeometryCollection): this;
|
||||
|
||||
/**
|
||||
* Returns true if x-reflection is enabled, which defaults to false.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
@@ -21,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"d3-geo-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
@@ -135,6 +135,10 @@ declare namespace daterangepicker {
|
||||
* A function that is passed each date in the two calendars before they are displayed, and may return true or false to indicate whether that date should be available for selection or not.
|
||||
*/
|
||||
isInvalidDate?(startDate: string | moment.Moment | Date, endDate?: string | moment.Moment | Date): boolean;
|
||||
/**
|
||||
* A function that is passed each date in the two calendars before they are displayed, and may return a string or array of CSS class names to apply to that date's calendar cell.
|
||||
*/
|
||||
isCustomDate?(date: string | moment.Moment | Date): string | string[] | undefined;
|
||||
/**
|
||||
* Indicates whether the date range picker should automatically update the value of an < input > element it's attached to at initialization and when the selected dates change.
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import decompress = require('decompress');
|
||||
import * as path from "path";
|
||||
|
||||
decompress('unicorn.zip', 'dist').then(files => {
|
||||
decompress('unicorn.zip', 'dist').then((files: decompress.File[]) => {
|
||||
console.log('done!');
|
||||
});
|
||||
|
||||
decompress('unicorn.zip', 'dist', {
|
||||
filter: file => path.extname(file.path) !== '.exe'
|
||||
}).then(files => {
|
||||
}).then((files: decompress.File[]) => {
|
||||
console.log('done!');
|
||||
});
|
||||
|
||||
@@ -16,6 +16,6 @@ decompress('unicorn.zip', 'dist', {
|
||||
file.path = `unicorn-${file.path}`;
|
||||
return file;
|
||||
}
|
||||
}).then(files => {
|
||||
}).then((files: decompress.File[]) => {
|
||||
console.log('done!');
|
||||
});
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
export = decompress;
|
||||
|
||||
declare function decompress(input: string | Buffer, output: string, opts?: decompress.DecompressOptions): Promise<decompress.File>;
|
||||
declare function decompress(input: string | Buffer, output: string, opts?: decompress.DecompressOptions): Promise<decompress.File[]>;
|
||||
|
||||
declare namespace decompress {
|
||||
interface File {
|
||||
|
||||
Vendored
+7
-4
@@ -18,10 +18,13 @@ export type BrowserName =
|
||||
"phantomjs" |
|
||||
"safari" |
|
||||
"vivaldi" |
|
||||
"yandexbrowser";
|
||||
"yandexbrowser" |
|
||||
"node";
|
||||
|
||||
export function detect(): null | {
|
||||
name: BrowserName | "node";
|
||||
export interface BrowserInfo {
|
||||
name: BrowserName;
|
||||
version: string;
|
||||
os: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function detect(): null | BrowserInfo;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
declare var describe: (test: string, callback: () => void) => void;
|
||||
declare var beforeAll: (callback: () => void) => void;
|
||||
declare var afterAll: (callback: () => void) => void;
|
||||
declare var test: (test: string, callback: () => void) => void;
|
||||
|
||||
describe('Test', () => {
|
||||
beforeAll(async () => {
|
||||
await device.reloadReactNative();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await element(by.id('element')).clearText();
|
||||
});
|
||||
|
||||
test('Test', async () => {
|
||||
await element(by.id('element')).replaceText('text');
|
||||
await element(by.id('element')).tap();
|
||||
await expect(element(by.id('element')).atIndex(0)).toNotExist();
|
||||
|
||||
await waitFor(element(by.id('element'))).toBeVisible().withTimeout(2000);
|
||||
});
|
||||
});
|
||||
Vendored
+408
@@ -0,0 +1,408 @@
|
||||
// Type definitions for detox 7.3
|
||||
// Project: https://github.com/wix/detox
|
||||
// Definitions by: Tareq El-Masri <https://github.com/TareqElMasri>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare const detox: Detox.Detox;
|
||||
declare const device: Detox.Device;
|
||||
declare const element: Detox.Element;
|
||||
declare const waitFor: Detox.WaitFor;
|
||||
declare const expect: Detox.Expect<Detox.Expect<any>>;
|
||||
declare const by: Detox.Matchers;
|
||||
|
||||
declare namespace Detox {
|
||||
interface Detox {
|
||||
/**
|
||||
* The setup phase happens inside detox.init(). This is the phase where detox reads its configuration, starts a server, loads its expection library and starts a simulator
|
||||
* @param config
|
||||
* @param options
|
||||
* @example const config = require('../package.json').detox;
|
||||
*
|
||||
* before(async () => {
|
||||
* await detox.init(config);
|
||||
* });
|
||||
*/
|
||||
init(config: any, options: DetoxInitOptions): Promise<void>;
|
||||
/**
|
||||
* Artifacts currently include only logs from the app process before each task
|
||||
* @param args
|
||||
*/
|
||||
beforeEach(...args: any[]): Promise<void>;
|
||||
/**
|
||||
* Artifacts currently include only logs from the app process after each task
|
||||
* @param args
|
||||
*/
|
||||
afterEach(...args: any[]): Promise<void>;
|
||||
/**
|
||||
* The cleanup phase should happen after all the tests have finished. This is the phase where detox-server shuts down.
|
||||
* @example after(async () => {
|
||||
* await detox.cleanup();
|
||||
* });
|
||||
*/
|
||||
cleanup(): Promise<void>;
|
||||
}
|
||||
interface Device {
|
||||
/**
|
||||
* Launch the app
|
||||
* @param config
|
||||
* @example // Terminate the app and launch it again. If set to false, the simulator will try to bring app from background,
|
||||
* // if the app isn't running, it will launch a new instance. default is false
|
||||
* await device.launchApp({newInstance: true});
|
||||
* // Grant or deny runtime permissions for your application.
|
||||
* await device.launchApp({permissions: {calendar: 'YES'}});
|
||||
* // Mock opening the app from URL to test your app's deep link handling mechanism.
|
||||
* await device.launchApp({url: url});
|
||||
*/
|
||||
launchApp(config: DeviceLanchAppConfig): Promise<void>;
|
||||
/**
|
||||
* By default, terminateApp() with no params will terminate the app
|
||||
* To terminate another app, specify its bundle id
|
||||
* @param bundle
|
||||
* @example await device.terminateApp('other.bundle.id');
|
||||
*/
|
||||
terminateApp(bundle?: string): Promise<void>;
|
||||
/**
|
||||
* Send application to background by bringing com.apple.springboard to the foreground.
|
||||
* Combining sendToHome() with launchApp({newInstance: false}) will simulate app coming back from background.
|
||||
* @example await device.sendToHome();
|
||||
* await device.launchApp({newInstance: false});
|
||||
*/
|
||||
sendToHome(): Promise<void>;
|
||||
/**
|
||||
* If this is a React Native app, reload the React Native JS bundle. This action is much faster than device.launchApp(), and can be used if you just need to reset your React Native logic.
|
||||
* @example await device.reloadReactNative()
|
||||
*/
|
||||
reloadReactNative(): Promise<void>;
|
||||
/**
|
||||
* By default, installApp() with no params will install the app file defined in the current configuration.
|
||||
* To install another app, specify its path
|
||||
* @param path
|
||||
* @example await device.installApp('path/to/other/app');
|
||||
*/
|
||||
installApp(path?: any): Promise<void>;
|
||||
/**
|
||||
* By default, uninstallApp() with no params will uninstall the app defined in the current configuration.
|
||||
* To uninstall another app, specify its bundle id
|
||||
* @param bundle
|
||||
* @example await device.installApp('other.bundle.id');
|
||||
*/
|
||||
uninstallApp(bundle?: string): Promise<void>;
|
||||
/**
|
||||
* Mock opening the app from URL. sourceApp is an optional parameter to specify source application bundle id.
|
||||
* @param url
|
||||
*/
|
||||
openURL(url: {url: string, sourceApp?: string}): Promise<void>;
|
||||
/**
|
||||
* Mock handling of received user notification when app is in foreground.
|
||||
* @param params
|
||||
*/
|
||||
sendUserNotification(...params: any[]): Promise<void>;
|
||||
/**
|
||||
* Mock handling of received user activity when app is in foreground.
|
||||
* @param params
|
||||
*/
|
||||
sendUserActivity(...params: any[]): Promise<void>;
|
||||
/**
|
||||
* Takes "portrait" or "landscape" and rotates the device to the given orientation. Currently only available in the iOS Simulator.
|
||||
* @param orientation
|
||||
*/
|
||||
setOrientation(orientation: Orientation): Promise<void>;
|
||||
/**
|
||||
* Note: setLocation is dependent on fbsimctl. if fbsimctl is not installed, the command will fail, it must be installed. Sets the simulator location to the given latitude and longitude.
|
||||
* @param lat
|
||||
* @param lon
|
||||
* @example await device.setLocation(32.0853, 34.7818);
|
||||
*/
|
||||
setLocation(lat: number, lon: number): Promise<void>;
|
||||
/**
|
||||
* Disable EarlGrey's network synchronization mechanism on preffered endpoints. Usful if you want to on skip over synchronizing on certain URLs.
|
||||
* @param urls
|
||||
* @example await device.setURLBlacklist(['.*127.0.0.1.*']);
|
||||
*/
|
||||
setURLBlacklist(urls: string[]): Promise<void>;
|
||||
/**
|
||||
* Enable EarlGrey's synchronization mechanism (enabled by default). This is being reset on every new instance of the app.
|
||||
* @example await device.enableSynchronization();
|
||||
*/
|
||||
enableSynchronization(): Promise<void>;
|
||||
/**
|
||||
* Disable EarlGrey's synchronization mechanism (enabled by default) This is being reset on every new instance of the app.
|
||||
* @example await device.disableSynchronization();
|
||||
*/
|
||||
disableSynchronization(): Promise<void>;
|
||||
/**
|
||||
* Resets the Simulator to clean state (like the Simulator > Reset Content and Settings... menu item), especially removing previously set permissions.
|
||||
* @example await device.resetContentAndSettings();
|
||||
*/
|
||||
resetContentAndSettings(): Promise<void>;
|
||||
/**
|
||||
* Returns the current device, ios or android.
|
||||
* @example if (device.getPlatform() === 'ios') {
|
||||
* await expect(loopSwitch).toHaveValue('1');
|
||||
* }
|
||||
*/
|
||||
getPlatform(): "ios" | "android";
|
||||
/**
|
||||
* Simulate shake (iOS Only)
|
||||
*/
|
||||
shake(): Promise<void>;
|
||||
}
|
||||
|
||||
type DetoxAny = Element & Actions<any> & WaitFor;
|
||||
|
||||
interface Element {
|
||||
(by: Matchers): DetoxAny;
|
||||
|
||||
/**
|
||||
* Select by parent element
|
||||
* @param parent
|
||||
* @example await element(by.id('Grandson883').withAncestor(by.id('Son883')));
|
||||
*/
|
||||
withAncestor(parent: Element): DetoxAny;
|
||||
/**
|
||||
* Select by child element
|
||||
* @param parent
|
||||
* @example await element(by.id('Son883').withDescendant(by.id('Grandson883')));
|
||||
*/
|
||||
withDescendant(child: Element): DetoxAny;
|
||||
/**
|
||||
* Choose from multiple elements matching the same matcher using index
|
||||
* @param index
|
||||
* @example await element(by.text('Product')).atIndex(2);
|
||||
*/
|
||||
atIndex(index: number): DetoxAny;
|
||||
}
|
||||
interface Matchers {
|
||||
/**
|
||||
* by.id will match an id that is given to the view via testID prop.
|
||||
* @param id
|
||||
* @example // In a React Native component add testID like so:
|
||||
* <TouchableOpacity testID={'tap_me'}>
|
||||
* // Then match with by.id:
|
||||
* await element(by.id('tap_me'));
|
||||
*/
|
||||
id(id: string): Matchers;
|
||||
/**
|
||||
* Find an element by text, useful for text fields, buttons.
|
||||
* @param text
|
||||
* @example await element(by.text('Tap Me'));
|
||||
*/
|
||||
text(text: string): Matchers;
|
||||
/**
|
||||
* Find an element by accessibilityLabel on iOS, or by contentDescription on Android.
|
||||
* @param label
|
||||
* @example await element(by.label('Welcome'));
|
||||
*/
|
||||
label(label: string): Matchers;
|
||||
/**
|
||||
* Find an element by native view type.
|
||||
* @param nativeViewType
|
||||
* @example await element(by.type('RCTImageView'));
|
||||
*/
|
||||
type(nativeViewType: string): Matchers;
|
||||
/**
|
||||
* Find an element with an accessibility trait. (iOS only)
|
||||
* @example await element(by.traits(['button']));
|
||||
*/
|
||||
traits(traits: string[]): Matchers;
|
||||
}
|
||||
interface Expect<R> {
|
||||
(element: Element): Expect<any>;
|
||||
/**
|
||||
* Expect the view to be at least 75% visible.
|
||||
* @example await expect(element(by.id('UniqueId204'))).toBeVisible();
|
||||
*/
|
||||
toBeVisible(): R;
|
||||
/**
|
||||
* Expect the view to not be visible.
|
||||
* @example await expect(element(by.id('UniqueId205'))).toBeNotVisible();
|
||||
*/
|
||||
toBeNotVisible(): R;
|
||||
/**
|
||||
* Expect the view to exist in the UI hierarchy.
|
||||
* @example await expect(element(by.id('UniqueId205'))).toExist();
|
||||
*/
|
||||
toExist(): R;
|
||||
/**
|
||||
* Expect the view to not exist in the UI hierarchy.
|
||||
* @example await expect(element(by.id('RandomJunk959'))).toNotExist();
|
||||
*/
|
||||
toNotExist(): R;
|
||||
/**
|
||||
* In React Native apps, expect UI component of type <Text> to have text.
|
||||
* In native iOS apps, expect UI elements of type UIButton, UILabel, UITextField or UITextViewIn to have inputText with text.
|
||||
* @param text
|
||||
* @example await expect(element(by.id('UniqueId204'))).toHaveText('I contain some text');
|
||||
*/
|
||||
toHaveText(text: string): R;
|
||||
/**
|
||||
* It searches by accessibilityLabel on iOS, or by contentDescription on Android.
|
||||
* In React Native it can be set for both platforms by defining an accessibilityLabel on the view.
|
||||
* @param label
|
||||
* @example await expect(element(by.id('UniqueId204'))).toHaveLabel('Done');
|
||||
*/
|
||||
toHaveLabel(label: string): R;
|
||||
/**
|
||||
* In React Native apps, expect UI component to have testID with that id.
|
||||
* In native iOS apps, expect UI element to have accesibilityIdentifier with that id.
|
||||
* @param id
|
||||
* @example await expect(element(by.text('I contain some text'))).toHaveId('UniqueId204');
|
||||
*/
|
||||
toHaveId(id: string): R;
|
||||
/**
|
||||
* Expect components like a Switch to have a value ('0' for off, '1' for on).
|
||||
* @param value
|
||||
* @example await expect(element(by.id('UniqueId533'))).toHaveValue('0');
|
||||
*/
|
||||
toHaveValue(value: any): R;
|
||||
}
|
||||
interface WaitFor {
|
||||
/**
|
||||
* This API polls using the given expectation continuously until the expectation is met. Use manual synchronization with waitFor only as a last resort.
|
||||
* NOTE: Every waitFor call must set a timeout using withTimeout(). Calling waitFor without setting a timeout will do nothing.
|
||||
* @example await waitFor(element(by.id('UniqueId336'))).toExist().withTimeout(2000);
|
||||
*/
|
||||
(element: Element): Expect<WaitFor>;
|
||||
/**
|
||||
* Waits for the condition to be met until the specified time (millis) have elapsed.
|
||||
* @param millis number
|
||||
* @example await waitFor(element(by.id('UniqueId336'))).toExist().withTimeout(2000);
|
||||
*/
|
||||
withTimeout(millis: number): Promise<void>;
|
||||
/**
|
||||
* Performs the action repeatedly on the element until an expectation is met
|
||||
* @param element
|
||||
* @example await waitFor(element(by.text('Text5'))).toBeVisible().whileElement(by.id('ScrollView630')).scroll(50, 'down');
|
||||
*/
|
||||
whileElement(by: Matchers): Element;
|
||||
}
|
||||
interface Actions<R> {
|
||||
/**
|
||||
* Simulate tap on an element
|
||||
* @example await element(by.id('tappable')).tap();
|
||||
*/
|
||||
tap(): Promise<Actions<R>>;
|
||||
/**
|
||||
* Simulate long press on an element
|
||||
* @example await element(by.id('tappable')).longPress();
|
||||
*/
|
||||
longPress(): Promise<Actions<R>>;
|
||||
/**
|
||||
* Simulate multiple taps on an element.
|
||||
* @param times number
|
||||
* @example await element(by.id('tappable')).multiTap(3);
|
||||
*/
|
||||
multiTap(times: number): Promise<Actions<R>>;
|
||||
/**
|
||||
* Simulate tap at a specific point on an element.
|
||||
* Note: The point coordinates are relative to the matched element and the element size could changes on different devices or even when changing the device font size.
|
||||
* @param point
|
||||
* @example await element(by.id('tappable')).tapAtPoint({ x:5, y:10 });
|
||||
*/
|
||||
tapAtPoint(point: { x: number, y: number }): Promise<Actions<R>>;
|
||||
/**
|
||||
* Use the builtin keyboard to type text into a text field.
|
||||
* @param text
|
||||
* @example await element(by.id('textField')).typeText('passcode');
|
||||
*/
|
||||
typeText(text: string): Promise<Actions<R>>;
|
||||
/**
|
||||
* Paste text into a text field.
|
||||
* @param text
|
||||
* @example await element(by.id('textField')).replaceText('passcode again');
|
||||
*/
|
||||
replaceText(text: string): Promise<Actions<R>>;
|
||||
/**
|
||||
* Clear text from a text field.
|
||||
* @example await element(by.id('textField')).clearText();
|
||||
*/
|
||||
clearText(): Promise<Actions<R>>;
|
||||
/**
|
||||
*
|
||||
* @param pixels
|
||||
* @param direction
|
||||
* @example
|
||||
* await element(by.id('scrollView')).scroll(100, 'down');
|
||||
* await element(by.id('scrollView')).scroll(100, 'up');
|
||||
*/
|
||||
scroll(pixels: number, direction: Direction): Actions<Promise<R>>;
|
||||
/**
|
||||
* Scroll to edge.
|
||||
* @param edge
|
||||
* @example await element(by.id('scrollView')).scrollTo('bottom');
|
||||
* await element(by.id('scrollView')).scrollTo('top');
|
||||
*/
|
||||
scrollTo(edge: Direction): Actions<Promise<R>>;
|
||||
/**
|
||||
*
|
||||
* @param direction
|
||||
* @param speed
|
||||
* @param percentage
|
||||
* @example await element(by.id('scrollView')).swipe('down');
|
||||
* await element(by.id('scrollView')).swipe('down', 'fast');
|
||||
* await element(by.id('scrollView')).swipe('down', 'fast', 0.5);
|
||||
*/
|
||||
swipe(direction: Direction, speed?: Speed, percentage?: number): Actions<Promise<R>>;
|
||||
/**
|
||||
* (iOS Only) column - number of datepicker column (starts from 0) value - string value in setted column (must be correct)
|
||||
* @param column
|
||||
* @param value
|
||||
* @example await expect(element(by.type('UIPickerView'))).toBeVisible();
|
||||
* await element(by.type('UIPickerView')).setColumnToValue(1,"6");
|
||||
* await element(by.type('UIPickerView')).setColumnToValue(2,"34");
|
||||
*/
|
||||
setColumnToValue(column: number, value: string): Actions<Promise<R>>;
|
||||
}
|
||||
|
||||
type Direction = "left" | "right" | "top" | "bottom" | "up" | "down";
|
||||
type Orientation = "portrait" | "landscape";
|
||||
type Speed = "fast" | "slow";
|
||||
|
||||
interface DetoxInitOptions {
|
||||
/**
|
||||
* Detox exports device, expect, element, by and waitFor as globals by default, if you want to control their initialization manually, set init detox with initGlobals set to false.
|
||||
* This is useful when during E2E tests you also need to run regular expectations in node. jest Expect for instance, will not be overriden by Detox when this option is used.
|
||||
*/
|
||||
initGlobals?: boolean;
|
||||
/**
|
||||
* By default await detox.init(config); will launch the installed app. If you wish to control when your app is launched, add {launchApp: false} param to your init.
|
||||
*/
|
||||
launchApp?: boolean;
|
||||
}
|
||||
|
||||
interface DeviceLanchAppConfig {
|
||||
/**
|
||||
* Restart the app
|
||||
* Terminate the app and launch it again. If set to false, the simulator will try to bring app from background, if the app isn't running, it will launch a new instance. default is false
|
||||
*/
|
||||
newInstance?: boolean;
|
||||
/**
|
||||
* Set runtime permissions
|
||||
* Grant or deny runtime permissions for your application.
|
||||
*/
|
||||
permissions?: any;
|
||||
/**
|
||||
* Launch from URL
|
||||
* Mock opening the app from URL to test your app's deep link handling mechanism.
|
||||
*/
|
||||
url?: any;
|
||||
/**
|
||||
* Launch with user notifications
|
||||
*/
|
||||
userNotification?: any;
|
||||
/**
|
||||
* Launch with user activity
|
||||
*/
|
||||
userActivity?: any;
|
||||
/**
|
||||
* Launch into a fresh installation
|
||||
* A flag that enables relaunching into a fresh installation of the app (it will uninstall and install the binary again), default is false.
|
||||
*/
|
||||
delete?: boolean;
|
||||
/**
|
||||
* Detox can start the app with additional launch arguments
|
||||
* The added launchArgs will be passed through the launch command to the device and be accessible via [[NSProcessInfo processInfo] arguments]
|
||||
*/
|
||||
launchArgs?: any;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"target": "ES2015",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"detox-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+3793
-548
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,418 @@
|
||||
declare var hiddenField: ASPxClientHiddenField;
|
||||
declare var mainCallbackPanel: ASPxClientCallbackPanel;
|
||||
declare var loginPopup: ASPxClientPopupControl;
|
||||
declare var searchButton: ASPxClientButton;
|
||||
declare var searchComboBox: ASPxClientComboBox;
|
||||
declare var roomsNumberSpinEdit: ASPxClientSpinEdit;
|
||||
declare var adultsNumberSpinEdit: ASPxClientSpinEdit;
|
||||
declare var childrenNumberSpinEdit: ASPxClientSpinEdit;
|
||||
declare var checkInDateEdit: ASPxClientDateEdit;
|
||||
declare var checkOutDateEdit: ASPxClientDateEdit;
|
||||
declare var backSlider: ASPxClientImageSlider;
|
||||
declare var locationComboBox: ASPxClientComboBox;
|
||||
declare var nightyRateTrackBar: ASPxClientTrackBar;
|
||||
declare var customerRatingTrackBar: ASPxClientTrackBar;
|
||||
declare var ourRatingCheckBoxList: ASPxClientCheckBoxList;
|
||||
declare var startFilterPopupControl: ASPxClientPopupControl;
|
||||
declare var imagePopupControl: ASPxClientPopupControl;
|
||||
declare var emailTextBox: ASPxClientTextBox;
|
||||
declare var creditCardEmailTextBox: ASPxClientTextBox;
|
||||
declare var accountEmailTextBox: ASPxClientTextBox;
|
||||
declare var bookingPageControl: ASPxClientPageControl;
|
||||
declare var paymentTypePageControl: ASPxClientPageControl;
|
||||
declare var offerFormPopup: ASPxClientPopupControl;
|
||||
declare var roomsSpinEdit: ASPxClientSpinEdit;
|
||||
declare var adultsSpinEdit: ASPxClientSpinEdit;
|
||||
declare var childrenSpinEdit: ASPxClientSpinEdit;
|
||||
declare var hotelDetailsCallbackPanel: ASPxClientCallbackPanel;
|
||||
declare var leftPanel: ASPxClientPanel;
|
||||
declare var menuButton: ASPxClientButton;
|
||||
declare var aboutWindow: ASPxClientPopupControl;
|
||||
declare var offersZone: ASPxClientDockZone;
|
||||
|
||||
module DXDemo {
|
||||
function showPage(page: string, params: { [key: string]: any }, skipHistory?: boolean): void {
|
||||
var queryString = getQueryString(params || {});
|
||||
hiddenField.Set("page", page);
|
||||
hiddenField.Set("parameters", queryString);
|
||||
hideMenu();
|
||||
var uri = queryString.length ? (page + "?" + queryString) : page;
|
||||
try {
|
||||
if (!skipHistory && window.history && window.history.pushState)
|
||||
window.history.pushState(uri, "", uri || "Default.aspx");
|
||||
} catch (e) { }
|
||||
mainCallbackPanel.PerformCallback(uri);
|
||||
};
|
||||
|
||||
export function onMainMenuItemClick(s: ASPxClientMenu, e: ASPxClientMenuItemClickEventArgs): void {
|
||||
switch (e.item.name) {
|
||||
case "login":
|
||||
hideMenu();
|
||||
setTimeout(function () { loginPopup.ShowAtElementByID("MainCallbackPanel_ContentPane"); }, 300);
|
||||
break;
|
||||
case "offers":
|
||||
showPage("SpecialOffers", {});
|
||||
break;
|
||||
default:
|
||||
hideMenu();
|
||||
setTimeout(function () { showAboutWindow(); }, 300);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
export function onLoginButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void {
|
||||
loginPopup.Hide();
|
||||
showAboutWindow();
|
||||
};
|
||||
|
||||
export function onSearchButtonClick(): void {
|
||||
if (ASPxClientEdit.ValidateGroup("DateEditors")) {
|
||||
showPage("ShowHotels", {
|
||||
location: searchComboBox.GetValue(),
|
||||
checkin: getFormattedDate(<Date>checkInDateEdit.GetValue()),
|
||||
checkout: getFormattedDate(<Date>checkOutDateEdit.GetValue()),
|
||||
rooms: roomsNumberSpinEdit.GetValue() || 1,
|
||||
adults: adultsNumberSpinEdit.GetValue() || 1,
|
||||
children: childrenNumberSpinEdit.GetValue() || 0
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export function onSearchComboBoxIndexChanged(s: ASPxClientComboBox, e: ASPxClientProcessingModeEventArgs): void {
|
||||
hideMenu();
|
||||
searchButton.AdjustControl();
|
||||
};
|
||||
|
||||
export function onIndexOfferCloseClick(index: number): void {
|
||||
var panel = <ASPxClientDockPanel>ASPxClientControl.GetControlCollection().GetByName("OfferDockPanel" + index);
|
||||
var sibPanel = <ASPxClientDockPanel>ASPxClientControl.GetControlCollection().GetByName("OfferDockPanel" + (index == 1 ? 2 : 1));
|
||||
panel.Hide();
|
||||
sibPanel.MakeFloat();
|
||||
sibPanel.SetWidth(offersZone.GetWidth());
|
||||
sibPanel.Dock(offersZone);
|
||||
};
|
||||
|
||||
export function onLogoClick(): void {
|
||||
showPage("", null, false);
|
||||
};
|
||||
|
||||
export function onMenuNavButtonCheckedChanged(s: ASPxClientCheckBox, e: ASPxClientProcessingModeEventArgs): void {
|
||||
var mainContainer = mainCallbackPanel.GetMainElement();
|
||||
if (s.GetChecked()) {
|
||||
backSlider.Pause();
|
||||
showMenu();
|
||||
}
|
||||
else {
|
||||
hideMenu();
|
||||
backSlider.Play();
|
||||
}
|
||||
};
|
||||
|
||||
export function onBackNavButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void {
|
||||
var params = getCurrentQueryParams();
|
||||
switch (getCurrentPage()) {
|
||||
case "PrintInvoice":
|
||||
showPage("Booking", params, false);
|
||||
break;
|
||||
case "Booking":
|
||||
if (bookingPageControl.GetActiveTabIndex() > 0)
|
||||
bookingPageControl.SetActiveTabIndex(bookingPageControl.GetActiveTabIndex() - 1);
|
||||
else
|
||||
showPage("ShowRooms", params, false);
|
||||
break;
|
||||
case "ShowRooms":
|
||||
showPage("ShowHotels", params, false);
|
||||
break;
|
||||
case "ShowDetails":
|
||||
showPage("ShowHotels", params, false);
|
||||
break;
|
||||
case "ShowHotels":
|
||||
case "SpecialOffers":
|
||||
showPage("", null, false);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
export function updateSearchResults(): void {
|
||||
var params = getCurrentQueryParams();
|
||||
params["location"] = locationComboBox.GetValue();
|
||||
params["minprice"] = nightyRateTrackBar.GetPositionStart();
|
||||
params["maxprice"] = nightyRateTrackBar.GetPositionEnd();
|
||||
params["custrating"] = customerRatingTrackBar.GetPosition();
|
||||
params["ourrating"] = ourRatingCheckBoxList.GetSelectedValues().join(",");
|
||||
showPage("ShowHotels", params);
|
||||
};
|
||||
|
||||
export function onBookHotelButtonClick(hotelID: string): void {
|
||||
var queryParams = getCurrentQueryParams();
|
||||
queryParams["hotelID"] = hotelID;
|
||||
showPage("ShowRooms", queryParams);
|
||||
};
|
||||
|
||||
export function onDetailsHotelButtonClick(hotelID: string): void {
|
||||
var queryParams = getCurrentQueryParams();
|
||||
queryParams["hotelID"] = hotelID;
|
||||
showPage("ShowDetails", queryParams);
|
||||
};
|
||||
|
||||
export function onShowStartFilterButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void {
|
||||
startFilterPopupControl.ShowAtElementByID("MainCallbackPanel_ContentPane");
|
||||
};
|
||||
|
||||
export function onChangeStartFilterButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void {
|
||||
if (ASPxClientEdit.ValidateGroup("DateEditors")) {
|
||||
var params = getCurrentQueryParams();
|
||||
params["checkin"] = getFormattedDate(<Date>checkInDateEdit.GetValue());
|
||||
params["checkout"] = getFormattedDate(<Date>checkOutDateEdit.GetValue());
|
||||
params["rooms"] = roomsNumberSpinEdit.GetValue() || 1;
|
||||
params["adults"] = adultsNumberSpinEdit.GetValue() || 1;
|
||||
params["children"] = childrenNumberSpinEdit.GetValue() || 0;
|
||||
startFilterPopupControl.Hide();
|
||||
showPage(hiddenField.Get("page").toString(), params);
|
||||
}
|
||||
};
|
||||
|
||||
export function onBookRoomButtonClick(roomID: string): void {
|
||||
var params = getCurrentQueryParams();
|
||||
params["roomID"] = roomID;
|
||||
showPage("Booking", params);
|
||||
};
|
||||
|
||||
export function onShowRoomsButtonClick(): void {
|
||||
var queryParams = getCurrentQueryParams();
|
||||
showPage("ShowRooms", queryParams);
|
||||
};
|
||||
|
||||
export function onShowDetailsButtonClick(): void {
|
||||
var queryParams = getCurrentQueryParams();
|
||||
showPage("ShowDetails", queryParams);
|
||||
};
|
||||
|
||||
export function onRoomImageNavItemClick(roomID: string, pictureName: string): void {
|
||||
setTimeout(function () {
|
||||
imagePopupControl.PerformCallback(roomID + "|" + pictureName);
|
||||
imagePopupControl.ShowAtElementByID("MainCallbackPanel_ContentPane");
|
||||
}, 500);
|
||||
};
|
||||
|
||||
export function onRoomsNavBarExpandedChanged(s: ASPxClientNavBar, e: ASPxClientNavBarGroupEventArgs): void {
|
||||
ASPxClientControl.AdjustControls(s.GetMainElement());
|
||||
};
|
||||
|
||||
export function onNextBookingStepButtonClick(step: number): void {
|
||||
var valid = true;
|
||||
var validationGroup = "";
|
||||
if (step == 1)
|
||||
validationGroup = "Account";
|
||||
if (step == 2)
|
||||
validationGroup = "RoomDetails";
|
||||
if (step == 3)
|
||||
validationGroup = "PaymentDetails";
|
||||
|
||||
switch (step) {
|
||||
case 1:
|
||||
valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "Account");
|
||||
if (valid) {
|
||||
emailTextBox.SetValue(accountEmailTextBox.GetValue());
|
||||
creditCardEmailTextBox.SetValue(accountEmailTextBox.GetValue());
|
||||
showPage("Booking", getCurrentQueryParams());
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "RoomDetails");
|
||||
emailTextBox.SetValue(accountEmailTextBox.GetValue());
|
||||
break;
|
||||
case 3:
|
||||
var paymentType = paymentTypePageControl.GetActiveTabIndex();
|
||||
if (paymentType == 0)
|
||||
valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "CreditCard");
|
||||
else if (paymentType == 1)
|
||||
valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "Cash");
|
||||
else if (paymentType == 2)
|
||||
valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "PayPal");
|
||||
break;
|
||||
}
|
||||
if (valid) {
|
||||
bookingPageControl.GetTab(step).SetEnabled(true);
|
||||
bookingPageControl.SetActiveTabIndex(step);
|
||||
}
|
||||
};
|
||||
|
||||
export function onAccountCaptchaHiddenFieldInit(s: ASPxClientHiddenField, e: ASPxClientEventArgs): void {
|
||||
if (s.Get("IsCaptchaValid")) {
|
||||
bookingPageControl.GetTab(1).SetEnabled(true);
|
||||
bookingPageControl.SetActiveTabIndex(1);
|
||||
}
|
||||
};
|
||||
|
||||
export function onFinishBookingStepButtonClick(): void {
|
||||
showAboutWindow();
|
||||
};
|
||||
|
||||
export function OnPrintInvoiceButtonClick(): void {
|
||||
showPage("PrintInvoice", getCurrentQueryParams());
|
||||
};
|
||||
|
||||
export function onOfferClick(offerID: string): void {
|
||||
offerFormPopup.SetContentHtml("");
|
||||
offerFormPopup.PerformCallback(offerID);
|
||||
var panel = <ASPxClientDockPanel>ASPxClientControl.GetControlCollection().GetByName("DockPanel" + offerID);
|
||||
var panelElement = <HTMLElement>panel.GetMainElement();
|
||||
if (panelElement.offsetWidth < 330 || panelElement.offsetHeight < 250) {
|
||||
offerFormPopup.SetWidth(400);
|
||||
offerFormPopup.SetHeight(280);
|
||||
offerFormPopup.ShowAtElementByID("SpecialOffersContainer");
|
||||
}
|
||||
else {
|
||||
offerFormPopup.SetWidth(panelElement.offsetWidth);
|
||||
offerFormPopup.SetHeight(panelElement.offsetHeight);
|
||||
offerFormPopup.ShowAtElement(panelElement);
|
||||
}
|
||||
};
|
||||
|
||||
export function onSpecialOfferCheckButtonClick(hotelID: string, locationID: string): void {
|
||||
if (ASPxClientEdit.ValidateGroup("DateEditors")) {
|
||||
var queryParams: { [key: string]: any } = {
|
||||
location: locationID,
|
||||
hotelID: hotelID,
|
||||
checkin: getFormattedDate(<Date>checkInDateEdit.GetValue()),
|
||||
checkout: getFormattedDate(<Date>checkOutDateEdit.GetValue()),
|
||||
rooms: roomsSpinEdit.GetValue() || 1,
|
||||
adults: adultsSpinEdit.GetValue() || 1,
|
||||
children: childrenSpinEdit.GetValue() || 0
|
||||
};
|
||||
showPage("ShowRooms", queryParams);
|
||||
}
|
||||
};
|
||||
|
||||
export function onIndexOfferClick(): void {
|
||||
showPage("SpecialOffers", {});
|
||||
};
|
||||
|
||||
export function onControlsInit(): void {
|
||||
ASPxClientUtils.AttachEventToElement(window, 'popstate', onHistoryPopState);
|
||||
var pathParts = document.location.href.split("/");
|
||||
var url = pathParts[pathParts.length - 1];
|
||||
try {
|
||||
if (window.history)
|
||||
window.history.replaceState(url, "");
|
||||
} catch (e) { }
|
||||
ASPxClientUtils.AttachEventToElement(window, "resize", onWindowResize);
|
||||
if (ASPxClientUtils.iOSPlatform) {
|
||||
// animate
|
||||
}
|
||||
};
|
||||
|
||||
export function updateRatingLabels(ratingControl: ASPxClientTrackBar) {
|
||||
var start = ratingControl.GetPositionStart().toString();
|
||||
var end = ratingControl.GetPositionEnd().toString();
|
||||
document.getElementById("cpLeftLabelID").innerHTML = start + " " + end;
|
||||
};
|
||||
|
||||
export function onRatingControlItemClick(s: ASPxClientRatingControl, e: ASPxClientRatingControlItemClickEventArgs): void {
|
||||
hotelDetailsCallbackPanel.PerformCallback(s.GetValue().toString());
|
||||
};
|
||||
|
||||
export function onInputKeyDown(s: ASPxClientTextBox, e: ASPxClientEditKeyEventArgs): void {
|
||||
var keyCode = ASPxClientUtils.GetKeyCode(e.htmlEvent);
|
||||
if (keyCode == 13)
|
||||
(<HTMLElement>s.GetInputElement()).blur();
|
||||
};
|
||||
|
||||
function getCurrentPage(): string {
|
||||
var hfPage = <string>hiddenField.Get("page");
|
||||
if (hfPage)
|
||||
return hfPage;
|
||||
var pathParts = document.location.pathname.split("/");
|
||||
return pathParts[pathParts.length - 1];
|
||||
};
|
||||
|
||||
function showAboutWindow(): void {
|
||||
aboutWindow.ShowAtElementByID("MainCallbackPanel_ContentPane");
|
||||
};
|
||||
|
||||
function hideMenu(): void {
|
||||
leftPanel.Collapse();
|
||||
if (menuButton.GetMainElement() && menuButton.GetChecked())
|
||||
menuButton.SetChecked(false);
|
||||
};
|
||||
|
||||
function showMenu(): void {
|
||||
leftPanel.Expand();
|
||||
};
|
||||
|
||||
var _resizeSpecialOffersTimeoutID = -1;
|
||||
function onWindowResize(): void {
|
||||
switch (<string>hiddenField.Get("page")) {
|
||||
case "SpecialOffers":
|
||||
if (_resizeSpecialOffersTimeoutID == -1)
|
||||
_resizeSpecialOffersTimeoutID = setTimeout(resizeSpecialOffers, 200);
|
||||
break;
|
||||
}
|
||||
hidePopups("AboutWindow", "StartFilterPopupControl", "LoginPopup", "OfferFormPopup", "ImagePopupControl");
|
||||
};
|
||||
|
||||
function hidePopups(...names: string[]): void {
|
||||
for (var i = 0; i < names.length; i++) {
|
||||
var popupControl = <ASPxClientPopupControl>ASPxClientControl.GetControlCollection().GetByName(names[i]);
|
||||
popupControl.Hide();
|
||||
}
|
||||
};
|
||||
|
||||
function resizeSpecialOffers(): void {
|
||||
for (var i = 1; i <= 4; i++) {
|
||||
var panel = <ASPxClientDockPanel>ASPxClientControl.GetControlCollection().GetByName("DockPanel" + i);
|
||||
if (panel && panel.IsVisible()) {
|
||||
var zone = panel.GetOwnerZone();
|
||||
zone.SetWidth((<HTMLElement>(<HTMLElement>zone.GetMainElement()).parentNode).offsetWidth)
|
||||
}
|
||||
}
|
||||
_resizeSpecialOffersTimeoutID = -1;
|
||||
};
|
||||
|
||||
function getFormattedDate(date: Date): string {
|
||||
return (date.getMonth() + 1) + "-" + date.getDate() + "-" + date.getFullYear();
|
||||
};
|
||||
|
||||
function getCurrentQueryParams(): { [key:string]: any } {
|
||||
var hfParams = <string>hiddenField.Get("parameters");
|
||||
if (hfParams)
|
||||
return getParamsByQueryString(hfParams);
|
||||
var query = document.location.search;
|
||||
if (query[0] === "?")
|
||||
query = query.substr(1);
|
||||
return getParamsByQueryString(query);
|
||||
};
|
||||
|
||||
function getQueryString(params: { [key:string]: any }): string {
|
||||
var queryItems: any[] = [];
|
||||
for (var key in params) {
|
||||
if (!params.hasOwnProperty(key)) continue;
|
||||
queryItems.push(key + "=" + params[key]);
|
||||
}
|
||||
if (queryItems.length > 0)
|
||||
return queryItems.join("&");
|
||||
return "";
|
||||
};
|
||||
|
||||
function getParamsByQueryString(queryString: string): { [key: string]: string } {
|
||||
var result: { [key: string]: any } = {};
|
||||
if (queryString) {
|
||||
var queryStringArray = queryString.split("&");
|
||||
for (var i = 0; i < queryStringArray.length; i++) {
|
||||
var part = queryStringArray[i].split('=');
|
||||
if (part.length != 2) continue;
|
||||
result[part[0]] = decodeURIComponent(part[1].replace(/\+/g, " "));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
function onHistoryPopState(evt: any): void {
|
||||
if (evt.state !== null && evt.state !== undefined) {
|
||||
var uriParts = evt.state.split("?");
|
||||
showPage(uriParts[0], getParamsByQueryString(uriParts[1]), true);
|
||||
}
|
||||
};
|
||||
}
|
||||
Vendored
+33698
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"devexpress-web": [
|
||||
"devexpress-web/v171"
|
||||
],
|
||||
"devexpress-web/*": [
|
||||
"devexpress-web/v171/*"
|
||||
]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"devexpress-web-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
+22
-11
@@ -3,11 +3,17 @@ const one = 'beep boop';
|
||||
const other = 'beep boob blah';
|
||||
|
||||
let diff = jsdiff.diffChars(one, other);
|
||||
printDiff(diff);
|
||||
|
||||
diff.forEach(part => {
|
||||
const mark = part.added ? '+' :
|
||||
part.removed ? '-' : ' ';
|
||||
console.log(`${mark} ${part.value}`);
|
||||
const diffArraysResult = jsdiff.diffArrays<string>(['a', 'b', 'c'], ['a', 'c', 'd']);
|
||||
diffArraysResult.forEach(result => {
|
||||
if (result.added) {
|
||||
console.log(`added ${result.value.length} line(s):`, ...result.value);
|
||||
} else if (result.removed) {
|
||||
console.log(`removed ${result.value.length} line(s):`, ...result.value);
|
||||
} else {
|
||||
console.log(`no changes`);
|
||||
}
|
||||
});
|
||||
|
||||
// --------------------------
|
||||
@@ -22,13 +28,13 @@ class LineDiffWithoutWhitespace extends jsdiff.Diff {
|
||||
}
|
||||
}
|
||||
|
||||
const obj = new LineDiffWithoutWhitespace(true);
|
||||
const obj = new LineDiffWithoutWhitespace();
|
||||
diff = obj.diff(one, other);
|
||||
printDiff(diff);
|
||||
|
||||
function printDiff(diff: jsdiff.IDiffResult[]) {
|
||||
function addLineHeader(decorator: string, str: string) {
|
||||
return str.split("\n").map((line, index, array) => {
|
||||
function addLineHeader(decorator: string, str: string | string[]) {
|
||||
return (typeof str === 'string' ? str.split("\n") : str).map((line, index, array) => {
|
||||
if (index === array.length - 1 && line === "") {
|
||||
return line;
|
||||
} else {
|
||||
@@ -52,7 +58,8 @@ function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUni
|
||||
const verifyPatch = jsdiff.parsePatch(
|
||||
jsdiff.createTwoFilesPatch("oldFile.ts", "newFile.ts", oldStr, newStr,
|
||||
"old", "new", { context: 1 }));
|
||||
if (JSON.stringify(verifyPatch) !== JSON.stringify(uniDiff)) {
|
||||
|
||||
if (JSON.stringify(verifyPatch[0], Object.keys(verifyPatch[0]).sort()) !== JSON.stringify(uniDiff, Object.keys(uniDiff).sort())) {
|
||||
console.error("Patch did not match uniDiff");
|
||||
}
|
||||
}
|
||||
@@ -82,7 +89,11 @@ function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUni
|
||||
});
|
||||
}
|
||||
|
||||
const uniDiff = jsdiff.structuredPatch("oldFile.ts", "newFile.ts", one, other,
|
||||
const uniDiffPatch = jsdiff.structuredPatch("oldFile.ts", "newFile.ts", one, other,
|
||||
"old", "new", { context: 1 });
|
||||
verifyPatchMethods(one, other, uniDiff);
|
||||
verifyApplyMethods(one, other, uniDiff);
|
||||
verifyPatchMethods(one, other, uniDiffPatch);
|
||||
|
||||
const uniDiffStr = jsdiff.createPatch("file.ts", one, other, "old", "new",
|
||||
{ context: 1 });
|
||||
const uniDiffApply = jsdiff.parsePatch(uniDiffStr)[0];
|
||||
verifyApplyMethods(one, other, uniDiffApply);
|
||||
|
||||
Vendored
+38
-15
@@ -1,6 +1,7 @@
|
||||
// Type definitions for diff 3.2
|
||||
// Type definitions for diff 3.5
|
||||
// Project: https://github.com/kpdecker/jsdiff
|
||||
// Definitions by: vvakame <https://github.com/vvakame>
|
||||
// szdc <https://github.com/szdc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -8,15 +9,19 @@ export = JsDiff;
|
||||
export as namespace JsDiff;
|
||||
|
||||
declare namespace JsDiff {
|
||||
interface ICaseOptions {
|
||||
interface IOptions {
|
||||
ignoreCase: boolean;
|
||||
}
|
||||
|
||||
interface ILinesOptions {
|
||||
interface ILinesOptions extends IOptions {
|
||||
ignoreWhitespace?: boolean;
|
||||
newlineIsToken?: boolean;
|
||||
}
|
||||
|
||||
interface IArrayOptions extends IOptions {
|
||||
comparator?: (left: any, right: any) => number;
|
||||
}
|
||||
|
||||
interface IDiffResult {
|
||||
value: string;
|
||||
count?: number;
|
||||
@@ -24,6 +29,13 @@ declare namespace JsDiff {
|
||||
removed?: boolean;
|
||||
}
|
||||
|
||||
interface IDiffArraysResult<T> {
|
||||
value: T[];
|
||||
count?: number;
|
||||
added?: boolean;
|
||||
removed?: boolean;
|
||||
}
|
||||
|
||||
interface IBestPath {
|
||||
newPos: number;
|
||||
componenets: IDiffResult[];
|
||||
@@ -42,38 +54,45 @@ declare namespace JsDiff {
|
||||
newFileName: string;
|
||||
oldHeader: string;
|
||||
newHeader: string;
|
||||
index: string;
|
||||
hunks: IHunk[];
|
||||
}
|
||||
|
||||
class Diff {
|
||||
ignoreWhitespace: boolean;
|
||||
diff(oldString: string, newString: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
constructor(ignoreWhitespace?: boolean);
|
||||
|
||||
diff(oldString: string, newString: string): IDiffResult[];
|
||||
|
||||
pushComponent(components: IDiffResult[], value: string, added: boolean, removed: boolean): void;
|
||||
pushComponent(components: IDiffResult[], added: boolean, removed: boolean): void;
|
||||
|
||||
extractCommon(basePath: IBestPath, newString: string, oldString: string, diagonalPath: number): number;
|
||||
|
||||
equals(left: string, right: string): boolean;
|
||||
|
||||
join(left: string, right: string): string;
|
||||
removeEmpty(array: any[]): any[];
|
||||
|
||||
castInput(value: any): any;
|
||||
|
||||
join(chars: string[]): string;
|
||||
|
||||
tokenize(value: string): any; // return types are string or string[]
|
||||
}
|
||||
|
||||
function diffChars(oldStr: string, newStr: string, options?: ICaseOptions): IDiffResult[];
|
||||
function diffChars(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffWords(oldStr: string, newStr: string, options?: ICaseOptions): IDiffResult[];
|
||||
function diffWords(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffWordsWithSpace(oldStr: string, newStr: string): IDiffResult[];
|
||||
function diffWordsWithSpace(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffJson(oldObj: object, newObj: object): IDiffResult[];
|
||||
function diffJson(oldObj: object, newObj: object, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[];
|
||||
|
||||
function diffCss(oldStr: string, newStr: string): IDiffResult[];
|
||||
function diffCss(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffTrimmedLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[];
|
||||
|
||||
function diffSentences(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffArrays<T>(oldArr: T[], newArr: T[], options?: IArrayOptions): Array<IDiffArraysResult<T>>;
|
||||
|
||||
function createPatch(fileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string;
|
||||
|
||||
@@ -94,4 +113,8 @@ declare namespace JsDiff {
|
||||
function convertChangesToXML(changes: IDiffResult[]): string;
|
||||
|
||||
function convertChangesToDMP(changes: IDiffResult[]): Array<{0: number; 1: string; }>;
|
||||
|
||||
function merge(mine: string, theirs: string, base: string): IUniDiff;
|
||||
|
||||
function canonicalize(obj: any, stack: any[], replacementStack: any[]): any;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import * as dnssd from 'dnssd';
|
||||
|
||||
const serviceType = new dnssd.ServiceType(dnssd.tcp('_mqtt'), dnssd.udp('_mqtt'));
|
||||
|
||||
const advertisement = new dnssd.Advertisement(serviceType, 1883, { name: 'broker' });
|
||||
const browser: dnssd.Browser = new dnssd.Browser(serviceType);
|
||||
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
// Type definitions for dnssd 0.3
|
||||
// Project: https://github.com/DeMille/dnssd.js#readme
|
||||
// Definitions by: Angel Merino <https://github.com/angelmerino>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
/** Declaration file generated by dts-gen */
|
||||
|
||||
export class Advertisement {
|
||||
constructor(type: any, port: any, ...args: any[]);
|
||||
|
||||
start(): any;
|
||||
|
||||
stop(forceImmediate: any, callback: any): void;
|
||||
|
||||
updateTXT(txtObj: any): void;
|
||||
}
|
||||
|
||||
export class Browser {
|
||||
constructor(type: any, ...args: any[]);
|
||||
|
||||
list(): any;
|
||||
|
||||
start(): any;
|
||||
|
||||
stop(): any;
|
||||
}
|
||||
|
||||
export class ServiceType {
|
||||
constructor(...args: any[]);
|
||||
|
||||
toString(): any;
|
||||
|
||||
static all(): any;
|
||||
|
||||
static tcp(...args: any[]): any;
|
||||
|
||||
static udp(...args: any[]): any;
|
||||
}
|
||||
|
||||
export const resolveA: any;
|
||||
|
||||
export const resolveAAAA: any;
|
||||
|
||||
export function all(): any;
|
||||
|
||||
export function resolve(name: any, type: any, ...args: any[]): any;
|
||||
|
||||
export function resolveSRV(name: any, opts: any): any;
|
||||
|
||||
export function resolveService(name: any, ...args: any[]): any;
|
||||
|
||||
export function resolveTXT(name: any, opts: any): any;
|
||||
|
||||
export function tcp(...args: any[]): any;
|
||||
|
||||
export function udp(...args: any[]): any;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dnssd-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,16 @@
|
||||
import { parsed, contentLoaded, loaded } from 'document-promises';
|
||||
|
||||
let promise: Promise<void>;
|
||||
promise = parsed;
|
||||
promise = contentLoaded;
|
||||
promise = loaded;
|
||||
|
||||
parsed.then(() => {
|
||||
// Document parsed
|
||||
});
|
||||
contentLoaded.then(() => {
|
||||
// Document is ready
|
||||
});
|
||||
loaded.then(() => {
|
||||
// Document loaded
|
||||
});
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// Type definitions for document-promises 3.1
|
||||
// Project: https://github.com/jonathantneal/document-promises#readme
|
||||
// Definitions by: Tiger Oakes <https://github.com/NotWoods>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* document.parsed is a promise that fulfills when the document is parsed
|
||||
* and `readyState` is `interactive`, before deferred and async scripts have run.
|
||||
*/
|
||||
export const parsed: Promise<void>;
|
||||
|
||||
/**
|
||||
* document.contentLoaded is a promise that fulfills when the document is
|
||||
* parsed, blocking scripts have completed, and `DOMContentLoaded` fires.
|
||||
*/
|
||||
export const contentLoaded: Promise<void>;
|
||||
|
||||
/**
|
||||
* document.loaded is a promise that fulfills when the document is parsed,
|
||||
* blocking scripts have completed, images, scripts, links and sub-frames
|
||||
* have finished loading, and `readyState` is `complete`.
|
||||
*/
|
||||
export const loaded: Promise<void>;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"document-promises-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,21 @@
|
||||
import * as webpack from 'webpack';
|
||||
import DotenvWebpackPlugin = require('dotenv-webpack');
|
||||
|
||||
new DotenvWebpackPlugin(); // $ExpectType DotenvWebpackPlugin
|
||||
|
||||
const options: DotenvWebpackPlugin.Options = {
|
||||
path: './some.other.env',
|
||||
safe: true,
|
||||
systemvars: true,
|
||||
silent: true
|
||||
};
|
||||
|
||||
const config: webpack.Configuration = {
|
||||
plugins: [
|
||||
new DotenvWebpackPlugin(),
|
||||
new DotenvWebpackPlugin({
|
||||
path: './some.other.env',
|
||||
}),
|
||||
new DotenvWebpackPlugin(options),
|
||||
]
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user