mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
Merge 20dec (#13471)
* base-64 typings * formatting and indenting * feat: add typings for watchpack * fix: improve missing typings * Port from https://github.com/agileek/typings-vis/blob/master/vs.d.ts * Fix travis build failures * Port PR https://github.com/agileek/typings-vis/pull/12 * Fix travis build failures * added tsconfig and tslint * removed patch number * added tests * made it export like base64-js * removed old code * formatted code * fix: add files field in tsconfig.json for expected publishment * fix: improve most missing typings * feat: upgrade to v3.0.0 * feat: upgrade to tapbale v0.2.5 * Types 2.0 (#13261) * updating typing of the latest 7.0 react-autosuggest * updating typing of react-autosuggest 7.0 * update typings for react-autosuggest 7.0 * Remove '+' from header versions, so they can be parsed (#13239) * Updated masonry-layout to fix linting errors (#13272) * Updated masonry-layout to fix linting errors * Fixed the tests I could fix. * Removed patch version * Add redux-persist and basic transformers (#13389) * Add definitions for redux-persist * Add missin generic types * Add definitions for filter transformer * Add definitions for encrypt transformer * Fix header * Add definitions for compress transformer * Delete unnecessary linter configs * Change way of importing, fix tests * fix: angulartics type definition for ES6 import * fix: lint error * fix scalar type config (#13398) The `GraphQLScalarTypeConfig` interface had incorrect types. Correct types may be seen here: https://github.com/graphql/graphql-js/blob/379a3084392179d2cae92c211a4559f9836299c6/src/type/definition.js#L348-L350 * [interact.js] Update module names (#13316) Update CommonJS module name as it was changed in version 1.2.7. AMD module name is also different from both new and old CommonJS module names, so a separate declaration was created for that as well. * Add definitions for redux-recycle (#13424) * Add definitions for redux-recycle * Fix linter errors * [jest] add type definition for toHaveBeenLastCalledWith (#13038) * remove ajv because the package bundles its own types (#13028) * Updated type definitions to yfiles for HTML 2.0. (#13332) * Updated type definitions to yFiles for HTML 2.0. * Updated type definitions to yfiles for HTML 2.0. * Added contact in yfiles .d.ts header. * Add redux-batched-actions typings. (#13054) * Add types for mailgen (#13080) * Typings for cordova-sqlite-storage (#13081) * Add flatpickr definitions (#13083) * Add pouch-redux-middleware typing (#13071) * Add pouch-redux-middleware typing * Fix <> in comment * Add declaration for crc (#13068) * Updated jquery.dataTables for 1.10.9 (#13099) Release Notes: https://cdn.datatables.net/1.10.9/ * Moved legacy browser settings to its own data type. * Added 'aIds' property on legacy settings object for mapping row ids to data indexes. * Added 'rowIdFn' function to legacy settings object to get a row's id from the row's data. * chore(lint): change vis typing to external module (#13399) * Fix cordova-sqlite-storage lint * Lint `vis`: Remove "I" prefix for namespaces * Change cordova-sqlite-storage back. Linter was wrong.
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
/// <reference types="ajv" />
|
||||
|
||||
import * as Ajv from 'ajv';
|
||||
var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true}
|
||||
var validate = ajv.compile({});
|
||||
var valid = validate({});
|
||||
if (!valid) console.log(validate.errors);
|
||||
|
||||
var valid = ajv.validate({}, {});
|
||||
if (!valid) console.log(ajv.errors);
|
||||
|
||||
ajv.addSchema({}, 'mySchema');
|
||||
var valid = ajv.validate('mySchema', {});
|
||||
if (!valid) console.log(ajv.errorsText());
|
||||
|
||||
ajv.addKeyword('range', {
|
||||
type: 'number', compile: function (sch, parentSchema) {
|
||||
var min: any = sch[0];
|
||||
var max: any = sch[1];
|
||||
|
||||
return parentSchema.exclusiveRange === true
|
||||
? function (data) { return data > min && data < max; }
|
||||
: function (data) { return data >= min && data <= max; }
|
||||
}
|
||||
});
|
||||
|
||||
var schema = { "range": [2, 4], "exclusiveRange": true };
|
||||
var validate = ajv.compile(schema);
|
||||
console.log(validate(2.01)); // true
|
||||
console.log(validate(3.99)); // true
|
||||
console.log(validate(2)); // false
|
||||
console.log(validate(4)); // false
|
||||
|
||||
declare var request: any;
|
||||
function loadSchema(uri: any, callback: any) {
|
||||
request.json(uri, function (err: any, res: any, body: any) {
|
||||
if (err || res.statusCode >= 400)
|
||||
callback(err || new Error('Loading error: ' + res.statusCode));
|
||||
else
|
||||
callback(null, body);
|
||||
});
|
||||
}
|
||||
var ajv = new Ajv({ loadSchema: loadSchema });
|
||||
|
||||
ajv.compileAsync(schema, function (err, validate) {
|
||||
if (err) return;
|
||||
var valid = validate({});
|
||||
});
|
||||
|
||||
declare var knex: any;
|
||||
function checkIdExists(schema: any, data: any) {
|
||||
return knex(schema.table)
|
||||
.select('id')
|
||||
.where('id', data)
|
||||
.then(function (rows: any) {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
var validate = ajv.compile(schema);
|
||||
|
||||
(validate({ userId: 1, postId: 19 }) as PromiseLike<boolean>)
|
||||
.then(function (valid) {
|
||||
// "valid" is always true here
|
||||
console.log('Data is valid');
|
||||
}, function (err) {
|
||||
if (!(err instanceof Ajv.ValidationError)) throw err;
|
||||
// data is invalid
|
||||
console.log('Validation errors:', err.errors);
|
||||
});
|
||||
|
||||
var ajv = new Ajv({ /* async: 'es7', */ transpile: 'nodent' });
|
||||
var validate = ajv.compile(schema); // transpiled es7 async function
|
||||
(validate({}) as PromiseLike<any>).then(() => { }, () => { });
|
||||
Vendored
-114
@@ -1,114 +0,0 @@
|
||||
// Type definitions for ajv
|
||||
// Project: https://github.com/epoberezkin/ajv
|
||||
// Definitions by: York Yao <https://github.com/plantain-00/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Ajv {
|
||||
/**
|
||||
* Create Ajv instance.
|
||||
*/
|
||||
constructor(options?: Ajv.AjvOptions);
|
||||
/**
|
||||
* Generate validating function and cache the compiled schema for future use.
|
||||
*/
|
||||
compile(schema: any): Ajv.AjvValidate;
|
||||
/**
|
||||
* Asyncronous version of compile method that loads missing remote schemas using asynchronous function in options.loadSchema.
|
||||
*/
|
||||
compileAsync(schema: any, callback: (error: Error, validate: Ajv.AjvValidate) => void): void;
|
||||
/**
|
||||
* Validate data using passed schema (it will be compiled and cached).
|
||||
*/
|
||||
validate(schema: any, data: any): boolean | PromiseLike<boolean>;
|
||||
errors: Ajv.ValidationError[];
|
||||
/**
|
||||
* Add schema(s) to validator instance.
|
||||
*/
|
||||
addSchema(schema: any, key: string): void;
|
||||
/**
|
||||
* Adds meta schema(s) that can be used to validate other schemas.
|
||||
* That function should be used instead of addSchema because there may be instance options that would compile a meta schema incorrectly (at the moment it is removeAdditional option).
|
||||
*/
|
||||
addMetaSchema(schema: any, key: string): void;
|
||||
/**
|
||||
* Validates schema.
|
||||
* This method should be used to validate schemas rather than validate due to the inconsistency of uri format in JSON-Schema standard.
|
||||
*/
|
||||
validateSchema(schema: any): Boolean;
|
||||
/**
|
||||
* Retrieve compiled schema previously added with addSchema by the key passed to addSchema or by its full reference (id).
|
||||
* Returned validating function has schema property with the reference to the original schema.
|
||||
*/
|
||||
getSchema(key: string): Ajv.AjvValidate;
|
||||
/**
|
||||
* Remove added/cached schema.
|
||||
* Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references.
|
||||
*/
|
||||
removeSchema(schema: any): void;
|
||||
/**
|
||||
* Add custom format to validate strings. It can also be used to replace pre-defined formats for Ajv instance.
|
||||
*/
|
||||
addFormat(name: string, format: any): void;
|
||||
/**
|
||||
* Add custom validation keyword to Ajv instance.
|
||||
*/
|
||||
addKeyword(keyword: string, definition: Ajv.AjxKeywordDefinition): void;
|
||||
errorsText(): any;
|
||||
static ValidationError: Function;
|
||||
}
|
||||
declare namespace Ajv {
|
||||
type AjvOptions = {
|
||||
v5?: boolean;
|
||||
allErrors?: boolean;
|
||||
verbose?: boolean;
|
||||
jsonPointers?: boolean;
|
||||
uniqueItems?: boolean;
|
||||
unicode?: boolean;
|
||||
format?: string;
|
||||
formats?: any;
|
||||
unknownFormats?: true | string[] | "ignore";
|
||||
schemas?: any;
|
||||
missingRefs?: true | "ignore" | "fail";
|
||||
extendRefs?: true | "ignore" | "fail";
|
||||
loadSchema?(uri: string, callback: (error: Error, body: any) => void): void;
|
||||
removeAdditional?: boolean | "all" | "failing";
|
||||
useDefaults?: boolean | "shared";
|
||||
coerceTypes?: boolean | "array";
|
||||
async?: any;
|
||||
transpile?: string;
|
||||
meta?: boolean;
|
||||
validateSchema?: boolean | "log";
|
||||
addUsedSchema?: boolean;
|
||||
inlineRefs?: boolean | number;
|
||||
passContext?: boolean;
|
||||
loopRequired?: number;
|
||||
ownProperties?: boolean;
|
||||
multipleOfPrecision?: boolean | number;
|
||||
errorDataPath?: string,
|
||||
messages?: boolean;
|
||||
beautify?: boolean;
|
||||
cache?: any;
|
||||
}
|
||||
type AjvValidate = ((data: any) => boolean | PromiseLike<boolean>) & {
|
||||
errors: ValidationError[];
|
||||
}
|
||||
type AjxKeywordDefinition = {
|
||||
async?: boolean;
|
||||
type: string;
|
||||
compile?: (schema: any, parentsSchema: any) => ((data: any) => boolean | PromiseLike<boolean>);
|
||||
validate?: (schema: any, data: any) => boolean;
|
||||
}
|
||||
type ValidationError = {
|
||||
keyword: string;
|
||||
dataPath: string;
|
||||
schemaPath: string;
|
||||
params: any;
|
||||
message: string;
|
||||
schema: any;
|
||||
parentSchema: any;
|
||||
data: any;
|
||||
}
|
||||
}
|
||||
|
||||
export = Ajv;
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular Material 1.1.0-rc5+ (angular.material module)
|
||||
// Type definitions for Angular Material (angular.material module) 1.1
|
||||
// Project: https://github.com/angular/material
|
||||
// Definitions by: Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for angular-ui-router-default 0.5+
|
||||
// Type definitions for angular-ui-router-default 0.5
|
||||
// Project: https://github.com/nonplus/angular-ui-router-default
|
||||
// Definitions by: Stepan Riha <https://github.com/nonplus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for angular-ui-uib-modal 0.11+ (ui.router module)
|
||||
// Type definitions for angular-ui-uib-modal (ui.router module) 0.11
|
||||
// Project: https://github.com/nonplus/angular-ui-router-uib-modal
|
||||
// Definitions by: Stepan Riha <https://github.com/nonplus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.1.5+ (ui.router module)
|
||||
// Type definitions for Angular JS (ui.router module) 1.1.5
|
||||
// Project: https://github.com/angular-ui/ui-router
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.3.1+ (ui.scroll module)
|
||||
// Type definitions for Angular JS (ui.scroll module) 1.3.1
|
||||
// Project: https://github.com/angular-ui/ui-scroll
|
||||
// Definitions by: Mark Nadig <https://github.com/marknadig>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for angular.ui.sortable module v0.13+
|
||||
// Type definitions for angular.ui.sortable module 0.13
|
||||
// Project: https://github.com/angular-ui/ui-sortable
|
||||
// Definitions by: Thodoris Greasidis <https://github.com/thgreasi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import * as angular from 'angular';
|
||||
import { angulartics } from 'angulartics';
|
||||
|
||||
namespace Analytics {
|
||||
angular.module("angulartics.app", ["angulartics"])
|
||||
.config(["$analyticsProvider", ($analyticsProvider:angulartics.IAnalyticsServiceProvider) => {
|
||||
@@ -36,3 +39,4 @@ namespace Analytics {
|
||||
$analytics.setSuperProperties({ role: 'admin' });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+8
-7
@@ -1,19 +1,20 @@
|
||||
// Type definitions for Angulartics v1.3.0
|
||||
// Type definitions for Angulartics 1.3
|
||||
// Project: http://luisfarzati.github.io/angulartics/
|
||||
// Definitions by: Steven Fan <https://github.com/stevenfan>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="angular" />
|
||||
import * as angular from 'angular';
|
||||
|
||||
declare namespace angulartics {
|
||||
|
||||
interface IAngularticsStatic {
|
||||
waitForVendorApi(objectName:string, delay:number, containsField?:any, registerFn?:any, onTimeout?:boolean): void;
|
||||
waitForVendorApi(objectName: string, delay: number, containsField?: any, registerFn?: any, onTimeout?: boolean): void;
|
||||
}
|
||||
|
||||
interface IAnalyticsService {
|
||||
eventTrack(eventName: string, properties?: any): any;
|
||||
getOptOut(): boolean;
|
||||
pageTrack(path:string, location?:angular.ILocationService): any;
|
||||
pageTrack(path: string, location?: angular.ILocationService): any;
|
||||
setAlias(alias: string): any;
|
||||
setOptOut(value: boolean): void;
|
||||
setUsername(username: string): any;
|
||||
@@ -32,7 +33,7 @@ declare namespace angulartics {
|
||||
trackRoutes(value: boolean): void;
|
||||
trackStates(value: boolean): void;
|
||||
|
||||
registerPageTrack(callback:(path:string, location?:angular.ILocationService) => any): void;
|
||||
registerPageTrack(callback: (path: string, location?: angular.ILocationService) => any): void;
|
||||
registerEventTrack(callback: (eventName: string, properties?: any) => any): void;
|
||||
registerSetAlias(callback: (alias: string) => any): void;
|
||||
registerSetUsername(callback: (username: string) => any): void;
|
||||
@@ -47,8 +48,8 @@ declare namespace angulartics {
|
||||
autoBasePath: boolean
|
||||
},
|
||||
developerMode: boolean
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
declare var angulartics:angulartics.IAngularticsStatic;
|
||||
declare var angulartics: angulartics.IAngularticsStatic;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import * as base64 from 'base-64';
|
||||
import * as utf8 from 'utf8';
|
||||
|
||||
let text = 'foo © bar 𝌆 baz';
|
||||
let bytes = utf8.encode(text);
|
||||
let encoded = base64.encode(bytes);
|
||||
// → 'Zm9vIMKpIGJhciDwnYyGIGJheg=='
|
||||
|
||||
encoded = 'Zm9vIMKpIGJhciDwnYyGIGJheg==';
|
||||
bytes = base64.decode(encoded);
|
||||
text = utf8.decode(bytes);
|
||||
|
||||
let version = base64.version;
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
// Type definitions for base-64 0.1
|
||||
// Project: https://github.com/mathiasbynens/base64
|
||||
// Definitions by: Dolan Miu <https://github.com/dolanmiu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export const version: string;
|
||||
|
||||
/**
|
||||
* This function takes a byte string (the input parameter) and encodes it according to base64.
|
||||
* The input data must be in the form of a string containing only characters
|
||||
* in the range from U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF.
|
||||
* The base64.encode() function is designed to be fully compatible
|
||||
* with btoa() as described in the HTML Standard.
|
||||
* see: https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-btoa
|
||||
*/
|
||||
export function encode(input: string): string;
|
||||
/**
|
||||
* This function takes a base64-encoded string (the input parameter) and decodes it.
|
||||
* The return value is in the form of a string containing only characters in
|
||||
* the range from U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF.
|
||||
* The base64.decode() function is designed to be fully compatible
|
||||
* with atob() as described in the HTML Standard.
|
||||
* see: https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-atob
|
||||
*/
|
||||
export function decode(input: string): string;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"base-64-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -0,0 +1,217 @@
|
||||
///<reference path="index.d.ts"/>
|
||||
|
||||
// examples taken from https://github.com/litehelpers/Cordova-sqlite-storage
|
||||
function echoTestFunction() {
|
||||
function successCallback(value: string) {
|
||||
|
||||
}
|
||||
function errorCallback() {
|
||||
|
||||
}
|
||||
window.sqlitePlugin.echoTest(successCallback, errorCallback);
|
||||
}
|
||||
function selfTestFunction() {
|
||||
function successCallback() {
|
||||
|
||||
}
|
||||
function errorCallback() {
|
||||
|
||||
}
|
||||
window.sqlitePlugin.selfTest(successCallback, errorCallback);
|
||||
}
|
||||
|
||||
function openingDatabase() {
|
||||
function successcb(db: SQLitePlugin.Database) {
|
||||
|
||||
}
|
||||
function errorcb(err: Error) {
|
||||
|
||||
}
|
||||
|
||||
var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}, successcb, errorcb);
|
||||
var db = window.sqlitePlugin.openDatabase({name: 'my.db', iosDatabaseLocation: 'Library'}, successcb, errorcb);
|
||||
}
|
||||
|
||||
function openingDatabase2() {
|
||||
window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}, function(db) {
|
||||
db.transaction(function(tx) {
|
||||
// ...
|
||||
}, function(err) {
|
||||
console.log('Open database ERROR: ' + JSON.stringify(err));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function singleStatementTransactions(db: SQLitePlugin.Database) {
|
||||
db.executeSql('INSERT INTO MyTable VALUES (?)', ['test-value'], function (resultSet) {
|
||||
console.log('resultSet.insertId: ' + resultSet.insertId);
|
||||
console.log('resultSet.rowsAffected: ' + resultSet.rowsAffected);
|
||||
}, function(error) {
|
||||
console.log('SELECT error: ' + error.message);
|
||||
});
|
||||
|
||||
db.executeSql("SELECT LENGTH('tenletters') AS stringlength", [], function (resultSet) {
|
||||
console.log('got stringlength: ' + resultSet.rows.item(0).stringlength);
|
||||
}, function(error) {
|
||||
console.log('SELECT error: ' + error.message);
|
||||
});
|
||||
}
|
||||
|
||||
function sqlBatchTransactions(db: SQLitePlugin.Database) {
|
||||
db.sqlBatch([
|
||||
'DROP TABLE IF EXISTS MyTable',
|
||||
'CREATE TABLE MyTable (SampleColumn)',
|
||||
[ 'INSERT INTO MyTable VALUES (?)', ['test-value'] ],
|
||||
], function() {
|
||||
db.executeSql('SELECT * FROM MyTable', [], function (resultSet) {
|
||||
console.log('Sample column value: ' + resultSet.rows.item(0).SampleColumn);
|
||||
});
|
||||
}, function(error) {
|
||||
console.log('Populate table error: ' + error.message);
|
||||
});
|
||||
}
|
||||
|
||||
function asynchronousTransaction(db: SQLitePlugin.Database) {
|
||||
db.transaction(function(tx) {
|
||||
tx.executeSql('DROP TABLE IF EXISTS MyTable');
|
||||
tx.executeSql('CREATE TABLE MyTable (SampleColumn)');
|
||||
tx.executeSql('INSERT INTO MyTable VALUES (?)', ['test-value'], function(tx, resultSet) {
|
||||
console.log('resultSet.insertId: ' + resultSet.insertId);
|
||||
console.log('resultSet.rowsAffected: ' + resultSet.rowsAffected);
|
||||
}, function(tx, error) {
|
||||
console.log('INSERT error: ' + error.message);
|
||||
});
|
||||
}, function(error) {
|
||||
console.log('transaction error: ' + error.message);
|
||||
}, function() {
|
||||
console.log('transaction ok');
|
||||
});
|
||||
|
||||
db.readTransaction(function(tx) {
|
||||
tx.executeSql("SELECT UPPER('Some US-ASCII text') AS uppertext", [], function(tx, resultSet) {
|
||||
console.log("resultSet.rows.item(0).uppertext: " + resultSet.rows.item(0).uppertext);
|
||||
}, function(tx, error) {
|
||||
console.log('SELECT error: ' + error.message);
|
||||
});
|
||||
}, function(error) {
|
||||
console.log('transaction error: ' + error.message);
|
||||
}, function() {
|
||||
console.log('transaction ok');
|
||||
});
|
||||
}
|
||||
|
||||
function sampleWithPRAGMA() {
|
||||
// Wait for Cordova to load
|
||||
document.addEventListener('deviceready', onDeviceReady, false);
|
||||
|
||||
// Cordova is ready
|
||||
function onDeviceReady() {
|
||||
var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'});
|
||||
|
||||
db.transaction(function(tx) {
|
||||
tx.executeSql('DROP TABLE IF EXISTS test_table');
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS test_table (id integer primary key, data text, data_num integer)');
|
||||
|
||||
// demonstrate PRAGMA:
|
||||
db.executeSql("pragma table_info (test_table);", [], function(res) {
|
||||
console.log("PRAGMA res: " + JSON.stringify(res));
|
||||
});
|
||||
|
||||
tx.executeSql("INSERT INTO test_table (data, data_num) VALUES (?,?)", ["test", 100], function(tx, res) {
|
||||
console.log("insertId: " + res.insertId + " -- probably 1");
|
||||
console.log("rowsAffected: " + res.rowsAffected + " -- should be 1");
|
||||
|
||||
db.transaction(function(tx) {
|
||||
tx.executeSql("select count(id) as cnt from test_table;", [], function(tx, res) {
|
||||
console.log("res.rows.length: " + res.rows.length + " -- should be 1");
|
||||
console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1");
|
||||
});
|
||||
});
|
||||
|
||||
// }, function(e) { // probably example in https://github.com/litehelpers/Cordova-sqlite-storage is broken
|
||||
}, function(_tx, e) {
|
||||
console.log("ERROR: " + e.message);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function sampleWithTransactionLevelNesting() {
|
||||
// Wait for Cordova to load
|
||||
document.addEventListener('deviceready', onDeviceReady, false);
|
||||
|
||||
// Cordova is ready
|
||||
function onDeviceReady() {
|
||||
var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'});
|
||||
|
||||
db.transaction(function(tx) {
|
||||
tx.executeSql('DROP TABLE IF EXISTS test_table');
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS test_table (id integer primary key, data text, data_num integer)');
|
||||
|
||||
tx.executeSql("INSERT INTO test_table (data, data_num) VALUES (?,?)", ["test", 100], function(tx, res) {
|
||||
console.log("insertId: " + res.insertId + " -- probably 1");
|
||||
console.log("rowsAffected: " + res.rowsAffected + " -- should be 1");
|
||||
|
||||
tx.executeSql("select count(id) as cnt from test_table;", [], function(tx, res) {
|
||||
console.log("res.rows.length: " + res.rows.length + " -- should be 1");
|
||||
console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1");
|
||||
});
|
||||
|
||||
}, function(tx, e) {
|
||||
console.log("ERROR: " + e.message);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function dbClose(db: SQLitePlugin.Database) {
|
||||
function successcb() {
|
||||
|
||||
}
|
||||
function errorcb(err: Error) {
|
||||
|
||||
}
|
||||
|
||||
db.close(successcb, errorcb);
|
||||
|
||||
|
||||
db.transaction(function (tx) {
|
||||
tx.executeSql("SELECT LENGTH('tenletters') AS stringlength", [], function (tx, res) {
|
||||
console.log('got stringlength: ' + res.rows.item(0).stringlength);
|
||||
});
|
||||
}, function (error) {
|
||||
// OK to close here:
|
||||
console.log('transaction error: ' + error.message);
|
||||
db.close();
|
||||
}, function () {
|
||||
// OK to close here:
|
||||
console.log('transaction ok');
|
||||
db.close(function () {
|
||||
console.log('database is closed ok');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function deleteDatabase() {
|
||||
function successcb() {
|
||||
|
||||
}
|
||||
function errorcb(err: Error) {
|
||||
|
||||
}
|
||||
|
||||
window.sqlitePlugin.deleteDatabase({name: 'my.db', location: 'default'}, successcb, errorcb);
|
||||
}
|
||||
|
||||
|
||||
function quickInstallationTest() {
|
||||
window.sqlitePlugin.openDatabase({ name: 'hello-world.db', location: 'default' }, function (db) {
|
||||
db.executeSql("select length('tenletters') as stringlength", [], function (res) {
|
||||
var stringlength = res.rows.item(0).stringlength;
|
||||
console.log('got stringlength: ' + stringlength);
|
||||
//document.getElementById('deviceready').querySelector('.received').innerHTML = 'stringlength: ' + stringlength;
|
||||
});
|
||||
});
|
||||
}
|
||||
Vendored
+68
@@ -0,0 +1,68 @@
|
||||
// Type definitions for cordova-sqlite-storage 1.5
|
||||
// Project: https://github.com/litehelpers/Cordova-sqlite-storage
|
||||
// Definitions by: rafw87 <https://github.com/rafw87/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Window {
|
||||
sqlitePlugin: SQLitePlugin.SQLite;
|
||||
}
|
||||
|
||||
declare var sqlitePlugin: SQLitePlugin.SQLite;
|
||||
|
||||
declare namespace SQLitePlugin {
|
||||
type TransactionFunction = (tx: Transaction) => void;
|
||||
|
||||
type SuccessCallback = () => void;
|
||||
type DatabaseSuccessCallback = (db: Database) => void;
|
||||
type StatementSuccessCallback = (results: Results) => void;
|
||||
type TransactionStatementSuccessCallback = (tx: Transaction, results: Results) => void;
|
||||
|
||||
type ErrorCallback = (err: Error) => void;
|
||||
type TransactionStatementErrorCallback = (tx: Transaction, err: Error) => boolean | void;
|
||||
|
||||
interface OpenArgs {
|
||||
name: string;
|
||||
location?: string;
|
||||
iosDatabaseLocation?: string;
|
||||
androidDatabaseImplementation?: number;
|
||||
androidLockWorkaround?: number;
|
||||
createFromLocation?: number;
|
||||
[key: string]: any;
|
||||
}
|
||||
interface DeleteArgs {
|
||||
name: string;
|
||||
location?: string;
|
||||
iosDatabaseLocation?: string;
|
||||
}
|
||||
|
||||
interface Results {
|
||||
rowsAffected: number;
|
||||
insertId?: number;
|
||||
rows: {
|
||||
length: number;
|
||||
item(i: number): any;
|
||||
};
|
||||
}
|
||||
|
||||
interface Transaction {
|
||||
executeSql(statement: string, params?: any[], success?: TransactionStatementSuccessCallback, error?: TransactionStatementErrorCallback): void;
|
||||
}
|
||||
|
||||
interface Database {
|
||||
transaction(fn: TransactionFunction, error?: ErrorCallback, success?: SuccessCallback): void;
|
||||
readTransaction(fn: TransactionFunction, error?: ErrorCallback, success?: SuccessCallback): void;
|
||||
|
||||
executeSql(statement: string, params?: any[], success?: StatementSuccessCallback, error?: ErrorCallback): void;
|
||||
sqlBatch (sqlStatements: Array<string|[string, any[]]>, success?: SuccessCallback, error?: ErrorCallback): void;
|
||||
|
||||
close(success?: SuccessCallback, error?: ErrorCallback): void;
|
||||
}
|
||||
|
||||
interface SQLite {
|
||||
openDatabase(args: OpenArgs, success?: DatabaseSuccessCallback, error?: ErrorCallback): Database;
|
||||
deleteDatabase(args: DeleteArgs, success?: SuccessCallback, error?: ErrorCallback): void;
|
||||
selfTest(success?: SuccessCallback, error?: ErrorCallback): void;
|
||||
echoTest(ok?: (value: string) => void, error?: (msg: string) => void): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-sqlite-storage-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
// https://github.com/Microsoft/types-publisher/issues/241
|
||||
"void-return": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import * as crc from "crc"
|
||||
import * as fs from "fs"
|
||||
|
||||
// tests move from the readme of the module
|
||||
|
||||
crc.crc32('hello').toString(16);
|
||||
// "3610a686"
|
||||
|
||||
crc.crc32(fs.readFileSync('README.md', 'utf8')).toString(16);
|
||||
// "127ad531"
|
||||
crc.crc32(fs.readFileSync('README.md')).toString(16);
|
||||
// "127ad531"
|
||||
|
||||
let value = crc.crc32('one');
|
||||
value = crc.crc32('two', value);
|
||||
value = crc.crc32('three', value);
|
||||
value.toString(16);
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for crc 3.4
|
||||
// Project: https://github.com/alexgorbatchev/node-crc/
|
||||
// Definitions by: Jianrong Yu <https://github.com/YuJianrong>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export function crc1(buf: string | Buffer, previous?: number): number;
|
||||
export function crc8(buf: string | Buffer, previous?: number): number;
|
||||
export function crc81wire(buf: string | Buffer, previous?: number): number;
|
||||
export function crc16(buf: string | Buffer, previous?: number): number;
|
||||
export function crc16ccitt(buf: string | Buffer, previous?: number): number;
|
||||
export function crc16modbus(buf: string | Buffer, previous?: number): number;
|
||||
export function crc16xmodem(buf: string | Buffer, previous?: number): number;
|
||||
export function crc16kermit(buf: string | Buffer, previous?: number): number;
|
||||
export function crc24(buf: string | Buffer, previous?: number): number;
|
||||
export function crc32(buf: string | Buffer, previous?: number): number;
|
||||
@@ -4,7 +4,7 @@
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ajv-tests.ts"
|
||||
"crc-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -1,12 +1,11 @@
|
||||
import resolve = require('enhanced-resolve');
|
||||
import { Context } from 'enhanced-resolve/lib/concord';
|
||||
import { ResolveResult } from 'enhanced-resolve/lib/common-types'
|
||||
import { ResolveResult, AbstractInputFileSystem } from 'enhanced-resolve/lib/common-types'
|
||||
import Resolver = require('enhanced-resolve/lib/Resolver')
|
||||
|
||||
resolve('lib', 'string', function (err) { });
|
||||
|
||||
let context: Context = {
|
||||
referrer: 'hi'
|
||||
let context = {
|
||||
issuer: 'hi'
|
||||
};
|
||||
|
||||
resolve(context, 'path', 'string', function () { });
|
||||
@@ -14,15 +13,12 @@ resolve(context, 'path', 'string', function () { });
|
||||
let resolver: Resolver
|
||||
resolver = resolve.ResolverFactory.createResolver({
|
||||
extensions: ['.js'],
|
||||
fileSystem: {}
|
||||
fileSystem: {} as AbstractInputFileSystem
|
||||
});
|
||||
|
||||
const nfs = new resolve.NodeJsInputFileSystem();
|
||||
|
||||
const snfs = new resolve.SyncNodeJsInputFileSystem();
|
||||
|
||||
const cfs = new resolve.CachedInputFileSystem(nfs, 4);
|
||||
const cfs2 = new resolve.CachedInputFileSystem(snfs, 4);
|
||||
|
||||
let result: ResolveResult
|
||||
|
||||
|
||||
Vendored
+86
-62
@@ -1,4 +1,4 @@
|
||||
// Type definitions for enhanced-resolve v2.3.0
|
||||
// Type definitions for enhanced-resolve v3.0.0
|
||||
// Project: http://github.com/webpack/enhanced-resolve.git
|
||||
// Definitions by: e-cloud <https://github.com/e-cloud>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -10,125 +10,149 @@ import fs = require('fs');
|
||||
import {
|
||||
ResolveResult,
|
||||
LoggingCallbackWrapper,
|
||||
ErrorCallback,
|
||||
CommonFileSystemMethod,
|
||||
BaseFileSystem,
|
||||
ResolverRequest
|
||||
} from './lib/common-types';
|
||||
import { Context } from './lib/concord';
|
||||
ResolverRequest,
|
||||
ResolveContext,
|
||||
AbstractInputFileSystem
|
||||
} from './lib/common-types'
|
||||
import { Dictionary } from './lib/concord'
|
||||
import Resolver = require('./lib/Resolver');
|
||||
import Tapable = require('tapable');
|
||||
|
||||
declare namespace Resolve {
|
||||
function sync(path: string, request: string): ResolveResult;
|
||||
function sync(context: Context, path: string, request: string): ResolveResult;
|
||||
function sync(context: ResolveContext, path: string, request: string): ResolveResult;
|
||||
|
||||
function context(path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
function context(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
function context(context: ResolveContext, path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
|
||||
namespace context {
|
||||
function sync(path: string, request: string): ResolveResult;
|
||||
function sync(context: Context, path: string, request: string): ResolveResult;
|
||||
function sync(context: ResolveContext, path: string, request: string): ResolveResult;
|
||||
}
|
||||
|
||||
function loader(path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
function loader(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
function loader(context: ResolveContext, path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
|
||||
namespace context {
|
||||
function sync(path: string, request: string): ResolveResult;
|
||||
function sync(context: Context, path: string, request: string): ResolveResult;
|
||||
function sync(context: ResolveContext, path: string, request: string): ResolveResult;
|
||||
}
|
||||
|
||||
function create(path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
function create(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
function create(context: ResolveContext, path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
|
||||
export namespace create {
|
||||
function sync(path: string, request: string): ResolveResult;
|
||||
function sync(context: Context, path: string, request: string): ResolveResult;
|
||||
function sync(context: ResolveContext, path: string, request: string): ResolveResult;
|
||||
}
|
||||
|
||||
export namespace ResolverFactory {
|
||||
interface ResolverOption {
|
||||
modules?: string[];
|
||||
descriptionFiles?: string[];
|
||||
plugins?: any[];
|
||||
mainFields?: string[];
|
||||
alias?: AliasItem[] | Dictionary<string>;
|
||||
aliasFields?: string[];
|
||||
mainFiles?: string[];
|
||||
extensions: string[];
|
||||
enforceExtension?: boolean;
|
||||
moduleExtensions?: string[];
|
||||
enforceModuleExtension?: boolean;
|
||||
alias?: AliasItem[] | {};
|
||||
symlinks?: string[] | boolean;
|
||||
resolveToContext?: boolean;
|
||||
unsafeCache?: boolean | {};
|
||||
cachePredicate?: (val: ResolverRequest) => boolean;
|
||||
fileSystem: any;
|
||||
descriptionFiles?: string[];
|
||||
enforceExtension?: boolean;
|
||||
enforceModuleExtension?: boolean;
|
||||
extensions: string[];
|
||||
fileSystem: AbstractInputFileSystem;
|
||||
mainFields?: string[];
|
||||
mainFiles?: string[];
|
||||
moduleExtensions?: string[];
|
||||
modules?: string[];
|
||||
plugins?: Tapable.Plugin[];
|
||||
resolver?: Resolver;
|
||||
resolveToContext?: boolean;
|
||||
symlinks?: string[] | boolean;
|
||||
unsafeCache?: boolean | Dictionary<any>;
|
||||
useSyncFileSystemCalls?: boolean;
|
||||
}
|
||||
interface AliasItem {
|
||||
name: string;
|
||||
alias: string;
|
||||
name: string;
|
||||
onlyModule: boolean;
|
||||
}
|
||||
function createResolver(options: ResolverOption): Resolver;
|
||||
}
|
||||
|
||||
class NodeJsInputFileSystem {
|
||||
readdir(path: string, callback: (err: Error, files: string[]) => void): void;
|
||||
|
||||
isSync(): boolean;
|
||||
|
||||
stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: fs.Stats) => any): void;
|
||||
|
||||
readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
readdir(path: string, callback: (err: Error, files: string[]) => void): void
|
||||
readFile(
|
||||
filename: string, encoding: string,
|
||||
callback: (err: NodeJS.ErrnoException, data: string) => void
|
||||
): void;
|
||||
readFile(
|
||||
filename: string, options: {
|
||||
encoding: string;
|
||||
flag?: string;
|
||||
}, callback: (err: NodeJS.ErrnoException, data: string) => void
|
||||
): void;
|
||||
readFile(
|
||||
filename: string, options: {
|
||||
flag?: string;
|
||||
}, callback: (err: NodeJS.ErrnoException, data: Buffer) => void
|
||||
): void;
|
||||
readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
|
||||
readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void;
|
||||
}
|
||||
|
||||
class SyncNodeJsInputFileSystem {
|
||||
isSync(): boolean;
|
||||
statSync(path: string | Buffer): fs.Stats;
|
||||
|
||||
stat: CommonFileSystemMethod;
|
||||
readdir: CommonFileSystemMethod;
|
||||
readFile(path: string, encoding?: string, callback?: (err: NodeJS.ErrnoException, result: Buffer) => void): void;
|
||||
readFile(path: string, callback?: (err: NodeJS.ErrnoException, result: Buffer) => void): void;
|
||||
readlink: CommonFileSystemMethod;
|
||||
readdirSync(path: string): string[];
|
||||
|
||||
readFileSync(filename: string, encoding: string): string;
|
||||
readFileSync(
|
||||
filename: string, options: {
|
||||
encoding: string;
|
||||
flag?: string;
|
||||
}
|
||||
): string;
|
||||
readFileSync(
|
||||
filename: string, options?: {
|
||||
flag?: string;
|
||||
}
|
||||
): Buffer;
|
||||
|
||||
readlinkSync(path: string | Buffer): string;
|
||||
}
|
||||
|
||||
class CachedInputFileSystem {
|
||||
fileSystem: BaseFileSystem;
|
||||
_statStorage: Storage;
|
||||
_readdirStorage: Storage;
|
||||
_readFileStorage: Storage;
|
||||
_readJsonStorage: Storage;
|
||||
_readlinkStorage: Storage;
|
||||
_stat: CommonFileSystemMethod;
|
||||
_readdir: CommonFileSystemMethod;
|
||||
_readFile: CommonFileSystemMethod;
|
||||
_readJson: CommonFileSystemMethod;
|
||||
_readlink: CommonFileSystemMethod;
|
||||
fileSystem: AbstractInputFileSystem;
|
||||
|
||||
constructor(fileSystem: BaseFileSystem, duration: number);
|
||||
constructor(fileSystem: AbstractInputFileSystem, duration: number);
|
||||
|
||||
isSync(): boolean;
|
||||
stat?(path: string, callback: (err: NodeJS.ErrnoException, stats: fs.Stats) => void): void;
|
||||
|
||||
stat(path: string, callback: ErrorCallback): void;
|
||||
readdir?(path: string, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void;
|
||||
|
||||
readdir(path: string, callback: ErrorCallback): void;
|
||||
readFile?(path: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
|
||||
readFile(path: string, callback: ErrorCallback): void;
|
||||
readJson?(path: string, callback: (err: NodeJS.ErrnoException, data: any) => void): void;
|
||||
|
||||
readJson(path: string, callback: ErrorCallback): void;
|
||||
readlink?(path: string, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void;
|
||||
|
||||
readlink(path: string, callback: ErrorCallback): void;
|
||||
statSync?(path: string | Buffer): fs.Stats;
|
||||
|
||||
readdirSync?(path: string): string[];
|
||||
|
||||
readFileSync?(filename: string, options?: { flag?: string; }): Buffer;
|
||||
|
||||
readlinkSync?(path: string | Buffer): string;
|
||||
|
||||
readJsonSync?(path: string): any;
|
||||
|
||||
purge(what?: string | string[]): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare function Resolve(path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
declare function Resolve(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void;
|
||||
declare function Resolve(
|
||||
context: ResolveContext,
|
||||
path: string,
|
||||
request: string,
|
||||
callback: LoggingCallbackWrapper
|
||||
): void;
|
||||
|
||||
export = Resolve;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class AliasFieldPlugin {
|
||||
source: string;
|
||||
field: string;
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, field: string, target: string);
|
||||
|
||||
+5
-5
@@ -1,13 +1,13 @@
|
||||
import Resolver = require('./Resolver');
|
||||
import Resolve = require('../');
|
||||
import Resolve = require('enhanced-resolve');
|
||||
|
||||
declare class AliasPlugin {
|
||||
source: string;
|
||||
options: Resolve.ResolverFactory.AliasItem;
|
||||
target: string;
|
||||
name: string;
|
||||
alias: string;
|
||||
name: string;
|
||||
onlyModule: boolean;
|
||||
options: Resolve.ResolverFactory.AliasItem;
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, options: Resolve.ResolverFactory.AliasItem, target: string);
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class AppendPlugin {
|
||||
source: string;
|
||||
appending: string;
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, appending: string, target: string);
|
||||
|
||||
+4
-2
@@ -1,10 +1,12 @@
|
||||
import Resolver = require('./Resolver');
|
||||
import { Dictionary } from './concord';
|
||||
|
||||
declare class ConcordExtensionsPlugin {
|
||||
options: Dictionary<any>;
|
||||
source: string;
|
||||
options: {};
|
||||
target: string;
|
||||
|
||||
constructor(source: string, options: {}, target: string);
|
||||
constructor(source: string, options: Dictionary<any>, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,10 +1,12 @@
|
||||
import Resolver = require('./Resolver');
|
||||
import { Dictionary } from './concord';
|
||||
|
||||
declare class ConcordMainPlugin {
|
||||
options: Dictionary<any>;
|
||||
source: string;
|
||||
options: {};
|
||||
target: string;
|
||||
|
||||
constructor(source: string, options: {}, target: string);
|
||||
constructor(source: string, options: Dictionary<any>, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,10 +1,12 @@
|
||||
import Resolver = require('./Resolver');
|
||||
import { Dictionary } from './concord';
|
||||
|
||||
declare class ConcordModulesPlugin {
|
||||
options: Dictionary<any>;
|
||||
source: string;
|
||||
options: {};
|
||||
target: string;
|
||||
|
||||
constructor(source: string, options: {}, target: string);
|
||||
constructor(source: string, options: Dictionary<any>, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,11 +1,13 @@
|
||||
import Resolver = require('./Resolver');
|
||||
|
||||
declare class DescriptionFilePlugin {
|
||||
filenames: string[];
|
||||
source: string;
|
||||
target: string;
|
||||
filenames: string[];
|
||||
|
||||
constructor(source: string, filenames: string[] | string, target: string);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
|
||||
export = DescriptionFilePlugin;
|
||||
|
||||
+19
-3
@@ -1,8 +1,24 @@
|
||||
import Resolver = require('./Resolver');
|
||||
import { Dictionary, Concord } from './concord';
|
||||
|
||||
export interface DescriptionFileData {
|
||||
concord?: Concord;
|
||||
browser?: Dictionary<string | boolean>;
|
||||
}
|
||||
|
||||
export interface LoadDescriptionFileResult {
|
||||
content: DescriptionFileData
|
||||
directory: string
|
||||
path: string
|
||||
}
|
||||
|
||||
declare function loadDescriptionFile(
|
||||
resolver: Resolver, directory: string, filenames: string[],
|
||||
callback: (...args: any[]) => any
|
||||
resolver: Resolver,
|
||||
directory: string,
|
||||
filenames: string[],
|
||||
callback: (err?: Error | null, result?: LoadDescriptionFileResult) => any
|
||||
): void;
|
||||
declare function getField(content: any, field: string): any;
|
||||
|
||||
declare function getField(content: Dictionary<any> | null, field: string): any;
|
||||
declare function cdUp(directory: string): string | null;
|
||||
export { loadDescriptionFile, getField, cdUp };
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class ModulesInHierachicDirectoriesPlugin {
|
||||
directories: string[];
|
||||
source: string;
|
||||
target: string;
|
||||
directories: string[];
|
||||
|
||||
constructor(source: string, directories: string[], target: string);
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import Resolver = require('./Resolver');
|
||||
declare class ModulesInRootPlugin {
|
||||
source: string;
|
||||
path: string;
|
||||
source: string;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, path: string, target: string);
|
||||
|
||||
Vendored
+14
-6
@@ -1,15 +1,22 @@
|
||||
/// <reference types="tapable" />
|
||||
import Tapable = require('tapable');
|
||||
import { ResolveParseResult, ResolverRequest, LoggingCallbackWrapper, BaseFileSystem } from './common-types';
|
||||
import { Context } from './concord';
|
||||
import {
|
||||
ResolveParseResult,
|
||||
ResolveResult,
|
||||
ResolverRequest,
|
||||
LoggingCallbackWrapper,
|
||||
AbstractInputFileSystem,
|
||||
ResolveContext
|
||||
} from './common-types';
|
||||
|
||||
declare class Resolver extends Tapable {
|
||||
fileSystem: BaseFileSystem;
|
||||
fileSystem: AbstractInputFileSystem;
|
||||
|
||||
constructor(fileSystem: BaseFileSystem);
|
||||
constructor(fileSystem: AbstractInputFileSystem);
|
||||
|
||||
resolveSync(context: Context, path: string, request: string): null;
|
||||
resolveSync(context: ResolveContext, path: string, request: string): ResolveResult;
|
||||
|
||||
resolve(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): any;
|
||||
resolve(context: ResolveContext, path: string, request: string, callback: LoggingCallbackWrapper): any;
|
||||
|
||||
doResolve(type: string, request: ResolverRequest, message: string | null, callback: LoggingCallbackWrapper): any;
|
||||
|
||||
@@ -23,4 +30,5 @@ declare class Resolver extends Tapable {
|
||||
|
||||
normalize(path: string): string;
|
||||
}
|
||||
|
||||
export = Resolver;
|
||||
|
||||
Vendored
+11
-11
@@ -1,29 +1,29 @@
|
||||
/// <reference types="node" />
|
||||
import { CommonFileSystemMethod } from './common-types';
|
||||
|
||||
import { CommonFileSystemMethod } from './common-types'
|
||||
import { Dictionary } from './concord'
|
||||
declare class Storage {
|
||||
duration: number;
|
||||
running: {
|
||||
[name: string]: ((...args: any[]) => any)[]
|
||||
};
|
||||
data: {
|
||||
[name: string]: any[]
|
||||
};
|
||||
levels: string[][];
|
||||
count: number;
|
||||
data: Dictionary<any>;
|
||||
duration: number;
|
||||
interval: NodeJS.Timer | null;
|
||||
levels: string[][];
|
||||
needTickCheck: boolean;
|
||||
nextTick: number | null;
|
||||
passive: boolean;
|
||||
running: Dictionary<Function[]>;
|
||||
|
||||
constructor(duration: number);
|
||||
|
||||
ensureTick(): void;
|
||||
|
||||
finished(name: string): void;
|
||||
finished(name: string, err: NodeJS.ErrnoException | null, result: any): void;
|
||||
|
||||
finishedSync(name: string, err: NodeJS.ErrnoException | null, result?: any): void;
|
||||
|
||||
provide(name: string, provider: CommonFileSystemMethod, callback: (...args: any[]) => any): any;
|
||||
|
||||
provideSync(name: string, provider: (name: string) => any): any;
|
||||
|
||||
tick(): true | undefined;
|
||||
|
||||
checkTicks(): void;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference types="node" />
|
||||
import fs = require('fs');
|
||||
import { AbstractInputFileSystem } from './common-types';
|
||||
|
||||
declare class SyncAsyncFileSystemDecorator {
|
||||
fs: AbstractInputFileSystem;
|
||||
|
||||
readdir?(path: string, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void;
|
||||
|
||||
readFile?(filename: string, callback: (err: NodeJS.ErrnoException | null, data?: Buffer) => void): void;
|
||||
|
||||
readJson?(path: string, callback: (err: NodeJS.ErrnoException | null, data?: any) => void): void;
|
||||
|
||||
readlink?(path: string, callback: (err: NodeJS.ErrnoException | null, linkString?: string) => void): void;
|
||||
|
||||
stat?(path: string, callback: (err: NodeJS.ErrnoException | null, stats?: fs.Stats) => void): void;
|
||||
|
||||
constructor(fs: AbstractInputFileSystem);
|
||||
}
|
||||
|
||||
export = SyncAsyncFileSystemDecorator;
|
||||
+10
-3
@@ -1,12 +1,19 @@
|
||||
import Resolver = require('./Resolver');
|
||||
import { ResolverRequest } from './common-types';
|
||||
import { Dictionary } from './concord';
|
||||
|
||||
declare class UnsafeCachePlugin {
|
||||
source: string;
|
||||
filterPredicate: (str: ResolverRequest) => boolean;
|
||||
cache: {};
|
||||
filterPredicate: (request: ResolverRequest) => boolean;
|
||||
cache: Dictionary<any>;
|
||||
target: string;
|
||||
|
||||
constructor(source: string, filterPredicate: (str: ResolverRequest) => boolean, cache: {}, target: string);
|
||||
constructor(
|
||||
source: string,
|
||||
filterPredicate: (request: ResolverRequest) => boolean,
|
||||
cache: Dictionary<any>,
|
||||
target: string
|
||||
);
|
||||
|
||||
apply(resolver: Resolver): void;
|
||||
}
|
||||
|
||||
+53
-25
@@ -1,5 +1,10 @@
|
||||
import { Context } from './concord';
|
||||
/// <reference types="node" />
|
||||
import { DescriptionFileData } from './DescriptionFileUtils';
|
||||
|
||||
import fs = require('fs');
|
||||
/**
|
||||
* Created by cloud on 16-11-4.
|
||||
*/
|
||||
export interface ResolveError extends Error {
|
||||
details: string;
|
||||
missing: string[];
|
||||
@@ -7,11 +12,15 @@ export interface ResolveError extends Error {
|
||||
}
|
||||
|
||||
export interface ResolveParseResult {
|
||||
request: string;
|
||||
query: string;
|
||||
module: boolean;
|
||||
directory: boolean;
|
||||
file: boolean;
|
||||
module: boolean;
|
||||
query: string;
|
||||
request: string;
|
||||
}
|
||||
|
||||
export interface ResolveContext {
|
||||
issuer?: string;
|
||||
}
|
||||
|
||||
export interface ResolveResult {
|
||||
@@ -20,21 +29,24 @@ export interface ResolveResult {
|
||||
}
|
||||
|
||||
export interface ResolverRequest {
|
||||
request: string;
|
||||
relativePath?: string;
|
||||
descriptionFileData?: any;
|
||||
descriptionFileRoot?: string;
|
||||
context: ResolveContext;
|
||||
descriptionFileData?: DescriptionFileData;
|
||||
descriptionFilePath?: string;
|
||||
context: Context;
|
||||
path: string;
|
||||
query?: string;
|
||||
descriptionFileRoot?: string;
|
||||
directory?: boolean;
|
||||
module?: boolean;
|
||||
path: string;
|
||||
query?: string;
|
||||
relativePath?: string;
|
||||
request: string;
|
||||
__innerRequest?: string;
|
||||
__innerRequest_request?: string;
|
||||
__innerRequest_relativePath?: string;
|
||||
}
|
||||
|
||||
export interface LoggingCallbackTools {
|
||||
log?(msg: string): void;
|
||||
stack?: string[];
|
||||
stack?: string[] | undefined;
|
||||
missing?: string[] | {
|
||||
push: (item: string) => void;
|
||||
};
|
||||
@@ -44,20 +56,36 @@ export interface LoggingCallbackWrapper extends LoggingCallbackTools {
|
||||
(err?: Error | null, ...args: any[]): any;
|
||||
}
|
||||
|
||||
export interface ErrorCallback {
|
||||
(err: Error | null, ...args: any[]): any;
|
||||
export interface ErrorCallback<T> {
|
||||
(err: T | null, ...args: any[]): any;
|
||||
}
|
||||
|
||||
export interface AbstractInputFileSystem {
|
||||
purge?(what?: string | string[]): void;
|
||||
readdir(path: string, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void;
|
||||
readdirSync?(path: string): string[];
|
||||
readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
|
||||
readFile(
|
||||
filename: string, options: {
|
||||
encoding: string;
|
||||
flag?: string;
|
||||
}, callback: (err: NodeJS.ErrnoException, data: string) => void
|
||||
): void;
|
||||
readFile(
|
||||
filename: string, options: {
|
||||
flag?: string;
|
||||
}, callback: (err: NodeJS.ErrnoException, data: Buffer) => void
|
||||
): void;
|
||||
readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||
readFileSync?(filename: string): Buffer;
|
||||
readJson?(path: string, callback: (err: NodeJS.ErrnoException, data: any) => void): void;
|
||||
readJsonSync?(path: string): any;
|
||||
readlink(path: string, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void;
|
||||
readlinkSync?(path: string): string;
|
||||
stat(path: string, callback: (err: NodeJS.ErrnoException, stats: fs.Stats) => void): void;
|
||||
statSync?(path: string): fs.Stats;
|
||||
}
|
||||
|
||||
export interface CommonFileSystemMethod {
|
||||
(name: string, callback: (err: Error | null, ...args: any[]) => void): void;
|
||||
}
|
||||
|
||||
export interface BaseFileSystem {
|
||||
stat: CommonFileSystemMethod;
|
||||
readdir?: CommonFileSystemMethod;
|
||||
readFile?(path: string, encoding: string, callback: ErrorCallback): void;
|
||||
readFile?(path: string, callback: ErrorCallback): void;
|
||||
readJson?: CommonFileSystemMethod;
|
||||
readlink?: CommonFileSystemMethod;
|
||||
isSync: () => boolean;
|
||||
(name: string, callback: (err: NodeJS.ErrnoException | null, ...args: any[]) => void): void;
|
||||
}
|
||||
|
||||
Vendored
+33
-21
@@ -1,38 +1,50 @@
|
||||
export interface Dictionary<T> {
|
||||
[key: string]: T;
|
||||
}
|
||||
|
||||
export interface Concord {
|
||||
'[server] main': string;
|
||||
extensions: string[];
|
||||
main: string;
|
||||
modules: Dictionary<string>;
|
||||
types: Dictionary<string>;
|
||||
}
|
||||
|
||||
export interface Type {
|
||||
type: string | null | undefined;
|
||||
features: string[];
|
||||
}
|
||||
|
||||
export interface Context {
|
||||
supportedResourceTypes?: string[];
|
||||
export interface ConcordContext {
|
||||
environments?: string[];
|
||||
referrer: string;
|
||||
referrer?: string;
|
||||
supportedResourceTypes?: string[];
|
||||
}
|
||||
|
||||
declare function parseType(type: string): Type;
|
||||
declare function isTypeMatched(baseType: string | Type, testedType: string | Type): boolean;
|
||||
declare function isResourceTypeSupported(context: Context, type: string): boolean | undefined;
|
||||
declare function isEnvironment(context: Context, env: string | Type): boolean | undefined;
|
||||
declare function isResourceTypeSupported(context: ConcordContext, type: string): boolean;
|
||||
declare function isEnvironment(context: ConcordContext, env: string | Type): boolean;
|
||||
declare function isGlobMatched(glob: string, relativePath: string): boolean;
|
||||
declare function isConditionMatched(context: Context, condition: string): boolean;
|
||||
declare function isKeyMatched(context: Context, key: string): string | boolean;
|
||||
declare function getField(context: Context, configuration: any, field: string): undefined;
|
||||
declare function getMain(context: Context, configuration: any): undefined;
|
||||
declare function getExtensions(context: Context, configuration: any): undefined;
|
||||
declare function matchModule(context: Context, configuration: any, request: string): any;
|
||||
declare function matchType(context: Context, configuration: any, relativePath: string): undefined;
|
||||
declare function isConditionMatched(context: ConcordContext, condition: string): boolean;
|
||||
declare function isKeyMatched(context: ConcordContext, key: string): string | boolean;
|
||||
declare function getField(context: ConcordContext, configuration: Concord, field: string): any;
|
||||
declare function getMain(context: ConcordContext, configuration: Concord): any;
|
||||
declare function getExtensions(context: ConcordContext, configuration: Concord): any;
|
||||
declare function matchModule(context: ConcordContext, configuration: Concord, request: string): any;
|
||||
declare function matchType(context: ConcordContext, configuration: Concord, relativePath: string): string | undefined;
|
||||
|
||||
export {
|
||||
parseType,
|
||||
isTypeMatched,
|
||||
isResourceTypeSupported,
|
||||
isEnvironment,
|
||||
isGlobMatched,
|
||||
isConditionMatched,
|
||||
isKeyMatched,
|
||||
getExtensions,
|
||||
getField,
|
||||
getMain,
|
||||
getExtensions,
|
||||
isConditionMatched,
|
||||
isEnvironment,
|
||||
isGlobMatched,
|
||||
isKeyMatched,
|
||||
isResourceTypeSupported,
|
||||
isTypeMatched,
|
||||
matchModule,
|
||||
matchType
|
||||
matchType,
|
||||
parseType
|
||||
};
|
||||
|
||||
@@ -26,6 +26,10 @@ import getPaths, { basename } from 'enhanced-resolve/lib/getPaths';
|
||||
|
||||
import { globToRegExp } from 'enhanced-resolve/lib/globToRegExp';
|
||||
|
||||
import Storage from 'enhanced-resolve/lib/Storage';
|
||||
|
||||
import { AbstractInputFileSystem } from 'enhanced-resolve/lib/common-types';
|
||||
|
||||
import JoinRequestPlugin = require('enhanced-resolve/lib/JoinRequestPlugin');
|
||||
|
||||
import LogInfoPlugin = require('enhanced-resolve/lib/LogInfoPlugin');
|
||||
@@ -48,8 +52,6 @@ import Resolver = require('enhanced-resolve/lib/Resolver');
|
||||
|
||||
import ResultPlugin = require('enhanced-resolve/lib/ResultPlugin');
|
||||
|
||||
import Storage from 'enhanced-resolve/lib/Storage'
|
||||
|
||||
import SymlinkPlugin = require('enhanced-resolve/lib/SymlinkPlugin');
|
||||
|
||||
import TryNextPlugin = require('enhanced-resolve/lib/TryNextPlugin');
|
||||
@@ -60,8 +62,6 @@ import UseFilePlugin = require('enhanced-resolve/lib/UseFilePlugin');
|
||||
|
||||
import resolve = require('../');
|
||||
|
||||
import { BaseFileSystem } from 'enhanced-resolve/lib/common-types'
|
||||
|
||||
const aplugin = new AliasFieldPlugin('a', 'b', 'c');
|
||||
|
||||
const aplugin2 = new AliasPlugin('a', {
|
||||
@@ -95,7 +95,7 @@ DescriptionFileUtils.cdUp('./lib');
|
||||
DescriptionFileUtils.getField({}, 'hi');
|
||||
DescriptionFileUtils.loadDescriptionFile(resolve.ResolverFactory.createResolver({
|
||||
extensions: [''],
|
||||
fileSystem: {}
|
||||
fileSystem: {} as AbstractInputFileSystem
|
||||
}), './lib', ['file'], function () { });
|
||||
|
||||
const dplugin1 = new DirectoryExistsPlugin('string', 'string');
|
||||
@@ -131,7 +131,7 @@ const nplugin = new NextPlugin('string', 'ap');
|
||||
|
||||
const pplugin = new ParsePlugin('string', 'ap');
|
||||
|
||||
const resolver = new Resolver({} as BaseFileSystem);
|
||||
const resolver = new Resolver({} as AbstractInputFileSystem);
|
||||
|
||||
const rplugin = new ResultPlugin('string');
|
||||
|
||||
|
||||
@@ -1,21 +1,53 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": [
|
||||
"index.d.ts",
|
||||
"enhanced-resolve-tests.ts",
|
||||
"lib/*.ts"
|
||||
]
|
||||
}
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitThis": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"enhanced-resolve-tests.ts",
|
||||
"./lib/AliasFieldPlugin.d.ts",
|
||||
"./lib/AliasPlugin.d.ts",
|
||||
"./lib/AppendPlugin.d.ts",
|
||||
"./lib/CloneBasenamePlugin.d.ts",
|
||||
"./lib/common-types.d.ts",
|
||||
"./lib/concord.d.ts",
|
||||
"./lib/ConcordExtensionsPlugin.d.ts",
|
||||
"./lib/ConcordMainPlugin.d.ts",
|
||||
"./lib/ConcordModulesPlugin.d.ts",
|
||||
"./lib/DescriptionFilePlugin.d.ts",
|
||||
"./lib/DescriptionFileUtils.d.ts",
|
||||
"./lib/DirectoryExistsPlugin.d.ts",
|
||||
"./lib/FileExistsPlugin.d.ts",
|
||||
"./lib/FileKindPlugin.d.ts",
|
||||
"./lib/getPaths.d.ts",
|
||||
"./lib/globToRegExp.d.ts",
|
||||
"./lib/JoinRequestPlugin.d.ts",
|
||||
"./lib/lib-tests.ts",
|
||||
"./lib/LogInfoPlugin.d.ts",
|
||||
"./lib/MainFieldPlugin.d.ts",
|
||||
"./lib/ModuleAppendPlugin.d.ts",
|
||||
"./lib/ModuleKindPlugin.d.ts",
|
||||
"./lib/ModulesInHierachicDirectoriesPlugin.d.ts",
|
||||
"./lib/ModulesInRootPlugin.d.ts",
|
||||
"./lib/NextPlugin.d.ts",
|
||||
"./lib/ParsePlugin.d.ts",
|
||||
"./lib/Resolver.d.ts",
|
||||
"./lib/ResultPlugin.d.ts",
|
||||
"./lib/Storage.d.ts",
|
||||
"./lib/SymlinkPlugin.d.ts",
|
||||
"./lib/TryNextPlugin.d.ts",
|
||||
"./lib/UnsafeCachePlugin.d.ts",
|
||||
"./lib/UseFilePlugin.d.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import * as Flatpickr from 'flatpickr';
|
||||
|
||||
const picker1 = new Flatpickr('input');
|
||||
|
||||
const input = document.querySelector('input');
|
||||
if (input != null) {
|
||||
const picker2 = new Flatpickr(input, {
|
||||
mode: 'range',
|
||||
onChange: dates => null
|
||||
});
|
||||
picker2.setDate(['2016-11-15T00:00:00.000Z', new Date()]);
|
||||
}
|
||||
|
||||
picker1.destroy();
|
||||
|
||||
Vendored
+68
@@ -0,0 +1,68 @@
|
||||
// Type definitions for flatpickr 2.2
|
||||
// Project: https://github.com/chmln/flatpickr
|
||||
// Definitions by: James Birtles <https://github.com/UnwrittenFun>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Flatpickr {
|
||||
constructor(element: string | Element, options?: Flatpickr.Options);
|
||||
|
||||
changeMonth(month: number, isOffset: boolean): void;
|
||||
clear(): void;
|
||||
close(): void;
|
||||
destroy(): void;
|
||||
formatDate(format: string, date: Date): string;
|
||||
jumpToDate(date?: Flatpickr.DateString): void;
|
||||
open(): void;
|
||||
parseDate(date: string): Date;
|
||||
redraw(): void;
|
||||
set(option: string, value: any): void;
|
||||
setDate(date: Flatpickr.DateString | Flatpickr.DateString[]): void;
|
||||
toggle(): void;
|
||||
}
|
||||
|
||||
declare namespace Flatpickr {
|
||||
interface Options {
|
||||
altFormat?: string;
|
||||
altInput?: boolean;
|
||||
altInputClass?: string;
|
||||
allowInput?: boolean;
|
||||
clickOpens?: boolean;
|
||||
dateFormat?: string | null;
|
||||
defaultDate?: DateString | DateString[];
|
||||
disable?: DateRange[];
|
||||
enable?: DateRange[];
|
||||
enableTime?: boolean;
|
||||
enableSeconds?: boolean;
|
||||
hourIncrement?: number;
|
||||
inline?: boolean;
|
||||
maxDate?: DateString;
|
||||
minDate?: DateString;
|
||||
minuteIncrement?: number;
|
||||
mode?: Mode;
|
||||
nextArrow?: string;
|
||||
noCalendar?: boolean;
|
||||
onChange?: EventCallback | EventCallback[];
|
||||
onClose?: EventCallback | EventCallback[];
|
||||
onOpen?: EventCallback | EventCallback[];
|
||||
onReady?: EventCallback | EventCallback[];
|
||||
onMonthChange?: EventCallback | EventCallback[];
|
||||
onYearChange?: EventCallback | EventCallback[];
|
||||
onValueUpdate?: EventCallback | EventCallback[];
|
||||
onDayCreate?: EventCallback | EventCallback[];
|
||||
parseDate?: (date: string) => Date;
|
||||
prevArrow?: string;
|
||||
shorthandCurrentMonth?: boolean;
|
||||
static?: boolean;
|
||||
time_24hr?: boolean;
|
||||
utc?: boolean;
|
||||
weekNumbers?: boolean;
|
||||
wrap?: boolean;
|
||||
}
|
||||
|
||||
type DateString = Date | string;
|
||||
type DateRange = DateString | { from: DateString, to: DateString } | ((date: Date) => boolean);
|
||||
type Mode = 'single' | 'multiple' | 'range';
|
||||
type EventCallback = (selectedDates: Date[], dateStr: string, instance: Flatpickr, elem: HTMLElement) => void;
|
||||
}
|
||||
|
||||
export = Flatpickr;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"flatpickr-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Vendored
+3
-3
@@ -1185,9 +1185,9 @@ declare module "graphql/type/definition" {
|
||||
export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
|
||||
name: string;
|
||||
description?: string;
|
||||
serialize: (value: any) => TInternal;
|
||||
parseValue?: (value: any) => TExternal;
|
||||
parseLiteral?: (valueNode: ValueNode) => TInternal;
|
||||
serialize: (value: any) => TExternal | null | undefined;
|
||||
parseValue?: (value: any) => TInternal | null | undefined;
|
||||
parseLiteral?: (valueNode: ValueNode) => TInternal | null | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for imagesLoaded 3.1.8+
|
||||
// Type definitions for imagesLoaded 3.1.8
|
||||
// Project: https://github.com/desandro/imagesloaded
|
||||
// Definitions by: Chris Charabaruk <http://github.com/coldacid>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Vendored
+12
-1
@@ -243,6 +243,17 @@ declare namespace Interact {
|
||||
|
||||
declare var interact: Interact.InteractStatic;
|
||||
|
||||
declare module "interact.js" {
|
||||
// CommonJS module name until version 1.2.6 is "interact.js"
|
||||
declare module "interact.js" {
|
||||
export = interact;
|
||||
}
|
||||
|
||||
// CommonJS module name from version 1.2.7 onward is "interactjs"
|
||||
declare module "interactjs" {
|
||||
export = interact;
|
||||
}
|
||||
|
||||
// AMD module name is "interact"
|
||||
declare module "interact" {
|
||||
export = interact;
|
||||
}
|
||||
|
||||
Vendored
+12
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for JQuery DataTables 1.10.8
|
||||
// Type definitions for JQuery DataTables 1.10.9
|
||||
// Project: http://www.datatables.net
|
||||
// Definitions by: Kiarash Ghiaseddin <https://github.com/Silver-Connection/DefinitelyTyped>, Omid Rad <https://github.com/omidkrad>, Armin Sander <https://github.com/pragmatrix/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -8,7 +8,7 @@
|
||||
// - Plugin and extension definitions are not typed.
|
||||
// - Some return types are not fully wokring
|
||||
|
||||
/// <reference types="jquery"/>
|
||||
/// <reference types="jquery" />
|
||||
|
||||
interface JQuery {
|
||||
DataTable(param?: DataTables.Settings): DataTables.DataTable;
|
||||
@@ -1752,9 +1752,10 @@ declare namespace DataTables {
|
||||
oFeatures: FeaturesLegacy;
|
||||
oScroll: ScrollingLegacy;
|
||||
oLanguage: LanguageLegacy; // | { fnInfoCallback: FunctionInfoCallback; };
|
||||
oBrowser: { bScrollOversize: boolean; };
|
||||
oBrowser: BrowserLegacy;
|
||||
aanFeatures: ArrayStringNode[][];
|
||||
aoData: RowLegacy[];
|
||||
aIds: any;
|
||||
aiDisplay: number[];
|
||||
aiDisplayMaster: number[];
|
||||
aoColumns: ColumnLegacy[];
|
||||
@@ -1827,6 +1828,14 @@ declare namespace DataTables {
|
||||
iTabIndex: number;
|
||||
nScrollHead: Node;
|
||||
nScrollFoot: Node;
|
||||
rowIdFn: (mSource: string | number | Function) => Function;
|
||||
}
|
||||
|
||||
export interface BrowserLegacy {
|
||||
barWidth: number,
|
||||
bBounding: boolean,
|
||||
bScrollbarLeft: boolean,
|
||||
bScrollOversize: boolean
|
||||
}
|
||||
|
||||
export interface FeaturesLegacy {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference types="jquery" />
|
||||
/// <reference types="jquery"/>
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
@@ -268,6 +268,17 @@ $(document).ready(function () {
|
||||
|
||||
//#endregion "Settings"
|
||||
|
||||
//#region "Settings-Legacy"
|
||||
|
||||
var browserLegacy: DataTables.BrowserLegacy = {
|
||||
barWidth: 10,
|
||||
bBounding: true,
|
||||
bScrollbarLeft: true,
|
||||
bScrollOversize: true
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region "Init"
|
||||
|
||||
var dt = $('#example').DataTable();
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jquery.dataTables-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
@@ -16,5 +12,9 @@
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jquery.dataTables-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+8
-8
@@ -1,10 +1,10 @@
|
||||
// Type definitions for JSNLog v2.17.3+
|
||||
// Type definitions for JSNLog 2.17.3
|
||||
// Project: https://github.com/mperdeck/jsnlog.js
|
||||
// Definitions by: Mattijs Perdeck <https://github.com/mperdeck>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// -------------------------------
|
||||
// Full documentation is at
|
||||
// Full documentation is at
|
||||
// http://jsnlog.com
|
||||
// -------------------------------
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
* Copyright 2016 Mattijs Perdeck.
|
||||
*
|
||||
* This project is licensed under the MIT license.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Declarations of all interfaces and ambient objects, except for JL itself.
|
||||
// Provides strong typing in both jsnlog.ts itself and in TypeScript programs that use
|
||||
// JSNLog.
|
||||
// Provides strong typing in both jsnlog.ts itself and in TypeScript programs that use
|
||||
// JSNLog.
|
||||
|
||||
declare namespace JL {
|
||||
|
||||
@@ -92,7 +92,7 @@ declare function __jsnlog_configure(jsnlog: any): void;
|
||||
declare function JL(loggerName?: string): JL.JSNLogLogger;
|
||||
|
||||
// Definitions that need to be kept out of the main namespace definition,
|
||||
// because otherwise during compilation of jsnlog.ts it complains that you can't
|
||||
// because otherwise during compilation of jsnlog.ts it complains that you can't
|
||||
// overload ambient declarations with non-ambient declarations.
|
||||
|
||||
declare namespace JL {
|
||||
@@ -103,7 +103,7 @@ declare namespace JL {
|
||||
export class Exception {
|
||||
constructor(data: any, inner?: any);
|
||||
}
|
||||
|
||||
|
||||
export function getOffLevel(): number;
|
||||
export function getTraceLevel(): number;
|
||||
export function getDebugLevel(): number;
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for jsUri 1.3+
|
||||
// Type definitions for jsUri 1.3
|
||||
// Project: https://github.com/derek-watson/jsUri
|
||||
// Definitions by: Chris Charabaruk <http://github.com/coldacid>, Florian Wagner <http://github.com/flqw>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Vendored
+43
-6
@@ -10,26 +10,63 @@ export interface Loader {
|
||||
query: string;
|
||||
request: string;
|
||||
options: any;
|
||||
normal: any;
|
||||
pitch: any;
|
||||
normal: null | ((request: string) => string);
|
||||
pitch: null | ((request: string) => string);
|
||||
raw: string;
|
||||
data: any;
|
||||
pitchExecuted: boolean;
|
||||
normalExecuted: boolean;
|
||||
}
|
||||
|
||||
export function getContext(resource: string): string;
|
||||
|
||||
export interface RunLoaderOption {
|
||||
resource: string;
|
||||
loaders: any[];
|
||||
context: any;
|
||||
readResource: (filename: string, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void) => void;
|
||||
readResource: (
|
||||
filename: string,
|
||||
callback: (err: NodeJS.ErrnoException | null, data: Buffer | null) => void
|
||||
) => void;
|
||||
}
|
||||
|
||||
export interface RunLoaderResult {
|
||||
result?: (Buffer | null)[];
|
||||
resourceBuffer?: Buffer | null;
|
||||
cacheable: boolean;
|
||||
fileDependencies: string[];
|
||||
contextDependencies: string[];
|
||||
}
|
||||
|
||||
export interface ExtendedLoaderContext {
|
||||
context: string | null;
|
||||
loaderIndex: number;
|
||||
loaders: Loader[];
|
||||
resourcePath: string | undefined;
|
||||
resourceQuery: string | undefined;
|
||||
async: (() => (() => void) | undefined) | null;
|
||||
callback: (() => void) | null;
|
||||
cacheable: (flag: boolean) => void;
|
||||
dependency: (file: string) => void;
|
||||
addDependency: (file: string) => void;
|
||||
addContextDependency: (context: string) => void;
|
||||
getDependencies: () => string[];
|
||||
getContextDependencies: () => string[];
|
||||
clearDependencies: () => void;
|
||||
resource: string;
|
||||
request: string;
|
||||
remainingRequest: string;
|
||||
currentRequest: string;
|
||||
previousRequest: string;
|
||||
query: {
|
||||
[key: string]: any;
|
||||
} | string;
|
||||
data: any;
|
||||
}
|
||||
|
||||
export function getContext(resource: string): string;
|
||||
|
||||
export function runLoaders(
|
||||
options: RunLoaderOption,
|
||||
callback: (err: NodeJS.ErrnoException | null, result: any) => any
|
||||
callback: (err: NodeJS.ErrnoException | null, result: RunLoaderResult) => any
|
||||
): void;
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
import { runLoaders, getContext, Loader, RunLoaderOption } from 'loader-runner';
|
||||
import { runLoaders, getContext } from 'loader-runner';
|
||||
|
||||
const option = {} as RunLoaderOption;
|
||||
const option = {
|
||||
resource: 'test.js',
|
||||
loaders: [{
|
||||
request: 'test.js'
|
||||
}],
|
||||
context: './lib/',
|
||||
readResource: function () {
|
||||
}
|
||||
};
|
||||
|
||||
runLoaders(option, function (err, result) {
|
||||
if(err)
|
||||
if (err) {
|
||||
console.log(err, result);
|
||||
}
|
||||
});
|
||||
|
||||
getContext('sdlfkjaldfjiojsdf');
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for localforage-cordovasqlitedriver module v1.0+
|
||||
// Type definitions for localforage-cordovasqlitedriver module 1.0
|
||||
// Project: https://github.com/thgreasi/localForage-cordovaSQLiteDriver
|
||||
// Definitions by: Thodoris Greasidis <https://github.com/thgreasi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Mailcheck 1.1+
|
||||
// Type definitions for Mailcheck 1.1
|
||||
// Project: https://github.com/mailcheck/mailcheck
|
||||
// Definitions by: Paulo Cesar <http://github.com/pocesar>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
// Type definitions for mailgen 2.0
|
||||
// Project: https://github.com/eladnava/mailgen#readme
|
||||
// Definitions by: Kiet Thanh Vo <https://github.com/vothanhkiet>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
import Option = Mailgen.Option;
|
||||
import Content = Mailgen.Content;
|
||||
/**
|
||||
* Created by kiettv on 7/24/16.
|
||||
*/
|
||||
declare class Mailgen {
|
||||
constructor(opts: Option);
|
||||
|
||||
cacheThemes(): void;
|
||||
|
||||
generate(params: Content): any;
|
||||
|
||||
generatePlaintext(params: Content): any;
|
||||
|
||||
parseParams(params: any): any;
|
||||
}
|
||||
|
||||
declare namespace Mailgen {
|
||||
interface Option {
|
||||
theme: string;
|
||||
product: Product;
|
||||
}
|
||||
|
||||
interface Product {
|
||||
name: string;
|
||||
link: string;
|
||||
logo?: string;
|
||||
}
|
||||
|
||||
interface Content {
|
||||
body: ContentBody;
|
||||
}
|
||||
|
||||
interface ContentBody {
|
||||
name: string;
|
||||
intro: string;
|
||||
action?: Action;
|
||||
outro: string;
|
||||
}
|
||||
|
||||
interface Action {
|
||||
instructions: string;
|
||||
button: Button;
|
||||
}
|
||||
|
||||
interface Button {
|
||||
color: string;
|
||||
text: string;
|
||||
link: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = Mailgen;
|
||||
@@ -0,0 +1,20 @@
|
||||
import * as Mailgen from "mailgen"
|
||||
|
||||
const generator: Mailgen = new Mailgen({
|
||||
theme: "default",
|
||||
product: {
|
||||
name: "test",
|
||||
link: "http://localhost",
|
||||
}
|
||||
});
|
||||
|
||||
let content: Mailgen.Content = {
|
||||
body: {
|
||||
name: "Hi",
|
||||
intro: "test",
|
||||
outro: "test",
|
||||
},
|
||||
};
|
||||
|
||||
let html = generator.generate(content);
|
||||
html = generator.generatePlaintext(content);
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mailgen-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Vendored
+17
-17
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Masonry 4.0.0
|
||||
// Type definitions for Masonry 4.0
|
||||
// Project: https://github.com/desandro/masonry
|
||||
// Definitions by: Mark Wilson <https://github.com/m-a-wilson>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -8,28 +8,28 @@
|
||||
// Modified from original definitions by:
|
||||
// Travis Brown < https://github.com/warriorrocker>
|
||||
|
||||
declare module Masonry {
|
||||
declare namespace Masonry {
|
||||
|
||||
class Masonry implements MasonryGrid {
|
||||
class Masonry implements MasonryGrid {
|
||||
constructor(options?: MasonryOptions);
|
||||
constructor(selector: string, options?: MasonryOptions);
|
||||
}
|
||||
|
||||
interface MasonryGrid {
|
||||
interface MasonryGrid {
|
||||
masonry?(): void;
|
||||
masonry?(eventName: string, listener: any): void;
|
||||
|
||||
// layout
|
||||
layout?(): void;
|
||||
layoutItems?(items: Array<any>, isStill?: boolean): void;
|
||||
stamp?(elements: Array<any>): void;
|
||||
unstamp?(elements: Array<any>): void;
|
||||
layoutItems?(items: any[], isStill?: boolean): void;
|
||||
stamp?(elements: any[]): void;
|
||||
unstamp?(elements: any[]): void;
|
||||
|
||||
// add and remove items
|
||||
appended?(elements: Array<any>): void;
|
||||
prepended?(elements: Array<any>): void;
|
||||
addItems?(elements: Array<any>): void;
|
||||
remove?(elements: Array<any>): void;
|
||||
appended?(elements: any[]): void;
|
||||
prepended?(elements: any[]): void;
|
||||
addItems?(elements: any[]): void;
|
||||
remove?(elements: any[]): void;
|
||||
|
||||
// events
|
||||
on?(eventName: string, listener: any): void;
|
||||
@@ -39,11 +39,11 @@ declare module Masonry {
|
||||
// utilities
|
||||
reloadItems?(): void;
|
||||
destroy?(): void;
|
||||
getItemElements?(): Array<any>;
|
||||
getItemElements?(): any[];
|
||||
data?(element: Element): Masonry;
|
||||
}
|
||||
|
||||
interface MasonryOptions {
|
||||
interface MasonryOptions {
|
||||
|
||||
// layout
|
||||
itemSelector?: string;
|
||||
@@ -56,15 +56,15 @@ declare module Masonry {
|
||||
originTop?: boolean;
|
||||
|
||||
// setup
|
||||
containerStyle?: Object;
|
||||
containerStyle?: {};
|
||||
transitionDuration?: any;
|
||||
resize?: boolean;
|
||||
initLayout?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = Masonry;
|
||||
|
||||
interface JQuery {
|
||||
masonry(options?: Masonry.MasonryOptions): JQuery;
|
||||
masonry(options?: Masonry.MasonryOptions): JQuery;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +1,36 @@
|
||||
// test file for masonry-layout.d.ts
|
||||
//import {Masonry} from "./masonry-layout.d.ts";
|
||||
import * as $ from "jquery";
|
||||
import { Masonry } from "./index";
|
||||
|
||||
// responsive layouts
|
||||
function testResponsiveLayouts() {
|
||||
$('.grid').masonry({
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: '.grid-sizer',
|
||||
percentPosition: true
|
||||
});
|
||||
}
|
||||
// function testResponsiveLayouts() {
|
||||
// $(document).ready(function () {
|
||||
// $('.grid').masonry({
|
||||
// itemSelector: '.grid-item',
|
||||
// columnWidth: '.grid-sizer',
|
||||
// percentPosition: true
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
|
||||
// recommended Options
|
||||
function testRecommendedOptions() {
|
||||
$('.grid').masonry({
|
||||
columnWidth: 200,
|
||||
itemSelector: '.grid-item'
|
||||
});
|
||||
// $(document).ready(function () {
|
||||
// $('.grid').masonry({
|
||||
// columnWidth: 200,
|
||||
// itemSelector: '.grid-item'
|
||||
// });
|
||||
// });
|
||||
|
||||
var msnry = new Masonry.Masonry('.grid', {
|
||||
var msnry = new Masonry('.grid', {
|
||||
columnWidth: 200,
|
||||
itemSelector: '.grid-item'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// extended Options
|
||||
function testExtendedOptions() {
|
||||
var msnry = new Masonry.Masonry('.grid', {
|
||||
var msnry = new Masonry('.grid', {
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: '.grid-sizer',
|
||||
percentPosition: true,
|
||||
@@ -41,4 +46,4 @@ function testExtendedOptions() {
|
||||
resize: true,
|
||||
initLayout: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
"asOfVersion": "2.0.18"
|
||||
},
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
"libraryName": "camel-case",
|
||||
"typingsPackageName": "camel-case",
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/camel-case",
|
||||
@@ -202,6 +203,12 @@
|
||||
"typingsPackageName": "sugar",
|
||||
"sourceRepoURL": "https://github.com/andrewplummer/Sugar",
|
||||
"asOfVersion": "2.0.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "ajv",
|
||||
"typingsPackageName": "ajv",
|
||||
"sourceRepoURL": "https://github.com/epoberezkin/ajv",
|
||||
"asOfVersion": "1.0.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for pouch-redux-middleware 0.5.0
|
||||
// Project: https://github.com/pgte/pouch-redux-middleware
|
||||
// Definitions by: Adam Charron <https://github.com/charrondev>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Dispatch, Action, Middleware } from 'redux'
|
||||
import * as PouchDB from 'pouchdb'
|
||||
|
||||
export interface Document {
|
||||
_id: any;
|
||||
[field: string]: any
|
||||
}
|
||||
|
||||
export interface Path {
|
||||
path: string
|
||||
db: PouchDB.Database<any>
|
||||
scheduleRemove?: (doc: Document) => void
|
||||
scheduleInset?: (doc: Document) => void
|
||||
propagateDelete?: (doc: Document, dispatch: Dispatch<any>) => void
|
||||
propagateInsert?: (doc: Document, dispatch: Dispatch<any>) => void
|
||||
propagateUpdate?: (doc: Document, dispatch: Dispatch<any>) => void
|
||||
handleResponse?: (err: Error, data: any, errorCallback: (err: Error) => void) => void
|
||||
queue?: Function
|
||||
docs?: any
|
||||
actions: {
|
||||
remove: (doc: Document) => Action
|
||||
update: (doc: Document) => Action
|
||||
insert: (doc: Document) => Action
|
||||
}
|
||||
}
|
||||
|
||||
export default function PouchMiddlewareFactory(paths?: Path[] | Path): Middleware
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"redux": "^3.6.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import * as redux from 'redux'
|
||||
import makePouchMiddleware, { Document, Path } from 'pouch-redux-middleware'
|
||||
import * as PouchDB from 'pouchdb';
|
||||
|
||||
const types = {
|
||||
DELETE_TODO: 'delete-todo',
|
||||
INSERT_TODO: 'insert-todo',
|
||||
UPDATE_TODO: 'update-todo'
|
||||
}
|
||||
|
||||
const path: Path = {
|
||||
path: "/test",
|
||||
db: new PouchDB('test'),
|
||||
actions: {
|
||||
remove: doc => { return { type: types.DELETE_TODO, id: doc._id } },
|
||||
insert: doc => { return { type: types.INSERT_TODO, todo: doc } },
|
||||
update: doc => { return { type: types.UPDATE_TODO, todo: doc } },
|
||||
}
|
||||
}
|
||||
|
||||
const middleware: redux.Middleware = makePouchMiddleware(path)
|
||||
const otherMiddleware: redux.Middleware = makePouchMiddleware([path, path, path])
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"pouch-redux-middleware-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+15
-21
@@ -1,12 +1,11 @@
|
||||
// Type definitions for react-autosuggest v3.7.3
|
||||
// Type definitions for react-autosuggest 7.0
|
||||
// Project: http://react-autosuggest.js.org/
|
||||
// Definitions by: Nicolas Schmitt <https://github.com/nicolas-schmitt>, Philip Ottesen <https://github.com/pjo256>
|
||||
// Definitions by: Nicolas Schmitt <https://github.com/nicolas-schmitt>, Philip Ottesen <https://github.com/pjo256>, Robert Essig <https://github.com/robessog>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="react"/>
|
||||
import * as React from 'react';
|
||||
|
||||
declare namespace ReactAutosuggest {
|
||||
interface SuggestionUpdateRequest {
|
||||
interface SuggestionsFetchRequest {
|
||||
value: string;
|
||||
reason: string;
|
||||
}
|
||||
@@ -31,16 +30,13 @@ declare namespace ReactAutosuggest {
|
||||
onBlur?: (event: React.FormEvent<any>, params?: BlurEvent) => void;
|
||||
}
|
||||
|
||||
interface ExplicitSuggestionSelectedEventData<TSuggestion> {
|
||||
export interface SuggestionSelectedEventData<TSuggestion> {
|
||||
method: 'click' | 'enter';
|
||||
sectionIndex: number | null;
|
||||
suggestion: TSuggestion;
|
||||
suggestionValue: string;
|
||||
}
|
||||
|
||||
interface SuggestionSelectedEventData extends ExplicitSuggestionSelectedEventData<any> {
|
||||
}
|
||||
|
||||
interface Theme {
|
||||
container?: string;
|
||||
containerOpen?: string;
|
||||
@@ -55,25 +51,23 @@ declare namespace ReactAutosuggest {
|
||||
|
||||
interface AutosuggestProps extends React.Props<Autosuggest> {
|
||||
suggestions: any[];
|
||||
onSuggestionsUpdateRequested?: (request: SuggestionUpdateRequest) => void;
|
||||
getSuggestionValue: (suggestion: any) => string;
|
||||
onSuggestionsFetchRequested: (request: SuggestionsFetchRequest) => void;
|
||||
onSuggestionsClearRequested?: () => void;
|
||||
getSuggestionValue: (suggestion: any) => any;
|
||||
renderSuggestion: (suggestion: any, inputValues: InputValues) => JSX.Element;
|
||||
inputProps: InputProps;
|
||||
alwaysRenderSuggestions?: boolean;
|
||||
onSuggestionSelected?: (event: React.FormEvent<any>, data: SuggestionSelectedEventData<any>) => void;
|
||||
shouldRenderSuggestions?: (value: string) => boolean;
|
||||
alwaysRenderSuggestions?: boolean;
|
||||
focusFirstSuggestion?: boolean;
|
||||
focusInputOnSuggestionClick?: boolean;
|
||||
multiSection?: boolean;
|
||||
renderSectionTitle?: (section: any, inputValues: InputValues) => JSX.Element;
|
||||
getSectionSuggestions?: (section: any) => any[];
|
||||
onSuggestionSelected?: (event: React.FormEvent<any>, data: SuggestionSelectedEventData | ExplicitSuggestionSelectedEventData<any>) => void;
|
||||
focusInputOnSuggestionClick?: boolean;
|
||||
renderInputComponent?: () => JSX.Element;
|
||||
renderSuggestionsContainer?: (children: any) => JSX.Element;
|
||||
theme?: Theme;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
class Autosuggest extends React.Component<AutosuggestProps, any> {}
|
||||
}
|
||||
|
||||
declare module 'react-autosuggest' {
|
||||
import Autosuggest = ReactAutosuggest.Autosuggest;
|
||||
export = Autosuggest;
|
||||
}
|
||||
export class Autosuggest extends React.Component<any, any> {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//region Imports
|
||||
import React = require('react');
|
||||
import ReactDOM = require('react-dom');
|
||||
import Autosuggest = require('react-autosuggest');
|
||||
import { Autosuggest, SuggestionSelectedEventData } from 'react-autosuggest';
|
||||
//endregion
|
||||
|
||||
interface Language {
|
||||
@@ -62,7 +62,7 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
}
|
||||
|
||||
return <Autosuggest suggestions={suggestions}
|
||||
onSuggestionsUpdateRequested={this.onSuggestionsUpdateRequested.bind(this)}
|
||||
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested.bind(this)}
|
||||
getSuggestionValue={this.getSuggestionValue}
|
||||
renderSuggestion={this.renderSuggestion}
|
||||
onSuggestionSelected={this.onSuggestionsSelected}
|
||||
@@ -72,7 +72,7 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
/>;
|
||||
}
|
||||
|
||||
protected onSuggestionsSelected(event: React.FormEvent<any>, data: ReactAutosuggest.ExplicitSuggestionSelectedEventData<Language>): void {
|
||||
protected onSuggestionsSelected(event: React.FormEvent<any>, data: SuggestionSelectedEventData<Language>): void {
|
||||
alert(`Selected language is ${data.suggestion.name} (${data.suggestion.year}).`);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
});
|
||||
}
|
||||
|
||||
protected onSuggestionsUpdateRequested({ value }: any): void {
|
||||
protected onSuggestionsFetchRequested({ value }: any): void {
|
||||
this.setState({
|
||||
suggestions: this.getSuggestions(value)
|
||||
});
|
||||
@@ -188,7 +188,7 @@ export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
|
||||
return <Autosuggest multiSection={true}
|
||||
suggestions={suggestions}
|
||||
onSuggestionsUpdateRequested={this.onSuggestionsUpdateRequested.bind(this)}
|
||||
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested.bind(this)}
|
||||
onSuggestionSelected={this.onSuggestionSelected}
|
||||
getSuggestionValue={this.getSuggestionValue}
|
||||
renderSuggestion={this.renderSuggestion}
|
||||
@@ -197,7 +197,7 @@ export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
inputProps={inputProps} />;
|
||||
}
|
||||
|
||||
protected onSuggestionSelected(event: React.FormEvent<any>, data: ReactAutosuggest.SuggestionSelectedEventData): void {
|
||||
protected onSuggestionSelected(event: React.FormEvent<any>, data: SuggestionSelectedEventData<Language>): void {
|
||||
const language = data.suggestion as Language;
|
||||
|
||||
alert(`Selected language is ${language.name} (${language.year}).`);
|
||||
@@ -219,7 +219,7 @@ export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
});
|
||||
}
|
||||
|
||||
protected onSuggestionsUpdateRequested({ value }: any): void {
|
||||
protected onSuggestionsFetchRequested({ value }: any): void {
|
||||
this.setState({
|
||||
suggestions: this.getSuggestions(value)
|
||||
});
|
||||
@@ -295,7 +295,7 @@ export class ReactAutosuggestCustomTest extends React.Component<any, any> {
|
||||
};
|
||||
|
||||
return <Autosuggest suggestions={suggestions}
|
||||
onSuggestionsUpdateRequested={this.onSuggestionsUpdateRequested}
|
||||
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
|
||||
getSuggestionValue={this.getSuggestionValue}
|
||||
renderSuggestion={this.renderSuggestion}
|
||||
inputProps={inputProps} />;
|
||||
@@ -332,7 +332,7 @@ export class ReactAutosuggestCustomTest extends React.Component<any, any> {
|
||||
});
|
||||
}
|
||||
|
||||
protected onSuggestionsUpdateRequested({ value }: any): void {
|
||||
protected onSuggestionsFetchRequested({ value }: any): void {
|
||||
this.setState({
|
||||
suggestions: this.getSuggestions(value)
|
||||
});
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// Type definitions for redux-batched-actions 0.1
|
||||
// Project: https://github.com/tshelburne/redux-batched-actions
|
||||
// Definitions by: Chad Burggraf <https://github.com/ChadBurggraf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = ReduxBatchedActions;
|
||||
export as namespace ReduxBatchedActions;
|
||||
|
||||
import { Action, Reducer } from 'redux';
|
||||
|
||||
declare namespace ReduxBatchedActions {
|
||||
/**
|
||||
* Batching action creator that creates a higher-order
|
||||
* action from an array of actions.
|
||||
*/
|
||||
export function batchActions<A extends Action>(actions: A[]): Action;
|
||||
|
||||
/**
|
||||
* Creates a higher-order reducer that enables batching
|
||||
* actions for the given reducer.
|
||||
*/
|
||||
export function enableBatching<S>(reducer: Reducer<S>): Reducer<S>;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"redux": "^3.6.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Reducer, createStore } from 'redux';
|
||||
import { Action, createAction } from 'redux-actions';
|
||||
import { enableBatching, batchActions } from 'redux-batched-actions';
|
||||
|
||||
const doThing = createAction('DO_THING');
|
||||
const doOther = createAction('DO_OTHER');
|
||||
|
||||
const reducer = (state: any = {}, action: Action<any>): any => {
|
||||
return state;
|
||||
};
|
||||
|
||||
const store = createStore(enableBatching(reducer), {});
|
||||
|
||||
store.dispatch(batchActions([doThing(), doOther()]));
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"redux-batched-actions-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for redux-persist-transform-compress 4.1
|
||||
// Project: https://github.com/rt2zz/redux-persist-transform-compress
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { PersistConfig, PersistTransformer } from "redux-persist";
|
||||
|
||||
export = createCompressor;
|
||||
declare function createCompressor (config?: PersistConfig): PersistTransformer;
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"redux": "^3.6.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { createStore, Reducer, Store } from "redux"
|
||||
import { createPersistor, Persistor, PersistTransformer } from "redux-persist"
|
||||
import createCompressor = require("redux-persist-transform-compress")
|
||||
|
||||
const reducer: Reducer<any> = (state: any, action: any) => ({})
|
||||
|
||||
const compressor: PersistTransformer = createCompressor({ whitelist : ["foo"] })
|
||||
|
||||
const store: Store<any> = createStore(reducer)
|
||||
|
||||
const persistor: Persistor = createPersistor(store, { transforms : [compressor] })
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"redux-persist-transform-compress-tests.ts"
|
||||
]
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for redux-persist-transform-encrypt 0.1
|
||||
// Project: https://github.com/maxdeviant/redux-persist-transform-encrypt#readme
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { PersistTransformer } from "redux-persist";
|
||||
|
||||
export as namespace ReduxPersistEncryptor;
|
||||
|
||||
export = createEncryptor;
|
||||
|
||||
declare function createEncryptor (config: createEncryptor.EncryptorConfig): PersistTransformer;
|
||||
|
||||
declare namespace createEncryptor {
|
||||
export interface EncryptorConfig {
|
||||
secretKey: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"redux": "^3.6.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { createStore, Reducer, Store } from "redux"
|
||||
import { createPersistor, Persistor, PersistTransformer } from "redux-persist"
|
||||
import { EncryptorConfig } from "redux-persist-transform-encrypt"
|
||||
import * as createEncryptor from "redux-persist-transform-encrypt"
|
||||
|
||||
const reducer: Reducer<any> = (state: any, action: any) => ({})
|
||||
|
||||
const config: EncryptorConfig = { secretKey : "foo" }
|
||||
const encryptor: PersistTransformer = createEncryptor(config)
|
||||
|
||||
const store: Store<any> = createStore(reducer)
|
||||
|
||||
const persistor: Persistor = createPersistor(store, { transforms : [encryptor] })
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"redux-persist-transform-encrypt-tests.ts"
|
||||
]
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for redux-persist-transform-filter 0.0
|
||||
// Project: https://github.com/edy/redux-persist-transform-filter
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { PersistTransformer } from "redux-persist";
|
||||
|
||||
export default function createFilter (reducerName: string, inboundPaths?: string[], outboundPaths?: string[]): PersistTransformer;
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"redux": "^3.6.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { createStore, Reducer, Store } from "redux"
|
||||
import { createPersistor, Persistor, PersistTransformer } from "redux-persist"
|
||||
import createFilter from "redux-persist-transform-filter"
|
||||
|
||||
const reducer: Reducer<any> = (state: any, action: any) => ({})
|
||||
|
||||
const filter: PersistTransformer = createFilter(
|
||||
"foo",
|
||||
["foo.bar"],
|
||||
["fizz.buzz"]
|
||||
)
|
||||
|
||||
const store: Store<any> = createStore(reducer)
|
||||
|
||||
const persistor: Persistor = createPersistor(store, { transforms : [filter] })
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"redux-persist-transform-filter-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
export const KEY_PREFIX: string;
|
||||
export const REHYDRATE: string;
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
// Type definitions for redux-persist 4.0
|
||||
// Project: https://github.com/rt2zz/redux-persist
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Action, GenericStoreEnhancer, Store } from "redux";
|
||||
|
||||
export interface PersistAction<S> extends Action {
|
||||
payload?: S;
|
||||
error?: any;
|
||||
}
|
||||
|
||||
export interface PersistorRehydrateOptions {
|
||||
serial?: boolean;
|
||||
}
|
||||
|
||||
export interface Persistor {
|
||||
purge(keys?: string[]): void;
|
||||
rehydrate<A>(incoming: A, options?: PersistorRehydrateOptions): A;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
}
|
||||
|
||||
export type PersistCallback<A> = (err: any, response?: A) => void;
|
||||
|
||||
export interface PersistTransformer {
|
||||
in(state: any, key: string): any;
|
||||
out(state: any, key: string): any;
|
||||
}
|
||||
|
||||
export interface PersistStorage {
|
||||
setItem(key: string, value: any, callback?: PersistCallback<void>): Promise<void>;
|
||||
getItem<A>(key: string, callback?: PersistCallback<A>): Promise<A>;
|
||||
removeItem(key: string, callback?: PersistCallback<void>): Promise<void>;
|
||||
getAllKeys<A>(callback?: PersistCallback<A>): Promise<A>;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export type PersistStateReconciler<A, B, C> = (state: A, inboundState: B, reducedState: C, log?: boolean) => C;
|
||||
|
||||
export interface PersistAutoRehydrateConfig<A, B, C> {
|
||||
stateReconcile?: PersistStateReconciler<A, B, C>;
|
||||
}
|
||||
|
||||
export interface PersistConfig {
|
||||
whitelist?: string[];
|
||||
blacklist?: string[];
|
||||
transforms?: PersistTransformer[];
|
||||
storage?: PersistStorage;
|
||||
debounce?: number;
|
||||
keyPrefix?: string;
|
||||
serialize?: (data: any) => string;
|
||||
deserialize?: (data: string) => any;
|
||||
}
|
||||
|
||||
export function autoRehydrate<A, B ,C> (config?: PersistAutoRehydrateConfig<A, B, C>): GenericStoreEnhancer;
|
||||
|
||||
export function createPersistor<A> (store: Store<A>, config?: PersistConfig): Persistor;
|
||||
|
||||
export function createTransform (inbound: any, outbound: any, config?: PersistConfig): PersistTransformer;
|
||||
|
||||
export function getStoredState(config?: PersistConfig, callback?: PersistCallback<any>): Promise<any>;
|
||||
|
||||
export function persistStore<A> (store: Store<A>, config?: PersistConfig, callback?: PersistCallback<any>): Persistor;
|
||||
|
||||
export function purgeStoredState (config?: PersistConfig, keys?: string[]): Promise<void>;
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"redux": "^3.6.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { createStore, Store, Reducer } from "redux"
|
||||
import {
|
||||
autoRehydrate,
|
||||
createPersistor,
|
||||
createTransform,
|
||||
getStoredState,
|
||||
persistStore,
|
||||
purgeStoredState,
|
||||
PersistConfig,
|
||||
PersistAutoRehydrateConfig,
|
||||
PersistCallback,
|
||||
Persistor,
|
||||
PersistorRehydrateOptions,
|
||||
PersistTransformer
|
||||
} from "redux-persist"
|
||||
import { KEY_PREFIX, REHYDRATE } from "redux-persist/constants"
|
||||
import { asyncLocalStorage, asyncSessionStorage } from "redux-persist/storages"
|
||||
|
||||
const reducer: Reducer<any> = (state: any, action: any) => ({})
|
||||
|
||||
const persistCallback: PersistCallback<any> = (err: any, response: any) => {}
|
||||
|
||||
const transform: PersistTransformer = createTransform({}, {}, { whitelist : ["foo"] })
|
||||
|
||||
const persistConfig: PersistConfig = {
|
||||
blacklist : ["foo"],
|
||||
whitelist : ["bar"],
|
||||
storage : asyncLocalStorage,
|
||||
transforms : [transform],
|
||||
debounce : 1000,
|
||||
keyPrefix : KEY_PREFIX
|
||||
}
|
||||
|
||||
const rehydrateOptions: PersistorRehydrateOptions = { serial : true }
|
||||
|
||||
const autoRehydrateConfig: PersistAutoRehydrateConfig<any, any, any> = {
|
||||
stateReconcile: (state: any, inboundState: any, reducedState: any, log: boolean) => ({})
|
||||
}
|
||||
|
||||
const store: Store<any> = createStore(reducer, autoRehydrate(autoRehydrateConfig))
|
||||
const persistor: Persistor = persistStore(store, persistConfig, persistCallback)
|
||||
|
||||
purgeStoredState({ whitelist : ["foo"] }, ["bar"])
|
||||
|
||||
getStoredState(persistConfig, (err: any, restoredState: any) => {
|
||||
const store: Store<any> = createStore(reducer, restoredState)
|
||||
const persistor: Persistor = createPersistor(store, persistConfig)
|
||||
const secondaryPersistor: Persistor = createPersistor(store, { storage : asyncSessionStorage })
|
||||
persistor.pause()
|
||||
persistor.resume()
|
||||
persistor.purge(["foo", "bar"])
|
||||
persistor.rehydrate(restoredState, rehydrateOptions)
|
||||
})
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { PersistStorage } from "redux-persist";
|
||||
|
||||
export const asyncLocalStorage: PersistStorage;
|
||||
export const asyncSessionStorage: PersistStorage;
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"constants.d.ts",
|
||||
"storages.d.ts",
|
||||
"redux-persist-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for redux-recycle 1.2
|
||||
// Project: https://github.com/omnidan/redux-recycle
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Reducer } from "redux";
|
||||
|
||||
export default function recycleState<A> (reducer: Reducer<A>, actions: string[], initialState?: A | Reducer<A>): Reducer<A>;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"redux": "^3.6.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { Reducer } from "redux";
|
||||
import recycleState from "redux-recycle";
|
||||
|
||||
const reducer: Reducer<any> = (state: any, action: any) => ({});
|
||||
const otherReducer: Reducer<any> = (state: any, action: any) => ({});
|
||||
|
||||
const resetReducer: Reducer<any> = recycleState(reducer, ["reset"], {});
|
||||
const resetToOtherReducer: Reducer<any> = recycleState(reducer, ["reset"], otherReducer);
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"redux-recycle-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+10
-2
@@ -1,11 +1,11 @@
|
||||
// Type definitions for tapable v0.2.4
|
||||
// Type definitions for tapable v0.2.5
|
||||
// Project: http://github.com/webpack/tapable.git
|
||||
// Definitions by: e-cloud <https://github.com/e-cloud>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare abstract class Tapable {
|
||||
private _plugins: {
|
||||
[index: string]: Tapable.Handler[]
|
||||
[propName: string]: Tapable.Handler[]
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,6 +37,12 @@ declare abstract class Tapable {
|
||||
*/
|
||||
applyPlugins(name: string, ...args: any[]): void;
|
||||
|
||||
applyPlugins0(name: string): void;
|
||||
|
||||
applyPlugins1(name: string, param: any): void;
|
||||
|
||||
applyPlugins2(name: string, param1: any, param2: any): void;
|
||||
|
||||
/**
|
||||
* synchronously applies all registered handlers for target name(event id).
|
||||
*
|
||||
@@ -103,6 +109,8 @@ declare abstract class Tapable {
|
||||
*/
|
||||
applyPluginsAsyncSeries(name: string, ...args: any[]): void;
|
||||
|
||||
applyPluginsAsyncSeries1(name: string, param: any, callback: Tapable.CallbackFunction): void
|
||||
|
||||
/**
|
||||
* asynchronously applies all registered handlers for target name(event id).
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user