mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Merge remote-tracking branch 'upstream/master' into koa-webpack
This commit is contained in:
@@ -10,12 +10,12 @@ const o: Options = {
|
||||
onRetry: (e: Error) => 42
|
||||
};
|
||||
|
||||
retry(
|
||||
const hello: Promise<string> = retry(
|
||||
bail => 'hello',
|
||||
{ retries: 3 }
|
||||
);
|
||||
|
||||
retry(
|
||||
const answer: Promise<number> = retry(
|
||||
bail => Promise.resolve(42),
|
||||
{ retries: 3 }
|
||||
);
|
||||
|
||||
Vendored
+1
-1
@@ -19,7 +19,7 @@ declare namespace AsyncRetry {
|
||||
onRetry?: (e: Error) => any;
|
||||
}
|
||||
|
||||
type RetryFunction<A> = (bail: (e: Error) => A, attempt: number) => A|Promise<A>;
|
||||
type RetryFunction<A> = (bail: (e: Error) => void, attempt: number) => A|Promise<A>;
|
||||
}
|
||||
|
||||
export = AsyncRetry;
|
||||
|
||||
@@ -206,7 +206,8 @@ client.mget({
|
||||
index: 'myindex',
|
||||
type: 'mytype',
|
||||
body: {
|
||||
ids: [1, 2, 3]
|
||||
ids: [1, 2, 3],
|
||||
_source: ['test']
|
||||
}
|
||||
}, (error, response) => {
|
||||
// ...
|
||||
|
||||
Vendored
+1
-1
@@ -465,7 +465,7 @@ export interface MGetParams extends GenericParams {
|
||||
preference?: string;
|
||||
realtime?: boolean;
|
||||
refresh?: boolean;
|
||||
source?: NameList;
|
||||
_source?: NameList;
|
||||
_sourceExclude?: NameList;
|
||||
_sourceInclude?: NameList;
|
||||
index?: string;
|
||||
|
||||
+43
-15
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Express 4.11
|
||||
// Type definitions for Express 4.16
|
||||
// Project: http://expressjs.com
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Michał Lytek <https://github.com/19majkel94>
|
||||
@@ -23,6 +23,7 @@ declare global {
|
||||
|
||||
import * as http from "http";
|
||||
import { EventEmitter } from "events";
|
||||
import { Options as RangeParserOptions, Result as RangeParserResult, Ranges as RangeParserRanges } from "range-parser";
|
||||
|
||||
export interface NextFunction {
|
||||
// tslint:disable-next-line callable-types (In ts2.1 it thinks the type alias has no call signatures)
|
||||
@@ -174,7 +175,7 @@ export interface CookieOptions {
|
||||
|
||||
export interface ByteRange { start: number; end: number; }
|
||||
|
||||
export interface RequestRanges extends Array<ByteRange> { type: string; }
|
||||
export interface RequestRanges extends RangeParserRanges { }
|
||||
|
||||
export type Errback = (err: Error) => void;
|
||||
|
||||
@@ -283,21 +284,19 @@ export interface Request extends http.IncomingMessage, Express.Request {
|
||||
acceptsLanguages(...lang: string[]): string | false;
|
||||
|
||||
/**
|
||||
* Parse Range header field,
|
||||
* capping to the given `size`.
|
||||
* Parse Range header field, capping to the given `size`.
|
||||
*
|
||||
* Unspecified ranges such as "0-" require
|
||||
* knowledge of your resource length. In
|
||||
* the case of a byte range this is of course
|
||||
* the total number of bytes. If the Range
|
||||
* header field is not given `null` is returned,
|
||||
* `-1` when unsatisfiable, `-2` when syntactically invalid.
|
||||
* Unspecified ranges such as "0-" require knowledge of your resource length. In
|
||||
* the case of a byte range this is of course the total number of bytes.
|
||||
* If the Range header field is not given `undefined` is returned.
|
||||
* If the Range header field is given, return value is a result of range-parser.
|
||||
* See more ./types/range-parser/index.d.ts
|
||||
*
|
||||
* NOTE: remember that ranges are inclusive, so for example "Range: users=0-3"
|
||||
* should respond with 4 users when available, not 3.
|
||||
*
|
||||
* NOTE: remember that ranges are inclusive, so
|
||||
* for example "Range: users=0-3" should respond
|
||||
* with 4 users when available, not 3.
|
||||
*/
|
||||
range(size: number): RequestRanges|null|-1|-2;
|
||||
range(size: number, options?: RangeParserOptions): RangeParserRanges | RangeParserResult | undefined;
|
||||
|
||||
/**
|
||||
* Return an array of Accepted media types
|
||||
@@ -450,6 +449,13 @@ export interface Request extends http.IncomingMessage, Express.Request {
|
||||
baseUrl: string;
|
||||
|
||||
app: Application;
|
||||
|
||||
/**
|
||||
* After middleware.init executed, Request will contain res and next properties
|
||||
* See: express/lib/middleware/init.js
|
||||
*/
|
||||
res?: Response;
|
||||
next?: NextFunction;
|
||||
}
|
||||
|
||||
export interface MediaType {
|
||||
@@ -827,7 +833,13 @@ export interface Response extends http.ServerResponse, Express.Response {
|
||||
*
|
||||
* @since 4.11.0
|
||||
*/
|
||||
append(field: string, value?: string[]|string): Response;
|
||||
append(field: string, value?: string[] | string): Response;
|
||||
|
||||
/**
|
||||
* After middleware.init executed, Response will contain req property
|
||||
* See: express/lib/middleware/init.js
|
||||
*/
|
||||
req?: Request;
|
||||
}
|
||||
|
||||
export interface Handler extends RequestHandler { }
|
||||
@@ -1062,6 +1074,22 @@ export interface Application extends EventEmitter, IRouter, Express.Application
|
||||
_router: any;
|
||||
|
||||
use: ApplicationRequestHandler<this>;
|
||||
|
||||
/**
|
||||
* The mount event is fired on a sub-app, when it is mounted on a parent app.
|
||||
* The parent app is passed to the callback function.
|
||||
*
|
||||
* NOTE:
|
||||
* Sub-apps will:
|
||||
* - Not inherit the value of settings that have a default value. You must set the value in the sub-app.
|
||||
* - Inherit the value of settings with no default value.
|
||||
*/
|
||||
on: (event: string, callback: (parent: Application) => void) => this;
|
||||
|
||||
/**
|
||||
* The app.mountpath property contains one or more path patterns on which a sub-app was mounted.
|
||||
*/
|
||||
mountpath: string | string[];
|
||||
}
|
||||
|
||||
export interface Express extends Application {
|
||||
|
||||
@@ -104,6 +104,9 @@ namespace express_tests {
|
||||
req.headers.existingHeader as string;
|
||||
req.headers.nonExistingHeader as any as undefined;
|
||||
|
||||
// Since 4.14.0 req.range() has options
|
||||
req.range(2, { combine: true });
|
||||
|
||||
res.send(req.query['token']);
|
||||
});
|
||||
|
||||
@@ -128,6 +131,19 @@ namespace express_tests {
|
||||
|
||||
app.use(router);
|
||||
|
||||
// Test req.res, req.next, res.req should exists after middleware.init
|
||||
app.use((req, res) => {
|
||||
req.res;
|
||||
req.next;
|
||||
res.req;
|
||||
});
|
||||
|
||||
// Test on mount event
|
||||
app.on('mount', (parent) => true);
|
||||
|
||||
// Test mountpath
|
||||
const mountPath: string|string[] = app.mountpath;
|
||||
|
||||
app.listen(3000);
|
||||
|
||||
const next: express.NextFunction = () => { };
|
||||
@@ -139,6 +155,7 @@ namespace express_tests {
|
||||
* *
|
||||
***************************/
|
||||
import * as http from 'http';
|
||||
import { RequestRanges } from 'express-serve-static-core';
|
||||
|
||||
namespace node_tests {
|
||||
{
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Express 4.11
|
||||
// Type definitions for Express 4.16
|
||||
// Project: http://expressjs.com
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Vendored
+1
@@ -20,6 +20,7 @@ declare namespace helmet {
|
||||
ieNoOpen?: boolean,
|
||||
noCache?: boolean,
|
||||
noSniff?: boolean,
|
||||
referrerPolicy?: boolean | IHelmetReferrerPolicyConfiguration,
|
||||
xssFilter?: boolean | IHelmetXssFilterConfiguration,
|
||||
expectCt?: boolean | IHelmetExpectCtConfiguration,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import imperium from 'imperium';
|
||||
|
||||
imperium.role('admin', async (req) => {
|
||||
return true;
|
||||
});
|
||||
|
||||
imperium.role('user')
|
||||
.can('seeUser', { user: '@' })
|
||||
.can('manageUser', { user: '@' });
|
||||
|
||||
imperium.role('admin')
|
||||
.is('user', { user: '*' });
|
||||
|
||||
imperium.can('seeUser');
|
||||
imperium.can(['seeUser', 'manageUser']);
|
||||
imperium.can({ action: 'seeUser', user: ':userId' });
|
||||
imperium.can([{ action: 'manageUser', user: ':userId' }]);
|
||||
imperium.is('admin');
|
||||
imperium.is(['admin', 'user']);
|
||||
Vendored
+98
@@ -0,0 +1,98 @@
|
||||
// Type definitions for imperium 2.0
|
||||
// Project: https://www.npmjs.org/package/imperium
|
||||
// Definitions by: Gaetan SENN <https://github.com/gaetansenn>
|
||||
// Definitions: https://github.com/psnider/DefinitelyTyped/imperium
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import express = require('express');
|
||||
|
||||
export type GetAcl = (req: express.Request) => Promise<boolean> | Promise<object>;
|
||||
export type Actions = string[] | string;
|
||||
export type Context = Array<'params' | 'query' | 'headers' | 'body'>;
|
||||
// Can contain when key that is evaluated during route action
|
||||
export interface RoleParams {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export const context: string[];
|
||||
export const roles: Roles;
|
||||
|
||||
// Add new role with specific ImperiumGetAcl
|
||||
export function role(roleName: string, getAcl?: GetAcl): Role;
|
||||
|
||||
// Check if user has role(s) act like as an OR
|
||||
export function is(roleNames: string | string[]): Promise<express.RequestHandler>;
|
||||
|
||||
// Check if current user can do action(s)
|
||||
export function can(actionS: string | string[] | Action | Action[]): Promise<express.RequestHandler>;
|
||||
|
||||
export function evaluateRouteActions(req: express.Request, action: Action[], context: Context): Actions;
|
||||
|
||||
export function evaluateRouteAction(req: express.Request, expr: string, key: string, context: Context): string;
|
||||
|
||||
export function evaluateUserActions(req: express.Request, roles: Role[]): Promise<Action[]>;
|
||||
|
||||
export function evaluateUserAction(action: RoleParams, context: { [key: string]: string[] }): { [key: string]: string[] };
|
||||
|
||||
export class Imperium {
|
||||
constructor()
|
||||
|
||||
context: string[];
|
||||
roles: Roles;
|
||||
|
||||
// Add new role with specific ImperiumGetAcl
|
||||
role(roleName: string, getAcl?: GetAcl): Role;
|
||||
|
||||
// Check if user has role(s) act like as an OR
|
||||
is(roleNames: string | string[]): Promise<express.RequestHandler>;
|
||||
|
||||
// Check if current user can do action(s)
|
||||
can(actionS: string | string[] | Action | Action[]): Promise<express.RequestHandler>;
|
||||
|
||||
private addRole(roleName: string, getAcl: GetAcl): void;
|
||||
|
||||
evaluateRouteActions(req: express.Request, action: Action[], context: Context): Actions;
|
||||
|
||||
evaluateRouteAction(req: express.Request, expr: string, key: string, context: Context): string;
|
||||
|
||||
evaluateUserActions(req: express.Request, roles: Role[]): Promise<Action[]>;
|
||||
|
||||
evaluateUserAction(action: RoleParams, context: { [key: string]: string[] }): { [key: string]: string[] };
|
||||
}
|
||||
|
||||
export interface Roles {
|
||||
[key: string]: RoleActions;
|
||||
}
|
||||
|
||||
export interface RoleActions {
|
||||
actions: Action[];
|
||||
getAcl?: GetAcl;
|
||||
}
|
||||
|
||||
export interface Action {
|
||||
action: string;
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export class Role {
|
||||
constructor(imperium: Imperium, roleName: string)
|
||||
|
||||
// Imperium instance to retreive child role
|
||||
imperium: Imperium;
|
||||
// Role name
|
||||
roleName: string;
|
||||
// Contain all the actions for this specific role
|
||||
role: RoleActions;
|
||||
|
||||
/* Add action with specific params */
|
||||
can(action: string, params: RoleParams): Role;
|
||||
|
||||
/* Get actions of childRoleName and replace params */
|
||||
is(childRoleName: string, params: RoleParams): Role;
|
||||
}
|
||||
|
||||
export class UnauthorizedError extends Error {
|
||||
constructor(message: string, status: number, context: any)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"esModuleInterop": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"imperium-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// Type definitions for jquery-mouse-exit 1.0
|
||||
// Project: https://github.com/makeup-jquery/jquery-mouse-exit
|
||||
// Definitions by: Anderson Friaça <https://github.com/AndersonFriaca>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
export type Options = Partial<{
|
||||
delay: number;
|
||||
}>;
|
||||
|
||||
export type FocusElements = Partial<{
|
||||
lostFocus: HTMLElement;
|
||||
gainedFocus: HTMLElement;
|
||||
}>;
|
||||
|
||||
declare global {
|
||||
interface JQuery {
|
||||
mouseExit(options?: Options): JQuery;
|
||||
on(event: 'mouseExit', handler: ((event: JQuery.Event<HTMLElement>, data: FocusElements) => void)): JQuery;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// init plugin
|
||||
$('#container').mouseExit({
|
||||
delay: 500
|
||||
});
|
||||
|
||||
// handle event
|
||||
$('#container').on('mouseExit', (e, data) => {
|
||||
console.log(data.lostFocus, data.gainedFocus);
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jquery-mouse-exit-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"extends": "dtslint/dt.json"}
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export class CacheEntry<T> extends EventEmitter {
|
||||
get(callback?: (err: Error, result: T) => void): T | undefined;
|
||||
set(value: T): void;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
export class Cache {
|
||||
/**
|
||||
* Clear cache entries prefix matching given key
|
||||
* @param key Key prefix of cache entry to clear
|
||||
*/
|
||||
clear(key?: string): void;
|
||||
|
||||
/**
|
||||
* Retrieve cache entry, or create if not exists
|
||||
* @param key Key of cache entry
|
||||
*/
|
||||
get<T>(key?: string): CacheEntry<T>;
|
||||
}
|
||||
Vendored
+13
-1
@@ -8,6 +8,7 @@ import { Analytics } from './api/analytics';
|
||||
import { Chatter } from './api/chatter';
|
||||
import { Metadata } from './api/metadata';
|
||||
import { Bulk } from './bulk';
|
||||
import { Cache } from './cache'
|
||||
import { OAuth2, Streaming } from '.';
|
||||
|
||||
export type Callback<T> = (err: Error, result: T) => void;
|
||||
@@ -111,7 +112,17 @@ export abstract class BaseConnection extends EventEmitter {
|
||||
callback?: (err: Error, result: RecordResult | RecordResult[]) => void): Promise<(RecordResult | RecordResult[])>;
|
||||
destroy<T>(type: string, ids: string | string[], options?: Object,
|
||||
callback?: (err: Error, result: RecordResult | RecordResult[]) => void): Promise<(RecordResult | RecordResult[])>;
|
||||
describe<T>(type: string, callback?: (err: Error, result: DescribeSObjectResult) => void): Promise<DescribeSObjectResult>;
|
||||
describe$: {
|
||||
/** Returns a value from the cache if it exists, otherwise calls Connection.describe */
|
||||
(type: string, callback?: (err: Error, result: DescribeSObjectResult) => void): DescribeSObjectResult;
|
||||
clear(): void;
|
||||
}
|
||||
describe(type: string, callback?: (err: Error, result: DescribeSObjectResult) => void): Promise<DescribeSObjectResult>;
|
||||
describeGlobal$: {
|
||||
/** Returns a value from the cache if it exists, otherwise calls Connection.describeGlobal */
|
||||
(callback?: (err: Error, result: DescribeGlobalResult) => void): DescribeGlobalResult;
|
||||
clear(): void;
|
||||
}
|
||||
describeGlobal<T>(callback?: (err: Error, result: DescribeGlobalResult) => void): Promise<DescribeGlobalResult>;
|
||||
sobject<T>(resource: string): SObject<T>;
|
||||
}
|
||||
@@ -126,6 +137,7 @@ export class Connection extends BaseConnection {
|
||||
bulk: Bulk;
|
||||
oauth2: OAuth2;
|
||||
streaming: Streaming;
|
||||
cache: Cache;
|
||||
|
||||
// Specific to Connection
|
||||
instanceUrl: string;
|
||||
|
||||
Vendored
+218
-3
@@ -1,9 +1,217 @@
|
||||
type maybe<T> = (T | null | undefined)
|
||||
|
||||
// From
|
||||
// https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_describesobjects_describesobjectresult.htm
|
||||
export interface DescribeSObjectResult {
|
||||
activateable: boolean;
|
||||
actionOverrides?: maybe<ActionOverride[]>;
|
||||
childRelationships: ChildRelationship[];
|
||||
compactLayoutable: boolean;
|
||||
createable: boolean;
|
||||
custom: boolean;
|
||||
customSetting: boolean;
|
||||
deleteable: boolean;
|
||||
deprecatedAndHidden: boolean;
|
||||
feedEnabled: boolean;
|
||||
fields: Field[];
|
||||
keyPrefix?: maybe<string>;
|
||||
label: string;
|
||||
fields: object[];
|
||||
labelPlural: string;
|
||||
layoutable: boolean;
|
||||
listviewable?: maybe<boolean>;
|
||||
lookupLayoutable?: maybe<boolean>;
|
||||
mergeable: boolean;
|
||||
mruEnabled: boolean;
|
||||
name: string;
|
||||
namedLayoutInfos: NamedLayoutInfo[];
|
||||
networkScopeFieldName?: maybe<string>;
|
||||
queryable: boolean;
|
||||
recordTypeInfos: RecordTypeInfo[];
|
||||
replicateable: boolean;
|
||||
retrieveable: boolean;
|
||||
searchable: boolean;
|
||||
searchLayoutable: boolean;
|
||||
supportedScopes: ScopeInfo[];
|
||||
triggerable: boolean;
|
||||
undeleteable: boolean;
|
||||
updateable: boolean;
|
||||
urlDetail?: string;
|
||||
urlEdit?: string;
|
||||
urlNew?: string;
|
||||
urls: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface DescribeGlobalResult {
|
||||
export interface ActionOverride {
|
||||
formFactor: string;
|
||||
isAvailableInTouch: boolean;
|
||||
name: string;
|
||||
pageId: string;
|
||||
url?: maybe<string>;
|
||||
}
|
||||
|
||||
export interface ChildRelationship {
|
||||
cascadeDelete: boolean;
|
||||
childSObject: string;
|
||||
deprecatedAndHidden: boolean;
|
||||
field: string;
|
||||
junctionIdListNames: string[];
|
||||
junctionReferenceTo: string[];
|
||||
relationshipName?: maybe<string>;
|
||||
restrictedDelete: boolean;
|
||||
}
|
||||
|
||||
export interface Field {
|
||||
aggregatable: boolean;
|
||||
autonumber: boolean;
|
||||
byteLength: number;
|
||||
calculated: boolean;
|
||||
calculatedFormula?: maybe<string>;
|
||||
cascadeDelete: boolean;
|
||||
caseSensitive: boolean;
|
||||
compoundFieldName?: maybe<string>;
|
||||
controllerName?: maybe<string>;
|
||||
creatable: boolean;
|
||||
custom: boolean;
|
||||
defaultValue?: maybe<string | boolean>;
|
||||
defaultValueFormula?: maybe<string>;
|
||||
defaultedOnCreate: boolean;
|
||||
dependentPicklist: boolean;
|
||||
deprecatedAndHidden: boolean;
|
||||
digits?: maybe<number>;
|
||||
displayLocationInDecimal?: maybe<boolean>;
|
||||
encrypted?: maybe<true>;
|
||||
externalId: boolean;
|
||||
extraTypeInfo?: maybe<ExtraTypeInfo>;
|
||||
filterable: boolean;
|
||||
filteredLookupInfo?: maybe<FilteredLookupInfo>;
|
||||
formula?: maybe<string>;
|
||||
groupable: boolean;
|
||||
highScaleNumber?: maybe<boolean>;
|
||||
htmlFormatted :boolean;
|
||||
idLookup: boolean;
|
||||
inlineHelpText?: maybe<string>;
|
||||
label: string;
|
||||
length: number;
|
||||
mask?: maybe<string>;
|
||||
maskType?: maybe<string>;
|
||||
name: string;
|
||||
nameField: boolean;
|
||||
namePointing: boolean;
|
||||
nillable: boolean;
|
||||
permissionable: boolean;
|
||||
picklistValues?: maybe<PicklistEntry[]>;
|
||||
polymorphicForeignKey: boolean;
|
||||
precision?: maybe<number>;
|
||||
queryByDistance: boolean;
|
||||
relationshipName?: maybe<string>;
|
||||
relationshipOrder?: maybe<number>;
|
||||
referenceTargetField?: maybe<string>;
|
||||
referenceTo?: maybe<string[]>;
|
||||
restrictedPicklist: boolean;
|
||||
scale: number;
|
||||
searchPrefilterable: boolean;
|
||||
soapType: SOAPType;
|
||||
sortable: boolean;
|
||||
type: FieldType;
|
||||
unique: boolean;
|
||||
updateable: boolean;
|
||||
writeRequiresMasterRead?: maybe<boolean>;
|
||||
}
|
||||
|
||||
export type ExtraTypeInfo =
|
||||
| 'imageurl'
|
||||
| 'personname'
|
||||
| 'plaintextarea'
|
||||
| 'richtextarea'
|
||||
| 'switchablepersonname'
|
||||
| 'externallookup'
|
||||
| 'indirectlookup'
|
||||
|
||||
export type FieldType =
|
||||
| 'string'
|
||||
| 'boolean'
|
||||
| 'int'
|
||||
| 'double'
|
||||
| 'date'
|
||||
| 'datetime'
|
||||
| 'base64'
|
||||
| 'id'
|
||||
| 'reference'
|
||||
| 'currency'
|
||||
| 'textarea'
|
||||
| 'percent'
|
||||
| 'phone'
|
||||
| 'url'
|
||||
| 'email'
|
||||
| 'combobox'
|
||||
| 'picklist'
|
||||
| 'multipicklist'
|
||||
| 'anyType'
|
||||
| 'location'
|
||||
// the following are not found in official documentation, but still occur when describing an sobject
|
||||
| 'time'
|
||||
| 'encryptedstring'
|
||||
| 'address'
|
||||
| 'complexvalue'
|
||||
|
||||
export interface FilteredLookupInfo {
|
||||
controllingFields: string[];
|
||||
dependent: boolean;
|
||||
optionalFilter: boolean;
|
||||
}
|
||||
|
||||
export type SOAPType =
|
||||
| 'tns:ID'
|
||||
| 'xsd:anyType'
|
||||
| 'xsd:base64Binary'
|
||||
| 'xsd:boolean'
|
||||
| 'xsd:date'
|
||||
| 'xsd:dateTime'
|
||||
| 'xsd:double'
|
||||
| 'xsd:int'
|
||||
| 'xsd:string'
|
||||
// the following are not found in official documentation, but still occur when describing an sobject
|
||||
| 'xsd:time'
|
||||
| 'urn:address'
|
||||
| 'urn:JunctionIdListNames'
|
||||
| 'urn:location'
|
||||
| 'urn:RecordTypesSupported'
|
||||
| 'urn:RelationshipReferenceTo'
|
||||
| 'urn:SearchLayoutButtonsDisplayed'
|
||||
| 'urn:SearchLayoutFieldsDisplayed'
|
||||
|
||||
export interface PicklistEntry {
|
||||
active: boolean;
|
||||
validFor?: maybe<string>;
|
||||
defaultValue: boolean;
|
||||
label?: maybe<string>;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface RecordTypeInfo {
|
||||
available: boolean;
|
||||
defaultRecordTypeMapping: boolean;
|
||||
developerName?: maybe<string>;
|
||||
master: boolean;
|
||||
name: string;
|
||||
recordTypeId: string;
|
||||
urls: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface NamedLayoutInfo {
|
||||
name: string;
|
||||
urls: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface ScopeInfo {
|
||||
label: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
// From
|
||||
// https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_describeglobal_describeglobalresult.htm#!
|
||||
|
||||
export interface DescribeGlobalSObjectResult {
|
||||
activateable: boolean;
|
||||
createable: boolean;
|
||||
custom: boolean;
|
||||
@@ -13,7 +221,7 @@ export interface DescribeGlobalResult {
|
||||
feedEnabled: boolean;
|
||||
hasSubtypes: boolean;
|
||||
isSubtype: boolean;
|
||||
keyPrefix: string;
|
||||
keyPrefix: string | null;
|
||||
label: string;
|
||||
labelPlural: string;
|
||||
layoutable: boolean;
|
||||
@@ -27,4 +235,11 @@ export interface DescribeGlobalResult {
|
||||
triggerable: boolean;
|
||||
undeletable: boolean;
|
||||
updateable: boolean;
|
||||
urls: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface DescribeGlobalResult {
|
||||
encoding: string;
|
||||
maxBatchSize: number;
|
||||
sobjects: DescribeGlobalSObjectResult[];
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -4,6 +4,7 @@
|
||||
// Kamil Ejsymont <https://github.com/netes>
|
||||
// Thomas Dvornik <https://github.com/amphro>
|
||||
// Tim Noonan <https://github.com/tnoonan-salesforce>
|
||||
// Abraham White <https://github.com/whiteabelincoln>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -12,9 +13,11 @@ export * from './api/chatter';
|
||||
export * from './api/metadata';
|
||||
export * from './batch';
|
||||
export * from './bulk';
|
||||
export * from './cache';
|
||||
export * from './channel';
|
||||
export * from './connection';
|
||||
export * from './date-enum';
|
||||
export * from './describe-result';
|
||||
export * from './job';
|
||||
export * from './oauth2';
|
||||
export * from './promise';
|
||||
|
||||
@@ -45,8 +45,8 @@ salesforceConnection.sobject("Account").create({
|
||||
Name: "Test Acc 2",
|
||||
BillingStreet: "Maplestory street",
|
||||
BillingPostalCode: "ME4 666"
|
||||
}, (err: Error, ret: sf.RecordResult) => {
|
||||
if (err || !ret.success) {
|
||||
}, (err: Error, ret: sf.RecordResult | sf.RecordResult[]) => {
|
||||
if (err || !Array.isArray(ret) && !ret.success) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
@@ -56,8 +56,8 @@ salesforceConnection.sobject("ContentVersion").create({
|
||||
Title: 'hello',
|
||||
PathOnClient: './hello-world.jpg',
|
||||
VersionData: '{ Test: Data }'
|
||||
}, (err: Error, ret: sf.RecordResult) => {
|
||||
if (err || !ret.success) {
|
||||
}, (err: Error, ret: sf.RecordResult | sf.RecordResult[]) => {
|
||||
if (err || !Array.isArray(ret) && !ret.success) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
@@ -77,8 +77,8 @@ salesforceConnection.sobject("ContentDocumentLink").create({
|
||||
ContentDocumentId: '',
|
||||
LinkedEntityId: '',
|
||||
ShareType: "I"
|
||||
}, (err: Error, ret: sf.RecordResult) => {
|
||||
if (err || !ret.success) {
|
||||
}, (err: Error, ret: sf.RecordResult | sf.RecordResult[]) => {
|
||||
if (err || !Array.isArray(ret) && !ret.success) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
@@ -157,7 +157,7 @@ async function testMetadata(conn: sf.Connection): Promise<void> {
|
||||
m.metadataObjects.filter((value: sf.MetadataObject) => value.directoryName === 'pages');
|
||||
console.log(`ApexPage?: ${pages[0].xmlName === 'ApexPage'}`);
|
||||
|
||||
const types: sf.ListMetadataQuery[] = [{ type: 'CustomObject', folder: null }];
|
||||
const types: sf.ListMetadataQuery[] = [{ type: 'CustomObject', folder: undefined }];
|
||||
md.list(types, '39.0', (err, properties: sf.FileProperties[]) => {
|
||||
if (err) {
|
||||
console.error('err', err);
|
||||
@@ -335,7 +335,8 @@ batch.on("response", (rets: sf.BatchResultInfo[]) => {
|
||||
if (rets[i].success) {
|
||||
console.log(`# ${(i + 1)} loaded successfully, id = ${rets[i].id}`);
|
||||
} else {
|
||||
console.log(`# ${(i + 1)} error occurred, message = ${rets[i].errors.join(', ')}`);
|
||||
const errors = rets[i].errors;
|
||||
console.log(`# ${(i + 1)} error occurred, message = ${errors ? errors.join(', ') : ''}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -350,3 +351,31 @@ salesforceConnection.streaming.topic("InvoiceStatementUpdates").subscribe((messa
|
||||
console.log('Event Created : ' + message.event.createdDate);
|
||||
console.log('Object Id : ' + message.sobject.Id);
|
||||
});
|
||||
|
||||
async function testDescribe() {
|
||||
const global: sf.DescribeGlobalResult = await salesforceConnection.describeGlobal();
|
||||
const globalCached: sf.DescribeGlobalResult = salesforceConnection.describeGlobal$();
|
||||
const globalCachedCorrectly = global === globalCached;
|
||||
salesforceConnection.describeGlobal$.clear();
|
||||
|
||||
globalCached.sobjects.forEach(async (sobject: sf.DescribeGlobalSObjectResult) => {
|
||||
const object: sf.DescribeSObjectResult = await salesforceConnection.describe(sobject.name);
|
||||
const cachedObject: sf.DescribeSObjectResult = salesforceConnection.describe$(sobject.name);
|
||||
salesforceConnection.describe$.clear();
|
||||
|
||||
object.fields.forEach(field => {
|
||||
const type: sf.FieldType = field.type;
|
||||
// following should never compile
|
||||
// const fail = type === 'hey'
|
||||
|
||||
const isString = type === 'string';
|
||||
});
|
||||
|
||||
// following should never compile (if StrictNullChecks is on)
|
||||
// object.keyPrefix.length;
|
||||
|
||||
console.log(`${sobject.name} Label: `, object.label);
|
||||
|
||||
const correctlyCached = object === cachedObject;
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+20
-3
@@ -18,9 +18,6 @@ export class SObject<T> {
|
||||
upsert(records: Record<T>, extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise<RecordResult>;
|
||||
upsert(records: Array<Record<T>>, extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult[]) => void): Promise<RecordResult[]>;
|
||||
upsertBulk(input?: Array<Record<T>> | stream.Stream | string, callback?: (err: Error, ret: RecordResult[] | BatchResultInfo[]) => void): Batch;
|
||||
describeGlobal(callback: (err: Error, res: any) => void): void;
|
||||
describe$(callback: (err: Error, ret: DescribeSObjectResult) => void): void;
|
||||
describeGlobal$(callback: (err: Error, res: any) => void): void;
|
||||
|
||||
find<T>(query?: any, callback?: (err: Error, ret: T[]) => void): Query<T>;
|
||||
find<T>(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query<T>;
|
||||
@@ -30,8 +27,18 @@ export class SObject<T> {
|
||||
findOne<T>(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T) => void): Query<T>;
|
||||
findOne<T>(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): Query<T>;
|
||||
|
||||
approvalLayouts$: {
|
||||
/** Returns a value from the cache if it exists, otherwise calls SObject.approvalLayouts */
|
||||
(callback?: (layoutInfo: ApprovalLayoutInfo) => void): ApprovalLayoutInfo;
|
||||
clear(): void;
|
||||
}
|
||||
approvalLayouts(callback?: (layoutInfo: ApprovalLayoutInfo) => void): Promise<ApprovalLayoutInfo>;
|
||||
bulkload(operation: string, options?: { extIdField?: string }, input?: Array<Record<T>> | stream.Stream[] | string[], callback?: (err: Error, ret: RecordResult) => void): Batch;
|
||||
compactLayouts$: {
|
||||
/** Returns a value from the cache if it exists, otherwise calls SObject.compactLayouts */
|
||||
(callback?: CompactLayoutInfo): CompactLayoutInfo;
|
||||
clear(): void;
|
||||
}
|
||||
compactLayouts(callback?: CompactLayoutInfo): Promise<CompactLayoutInfo>;
|
||||
count(conditions?: Object | string, callback?: (err: Error, num: number) => void): Promise<number>;
|
||||
create(options: any | any[], callback?: (err: Error, ret: RecordResult | RecordResult[]) => void): Promise<RecordResult | RecordResult[]>;
|
||||
@@ -45,8 +52,18 @@ export class SObject<T> {
|
||||
deleted(start: Date | string, end: Date | string, callback?: (info: DeletedRecordsInfo) => void): Promise<DeletedRecordsInfo>;
|
||||
deleteHardBulk(input?: Array<Record<T>> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch;
|
||||
describe(callback?: (err: Error, ret: DescribeSObjectResult) => void): Promise<DescribeSObjectResult>;
|
||||
describe$: {
|
||||
/** Returns a value from the cache if it exists, otherwise calls SObject.describe */
|
||||
(callback?: (err: Error, ret: DescribeSObjectResult) => void): DescribeSObjectResult;
|
||||
clear(): void;
|
||||
}
|
||||
insert(options: any | any[], callback?: (err: Error, ret: RecordResult | RecordResult[]) => void): Promise<RecordResult | RecordResult[]>;
|
||||
insertBulk(input?: Array<Record<T>> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch;
|
||||
/** Returns a value from the cache if it exists, otherwise calls SObject.layouts */
|
||||
layouts$: {
|
||||
(layoutName?: string, callback?: (err: Error, info: LayoutInfo) => void): LayoutInfo;
|
||||
clear(): void;
|
||||
}
|
||||
layouts(layoutName?: string, callback?: (err: Error, info: LayoutInfo) => void): Promise<LayoutInfo>;
|
||||
listview(id: string): ListView;
|
||||
listviews(callback?: (err: Error, info: ListViewsInfo) => void): Promise<ListViewsInfo>;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
Vendored
+13
-5
@@ -1,6 +1,8 @@
|
||||
// Type definitions for koa-webpack 5.0
|
||||
// Project: https://github.com/shellscape/koa-webpack
|
||||
// Definitions by: Luka Maljic <https://github.com/malj>
|
||||
// Lee Benson <https://github.com/leebenson>
|
||||
// miZyind <https://github.com/miZyind>
|
||||
// Tomek Łaziuk <https://github.com/tlaziuk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
@@ -8,8 +10,7 @@
|
||||
import Koa = require('koa');
|
||||
import webpack = require('webpack');
|
||||
import webpackDevMiddleware = require('webpack-dev-middleware');
|
||||
import webpackHotMiddleware = require('webpack-hot-middleware');
|
||||
import connect = require('connect');
|
||||
import webpackHotClient = require('webpack-hot-client');
|
||||
|
||||
declare function koaWebpack(
|
||||
options?: koaWebpack.Options
|
||||
@@ -20,12 +21,19 @@ declare namespace koaWebpack {
|
||||
compiler?: webpack.Compiler;
|
||||
config?: webpack.Configuration;
|
||||
devMiddleware?: webpackDevMiddleware.Options;
|
||||
hotClient?: webpackHotMiddleware.Options | boolean;
|
||||
hotClient?: webpackHotClient.Options | boolean;
|
||||
}
|
||||
|
||||
interface CombinedWebpackMiddleware {
|
||||
devMiddleware: connect.NextHandleFunction & webpackDevMiddleware.WebpackDevMiddleware;
|
||||
hotClient: connect.NextHandleFunction & webpackHotMiddleware.EventStream;
|
||||
devMiddleware: webpackDevMiddleware.WebpackDevMiddleware;
|
||||
/**
|
||||
* @todo make this a `webpack-hot-client@^4.0.0` instance, no typings for v4 available yet
|
||||
*/
|
||||
hotClient: {
|
||||
close: () => void;
|
||||
options: webpackHotClient.Options;
|
||||
server: any;
|
||||
};
|
||||
close(callback?: () => any): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,45 +7,56 @@ const config: webpack.Configuration = {};
|
||||
const compiler = webpack(config);
|
||||
|
||||
// Using the middleware
|
||||
|
||||
koaWebpack({
|
||||
compiler,
|
||||
config,
|
||||
// Reference: https://github.com/webpack/webpack-dev-middleware#options
|
||||
devMiddleware: {
|
||||
lazy: true,
|
||||
watchOptions: {
|
||||
aggregateTimeout: 300,
|
||||
poll: true,
|
||||
},
|
||||
publicPath: '/assets/',
|
||||
headers: { 'X-Custom-Header': 'yes' },
|
||||
index: 'index.html',
|
||||
headers: {
|
||||
'X-Custom-Header': 'yes'
|
||||
},
|
||||
stats: {
|
||||
colors: true,
|
||||
},
|
||||
lazy: false,
|
||||
logger: undefined,
|
||||
logLevel: 'info',
|
||||
// logTime: false,
|
||||
// mimeTypes: null,
|
||||
publicPath: '/assets/',
|
||||
reporter: null,
|
||||
serverSideRender: false
|
||||
serverSideRender: false,
|
||||
stats: { context: process.cwd() },
|
||||
watchOptions: { aggregateTimeout: 200 },
|
||||
// writeToDisk: false
|
||||
},
|
||||
// Reference: https://github.com/webpack-contrib/webpack-hot-client#api
|
||||
hotClient: {
|
||||
log: console.log.bind(console),
|
||||
path: '/__what',
|
||||
heartbeat: 2000
|
||||
allEntries: false,
|
||||
autoConfigure: true,
|
||||
host: 'localhost',
|
||||
hmr: true,
|
||||
https: false,
|
||||
logLevel: 'info',
|
||||
logTime: false,
|
||||
port: 0,
|
||||
reload: true,
|
||||
server: undefined,
|
||||
stats: { context: process.cwd() }
|
||||
}
|
||||
}).then((middleware) => {
|
||||
app.use(middleware);
|
||||
})
|
||||
.then((middleware) => {
|
||||
app.use(middleware);
|
||||
|
||||
// Accessing the underlying middleware
|
||||
// Accessing the underlying middleware
|
||||
middleware.devMiddleware.close();
|
||||
middleware.devMiddleware.invalidate();
|
||||
middleware.devMiddleware.waitUntilValid();
|
||||
middleware.devMiddleware.getFilenameFromUrl('/public/index.html');
|
||||
middleware.devMiddleware.fileSystem;
|
||||
middleware.hotClient.close();
|
||||
middleware.hotClient.options;
|
||||
middleware.hotClient.server;
|
||||
|
||||
middleware.devMiddleware.close();
|
||||
middleware.devMiddleware.invalidate();
|
||||
middleware.devMiddleware.waitUntilValid();
|
||||
middleware.hotClient.publish(null);
|
||||
|
||||
return middleware;
|
||||
}).then((middleware) => {
|
||||
// close the middleware
|
||||
|
||||
middleware.close();
|
||||
});
|
||||
// close the middleware
|
||||
middleware.close(() => {
|
||||
console.log('closed');
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+2
-2
@@ -1,16 +1,16 @@
|
||||
// Type definitions for krakenjs 2.2
|
||||
// Project: http://krakenjs.com
|
||||
// Definitions by: Timur Manyanov <https://github.com/darkwebdev>
|
||||
// Satana Charuwichitratana <https://github.com/micksatana>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { Express } from 'express';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
declare function k(options?: k.Options | string): Express;
|
||||
|
||||
declare namespace k {
|
||||
interface Kraken extends Express, EventEmitter {
|
||||
interface Kraken extends Express {
|
||||
kraken: Kraken;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+11
@@ -1030,6 +1030,17 @@ declare namespace MathJax {
|
||||
* they were MathML, you might need to set this to true.
|
||||
*/
|
||||
addMMLclasses?: boolean;
|
||||
/*This controls whether the SVG output uses <use> elements to re-use font paths rather than repeat paths every
|
||||
* time. If useGlobalCache (see below) is set to false, this will still reduce duplication of paths while keeping
|
||||
* each SVG self-contained.
|
||||
*/
|
||||
useFontCache?: boolean;
|
||||
/*When set to true the SVG Output stores paths (corresponding to “fonts” in the SVG output) in a global SVG
|
||||
* object using <defs> elements so that it can re-use them in all equations via <use> elements (much like a font
|
||||
* file allows re-use of characters across the document). While set to true by default, it will have no effect if
|
||||
* useFontCache is set to false.
|
||||
*/
|
||||
useGlobalCache?: boolean;
|
||||
/*EqnChunk is the number of equations that will be typeset before they appear on screen. Larger values make for
|
||||
* less visual flicker as the equations are drawn, but also mean longer delays before the reader sees anything.
|
||||
*/
|
||||
|
||||
@@ -57,4 +57,11 @@ MathJax.Hub.Config({
|
||||
"HTML-CSS": { linebreaks: { automatic: true } },
|
||||
CommonHTML: { linebreaks: { automatic: true } },
|
||||
SVG: { linebreaks: { automatic: true } }
|
||||
});
|
||||
});
|
||||
|
||||
MathJax.Hub.Config({
|
||||
SVG: {
|
||||
useFontCache: true,
|
||||
useGlobalCache: true
|
||||
}
|
||||
})
|
||||
|
||||
Vendored
+2
@@ -2178,6 +2178,7 @@ declare module "child_process" {
|
||||
}
|
||||
|
||||
export interface SpawnOptions {
|
||||
argv0?: string;
|
||||
cwd?: string;
|
||||
env?: any;
|
||||
stdio?: any;
|
||||
@@ -2320,6 +2321,7 @@ declare module "child_process" {
|
||||
export function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
|
||||
|
||||
export interface SpawnSyncOptions {
|
||||
argv0?: string;
|
||||
cwd?: string;
|
||||
input?: string | Buffer;
|
||||
stdio?: any;
|
||||
|
||||
@@ -2097,8 +2097,10 @@ namespace child_process_tests {
|
||||
childProcess.exec("echo test");
|
||||
childProcess.exec("echo test", { windowsHide: true });
|
||||
childProcess.spawn("echo", ["test"], { windowsHide: true });
|
||||
childProcess.spawn("echo", ["test"], { windowsHide: true, argv0: "echo-test" });
|
||||
childProcess.spawnSync("echo test");
|
||||
childProcess.spawnSync("echo test", {windowsVerbatimArguments: false});
|
||||
childProcess.spawnSync("echo test", {windowsVerbatimArguments: false, argv0: "echo-test"});
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Vendored
+4
@@ -1698,6 +1698,8 @@ id(value: number|string): this;
|
||||
valueFormat(): string;
|
||||
/*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/
|
||||
valueFormat(value: string): this;
|
||||
/*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/
|
||||
valueFormat(format: (d: any) => string): this;
|
||||
/* The width the graph or component created inside the SVG should be made*/
|
||||
width(): number;
|
||||
/*The width the graph or component created inside the SVG should be made.*/
|
||||
@@ -2649,6 +2651,8 @@ id(value: number|string): this;
|
||||
valueFormat(): string;
|
||||
/*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/
|
||||
valueFormat(value: string): this;
|
||||
/*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/
|
||||
valueFormat(format: (d: any) => string): this;
|
||||
/*.*/
|
||||
valuePadding(): number;
|
||||
/**/
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace nvd3_test_discreteBarChart {
|
||||
//.staggerLabels(historicalBarChart[0].values.length > 8)
|
||||
.showValues(true)
|
||||
.duration(250)
|
||||
.valueFormat(d3.format("d"))
|
||||
;
|
||||
|
||||
d3.select('#chart1 svg')
|
||||
|
||||
@@ -136,6 +136,7 @@ namespace nvd3_test_multibarHorizontalChart {
|
||||
.barColor(d3.scale.category20().range())
|
||||
.duration(250)
|
||||
.margin({ left: 100 })
|
||||
.valueFormat(d3.format("d"))
|
||||
.stacked(true);
|
||||
|
||||
chart.yAxis.tickFormat(d3.format(',.2f'));
|
||||
|
||||
Vendored
+133
-105
@@ -413,11 +413,11 @@ declare namespace Office {
|
||||
*/
|
||||
auth: Auth;
|
||||
/**
|
||||
* True if developers can display, on the current platform, a UI in the add-in sell or upgrade; otherwise returns False.
|
||||
*
|
||||
* @remarks
|
||||
* The iOS App Store doesn't support apps with add-ins that provide links to additional payment systems. However, Office Add-ins running on the Windows desktop or for Office Online in the browser, do allow such links. If you want the UI of your add-in to provide a link to an external payment system on platforms other than iOS, you can use the commerceAllowed property to control when that link is displayed.
|
||||
*/
|
||||
* True, if the current platform allows the add-in to display a UI for selling or upgrading; otherwise returns False.
|
||||
*
|
||||
* @remarks
|
||||
* The iOS App Store doesn't support apps with add-ins that provide links to additional payment systems. However, Office Add-ins running on the Windows desktop or for Office Online in the browser, do allow such links. If you want the UI of your add-in to provide a link to an external payment system on platforms other than iOS, you can use the commerceAllowed property to control when that link is displayed.
|
||||
*/
|
||||
commerceAllowed: boolean;
|
||||
/**
|
||||
* Gets the locale (language) specified by the user for editing the document or item.
|
||||
@@ -426,20 +426,7 @@ declare namespace Office {
|
||||
/**
|
||||
* Gets information about the environment in which the add-in is running.
|
||||
*/
|
||||
diagnostics: {
|
||||
/**
|
||||
* Gets the Office application host in which the add-in is running.
|
||||
*/
|
||||
host: HostType;
|
||||
/**
|
||||
* Gets the platform on which the add-in is running.
|
||||
*/
|
||||
platform: PlatformType;
|
||||
/**
|
||||
* Gets the version of Office on which the add-in is running.
|
||||
*/
|
||||
version: string;
|
||||
};
|
||||
diagnostics: ContextInformation;
|
||||
/**
|
||||
* Gets the locale (language) specified by the user for the UI of the Office host application.
|
||||
* @remarks
|
||||
@@ -488,14 +475,7 @@ declare namespace Office {
|
||||
/**
|
||||
* Provides a method for determining what requirement sets are supported on the current host and platform.
|
||||
*/
|
||||
requirements: {
|
||||
/**
|
||||
* Check if the specified requirement set is supported by the host Office application.
|
||||
* @param name - Set name; e.g., "MatrixBindings".
|
||||
* @param minVersion - The minimum required version; e.g., "1.4".
|
||||
*/
|
||||
isSetSupported(name: string, minVersion?: number): boolean;
|
||||
}
|
||||
requirements: RequirementSetSupport;
|
||||
/**
|
||||
* Gets an object that represents the custom settings or state of a mail add-in saved to a user's mailbox.
|
||||
*
|
||||
@@ -605,6 +585,17 @@ declare namespace Office {
|
||||
*/
|
||||
closeContainer(): void;
|
||||
}
|
||||
/**
|
||||
* Provides information about what Requirement Sets are supported in current environment.
|
||||
*/
|
||||
interface RequirementSetSupport {
|
||||
/**
|
||||
* Check if the specified requirement set is supported by the host Office application.
|
||||
* @param name - Set name; e.g., "MatrixBindings".
|
||||
* @param minVersion - The minimum required version; e.g., "1.4".
|
||||
*/
|
||||
isSetSupported(name: string, minVersion?: number): boolean;
|
||||
}
|
||||
/**
|
||||
* Provides options for how a dialog is displayed.
|
||||
*/
|
||||
@@ -673,6 +664,23 @@ declare namespace Office {
|
||||
*/
|
||||
asyncContext?: any
|
||||
}
|
||||
/**
|
||||
* Provides information about the environment in which the add-in is running.
|
||||
*/
|
||||
interface ContextInformation {
|
||||
/**
|
||||
* Gets the Office application host in which the add-in is running.
|
||||
*/
|
||||
host: Office.HostType;
|
||||
/**
|
||||
* Gets the platform on which the add-in is running.
|
||||
*/
|
||||
platform: Office.PlatformType;
|
||||
/**
|
||||
* Gets the version of Office on which the add-in is running.
|
||||
*/
|
||||
version: string;
|
||||
}
|
||||
/**
|
||||
* Provides options for how to get the data in a binding.
|
||||
*
|
||||
@@ -772,7 +780,7 @@ declare namespace Office {
|
||||
format: object
|
||||
}
|
||||
/**
|
||||
* Specifies a cell, or row, or column, by its zero-based row and/or column number. Example: {row: 4, column: 3} specifies the cell in the 3rd (zero-based) row in the 4th (zero-based) column.
|
||||
* Specifies a cell, or row, or column, by its zero-based row and/or column number. Example: {row: 3, column: 4} specifies the cell in the 3rd (zero-based) row in the 4th (zero-based) column.
|
||||
*/
|
||||
interface RangeCoordinates {
|
||||
/**
|
||||
@@ -805,10 +813,6 @@ declare namespace Office {
|
||||
* The unique ID of the binding. Autogenerated if not supplied.
|
||||
*/
|
||||
id?: string
|
||||
/**
|
||||
* The names of the columns involved in the binding.
|
||||
*/
|
||||
columns?: Array<string>
|
||||
/**
|
||||
* A user-defined item of any type that is returned, unchanged, in the value property of the AsyncResult object that is passed to a callback.
|
||||
*/
|
||||
@@ -829,7 +833,7 @@ declare namespace Office {
|
||||
/**
|
||||
* Specifies a table of sample data displayed in the prompt UI as an example of the kinds of fields (columns) that can be bound by your add-in. The headers provided in the TableData object specify the labels used in the field selection UI. Note: This parameter is used only in add-ins for Access. It is ignored if provided when calling the method in an add-in for Excel.
|
||||
*/
|
||||
sampleData?: TableData
|
||||
sampleData?: Office.TableData
|
||||
/**
|
||||
* A user-defined item of any type that is returned, unchanged, in the value property of the AsyncResult object that is passed to a callback.
|
||||
*/
|
||||
@@ -997,7 +1001,6 @@ declare namespace Office {
|
||||
* - DialogEventReceived. Triggered when the dialog box has been closed or otherwise unloaded.
|
||||
*/
|
||||
addEventHandler(eventType: Office.EventType, handler: Function): void;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1110,6 +1113,44 @@ declare namespace Office {
|
||||
*/
|
||||
ReadWrite
|
||||
}
|
||||
/**
|
||||
* Specifies the type of the XML node.
|
||||
*
|
||||
* @remarks
|
||||
* Hosts: Word
|
||||
*
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*/
|
||||
enum CustomXMLNodeType {
|
||||
/**
|
||||
* The node is an attribute.
|
||||
*/
|
||||
Attribute,
|
||||
/**
|
||||
* The node is CData.
|
||||
*/
|
||||
CData,
|
||||
/**
|
||||
* The node is a comment.
|
||||
*/
|
||||
NodeComment,
|
||||
/**
|
||||
* The node is an element.
|
||||
*/
|
||||
Element,
|
||||
/**
|
||||
* The node is a Document element.
|
||||
*/
|
||||
NodeDocument,
|
||||
/**
|
||||
* The node is a processing instruction.
|
||||
*/
|
||||
ProcessingInstruction,
|
||||
/**
|
||||
* The node is text.
|
||||
*/
|
||||
Text,
|
||||
}
|
||||
/**
|
||||
* Specifies the kind of event that was raised. Returned by the type property of an EventNameEventArgs object.
|
||||
*
|
||||
@@ -1249,12 +1290,6 @@ declare namespace Office {
|
||||
*/
|
||||
Index
|
||||
}
|
||||
enum Index {
|
||||
First,
|
||||
Last,
|
||||
Next,
|
||||
Previous
|
||||
}
|
||||
/**
|
||||
* Specifies whether to select (highlight) the location to navigate to (when using the Document.goToByIdAsync method).
|
||||
*
|
||||
@@ -2038,6 +2073,60 @@ declare namespace Office {
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
setSelectedDataAsync(data: string | TableData | any[][], options?: SetSelectedDataOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get Project field (Ex. ProjectWebAccessURL).
|
||||
* @param fieldId Project level fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getProjectFieldAsync(fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get resource field for provided resource Id. (Ex.ResourceName)
|
||||
* @param resourceId Either a string or value of the Resource Id.
|
||||
* @param fieldId Resource Fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getResourceFieldAsync(resourceId: string, fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get the current selected Resource's Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedResourceAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get the current selected Task's Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedTaskAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get the current selected View Type (Ex. Gantt) and View Name.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedViewAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get the Task Name, WSS Task Id, and ResourceNames for given taskId.
|
||||
* @param taskId Either a string or value of the Task Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getTaskAsync(taskId: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get task field for provided task Id. (Ex. StartDate).
|
||||
* @param taskId Either a string or value of the Task Id.
|
||||
* @param fieldId Task Fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getTaskFieldAsync(taskId: string, fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get the WSS Url and list name for the Tasks List, the MPP is synced too.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getWSSUrlAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
}
|
||||
/**
|
||||
* Provides information about the document that raised the SelectionChanged event.
|
||||
@@ -4668,63 +4757,6 @@ declare namespace Office {
|
||||
*/
|
||||
Timeline
|
||||
}
|
||||
// Objects
|
||||
interface Document {
|
||||
/**
|
||||
* Get Project field (Ex. ProjectWebAccessURL).
|
||||
* @param fieldId Project level fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getProjectFieldAsync(fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get resource field for provided resource Id. (Ex.ResourceName)
|
||||
* @param resourceId Either a string or value of the Resource Id.
|
||||
* @param fieldId Resource Fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getResourceFieldAsync(resourceId: string, fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get the current selected Resource's Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedResourceAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get the current selected Task's Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedTaskAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get the current selected View Type (Ex. Gantt) and View Name.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedViewAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get the Task Name, WSS Task Id, and ResourceNames for given taskId.
|
||||
* @param taskId Either a string or value of the Task Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getTaskAsync(taskId: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get task field for provided task Id. (Ex. StartDate).
|
||||
* @param taskId Either a string or value of the Task Id.
|
||||
* @param fieldId Task Fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getTaskFieldAsync(taskId: string, fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get the WSS Url and list name for the Tasks List, the MPP is synced too.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getWSSUrlAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9907,15 +9939,11 @@ declare namespace Excel {
|
||||
* Copy a worksheet and place it at the specified position. Return the copied worksheet.
|
||||
*
|
||||
* [Api set: ExcelApi 1.7]
|
||||
*
|
||||
* @param positionType Specifies where to put the copy relative to the worksheet specified in relativeTo param. Can be Excel.WorksheetPositionType or string equivalent. Must not be Excel.WorksheetPositionType.none or "None".
|
||||
* @param relativeTo Specifies the worksheet that is the basis for intepreting the positionType param. If not specified, the worksheet on which the copy() is called is assumed.
|
||||
*/
|
||||
copy(positionType?: Excel.WorksheetPositionType, relativeTo?: Excel.Worksheet): Excel.Worksheet;
|
||||
/**
|
||||
*
|
||||
* Copy a worksheet and place it at the specified position. Return the copied worksheet.
|
||||
*
|
||||
* [Api set: ExcelApi 1.7]
|
||||
*/
|
||||
copy(positionType?: "None" | "Before" | "After" | "Beginning" | "End", relativeTo?: Excel.Worksheet): Excel.Worksheet;
|
||||
copy(positionType?: Excel.WorksheetPositionType | string, relativeTo?: Excel.Worksheet): Excel.Worksheet;
|
||||
/**
|
||||
*
|
||||
* Deletes the worksheet from the workbook.
|
||||
|
||||
Vendored
+198
-77
@@ -1,22 +1,73 @@
|
||||
// Type definitions for openpgpjs
|
||||
// Project: http://openpgpjs.org/
|
||||
// Definitions by: Guillaume Lacasa <https://blog.lacasa.fr>
|
||||
// Errietta Kostala <https://github.com/errietta>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace openpgp;
|
||||
|
||||
export interface KeyPair {
|
||||
export interface UserId {
|
||||
name?: string,
|
||||
email?: string,
|
||||
}
|
||||
|
||||
export interface SessionKey {
|
||||
data: Uint8Array,
|
||||
algorithm: string
|
||||
}
|
||||
|
||||
export interface EncryptOptions {
|
||||
data: string|Uint8Array,
|
||||
dataType?: 'utf8'|'binary'|'text'|'mime',
|
||||
publicKeys?: key.Key | key.Key[],
|
||||
privateKeys?: key.Key | key.Key[],
|
||||
passwords?: string|string[],
|
||||
sessionKey?: SessionKey,
|
||||
filename?: string,
|
||||
compression?: enums.compression,
|
||||
armor?: boolean,
|
||||
detached?: boolean,
|
||||
signature?: Signature,
|
||||
returnSessionKey?: boolean,
|
||||
wildcard?: boolean,
|
||||
date?: Date,
|
||||
fromUserId?: UserId,
|
||||
toUserId?: UserId,
|
||||
}
|
||||
|
||||
export interface EncryptedMessage {
|
||||
data: string,
|
||||
message: string,
|
||||
}
|
||||
|
||||
export interface DecryptOptions {
|
||||
message: message.Message,
|
||||
privateKeys?: key.Key | key.Key[],
|
||||
passwords?: string | string[],
|
||||
sessionKeys?: SessionKey | SessionKey[],
|
||||
publicKeys?: key.Key | key.Key[],
|
||||
format?: string,
|
||||
signature?: Signature,
|
||||
date?: Date,
|
||||
}
|
||||
|
||||
export interface KeyContainer {
|
||||
key: key.Key,
|
||||
}
|
||||
|
||||
export interface KeyPair extends KeyContainer {
|
||||
privateKeyArmored: string,
|
||||
publicKeyArmored: string
|
||||
}
|
||||
|
||||
export interface KeyOptions {
|
||||
keyType?: enums.publicKey,
|
||||
numBits: number,
|
||||
userId: string,
|
||||
passphrase: string,
|
||||
unlocked?: boolean
|
||||
userIds?: UserId[],
|
||||
passphrase?: string,
|
||||
numBits?: number,
|
||||
keyExpirationTime?: number,
|
||||
curve?: string,
|
||||
date?: Date,
|
||||
subkeys?: KeyOptions[]
|
||||
}
|
||||
|
||||
export interface Keyid {
|
||||
@@ -29,91 +80,153 @@ export interface Signature {
|
||||
}
|
||||
|
||||
export interface VerifiedMessage {
|
||||
text: string,
|
||||
signatures: Array<Signature>
|
||||
data: Uint8Array|string,
|
||||
signatures: Array<Signature>,
|
||||
filename: string,
|
||||
}
|
||||
|
||||
/** Decrypts message and verifies signatures
|
||||
export interface OpenPGPWorker {
|
||||
randomCallback(): void;
|
||||
configure(config: any): void;
|
||||
seedRandom(buffer: ArrayBuffer): void;
|
||||
delegate(id: number, method: string, options: any): void;
|
||||
response(event: any): void;
|
||||
}
|
||||
|
||||
@param privateKey private key with decrypted secret key data
|
||||
@param publicKeys array of keys to verify signatures
|
||||
@param msg the message object with signed and encrypted data
|
||||
*/
|
||||
export function decryptAndVerifyMessage(privateKey: key.Key, publicKeys: Array<key.Key>, msg: string): Promise<VerifiedMessage>;
|
||||
/** Decrypts message and verifies signatures
|
||||
export interface WorkerOptions {
|
||||
path?: string,
|
||||
n?: number,
|
||||
workers?: OpenPGPWorker[],
|
||||
config?: any,
|
||||
}
|
||||
|
||||
@param privateKey private key with decrypted secret key data
|
||||
@param publicKey single key to verify signatures
|
||||
@param msg the message object with signed and encrypted data
|
||||
*/
|
||||
export function decryptAndVerifyMessage(privateKey: key.Key, publicKey: key.Key, msg: string): Promise<VerifiedMessage>;
|
||||
export class AsyncProxy {
|
||||
constructor(options: WorkerOptions);
|
||||
getId(): number;
|
||||
seedRandom(workerId: number, size: number): Promise<void>;
|
||||
terminate(): void;
|
||||
delegate(method: string, options: any): void;
|
||||
|
||||
/** Decrypts message
|
||||
workers: OpenPGPWorker[];
|
||||
}
|
||||
|
||||
@param privateKey private key with decrypted secret key data
|
||||
@param msg the message object with the encrypted data
|
||||
*/
|
||||
export function decryptMessage(privateKey: key.Key, msg: message.Message): Promise<string>;
|
||||
/**
|
||||
* Set the path for the web worker script and create an instance of the async proxy
|
||||
* @param {String} path relative path to the worker scripts, default: 'openpgp.worker.js'
|
||||
* @param {Number} n number of workers to initialize
|
||||
* @param {Array<Object>} workers alternative to path parameter: web workers initialized with 'openpgp.worker.js'
|
||||
*/
|
||||
export function initWorker(options: WorkerOptions): boolean;
|
||||
|
||||
/** Encrypts message text with keys
|
||||
@param keys array of keys used to encrypt the message
|
||||
@param text message as native JavaScript string
|
||||
@returns encrypted ASCII armored message
|
||||
*/
|
||||
export function encryptMessage(keys: Array<key.Key>, message: string): Promise<string>;
|
||||
/** Encrypts message text with keys
|
||||
/**
|
||||
* Returns a reference to the async proxy if the worker was initialized with openpgp.initWorker()
|
||||
* @returns {module:worker/async_proxy.AsyncProxy|null} the async proxy or null if not initialized
|
||||
*/
|
||||
export function getWorker(): AsyncProxy;
|
||||
|
||||
@param single key used to encrypt the message
|
||||
@param text message as native JavaScript string
|
||||
*/
|
||||
export function encryptMessage(key: key.Key, message: string): Promise<string>;
|
||||
/**
|
||||
* Cleanup the current instance of the web worker.
|
||||
*/
|
||||
export function destroyWorker(): void;
|
||||
|
||||
/** Generates a new OpenPGP key pair. Currently only supports RSA keys. Primary and subkey will be of same type.
|
||||
@param options
|
||||
*/
|
||||
export function generateKeyPair(options: KeyOptions): Promise<KeyPair>;
|
||||
/**
|
||||
* Encrypts message text/data with public keys, passwords or both at once. At least either public keys or passwords
|
||||
* must be specified. If private keys are specified, those will be used to sign the message.
|
||||
* @param {String|Uint8Array} data text/data to be encrypted as JavaScript binary string or Uint8Array
|
||||
* @param {utf8|binary|text|mime} dataType (optional) data packet type
|
||||
* @param {Key|Array<Key>} publicKeys (optional) array of keys or single key, used to encrypt the message
|
||||
* @param {Key|Array<Key>} privateKeys (optional) private keys for signing. If omitted message will not be signed
|
||||
* @param {String|Array<String>} passwords (optional) array of passwords or a single password to encrypt the message
|
||||
* @param {Object} sessionKey (optional) session key in the form: { data:Uint8Array, algorithm:String }
|
||||
* @param {String} filename (optional) a filename for the literal data packet
|
||||
* @param {module:enums.compression} compression (optional) which compression algorithm to compress the message with, defaults to what is specified in config
|
||||
* @param {Boolean} armor (optional) if the return values should be ascii armored or the message/signature objects
|
||||
* @param {Boolean} detached (optional) if the signature should be detached (if true, signature will be added to returned object)
|
||||
* @param {Signature} signature (optional) a detached signature to add to the encrypted message
|
||||
* @param {Boolean} returnSessionKey (optional) if the unencrypted session key should be added to returned object
|
||||
* @param {Boolean} wildcard (optional) use a key ID of 0 instead of the public key IDs
|
||||
* @param {Date} date (optional) override the creation date of the message and the message signature
|
||||
* @param {Object} fromUserId (optional) user ID to sign with, e.g. { name:'Steve Sender', email:'steve@openpgp.org' }
|
||||
* @param {Object} toUserId (optional) user ID to encrypt for, e.g. { name:'Robert Receiver', email:'robert@openpgp.org' }
|
||||
* @returns {Promise<Object>} encrypted (and optionally signed message) in the form:
|
||||
* {data: ASCII armored message if 'armor' is true,
|
||||
* message: full Message object if 'armor' is false, signature: detached signature if 'detached' is true}
|
||||
* @async
|
||||
* @static
|
||||
*/
|
||||
export function encrypt(options: EncryptOptions): Promise<EncryptedMessage>;
|
||||
|
||||
/** Signs message text and encrypts it
|
||||
/**
|
||||
* Decrypts a message with the user's private key, a session key or a password. Either a private key,
|
||||
* a session key or a password must be specified.
|
||||
* @param {Message} message the message object with the encrypted data
|
||||
* @param {Key|Array<Key>} privateKeys (optional) private keys with decrypted secret key data or session key
|
||||
* @param {String|Array<String>} passwords (optional) passwords to decrypt the message
|
||||
* @param {Object|Array<Object>} sessionKeys (optional) session keys in the form: { data:Uint8Array, algorithm:String }
|
||||
* @param {Key|Array<Key>} publicKeys (optional) array of public keys or single key, to verify signatures
|
||||
* @param {String} format (optional) return data format either as 'utf8' or 'binary'
|
||||
* @param {Signature} signature (optional) detached signature for verification
|
||||
* @param {Date} date (optional) use the given date for verification instead of the current time
|
||||
* @returns {Promise<Object>} decrypted and verified message in the form:
|
||||
* { data:Uint8Array|String, filename:String, signatures:[{ keyid:String, valid:Boolean }] }
|
||||
* @async
|
||||
* @static
|
||||
*/
|
||||
export function decrypt(options: DecryptOptions): Promise<VerifiedMessage>;
|
||||
|
||||
@param publicKeys array of keys used to encrypt the message
|
||||
@param privateKey private key with decrypted secret key data for signing
|
||||
@param text private key with decrypted secret key data for signing
|
||||
*/
|
||||
export function signAndEncryptMessage(publicKeys: Array<key.Key>, privateKey: key.Key, text: string): Promise<string>;
|
||||
/** Signs message text and encrypts it
|
||||
/**
|
||||
* Generates a new OpenPGP key pair. Supports RSA and ECC keys. Primary and subkey will be of same type.
|
||||
* @param {Array<Object>} userIds array of user IDs e.g. [{ name:'Phil Zimmermann', email:'phil@openpgp.org' }]
|
||||
* @param {String} passphrase (optional) The passphrase used to encrypt the resulting private key
|
||||
* @param {Number} numBits (optional) number of bits for RSA keys: 2048 or 4096.
|
||||
* @param {Number} keyExpirationTime (optional) The number of seconds after the key creation time that the key expires
|
||||
* @param {String} curve (optional) elliptic curve for ECC keys:
|
||||
* curve25519, p256, p384, p521, secp256k1,
|
||||
* brainpoolP256r1, brainpoolP384r1, or brainpoolP512r1.
|
||||
* @param {Date} date (optional) override the creation date of the key and the key signatures
|
||||
* @param {Array<Object>} subkeys (optional) options for each subkey, default to main key options. e.g. [{sign: true, passphrase: '123'}]
|
||||
* sign parameter defaults to false, and indicates whether the subkey should sign rather than encrypt
|
||||
* @returns {Promise<Object>} The generated key object in the form:
|
||||
* { key:Key, privateKeyArmored:String, publicKeyArmored:String }
|
||||
* @async
|
||||
* @static
|
||||
*/
|
||||
export function generateKey(options: KeyOptions): Promise<KeyPair>;
|
||||
|
||||
@param publicKeys single key used to encrypt the message
|
||||
@param privateKey private key with decrypted secret key data for signing
|
||||
@param text private key with decrypted secret key data for signing
|
||||
*/
|
||||
export function signAndEncryptMessage(publicKey: key.Key, privateKey: key.Key, text: string): Promise<string>;
|
||||
/**
|
||||
* Reformats signature packets for a key and rewraps key object.
|
||||
* @param {Key} privateKey private key to reformat
|
||||
* @param {Array<Object>} userIds array of user IDs e.g. [{ name:'Phil Zimmermann', email:'phil@openpgp.org' }]
|
||||
* @param {String} passphrase (optional) The passphrase used to encrypt the resulting private key
|
||||
* @param {Number} keyExpirationTime (optional) The number of seconds after the key creation time that the key expires
|
||||
* @returns {Promise<Object>} The generated key object in the form:
|
||||
* { key:Key, privateKeyArmored:String, publicKeyArmored:String }
|
||||
* @async
|
||||
* @static
|
||||
*/
|
||||
export function reformatKey(options: {
|
||||
privateKey: key.Key,
|
||||
userIds?: UserId[],
|
||||
passphrase?: string,
|
||||
keyExpirationTime?: number,
|
||||
}): Promise<KeyPair>;
|
||||
|
||||
/** Signs a cleartext message
|
||||
|
||||
@param privateKeys array of keys with decrypted secret key data to sign cleartext
|
||||
@param text cleartext
|
||||
*/
|
||||
export function signClearMessage(privateKeys: Array<key.Key>, text: string): Promise<string>;
|
||||
/** Signs a cleartext message
|
||||
|
||||
@param privateKeys single key with decrypted secret key data to sign cleartext
|
||||
@param text cleartext
|
||||
*/
|
||||
export function signClearMessage(privateKey: key.Key, text: string): Promise<string>;
|
||||
|
||||
/** Verifies signatures of cleartext signed message
|
||||
|
||||
@param publicKeys array of keys to verify signatures
|
||||
@param msg cleartext message object with signatures
|
||||
*/
|
||||
export function verifyClearSignedMessage(publicKeys: Array<key.Key>, msg: cleartext.CleartextMessage): Promise<VerifiedMessage>;
|
||||
/** Verifies signatures of cleartext signed message
|
||||
|
||||
@param publicKeys single key to verify signatures
|
||||
@param msg cleartext message object with signatures
|
||||
*/
|
||||
export function verifyClearSignedMessage(publicKey: key.Key, msg: cleartext.CleartextMessage): Promise<VerifiedMessage>;
|
||||
/**
|
||||
* Unlock a private key with your passphrase.
|
||||
* @param {Key} privateKey the private key that is to be decrypted
|
||||
* @param {String|Array<String>} passphrase the user's passphrase(s) chosen during key generation
|
||||
* @returns {Promise<Object>} the unlocked key object in the form: { key:Key }
|
||||
* @async
|
||||
*/
|
||||
export function decryptKey(options: {
|
||||
privateKey: key.Key,
|
||||
passphrase?: string | string[],
|
||||
}): Promise<KeyContainer>;
|
||||
|
||||
export function encryptKey(options: {
|
||||
privateKey: key.Key,
|
||||
passphrase?: string
|
||||
}): Promise<KeyContainer>;
|
||||
|
||||
export namespace armor {
|
||||
/** Armor an OpenPGP binary packet block
|
||||
@@ -471,6 +584,14 @@ export namespace message {
|
||||
@param armoredText text to be parsed
|
||||
*/
|
||||
function readArmored(armoredText: string): Message;
|
||||
|
||||
/**
|
||||
* reads an OpenPGP message as byte array and returns a message object
|
||||
* @param {Uint8Array} input binary message
|
||||
* @returns {Message} new message object
|
||||
* @static
|
||||
*/
|
||||
function read(data: Uint8Array): Message;
|
||||
}
|
||||
|
||||
export namespace packet {
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
var options: openpgp.KeyOptions = {
|
||||
numBits: 2048,
|
||||
userId: 'Jon Smith <jon.smith@example.org>',
|
||||
userIds: [{
|
||||
name: 'Jon Smith',
|
||||
email: 'jon.smith@example.org',
|
||||
}],
|
||||
passphrase: 'super long and hard to guess secret'
|
||||
};
|
||||
|
||||
openpgp.generateKeyPair(options).then(function (keypair) {
|
||||
openpgp.generateKey(options).then(function (keypair) {
|
||||
// success
|
||||
var privkey = keypair.privateKeyArmored;
|
||||
var pubkey = keypair.publicKeyArmored;
|
||||
@@ -18,14 +21,15 @@ openpgp.generateKeyPair(options).then(function (keypair) {
|
||||
var spubkey = '-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----';
|
||||
var publicKey = openpgp.key.readArmored(spubkey);
|
||||
|
||||
openpgp.encryptMessage(publicKey.keys, 'Hello, World!').then(function (pgpMessage) {
|
||||
openpgp.encrypt({
|
||||
data: 'Hello, World!',
|
||||
publicKeys: publicKey.keys
|
||||
}).then(function (pgpMessage) {
|
||||
// success
|
||||
}).catch(function (error) {
|
||||
// failure
|
||||
});
|
||||
|
||||
|
||||
|
||||
var sprivkey = '-----BEGIN PGP PRIVATE KEY BLOCK ... END PGP PRIVATE KEY BLOCK-----';
|
||||
var privateKey = openpgp.key.readArmored(sprivkey).keys[0];
|
||||
privateKey.decrypt('passphrase');
|
||||
@@ -33,7 +37,10 @@ privateKey.decrypt('passphrase');
|
||||
var pgpMessageStr = '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----';
|
||||
var pgpMessage = openpgp.message.readArmored(pgpMessageStr);
|
||||
|
||||
openpgp.decryptMessage(privateKey, pgpMessage).then(function (plaintext) {
|
||||
openpgp.decrypt({
|
||||
privateKeys: privateKey,
|
||||
message: pgpMessage
|
||||
}).then(function (plaintext) {
|
||||
// success
|
||||
}).catch(function (error) {
|
||||
// failure
|
||||
@@ -44,35 +51,9 @@ openpgp.decryptMessage(privateKey, pgpMessage).then(function (plaintext) {
|
||||
|
||||
|
||||
var keyoptions: openpgp.KeyOptions;
|
||||
var key= openpgp.key.generate(keyoptions);
|
||||
var keys: Array<openpgp.key.Key>;
|
||||
var message = openpgp.message.readArmored("");
|
||||
var cleartextmessage = openpgp.cleartext.readArmored("");
|
||||
var mpi: openpgp.crypto.Mpi;
|
||||
var mpis: Array<openpgp.crypto.Mpi>;
|
||||
|
||||
|
||||
openpgp.decryptAndVerifyMessage(key, key, "").then();
|
||||
openpgp.decryptAndVerifyMessage(key, keys, "").then();
|
||||
|
||||
openpgp.decryptMessage(key, message).then();
|
||||
|
||||
openpgp.encryptMessage(key, "").then();
|
||||
openpgp.encryptMessage(keys, "").then();
|
||||
|
||||
openpgp.generateKeyPair(keyoptions).then(function (keypair) {
|
||||
key = keypair.key;
|
||||
});
|
||||
|
||||
openpgp.signAndEncryptMessage(key, key, "").then();
|
||||
openpgp.signAndEncryptMessage(keys, key, "").then();
|
||||
|
||||
openpgp.signClearMessage(key, "").then();
|
||||
openpgp.signClearMessage(keys, "").then();
|
||||
|
||||
openpgp.verifyClearSignedMessage(key, cleartextmessage);
|
||||
openpgp.verifyClearSignedMessage(keys, cleartextmessage);
|
||||
|
||||
openpgp.armor.armor(openpgp.enums.armor.message, {}, 0, 1);
|
||||
openpgp.armor.dearmor("");
|
||||
|
||||
|
||||
Vendored
+11
@@ -3,6 +3,13 @@
|
||||
// Definitions by: Tomek Łaziuk <https://github.com/tlaziuk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Returns `-1` when unsatisfiable and `-2` when syntactically invalid.
|
||||
*
|
||||
* When ranges are returned, the array has a "type" property which is the type of
|
||||
* range that is required (most commonly, "bytes"). Each array element is an object
|
||||
* with a "start" and "end" property for the portion of the range.
|
||||
*/
|
||||
declare function RangeParser(size: number, str: string, options?: RangeParser.Options): RangeParser.Result | RangeParser.Ranges;
|
||||
|
||||
declare namespace RangeParser {
|
||||
@@ -14,6 +21,10 @@ declare namespace RangeParser {
|
||||
end: number;
|
||||
}
|
||||
interface Options {
|
||||
/**
|
||||
* The "combine" option can be set to `true` and overlapping & adjacent ranges
|
||||
* will be combined into a single range.
|
||||
*/
|
||||
combine?: boolean;
|
||||
}
|
||||
const enum Result {
|
||||
|
||||
Vendored
+1
-1
@@ -19,7 +19,7 @@ import {
|
||||
export function findDOMNode(instance: ReactInstance): Element | null | Text;
|
||||
export function unmountComponentAtNode(container: Element): boolean;
|
||||
|
||||
export function createPortal(children: ReactNode, container: Element): ReactPortal;
|
||||
export function createPortal(children: ReactNode, container: Element, key?: null | string): ReactPortal;
|
||||
|
||||
export const version: string;
|
||||
export const render: Renderer;
|
||||
|
||||
@@ -42,7 +42,14 @@ describe('ReactDOM', () => {
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.createPortal(React.createElement('div'), portalTarget);
|
||||
ReactDOM.createPortal(<div />, document.createElement('div'));
|
||||
ReactDOM.createPortal(<div />, document.createElement('div'), null);
|
||||
ReactDOM.createPortal(<div />, document.createElement('div'), 'key');
|
||||
|
||||
ReactDOM.createPortal(React.createElement('div'), document.createElement('div'));
|
||||
ReactDOM.createPortal(React.createElement('div'), document.createElement('div'), null);
|
||||
ReactDOM.createPortal(React.createElement('div'), document.createElement('div'), 'key');
|
||||
|
||||
ReactDOM.render(<ClassComponent />, rootElement);
|
||||
});
|
||||
});
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for react-native-custom-tabs 0.1
|
||||
// Project: https://github.com/droibit/react-native-custom-tabs
|
||||
// Definitions by: Phil Nova <https://github.com/philnova>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface Animations {
|
||||
startEnter: string;
|
||||
startExit: string;
|
||||
endEnter: string;
|
||||
endExit: string;
|
||||
}
|
||||
|
||||
export interface CustomTabsOptions {
|
||||
toolbarColor?: string;
|
||||
enableUrlBarHiding?: boolean;
|
||||
showPageTitle?: boolean;
|
||||
enableDefaultShare?: boolean;
|
||||
animations?: Animations;
|
||||
headers?: any;
|
||||
}
|
||||
|
||||
export function openURL(url: string, options?: CustomTabsOptions): Promise<boolean>;
|
||||
@@ -0,0 +1,10 @@
|
||||
import * as ReactNativeCustomTabs from 'react-native-custom-tabs';
|
||||
|
||||
const rnt: ReactNativeCustomTabs.CustomTabsOptions = {
|
||||
toolbarColor: 'blue',
|
||||
enableUrlBarHiding: false,
|
||||
showPageTitle: true,
|
||||
enableDefaultShare: true,
|
||||
};
|
||||
|
||||
const url: Promise<boolean> = ReactNativeCustomTabs.openURL('testurl.com', rnt);
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-custom-tabs-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+17
-17
@@ -1,9 +1,9 @@
|
||||
// Type definitions for react-native-tab-view 0.0
|
||||
// Type definitions for react-native-tab-view 1.0
|
||||
// Project: https://github.com/react-native-community/react-native-tab-view
|
||||
// Definitions by: Kalle Ott <https://github.com/kaoDev>
|
||||
// Kyle Roach <https://github.com/iRoachie>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import { PureComponent, ReactNode, ComponentType } from 'react'
|
||||
import {
|
||||
Animated,
|
||||
@@ -39,7 +39,7 @@ export type SceneRendererProps<T extends RouteBase = RouteBase> = {
|
||||
}
|
||||
navigationState: NavigationState<T>
|
||||
position: Animated.Value
|
||||
jumpToIndex: (index: number) => void
|
||||
jumpTo: (key: string) => void
|
||||
getLastPosition: () => number
|
||||
subscribe: (
|
||||
event: SubscriptionName,
|
||||
@@ -75,24 +75,24 @@ export type PagerProps = {
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
export type TabViewAnimatedProps<
|
||||
export type TabViewProps<
|
||||
T extends RouteBase = RouteBase
|
||||
> = PagerProps & {
|
||||
navigationState: NavigationState<T>
|
||||
tabBarPosition?: 'bottom' | 'top'
|
||||
onIndexChange: (index: number) => void
|
||||
onPositionChange?: (props: { value: number }) => void
|
||||
initialLayout?: Layout
|
||||
canJumpToTab?: (route: T) => boolean
|
||||
renderPager?: (props: SceneRendererProps<T> & PagerProps) => ReactNode
|
||||
renderScene: (props: SceneRendererProps<T> & Scene<T>) => ReactNode
|
||||
renderHeader?: (props: SceneRendererProps<T>) => ReactNode
|
||||
renderFooter?: (props: SceneRendererProps<T>) => ReactNode
|
||||
renderTabBar?: (props: SceneRendererProps<T>) => ReactNode
|
||||
lazy?: boolean
|
||||
style?: StyleProp<ViewStyle>
|
||||
}
|
||||
|
||||
export class TabViewAnimated<T extends Route = Route> extends PureComponent<
|
||||
TabViewAnimatedProps<T>,
|
||||
export class TabView<T extends Route = Route> extends PureComponent<
|
||||
TabViewProps<T>,
|
||||
any
|
||||
> {}
|
||||
|
||||
@@ -125,7 +125,7 @@ export type GestureState = {
|
||||
|
||||
export type GestureHandler = (event: GestureEvent, state: GestureState) => void
|
||||
|
||||
export type TabViewPagerPanProps<
|
||||
export type PagerPanProps<
|
||||
T extends RouteBase = RouteBase
|
||||
> = SceneRendererProps<T> & {
|
||||
configureTransition?: TransitionConfigurator
|
||||
@@ -144,8 +144,8 @@ export type DefaultTransitionSpec = {
|
||||
friction: 35
|
||||
}
|
||||
|
||||
export class TabViewPagerPan<T extends Route = Route> extends PureComponent<
|
||||
TabViewPagerPanProps<T>,
|
||||
export class PagerPan<T extends Route = Route> extends PureComponent<
|
||||
PagerPanProps<T>,
|
||||
void
|
||||
> {
|
||||
static defaultProps: {
|
||||
@@ -168,7 +168,7 @@ export type ScrollEvent = {
|
||||
}
|
||||
}
|
||||
|
||||
export type TabViewPagerScrollProps<
|
||||
export type PagerScrollProps<
|
||||
T extends RouteBase = RouteBase
|
||||
> = SceneRendererProps<T> & {
|
||||
animationEnabled?: boolean
|
||||
@@ -176,8 +176,8 @@ export type TabViewPagerScrollProps<
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
export class TabViewPagerScroll<T extends Route = Route> extends PureComponent<
|
||||
TabViewPagerScrollProps<T>,
|
||||
export class PagerScroll<T extends Route = Route> extends PureComponent<
|
||||
PagerScrollProps<T>,
|
||||
any
|
||||
> {}
|
||||
|
||||
@@ -190,7 +190,7 @@ export type PageScrollEvent = {
|
||||
|
||||
export type PageScrollState = 'dragging' | 'settling' | 'idle'
|
||||
|
||||
export type TabViewPagerAndroidProps<
|
||||
export type PagerAndroidProps<
|
||||
T extends RouteBase = RouteBase
|
||||
> = SceneRendererProps<T> & {
|
||||
animationEnabled?: boolean
|
||||
@@ -198,8 +198,8 @@ export type TabViewPagerAndroidProps<
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
export class TabViewPagerAndroid<T extends Route = Route> extends PureComponent<
|
||||
TabViewPagerAndroidProps<T>,
|
||||
export class PagerAndroid<T extends Route = Route> extends PureComponent<
|
||||
PagerAndroidProps<T>,
|
||||
void
|
||||
> {}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PureComponent, Component } from 'react'
|
||||
import { View, StyleSheet } from 'react-native'
|
||||
import {
|
||||
TabViewAnimated,
|
||||
TabView,
|
||||
TabBar,
|
||||
SceneMap,
|
||||
TabBarProps,
|
||||
@@ -31,7 +31,7 @@ class TabViewExample extends PureComponent {
|
||||
|
||||
_handleIndexChange = (index: number) => this.setState({ index })
|
||||
|
||||
_renderHeader = (props: TabBarProps) => <TabBar {...props} />
|
||||
_renderTabBar = (props: TabBarProps) => <TabBar {...props} />
|
||||
|
||||
_renderScene = SceneMap({
|
||||
first: FirstRoute,
|
||||
@@ -40,11 +40,12 @@ class TabViewExample extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<TabViewAnimated
|
||||
<TabView
|
||||
style={styles.container}
|
||||
navigationState={this.state}
|
||||
renderScene={this._renderScene}
|
||||
renderHeader={this._renderHeader}
|
||||
renderTabBar={this._renderTabBar}
|
||||
tabBarPosition="top"
|
||||
onIndexChange={this._handleIndexChange}
|
||||
/>
|
||||
)
|
||||
|
||||
Vendored
+3
-3
@@ -108,17 +108,17 @@ export interface Connect {
|
||||
|
||||
<TStateProps = {}, no_dispatch = {}, TOwnProps = {}, State = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>
|
||||
): InferableComponentEnhancerWithProps<TStateProps & DispatchProp & TOwnProps, TOwnProps>;
|
||||
): InferableComponentEnhancerWithProps<TStateProps & DispatchProp, TOwnProps>;
|
||||
|
||||
<no_state = {}, TDispatchProps = {}, TOwnProps = {}>(
|
||||
mapStateToProps: null | undefined,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TDispatchProps & TOwnProps, TOwnProps>;
|
||||
): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
|
||||
|
||||
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps & TOwnProps, TOwnProps>;
|
||||
): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
|
||||
|
||||
<TStateProps = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}, State = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from "react";
|
||||
import { View } from "react-native";
|
||||
import { TabStack, renderSubView } from "react-router-navigation-core";
|
||||
import { TabBarProps, TabProps } from "react-router-navigation";
|
||||
import { TabViewAnimated } from "react-native-tab-view";
|
||||
import { TabView } from "react-native-tab-view";
|
||||
|
||||
type Props = TabBarProps & {
|
||||
children?: Array<React.ReactElement<TabProps>>;
|
||||
@@ -24,7 +24,7 @@ class BottomNavigation extends React.Component<Props, State> {
|
||||
render={props => {
|
||||
const ownProps = { ...this.props, ...props };
|
||||
return (
|
||||
<TabViewAnimated
|
||||
<TabView
|
||||
{...props}
|
||||
key={`transitioner_${this.state.key}`}
|
||||
animationEnabled={false}
|
||||
@@ -32,10 +32,11 @@ class BottomNavigation extends React.Component<Props, State> {
|
||||
sceneProps => <View />,
|
||||
ownProps
|
||||
)}
|
||||
renderFooter={renderSubView(
|
||||
renderTabBar={renderSubView(
|
||||
sceneProps => <View />,
|
||||
ownProps
|
||||
)}
|
||||
tabBarPosition="bottom"
|
||||
renderScene={renderSubView(
|
||||
sceneProps => <View />,
|
||||
ownProps
|
||||
|
||||
-1
@@ -6,7 +6,6 @@
|
||||
|
||||
import { Component, ReactNode, ReactElement, ComponentClass } from "react";
|
||||
import { StyleProp, ViewProps, ViewStyle, TextStyle } from "react-native";
|
||||
import { TabViewAnimated, TabViewPagerPan } from "react-native-tab-view";
|
||||
import { RouteProps } from "react-router-navigation-core";
|
||||
import {
|
||||
NavigationTransitionProps,
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ export namespace ReactStripeElements {
|
||||
interface StripeProviderOptions {
|
||||
stripeAccount?: string;
|
||||
}
|
||||
type StripeProviderProps = { apiKey: string; stripe?: never; options?: StripeProviderOptions } | { apiKey?: never; stripe: StripeProps | null; options?: StripeProviderOptions; };
|
||||
type StripeProviderProps = { apiKey: string; stripe?: never; } & StripeProviderOptions | { apiKey?: never; stripe: StripeProps | null; } & StripeProviderOptions;
|
||||
|
||||
interface StripeProps {
|
||||
createSource(sourceData?: SourceOptions): Promise<SourceResponse>;
|
||||
|
||||
@@ -197,6 +197,7 @@ const TestStripeProviderProps3: React.SFC<{
|
||||
}> = props => <StripeProvider stripe={null} />;
|
||||
|
||||
/**
|
||||
* StripeProvider should be able to accept an `options` prop
|
||||
* StripeProvider should be able to accept options.
|
||||
* See: https://stripe.com/docs/stripe-js/reference#stripe-function for options.
|
||||
*/
|
||||
const TestStripeProviderOptions: React.SFC = () => <StripeProvider apiKey="" options={{stripeAccount: ""}} />;
|
||||
const TestStripeProviderOptions: React.SFC = () => <StripeProvider apiKey="" stripeAccount="" />;
|
||||
|
||||
@@ -2,3 +2,11 @@ Typings for [Recharts](http://recharts.org/), a composable charting library buil
|
||||
|
||||
The [Recharts website](https://github.com/recharts/recharts.org) has comprehensive API documentation which is generated from JavaScript files.
|
||||
Those files are used as input to generate these typings.
|
||||
|
||||
# How to run tests
|
||||
|
||||
As of 1.6.2018.
|
||||
|
||||
1) Install typescript globally: `npm i -g typescript`
|
||||
2) Install React's dependencies: `cd ../react && npm i`
|
||||
3) Run tests: `cd ../recharts && tsc`
|
||||
Vendored
+25
-7
@@ -6,6 +6,7 @@
|
||||
// Zheyang Song <https://github.com/ZheyangSong>
|
||||
// Rich Baird <https://github.com/richbai90>
|
||||
// Dan Torberg <https://github.com/caspeco-dan>
|
||||
// Peter Keuter <https://github.com/pkeuter>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
@@ -163,7 +164,7 @@ export interface AreaProps extends EventAttributes, Partial<PresentationAttribut
|
||||
connectNulls?: boolean;
|
||||
activeDot?: boolean | object | React.ReactElement<any> | ContentRenderer<any>;
|
||||
dot?: boolean | object | React.ReactElement<any> | ContentRenderer<DotProps>;
|
||||
label?: boolean | object | React.ReactElement<any> | LabelProps['content'];
|
||||
label?: boolean | object | ContentRenderer<any> | React.ReactElement<any>;
|
||||
hide?: boolean;
|
||||
layout?: LayoutType;
|
||||
baseLine?: number | any[];
|
||||
@@ -207,7 +208,7 @@ export interface BarProps extends EventAttributes, Partial<PresentationAttribute
|
||||
shape?: React.ReactElement<any> | ContentRenderer<RectangleProps>;
|
||||
data?: BarData[];
|
||||
// see label section at http://recharts.org/#/en-US/api/Bar
|
||||
label?: boolean | Label | React.SFC<LabelProps> | React.ReactElement<LabelProps> | ContentRenderer<Label>;
|
||||
label?: boolean | Label | React.SFC<LabelProps> | React.ReactElement<LabelProps> | ContentRenderer<any>;
|
||||
}
|
||||
|
||||
export class Bar extends React.Component<BarProps> { }
|
||||
@@ -404,7 +405,7 @@ export interface LineProps extends EventAttributes, Partial<PresentationAttribut
|
||||
width?: number;
|
||||
height?: number;
|
||||
dataKey: DataKey; // As the source code states, dataKey will replace valueKey in 1.1.0 and it'll be required (it's already required in current implementation).
|
||||
label?: boolean | object | React.ReactElement<any> | LabelProps['content'];
|
||||
label?: boolean | object | React.ReactElement<any> | ContentRenderer<any>;
|
||||
points?: Point[];
|
||||
}
|
||||
|
||||
@@ -437,8 +438,8 @@ export interface PieProps extends EventAttributes, Partial<PresentationAttribute
|
||||
labelLine?: object | ContentRenderer<LineProps & any> | React.ReactElement<any> | boolean;
|
||||
label?: {
|
||||
offsetRadius: number;
|
||||
} | LabelProps['content'] | React.ReactElement<any> | boolean;
|
||||
activeShape?: object |ContentRenderer<any> | React.ReactElement<any>;
|
||||
} | React.ReactElement<any> | ContentRenderer<any> | boolean;
|
||||
activeShape?: object | ContentRenderer<any> | React.ReactElement<any>;
|
||||
activeIndex?: number | number[];
|
||||
}
|
||||
|
||||
@@ -552,7 +553,7 @@ export interface RadarProps extends EventAttributes, Partial<PresentationAttribu
|
||||
shape?: React.ReactElement<any> | ContentRenderer<RadarProps>;
|
||||
activeDot?: object | React.ReactElement<any> | ContentRenderer<any> | boolean;
|
||||
dot?: object | React.ReactElement<any> | ContentRenderer<DotProps> | boolean;
|
||||
label?: object | React.ReactElement<any> | LabelProps['content'] | boolean;
|
||||
label?: object | React.ReactElement<any> | ContentRenderer<any> | boolean;
|
||||
legendType?: LegendType;
|
||||
hide?: boolean;
|
||||
}
|
||||
@@ -591,7 +592,7 @@ export interface RadialBarProps extends EventAttributes, Partial<PresentationAtt
|
||||
maxBarSize?: number;
|
||||
data?: RadialBarData[];
|
||||
legendType?: LegendType;
|
||||
label?: boolean | React.ReactElement<any> | LabelProps['content'] | object;
|
||||
label?: boolean | React.ReactElement<any> | ContentRenderer<any> | object;
|
||||
background?: boolean | React.ReactElement<any> | ContentRenderer<any> | object;
|
||||
hide?: boolean;
|
||||
}
|
||||
@@ -838,7 +839,24 @@ export interface LabelProps {
|
||||
position?: PositionType;
|
||||
children?: React.ReactNode[] | React.ReactNode;
|
||||
className?: string;
|
||||
content?: React.ReactElement<any> | ContentRenderer<any>;
|
||||
}
|
||||
|
||||
export class LabelList extends React.Component<LabelListProps> { }
|
||||
|
||||
export interface LabelListProps {
|
||||
angle?: number;
|
||||
children?: React.ReactNode[] | React.ReactNode;
|
||||
className?: string;
|
||||
clockWise?: boolean;
|
||||
content?: React.ReactElement<any> | ContentRenderer<Label>;
|
||||
data?: number;
|
||||
dataKey: string | number | RechartsFunction;
|
||||
formatter?: LabelFormatter;
|
||||
id?: string;
|
||||
offset?: number;
|
||||
position?: PositionType;
|
||||
valueAccessor?: RechartsFunction;
|
||||
}
|
||||
|
||||
export type AxisDomain = string | number | ContentRenderer<any> | 'auto' | 'dataMin' | 'dataMax';
|
||||
|
||||
@@ -4,8 +4,8 @@ import * as ReactDOM from 'react-dom';
|
||||
import {
|
||||
CartesianGrid, Line, LineChart, PieChart, Pie,
|
||||
Sector, XAxis, YAxis, Tooltip, ReferenceLine,
|
||||
ReferenceArea, ResponsiveContainer, Label, Brush,
|
||||
ScatterChart, ZAxis, Legend, Scatter
|
||||
ReferenceArea, ResponsiveContainer, Label, LabelList, Brush,
|
||||
ScatterChart, ZAxis, Legend, Scatter, Bar, BarChart
|
||||
} from 'recharts';
|
||||
|
||||
interface ComponentState {
|
||||
@@ -160,6 +160,7 @@ class Component extends React.Component<{}, ComponentState> {
|
||||
<ResponsiveContainer>
|
||||
<PieChart width={800} height={400}>
|
||||
<Pie
|
||||
label={(props: {name: string}) => <Label>{name}</Label>}
|
||||
dataKey="value"
|
||||
activeIndex={this.state.activeIndex}
|
||||
activeShape={renderActiveShape}
|
||||
@@ -184,6 +185,26 @@ class Component extends React.Component<{}, ComponentState> {
|
||||
<Scatter name="A school" data={data} fill="#8884d8" />
|
||||
</ScatterChart>
|
||||
</ResponsiveContainer>
|
||||
<ResponsiveContainer>
|
||||
<BarChart
|
||||
width={730}
|
||||
height={250}
|
||||
data={data}
|
||||
margin={{ top: 15, right: 30, left: 20, bottom: 5 }}
|
||||
>
|
||||
<CartesianGrid strokeDasharray="3 3" />
|
||||
<XAxis dataKey="name">
|
||||
<Label value="Pages of my website" offset={0} position="insideBottom" />
|
||||
</XAxis>
|
||||
<YAxis label='pv of page' />
|
||||
<Bar dataKey="pv" fill="#8884d8">
|
||||
<LabelList dataKey="name" position="insideTop" angle={45} />
|
||||
</Bar>
|
||||
<Bar dataKey="uv" fill="#82ca9d">
|
||||
<LabelList dataKey="uv" position="top" />
|
||||
</Bar>
|
||||
</BarChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
+4
-4
@@ -9,10 +9,10 @@ import request = require('request');
|
||||
import http = require('http');
|
||||
|
||||
declare namespace requestPromise {
|
||||
interface RequestPromise extends request.Request {
|
||||
then: Promise<any>["then"];
|
||||
catch: Promise<any>["catch"];
|
||||
promise(): Promise<any>;
|
||||
interface RequestPromise<T = any> extends request.Request {
|
||||
then: Promise<T>["then"];
|
||||
catch: Promise<T>["catch"];
|
||||
promise(): Promise<T>;
|
||||
}
|
||||
|
||||
interface RequestPromiseOptions extends request.CoreOptions {
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ export interface Schema extends BaseSchema {
|
||||
readOnly?: boolean;
|
||||
xml?: XML;
|
||||
externalDocs?: ExternalDocs;
|
||||
example?: {[exampleName: string]: {}};
|
||||
example?: any;
|
||||
required?: string[];
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -7,7 +7,7 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
import * as http from 'http';
|
||||
import * as net from 'net';
|
||||
|
||||
export = WebpackHotClient;
|
||||
|
||||
@@ -44,7 +44,7 @@ declare namespace WebpackHotClient {
|
||||
/** Reload the page if a patch cannot be applied by webpack */
|
||||
reload?: boolean;
|
||||
/** Server instance for webpack-hot-client to connect to */
|
||||
server?: http.Server;
|
||||
server?: net.Server;
|
||||
/** Webpack stats configuration */
|
||||
stats?: webpack.Options.Stats;
|
||||
}
|
||||
|
||||
Vendored
+68
@@ -0,0 +1,68 @@
|
||||
// Type definitions for yauzl-promise 2.1
|
||||
// Project: https://github.com/overlookmotel/yauzl-promise
|
||||
// Definitions by: Dave Lee <https://github.com/dlee-nvisia>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Entry as BaseEntry, Options, ZipFileOptions, RandomAccessReader } from 'yauzl';
|
||||
import { Readable } from 'stream';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
// This class is not directly compatible with @types/yauzl 's ZipFile as this library changes the function signatures
|
||||
// Therefore, it is replaced, albeit with a significant portion
|
||||
export class ZipFile extends EventEmitter {
|
||||
// This chunk taken directly from @types/yauzl
|
||||
autoClose: boolean;
|
||||
comment: string;
|
||||
decodeStrings: boolean;
|
||||
emittedError: boolean;
|
||||
entriesRead: number;
|
||||
entryCount: number;
|
||||
fileSize: number;
|
||||
isOpen: boolean;
|
||||
lazyEntries: boolean;
|
||||
readEntryCursor: boolean;
|
||||
validateEntrySizes: boolean;
|
||||
|
||||
constructor(
|
||||
reader: RandomAccessReader,
|
||||
centralDirectoryOffset: number,
|
||||
fileSize: number,
|
||||
entryCount: number,
|
||||
comment: string,
|
||||
autoClose: boolean,
|
||||
lazyEntries: boolean,
|
||||
decodeStrings: boolean,
|
||||
validateEntrySizes: boolean,
|
||||
);
|
||||
|
||||
// These funcitons are custom to yauzl-promise
|
||||
|
||||
close(): Promise<void>;
|
||||
readEntry(): Promise<Entry>;
|
||||
readEntries(numEntries?: number): Promise<Entry[]>;
|
||||
walkEntries(callback: (entry: Entry) => Promise<void> | void, numEntries?: number): Promise<void>;
|
||||
openReadStream(entry: Entry, options?: ZipFileOptions): Promise<Readable>;
|
||||
}
|
||||
|
||||
export class Entry extends BaseEntry {
|
||||
openReadStream(options?: ZipFileOptions): Promise<Readable>;
|
||||
}
|
||||
|
||||
export function open(path: string, options?: Options): Promise<ZipFile>;
|
||||
// export function open(path: string): Promise<ZipFile>;
|
||||
export function fromFd(fd: number, options?: Options): Promise<ZipFile>;
|
||||
// export function fromFd(fd: number): Promise<ZipFile>;
|
||||
export function fromBuffer(buffer: Buffer, options?: Options): Promise<ZipFile>;
|
||||
// export function fromBuffer(buffer: Buffer): Promise<ZipFile>;
|
||||
export function fromRandomAccessReader(reader: RandomAccessReader, totalSize: number, options?: Options): Promise<ZipFile>;
|
||||
// export function fromRandomAccessReader(reader: RandomAccessReader, totalSize: number): Promise<ZipFile>;
|
||||
|
||||
// These are copied directly from @types/yauzl, I beleive they are unmodified
|
||||
export function dosDateTimeToDate(date: number, time: number): Date;
|
||||
export function validateFileName(fileName: string): string | null;
|
||||
|
||||
export { RandomAccessReader, Options, ZipFileOptions };
|
||||
@@ -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",
|
||||
"yauzl-promise-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,49 @@
|
||||
import * as yauzl from 'yauzl-promise';
|
||||
|
||||
class FakeRaR extends yauzl.RandomAccessReader {}
|
||||
|
||||
const options: yauzl.Options = {
|
||||
autoClose: true
|
||||
};
|
||||
|
||||
const zipOptions: yauzl.ZipFileOptions = {
|
||||
decrypt: true,
|
||||
decompress: true,
|
||||
start: 0,
|
||||
end: 1
|
||||
};
|
||||
|
||||
const date = yauzl.dosDateTimeToDate(1, 1);
|
||||
const fn = yauzl.validateFileName("fake");
|
||||
|
||||
async function test() {
|
||||
const zip = await yauzl.open("");
|
||||
const open2 = await yauzl.open("", options);
|
||||
|
||||
const fd1 = await yauzl.fromFd(0);
|
||||
const fd2 = await yauzl.fromFd(0, options);
|
||||
|
||||
const buffer1 = await yauzl.fromBuffer(Buffer.from("test", "utf-8"));
|
||||
const buffer2 = await yauzl.fromBuffer(Buffer.from("test", "utf-8"), options);
|
||||
|
||||
const rar1 = await yauzl.fromRandomAccessReader(new FakeRaR(), 1);
|
||||
const rar2 = await yauzl.fromRandomAccessReader(new FakeRaR(), 1, options);
|
||||
|
||||
const entry = await zip.readEntry();
|
||||
await zip.readEntries();
|
||||
await zip.readEntries(1);
|
||||
|
||||
const rs = await zip.openReadStream(entry);
|
||||
await zip.openReadStream(entry, zipOptions);
|
||||
|
||||
await entry.openReadStream();
|
||||
await entry.openReadStream(zipOptions);
|
||||
|
||||
await zip.walkEntries(async (entry: yauzl.Entry) => {
|
||||
console.log("foo");
|
||||
});
|
||||
|
||||
await zip.walkEntries(async (entry: yauzl.Entry) => {
|
||||
console.log("foo");
|
||||
}, 1);
|
||||
}
|
||||
Vendored
+2
-2
@@ -37,8 +37,8 @@ export interface Schema<T> {
|
||||
meta(): any;
|
||||
describe(): SchemaDescription;
|
||||
concat(schema: this): this;
|
||||
validate(value: T, options?: ValidateOptions): Promise<ValidationError | T>;
|
||||
validateSync(value: T, options?: ValidateOptions): ValidationError | T;
|
||||
validate(value: T, options?: ValidateOptions): Promise<T>;
|
||||
validateSync(value: T, options?: ValidateOptions): T;
|
||||
isValid(value: T, options?: any): Promise<boolean>;
|
||||
isValidSync(value: T, options?: any): boolean;
|
||||
cast(value: any, options?: any): T;
|
||||
|
||||
@@ -307,7 +307,7 @@ const testObject: MyInterface = {
|
||||
arrayField: ["hi"],
|
||||
};
|
||||
|
||||
typedSchema.validateSync(testObject); // $ExpectType ValidationError | MyInterface
|
||||
typedSchema.validateSync(testObject); // $ExpectType MyInterface
|
||||
|
||||
// $ExpectError
|
||||
yup.object<MyInterface>({
|
||||
|
||||
Reference in New Issue
Block a user