mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
Merge remote-tracking branch 'upstream/master' into node-client
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- node
|
||||
- 8
|
||||
|
||||
sudo: false
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import * as args from "args";
|
||||
|
||||
args
|
||||
.option("opt1", "desc")
|
||||
.option("opt2", "desc", false, (value: any): any => value)
|
||||
.options([
|
||||
{
|
||||
name: 'opt3',
|
||||
description: 'desc',
|
||||
defaultValue: 1,
|
||||
init: (value: any) => { },
|
||||
},
|
||||
{
|
||||
name: 'opt4',
|
||||
description: 'desc',
|
||||
},
|
||||
])
|
||||
.command("cm1", "desc")
|
||||
.command("cm2", "desc", (value: any): void => { }, ['a'])
|
||||
.example("ex1", "desc")
|
||||
.examples([
|
||||
{
|
||||
usage: "ex2",
|
||||
description: "desc",
|
||||
},
|
||||
]);
|
||||
|
||||
args.parse(['~/bin/node', '~/dir', 'arg', '--param'], {
|
||||
help: true,
|
||||
name: "name",
|
||||
version: true,
|
||||
usageFilter: (a: any): any => a,
|
||||
value: "value",
|
||||
mri: {
|
||||
args: ['a'],
|
||||
alias: {
|
||||
a: "b",
|
||||
c: ['d'],
|
||||
},
|
||||
boolean: ['wat'],
|
||||
default: {
|
||||
foo: 'bar',
|
||||
},
|
||||
string: ['zulu'],
|
||||
unknown: (param: string): boolean => true,
|
||||
},
|
||||
minimist: {
|
||||
string: ['string'],
|
||||
boolean: ['string'],
|
||||
alias: {
|
||||
bar: 'foo',
|
||||
foo: ['bar1', 'bar2'],
|
||||
},
|
||||
default: {
|
||||
foo: 'bar',
|
||||
},
|
||||
stopEarly: true,
|
||||
"--": false,
|
||||
unknown: (param: string): boolean => true,
|
||||
},
|
||||
mainColor: "yellow",
|
||||
subColor: "dim"
|
||||
});
|
||||
|
||||
args.showHelp();
|
||||
|
||||
const x: string = args.sub[0];
|
||||
Vendored
+72
@@ -0,0 +1,72 @@
|
||||
// Type definitions for args 3.0
|
||||
// Project: https://github.com/leo/args#readme
|
||||
// Definitions by: Slessi <https://github.com/Slessi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare const c: args;
|
||||
export = c;
|
||||
|
||||
interface args {
|
||||
sub: string[];
|
||||
|
||||
option(name: string | [string, string], description: string, defaultValue?: any, init?: OptionInitFunction): args;
|
||||
options(list: Option[]): args;
|
||||
command(name: string, description: string, init?: (name: string, sub: string[], options: ConfigurationOptions) => void, aliases?: string[]): args;
|
||||
example(usage: string, description: string): args;
|
||||
examples(list: Example[]): args;
|
||||
parse(argv: string[], options?: ConfigurationOptions): { [key: string]: any };
|
||||
showHelp(): void;
|
||||
}
|
||||
|
||||
type OptionInitFunction = (value: any) => any;
|
||||
|
||||
interface MriOptions {
|
||||
args?: string[];
|
||||
alias?: {
|
||||
[key: string]: string | string[]
|
||||
};
|
||||
boolean?: string | string[];
|
||||
default?: {
|
||||
[key: string]: any
|
||||
};
|
||||
string?: string | string[];
|
||||
unknown?: (param: string) => boolean;
|
||||
}
|
||||
|
||||
interface MinimistOptions {
|
||||
string?: string | string[];
|
||||
boolean?: boolean | string | string[];
|
||||
alias?: {
|
||||
[key: string]: string | string[]
|
||||
};
|
||||
default?: {
|
||||
[key: string]: any
|
||||
};
|
||||
stopEarly?: boolean;
|
||||
"--"?: boolean;
|
||||
unknown?: (param: string) => boolean;
|
||||
}
|
||||
|
||||
interface ConfigurationOptions {
|
||||
help?: boolean;
|
||||
name?: string;
|
||||
version?: boolean;
|
||||
usageFilter?: (output: any) => any;
|
||||
value?: string;
|
||||
mri: MriOptions;
|
||||
minimist?: MinimistOptions;
|
||||
mainColor: string | string[];
|
||||
subColor: string | string[];
|
||||
}
|
||||
|
||||
interface Option {
|
||||
name: string | [string, string];
|
||||
description: string;
|
||||
init?: OptionInitFunction;
|
||||
defaultValue?: any;
|
||||
}
|
||||
|
||||
interface Example {
|
||||
usage: string;
|
||||
description: string;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"args-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+3
-2
@@ -15,6 +15,7 @@ export interface AsyncResultArrayCallback<T, E> { (err?: E, results?: (T | undef
|
||||
export interface AsyncResultObjectCallback<T, E> { (err: E | undefined, results: Dictionary<T | undefined>): void; }
|
||||
|
||||
export interface AsyncFunction<T, E> { (callback: (err?: E, result?: T) => void): void; }
|
||||
export interface AsyncFunctionEx<T, E> { (callback: (err?: E, ...results: T[]) => void): void; }
|
||||
export interface AsyncIterator<T, E> { (item: T, callback: ErrorCallback<E>): void; }
|
||||
export interface AsyncForEachOfIterator<T, E> { (item: T, key: number|string, callback: ErrorCallback<E>): void; }
|
||||
export interface AsyncResultIterator<T, R, E> { (item: T, callback: AsyncResultCallback<R, E>): void; }
|
||||
@@ -174,9 +175,9 @@ export function parallel<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, callback?
|
||||
export function parallelLimit<T, E>(tasks: Array<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
export function parallelLimit<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultObjectCallback<T, E>): void;
|
||||
export function whilst<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
|
||||
export function doWhilst<E>(fn: AsyncVoidFunction<E>, test: () => boolean, callback: ErrorCallback<E>): void;
|
||||
export function doWhilst<T, E>(fn: AsyncFunctionEx<T, E>, test: (...results: T[]) => boolean, callback: ErrorCallback<E>): void;
|
||||
export function until<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
|
||||
export function doUntil<E>(fn: AsyncVoidFunction<E>, test: () => boolean, callback: ErrorCallback<E>): void;
|
||||
export function doUntil<T, E>(fn: AsyncFunctionEx<T, E>, test: (...results: T[]) => boolean, callback: ErrorCallback<E>): void;
|
||||
export function during<E>(test: (testCallback : AsyncBooleanResultCallback<E>) => void, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
|
||||
export function doDuring<E>(fn: AsyncVoidFunction<E>, test: (testCallback: AsyncBooleanResultCallback<E>) => void, callback: ErrorCallback<E>): void;
|
||||
export function forever<E>(next: (next : ErrorCallback<E>) => void, errBack: ErrorCallback<E>) : void;
|
||||
|
||||
@@ -47,13 +47,13 @@ interface NumberCallback { (err?: Error, result?: number): void; }
|
||||
interface AsyncNumberGetter { (callback: NumberCallback): void; }
|
||||
|
||||
var taskDict: Lookup<AsyncNumberGetter> = {
|
||||
one: function(callback){
|
||||
setTimeout(function(){
|
||||
one: function(callback) {
|
||||
setTimeout(function() {
|
||||
callback(undefined, 1);
|
||||
}, 200);
|
||||
},
|
||||
two: function(callback){
|
||||
setTimeout(function(){
|
||||
two: function(callback) {
|
||||
setTimeout(function() {
|
||||
callback(undefined, 2);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
@@ -239,16 +239,16 @@ async.parallelLimit({
|
||||
|
||||
|
||||
function whileFn(callback: any) {
|
||||
count++;
|
||||
setTimeout(callback, 1000);
|
||||
setTimeout(() => callback(null, ++count), 1000);
|
||||
}
|
||||
|
||||
function whileTest() { return count < 5; }
|
||||
function doWhileTest(count: number) { return count < 5; }
|
||||
var count = 0;
|
||||
async.whilst(whileTest, whileFn, function (err) { });
|
||||
async.until(whileTest, whileFn, function (err) { });
|
||||
async.doWhilst(whileFn, whileTest, function (err) { });
|
||||
async.doUntil(whileFn, whileTest, function (err) { });
|
||||
async.doWhilst(whileFn, doWhileTest, function (err) { });
|
||||
async.doUntil(whileFn, doWhileTest, function (err) { });
|
||||
|
||||
async.during(function (testCallback) { testCallback(new Error(), false); }, function (callback) { callback() }, function (error) { console.log(error) });
|
||||
async.doDuring(function (callback) { callback() }, function (testCallback) { testCallback(new Error(), false); }, function (error) { console.log(error) });
|
||||
|
||||
@@ -4,6 +4,7 @@ var anyObj: any = { abc: 123 };
|
||||
var num: number = 5;
|
||||
var error: Error = new Error();
|
||||
var b: boolean = true;
|
||||
var apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext;
|
||||
var apiGwEvt: AWSLambda.APIGatewayEvent;
|
||||
var customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent;
|
||||
var clientCtx: AWSLambda.ClientContext;
|
||||
@@ -22,33 +23,33 @@ var snsEvtRec: AWSLambda.SNSEventRecord;
|
||||
var snsMsg: AWSLambda.SNSMessage;
|
||||
var snsMsgAttr: AWSLambda.SNSMessageAttribute;
|
||||
var snsMsgAttrs: AWSLambda.SNSMessageAttributes;
|
||||
var S3EvtRec: AWSLambda.S3EventRecord = {
|
||||
var S3EvtRec: AWSLambda.S3EventRecord = {
|
||||
eventVersion: '2.0',
|
||||
eventSource: 'aws:s3',
|
||||
awsRegion: 'us-east-1',
|
||||
eventTime: '1970-01-01T00:00:00.000Z',
|
||||
eventName: 'ObjectCreated:Put',
|
||||
userIdentity: {
|
||||
userIdentity: {
|
||||
principalId: 'AIDAJDPLRKLG7UEXAMPLE'
|
||||
},
|
||||
requestParameters:{
|
||||
requestParameters:{
|
||||
sourceIPAddress: '127.0.0.1'
|
||||
},
|
||||
responseElements: {
|
||||
responseElements: {
|
||||
'x-amz-request-id': 'C3D13FE58DE4C810',
|
||||
'x-amz-id-2': 'FMyUVURIY8/IgAtTv8xRjskZQpcIZ9KG4V5Wp6S7S/JRWeUWerMUE5JgHvANOjpD'
|
||||
},
|
||||
s3: {
|
||||
s3: {
|
||||
s3SchemaVersion: '1.0',
|
||||
configurationId: 'testConfigRule',
|
||||
bucket: {
|
||||
bucket: {
|
||||
name: 'mybucket',
|
||||
ownerIdentity: {
|
||||
ownerIdentity: {
|
||||
principalId: 'A3NL1KOZZKExample'
|
||||
},
|
||||
arn: 'arn:aws:s3:::mybucket'
|
||||
},
|
||||
object: {
|
||||
object: {
|
||||
key: 'HappyFace.jpg',
|
||||
size: 1024,
|
||||
eTag: 'd41d8cd98f00b204e9800998ecf8427e',
|
||||
@@ -65,6 +66,27 @@ var cognitoUserPoolEvent: AWSLambda.CognitoUserPoolEvent;
|
||||
var cloudformationCustomResourceEvent: AWSLambda.CloudFormationCustomResourceEvent;
|
||||
var cloudformationCustomResourceResponse: AWSLambda.CloudFormationCustomResourceResponse;
|
||||
|
||||
/* API Gateway Event request context */
|
||||
str = apiGwEvtReqCtx.accountId;
|
||||
str = apiGwEvtReqCtx.apiId;
|
||||
str = apiGwEvtReqCtx.httpMethod;
|
||||
str = apiGwEvtReqCtx.identity.accessKey;
|
||||
str = apiGwEvtReqCtx.identity.accountId;
|
||||
str = apiGwEvtReqCtx.identity.apiKey;
|
||||
str = apiGwEvtReqCtx.identity.caller;
|
||||
str = apiGwEvtReqCtx.identity.cognitoAuthenticationProvider;
|
||||
str = apiGwEvtReqCtx.identity.cognitoAuthenticationType;
|
||||
str = apiGwEvtReqCtx.identity.cognitoIdentityId;
|
||||
str = apiGwEvtReqCtx.identity.cognitoIdentityPoolId;
|
||||
str = apiGwEvtReqCtx.identity.sourceIp;
|
||||
str = apiGwEvtReqCtx.identity.user;
|
||||
str = apiGwEvtReqCtx.identity.userAgent;
|
||||
str = apiGwEvtReqCtx.identity.userArn;
|
||||
str = apiGwEvtReqCtx.stage;
|
||||
str = apiGwEvtReqCtx.requestId;
|
||||
str = apiGwEvtReqCtx.resourceId;
|
||||
str = apiGwEvtReqCtx.resourcePath;
|
||||
|
||||
/* API Gateway Event */
|
||||
str = apiGwEvt.body;
|
||||
str = apiGwEvt.headers["example"];
|
||||
@@ -74,31 +96,17 @@ str = apiGwEvt.path;
|
||||
str = apiGwEvt.pathParameters["example"];
|
||||
str = apiGwEvt.queryStringParameters["example"];
|
||||
str = apiGwEvt.stageVariables["example"];
|
||||
str = apiGwEvt.requestContext.accountId;
|
||||
str = apiGwEvt.requestContext.apiId;
|
||||
str = apiGwEvt.requestContext.httpMethod;
|
||||
str = apiGwEvt.requestContext.identity.accessKey;
|
||||
str = apiGwEvt.requestContext.identity.accountId;
|
||||
str = apiGwEvt.requestContext.identity.apiKey;
|
||||
str = apiGwEvt.requestContext.identity.caller;
|
||||
str = apiGwEvt.requestContext.identity.cognitoAuthenticationProvider;
|
||||
str = apiGwEvt.requestContext.identity.cognitoAuthenticationType;
|
||||
str = apiGwEvt.requestContext.identity.cognitoIdentityId;
|
||||
str = apiGwEvt.requestContext.identity.cognitoIdentityPoolId;
|
||||
str = apiGwEvt.requestContext.identity.sourceIp;
|
||||
str = apiGwEvt.requestContext.identity.user;
|
||||
str = apiGwEvt.requestContext.identity.userAgent;
|
||||
str = apiGwEvt.requestContext.identity.userArn;
|
||||
str = apiGwEvt.requestContext.stage;
|
||||
str = apiGwEvt.requestContext.requestId;
|
||||
str = apiGwEvt.requestContext.resourceId;
|
||||
str = apiGwEvt.requestContext.resourcePath;
|
||||
apiGwEvtReqCtx = apiGwEvt.requestContext;
|
||||
str = apiGwEvt.resource;
|
||||
|
||||
/* API Gateway CustomAuthorizer Event */
|
||||
str = customAuthorizerEvt.type;
|
||||
str = customAuthorizerEvt.authorizationToken;
|
||||
str = customAuthorizerEvt.methodArn;
|
||||
str = customAuthorizerEvt.authorizationToken;
|
||||
str = apiGwEvt.pathParameters["example"];
|
||||
str = apiGwEvt.queryStringParameters["example"];
|
||||
str = apiGwEvt.stageVariables["example"];
|
||||
apiGwEvtReqCtx = apiGwEvt.requestContext;
|
||||
|
||||
/* SNS Event */
|
||||
snsEvtRecs = snsEvt.Records;
|
||||
|
||||
Vendored
+32
-24
@@ -8,9 +8,35 @@
|
||||
// Yoriki Yamaguchi <https://github.com/y13i>
|
||||
// wwwy3y3 <https://github.com/wwwy3y3>
|
||||
// Ishaan Malhi <https://github.com/OrthoDex>
|
||||
// Daniel Cottone <https://github.com/daniel-cottone>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
// API Gateway "event" request context
|
||||
interface APIGatewayEventRequestContext {
|
||||
accountId: string;
|
||||
apiId: string;
|
||||
httpMethod: string;
|
||||
identity: {
|
||||
accessKey: string | null;
|
||||
accountId: string | null;
|
||||
apiKey: string | null;
|
||||
caller: string | null;
|
||||
cognitoAuthenticationProvider: string | null;
|
||||
cognitoAuthenticationType: string | null;
|
||||
cognitoIdentityId: string | null;
|
||||
cognitoIdentityPoolId: string | null;
|
||||
sourceIp: string;
|
||||
user: string | null;
|
||||
userAgent: string | null;
|
||||
userArn: string | null;
|
||||
},
|
||||
stage: string;
|
||||
requestId: string;
|
||||
resourceId: string;
|
||||
resourcePath: string;
|
||||
}
|
||||
|
||||
// API Gateway "event"
|
||||
interface APIGatewayEvent {
|
||||
body: string | null;
|
||||
@@ -21,37 +47,19 @@ interface APIGatewayEvent {
|
||||
pathParameters: { [name: string]: string } | null;
|
||||
queryStringParameters: { [name: string]: string } | null;
|
||||
stageVariables: { [name: string]: string } | null;
|
||||
requestContext: {
|
||||
accountId: string;
|
||||
apiId: string;
|
||||
httpMethod: string;
|
||||
identity: {
|
||||
accessKey: string | null;
|
||||
accountId: string | null;
|
||||
apiKey: string | null;
|
||||
caller: string | null;
|
||||
cognitoAuthenticationProvider: string | null;
|
||||
cognitoAuthenticationType: string | null;
|
||||
cognitoIdentityId: string | null;
|
||||
cognitoIdentityPoolId: string | null;
|
||||
sourceIp: string;
|
||||
user: string | null;
|
||||
userAgent: string | null;
|
||||
userArn: string | null;
|
||||
},
|
||||
stage: string;
|
||||
requestId: string;
|
||||
resourceId: string;
|
||||
resourcePath: string;
|
||||
};
|
||||
requestContext: APIGatewayEventRequestContext;
|
||||
resource: string;
|
||||
}
|
||||
|
||||
// API Gateway CustomAuthorizer "event"
|
||||
interface CustomAuthorizerEvent {
|
||||
type: string;
|
||||
authorizationToken: string;
|
||||
methodArn: string;
|
||||
authorizationToken?: string;
|
||||
headers?: { [name: string]: string };
|
||||
pathParameters?: { [name: string]: string } | null;
|
||||
queryStringParameters?: { [name: string]: string } | null;
|
||||
requestContext?: APIGatewayEventRequestContext;
|
||||
}
|
||||
|
||||
// SNS "event"
|
||||
|
||||
@@ -165,7 +165,12 @@ function CommonMethodsInEventStreamsAndProperties() {
|
||||
|
||||
{
|
||||
// Calculator for grouped consecutive values until group is cancelled:
|
||||
var events = [
|
||||
interface Event {
|
||||
id:number;
|
||||
type:string;
|
||||
val?:number;
|
||||
}
|
||||
var events: Event[] = [
|
||||
{id: 1, type: "add", val: 3},
|
||||
{id: 2, type: "add", val: -1},
|
||||
{id: 1, type: "add", val: 2},
|
||||
@@ -177,7 +182,7 @@ function CommonMethodsInEventStreamsAndProperties() {
|
||||
{id: 1, type: "cancel"}
|
||||
],
|
||||
keyF = (event:{id:number}) => event.id,
|
||||
limitF = (groupedStream:Bacon.EventStream<string, {id:number; type:string; val?:number}>) => {
|
||||
limitF = (groupedStream:Bacon.EventStream<string, Event>) => {
|
||||
var cancel = groupedStream.filter(x => x.type === "cancel").take(1),
|
||||
adds = groupedStream.filter(x => x.type === "add");
|
||||
return adds.takeUntil(cancel).map(x => x.val);
|
||||
|
||||
Vendored
+224
-62
@@ -43,24 +43,37 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
constructor(callback: (resolve: (thenableOrResult?: R | PromiseLike<R>) => void, reject: (error?: any) => void, onCancel?: (callback: () => void) => void) => void);
|
||||
|
||||
/**
|
||||
* Promises/A+ `.then()`. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
|
||||
* Promises/A+ `.then()`. Returns a new promise chained from this promise.
|
||||
*
|
||||
* The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
|
||||
*/
|
||||
// Based on PromiseLike.then, but returns a Bluebird instance.
|
||||
then<U>(onFulfill?: (value: R) => U | PromiseLike<U>, onReject?: (error: any) => U | PromiseLike<U>): Bluebird<U>; // For simpler signature help.
|
||||
then<TResult1 = R, TResult2 = never>(onfulfilled?: ((value: R) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Bluebird<TResult1 | TResult2>;
|
||||
then<TResult1 = R, TResult2 = never>(
|
||||
onfulfilled?: ((value: R) => TResult1 | PromiseLike<TResult1>) | null,
|
||||
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
|
||||
): Bluebird<TResult1 | TResult2>;
|
||||
|
||||
/**
|
||||
* This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
|
||||
* This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise.
|
||||
*
|
||||
* Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch(onReject: (error: any) => R | PromiseLike<R>): Bluebird<R>;
|
||||
catch<U>(onReject?: ((error: any) => U | PromiseLike<U>) | undefined | null): Bluebird<U | R>;
|
||||
catch<U>(onReject: ((error: any) => U | PromiseLike<U>) | undefined | null): Bluebird<U | R>;
|
||||
|
||||
/**
|
||||
* This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called.
|
||||
* This extends `.catch` to work more like catch-clauses in languages like Java or C#.
|
||||
*
|
||||
* This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called.
|
||||
* Instead of manually checking `instanceof` or `.name === "SomeError"`,
|
||||
* you may specify a number of error constructors which are eligible for this catch handler.
|
||||
* The catch handler that is first met that has eligible constructors specified, is the one that will be called.
|
||||
*
|
||||
* This method also supports predicate-based filters.
|
||||
* If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument.
|
||||
* The return result of the predicate will be used determine whether the error handler should be called.
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
@@ -190,17 +203,23 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
): Bluebird<U | R>;
|
||||
|
||||
/**
|
||||
* This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
|
||||
* This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise.
|
||||
*
|
||||
* Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
caught(onReject: (error: any) => R | PromiseLike<R>): Bluebird<R>;
|
||||
caught<U>(onReject?: ((error: any) => U | PromiseLike<U>) | undefined | null): Bluebird<U | R>;
|
||||
caught<U>(onReject: ((error: any) => U | PromiseLike<U>) | undefined | null): Bluebird<U | R>;
|
||||
|
||||
/**
|
||||
* This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called.
|
||||
* This extends `.catch` to work more like catch-clauses in languages like Java or C#.
|
||||
*
|
||||
* This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called.
|
||||
* Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler.
|
||||
* The catch handler that is first met that has eligible constructors specified, is the one that will be called.
|
||||
*
|
||||
* This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument.
|
||||
* The return result of the predicate will be used determine whether the error handler should be called.
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
@@ -335,7 +354,9 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
error<U>(onReject: (reason: any) => U | PromiseLike<U>): Bluebird<U>;
|
||||
|
||||
/**
|
||||
* Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler.
|
||||
* Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise.
|
||||
*
|
||||
* There are special semantics for `.finally()` in that the final value cannot be modified from the handler.
|
||||
*
|
||||
* Alias `.lastly();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
@@ -344,7 +365,9 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
lastly<U>(handler: () => U | PromiseLike<U>): Bluebird<R>;
|
||||
|
||||
/**
|
||||
* Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise.
|
||||
* Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`.
|
||||
*
|
||||
* Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise.
|
||||
*/
|
||||
bind(thisArg: any): Bluebird<R>;
|
||||
|
||||
@@ -409,7 +432,11 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
timeout(ms: number, message?: string | Error): Bluebird<R>;
|
||||
|
||||
/**
|
||||
* Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success.
|
||||
* Register a node-style callback on this promise.
|
||||
*
|
||||
* When this promise is is either fulfilled or rejected,
|
||||
* the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument.
|
||||
* The error argument will be `null` in case of success.
|
||||
* If the `callback` argument is not a function, this method does not do anything.
|
||||
*/
|
||||
nodeify(callback: (err: any, value?: R) => void, options?: Bluebird.SpreadOption): this;
|
||||
@@ -694,7 +721,8 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
/**
|
||||
* Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise.
|
||||
*
|
||||
* Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call.
|
||||
* Note about second argument: if it's specifically a true array, its values become respective arguments for the function call.
|
||||
* Otherwise it is passed as is as the first argument for the function call.
|
||||
*
|
||||
* Alias for `attempt();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
@@ -702,7 +730,8 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
static attempt<R>(fn: () => R | PromiseLike<R>): Bluebird<R>;
|
||||
|
||||
/**
|
||||
* Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function.
|
||||
* Returns a new function that wraps the given function `fn`.
|
||||
* The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function.
|
||||
* This method is convenient when a function can sometimes return synchronously or throw synchronously.
|
||||
*/
|
||||
static method<R, A1>(fn: (arg1: A1) => R | PromiseLike<R>): (arg1: A1) => Bluebird<R>;
|
||||
@@ -729,7 +758,10 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
static defer<R>(): Bluebird.Resolver<R>;
|
||||
|
||||
/**
|
||||
* Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable.
|
||||
* Cast the given `value` to a trusted promise.
|
||||
*
|
||||
* If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value.
|
||||
* If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable.
|
||||
*/
|
||||
static cast<R>(value: R | PromiseLike<R>): Bluebird<R>;
|
||||
|
||||
@@ -744,7 +776,10 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
static is(value: any): boolean;
|
||||
|
||||
/**
|
||||
* Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have already been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency.
|
||||
* Call this right after the library is loaded to enabled long stack traces.
|
||||
*
|
||||
* Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have already been created.
|
||||
* Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency.
|
||||
*/
|
||||
static longStackTraces(): void;
|
||||
|
||||
@@ -757,24 +792,49 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
static delay(ms: number): Bluebird<void>;
|
||||
|
||||
/**
|
||||
* Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument.
|
||||
* Returns a function that will wrap the given `nodeFunction`.
|
||||
*
|
||||
* Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function.
|
||||
* The node function should conform to node.js convention of accepting a callback as last argument and
|
||||
* calling that callback with error as the first argument and success value on the second argument.
|
||||
*
|
||||
* If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them.
|
||||
*
|
||||
* If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`.
|
||||
*/
|
||||
static promisify<T>(func: (callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): () => Bluebird<T>;
|
||||
static promisify<T, A1>(func: (arg1: A1, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1) => Bluebird<T>;
|
||||
static promisify<T, A1, A2>(func: (arg1: A1, arg2: A2, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2) => Bluebird<T>;
|
||||
static promisify<T, A1, A2, A3>(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3) => Bluebird<T>;
|
||||
static promisify<T, A1, A2, A3, A4>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird<T>;
|
||||
static promisify<T, A1, A2, A3, A4, A5>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird<T>;
|
||||
static promisify<T>(
|
||||
func: (callback: (err: any, result?: T) => void) => void,
|
||||
options?: Bluebird.PromisifyOptions
|
||||
): () => Bluebird<T>;
|
||||
static promisify<T, A1>(
|
||||
func: (arg1: A1, callback: (err: any, result?: T) => void) => void,
|
||||
options?: Bluebird.PromisifyOptions
|
||||
): (arg1: A1) => Bluebird<T>;
|
||||
static promisify<T, A1, A2>(
|
||||
func: (arg1: A1, arg2: A2, callback: (err: any, result?: T) => void) => void,
|
||||
options?: Bluebird.PromisifyOptions
|
||||
): (arg1: A1, arg2: A2) => Bluebird<T>;
|
||||
static promisify<T, A1, A2, A3>(
|
||||
func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result?: T) => void) => void,
|
||||
options?: Bluebird.PromisifyOptions
|
||||
): (arg1: A1, arg2: A2, arg3: A3) => Bluebird<T>;
|
||||
static promisify<T, A1, A2, A3, A4>(
|
||||
func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result?: T) => void) => void,
|
||||
options?: Bluebird.PromisifyOptions
|
||||
): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird<T>;
|
||||
static promisify<T, A1, A2, A3, A4, A5>(
|
||||
func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result?: T) => void) => void,
|
||||
options?: Bluebird.PromisifyOptions
|
||||
): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird<T>;
|
||||
static promisify(nodeFunction: (...args: any[]) => void, options?: Bluebird.PromisifyOptions): (...args: any[]) => Bluebird<any>;
|
||||
|
||||
/**
|
||||
* Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object.
|
||||
* Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain.
|
||||
*
|
||||
* Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method.
|
||||
* The promisified method name will be the original method name postfixed with `Async`. Returns the input object.
|
||||
*
|
||||
* Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example,
|
||||
* if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method.
|
||||
*/
|
||||
// TODO how to model promisifyAll?
|
||||
static promisifyAll<T extends object>(target: T, options?: Bluebird.PromisifyAllOptions<T>): T;
|
||||
@@ -788,19 +848,49 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
static fromCallback<T>(resolver: (callback: (err: any, result?: T) => void) => void, options?: Bluebird.FromNodeOptions): Bluebird<T>;
|
||||
|
||||
/**
|
||||
* Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
|
||||
* Returns a function that can use `yield` to run asynchronous code synchronously.
|
||||
*
|
||||
* This feature requires the support of generators which are drafted in the next version of the language.
|
||||
* Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
|
||||
*/
|
||||
// TODO: After https://github.com/Microsoft/TypeScript/issues/2983 is implemented, we can use
|
||||
// the return type propagation of generators to automatically infer the return type T.
|
||||
static coroutine<T>(generatorFunction: () => IterableIterator<any>, options?: Bluebird.CoroutineOptions): () => Bluebird<T>;
|
||||
static coroutine<T, A1>(generatorFunction: (a1: A1) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2>(generatorFunction: (a1: A1, a2: A2) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3>(generatorFunction: (a1: A1, a2: A2, a3: A3) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3, A4>(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3, A4, A5>(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3, A4, A5, A6>(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3, A4, A5, A6, A7>(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3, A4, A5, A6, A7, A8>(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => IterableIterator<any>, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => Bluebird<T>;
|
||||
static coroutine<T>(
|
||||
generatorFunction: () => IterableIterator<any>,
|
||||
options?: Bluebird.CoroutineOptions
|
||||
): () => Bluebird<T>;
|
||||
static coroutine<T, A1>(
|
||||
generatorFunction: (a1: A1) => IterableIterator<any>,
|
||||
options?: Bluebird.CoroutineOptions
|
||||
): (a1: A1) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2>(
|
||||
generatorFunction: (a1: A1, a2: A2) => IterableIterator<any>,
|
||||
options?: Bluebird.CoroutineOptions
|
||||
): (a1: A1, a2: A2) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3>(
|
||||
generatorFunction: (a1: A1, a2: A2, a3: A3) => IterableIterator<any>,
|
||||
options?: Bluebird.CoroutineOptions
|
||||
): (a1: A1, a2: A2, a3: A3) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3, A4>(
|
||||
generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4) => IterableIterator<any>,
|
||||
options?: Bluebird.CoroutineOptions
|
||||
): (a1: A1, a2: A2, a3: A3, a4: A4) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3, A4, A5>(
|
||||
generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => IterableIterator<any>,
|
||||
options?: Bluebird.CoroutineOptions
|
||||
): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3, A4, A5, A6>(
|
||||
generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => IterableIterator<any>,
|
||||
options?: Bluebird.CoroutineOptions
|
||||
): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3, A4, A5, A6, A7>(
|
||||
generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => IterableIterator<any>,
|
||||
options?: Bluebird.CoroutineOptions
|
||||
): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => Bluebird<T>;
|
||||
static coroutine<T, A1, A2, A3, A4, A5, A6, A7, A8>(
|
||||
generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => IterableIterator<any>,
|
||||
options?: Bluebird.CoroutineOptions
|
||||
): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => Bluebird<T>;
|
||||
|
||||
/**
|
||||
* Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers.
|
||||
@@ -820,7 +910,9 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
static onPossiblyUnhandledRejection(handler?: (error: Error, promise: Bluebird<any>) => void): void;
|
||||
|
||||
/**
|
||||
* Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason.
|
||||
* Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled.
|
||||
* The promise's fulfillment value is an array with fulfillment values at respective positions to the original array.
|
||||
* If any promise in the array rejects, the returned promise is rejected with the rejection reason.
|
||||
*/
|
||||
// TODO enable more overloads
|
||||
// array with promises of different types
|
||||
@@ -833,9 +925,13 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
static all<R>(values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>): Bluebird<R[]>;
|
||||
|
||||
/**
|
||||
* Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason.
|
||||
* Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled.
|
||||
*
|
||||
* If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties.
|
||||
* The promise's fulfillment value is an object with fulfillment values at respective keys to the original object.
|
||||
* If any promise in the object rejects, the returned promise is rejected with the rejection reason.
|
||||
*
|
||||
* If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties.
|
||||
* All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties.
|
||||
*
|
||||
* *The original object is not modified.*
|
||||
*/
|
||||
@@ -859,7 +955,8 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
static race<R>(values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>): Bluebird<R>;
|
||||
|
||||
/**
|
||||
* Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution.
|
||||
* Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises).
|
||||
* When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution.
|
||||
*
|
||||
* If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in.
|
||||
*
|
||||
@@ -874,60 +971,112 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
* ) -> Promise
|
||||
* For coordinating multiple concurrent discrete promises.
|
||||
*
|
||||
* Note: In 1.x and 0.x Promise.join used to be a Promise.all that took the values in as arguments instead in an array. This behavior has been deprecated but is still supported partially - when the last argument is an immediate function value the new semantics will apply
|
||||
* Note: In 1.x and 0.x Promise.join used to be a Promise.all that took the values in as arguments instead in an array.
|
||||
* This behavior has been deprecated but is still supported partially - when the last argument is an immediate function value the new semantics will apply
|
||||
*/
|
||||
static join<R, A1>(arg1: A1 | PromiseLike<A1>, handler: (arg1: A1) => R | PromiseLike<R>): Bluebird<R>;
|
||||
static join<R, A1, A2>(arg1: A1 | PromiseLike<A1>, arg2: A2 | PromiseLike<A2>, handler: (arg1: A1, arg2: A2) => R | PromiseLike<R>): Bluebird<R>;
|
||||
static join<R, A1, A2, A3>(arg1: A1 | PromiseLike<A1>, arg2: A2 | PromiseLike<A2>, arg3: A3 | PromiseLike<A3>, handler: (arg1: A1, arg2: A2, arg3: A3) => R | PromiseLike<R>): Bluebird<R>;
|
||||
static join<R, A1, A2, A3, A4>(arg1: A1 | PromiseLike<A1>, arg2: A2 | PromiseLike<A2>, arg3: A3 | PromiseLike<A3>, arg4: A4 | PromiseLike<A4>, handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => R | PromiseLike<R>): Bluebird<R>;
|
||||
static join<R, A1, A2, A3, A4, A5>(arg1: A1 | PromiseLike<A1>, arg2: A2 | PromiseLike<A2>, arg3: A3 | PromiseLike<A3>, arg4: A4 | PromiseLike<A4>, arg5: A5 | PromiseLike<A5>, handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => R | PromiseLike<R>): Bluebird<R>;
|
||||
static join<R, A1>(
|
||||
arg1: A1 | PromiseLike<A1>,
|
||||
handler: (arg1: A1) => R | PromiseLike<R>
|
||||
): Bluebird<R>;
|
||||
static join<R, A1, A2>(
|
||||
arg1: A1 | PromiseLike<A1>,
|
||||
arg2: A2 | PromiseLike<A2>,
|
||||
handler: (arg1: A1, arg2: A2) => R | PromiseLike<R>
|
||||
): Bluebird<R>;
|
||||
static join<R, A1, A2, A3>(
|
||||
arg1: A1 | PromiseLike<A1>,
|
||||
arg2: A2 | PromiseLike<A2>,
|
||||
arg3: A3 | PromiseLike<A3>,
|
||||
handler: (arg1: A1, arg2: A2, arg3: A3) => R | PromiseLike<R>
|
||||
): Bluebird<R>;
|
||||
static join<R, A1, A2, A3, A4>(
|
||||
arg1: A1 | PromiseLike<A1>,
|
||||
arg2: A2 | PromiseLike<A2>,
|
||||
arg3: A3 | PromiseLike<A3>,
|
||||
arg4: A4 | PromiseLike<A4>,
|
||||
handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => R | PromiseLike<R>
|
||||
): Bluebird<R>;
|
||||
static join<R, A1, A2, A3, A4, A5>(
|
||||
arg1: A1 | PromiseLike<A1>,
|
||||
arg2: A2 | PromiseLike<A2>,
|
||||
arg3: A3 | PromiseLike<A3>,
|
||||
arg4: A4 | PromiseLike<A4>,
|
||||
arg5: A5 | PromiseLike<A5>,
|
||||
handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => R | PromiseLike<R>
|
||||
): Bluebird<R>;
|
||||
|
||||
// variadic array
|
||||
/** @deprecated use .all instead */
|
||||
static join<R>(...values: Array<R | PromiseLike<R>>): Bluebird<R[]>;
|
||||
|
||||
/**
|
||||
* Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
* Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array.
|
||||
* If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well.
|
||||
*
|
||||
* *The original array is not modified.*
|
||||
*/
|
||||
static map<R, U>(values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
|
||||
static map<R, U>(
|
||||
values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>,
|
||||
mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>,
|
||||
options?: Bluebird.ConcurrencyOption
|
||||
): Bluebird<U[]>;
|
||||
|
||||
/**
|
||||
* Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
* Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array.
|
||||
* If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration.
|
||||
*
|
||||
* *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.*
|
||||
* *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned.
|
||||
* If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.*
|
||||
*/
|
||||
static reduce<R, U>(values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>, reducer: (total: U, current: R, index: number, arrayLength: number) => U | PromiseLike<U>, initialValue?: U): Bluebird<U>;
|
||||
static reduce<R, U>(
|
||||
values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>,
|
||||
reducer: (total: U, current: R, index: number, arrayLength: number) => U | PromiseLike<U>,
|
||||
initialValue?: U
|
||||
): Bluebird<U>;
|
||||
|
||||
/**
|
||||
* Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
* Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array.
|
||||
* If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result.
|
||||
*
|
||||
* *The original array is not modified.
|
||||
*/
|
||||
static filter<R>(values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>, filterer: (item: R, index: number, arrayLength: number) => boolean | PromiseLike<boolean>, option?: Bluebird.ConcurrencyOption): Bluebird<R[]>;
|
||||
static filter<R>(
|
||||
values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>,
|
||||
filterer: (item: R, index: number, arrayLength: number) => boolean | PromiseLike<boolean>,
|
||||
option?: Bluebird.ConcurrencyOption
|
||||
): Bluebird<R[]>;
|
||||
|
||||
/**
|
||||
* Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
* Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array.
|
||||
* Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration.
|
||||
* Resolves to the original array unmodified, this method is meant to be used for side effects.
|
||||
* If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration.
|
||||
*/
|
||||
static each<R, U>(values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>, iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Bluebird<R[]>;
|
||||
static each<R, U>(
|
||||
values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>,
|
||||
iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>
|
||||
): Bluebird<R[]>;
|
||||
|
||||
/**
|
||||
* Given an Iterable(arrays are Iterable), or a promise of an Iterable, which produces promises (or a mix of promises and values), iterate over all the values in the Iterable into an array and iterate over the array serially, in-order.
|
||||
*
|
||||
* Returns a promise for an array that contains the values returned by the iterator function in their respective positions. The iterator won't be called for an item until its previous item, and the promise returned by the iterator for that item are fulfilled. This results in a mapSeries kind of utility but it can also be used simply as a side effect iterator similar to Array#forEach.
|
||||
* Returns a promise for an array that contains the values returned by the iterator function in their respective positions.
|
||||
* The iterator won't be called for an item until its previous item, and the promise returned by the iterator for that item are fulfilled.
|
||||
* This results in a mapSeries kind of utility but it can also be used simply as a side effect iterator similar to Array#forEach.
|
||||
*
|
||||
* If any promise in the input array is rejected or any promise returned by the iterator function is rejected, the result will be rejected as well.
|
||||
*/
|
||||
static mapSeries<R, U>(values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>, iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Bluebird<U[]>;
|
||||
static mapSeries<R, U>(
|
||||
values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>,
|
||||
iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>
|
||||
): Bluebird<U[]>;
|
||||
|
||||
/**
|
||||
* A meta method used to specify the disposer method that cleans up a resource when using `Promise.using`.
|
||||
@@ -946,9 +1095,21 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
* will be called when the promise returned by the callback passed to using has settled. The disposer is
|
||||
* necessary because there is no standard interface in node for disposing resources.
|
||||
*/
|
||||
static using<R, T>(disposer: Bluebird.Disposer<R>, executor: (transaction: R) => PromiseLike<T>): Bluebird<T>;
|
||||
static using<R1, R2, T>(disposer: Bluebird.Disposer<R1>, disposer2: Bluebird.Disposer<R2>, executor: (transaction1: R1, transaction2: R2) => PromiseLike<T>): Bluebird<T>;
|
||||
static using<R1, R2, R3, T>(disposer: Bluebird.Disposer<R1>, disposer2: Bluebird.Disposer<R2>, disposer3: Bluebird.Disposer<R3>, executor: (transaction1: R1, transaction2: R2, transaction3: R3) => PromiseLike<T>): Bluebird<T>;
|
||||
static using<R, T>(
|
||||
disposer: Bluebird.Disposer<R>,
|
||||
executor: (transaction: R) => PromiseLike<T>
|
||||
): Bluebird<T>;
|
||||
static using<R1, R2, T>(
|
||||
disposer: Bluebird.Disposer<R1>,
|
||||
disposer2: Bluebird.Disposer<R2>,
|
||||
executor: (transaction1: R1, transaction2: R2
|
||||
) => PromiseLike<T>): Bluebird<T>;
|
||||
static using<R1, R2, R3, T>(
|
||||
disposer: Bluebird.Disposer<R1>,
|
||||
disposer2: Bluebird.Disposer<R2>,
|
||||
disposer3: Bluebird.Disposer<R3>,
|
||||
executor: (transaction1: R1, transaction2: R2, transaction3: R3) => PromiseLike<T>
|
||||
): Bluebird<T>;
|
||||
|
||||
/**
|
||||
* Configure long stack traces, warnings, monitoring and cancellation.
|
||||
@@ -1083,7 +1244,8 @@ declare namespace Bluebird {
|
||||
reject(reason: any): void;
|
||||
|
||||
/**
|
||||
* Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions.
|
||||
* Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property.
|
||||
* The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions.
|
||||
*
|
||||
* If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values.
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"max-line-length": [true, 490],
|
||||
"no-redundant-undefined": false,
|
||||
"max-line-length": [true, 280],
|
||||
"no-unnecessary-generics": false,
|
||||
"prefer-const": false
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -154,7 +154,7 @@ declare namespace Chart {
|
||||
responsiveAnimationDuration?: number;
|
||||
maintainAspectRatio?: boolean;
|
||||
events?: string[];
|
||||
onClick?(any?: any): any;
|
||||
onClick?(event?: MouseEvent, activeElements?: Array<{}>): any;
|
||||
title?: ChartTitleOptions;
|
||||
legend?: ChartLegendOptions;
|
||||
tooltips?: ChartTooltipOptions;
|
||||
|
||||
Vendored
+1
-1
@@ -172,7 +172,7 @@ interface Cheerio {
|
||||
|
||||
empty(): Cheerio;
|
||||
|
||||
html(): string;
|
||||
html(): string | null;
|
||||
html(html: string): Cheerio;
|
||||
|
||||
text(): string;
|
||||
|
||||
Vendored
+2
-1
@@ -7030,8 +7030,9 @@ declare namespace chrome.webNavigation {
|
||||
/**
|
||||
* The ID of the process runs the renderer for this tab.
|
||||
* @since Chrome 22.
|
||||
* @deprecated since Chrome 49. Frames are now uniquely identified by their tab ID and frame ID; the process ID is no longer needed and therefore ignored.
|
||||
*/
|
||||
processId: number;
|
||||
processId?: number;
|
||||
/** The ID of the tab in which the frame is. */
|
||||
tabId: number;
|
||||
/** The ID of the frame in the given tab. */
|
||||
|
||||
Vendored
+1
@@ -437,6 +437,7 @@ export class ShallowWrapper<P = {}, S = {}> {
|
||||
parent(): ShallowWrapper<any, any>;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
export interface ReactWrapper<P = {}, S = {}> extends CommonWrapper<P, S> {}
|
||||
export class ReactWrapper<P = {}, S = {}> {
|
||||
constructor(nodes: JSX.Element | JSX.Element[], root?: ReactWrapper, options?: MountRendererProps);
|
||||
|
||||
Vendored
+11
-2
@@ -4,6 +4,7 @@
|
||||
// Leon Yu <https://github.com/leonyu>
|
||||
// Sukhdeep Singh <https://github.com/SinghSukhdeep>
|
||||
// Jean-Francois Cere <https://github.com/jfcere>
|
||||
// Sebastien Cote <https://github.com/scote>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -555,9 +556,17 @@ interface JQuery {
|
||||
* Collapsibles are accordion elements that expand when clicked on.
|
||||
* They allow you to hide content that is not immediately relevant to the user.
|
||||
*
|
||||
* @param CollapsibleOptions options the collapsible options
|
||||
* @param CollapsibleOptions | string options the collapsible options or the string "destroy" to destroy the collapsible
|
||||
*/
|
||||
collapsible(options?: Materialize.CollapsibleOptions): JQuery;
|
||||
collapsible(options?: Materialize.CollapsibleOptions | string): JQuery;
|
||||
|
||||
/**
|
||||
* Programmatically trigger an event on a selected index
|
||||
*
|
||||
* @param string method the string "open" or "close" to open or to close the collapsible element on specified index
|
||||
* @param number index the element index to trigger "open" or "close" function
|
||||
*/
|
||||
collapsible(method: string, index: number): JQuery;
|
||||
|
||||
/**
|
||||
* Tooltips are small, interactive, textual hints for mainly graphical elements.
|
||||
|
||||
@@ -39,6 +39,8 @@ let collapseHtml = '<ul class="collapsible" data-collapsible="accordion">' +
|
||||
|
||||
$(collapseHtml).collapsible({ accordion: false, onClose: () => { alert('Closed'); } });
|
||||
$(collapseHtml).collapsible({ accordion: true, onOpen: () => { alert('Opened'); } });
|
||||
$(collapseHtml).collapsible('destroy');
|
||||
$(collapseHtml).collapsible('open', 0);
|
||||
|
||||
// Dialogs - Toasts
|
||||
Materialize.toast('I am a toast!', 4000);
|
||||
|
||||
Vendored
+9
-2
@@ -1,8 +1,7 @@
|
||||
// Type definitions for ramda 0.24
|
||||
// Type definitions for ramda 0.25
|
||||
// Project: https://github.com/donnut/typescript-ramda
|
||||
// Definitions by: Erwin Poeze <https://github.com/donnut>
|
||||
// Matt DeKrey <https://github.com/mdekrey>
|
||||
// Liam Goodacre <https://github.com/LiamGoodacre>
|
||||
// Matt Dziuban <https://github.com/mrdziuban>
|
||||
// Stephen King <https://github.com/sbking>
|
||||
// Alejandro Fernandez Haro <https://github.com/afharo>
|
||||
@@ -553,6 +552,14 @@ declare namespace R {
|
||||
*/
|
||||
empty<T>(x: T): T;
|
||||
|
||||
/**
|
||||
* Checks if a list ends with the provided values
|
||||
*/
|
||||
endsWith(a: string, list: string): boolean;
|
||||
endsWith(a: string): (list: string) => boolean;
|
||||
endsWith<T>(a: T | T[], list: T[]): boolean;
|
||||
endsWith<T>(a: T | T[]): (list: T[]) => boolean;
|
||||
|
||||
/**
|
||||
* Takes a function and two values in its domain and returns true if the values map to the same value in the
|
||||
* codomain; false otherwise.
|
||||
|
||||
@@ -2241,6 +2241,15 @@ class Rectangle {
|
||||
R.isEmpty({a: 1}); // => false
|
||||
};
|
||||
|
||||
() => {
|
||||
R.endsWith("c", "abc"); // => true
|
||||
R.endsWith("c")("abc"); // => true
|
||||
R.endsWith(3, [1, 2, 3]); // => true
|
||||
R.endsWith(3)([1, 2, 3]); // => true
|
||||
R.endsWith([3], [1, 2, 3]); // => true
|
||||
R.endsWith([3])([1, 2, 3]); // => true
|
||||
};
|
||||
|
||||
() => {
|
||||
R.not(true); // => false
|
||||
R.not(false); // => true
|
||||
|
||||
Vendored
+6
-16
@@ -9,6 +9,7 @@
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
declare class Autosuggest extends React.Component<Autosuggest.AutosuggestProps> {}
|
||||
|
||||
export = Autosuggest;
|
||||
@@ -57,22 +58,11 @@ declare namespace Autosuggest {
|
||||
method: 'click' | 'enter';
|
||||
}
|
||||
|
||||
interface Theme {
|
||||
container?: string;
|
||||
containerOpen?: string;
|
||||
input?: string;
|
||||
inputOpen?: string;
|
||||
inputFocused?: string;
|
||||
suggestionsContainer?: string;
|
||||
suggestionsContainerOpen?: string;
|
||||
suggestionsList?: string;
|
||||
suggestion?: string;
|
||||
suggestionFirst?: string;
|
||||
suggestionHighlighted?: string;
|
||||
sectionContainer?: string;
|
||||
sectionContainerFirst?: string;
|
||||
sectionTitle?: string;
|
||||
}
|
||||
type ThemeKey = 'container' | 'containerOpen' | 'input' | 'inputOpen' | 'inputFocused' | 'suggestionsContainer' |
|
||||
'suggestionsContainerOpen' | 'suggestionsList' | 'suggestion' | 'suggestionFirst' | 'suggestionHighlighted' |
|
||||
'sectionContainer' | 'sectionContainerFirst' | 'sectionTitle';
|
||||
|
||||
type Theme = Record<string, string | React.CSSProperties> | Partial<Record<ThemeKey, string | React.CSSProperties>>;
|
||||
|
||||
interface AutosuggestProps extends React.Props<Autosuggest> {
|
||||
suggestions: any[];
|
||||
|
||||
@@ -85,7 +85,8 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
const theme = {
|
||||
input: 'themed-input-class',
|
||||
container: 'themed-container-class',
|
||||
suggestionFocused: 'active'
|
||||
suggestionFocused: 'active',
|
||||
sectionTitle: { color: 'blue' }
|
||||
};
|
||||
|
||||
return <Autosuggest
|
||||
|
||||
@@ -45,12 +45,11 @@ interface StartScreenNavigationParams {
|
||||
s: string;
|
||||
}
|
||||
|
||||
interface StartScreenProps extends NavigationScreenProps<StartScreenNavigationParams> { }
|
||||
/**
|
||||
* @desc Simple screen component class with typed component props that should
|
||||
* receive the navigation prop from the AppNavigator.
|
||||
*/
|
||||
class StartScreen extends React.Component<StartScreenProps> {
|
||||
class StartScreen extends React.Component<NavigationScreenProps<StartScreenNavigationParams>> {
|
||||
render() {
|
||||
// Implicit type checks.
|
||||
const navigationStateParams: StartScreenNavigationParams = this.props.navigation.state.params;
|
||||
|
||||
@@ -23,7 +23,7 @@ const initialStateLoader = createLoader(storageEngine);
|
||||
|
||||
const storageMiddleware = createMiddleware(storageEngine, [], []);
|
||||
|
||||
const store = applyMiddleware(storageMiddleware)(createStore)(enhancedReducer);
|
||||
const store = applyMiddleware(storageMiddleware)<TestState>(createStore)(enhancedReducer);
|
||||
|
||||
initialStateLoader(store).then(() => {
|
||||
// render app
|
||||
@@ -33,7 +33,7 @@ initialStateLoader(store).then(() => {
|
||||
// Test for React Native Async Storage engine
|
||||
const storageEngineReactNative = createReactNativeAsyncStorageEngine("test");
|
||||
const storageMiddlewareReactNative = createMiddleware(storageEngine);
|
||||
const storeReactNative = applyMiddleware(storageMiddlewareReactNative)(createStore)(enhancedReducer);
|
||||
const storeReactNative = applyMiddleware(storageMiddlewareReactNative)<TestState>(createStore)(enhancedReducer);
|
||||
initialStateLoader(storeReactNative).then(() => {
|
||||
// render app
|
||||
})
|
||||
|
||||
Vendored
+588
@@ -48901,6 +48901,594 @@ declare namespace Windows {
|
||||
namespace LocalSearch {
|
||||
}
|
||||
}
|
||||
|
||||
/** Provides types and members you can use to access and manage Windows Store-related data for the current app. */
|
||||
namespace Store {
|
||||
/** Defines values that represent the status of an request that is related to a consumable add-on. */
|
||||
enum StoreConsumableStatus {
|
||||
/** The request did not succeed because the remaining balance of the consumable add-on is too low. */
|
||||
insufficentQuantity = 1,
|
||||
/** The request did not succeed because of a network connectivity error. */
|
||||
networkError = 2,
|
||||
/** The request did not succeed because of a server error returned by the Windows Store. */
|
||||
serverError = 3,
|
||||
/** The request succeeded. */
|
||||
succeeded = 0,
|
||||
}
|
||||
|
||||
/** Defines values that represent the state of a package download or installation request. */
|
||||
enum StorePackageUpdateState {
|
||||
/** The download or installation of the package updates was canceled. */
|
||||
canceled = 4,
|
||||
/** The package updates have finished downloading or installing. */
|
||||
completed = 3,
|
||||
/** The package updates are being deployed to the device. */
|
||||
deploying = 2,
|
||||
/** The package updates are being downloaded. */
|
||||
downloading = 1,
|
||||
/** The download or installation of the package updates did not succeed because the device does not have enough battery power. */
|
||||
errorLowBattery = 6,
|
||||
/** The download did not succeed because a Wi-Fi connection is recommended to download the package updates. */
|
||||
errorWiFiRecommended = 7,
|
||||
/** The download did not succeed because a Wi-Fi connection is required to download the package updates. */
|
||||
errorWiFiRequired = 8,
|
||||
/** An unknown error occurred. */
|
||||
otherError = 5,
|
||||
/** The download of the package updates has not started. */
|
||||
pending = 0,
|
||||
}
|
||||
|
||||
/** Defines values that represent the units of a trial period or billing period for a subscription. */
|
||||
enum StoreDurationUnit {
|
||||
/** The period is defined in days. */
|
||||
day = 2,
|
||||
/** The period is defined in hours. */
|
||||
hour = 1,
|
||||
/** The period is defined in minutes. */
|
||||
minute = 0,
|
||||
/** The period is defined in months. */
|
||||
month = 4,
|
||||
/** The period is defined in weeks. */
|
||||
week = 3,
|
||||
/** The period is defined in years. */
|
||||
year = 5,
|
||||
}
|
||||
|
||||
/** Defines values that represent the status of a request to purchase an app or add-on. */
|
||||
enum StorePurchaseStatus {
|
||||
/** The current user has already purchased the specified app or add-on. */
|
||||
alreadyPurchased = 1,
|
||||
/** The purchase request did not succeed because of a network connectivity error. */
|
||||
networkError = 3,
|
||||
/** The purchase request did not succeed. */
|
||||
notPurchased = 2,
|
||||
/** The purchase request did not succeed because of a server error returned by the Windows Store. */
|
||||
serverError = 4,
|
||||
/** The purchase request succeeded. */
|
||||
succeeded = 0,
|
||||
}
|
||||
|
||||
/** Provides status info for a package that is associated with a download or installation request. */
|
||||
interface StorePackageUpdateStatus {
|
||||
/** The number of bytes that have been downloaded. */
|
||||
packageBytesDownloaded: number;
|
||||
/** The download (or download and install) progress of the current package, represented by a value from 0.0 to 1.0. When you use RequestDownloadStorePackageUpdatesAsync to download packages, this value increases from 0.0 to 1.0 during the download of each package. When you use RequestDownloadAndInstallStorePackageUpdatesAsync to download and install packages in a single operation, this value increases from 0.0 to 0.8 during the download of each package, and then it increases from 0.8 to 1.0 during the install phase. */
|
||||
packageDownloadProgress: number;
|
||||
/** The size of the package that is being downloaded, in bytes. This is an estimate, and it might change during the download process. */
|
||||
packageDownloadSizeInBytes: number;
|
||||
/** The family name of the package that is being downloaded or installed. */
|
||||
packageFamilyName: string;
|
||||
/** A StorePackageUpdateState value that indicates the state of the package that is being downloaded or installed. */
|
||||
packageUpdateState: StorePackageUpdateState;
|
||||
/** The current progress of all package downloads in the request, represented by a value from 0.0 to 1.0. */
|
||||
totalDownloadProgress: number;
|
||||
}
|
||||
|
||||
/** Provides response data for a request to acquire a downloadable content (DLC) package license. */
|
||||
abstract class StoreAcquireLicenseResult {
|
||||
/** Gets the error code for the request, if the operation encountered an error. */
|
||||
extendedError: WinRTError;
|
||||
/** Gets an object that represents the downloadable content (DLC) package license. */
|
||||
storePackageLicense: StorePackageLicense;
|
||||
}
|
||||
|
||||
/** Provides license info for the current app, including licenses for products that are offered by the app. */
|
||||
abstract class StoreAppLicense {
|
||||
/** Gets the collection of licenses for add-ons that can be used offline (typically durable add-ons), for which the user has entitlements to use. This property does not include licenses for consumable add-ons. */
|
||||
addOnLicenses: Windows.Foundation.Collections.IMapView<string, StoreLicense>;
|
||||
/** Gets the expiration date and time for the app license. */
|
||||
expirationDate: Date;
|
||||
/** Gets complete license data in JSON format. */
|
||||
extendedJsonData: string;
|
||||
/** Gets a value that indicates whether the license is active. */
|
||||
isActive: boolean;
|
||||
/** Gets a value that indicates whether the license is a trial license. */
|
||||
isTrial: boolean;
|
||||
/** Gets a value that indicates whether the current user has an entitlement for the usage-limited trial that is associated with this app license. */
|
||||
isTrialOwnedByThisUser: boolean;
|
||||
/** Gets the Store ID of the licensed app SKU from the Windows Store catalog. */
|
||||
skuStoreId: string;
|
||||
/** Gets the remaining time for the usage-limited trial that is associated with this app license. */
|
||||
trialTimeRemaining: number;
|
||||
/** Gets a unique ID that identifies the combination of the current user and the usage-limited trial that is associated with this app license. */
|
||||
trialUniqueId: string;
|
||||
}
|
||||
|
||||
/** Represents a specific instance of a product SKU that can be purchased. */
|
||||
abstract class StoreAvailability {
|
||||
/** Gets the end date for the current SKU availability. */
|
||||
endDate: Date;
|
||||
/** Gets complete data for the current SKU availability from the Store in JSON format. */
|
||||
extendedJsonData: string;
|
||||
/** Gets price info for the current SKU availability, including the base price, current price, and sale info. */
|
||||
price: StorePrice;
|
||||
/**
|
||||
* Requests the purchase of the current SKU availability and displays the UI that is used to complete the transaction via the Windows Store.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase.
|
||||
*/
|
||||
requestPurchaseAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<StorePurchaseResult>;
|
||||
/**
|
||||
* Requests the purchase of the current SKU availability and displays the UI that is used to complete the transaction via the Windows Store. This method provides the option to specify additional details for a specific offer within a large catalog of products that are represented by a single listing in the Windows Store, including the product name to display to the user during the purchase.
|
||||
* @param {StorePurchaseProperties} storePurchaseProperties An object that specifies additional info for the purchase request, including the product name to display to the user during the purchase.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase.
|
||||
*/
|
||||
requestPurchaseAsync(storePurchaseProperties: StorePurchaseProperties): Windows.Foundation.IPromiseWithIAsyncOperation<StorePurchaseResult>;
|
||||
/** Gets the Store ID of the current SKU availability from the Windows Store catalog. */
|
||||
storeId: string;
|
||||
}
|
||||
|
||||
/** Provides additional data for a product SKU that the user has an entitlement to use. */
|
||||
abstract class StoreCollectionData {
|
||||
/** Gets the date on which the product SKU was acquired. */
|
||||
acquiredDate: Date;
|
||||
/** Gets the promotion campaign ID that is associated with the product SKU. */
|
||||
campaignId: string;
|
||||
/** Gets the developer offer ID that is associated with the product SKU. */
|
||||
developerOfferId: string;
|
||||
/** Gets the end date of the trial for the product SKU, if the SKU is a trial version or a durable add-on that expires after a set duration. */
|
||||
endDate: Date;
|
||||
/** Gets complete collection data for the product SKU in JSON format. */
|
||||
extendedJsonData: string;
|
||||
/** Gets a value that indicates whether the product SKU is a trial version. */
|
||||
isTrial: boolean;
|
||||
/** Gets the start date of the trial for the product SKU, if the SKU is a trial version or a durable add-on that expires after a set duration. */
|
||||
startDate: Date;
|
||||
/** Gets the remaining trial time for the product SKU. */
|
||||
trialTimeRemaining: number;
|
||||
}
|
||||
|
||||
/** Provides response data for a request that involves a consumable add-on for the current app. */
|
||||
abstract class StoreConsumableResult {
|
||||
/** Gets the remaining balance for the consumable add-on. */
|
||||
balanceRemaining: number;
|
||||
/** Gets the error code for the request, if the operation encountered an error. */
|
||||
extendedError: WinRTError;
|
||||
/** Gets the status of the request. */
|
||||
status: StoreConsumableStatus;
|
||||
/** Gets the tracking ID that was submitted with the ReportConsumableFulfillmentAsync request. */
|
||||
trackingId: string;
|
||||
}
|
||||
|
||||
/** Provides members you can use to access and manage Windows Store-related data for the current app. For example, you can use members of this class to get Windows Store listing and license info for the current app, purchase the current app or products that are offered by the app, or download and install package updates for the app. */
|
||||
abstract class StoreContext {
|
||||
/**
|
||||
* Acquires a license for the specified downloadable content (DLC) package for the current app.
|
||||
* @param optionalPackage The DLC package for which to acquire a license.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreAcquireLicenseResult object that contains the license.
|
||||
*/
|
||||
acquireStoreLicenseForOptionalPackageAsync(optionalPackage: Windows.ApplicationModel.Package): Windows.Foundation.IPromiseWithIAsyncOperation<StoreAcquireLicenseResult>;
|
||||
/**
|
||||
* Gets Store product details for the app or add-on that is associated with the specified package.
|
||||
* @param productKinds An array of strings that specify the types of Store products that might be associated with the package. For a list of the supported string values, see the ProductKind property.
|
||||
* @param package A Package that represents the package for which you want to get the corresponding Store product details.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreProductResult object. Use the Product property of this object to access a StoreProduct that contains Store product details for the specified package.
|
||||
*/
|
||||
findStoreProductForPackageAsync(productKinds: Windows.Foundation.Collections.IIterable<string>, package: Windows.ApplicationModel.Package): Windows.Foundation.IPromiseWithIAsyncOperation<StoreProductResult>;
|
||||
/**
|
||||
* Gets the collection of packages for the current app that have updates available for download from the Windows Store, including optional packages for the app (also called downloadable content or DLC).
|
||||
* @return An asynchronous operation that, on successful completion, returns a collection of StorePackageUpdate objects that represent the packages that have updates available.
|
||||
*/
|
||||
getAppAndOptionalStorePackageUpdatesAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<StorePackageUpdate>;
|
||||
/**
|
||||
* Gets license info for the current app, including licenses for add-ons for the current app.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreAppLicense object that contains license info for the current app, including add-on licenses.
|
||||
*/
|
||||
getAppLicenseAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<StoreAppLicense>;
|
||||
/**
|
||||
* Gets the list of products that can be purchased from within the current app.
|
||||
* @param productKinds An array of strings that specify the types of products you want to get. For a list of the supported string values, see the ProductKind property.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreProductQueryResult that provides access to the associated products and relevant error info.
|
||||
*/
|
||||
getAssociatedStoreProductsAsync(productKinds: Windows.Foundation.Collections.IIterable<string>): Windows.Foundation.IPromiseWithIAsyncOperation<StoreProductQueryResult>;
|
||||
/**
|
||||
* Gets the list of products that can be purchased from within the current app. This method supports paging to return the results.
|
||||
* @param productKinds An array of strings that specify the types of products you want to get. For a list of the supported string values, see the ProductKind property.
|
||||
* @param maxItemsToRetrievePerPage The maximum number of products to return in each page of results.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreProductPagedQueryResult that provides access to the associated products, relevant error info, and the next page of results.
|
||||
*/
|
||||
getAssociatedStoreProductsWithPagingAsync(productKinds: Windows.Foundation.Collections.IIterable<string>, maxItemsToRetrievePerPage: number): Windows.Foundation.IPromiseWithIAsyncOperation<StoreProductPagedQueryResult>;
|
||||
/**
|
||||
* Gets the remaining balance for the specified consumable add-on for the current app.
|
||||
* @param productStoreId The Store ID for the add-on (as provided by the StoreId property of the StoreProduct that represents the add-on).
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreConsumableResult that provides the remaining balance and other info.
|
||||
*/
|
||||
getConsumableBalanceRemainingAsync(productStoreId: string): Windows.Foundation.IPromiseWithIAsyncOperation<StoreConsumableResult>;
|
||||
/**
|
||||
* Retrieves a Windows Store collections ID key that can be used to query for product entitlements or to consume product entitlements that are owned by the current user.
|
||||
* @param serviceTicket An Azure Active Directory access token that identifies the publisher of the current app. For more information about generating this token, see Manage product entitlements from a service.
|
||||
* @param publisherUserId An anonymous ID that identifies the current user in the context of services that are managed by the publisher of the current app. If the publisher maintains anonymous user IDs for use in their services, they can use this parameter to correlate these user IDs with the calls they make to Windows Store services. This parameter is optional.
|
||||
* @return An asynchronous operation that, on successful completion, returns the collections ID key for the current user. This key is valid for 90 days.
|
||||
*/
|
||||
getCustomerCollectionsIdAsync(serviceTicket: string, publisherUserId?: string): Windows.Foundation.IPromiseWithIAsyncOperation<string>;
|
||||
/**
|
||||
* Retrieves a Windows Store purchase ID key that can be used to grant entitlements for free products on behalf of the current user.
|
||||
* @param serviceTicket An Azure Active Directory access token that identifies the publisher of the current app. For more information about generating this token, see Manage product entitlements from a service.
|
||||
* @param publisherUserId An anonymous ID that identifies the current user in the context of services that are managed by the publisher of the current app. If the publisher maintains anonymous user IDs for use in their services, they can use this parameter to correlate these user IDs with the calls they make to Windows Store services. This parameter is optional.
|
||||
* @return An asynchronous operation that, on successful completion, returns the purchase ID key for the current user. This key is valid for 90 days.
|
||||
*/
|
||||
getCustomerPurchaseIdAsync(serviceTicket: string, publisherUserId?: string): Windows.Foundation.IPromiseWithIAsyncOperation<string>;
|
||||
/**
|
||||
* Gets a StoreContext object that can be used to access and manage Windows Store-related data for the current user in the context of the current app.
|
||||
* @return An object that you can use to access and manage Windows Store-related data for the current user.
|
||||
*/
|
||||
static getDefault(): StoreContext;
|
||||
/**
|
||||
* Gets a StoreContext object that can be used to access and manage Windows Store-related data for the specified user in the context of the current app.
|
||||
* @param user An object that identifies the user whose Windows Store-related data you want to access and manage.
|
||||
* @return An object that you can use to access and manage Windows Store-related data for the specified user.
|
||||
*/
|
||||
static getForUser(user: Windows.System.User): StoreContext;
|
||||
/**
|
||||
* Gets Windows Store listing info for the current app and provides access to a method that you can use to purchase the app for the current user.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreProductResult object that contains Windows Store listing info for the current app and any relevant error info.
|
||||
*/
|
||||
getStoreProductForCurrentAppAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<StoreProductResult>;
|
||||
/**
|
||||
* Gets Windows Store listing info for the specified products that can be purchased from within the current app.
|
||||
* @param productKinds An array of strings that specify the types of products for which you want to retrieve listing info. For a list of the supported string values, see the ProductKind property.
|
||||
* @param storeIds An array of the Store ID strings for the products for which you want to retrieve listing info.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreProductQueryResult object that contains Windows Store listing info for the specified products and any relevant error info.
|
||||
*/
|
||||
getStoreProductsAsync(productKinds: Windows.Foundation.Collections.IIterable<string>, storeIds: Windows.Foundation.Collections.IIterable<string>): Windows.Foundation.IPromiseWithIAsyncOperation<StoreProductQueryResult>;
|
||||
/**
|
||||
* Gets Windows Store info for the add-ons of the current app for which the user has entitlements to use.
|
||||
* @param productKinds An array of strings that specify the types of add-ons for which you want to retrieve listing info. For a list of the supported string values, see the ProductKind property.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreProductQueryResult object that contains Windows Store listing info for the add-ons of the current app for which the user has entitlements to use.
|
||||
*/
|
||||
getUserCollectionAsync(productKinds: Windows.Foundation.Collections.IIterable<string>): Windows.Foundation.IPromiseWithIAsyncOperation<StoreProductQueryResult>;
|
||||
/**
|
||||
* Gets Windows Store info for the add-ons of the current app for which the user has entitlements to use. This method supports paging to return the results.
|
||||
* @param productKinds An array of strings that specify the types of add-ons for which you want to retrieve listing info. For a list of the supported string values, see the ProductKind property.
|
||||
* @param maxItemsToRetrievePerPage The maximum number of add-ons to return in each page of results.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreProductPagedQueryResult object that provides access to the Windows Store listing info for the add-ons of the current app for which the user has entitlements to use, as well as the next page of results.
|
||||
*/
|
||||
getUserCollectionWithPagingAsync(productKinds: Windows.Foundation.Collections.IIterable<string>, maxItemsToRetrievePerPage: number): Windows.Foundation.IPromiseWithIAsyncOperation<StoreProductPagedQueryResult>;
|
||||
/** Raised when the status of the app's license changes (for example, the trial period has expired or the user has purchased the full version of the app). */
|
||||
onofflinelicenseschanged: Windows.Foundation.TypedEventHandler<StoreContext, object>;
|
||||
/**
|
||||
* Reports a consumable add-on for the current app as fulfilled in the Windows Store.
|
||||
* @param productStoreId The Store ID of the consumable add-on that you want to report as fulfilled.
|
||||
* @param quantity The number of units of the consumable add-on that you want to report as fulfilled. For a Store-managed consumable (that is, a consumable where Microsoft keeps track of the balance), specify the number of units that have been consumed. For a developer-managed consumable (that is, a consumable where the developer keeps track of the balance), specify 1.
|
||||
* @param trackingId A developer-supplied GUID that identifies the specific transaction that the fulfillment operation is associated with for tracking purposes. For more information, see the remarks.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreConsumableResult object that contains info about the fulfillment operation, such as the remaining balance of add-on units.
|
||||
*/
|
||||
reportConsumableFulfillmentAsync(productStoreId: string, quantity: number, trackingId: string): Windows.Foundation.IPromiseWithIAsyncOperation<StoreConsumableResult>;
|
||||
/**
|
||||
* Downloads and installs the specified downloadable content (DLC) packages for the current app from the Windows Store.
|
||||
* @param storeIds The product IDs of the add-on packages to install.
|
||||
* @return An object that the caller can observe to track progress and completion for the operation. On successful completion, the result is a StorePackageUpdateResult object that provides info about the package updates.
|
||||
*/
|
||||
requestDownloadAndInstallStorePackagesAsync(storeIds: Windows.Foundation.Collections.IIterable<string>): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress<StorePackageUpdateResult, StorePackageUpdateStatus>;
|
||||
/**
|
||||
* Downloads and installs the specified package updates for the current app from the Windows Store.
|
||||
* @param storePackageUpdates The set of StorePackageUpdate objects that represent the updated packages to download and install.
|
||||
* @return An object that the caller can observe to track progress and completion for the operation. On successful completion, the result is a StorePackageUpdateResult object that provides info about the package updates.
|
||||
*/
|
||||
requestDownloadAndInstallStorePackageUpdatesAsync(storePackageUpdates: Windows.Foundation.Collections.IIterable<StorePackageUpdate>): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress<StorePackageUpdateResult, StorePackageUpdateStatus>;
|
||||
/**
|
||||
* Downloads the specified package updates for the current app from the Windows Store.
|
||||
* @param storePackageUpdates The set of StorePackageUpdate objects that represent the updated packages to download.
|
||||
* @return An object that the caller can observe to track progress and completion for the operation. On successful completion, the result is a StorePackageUpdateResult object that provides info about the package updates.
|
||||
*/
|
||||
requestDownloadStorePackageUpdatesAsync(storePackageUpdates: Windows.Foundation.Collections.IIterable<StorePackageUpdate>): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress<StorePackageUpdateResult, StorePackageUpdateStatus>;
|
||||
/**
|
||||
* Requests the purchase for the specified app or add-on and displays the UI that is used to complete the transaction via the Windows Store.
|
||||
* @param storeId The Store ID of the app or the add-on that you want to purchase for the current user.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase.
|
||||
*/
|
||||
requestPurchaseAsync(storeId: string): Windows.Foundation.IPromiseWithIAsyncOperation<StorePurchaseResult>;
|
||||
/**
|
||||
* Requests the purchase for the specified app or add-on and displays the UI that is used to complete the transaction via the Windows Store. This method provides the option to specify additional details for a specific offer within a large catalog of products that are represented by a single listing in the Windows Store, including the product name to display to the user during the purchase.
|
||||
* @param storeId The Store ID of the app or the add-on that you want to purchase for the current user.
|
||||
* @param storePurchaseProperties An object that specifies additional info for the purchase request, including the product name to display to the user during the purchase.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase.
|
||||
*/
|
||||
requestPurchaseAsync(storeId: string, storePurchaseProperties: StorePurchaseProperties): Windows.Foundation.IPromiseWithIAsyncOperation<StorePurchaseResult>;
|
||||
/** Gets an object that provides info about the current user. */
|
||||
user: Windows.System.User;
|
||||
}
|
||||
|
||||
/** Represents an image that is associated with a product listing in the Windows Store. */
|
||||
abstract class StoreImage {
|
||||
/** Gets the caption for the image. */
|
||||
caption: string;
|
||||
/** Gets the height of the image, in pixels. */
|
||||
height: number;
|
||||
/** Gets the tag for the image. */
|
||||
imagePurposeTag: string;
|
||||
/** Gets the URI of the image. */
|
||||
uri: Windows.Foundation.Uri;
|
||||
/** Gets the width of the image, in pixels. */
|
||||
width: number;
|
||||
}
|
||||
|
||||
/** Provides license info for an add-on that is associated with the current app. */
|
||||
abstract class StoreLicense {
|
||||
/** Gets the expiration date and time for the add-on license. */
|
||||
expirationDate: Date;
|
||||
/** Gets complete license data in JSON format. */
|
||||
extendedJsonData: string;
|
||||
/** Gets in the product ID for the add-on. */
|
||||
inAppOfferToken: string;
|
||||
/** Gets a value that indicates whether the add-on license is active. */
|
||||
isActive: boolean;
|
||||
/** Gets the Store ID of the licensed add-on SKU from the Windows Store catalog. */
|
||||
skuStoreId: string;
|
||||
}
|
||||
|
||||
/** Provides license info for a downloadable content (DLC) package for the current app. */
|
||||
abstract class StorePackageLicense {
|
||||
/** Closes and releases any resources used by this StorePackageLicense. */
|
||||
close(): void;
|
||||
/** Gets a value that indicates whether the license is valid. */
|
||||
isValid: boolean;
|
||||
/** Raised when user no longer has rights to the license on the current device (for example, the user has acquired the license on a different device). */
|
||||
onlicenselost: Windows.Foundation.TypedEventHandler<StorePackageLicense, object>;
|
||||
/** Gets the downloadable content (DLC) package that is associated with the license. */
|
||||
package: Windows.ApplicationModel.Package;
|
||||
/** Releases the license for the downloadable content (DLC) package. */
|
||||
releaseLicense(): void;
|
||||
}
|
||||
|
||||
/** Provides info about a package for the current app that has an update available for download from the Windows Store. */
|
||||
abstract class StorePackageUpdate {
|
||||
/** Gets a value that indicates whether the package that has an update available for download from the Windows Store is a mandatory package, as specified by the developer in the Windows Dev Center dashboard. */
|
||||
mandatory: boolean;
|
||||
/** Gets the package that has an update available for download from the Windows Store. */
|
||||
package: Windows.ApplicationModel.Package;
|
||||
}
|
||||
|
||||
/** Provides info about a completed package update request for the current app. */
|
||||
abstract class StorePackageUpdateResult {
|
||||
/** Gets the state of the completed package update request. */
|
||||
overallState: StorePackageUpdateState;
|
||||
/** Gets info about the status of each of the package updates that are associated with the completed request. */
|
||||
storePackageUpdateStatuses: Windows.Foundation.Collections.IVectorView<StorePackageUpdateStatus>;
|
||||
}
|
||||
|
||||
/** Contains pricing info for a product listing in the Windows Store. */
|
||||
abstract class StorePrice {
|
||||
/** Gets the ISO 4217 currency code for the market of the current user. */
|
||||
currencyCode: string;
|
||||
/** Gets the base price for the product with the appropriate formatting for the market of the current user. */
|
||||
formattedBasePrice: string;
|
||||
/** Gets the purchase price for the product with the appropriate formatting for the market of the current user. */
|
||||
formattedPrice: string;
|
||||
/** Gets the recurring price for the product with the appropriate formatting for the market of the current user, if recurring billing is enabled for this product. */
|
||||
formattedRecurrencePrice: string;
|
||||
/** Gets a value that indicates whether the product is on sale. */
|
||||
isOnSale: boolean;
|
||||
/** Gets the end date for the sale period for the product, if the product is on sale. */
|
||||
saleEndDate: Date;
|
||||
}
|
||||
|
||||
/** Represents a product that is available in the Windows Store. */
|
||||
abstract class StoreProduct {
|
||||
/** Gets the product description from the Windows Store listing. */
|
||||
description: string;
|
||||
/** Gets complete data for the product from the Store in JSON format. */
|
||||
extendedJsonData: string;
|
||||
/**
|
||||
* Indicates whether any SKU of this product is installed on the current device. This method is intended to be used for products that have downloadable content (DLC).
|
||||
* @return An asynchronous operation that, on successful completion, returns true if a SKU of this product is installed on the current device; otherwise, false.
|
||||
*/
|
||||
getIsAnySkuInstalledAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<boolean>;
|
||||
/** Gets a value that indicates whether the product has optional downloadable content (DLC). */
|
||||
hasDigitalDownload: boolean;
|
||||
/** Gets the images from the Windows Store listing for the product. */
|
||||
images: Windows.Foundation.Collections.IVectorView<StoreImage>;
|
||||
/** Gets the product ID for this product, if the current StoreProduct represents an add-on. */
|
||||
inAppOfferToken: string;
|
||||
/** Gets a value that indicates whether the current user has an entitlement to use the default SKU of the product. */
|
||||
isInUserCollection: boolean;
|
||||
/** Gets the keywords that are associated with the product in the Windows Dev Center dashboard. This property only applies to StoreProduct objects that represent add-ons. These strings correspond to the value of the Keywords field in the properties page for the add-on in the Windows Dev Center dashboard. */
|
||||
keywords: Windows.Foundation.Collections.IVectorView<string>;
|
||||
/** Gets the language for the data in the Windows Store listing for the product. */
|
||||
language: string;
|
||||
/** Gets the URI to the Windows Store listing for the product. */
|
||||
linkUri: Windows.Foundation.Uri;
|
||||
/** Gets the price for the default SKU and availability for the product. */
|
||||
price: StorePrice;
|
||||
/** Gets the type of the product. These values are currently supported: Application, Game, Consumable, UnmanagedConsumable, and Durable. */
|
||||
productKind: string;
|
||||
/**
|
||||
* Requests the purchase of the default SKU and availability for the product and displays the UI that is used to complete the transaction via the Windows Store.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase.
|
||||
*/
|
||||
requestPurchaseAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<StorePurchaseResult>;
|
||||
/**
|
||||
* Requests the purchase of the default SKU and availability for the product and displays the UI that is used to complete the transaction via the Windows Store. This method provides the option to specify additional details for a specific offer within a large catalog of products that are represented by a single listing in the Windows Store, including the product name to display to the user during the purchase.
|
||||
* @param storePurchaseProperties An object that specifies additional info for the purchase request, including the product name to display to the user during the purchase.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase.
|
||||
*/
|
||||
requestPurchaseAsync(storePurchaseProperties: StorePurchaseProperties): Windows.Foundation.IPromiseWithIAsyncOperation<StorePurchaseResult>;
|
||||
/** Gets the list of available SKUs for the product. */
|
||||
skus: Windows.Foundation.Collections.IVectorView<StoreSku>;
|
||||
/** Gets the Store ID for this product. */
|
||||
storeId: string;
|
||||
/** Gets the product title from the Windows Store listing. */
|
||||
title: string;
|
||||
/** Gets the videos from the Windows Store listing for the product. */
|
||||
videos: Windows.Foundation.Collections.IVectorView<StoreVideo>;
|
||||
}
|
||||
|
||||
/** Provides response data for a paged request to retrieve details about products that can be purchased from within the current app. */
|
||||
abstract class StoreProductPagedQueryResult {
|
||||
/** Gets the error code for the request, if the operation encountered an error. */
|
||||
extendedError: WinRTError;
|
||||
/**
|
||||
* Returns the next page of results. To determine if there are more pages of results, use the HasMoreResults property.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreProductPagedQueryResult object that provides the next page of results.
|
||||
*/
|
||||
getNextAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<StoreProductPagedQueryResult>;
|
||||
/** Gets a value that indicates whether there are additional pages of results. To get the next page of results, use the GetNextAsync method. */
|
||||
hasMoreResults: boolean;
|
||||
/** Gets the collection of products returned by the request. */
|
||||
products: Windows.Foundation.Collections.IMapView<string, StoreProduct>;
|
||||
}
|
||||
|
||||
/** Provides response data for a request to retrieve details about products that can be purchased from within the current app. */
|
||||
abstract class StoreProductQueryResult {
|
||||
/** Gets the error code for the request, if the operation encountered an error. */
|
||||
extendedError: WinRTError;
|
||||
/** Gets the collection of products returned by the request. */
|
||||
products: Windows.Foundation.Collections.IMapView<string, StoreProduct>;
|
||||
}
|
||||
|
||||
/** Provides response data for a request to retrieve details about the current app. */
|
||||
abstract class StoreProductResult {
|
||||
/** Gets the error code for the request, if the operation encountered an error. */
|
||||
extendedError: WinRTError;
|
||||
/** Gets info about the current app. */
|
||||
product: StoreProduct;
|
||||
}
|
||||
|
||||
/** Contains additional details that you can pass to a purchase request for a product, including the product name to display to the user during the purchase. */
|
||||
class StorePurchaseProperties {
|
||||
/** Initializes a new instance of the StorePurchaseProperties class. */
|
||||
constructor();
|
||||
/** Initializes a new instance of the StorePurchaseProperties class. This overload provides the option to specify the product name that is displayed to the user during the purchase.
|
||||
* @param name The product name that is displayed to the user during the purchase.
|
||||
*/
|
||||
constructor(name: string);
|
||||
/** Gets or sets a JSON-formatted string that contains extended data to pass with the purchase request to the Windows Store. */
|
||||
extendedJsonData: string;
|
||||
/** Gets or sets the product name that is displayed to the user during the purchase. The specified name appears in the title bar of the purchase UI. */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** Provides response data for a request to purchase an app or product that is offered by the app. */
|
||||
abstract class StorePurchaseResult {
|
||||
/** Gets the error code for the purchase request, if the operation encountered an error. */
|
||||
extendedError: WinRTError;
|
||||
/** Gets the status of the purchase request. */
|
||||
status: StorePurchaseStatus;
|
||||
}
|
||||
|
||||
/** Provides a helper method that can be used to send requests to the Windows Store for operations that do not yet have a corresponding API available in the Windows SDK. */
|
||||
abstract class StoreRequestHelper {
|
||||
/**
|
||||
* Sends the specified request to the Windows Store with the provided context and parameters.
|
||||
* @param context An object that specifies the user for which to perform the operation. If your app is a single-user app (that is, it runs only in the context of the user that launched the app), use the StoreContext.GetDefault method to get a StoreContext object that you can use to send a request that operates in the context of the user. If your app is a multi-user app, use the StoreContext.GetForUser method to get a StoreContext object that you can use to send a request that operates in the context of a specific user.
|
||||
* @param requestKind A value that identifies the request that you want to send to the Windows Store.
|
||||
* @param parametersAsJson A JSON-formatted string that contains the arguments to pass to the request.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StoreSendRequestResult object that provides status and error info about the request.
|
||||
*/
|
||||
sendRequestAsync(context: StoreContext, requestKind: number, parametersAsJson: string): Windows.Foundation.IPromiseWithIAsyncOperation<StoreSendRequestResult>;
|
||||
}
|
||||
|
||||
/** Provides response data for a request that is sent to the Windows Store. */
|
||||
abstract class StoreSendRequestResult {
|
||||
/** Gets the error code for the request, if the operation encountered an error. */
|
||||
extendedError: WinRTError;
|
||||
/** Gets the HTTP status code for the request. */
|
||||
httpStatusCode: Windows.Web.Http.HttpStatusCode;
|
||||
/** Gets the response data for the request. */
|
||||
response: string;
|
||||
}
|
||||
|
||||
/** Provides info for a SKU of a product in the Windows Store. */
|
||||
abstract class StoreSku {
|
||||
/** Gets the availabilities for the current product SKU. Each product SKU can have one or more availabilities that have different prices. */
|
||||
availabilities: Windows.Foundation.Collections.IVectorView<StoreAvailability>;
|
||||
/** Gets the list of Store IDs for the apps or add-ons that are bundled with this product SKU. */
|
||||
bundledSkus: Windows.Foundation.Collections.IVectorView<string>;
|
||||
/** Gets additional data for the current product SKU, if the user has an entitlement to use the SKU. */
|
||||
collectionData: StoreCollectionData;
|
||||
/** Gets the custom developer data string (also called a tag) that contains custom information about the add-on that this product SKU represents. This string corresponds to the value of the Custom developer data field in the properties page for the add-on in the Windows Dev Center dashboard. */
|
||||
customDeveloperData: string;
|
||||
/** Gets the product SKU description from the Windows Store listing. */
|
||||
description: string;
|
||||
/** Gets complete data for the current product SKU from the Store in JSON format. */
|
||||
extendedJsonData: string;
|
||||
/**
|
||||
* Indicates whether this product SKU is installed on the current device.
|
||||
* @return An asynchronous operation that, on successful completion, returns true if this product SKU is installed on the current device; otherwise, false.
|
||||
*/
|
||||
getIsInstalledAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<boolean>;
|
||||
/** Gets the images from the Windows Store listing for the product SKU. */
|
||||
images: Windows.Foundation.Collections.IVectorView<StoreImage>;
|
||||
/** Gets a value that indicates whether the current user has an entitlement to use the current product SKU. */
|
||||
isInUserCollection: boolean;
|
||||
/** Gets a value that indicates whether the current product SKU is a subscription with recurring billing. For more information about the subscription, see the SubscriptionInfo property. */
|
||||
isSubscription: boolean;
|
||||
/** Gets a value that indicates whether the current product SKU is a trial SKU. */
|
||||
isTrial: boolean;
|
||||
/** Gets the language for the data in the Windows Store listing for the product SKU. */
|
||||
language: string;
|
||||
/** Gets the price of the default availability for this product SKU. */
|
||||
price: StorePrice;
|
||||
/**
|
||||
* Requests the purchase of the product SKU and displays the UI that is used to complete the transaction via the Windows Store.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase.
|
||||
*/
|
||||
requestPurchaseAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<StorePurchaseResult>;
|
||||
/**
|
||||
* Requests the purchase of the product SKU and displays the UI that is used to complete the transaction via the Windows Store. This method provides the option to specify additional details for a specific offer within a large catalog of products that are represented by a single listing in the Windows Store, including the product name to display to the user during the purchase.
|
||||
* @param storePurchaseProperties An object that specifies additional info for the purchase request, including the product name to display to the user during the purchase.
|
||||
* @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase.
|
||||
*/
|
||||
requestPurchaseAsync(storePurchaseProperties: StorePurchaseProperties): Windows.Foundation.IPromiseWithIAsyncOperation<StorePurchaseResult>;
|
||||
/** Gets the Store ID of this product SKU. */
|
||||
storeId: string;
|
||||
/** Gets subscription information for this product SKU, if this product SKU is a subscription with recurring billing. To determine whether this product SKU is a subscription, use the IsSubscription property. */
|
||||
subscriptionInfo: StoreSubscriptionInfo;
|
||||
/** Gets the product SKU title from the Windows Store listing. */
|
||||
title: string;
|
||||
/** Gets the videos from the Windows Store listing for the product SKU. */
|
||||
videos: Windows.Foundation.Collections.IVectorView<StoreVideo>;
|
||||
}
|
||||
|
||||
/** Provides subscription info for a product SKU that represents a subscription with recurring billing. */
|
||||
abstract class StoreSubscriptionInfo {
|
||||
/** Gets the duration of the billing period for a subscription, in the units specified by the BillingPeriodUnit property. */
|
||||
billingPeriod: number;
|
||||
/** Gets the units of the billing period for a subscription. */
|
||||
billingPeriodUnit: StoreDurationUnit;
|
||||
/** Gets a value that indicates whether the subscription contains a trial period. */
|
||||
hasTrialPeriod: boolean;
|
||||
/** Gets the duration of the trial period for the subscription, in the units specified by the TrialPeriodUnit property. To determine whether the subscription has a trial period, use the HasTrialPeriod property. */
|
||||
trialPeriod: number;
|
||||
/** Gets the units of the trial period for the subscription. */
|
||||
trialPeriodUnit: StoreDurationUnit;
|
||||
}
|
||||
|
||||
/** Represents a video that is associated with a product listing in the Windows Store. */
|
||||
abstract class StoreVideo {
|
||||
/** Gets the caption for the video. */
|
||||
caption: string;
|
||||
/** Gets the height of the video, in pixels. */
|
||||
height: number;
|
||||
/** Gets the preview image that is displayed for the video. */
|
||||
previewImage: StoreImage;
|
||||
/** Gets the URI of the video. */
|
||||
uri: Windows.Foundation.Uri;
|
||||
/** Gets the tag for the video. */
|
||||
videoPurposeTag: string;
|
||||
/** Gets the width of the video, in pixels. */
|
||||
width: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
/** Provides classes for managing files, folders, and application settings. */
|
||||
namespace Storage {
|
||||
|
||||
Reference in New Issue
Block a user