Merge branch 'master' into react-instantsearch-core

This commit is contained in:
Gordon
2019-02-24 12:25:04 -06:00
251 changed files with 5066 additions and 6000 deletions
+24
View File
@@ -396,6 +396,12 @@
"sourceRepoURL": "https://github.com/date-fns/date-fns",
"asOfVersion": "2.6.0"
},
{
"libraryName": "dd-trace",
"typingsPackageName": "dd-trace",
"sourceRepoURL": "https://github.com/DataDog/dd-trace-js",
"asOfVersion": "0.9.0"
},
{
"libraryName": "decimal.js",
"typingsPackageName": "decimal.js",
@@ -414,6 +420,12 @@
"sourceRepoURL": "https://github.com/sindresorhus/delay",
"asOfVersion": "3.1.0"
},
{
"libraryName": "detect-browser",
"typingsPackageName": "detect-browser",
"sourceRepoURL": "https://github.com/DamonOehlman/detect-browser",
"asOfVersion": "4.0.0"
},
{
"libraryName": "DevExtreme",
"typingsPackageName": "devextreme",
@@ -726,6 +738,12 @@
"sourceRepoURL": "https://github.com/prettymuchbryce/node-http-status",
"asOfVersion": "1.2.0"
},
{
"libraryName": "i18next-browser-languagedetector",
"typingsPackageName": "i18next-browser-languagedetector",
"sourceRepoURL": "https://github.com/i18next/i18next-browser-languagedetector",
"asOfVersion": "3.0.0"
},
{
"libraryName": "i18next-xhr-backend",
"typingsPackageName": "i18next-xhr-backend",
@@ -1116,6 +1134,12 @@
"sourceRepoURL": "http://onsen.io",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-throttle",
"typingsPackageName": "p-throttle",
"sourceRepoURL": "https://github.com/sindresorhus/p-throttle",
"asOfVersion": "2.0.0"
},
{
"libraryName": "param-case",
"typingsPackageName": "param-case",
+1 -1
View File
@@ -21,7 +21,7 @@
"lint": "dtslint types"
},
"devDependencies": {
"dtslint": "github:Microsoft/dtslint#production",
"dtslint": "latest",
"types-publisher": "github:Microsoft/types-publisher#production"
},
"dependencies": {}
@@ -97,6 +97,7 @@ let _algoliaIndexSettings: IndexSettings = {
minProximity: 0,
placeholders: { '': [''] },
camelCaseAttributes: [''],
sortFacetValuesBy: 'count',
};
let _algoliaQueryParameters: QueryParameters = {
@@ -150,6 +151,7 @@ let _algoliaQueryParameters: QueryParameters = {
synonyms: true,
replaceSynonymsInHighlight: false,
minProximity: 0,
sortFacetValuesBy: 'alpha',
};
let client: Client = algoliasearch('', '');
+19 -11
View File
@@ -5,6 +5,7 @@
// Aurélien Hervé <https://github.com/aherve>
// Samuel Vaillant <https://github.com/samouss>
// Kai Eichinger <https://github.com/keichinger>
// Nery Ortez <https://github.com/neryortez>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -24,25 +25,25 @@ declare namespace algoliasearch {
* Query on multiple index
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
*/
search(
search<T=any>(
queries: {
indexName: string;
query: string;
params: QueryParameters;
}[],
cb: (err: Error, res: MultiResponse) => void
cb: (err: Error, res: MultiResponse<T>) => void
): void;
/**
* Query on multiple index
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
*/
search(
search<T=any>(
queries: {
indexName: string;
query: string;
params: QueryParameters;
}[]
): Promise<MultiResponse>;
): Promise<MultiResponse<T>>;
/**
* Query for facet values of a specific facet
*/
@@ -590,14 +591,14 @@ declare namespace algoliasearch {
* Search in an index
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
*/
search(params: QueryParameters): Promise<Response>;
search<T=any>(params: QueryParameters): Promise<Response<T>>;
/**
* Search in an index
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
*/
search(
search<T=any>(
params: QueryParameters,
cb: (err: Error, res: Response) => void
cb: (err: Error, res: Response<T>) => void
): void;
/**
* Search in an index
@@ -1451,6 +1452,11 @@ declare namespace algoliasearch {
nbShards?: number;
userData?: string | object;
/**
* https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/
*/
sortFacetValuesBy?: 'count' | 'alpha';
}
namespace SearchForFacetValues {
@@ -1776,14 +1782,16 @@ declare namespace algoliasearch {
https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/
*/
camelCaseAttributes?: string[];
sortFacetValuesBy?: 'count' | 'alpha';
}
interface Response {
interface Response<T=any> {
/**
* Contains all the hits matching the query
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
*/
hits: any[];
hits: T[];
/**
* Current page
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
@@ -1842,8 +1850,8 @@ declare namespace algoliasearch {
cursor?: string;
}
interface MultiResponse {
results: Response[];
interface MultiResponse<T=any> {
results: Response<T>[];
}
}
+17 -11
View File
@@ -6,6 +6,7 @@
// Samuel Vaillant <https://github.com/samouss>
// Claas Brüggemann <https://github.com/ClaasBrueggemann>
// Kai Eichinger <https://github.com/keichinger>
// Nery Ortez <https://github.com/neryortez>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -25,25 +26,25 @@ declare namespace algoliasearch {
* Query on multiple index
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
*/
search(
search<T=any>(
queries: {
indexName: string;
query: string;
params: QueryParameters;
}[],
cb: (err: Error, res: MultiResponse) => void
cb: (err: Error, res: MultiResponse<T>) => void
): void;
/**
* Query on multiple index
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
*/
search(
search<T=any>(
queries: {
indexName: string;
query: string;
params: QueryParameters;
}[]
): Promise<MultiResponse>;
): Promise<MultiResponse<T>>;
/**
* Query for facet values of a specific facet
*/
@@ -109,15 +110,15 @@ declare namespace algoliasearch {
* Search in an index
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
*/
search(
search<T=any>(
params: QueryParameters,
cb: (err: Error, res: Response) => void
cb: (err: Error, res: Response<T>) => void
): void;
/**
* Search in an index
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
*/
search(params: QueryParameters): Promise<Response>;
search<T=any>(params: QueryParameters): Promise<Response<T>>;
/**
* Search in an index
* https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/
@@ -531,6 +532,11 @@ declare namespace algoliasearch {
nbShards?: number;
userData?: string | object;
/**
* https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/
*/
sortFacetValuesBy?: 'count' | 'alpha';
}
namespace SearchForFacetValues {
@@ -552,12 +558,12 @@ declare namespace algoliasearch {
}
}
interface Response {
interface Response<T=any> {
/**
* Contains all the hits matching the query
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
*/
hits: any[];
hits: T[];
/**
* Current page
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
@@ -616,8 +622,8 @@ declare namespace algoliasearch {
cursor?: string;
}
interface MultiResponse {
results: Response[];
interface MultiResponse<T=any> {
results: Response<T>[];
}
}
+1 -1
View File
@@ -346,7 +346,7 @@ declare module 'angular' {
interface IMenuService {
close(): void;
hide(response?: any, options?: any): IPromise<any>;
open(event?: MouseEvent): void;
open(event?: MouseEvent | JQueryEventObject): void;
}
interface IColorPalette {
+30 -1
View File
@@ -1,6 +1,12 @@
// near copy of each of the tests from https://github.com/nodeca/argparse/tree/master/examples
import { ArgumentParser, RawDescriptionHelpFormatter } from 'argparse';
import {
ArgumentParser,
RawDescriptionHelpFormatter,
Action,
ActionConstructorOptions,
Namespace,
} from 'argparse';
let args: any;
const simpleExample = new ArgumentParser({
@@ -276,3 +282,26 @@ group.addArgument(['--bar'], {
help: 'bar help'
});
formatterExample.printHelp();
class CustomAction1 extends Action {
constructor(options: ActionConstructorOptions) {
super(options);
}
call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null) {
console.log('custom action 1');
}
}
class CustomAction2 extends Action {
call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null) {
console.log('custom action 2');
}
}
const customActionExample = new ArgumentParser({ addHelp: false });
customActionExample.addArgument('--abc', {
action: CustomAction1,
});
customActionExample.addArgument('--def', {
action: CustomAction2,
});
+13 -1
View File
@@ -3,6 +3,7 @@
// Definitions by: Andrew Schurman <https://github.com/arcticwaters>
// Tomasz Łaziuk <https://github.com/tlaziuk>
// Sebastian Silbermann <https://github.com/eps1lon>
// Kannan Goundan <https://github.com/cakoose>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -79,13 +80,24 @@ export interface ArgumentGroupOptions {
description?: string;
}
export abstract class Action {
protected dest: string;
constructor(options: ActionConstructorOptions);
abstract call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null): void;
}
// Passed to the Action constructor. Subclasses are just expected to relay this to
// the super() constructor, so using an "opaque type" pattern is probably fine.
// Someone may want to fill this out in the future.
export type ActionConstructorOptions = number & {_: 'ActionConstructorOptions'};
export class HelpFormatter { }
export class ArgumentDefaultsHelpFormatter { }
export class RawDescriptionHelpFormatter { }
export class RawTextHelpFormatter { }
export interface ArgumentOptions {
action?: string;
action?: string | { new(options: ActionConstructorOptions): Action };
optionStrings?: string[];
dest?: string;
nargs?: string | number;
+1 -1
View File
@@ -21,4 +21,4 @@
"index.d.ts",
"argparse-tests.ts"
]
}
}
+56
View File
@@ -39,3 +39,59 @@ babel.transformFromAstAsync(parsedAst!, sourceCode, options).then(transformFromA
const { code, map, ast } = transformFromAstAsyncResult!;
const { body } = ast!.program;
});
function checkOptions(_options: babel.TransformOptions) {}
function checkConfigFunction(_config: babel.ConfigFunction) {}
checkOptions({ envName: 'banana' });
// babel uses object destructuring default to provide the envName fallback so null is not allowed
// $ExpectError
checkOptions({ envName: null });
checkOptions({ caller: { name: '@babel/register' } });
checkOptions({ caller: { name: 'babel-jest', supportsStaticESM: false } });
// don't add an index signature; users should augment the interface instead if they need to
// $ExpectError
checkOptions({ caller: { name: '', tomato: true } });
checkOptions({ rootMode: 'upward-optional' });
// $ExpectError
checkOptions({ rootMode: 'potato' });
// $ExpectError
checkConfigFunction(() => {});
// you technically can do that though you probably shouldn't
checkConfigFunction(() => ({}));
checkConfigFunction(api => {
api.assertVersion(7);
api.assertVersion("^7.2");
api.cache.forever();
api.cache.never();
api.cache.using(() => true);
api.cache.using(() => 1);
api.cache.using(() => '1');
api.cache.using(() => null);
api.cache.using(() => undefined);
// $ExpectError
api.cache.using(() => ({}));
api.cache.invalidate(() => 2);
// $ExpectType string
api.env();
api.env('development');
api.env(['production', 'test']);
// $ExpectType 42
api.env(name => 42);
// $ExpectType string
api.version;
return {
shouldPrintComment(comment) {
// $ExpectType string
comment;
return true;
}
};
});
+153 -2
View File
@@ -1,8 +1,9 @@
// Type definitions for @babel/core 7.0
// Type definitions for @babel/core 7.1
// Project: https://github.com/babel/babel/tree/master/packages/babel-core, https://babeljs.io
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Melvin Groenhoff <https://github.com/mgroenhoff>
// Jessica Franco <https://github.com/Jessidhia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
@@ -54,6 +55,15 @@ export interface TransformOptions {
*/
root?: string | null;
/**
* This option, combined with the "root" value, defines how Babel chooses its project root.
* The different modes define different ways that Babel can process the "root" value to get
* the final project root.
*
* @see https://babeljs.io/docs/en/next/options#rootmode
*/
rootMode?: 'root' | 'upward' | 'upward-optional';
/**
* The config file to load Babel's config from. Defaults to searching for "babel.config.js" inside the "root" folder. `false` will disable searching for config files.
*
@@ -82,7 +92,7 @@ export interface TransformOptions {
*
* Default: env vars
*/
envName?: string | null;
envName?: string;
/**
* Enable code generation
@@ -112,6 +122,14 @@ export interface TransformOptions {
*/
cwd?: string | null;
/**
* Utilities may pass a caller object to identify themselves to Babel and
* pass capability-related flags for use by configs, presets and plugins.
*
* @see https://babeljs.io/docs/en/next/options#caller
*/
caller?: TransformCaller;
/**
* This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { \/* specific options *\/ } } }`
* which will use those options when the `envName` is `production`
@@ -284,6 +302,14 @@ export interface TransformOptions {
wrapPluginVisitorMethod?: ((pluginAlias: string, visitorType: "enter" | "exit", callback: (path: NodePath, state: any) => void) => (path: NodePath, state: any) => void) | null;
}
export interface TransformCaller {
// the only required property
name: string;
// e.g. set to true by `babel-loader` and false by `babel-jest`
supportsStaticESM?: boolean;
// augment this with a "declare module '@babel/core' { ... }" if you need more keys
}
export type FileResultCallback = (err: Error | null, result: BabelFileResult | null) => any;
/**
@@ -528,4 +554,129 @@ export interface CreateConfigItemOptions {
*/
export function createConfigItem(value: PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined], options?: CreateConfigItemOptions): ConfigItem;
// NOTE: the documentation says the ConfigAPI also exposes @babel/core's exports, but it actually doesn't
/**
* @see https://babeljs.io/docs/en/next/config-files#config-function-api
*/
export interface ConfigAPI {
/**
* The version string for the Babel version that is loading the config file.
*
* @see https://babeljs.io/docs/en/next/config-files#apiversion
*/
version: string;
/**
* @see https://babeljs.io/docs/en/next/config-files#apicache
*/
cache: SimpleCacheConfigurator;
/**
* @see https://babeljs.io/docs/en/next/config-files#apienv
*/
env: EnvFunction;
// undocumented; currently hardcoded to return 'false'
// async(): boolean
/**
* This API is used as a way to access the `caller` data that has been passed to Babel.
* Since many instances of Babel may be running in the same process with different `caller` values,
* this API is designed to automatically configure `api.cache`, the same way `api.env()` does.
*
* The `caller` value is available as the first parameter of the callback function.
* It is best used with something like this to toggle configuration behavior
* based on a specific environment:
*
* @example
* function isBabelRegister(caller?: { name: string }) {
* return !!(caller && caller.name === "@babel/register")
* }
* api.caller(isBabelRegister)
*
* @see https://babeljs.io/docs/en/next/config-files#apicallercb
*/
caller<T extends SimpleCacheKey>(callerCallback: (caller: TransformOptions['caller']) => T): T;
/**
* While `api.version` can be useful in general, it's sometimes nice to just declare your version.
* This API exposes a simple way to do that with:
*
* @example
* api.assertVersion(7) // major version only
* api.assertVersion("^7.2")
*
* @see https://babeljs.io/docs/en/next/config-files#apiassertversionrange
*/
assertVersion(versionRange: number | string): boolean;
// NOTE: this is an undocumented reexport from "@babel/parser" but it's missing from its types
// tokTypes: typeof tokTypes
}
/**
* JS configs are great because they can compute a config on the fly,
* but the downside there is that it makes caching harder.
* Babel wants to avoid re-executing the config function every time a file is compiled,
* because then it would also need to re-execute any plugin and preset functions
* referenced in that config.
*
* To avoid this, Babel expects users of config functions to tell it how to manage caching
* within a config file.
*
* @see https://babeljs.io/docs/en/next/config-files#apicache
*/
export interface SimpleCacheConfigurator {
// there is an undocumented call signature that is a shorthand for forever()/never()/using().
// (ever: boolean): void
// <T extends SimpleCacheKey>(callback: CacheCallback<T>): T
/**
* Permacache the computed config and never call the function again.
*/
forever(): void;
/**
* Do not cache this config, and re-execute the function every time.
*/
never(): void;
/**
* Any time the using callback returns a value other than the one that was expected,
* the overall config function will be called again and a new entry will be added to the cache.
*
* @example
* api.cache.using(() => process.env.NODE_ENV)
*/
using<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
/**
* Any time the using callback returns a value other than the one that was expected,
* the overall config function will be called again and all entries in the cache will
* be replaced with the result.
*
* @example
* api.cache.invalidate(() => process.env.NODE_ENV)
*/
invalidate<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
}
// https://github.com/babel/babel/blob/v7.3.3/packages/babel-core/src/config/caching.js#L231
export type SimpleCacheKey = string | boolean | number | null | undefined;
export type SimpleCacheCallback<T extends SimpleCacheKey> = () => T;
/**
* Since `NODE_ENV` is a fairly common way to toggle behavior, Babel also includes an API function
* meant specifically for that. This API is used as a quick way to check the `"envName"` that Babel
* was loaded with, which takes `NODE_ENV` into account if no other overriding environment is set.
*
* @see https://babeljs.io/docs/en/next/config-files#apienv
*/
export interface EnvFunction {
/**
* @returns the current `envName` string
*/
(): string;
/**
* @returns `true` if the `envName` is `===` any of the given strings
*/
(envName: string | ReadonlyArray<string>): boolean;
// the official documentation is misleading for this one...
// this just passes the callback to `cache.using` but with an additional argument.
// it returns its result instead of necessarily returning a boolean.
<T extends SimpleCacheKey>(envCallback: (envName: NonNullable<TransformOptions['envName']>) => T): T;
}
export type ConfigFunction = (api: ConfigAPI) => TransformOptions;
export as namespace babel;
+1 -1
View File
@@ -4287,7 +4287,7 @@ declare namespace swan {
Methods,
Props
> = object &
ComponentOptions<V, Data | ((this: V) => Data), Methods, Props> &
ComponentOptions<V, Data, Methods, Props> &
ThisType<CombinedInstance<V, Data, Methods, Readonly<Props>>>;
interface ComponentRelation<D = any, P = any> {
+23
View File
@@ -0,0 +1,23 @@
import * as bitTwiddle from "bit-twiddle";
bitTwiddle.INT_BITS;
bitTwiddle.INT_MAX;
bitTwiddle.INT_MIN;
bitTwiddle.sign(5);
bitTwiddle.abs(-5);
bitTwiddle.min(1, 6);
bitTwiddle.max(6, 1);
bitTwiddle.isPow2(3);
bitTwiddle.log2(3);
bitTwiddle.log10(3);
bitTwiddle.popCount(4);
bitTwiddle.countTrailingZeros(3.0000003);
bitTwiddle.nextPow2(31.315);
bitTwiddle.prevPow2(31.315);
bitTwiddle.parity(123);
bitTwiddle.interleave2(12, 24);
bitTwiddle.deinterleave2(24, 12);
bitTwiddle.interleave3(24, 12, 6);
bitTwiddle.deinterleave3(24, 12);
bitTwiddle.nextCombination(41.935);
+101
View File
@@ -0,0 +1,101 @@
// Type definitions for bit-twiddle 1.0
// Project: https://github.com/mikolalysenko/bit-twiddle
// Definitions by: Adam Zerella <https://github.com/adamzerella>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.3
export const INT_BITS: number;
export const INT_MAX: number;
export const INT_MIN: number;
/**
* Computes the sign of the integer.
*/
export function sign(value: number): number;
/**
* Returns the absolute value of the integer.
*/
export function abs(value: number): number;
/**
* Computes the minimum of integers x and y.
*/
export function min(x: number, y: number): number;
/**
* Computes the maximum of integers x and y.
*/
export function max(x: number, y: number): number;
/**
* Returns true if value is a power of 2, otherwise false.
*/
export function isPow2(value: number): boolean;
/**
* Returns an integer approximation of the log-base 2 of value.
*/
export function log2(value: number): number;
/**
* Returns an integer approximation of the log-base 10 of value.
*/
export function log10(value: number): number;
/**
* Counts the number of bits set in value.
*/
export function popCount(value: number): number;
/**
* Counts the number of trailing zeros.
*/
export function countTrailingZeros(value: number): number;
/**
* Rounds value up to the next power of 2.
*/
export function nextPow2(value: number): number;
/**
* Rounds value down to the previous power of 2.
*/
export function prevPow2(value: number): number;
/**
* Computes the parity of the bits in value.
*/
export function parity(value: number): number;
/**
* Reverses the bits of value.
*/
export function reverse(value: number): number;
/**
* Interleaves a pair of 16 bit integers. Useful for fast quadtree style indexing.
* @see http://en.wikipedia.org/wiki/Z-order_curve
*/
export function interleave2(x: number, y: number): number;
/**
* Deinterleaves the bits of value, returns the nth part.
* If both x and y are 16 bit.
*/
export function deinterleave2(x: number, y: number): number;
/**
* Interleaves a triple of 10 bit integers. Useful for fast octree indexing.
*/
export function interleave3(x: number, y: number, z: number): number;
/**
* Same deal as deinterleave2, only for triples instead of pairs.
*/
export function deinterleave3(x: number, y: number): number;
/**
* Returns next combination ordered colexicographically.
*/
export function nextCombination(x: number): number;
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [
],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bit-twiddle-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+2
View File
@@ -143,6 +143,8 @@ pdfQueue
.on('drained', () => undefined)
.on('removed', (job: Queue.Job) => undefined);
pdfQueue.setMaxListeners(42);
// test different process methods
const profileQueue = new Queue('profile');
+2 -1
View File
@@ -17,6 +17,7 @@
// TypeScript Version: 2.8
import * as Redis from "ioredis";
import { EventEmitter } from "events";
/**
* This is the Queue constructor.
@@ -384,7 +385,7 @@ declare namespace Bull {
next: number;
}
interface Queue<T = any> {
interface Queue<T = any> extends EventEmitter {
/**
* The name of the queue
*/
+35 -1
View File
@@ -1,4 +1,4 @@
import CamlBuilder from 'camljs'
var caml = new CamlBuilder().Where()
.Any(
@@ -53,3 +53,37 @@ caml = CamlBuilder.Expression()
.ToString();
caml = new CamlBuilder().Where().DateTimeField("Created").GreaterThan(new Date(Date.UTC(2013,0,1))).ToString();
// Aggregations and extended syntax of GroupBy
var query = new CamlBuilder()
.View(["Category", { count: "ID" }, { sum: "Amount" }])
.Query()
.GroupBy("Category", true, 100)
.ToString();
// ContentTypeId field
var query = new CamlBuilder()
.Where()
.TextField("Title").EqualTo("Document")
.And()
.ContentTypeIdField().BeginsWith("0x101")
.ToString();
// joins
var query = new CamlBuilder()
.View(["Title", "Country", "Population"])
.LeftJoin("Country", "Country").Select("y4r6", "Population")
.Query()
.Where()
.NumberField("Population").LessThan(10)
.ToString();
// RowLimit & Scope
var camlBuilder1 = new CamlBuilder()
.View(["ID", "Created"])
.RowLimit(20, true)
.Scope(CamlBuilder.ViewScope.RecursiveAll)
.Query()
.Where()
.TextField("Title").BeginsWith("A")
.ToString();
+60 -17
View File
@@ -1,8 +1,8 @@
// Type definitions for camljs
// Project: http://camljs.codeplex.com
// Definitions by: Andrey Markeev <http://markeev.com>
// Project: https://github.com/andrei-markeev/camljs
// Definitions by: Andrey Markeev <https://github.com/andrei-markeev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
declare class CamlBuilder {
constructor();
@@ -10,25 +10,43 @@ declare class CamlBuilder {
Where(): CamlBuilder.IFieldExpression;
/** Generate <View> tag for SP.CamlQuery
@param viewFields If omitted, default view fields are requested; otherwise, only values for the fields with the specified internal names are returned.
Specifying view fields is a good practice, as it decreases traffic between server and client. */
View(viewFields?: string[]): CamlBuilder.IView;
Specifying view fields is a good practice, as it decreases traffic between server and client.
Additionally you can specify aggregated fields, e.g. { count: "<field name>" }, { sum: "<field name>" }, etc.. */
View(viewFields?: CamlBuilder.ViewField[]): CamlBuilder.IView;
/** Generate <ViewFields> tag for SPServices */
ViewFields(viewFields: string[]): CamlBuilder.IFinalizableToString;
/** Use for:
1. SPServices CAMLQuery attribute
2. Creating partial expressions
3. In conjunction with Any & All clauses
*/
*/
static Expression(): CamlBuilder.IFieldExpression;
static FromXml(xml: string): CamlBuilder.IRawQuery;
}
declare namespace CamlBuilder {
interface IView extends IJoinable, IFinalizable {
declare module CamlBuilder {
type Aggregation = {
count: string;
} | {
sum: string;
} | {
avg: string;
} | {
max: string;
} | {
min: string;
} | {
stdev: string;
} | {
var: string;
};
type ViewField = string | Aggregation;
interface IView extends IFinalizable {
/** Define query */
Query(): IQuery;
/** Define maximum amount of returned records */
RowLimit(limit: number, paged?: boolean): IView;
/** Define view scope */
Scope(scope: ViewScope): IView;
}
interface IJoinable {
/** Join the list you're querying with another list.
Joins are only allowed through a lookup field relation.
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
@@ -40,22 +58,39 @@ declare namespace CamlBuilder {
@alias alias for the joined list */
LeftJoin(lookupFieldInternalName: string, alias: string): IJoin;
}
interface IJoinable {
/** Join the list you're querying with another list.
Joins are only allowed through a lookup field relation.
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
@param alias Alias for the joined list
@param fromList (optional) List where the lookup column resides - use it only for nested joins */
InnerJoin(lookupFieldInternalName: string, alias: string, fromList?: string): IJoin;
/** Join the list you're querying with another list.
Joins are only allowed through a lookup field relation.
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
@param alias Alias for the joined list
@param fromList (optional) List where the lookup column resides - use it only for nested joins */
LeftJoin(lookupFieldInternalName: string, alias: string, fromList?: string): IJoin;
}
interface IJoin extends IJoinable {
/** Select projected field for using in the main Query body
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
}
interface IProjectableView extends IView {
interface IProjectableView extends IJoinable {
/** Define query */
Query(): IQuery;
/** Define maximum amount of returned records */
RowLimit(limit: number, paged?: boolean): IView;
/** Define view scope */
Scope(scope: ViewScope): IView;
/** Select projected field for using in the main Query body
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
}
enum ViewScope {
/** */
Recursive = 0,
/** */
RecursiveAll = 1,
/** */
FilesOnly = 2,
}
interface IQuery extends IGroupable {
@@ -85,8 +120,9 @@ declare namespace CamlBuilder {
}
interface IGroupable extends ISortable {
/** Adds GroupBy clause to the query.
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. */
GroupBy(fieldInternalName: any): IGroupedQuery;
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved.
@param groupLimit Return only first N groups */
GroupBy(fieldInternalName: any, collapse?: boolean, groupLimit?: number): IGroupedQuery;
}
interface IExpression extends IGroupable {
/** Adds And clause to the query. */
@@ -113,6 +149,12 @@ declare namespace CamlBuilder {
Any(conditions: IExpression[]): IExpression;
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Text */
TextField(internalName: string): ITextFieldExpression;
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is ContentTypeId */
ContentTypeIdField(internalName?: string): ITextFieldExpression;
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Choice */
ChoiceField(internalName: string): ITextFieldExpression;
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Computed */
ComputedField(internalName: string): ITextFieldExpression;
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Boolean */
BooleanField(internalName: string): IBooleanFieldExpression;
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is URL */
@@ -360,7 +402,7 @@ declare namespace CamlBuilder {
Year = 4,
}
class Internal {
static createView(viewFields?: string[]): IView;
static createView(viewFields?: ViewField[]): IView;
static createViewFields(viewFields: string[]): IFinalizableToString;
static createWhere(): IFieldExpression;
static createExpression(): IFieldExpression;
@@ -401,3 +443,4 @@ declare namespace CamlBuilder {
};
}
}
export = CamlBuilder;
+2 -1
View File
@@ -14,7 +14,8 @@
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
+3
View File
@@ -18,6 +18,9 @@ const Memory: EnginePrototypeOrObject = {
const client = new Client<string>(Memory, { partition: 'cache' });
client.start().then(() => {});
client.stop().then(() => {});
const cache = new Policy({
expiresIn: 5000,
}, client, 'cache');
+1 -1
View File
@@ -23,7 +23,7 @@ export class Client<T> implements ClientApi<T> {
/** start() - creates a connection to the cache server. Must be called before any other method is available. */
start(): Promise<void>;
/** stop() - terminates the connection to the cache server. */
stop(): void;
stop(): Promise<void>;
/**
* get(key, callback) - retrieve an item from the cache engine if found where:
* * key - a cache key object (see [ICacheKey]).
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/producthunt/chai-enzyme
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.1
/// <reference types="enzyme" />
+1 -1
View File
@@ -5246,7 +5246,7 @@ declare namespace chrome.runtime {
export interface PortMessageEvent extends chrome.events.Event<(message: any, port: Port) => void> { }
export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response: any) => void) => void> { }
export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void> { }
export interface ExtensionConnectEvent extends chrome.events.Event<(port: Port) => void> { }
+30
View File
@@ -0,0 +1,30 @@
import co = require('co');
function* gen(num: number, str: string, arr: number[], obj: object, fun: () => void) {
return num;
}
co(gen, 42, 'forty-two', [42], { value: 42 }, () => {})
.then((num: number) => {}, (err: Error) => {})
.catch((err: Error) => {});
co.default(gen, 42, 'forty-two', [42], { value: 42 }, () => {})
.then((num: number) => {}, (err: Error) => {})
.catch((err: Error) => {});
co.co(gen, 42, 'forty-two', [42], { value: 42 }, () => {})
.then((num: number) => {}, (err: Error) => {})
.catch((err: Error) => {});
co.wrap(gen)(42, 'forty-two', [42], { value: 42 }, () => {})
.then((num: number) => {}, (err: Error) => {})
.catch((err: Error) => {});
// $ExpectError
co(gen, 42, 'forty-two', [42], { value: 42 }, () => {}).then((str: string) => {});
// $ExpectError
co.wrap(gen)();
// $ExpectError
co.wrap(gen)('forty-two');
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for co 4.6
// Project: https://github.com/tj/co#readme
// Definitions by: Doniyor Aliyev <https://github.com/doniyor2109>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.1
type ExtractType<T> = T extends IterableIterator<infer R> ? R : never;
interface Co {
<F extends (...args: any[]) => Generator>(fn: F, ...args: Parameters<F>): Promise<ExtractType<ReturnType<F>>>;
default: Co;
co: Co;
wrap: <F extends (...args: any[]) => Generator>(fn: F) => (...args: Parameters<F>) => Promise<ExtractType<ReturnType<F>>>;
}
declare const co: Co;
export = co;
@@ -18,6 +18,6 @@
},
"files": [
"index.d.ts",
"dd-trace-tests.ts"
"co-tests.ts"
]
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/commercetools/enzyme-extensions
// Definitions by: Christian Rackerseder <https://github.com/screendriver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.1
import * as enzyme from 'enzyme';
+1 -1
View File
@@ -1,5 +1,5 @@
// Type definitions for cordova-sqlite-storage 1.5
// Project: https://github.com/litehelpers/Cordova-sqlite-storage
// Project: https://github.com/xpbrew/cordova-sqlite-storage
// Definitions by: rafw87 <https://github.com/rafw87>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+22 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Cytoscape.js 3.2
// Type definitions for Cytoscape.js 3.3
// Project: http://js.cytoscape.org/
// Definitions by: Fabian Schmidt and Fred Eisele <https://github.com/phreed>
// Shenghan Gao <https://github.com/wy193777>
@@ -464,6 +464,27 @@ declare namespace cytoscape {
*/
endBatch(): void;
/**
* Attaches the instance to the specified container for visualisation.
* http://js.cytoscape.org/#cy.mount
*
* If the core instance is headless prior to calling cy.mount(), then
* the instance will no longer be headless and the visualisation will
* be shown in the specified container. If the core instance is
* non-headless prior to calling cy.mount(), then the visualisation
* is swapped from the prior container to the specified container.
*/
mount(element: Element): void;
/**
* Remove the instance from its current container.
* http://js.cytoscape.org/#cy.unmount
*
* This function sets the instance to be headless after unmounting from
* the current container.
*/
unmount(): void;
/**
* A convenience function to explicitly destroy the Core.
* http://js.cytoscape.org/#cy.destroy
+2 -1
View File
@@ -608,7 +608,8 @@ const testObject = {
};
const p1: Array<number | string | Date | number[]> = d3Array.permute(testObject, ['name', 'val', 'when', 'more']);
const p2: Array<Date | number[]> = d3Array.permute(testObject, ['when', 'more']);
// $ExpectType: Array<Date | number[]>
const p2 = d3Array.permute(testObject, ['when', 'more']);
// $ExpectError
const p3 = d3Array.permute(testObject, ['when', 'unknown']);
-56
View File
@@ -1,56 +0,0 @@
import * as tracer from "dd-trace";
import SpanContext = require("dd-trace/src/opentracing/span_context");
tracer.init({
enabled: true,
service: "MyLovelyService",
hostname: "localhost",
port: 8126,
env: "dev",
logger: {
debug: msg => {},
error: err => {},
}
});
function useWebFrameworkPlugin(plugin: "express" | "hapi" | "koa" | "restify") {
tracer.use(plugin, {
service: "incoming-request",
headers: ["User-Agent"],
validateStatus: code => code !== 418,
});
}
tracer.use("graphql", {
depth: 1,
// Can’t use spread operator here due to https://github.com/Microsoft/TypeScript/issues/10727
// tslint:disable-next-line:prefer-object-spread
variables: variables => Object.assign({}, variables, { password: "REDACTED" }),
});
tracer.use("http", {
splitByDomain: true,
});
tracer
.trace("web.request", {
service: "my_service",
childOf: new SpanContext({ traceId: 1337, spanId: 42 }), // childOf must be an instance of this type. See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99
tags: {
env: "dev",
},
})
.then(span => {
span.setTag("my_tag", "my_value");
span.finish();
});
const parentScope = tracer.scopeManager().active();
const span = tracer.startSpan("memcached", {
childOf: parentScope && parentScope.span(),
tags: {
"service.name": "my-memcached",
"resource.name": "get",
"span.type": "memcached",
},
});
-275
View File
@@ -1,275 +0,0 @@
// Type definitions for dd-trace-js 0.7
// Project: https://github.com/DataDog/dd-trace-js
// Definitions by: Colin Bradley <https://github.com/ColinBradley>
// Eloy Durán <https://github.com/alloy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
// Prettified with:
// $ prettier --parser typescript --tab-width 4 --semi --trailing-comma es5 --write --print-width 120 types/dd-trace/{,*}/*.ts*
import { Tracer, Span, SpanContext } from "opentracing";
import DatadogSpanContext = require("./src/opentracing/span_context");
declare var trace: TraceProxy;
export = trace;
declare class TraceProxy extends Tracer {
/**
* Initializes the tracer. This should be called before importing other libraries.
*/
init(options?: TracerOptions): this;
/**
* Enable and optionally configure a plugin.
* @param plugin The name of a built-in plugin.
* @param config Configuration options.
*/
use<P extends Plugin>(plugin: P, config: PluginConfiguration[P]): this;
/**
* Initiate a trace and creates a new span.
* @param operationName The operation name to be used for this span.
* @param options Configuration options. These will take precedence over environment variables.
*/
trace(operationName: string, options: TraceOptions): Promise<Span>;
/**
* Initiate a trace and creates a new span.
* @param operationName The operation name to be used for this span.
* @param options Configuration options. These will take precedence over environment variables.
*/
trace(operationName: string, options: TraceOptions, callback: (span: Span) => void): void;
/**
* Get the span from the current context.
* @returns The current span or null if outside a trace context.
*/
currentSpan(): Span | null;
/**
* Get the scope manager to manager context propagation for the tracer.
*/
scopeManager(): ScopeManager;
}
interface TracerOptions {
/**
* Whether to enable the tracer.
* @default true
*/
enabled?: boolean;
/**
* Enable debug logging in the tracer.
* @default false
*/
debug?: boolean;
/**
* The service name to be used for this program.
*/
service?: string;
/**
* The address of the trace agent that the tracer will submit to.
* @default 'localhost'
*/
hostname?: string;
/**
* The port of the trace agent that the tracer will submit to.
* @default 8126
*/
port?: number | string;
/**
* Set an application’s environment e.g. prod, pre-prod, stage.
*/
env?: string;
/**
* Percentage of spans to sample as a float between 0 and 1.
* @default 1
*/
sampleRate?: number;
/**
* Interval in milliseconds at which the tracer will submit traces to the agent.
* @default 2000
*/
flushInterval?: number;
/**
* Experimental features can be enabled all at once by using true or individually using key / value pairs.
* @default {}
*/
experimental?: ExperimentalOptions | boolean;
/**
* Whether to load all built-in plugins.
* @default true
*/
plugins?: boolean;
/**
* Custom logger to be used by the tracer (if debug = true),
* should support debug() and error() methods
* see https://datadog.github.io/dd-trace-js/#custom-logging__anchor
*/
logger?: {
debug: (message: string) => void;
error: (err: Error) => void;
};
/**
* Global tags that should be assigned to every span.
*/
tags?: { [key: string]: any };
}
interface ExperimentalOptions {}
interface TraceOptions {
/**
* The service name to be used for this span.
* The service name from the tracer will be used if this is not provided.
*/
service?: string;
/**
* The resource name to be used for this span.
* The operation name will be used if this is not provided.
*/
resource?: string;
/**
* The span type to be used for this span.
*/
type?: string;
/**
* The parent span or span context for the new span. Generally this is not needed as it will be
* fetched from the current context.
* If creating your own, this must be an instance of DatadogSpanContext from ./src/opentracing/span_context
* See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99
*/
childOf?: Span | SpanContext | DatadogSpanContext;
/**
* Global tags that should be assigned to every span.
*/
tags?: { [key: string]: any } | string;
}
declare class ScopeManager {
/**
* Get the current active scope or null if there is none.
*
* @todo The dd-trace source returns null, but opentracing's childOf span
* option is typed as taking undefined or a scope, so using undefined
* here instead.
*/
active(): Scope | undefined;
/**
* Activate a new scope wrapping the provided span.
*
* @param span The span for which to activate the new scope.
* @param finishSpanOnClose Whether to automatically finish the span when the scope is closed.
*/
activate(span: Span, finishSpanOnClose?: boolean): Scope;
}
declare class Scope {
/**
* Get the span wrapped by this scope.
*/
span(): Span;
/**
* Close the scope, and finish the span if the scope was created with `finishSpanOnClose` set to true.
*/
close(): void;
}
type Plugin =
| "amqp10"
| "amqplib"
| "bluebird"
| "elasticsearch"
| "express"
| "graphql"
| "hapi"
| "http"
| "ioredis"
| "koa"
| "memcached"
| "mongodb-core"
| "mysql"
| "mysql2"
| "pg"
| "q"
| "redis"
| "restify"
| "when";
interface BasePluginOptions {
/**
* The service name to be used for this plugin.
*/
service?: string;
}
interface BaseWebFrameworkPluginOptions extends BasePluginOptions {
/**
* An array of headers to include in the span metadata.
*/
headers?: string[];
/**
* Callback function to determine if there was an error. It should take a
* status code as its only parameter and return `true` for success or `false`
* for errors.
*/
validateStatus?: (code: number) => boolean;
}
interface ExpressPluginOptions extends BaseWebFrameworkPluginOptions {}
interface HapiPluginOptions extends BaseWebFrameworkPluginOptions {}
interface KoaPluginOptions extends BaseWebFrameworkPluginOptions {}
interface RestifyPluginOptions extends BaseWebFrameworkPluginOptions {}
interface GraphQLPluginOptions extends BasePluginOptions {
/**
* The maximum depth of fields/resolvers to instrument. Set to `0` to only
* instrument the operation or to -1 to instrument all fields/resolvers.
*/
depth?: number;
/**
* A callback to enable recording of variables. By default, no variables are
* recorded. For example, using `variables => variables` would record all
* variables.
*/
variables?: <T extends { [key: string]: any }>(variables: T) => Partial<T>;
}
interface HTTPPluginOptions extends BasePluginOptions {
/**
* Use the remote endpoint host as the service name instead of the default.
*/
splitByDomain?: boolean;
}
type PluginConfiguration = { [K in Plugin]: BasePluginOptions } & {
express: ExpressPluginOptions;
graphql: GraphQLPluginOptions;
hapi: HapiPluginOptions;
http: HTTPPluginOptions;
koa: KoaPluginOptions;
restify: RestifyPluginOptions;
};
-28
View File
@@ -1,28 +0,0 @@
import { SpanContext } from 'opentracing';
declare class DatadogSpanContext extends SpanContext {
/**
* Used to create references to parent spans.
* See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99
*/
constructor(props: SpanContextLike);
}
interface SpanContextLike {
traceId: number;
spanId: number;
parentId?: number | null;
sampled?: boolean;
baggageItems?: { [key: string]: string };
trace?: {
started: number[],
finished: number[]
};
}
export = DatadogSpanContext;
+1 -1
View File
@@ -38,7 +38,7 @@ declare namespace debug {
(formatter: any, ...args: any[]): void;
enabled: boolean;
log: (v: any) => string;
log: (...args: any[]) => any;
namespace: string;
extend: (namespace: string, delimiter?: string) => Debugger;
}
@@ -1,64 +0,0 @@
import { BrowserName, BrowserInfo, detect } from 'detect-browser';
const browser = detect();
if (browser) {
const name: string | undefined = browser.name;
const version: string | undefined = browser.version;
const os: string | undefined | null = browser.os;
const bot: true | undefined = browser.bot;
}
const browserInfos: BrowserInfo[] = [];
// Those that can happen when 'detect' hits on a browser
browserInfos.push(
{
name: "chrome",
version: "1.2.3",
os: null
}
);
browserInfos.push(
{
name: "edge",
version: "24.5.3",
os: "Sun OS"
}
);
browserInfos.push(
{
name: "edge",
version: "13.0",
os: "Windows 10",
bot: true
}
);
// Those that could be returned when it's a bot
browserInfos.push(
{
name: "facebook",
version: "1.0.2",
os: "Linux",
bot: true
}
);
browserInfos.push(
{
name: "crios",
version: "2.9.4",
os: undefined,
bot: true
}
);
browserInfos.push(
{
bot: true
}
);
-42
View File
@@ -1,42 +0,0 @@
// Type definitions for detect-browser 3.0
// Project: https://github.com/DamonOehlman/detect-browser
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
// Brian Caruso <https://github.com/carusology>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export {};
export type BrowserName =
"aol" |
"android" |
"bb10" |
"chrome" |
"crios" |
"edge" |
"facebook" |
"firefox" |
"fxios" |
"ie" |
"instagram" |
"ios" |
"ios-webview" |
"kakaotalk" |
"node" |
"opera" |
"phantomjs" |
"safari" |
"samsung" |
"vivaldi" |
"yandexbrowser";
export interface BrowserInfo {
name?: string;
version?: string;
os?: string | null;
bot?: true;
}
export function detect(): null | false | BrowserInfo;
export function detectOS(userAgentString: string): null | string;
export function parseUserAgent(userAgentString: string): null | BrowserInfo;
export function getNodeVersion(): false | BrowserInfo;
-10
View File
@@ -1,10 +0,0 @@
{
"extends": "dtslint/dt.json",
"rules": {
"indent": [
true,
"spaces",
4
]
}
}
+2 -2
View File
@@ -8,8 +8,8 @@
/*!
* filename: ej.web.all.d.ts
* version : 16.4.0.42
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.
* version : 16.4.0.52
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
+4 -1
View File
@@ -12,6 +12,9 @@
"typeRoots": [
"../"
],
"paths": {
"lru-cache": ["lru-cache/v4"]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
@@ -20,4 +23,4 @@
"index.d.ts",
"ejs-tests.ts"
]
}
}
+1 -1
View File
@@ -187,7 +187,7 @@ export class ec {
export namespace ec {
interface GenKeyPairOptions {
pers: any;
pers?: any;
entropy: any;
persEnc?: string;
entropyEnc?: string;
+1 -1
View File
@@ -1,5 +1,5 @@
// Type definitions for emojione 2.2
// Project: https://github.com/Ranks/emojione, http://www.emojione.com
// Project: https://github.com/Ranks/emojione, https://www.emojione.com
// Definitions by: Danilo Bargen <https://github.com/dbrgn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: http://airbnb.io/enzyme/
// Definitions by: Nabeelah Ali <https://github.com/nali>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.1
import { EnzymeAdapter } from 'enzyme';
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/airbnb/enzyme, http://airbnb.io/enzyme
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.1
import { EnzymeAdapter } from 'enzyme';
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/airbnb/enzyme, http://airbnb.io/enzyme
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.1
import { EnzymeAdapter } from 'enzyme';
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/zth/enzyme-async-helpers
// Definitions by: Kim Ehrenpohl <https://github.com/kimehrenpohl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.1
import { ReactWrapper, EnzymeSelector } from 'enzyme';
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/Knegusen/enzyme-redux#readme
// Definitions by: Dennis Axelsson <https://github.com/knegusen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.1
import { ReactWrapper, ShallowWrapper } from 'enzyme';
import { ReactElement } from 'react';
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/adriantoine/enzyme-to-json#readme
// Definitions by: Joscha Feth <https://github.com/joscha>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.1
import { ReactWrapper, ShallowWrapper } from 'enzyme';
+12 -1
View File
@@ -10,7 +10,7 @@ import {
ShallowRendererProps,
ComponentClass as EnzymeComponentClass
} from "enzyme";
import { Component, ReactElement, HTMLAttributes, ComponentClass, StatelessComponent } from "react";
import { Component, ReactElement, ReactNode, HTMLAttributes, ComponentClass, StatelessComponent } from "react";
// Help classes/interfaces
interface MyComponentProps {
@@ -35,6 +35,10 @@ interface MyComponentState {
stateProperty: string;
}
interface MyRenderPropProps {
children: (params: string) => ReactNode;
}
function toComponentType<T>(Component: ComponentClass<T> | StatelessComponent<T>): ComponentClass<T> | StatelessComponent<T> {
return Component;
}
@@ -59,6 +63,8 @@ class AnotherComponent extends Component<AnotherComponentProps> {
}
}
class MyRenderPropComponent extends Component<MyRenderPropProps> {}
const MyStatelessComponent = (props: StatelessProps) => <span />;
const AnotherStatelessComponent = (props: AnotherStatelessProps) => <span />;
@@ -477,6 +483,11 @@ function ShallowWrapperTest() {
shallowWrapper = new ShallowWrapper<MyComponentProps, MyComponentState>(<MyComponent stringProp="1" numberProp={1} />, undefined, { lifecycleExperimental: true });
shallowWrapper = new ShallowWrapper<MyComponentProps, MyComponentState>(<MyComponent stringProp="1" numberProp={1} />, shallowWrapper, { lifecycleExperimental: true });
}
function test_renderProp() {
let shallowWrapper = new ShallowWrapper<MyRenderPropProps>(<MyRenderPropComponent children={(params) => <div className={params} />} />);
shallowWrapper = shallowWrapper.renderProp('children')('test');
}
}
// ReactWrapper
+10 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for Enzyme 3.1
// Type definitions for Enzyme 3.9
// Project: https://github.com/airbnb/enzyme
// Definitions by: Marian Palkus <https://github.com/MarianPalkus>
// Cap3 <http://www.cap3.de>
@@ -8,8 +8,9 @@
// MartynasZilinskas <https://github.com/MartynasZilinskas>
// Torgeir Hovden <https://github.com/thovden>
// Martin Hochel <https://github.com/hotell>
// Christian Rackerseder <https://github.com/screendriver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.1
/// <reference types="cheerio" />
import { ReactElement, Component, AllHTMLAttributes as ReactHTMLAttributes, SVGAttributes as ReactSVGAttributes } from "react";
@@ -363,6 +364,8 @@ export interface CommonWrapper<P = {}, S = {}, C = Component<P, S>> {
length: number;
}
export type Parameters<T> = T extends (...args: infer A) => any ? A : never;
// tslint:disable-next-line no-empty-interface
export interface ShallowWrapper<P = {}, S = {}, C = Component> extends CommonWrapper<P, S, C> { }
export class ShallowWrapper<P = {}, S = {}, C = Component> {
@@ -447,6 +450,11 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
* Returns a wrapper with the direct parent of the node in the current wrapper.
*/
parent(): ShallowWrapper<any, any>;
/**
* Returns a wrapper of the node rendered by the provided render prop.
*/
renderProp<PropName extends keyof P>(prop: PropName): (...params: Parameters<P[PropName]>) => ShallowWrapper<any, never>;
}
// tslint:disable-next-line no-empty-interface
+1
View File
@@ -412,6 +412,7 @@ async () => {
{ resize: { width: 300 } },
{ resize: { height: 300 } },
{ resize: { height: 300, width: 300 } },
{ crop: { originX: 0, originY: 0, height: 300, width: 300 } }
], {
compress: 0.75
});
+7 -5
View File
@@ -1952,14 +1952,16 @@ export namespace ImageManipulator {
}
interface Flip {
flip?: { vertical?: boolean; horizontal?: boolean };
flip: { vertical?: boolean; horizontal?: boolean };
}
interface Crop {
originX: number;
originY: number;
width: number;
height: number;
crop: {
originX: number;
originY: number;
width: number;
height: number;
};
}
interface ImageResult {
@@ -0,0 +1,22 @@
import * as express from "express";
import rewrite = require("express-urlrewrite");
declare const app: express.Application;
app.use(rewrite(/^\/i(\w+)/, "/items/$1"));
app.use(rewrite("/:src..:dst", "/commits/$1/to/$2"));
app.use(rewrite("/:src..:dst", "/commits/:src/to/:dst"));
app.use(rewrite("/js/*", "/public/assets/js/$1"));
app.use(rewrite("/file\\?param=:param", "/file/:param"));
app.use(rewrite("/path", "/anotherpath?param=some"));
app.get("/route/:var", rewrite("/rewritten/:var"));
declare const someMw: express.Handler;
app.get("/rewritten/:var", someMw);
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for express-urlrewrite 1.2
// Project: https://github.com/kapouer/express-urlrewrite
// Definitions by: Melvin Groenhoff <https://github.com/mgroenhoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as express from "express";
declare function rewrite(s: string): express.Handler;
declare function rewrite(s: string | RegExp, t: string): express.Handler;
export = rewrite;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"express-urlrewrite-tests.ts"
]
}
+7 -5
View File
@@ -9,7 +9,7 @@
import { Duplex } from "stream";
declare namespace favicons {
interface Configuration {
interface Configuration {
/** Path for overriding default icons path @default "/" */
path: string;
/** Your application's name @default null */
@@ -38,6 +38,8 @@ declare namespace favicons {
version: string;
/** Print logs to console? @default false */
logging: boolean;
/** Use nearest neighbor resampling to preserve hard edges on pixel art @default false */
pixel_art: boolean;
/**
* Platform Options:
* - offset - offset in percentage
@@ -66,18 +68,18 @@ declare namespace favicons {
}>;
}
interface FavIconResponse {
interface FavIconResponse {
images: Array<{ name: string; contents: Buffer }>;
files: Array<{ name: string; contents: Buffer }>;
html: string[];
}
type Callback = (error: Error | null, response: FavIconResponse) => void;
type Callback = (error: Error | null, response: FavIconResponse) => void;
/** You can programmatically access Favicons configuration (icon filenames, HTML, manifest files, etc) with this export */
const config: Configuration;
const config: Configuration;
function stream(configuration?: Configuration): Duplex;
function stream(configuration?: Configuration): Duplex;
}
/**
* Generate favicons
+1 -1
View File
@@ -3188,7 +3188,7 @@ declare namespace browser.storage {
* @param changes Object mapping each key that changed to its corresponding `storage.StorageChange` for that item.
* @param areaName The name of the storage area (`"sync"`, `"local"` or `"managed"`) the changes are for.
*/
const onChanged: WebExtEvent<(changes: StorageChange, areaName: string) => void>;
const onChanged: WebExtEvent<(changes: {[key: string]: StorageChange}, areaName: string) => void>;
}
/**
@@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"opentracing": ">=0.14.1"
"moment": "^2.19.4"
}
}
@@ -1,61 +0,0 @@
import * as i18next from "i18next";
import * as LngDetector from "i18next-browser-languagedetector";
const options: LngDetector.DetectorOptions = {
// order and from where user language should be detected
order: ["querystring", "cookie", "localStorage", "navigator", "htmlTag"],
// keys or params to lookup language from
lookupQuerystring: "lng",
lookupCookie: "i18next",
lookupLocalStorage: "i18nextLng",
// cache user language on
caches: ["localStorage", "cookie"],
excludeCacheFor: ["cimode"], // languages to not persist (cookie, localStorage)
// optional expire and domain for set cookie
cookieMinutes: 10,
cookieDomain: "myDomain",
// optional htmlTag with lang attribute, the default is:
htmlTag: document.documentElement
};
i18next.use(LngDetector).init({
detection: options
});
const customDetector: LngDetector.CustomDetector = {
name: "myDetectorsName",
lookup(options: LngDetector.DetectorOptions) {
// options -> are passed in options
return "en";
},
cacheUserLanguage(lng: string, options: LngDetector.DetectorOptions) {
// options -> are passed in options
// lng -> current language, will be called after init and on changeLanguage
// store it
}
};
const customDetector2: LngDetector.CustomDetector = {
name: "myDetectorsName",
lookup(options: LngDetector.DetectorOptions) {
return undefined;
}
};
const lngDetector = new LngDetector(null, options);
lngDetector.init(options);
lngDetector.addDetector(customDetector);
i18next
.use(lngDetector)
.init({
detection: options
});
-65
View File
@@ -1,65 +0,0 @@
// Type definitions for i18next-browser-languagedetector 2.0
// Project: http://i18next.com/, https://github.com/i18next/i18next-browser-languagedetector
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare namespace i18nextBrowserLanguageDetector {
interface DetectorOptions {
/**
* order and from where user language should be detected
*/
order?: Array<"querystring" | "cookie" | "localStorage" | "navigator" | "htmlTag" | string>;
/**
* keys or params to lookup language from
*/
lookupQuerystring?: string;
lookupCookie?: string;
lookupLocalStorage?: string;
/**
* cache user language on
*/
caches?: string[];
/**
* languages to not persist (cookie, localStorage)
*/
excludeCacheFor?: string[];
/**
* optional expire and domain for set cookie
* @default 10
*/
cookieMinutes?: number;
cookieDomain?: string;
/**
* optional htmlTag with lang attribute
* @default document.documentElement
*/
htmlTag?: HTMLElement;
}
interface CustomDetector {
name: string;
cacheUserLanguage?(lng: string, options: DetectorOptions): void;
lookup(options: DetectorOptions): string | undefined;
}
}
declare class i18nextBrowserLanguageDetector {
constructor(services?: any, options?: i18nextBrowserLanguageDetector.DetectorOptions);
/**
* Adds detector.
*/
addDetector(detector: i18nextBrowserLanguageDetector.CustomDetector): i18nextBrowserLanguageDetector;
/**
* Initializes detector.
*/
init(options?: i18nextBrowserLanguageDetector.DetectorOptions): void;
}
export = i18nextBrowserLanguageDetector;
@@ -1,42 +0,0 @@
import * as i18next from 'i18next';
import LngDetector from 'i18next-browser-languagedetector';
const options = {
// order and from where user language should be detected
order: ['querystring', 'cookie', 'localStorage', 'navigator'],
// keys or params to lookup language from
lookupQuerystring: 'lng',
lookupCookie: 'i18next',
lookupLocalStorage: 'i18nextLng',
// cache user language on
caches: ['localStorage', 'cookie'],
// optional expire and domain for set cookie
cookieMinutes: 10,
cookieDomain: 'myDomain'
};
const myDetector = {
name: 'myDetectorsName',
lookup(options: {}) {
// options -> are passed in options
return 'en';
},
cacheUserLanguage(lng: string, options: {}) {
// options -> are passed in options
// lng -> current language, will be called after init and on changeLanguage
// store it
}
};
i18next.use(LngDetector).init({
detection: options
});
const lngDetector = new LngDetector(null, options);
lngDetector.init(options);
lngDetector.addDetector(myDetector);
-58
View File
@@ -1,58 +0,0 @@
// Type definitions for i18next-browser-languagedetector 0.0
// Project: http://i18next.com/
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as i18next from "i18next";
declare namespace I18next {
interface I18nextStatic extends i18nextBrowserLanguageDetector.I18nextStatic { }
interface I18nextOptions extends i18nextBrowserLanguageDetector.I18nextOptions { }
}
declare namespace i18nextBrowserLanguageDetector {
/** Interface for Language detector options. */
interface LanguageDetectorOptions {
caches?: string[] | boolean;
cookieDomain?: string;
cookieExpirationDate?: Date;
lookupCookie?: string;
lookupFromPathIndex?: number;
lookupQuerystring?: string;
lookupSession?: string;
order?: string[];
}
/** Interface for custom detector. */
interface CustomDetector {
name: string;
// todo: Checks parameters type.
cacheUserLanguage(lng: string, options: {}): void;
lookup(options: {}): string;
}
/** i18next options. */
interface I18nextOptions {
detection?: LanguageDetectorOptions;
}
/** i18next interface. */
interface I18nextStatic {
use(module: LngDetector): I18nextStatic;
}
/** i18next language detection. */
class LngDetector {
constructor(services?: any, options?: LanguageDetectorOptions);
/** Adds detector. */
addDetector(detector: CustomDetector): LngDetector;
/** Initializes detector. */
init(options?: LanguageDetectorOptions): void;
}
}
export default i18nextBrowserLanguageDetector.LngDetector;
@@ -1,11 +0,0 @@
{
"extends": "dtslint/dt.json",
"rules": {
"interface-name": [
false
],
"no-empty-interface": [
false
]
}
}
+9
View File
@@ -0,0 +1,9 @@
import { indefinite } from "indefinite";
const anApple = indefinite("apple"); // "an apple"
const aBanana = indefinite('banana'); // "a banana"
const AnApple = indefinite('apple', { capitalize: true }); // "An apple"
const anEight = indefinite("8"); // "an 8"
const anEightAsNumber = indefinite(8); // "an 8"
const a1892 = indefinite("1892"); // "a 1892" -> read "a one thousand eight hundred ninety-two"
const a1892AsColloquial = indefinite("1892", { numbers: "colloquial" }); // "an 1892" -> read "an eighteen ninety-two"
+11
View File
@@ -0,0 +1,11 @@
// Type definitions for indefinite 2.2
// Project: https://github.com/tandrewnichols/indefinite
// Definitions by: omaishar <https://github.com/omaishr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Options {
capitalize?: boolean;
caseInsensitive?: boolean;
numbers?: "colloquial";
}
export function indefinite(word: string | number, opts?: Options): string;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"indefinite-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+39
View File
@@ -0,0 +1,39 @@
// Type definitions for ink-spinner 2.0
// Project: https://github.com/vadimdemedes/ink-spinner#readme
// Definitions by: Łukasz Ostrowski <https://github.com/lukostry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { Chalk } from 'chalk';
import * as cliSpinners from 'cli-spinners';
import { Component } from 'ink';
type StringifyPartial<T> = {
[P in keyof T]?: string;
};
type BooleansPartial<T> = {
[P in keyof T]?: boolean;
};
type TupleOfNumbersPartial<T> = {
[P in keyof T]?: [number, number, number];
};
// Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type ChalkColorModels = Pick<Chalk, 'rgb' | 'hsl' | 'hsv' | 'hwb' | 'bgRgb' | 'bgHsl' | 'bgHsv' | 'bgHwb'>;
type ChalkKeywordsAndHexes = Pick<Chalk, 'keyword' | 'hex' | 'bgKeyword' | 'bgHex'>;
type ChalkCommons = Omit<Chalk, keyof ChalkColorModels | keyof ChalkKeywordsAndHexes | 'constructor' | 'level' | 'enabled'>;
interface SpinnerProps {
type?: cliSpinners.SpinnerName;
}
type ChalkProps = BooleansPartial<ChalkCommons>
& StringifyPartial<ChalkKeywordsAndHexes>
& TupleOfNumbersPartial<ChalkColorModels>;
declare class Spinner extends Component<SpinnerProps & ChalkProps> { }
export = Spinner;
+10
View File
@@ -0,0 +1,10 @@
/** @jsx h */
import { h } from 'ink';
import Spinner from 'ink-spinner';
// NOTE: `import Spinner = require('ink-spinner');` will work as well.
// If importing using ES6 default import as above,
// `allowSyntheticDefaultImports` flag in compiler options needs to be set to `true`
const Demo = () => {
return <Spinner type="line" rgb={[255, 255, 255]} />;
};
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"jsx": "react",
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ink-spinner-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+8 -7
View File
@@ -900,7 +900,7 @@ declare global {
q?: boolean;
addID?: boolean;
limit?: number;
ignoreNull: boolean;
ignoreNull?: boolean;
sessionId?: any;
aggregate?: "minmax" | "min" | "max" | "average" | "total" | "count" | "none";
}
@@ -1627,11 +1627,11 @@ declare global {
removeAllListeners(event?: "ready" | "unload" | "stateChange" | "objectChange" | "message"): this;
} // end interface Adapter
type ReadyHandler = () => void;
type ObjectChangeHandler = (id: string, obj: ioBroker.Object | null | undefined) => void;
type StateChangeHandler = (id: string, obj: State | null | undefined) => void;
type MessageHandler = (obj: Message) => void;
type UnloadHandler = (callback: EmptyCallback) => void;
type ReadyHandler = () => void | Promise<void>;
type ObjectChangeHandler = (id: string, obj: ioBroker.Object | null | undefined) => void | Promise<void>;
type StateChangeHandler = (id: string, obj: State | null | undefined) => void | Promise<void>;
type MessageHandler = (obj: Message) => void | Promise<void>;
type UnloadHandler = (callback: EmptyCallback) => void | Promise<void>;
type EmptyCallback = () => void;
type ErrorCallback = (err?: string) => void;
@@ -1682,7 +1682,8 @@ declare global {
type SetStateCallback = (err: string | null, id?: string) => void;
type SetStateChangedCallback = (err: string | null, id: string, notChanged: boolean) => void;
type DeleteStateCallback = (err: string | null, id?: string) => void;
type GetHistoryCallback = (err: string | null, result: Array<(State & { id?: string })>, step: number, sessionId?: string) => void;
type GetHistoryResult = Array<(State & { id?: string })>;
type GetHistoryCallback = (err: string | null, result: GetHistoryResult, step: number, sessionId?: string) => void;
/** Contains the return values of readDir */
interface ReadDirResult {
+12
View File
@@ -20,6 +20,16 @@ adapter
;
adapter.removeAllListeners();
// Test adapter constructor options
let adapterOptions: ioBroker.AdapterOptions = {
name: "foo",
ready: readyHandler,
stateChange: stateChangeHandler,
objectChange: objectChangeHandler,
message: messageHandler,
unload: unloadHandler,
};
function readyHandler() { }
function stateChangeHandler(id: string, state: ioBroker.State | null | undefined) {
@@ -260,6 +270,8 @@ adapter.subscribeForeignStatesAsync("*").catch(handleError);
adapter.unsubscribeStatesAsync("*").catch(handleError);
adapter.unsubscribeForeignStatesAsync("*").catch(handleError);
adapter.getHistory("state.id", {}, (err, result: ioBroker.GetHistoryResult) => {});
// Repro from https://github.com/ioBroker/adapter-core/issues/3
const repro1: ioBroker.ObjectChangeHandler = (id, obj) => {
if (!obj || !obj.common) return;
+14 -6
View File
@@ -272,7 +272,7 @@ declare namespace IORedis {
hgetBuffer(key: KeyType, field: string, callback: (err: Error, res: Buffer) => void): void;
hgetBuffer(key: KeyType, field: string): Promise<Buffer>;
hmset(key: KeyType, field: string, value: any, ...args: string[]): Promise<0 | 1>;
hmset(key: KeyType, ...args: any[]): Promise<0 | 1>;
hmset(key: KeyType, data: any, callback: (err: Error, res: 0 | 1) => void): void;
hmset(key: KeyType, data: any): Promise<0 | 1>;
@@ -313,9 +313,13 @@ declare namespace IORedis {
getset(key: KeyType, value: any, callback: (err: Error, res: string | null) => void): void;
getset(key: KeyType, value: any): Promise<string | null>;
mset(key: KeyType, value: any, ...args: string[]): any;
mset(...args: any[]): any;
mset(data: any, callback: (err: Error, res: string) => void): void;
mset(data: any): Promise<string>;
msetnx(key: KeyType, value: any, ...args: string[]): any;
msetnx(...args: any[]): any;
msetnx(data: any, callback: (err: Error, res: 0 | 1) => void): void;
msetnx(data: any): Promise<0 | 1>;
randomkey(callback: (err: Error, res: string) => void): void;
randomkey(): Promise<string>;
@@ -489,6 +493,8 @@ declare namespace IORedis {
xack(key: KeyType, group: string, ...ids: string[]): any;
xadd(key: KeyType, id: string, ...args: string[]): any;
xadd(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', count: number, ...args: string[]): any;
xadd(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', approximate: '~', count: number, ...args: string[]): any;
xclaim(key: KeyType, group: string, consumer: string, minIdleTime: number, ...args: any[]): any;
@@ -673,7 +679,7 @@ declare namespace IORedis {
hget(key: KeyType, field: string, callback?: (err: Error, res: string | string) => void): Pipeline;
hgetBuffer(key: KeyType, field: string, callback?: (err: Error, res: Buffer) => void): Pipeline;
hmset(key: KeyType, field: string, value: any, ...args: string[]): Pipeline;
hmset(key: KeyType, ...args: any[]): Pipeline;
hmset(key: KeyType, data: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline;
hmget(key: KeyType, ...fields: string[]): Pipeline;
@@ -702,9 +708,11 @@ declare namespace IORedis {
getset(key: KeyType, value: any, callback?: (err: Error, res: string) => void): Pipeline;
mset(key: KeyType, value: any, ...args: string[]): Pipeline;
mset(...args: any[]): Pipeline;
mset(data: any, callback?: (err: Error, res: string) => void): Pipeline;
msetnx(key: KeyType, value: any, ...args: string[]): Pipeline;
msetnx(...args: any[]): Pipeline;
msetnx(data: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline;
randomkey(callback?: (err: Error, res: string) => void): Pipeline;
+5
View File
@@ -154,6 +154,9 @@ redis.multi([
const keys = ['foo', 'bar'];
redis.mget(...keys);
redis.mset(...['foo', 'bar']);
redis.mset({ foo: 'bar' });
new Redis.Cluster([
'localhost'
]);
@@ -177,6 +180,8 @@ new Redis.Cluster([{
redis.xack('streamName', 'groupName', 'id');
redis.xadd('streamName', '*', 'field', 'name');
redis.xadd('streamName', 'MAXLEN', 100, '*', 'field', 'name');
redis.xadd('streamName', 'MAXLEN', '~', 100, '*', 'field', 'name');
redis.xclaim('streamName', 'groupName', 'consumerName', 3600000, 'id');
redis.xdel('streamName', 'id');
redis.xgroup('CREATE', 'streamName', 'groupName', '$');
+7
View File
@@ -0,0 +1,7 @@
// Type definitions for is-blank 2.1
// Project: https://github.com/johnotander/is-blank#readme
// Definitions by: Christian Gambardella <https://github.com/heygambo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function isBlank(input: any): boolean;
export = isBlank;
+17
View File
@@ -0,0 +1,17 @@
import isBlank = require('is-blank');
isBlank([]); // => true
isBlank({}); // => true
isBlank(0); // => true
isBlank(() => {}); // => true
isBlank(null); // => true
isBlank(undefined); // => true
isBlank(''); // => true
isBlank(' '); // => true
isBlank('\r\t\n '); // => true
isBlank(['a', 'b']); // => false
isBlank({ a: 'b' }); // => false
isBlank('string'); // => false
isBlank(42); // => false
isBlank((a: number, b: number) => a + b);
@@ -18,6 +18,6 @@
},
"files": [
"index.d.ts",
"p-throttle-tests.ts"
"is-blank-tests.ts"
]
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for is-natural-number 4.0
// Project: https://github.com/shinnn/is-natural-number.js
// Definitions by: Adam Zerella <https://github.com/adamzerella>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Options {
/**
* Setting this option true makes 0 regarded as a natural number.
*/
includeZero: boolean;
}
/**
* Rreturns true if the first argument is one of the natural numbers.
* If not, or the argument is not a number, it returns false.
*/
declare function isNaturalNumber(number: number|string, option?: Options): boolean;
export = isNaturalNumber;
@@ -0,0 +1,6 @@
import isNaturalNumber = require("is-natural-number");
isNaturalNumber(5);
isNaturalNumber("5");
isNaturalNumber(0, {includeZero: true});
isNaturalNumber("0", {includeZero: true});
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [
],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"is-natural-number-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+11
View File
@@ -0,0 +1,11 @@
// Type definitions for is-odd 3.0
// Project: https://github.com/jonschlinkert/is-odd
// Definitions by: Adam Zerella <https://github.com/adamzerella>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Return true if a given number is odd or not.
*/
declare function isOdd(value: number|string): boolean;
export = isOdd;
+4
View File
@@ -0,0 +1,4 @@
import isOdd = require("is-odd");
isOdd(5);
isOdd("5");
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [
],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"is-odd-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+1 -1
View File
@@ -34,6 +34,6 @@ interface JasmineDataDrivenTest {
assertion: (arg0: T, arg1: U, done: () => void) => void): void;
<T>(
description: string,
dataset: T[],
dataset: T[] | Array<[T]>,
assertion: (value: T, done: () => void) => void): void;
}
@@ -37,6 +37,13 @@ xall("A data driven test can be pending",
}
);
all("A data set must consist of array-wrapped arrays, if test expects single array input",
[[[1, 2]], [[3, 4]], [[5, 6]]],
(numberArray: number[]) => {
expect(numberArray.length).toBe(2);
}
);
describe("A suite", () => {
let a: number;
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/formidablelabs/enzyme-matchers/packages/jasmine-enzyme
// Definitions by: Umar Bolatov <https://github.com/bolatovumar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.1
/// <reference types="jasmine" />
/// <reference types="react" />
+1 -1
View File
@@ -15,7 +15,7 @@ declare namespace create {
log(name: string, n: number, start: number, callback: (err: Error, data: any) => void): void;
log(name: string, n: number, start: number, type: 'text' | 'html', callback: (err: Error, data: any) => void): void;
log(name: string, n: number, start: number, type: 'text' | 'html', meta: boolean, callback: (err: Error, data: any) => void): void;
logStream(name: string, n: number, type?: 'text' | 'html', delay?: number): NodeJS.ReadableStream;
logStream(name: string, n: number, options?: { type?: 'text' | 'html', delay?: number }): NodeJS.ReadableStream;
stop(name: string, n: number, callback: (err: Error) => void): void;
term(name: string, n: number, callback: (err: Error) => void): void;
};
+14
View File
@@ -34,6 +34,20 @@ log.on('end', () => {
console.log('end');
});
const log2 = jenkins.build.logStream('example', 1, { type: 'html', delay: 2 * 1000 });
log2.on('data', (text: string) => {
process.stdout.write(text);
});
log2.on('error', (err: Error) => {
console.log('error', err);
});
log2.on('end', () => {
console.log('end');
});
jenkins.build.stop('example', 1, (err) => {
if (err) throw err;
});
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/igor-dv/jest-specific-snapshot#readme
// Definitions by: Janeene Beeforth <https://github.com/dawnmist>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
// TypeScript Version: 3.1
/// <reference types="jest" />
+20 -11
View File
@@ -978,20 +978,29 @@ declare namespace jest {
}
/**
* Represents the result of a single call to a mock function.
* Represents the result of a single call to a mock function with a return value.
*/
interface MockResult {
/**
* True if the function threw.
* False if the function returned.
*/
isThrow: boolean;
/**
* The value that was either thrown or returned by the function.
*/
interface MockResultReturn<T> {
type: 'return';
value: T;
}
/**
* Represents the result of a single incomplete call to a mock function.
*/
interface MockResultIncomplete {
type: 'incomplete';
value: undefined;
}
/**
* Represents the result of a single call to a mock function with a thrown error.
*/
interface MockResultThrow {
type: 'throw';
value: any;
}
type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
interface MockContext<T, Y extends any[]> {
calls: Y[];
instances: T[];
@@ -999,7 +1008,7 @@ declare namespace jest {
/**
* List of results of calls to the mock function.
*/
results: MockResult[];
results: Array<MockResult<T>>;
}
}
+14 -1
View File
@@ -316,7 +316,7 @@ interface TestApi {
test(x: number): string;
}
// $ExpectType Mock<string, [number]>
const mock12 = jest.fn<ReturnType<TestApi["test"]>, ArgsType<TestApi["test"]>>();
const mock12 = jest.fn<ReturnType<TestApi["test"]>, jest.ArgsType<TestApi["test"]>>();
// $ExpectType number
mock1('test');
@@ -485,6 +485,19 @@ mocked.test4.mockRejectedValue(new Error());
// $ExpectError
mocked.test4.mockRejectedValueOnce(new Error());
const mockResult = jest.fn(() => 1).mock.results[0];
switch (mockResult.type) {
case 'return':
mockResult.value; // $ExpectType number
break;
case 'incomplete':
mockResult.value; // $ExpectType undefined
break;
case 'throw':
mockResult.value; // $ExpectType any
break;
}
/* Snapshot serialization */
const snapshotSerializerPlugin: jest.SnapshotSerializerPlugin = {
+2 -1
View File
@@ -15,6 +15,7 @@
// Peter Thorson <https://github.com/zaphoyd>
// Will Garcia <https://github.com/thewillg>
// Simon Schick <https://github.com/SimonSchick>
// Alejandro Fernandez Haro <https://github.com/afharo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -704,7 +705,7 @@ export interface ArraySchema extends AnySchema {
* `schema` - the validation rules required to satisfy the assertion. If the `schema` includes references, they are resolved against
* the array item being tested, not the value of the `ref` target.
*/
assertItem(schema: SchemaLike): this;
has(schema: SchemaLike): this;
/**
* Allow this array to be sparse.
* enabled can be used with a falsy value to go back to the default behavior.
+1 -1
View File
@@ -312,7 +312,7 @@ anySchema = Joi.any();
arrSchema = Joi.array();
arrSchema = arrSchema.assertItem(Joi.any());
arrSchema = arrSchema.has(Joi.any());
arrSchema = arrSchema.sparse();
arrSchema = arrSchema.sparse(bool);
arrSchema = arrSchema.single();

Some files were not shown because too many files have changed in this diff Show More