mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge: upstream/master into update/jest-each-templatize
This commit is contained in:
+14
-2
@@ -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",
|
||||
@@ -730,7 +742,7 @@
|
||||
"libraryName": "i18next-browser-languagedetector",
|
||||
"typingsPackageName": "i18next-browser-languagedetector",
|
||||
"sourceRepoURL": "https://github.com/i18next/i18next-browser-languagedetector",
|
||||
"asOfVersion": "2.0.2"
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "i18next-xhr-backend",
|
||||
@@ -1126,7 +1138,7 @@
|
||||
"libraryName": "p-throttle",
|
||||
"typingsPackageName": "p-throttle",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-throttle",
|
||||
"asOfVersion": "2.0.0"
|
||||
"asOfVersion": "2.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "param-case",
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
Vendored
+13
-1
@@ -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;
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"argparse-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,3 +101,50 @@ const thingShadows = new awsIot.thingShadow({
|
||||
|
||||
thingShadows.on("timeout", function(thingName: string, clientToken: string) {
|
||||
});
|
||||
|
||||
const jobs = new awsIot.jobs({
|
||||
keyPath: "",
|
||||
certPath: "",
|
||||
caPath: "",
|
||||
clientId: "",
|
||||
region: "",
|
||||
baseReconnectTimeMs: 1000,
|
||||
protocol: "wss",
|
||||
port: 443,
|
||||
host: "",
|
||||
debug: false
|
||||
});
|
||||
|
||||
jobs.subscribeToJobs("thingname", "operationname", (err, job) => {
|
||||
console.error("Error", err);
|
||||
if (err || !job) {
|
||||
return;
|
||||
}
|
||||
console.log("job id", job.id);
|
||||
console.log("job info", job.document);
|
||||
console.log("job op", job.operation);
|
||||
console.log("job status", job.status);
|
||||
console.log("job status details", job.status.statusDetails);
|
||||
console.log(
|
||||
"job status details progress",
|
||||
job.status.statusDetails.progress
|
||||
);
|
||||
|
||||
job.inProgress({ progress: "1" }, err =>
|
||||
console.error("Job progress error", err)
|
||||
);
|
||||
job.failed({ progress: "2" }, err =>
|
||||
console.error("Job failed error", err)
|
||||
);
|
||||
job.succeeded({ progress: "3" }, err =>
|
||||
console.error("Job failed error", err)
|
||||
);
|
||||
});
|
||||
|
||||
jobs.startJobNotifications("thingname", err =>
|
||||
console.error("Start job notification error", err)
|
||||
);
|
||||
|
||||
jobs.unsubscribeFromJobs("thingname", "operationame", err =>
|
||||
console.error("Unsubscribe from jobs error", err)
|
||||
);
|
||||
|
||||
Vendored
+113
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for aws-iot-device-sdk 2.1.0
|
||||
// Type definitions for aws-iot-device-sdk 2.2.0
|
||||
// Project: https://github.com/aws/aws-iot-device-sdk-js
|
||||
// Definitions by: Markus Olsson <https://github.com/niik>
|
||||
// Margus Lamp <https://github.com/mlamp>
|
||||
@@ -391,3 +391,115 @@ export class thingShadow extends NodeJS.EventEmitter {
|
||||
/** Emitted when a different client"s update or delete operation is accepted on the shadow. */
|
||||
on(event: "foreignStateChange", listener: (thingName: string, operation: "update" | "delete", stateObject: any) => void): this;
|
||||
}
|
||||
|
||||
export interface statusDetails {
|
||||
progress: string;
|
||||
}
|
||||
|
||||
export interface jobStatus {
|
||||
status: string;
|
||||
statusDetails: statusDetails;
|
||||
}
|
||||
|
||||
export interface jobDocument {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface job {
|
||||
/** Object that contains job execution information and functions for updating job execution status. */
|
||||
|
||||
/** Returns the job id. */
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The JSON document describing details of the job to be executed eg.
|
||||
* {
|
||||
* "operation": "install",
|
||||
* "otherProperty": "value",
|
||||
* ...
|
||||
* }
|
||||
*/
|
||||
document: jobDocument;
|
||||
|
||||
/**
|
||||
* Returns the job operation from the job document. Eg. 'install', 'reboot', etc.
|
||||
*/
|
||||
operation: string;
|
||||
|
||||
/**
|
||||
* Returns the current job status according to AWS Orchestra.
|
||||
*/
|
||||
status: jobStatus;
|
||||
|
||||
/**
|
||||
* Update the status of the job execution to be IN_PROGRESS for the thing associated with the job.
|
||||
*
|
||||
* @param statusDetails - optional document describing the status details of the in progress job
|
||||
* @param callback - function(err) optional callback for when the operation completes, err is null if no error occurred
|
||||
*/
|
||||
inProgress(statusDetails?: statusDetails, callback?: (err: Error) => void): void;
|
||||
|
||||
/**
|
||||
* Update the status of the job execution to be FAILED for the thing associated with the job.
|
||||
*
|
||||
* @param statusDetails - optional document describing the status details of the in progress job e.g.
|
||||
* @param callback - function(err) optional callback for when the operation completes, err is null if no error occurred
|
||||
*/
|
||||
failed(statusDetails?: statusDetails, callback?: (err: Error) => void): void;
|
||||
|
||||
/**
|
||||
* Update the status of the job execution to be SUCCESS for the thing associated with the job.
|
||||
*
|
||||
* @param statusDetails - optional document describing the status details of the in progress job e.g.
|
||||
* @param callback - function(err) optional callback for when the operation completes, err is null if no error occurred
|
||||
*/
|
||||
succeeded(statusDetails?: statusDetails, callback?: (err: Error) => void): void;
|
||||
}
|
||||
|
||||
export class jobs extends device {
|
||||
/**
|
||||
* The `jobs` class wraps an instance of the `device` class with additional functionality to
|
||||
* handle job execution management through the AWS IoT Jobs platform. Arguments in `deviceOptions`
|
||||
* are the same as those in the device class and the `jobs` class supports all of the
|
||||
* same events and functions as the `device` class.
|
||||
*/
|
||||
constructor(options?: DeviceOptions);
|
||||
|
||||
/**
|
||||
* Subscribes to job execution notifications for the thing named `thingName`. If
|
||||
* `operationName` is specified then the callback will only be called when a job
|
||||
* ready for execution contains a property called `operation` in its job document with
|
||||
* a value matching `operationName`. If `operationName` is omitted then the callback
|
||||
* will be called for every job ready for execution that does not match another
|
||||
* `subscribeToJobs` subscription.
|
||||
*
|
||||
* @param thingName - name of the Thing to receive job execution notifications
|
||||
* @param operationName - optionally filter job execution notifications to jobs with a value
|
||||
* for the `operation` property that matches `operationName
|
||||
* @param callback - function (err, job) callback for when a job execution is ready for processing or an error occurs
|
||||
* - `err` a subscription error or an error that occurs when client is disconnecting
|
||||
* - `job` an object that contains job execution information and functions for updating job execution status.
|
||||
*/
|
||||
subscribeToJobs(thingName: string, operationName: string, callback?: (err: Error, job: job) => void): void;
|
||||
|
||||
/**
|
||||
* Causes any existing queued job executions for the given thing to be published
|
||||
* to the appropriate subscribeToJobs handler. Only needs to be called once per thing.
|
||||
*
|
||||
* @param thingName - name of the Thing to cancel job execution notifications for
|
||||
* @param callback - function (err) callback for when the startJobNotifications operation completes
|
||||
*/
|
||||
startJobNotifications(thingName: string, callback: (error: Error) => void): mqtt.Client;
|
||||
|
||||
/**
|
||||
* Unsubscribes from job execution notifications for the thing named `thingName` having
|
||||
* operations with a value of the given `operationName`. If `operationName` is omitted then
|
||||
* the default handler for the thing with the given name is unsubscribed.
|
||||
*
|
||||
* @param thingName - name of the Thing to cancel job execution notifications for
|
||||
* @param operationName - optional name of previously subscribed operation names
|
||||
* @param callback - function (err) callback for when the unsubscribe operation completes
|
||||
*/
|
||||
unsubscribeFromJobs(thingName: string, operationName: string, callback: (err: Error) => void): void;
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Vendored
+153
-2
@@ -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;
|
||||
|
||||
Vendored
+1
-1
@@ -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> {
|
||||
|
||||
@@ -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);
|
||||
Vendored
+101
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
Vendored
+60
-17
@@ -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;
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
Vendored
+4
-3
@@ -87,7 +87,8 @@ export namespace policies {
|
||||
|
||||
interface DecisionInfo {
|
||||
decision: number;
|
||||
consistency: number;
|
||||
consistency?: number;
|
||||
useCurrentHost?: boolean;
|
||||
}
|
||||
|
||||
interface RequestInfo {
|
||||
@@ -115,8 +116,8 @@ export namespace policies {
|
||||
onReadTimeout(requestInfo: RequestInfo, consistency: types.consistencies, received: number, blockFor: number, isDataPresent: boolean): DecisionInfo;
|
||||
onUnavailable(requestInfo: RequestInfo, consistency: types.consistencies, required: number, alive: number): DecisionInfo;
|
||||
onWriteTimeout(requestInfo: RequestInfo, consistency: types.consistencies, received: number, blockFor: number, writeType: string): DecisionInfo;
|
||||
rethrowResult(): { decision: retryDecision };
|
||||
retryResult(consistency?: types.consistencies, useCurrentHost?: boolean): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean };
|
||||
rethrowResult(): DecisionInfo;
|
||||
retryResult(consistency?: types.consistencies, useCurrentHost?: boolean): DecisionInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -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" />
|
||||
|
||||
@@ -1441,6 +1441,12 @@ export interface MediaInformation {
|
||||
* The media tracks.
|
||||
*/
|
||||
tracks?: Track[];
|
||||
|
||||
/**
|
||||
* VMAP ad request configuration. Used if breaks and breakClips are not
|
||||
* provided.
|
||||
*/
|
||||
vmapAdsRequest?: VastAdsRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -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';
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Type definitions for connect-datadog 0.0
|
||||
// Project: https://github.com/AppPress/node-connect-datadog
|
||||
// Project: https://github.com/datadog/node-connect-datadog
|
||||
// Definitions by: Moshe Good <https://github.com/moshegood>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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']);
|
||||
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
});
|
||||
Vendored
-275
@@ -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;
|
||||
};
|
||||
@@ -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,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
|
||||
}
|
||||
);
|
||||
Vendored
-42
@@ -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;
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"indent": [
|
||||
true,
|
||||
"spaces",
|
||||
4
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Type definitions for drivelist 6.4
|
||||
// Project: https://github.com/resin-io-modules/drivelist
|
||||
// Project: https://github.com/balena-io-modules/drivelist
|
||||
// Definitions by: Xiao Deng <https://github.com/WholeMilk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -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
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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';
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -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';
|
||||
|
||||
Vendored
+1
-1
@@ -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';
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Vendored
+10
-2
@@ -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
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
Vendored
+7
-5
@@ -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 {
|
||||
|
||||
Vendored
+1
@@ -36,6 +36,7 @@ declare class HTTPError extends StdError {
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
headers: http.IncomingHttpHeaders;
|
||||
body: Buffer | string | object;
|
||||
}
|
||||
|
||||
declare class MaxRedirectsError extends StdError {
|
||||
|
||||
@@ -19,5 +19,8 @@ gulp.src("test.css")
|
||||
gulp.src("test.css")
|
||||
.pipe(ghPages({push: false}));
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(ghPages({ force: true }));
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(ghPages({message: "master"}));
|
||||
|
||||
Vendored
+2
@@ -1,6 +1,7 @@
|
||||
// Type definitions for gulp-gh-pages
|
||||
// Project: https://github.com/rowoot/gulp-gh-pages
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Ntnyq <https://github.com/ntnyq>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
@@ -12,6 +13,7 @@ interface Options {
|
||||
branch?: string;
|
||||
cacheDir?: string;
|
||||
push?: boolean;
|
||||
force?: boolean;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"opentracing": ">=0.14.1"
|
||||
"moment": "^2.19.4"
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
Vendored
+11
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"chalk": "^2.1.0"
|
||||
}
|
||||
}
|
||||
Vendored
+12
-6
@@ -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>;
|
||||
@@ -675,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;
|
||||
@@ -704,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;
|
||||
|
||||
|
||||
@@ -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'
|
||||
]);
|
||||
|
||||
Vendored
+7
@@ -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;
|
||||
@@ -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",
|
||||
"dd-trace-tests.ts"
|
||||
"is-blank-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+19
@@ -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});
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+11
@@ -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;
|
||||
@@ -0,0 +1,4 @@
|
||||
import isOdd = require("is-odd");
|
||||
|
||||
isOdd(5);
|
||||
isOdd("5");
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+4
@@ -284,6 +284,10 @@ declare global {
|
||||
* Get the Isotope instance from a jQuery object. Isotope instances are useful to access Isotope properties.
|
||||
*/
|
||||
data(methodName: 'isotope'): Isotope;
|
||||
/**
|
||||
* Filters, sorts, and lays out items.
|
||||
*/
|
||||
isotope(): JQuery;
|
||||
/**
|
||||
* Lays out specified items.
|
||||
* @param elements Array of Isotope.Items
|
||||
|
||||
@@ -81,6 +81,7 @@ $grid = $('.grid').isotope({
|
||||
});
|
||||
|
||||
// test methods using jquery
|
||||
$grid.isotope();
|
||||
$grid.isotope('addItems', $('.items'));
|
||||
$grid.isotope('appended', $('.items')[0]);
|
||||
$grid.isotope('hideItemElements', [ new HTMLElement() ]);
|
||||
|
||||
Vendored
+1
-1
@@ -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" />
|
||||
|
||||
Vendored
+1
-1
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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
@@ -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" />
|
||||
|
||||
|
||||
Vendored
+9
-4
@@ -266,20 +266,24 @@ declare namespace jest {
|
||||
// Exclusively arrays.
|
||||
<T extends any[]>(cases: ReadonlyArray<T>): (
|
||||
name: string,
|
||||
fn: (...args: T) => any
|
||||
fn: (...args: T) => any,
|
||||
timeout?: number
|
||||
) => void;
|
||||
// Not arrays.
|
||||
<T>(cases: ReadonlyArray<T>): (
|
||||
name: string,
|
||||
fn: (...args: T[]) => any
|
||||
fn: (...args: T[]) => any,
|
||||
timeout?: number
|
||||
) => void;
|
||||
(cases: ReadonlyArray<ReadonlyArray<any>>): (
|
||||
name: string,
|
||||
fn: (...args: any[]) => any
|
||||
fn: (...args: any[]) => any,
|
||||
timeout?: number
|
||||
) => void;
|
||||
(strings: TemplateStringsArray, ...placeholders: any[]): (
|
||||
name: string,
|
||||
fn: (arg: any) => any
|
||||
fn: (arg: any) => any,
|
||||
timeout?: number
|
||||
) => void;
|
||||
}
|
||||
|
||||
@@ -1638,6 +1642,7 @@ declare namespace jest {
|
||||
numPendingTests: number;
|
||||
numPendingTestSuites: number;
|
||||
numRuntimeErrorTestSuites: number;
|
||||
numTodoTests: number;
|
||||
numTotalTests: number;
|
||||
numTotalTestSuites: number;
|
||||
snapshot: SnapshotSummary;
|
||||
|
||||
@@ -1360,6 +1360,14 @@ test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
|
||||
}
|
||||
);
|
||||
|
||||
test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
|
||||
".add(%i, %i)",
|
||||
(a, b, expected) => {
|
||||
expect(a + b).toBe(expected);
|
||||
},
|
||||
5000
|
||||
);
|
||||
|
||||
test.each`
|
||||
a | b | expected
|
||||
${1} | ${1} | ${2}
|
||||
@@ -1369,6 +1377,15 @@ test.each`
|
||||
expect(a + b).toBe(expected);
|
||||
});
|
||||
|
||||
test.each`
|
||||
a | b | expected
|
||||
${1} | ${1} | ${2}
|
||||
${1} | ${2} | ${3}
|
||||
${2} | ${1} | ${3}
|
||||
`("returns $expected when $a is added $b", ({ a, b, expected }: Case) => {
|
||||
expect(a + b).toBe(expected);
|
||||
}, 5000);
|
||||
|
||||
test.only.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
|
||||
".add(%i, %i)",
|
||||
(a, b, expected) => {
|
||||
|
||||
Vendored
+2
-1
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
|
||||
Vendored
+121
@@ -193,6 +193,17 @@ declare class Router<StateT = any, CustomT = {}> {
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
...middleware: Array<Router.IMiddleware<StateT, CustomT>>
|
||||
): Router<StateT, CustomT>;
|
||||
get<T, U>(
|
||||
name: string,
|
||||
path: string | RegExp,
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
get<T, U>(
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
|
||||
/**
|
||||
* HTTP post method
|
||||
@@ -206,6 +217,17 @@ declare class Router<StateT = any, CustomT = {}> {
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
...middleware: Array<Router.IMiddleware<StateT, CustomT>>
|
||||
): Router<StateT, CustomT>;
|
||||
post<T, U>(
|
||||
name: string,
|
||||
path: string | RegExp,
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
post<T, U>(
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
|
||||
/**
|
||||
* HTTP put method
|
||||
@@ -219,6 +241,17 @@ declare class Router<StateT = any, CustomT = {}> {
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
...middleware: Array<Router.IMiddleware<StateT, CustomT>>
|
||||
): Router<StateT, CustomT>;
|
||||
put<T, U>(
|
||||
name: string,
|
||||
path: string | RegExp,
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
put<T, U>(
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
|
||||
/**
|
||||
* HTTP link method
|
||||
@@ -232,6 +265,17 @@ declare class Router<StateT = any, CustomT = {}> {
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
...middleware: Array<Router.IMiddleware<StateT, CustomT>>
|
||||
): Router<StateT, CustomT>;
|
||||
link<T, U>(
|
||||
name: string,
|
||||
path: string | RegExp,
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
link<T, U>(
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
|
||||
/**
|
||||
* HTTP unlink method
|
||||
@@ -245,6 +289,17 @@ declare class Router<StateT = any, CustomT = {}> {
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
...middleware: Array<Router.IMiddleware<StateT, CustomT>>
|
||||
): Router<StateT, CustomT>;
|
||||
unlink<T, U>(
|
||||
name: string,
|
||||
path: string | RegExp,
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
unlink<T, U>(
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
|
||||
/**
|
||||
* HTTP delete method
|
||||
@@ -258,6 +313,17 @@ declare class Router<StateT = any, CustomT = {}> {
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
...middleware: Array<Router.IMiddleware<StateT, CustomT>>
|
||||
): Router<StateT, CustomT>;
|
||||
delete<T, U>(
|
||||
name: string,
|
||||
path: string | RegExp,
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
delete<T, U>(
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
|
||||
/**
|
||||
* Alias for `router.delete()` because delete is a reserved word
|
||||
@@ -271,6 +337,17 @@ declare class Router<StateT = any, CustomT = {}> {
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
...middleware: Array<Router.IMiddleware<StateT, CustomT>>
|
||||
): Router<StateT, CustomT>;
|
||||
del<T, U>(
|
||||
name: string,
|
||||
path: string | RegExp,
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
del<T, U>(
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
|
||||
/**
|
||||
* HTTP head method
|
||||
@@ -284,6 +361,17 @@ declare class Router<StateT = any, CustomT = {}> {
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
...middleware: Array<Router.IMiddleware<StateT, CustomT>>
|
||||
): Router<StateT, CustomT>;
|
||||
head<T, U>(
|
||||
name: string,
|
||||
path: string | RegExp,
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
head<T, U>(
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
|
||||
/**
|
||||
* HTTP options method
|
||||
@@ -297,6 +385,17 @@ declare class Router<StateT = any, CustomT = {}> {
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
...middleware: Array<Router.IMiddleware<StateT, CustomT>>
|
||||
): Router<StateT, CustomT>;
|
||||
options<T, U>(
|
||||
name: string,
|
||||
path: string | RegExp,
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
options<T, U>(
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
|
||||
/**
|
||||
* HTTP path method
|
||||
@@ -310,6 +409,17 @@ declare class Router<StateT = any, CustomT = {}> {
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
...middleware: Array<Router.IMiddleware<StateT, CustomT>>
|
||||
): Router<StateT, CustomT>;
|
||||
patch<T, U>(
|
||||
name: string,
|
||||
path: string | RegExp,
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
patch<T, U>(
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
|
||||
/**
|
||||
* Register route with all methods.
|
||||
@@ -323,6 +433,17 @@ declare class Router<StateT = any, CustomT = {}> {
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
...middleware: Array<Router.IMiddleware<StateT, CustomT>>
|
||||
): Router<StateT, CustomT>;
|
||||
all<T, U>(
|
||||
name: string,
|
||||
path: string | RegExp,
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
all<T, U>(
|
||||
path: string | RegExp | (string | RegExp)[],
|
||||
middleware: Koa.Middleware<T, U>,
|
||||
routeHandler: Router.IMiddleware<StateT & T, CustomT & U>
|
||||
): Router<StateT & T, CustomT & U>;
|
||||
|
||||
/**
|
||||
* Set the path prefix for a Router instance that was already initialized.
|
||||
|
||||
@@ -125,3 +125,66 @@ app2.use((ctx: Context, next: any) => {
|
||||
});
|
||||
|
||||
app2.listen(8000);
|
||||
|
||||
// Prepending middlewares tests
|
||||
|
||||
type IBlah = { blah: string; }
|
||||
type IWooh = { wooh: string; }
|
||||
|
||||
const router4 = new Router<MyState, MyContext>({prefix: "/users"});
|
||||
|
||||
router4.get('/',
|
||||
(ctx: Koa.ParameterizedContext<IBlah & IWooh>, next) => {
|
||||
ctx.state.blah = "blah";
|
||||
ctx.state.wooh = "wooh";
|
||||
return next();
|
||||
},
|
||||
(ctx, next) => {
|
||||
console.log(ctx.state.blah);
|
||||
console.log(ctx.state.wooh);
|
||||
console.log(ctx.state.foo);
|
||||
ctx.body = 'Hello World!';
|
||||
return next();
|
||||
})
|
||||
|
||||
const middleware1: Koa.Middleware<IBlah> = (ctx, next) => {
|
||||
ctx.state.blah = "blah";
|
||||
}
|
||||
|
||||
const middleware2: Koa.Middleware<IWooh> = (ctx, next) => {
|
||||
ctx.state.wooh = "blah";
|
||||
}
|
||||
|
||||
const emptyMiddleware: Koa.Middleware<{}> = (ctx, next) => {
|
||||
}
|
||||
|
||||
function routeHandler1(ctx: Koa.ParameterizedContext<IWooh>): void {
|
||||
ctx.body = "234";
|
||||
}
|
||||
|
||||
function routeHandler2(ctx: Koa.ParameterizedContext<IBlah>): void {
|
||||
ctx.body = "234";
|
||||
}
|
||||
|
||||
function routeHandler3(ctx: Koa.ParameterizedContext<{}>): void {
|
||||
ctx.body = "234";
|
||||
}
|
||||
|
||||
function routeHandler4(ctx: Router.RouterContext<MyState, MyContext>): void {
|
||||
ctx.body = "234";
|
||||
}
|
||||
|
||||
const middleware3 = compose([middleware1, middleware2]);
|
||||
|
||||
router4.get('/foo', middleware3, routeHandler1);
|
||||
router4.post('/foo', middleware1, routeHandler2);
|
||||
router4.put('/foo', middleware2, routeHandler3);
|
||||
|
||||
router4.patch("foo", '/foo', middleware3, routeHandler1);
|
||||
router4.delete('/foo', middleware1, routeHandler2);
|
||||
router4.head('/foo', middleware2, routeHandler3);
|
||||
|
||||
router4.post('/foo', emptyMiddleware, emptyMiddleware, routeHandler4);
|
||||
router4.post('/foo', emptyMiddleware, emptyMiddleware, emptyMiddleware, routeHandler4);
|
||||
router4.get('name', '/foo', emptyMiddleware, emptyMiddleware, routeHandler4);
|
||||
router4.get('name', '/foo', emptyMiddleware, emptyMiddleware, emptyMiddleware, routeHandler4);
|
||||
Vendored
+7
-3
@@ -626,7 +626,7 @@ export interface PathOptions extends InteractiveLayerOptions {
|
||||
opacity?: number;
|
||||
lineCap?: LineCapShape;
|
||||
lineJoin?: LineJoinShape;
|
||||
dashArray?: string;
|
||||
dashArray?: string | number[];
|
||||
dashOffset?: string;
|
||||
fill?: boolean;
|
||||
fillColor?: string;
|
||||
@@ -1134,14 +1134,15 @@ export interface PopupOptions extends DivOverlayOptions {
|
||||
maxWidth?: number;
|
||||
minWidth?: number;
|
||||
maxHeight?: number;
|
||||
keepInView?: boolean;
|
||||
closeButton?: boolean;
|
||||
autoPan?: boolean;
|
||||
autoPanPaddingTopLeft?: PointExpression;
|
||||
autoPanPaddingBottomRight?: PointExpression;
|
||||
autoPanPadding?: PointExpression;
|
||||
keepInView?: boolean;
|
||||
closeButton?: boolean;
|
||||
autoClose?: boolean;
|
||||
closeOnClick?: boolean;
|
||||
closeOnEscapeKey?: boolean;
|
||||
}
|
||||
|
||||
export type Content = string | HTMLElement;
|
||||
@@ -1534,6 +1535,9 @@ export interface MarkerOptions extends InteractiveLayerOptions {
|
||||
opacity?: number;
|
||||
riseOnHover?: boolean;
|
||||
riseOffset?: number;
|
||||
autoPan?: boolean;
|
||||
autoPanSpeed?: number;
|
||||
autoPanPadding?: PointExpression;
|
||||
}
|
||||
|
||||
export class Marker<P = any> extends Layer {
|
||||
|
||||
@@ -506,7 +506,10 @@ export class MyNewControl extends L.Control {
|
||||
L.marker([1, 2], {
|
||||
icon: L.icon({
|
||||
iconUrl: 'my-icon.png'
|
||||
})
|
||||
}),
|
||||
autoPan: true,
|
||||
autoPanPadding: [10, 20],
|
||||
autoPanSpeed: 5,
|
||||
}).bindPopup('<p>Hi</p>');
|
||||
|
||||
L.marker([1, 2], {
|
||||
|
||||
Vendored
+125
-123
@@ -1,23 +1,127 @@
|
||||
// Type definitions for lru-cache 4.1
|
||||
// Type definitions for lru-cache 5.1
|
||||
// Project: https://github.com/isaacs/node-lru-cache
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export = LRU;
|
||||
declare class LRUCache<K, V> {
|
||||
constructor(options?: LRUCache.Options<K, V>);
|
||||
constructor(max: number);
|
||||
|
||||
declare const LRU: LRU;
|
||||
/**
|
||||
* Return total length of objects in cache taking into account `length` options function.
|
||||
*/
|
||||
readonly length: number;
|
||||
|
||||
interface LRU {
|
||||
<K, V>(opts?: LRU.Options<K, V>): LRU.Cache<K, V>;
|
||||
<K, V>(max: number): LRU.Cache<K, V>;
|
||||
new <K, V>(opts?: LRU.Options<K, V>): LRU.Cache<K, V>;
|
||||
new <K, V>(max: number): LRU.Cache<K, V>;
|
||||
/**
|
||||
* Return total quantity of objects currently in cache. Note,
|
||||
* that `stale` (see options) items are returned as part of this item count.
|
||||
*/
|
||||
readonly itemCount: number;
|
||||
|
||||
/**
|
||||
* Same as Options.allowStale.
|
||||
*/
|
||||
allowStale: boolean;
|
||||
|
||||
/**
|
||||
* Same as Options.length.
|
||||
*/
|
||||
lengthCalculator(value: V): number;
|
||||
|
||||
/**
|
||||
* Same as Options.max. Resizes the cache when the `max` changes.
|
||||
*/
|
||||
max: number;
|
||||
|
||||
/**
|
||||
* Same as Options.maxAge. Resizes the cache when the `maxAge` changes.
|
||||
*/
|
||||
maxAge: number;
|
||||
|
||||
/**
|
||||
* Will update the "recently used"-ness of the key. They do what you think.
|
||||
* `maxAge` is optional and overrides the cache `maxAge` option if provided.
|
||||
*/
|
||||
set(key: K, value: V, maxAge?: number): boolean;
|
||||
|
||||
/**
|
||||
* Will update the "recently used"-ness of the key. They do what you think.
|
||||
* `maxAge` is optional and overrides the cache `maxAge` option if provided.
|
||||
*
|
||||
* If the key is not found, will return `undefined`.
|
||||
*/
|
||||
get(key: K): V | undefined;
|
||||
|
||||
/**
|
||||
* Returns the key value (or `undefined` if not found) without updating
|
||||
* the "recently used"-ness of the key.
|
||||
*
|
||||
* (If you find yourself using this a lot, you might be using the wrong
|
||||
* sort of data structure, but there are some use cases where it's handy.)
|
||||
*/
|
||||
peek(key: K): V | undefined;
|
||||
|
||||
/**
|
||||
* Check if a key is in the cache, without updating the recent-ness
|
||||
* or deleting it for being stale.
|
||||
*/
|
||||
has(key: K): boolean;
|
||||
|
||||
/**
|
||||
* Deletes a key out of the cache.
|
||||
*/
|
||||
del(key: K): void;
|
||||
|
||||
/**
|
||||
* Clear the cache entirely, throwing away all values.
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
/**
|
||||
* Manually iterates over the entire cache proactively pruning old entries.
|
||||
*/
|
||||
prune(): void;
|
||||
|
||||
/**
|
||||
* Just like `Array.prototype.forEach`. Iterates over all the keys in the cache,
|
||||
* in order of recent-ness. (Ie, more recently used items are iterated over first.)
|
||||
*/
|
||||
forEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
|
||||
|
||||
/**
|
||||
* The same as `cache.forEach(...)` but items are iterated over in reverse order.
|
||||
* (ie, less recently used items are iterated over first.)
|
||||
*/
|
||||
rforEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
|
||||
|
||||
/**
|
||||
* Return an array of the keys in the cache.
|
||||
*/
|
||||
keys(): K[];
|
||||
|
||||
/**
|
||||
* Return an array of the values in the cache.
|
||||
*/
|
||||
values(): V[];
|
||||
|
||||
/**
|
||||
* Return an array of the cache entries ready for serialization and usage with `destinationCache.load(arr)`.
|
||||
*/
|
||||
dump(): Array<LRUCache.Entry<K, V>>;
|
||||
|
||||
/**
|
||||
* Loads another cache entries array, obtained with `sourceCache.dump()`,
|
||||
* into the cache. The destination cache is reset before loading new entries
|
||||
*
|
||||
* @param cacheEntries Obtained from `sourceCache.dump()`
|
||||
*/
|
||||
load(cacheEntries: ReadonlyArray<LRUCache.Entry<K, V>>): void;
|
||||
}
|
||||
|
||||
declare namespace LRU {
|
||||
interface Options<K = any, V = any> {
|
||||
declare namespace LRUCache {
|
||||
interface Options<K, V> {
|
||||
/**
|
||||
* The maximum size of the cache, checked by applying the length
|
||||
* function to all values in the cache. Not setting this is kind of silly,
|
||||
@@ -69,123 +173,21 @@ declare namespace LRU {
|
||||
* not when it is overwritten.
|
||||
*/
|
||||
noDisposeOnSet?: boolean;
|
||||
|
||||
/**
|
||||
* When using time-expiring entries with `maxAge`, setting this to `true` will make each
|
||||
* item's effective time update to the current time whenever it is retrieved from cache,
|
||||
* causing it to not expire. (It can still fall out of cache based on recency of use, of
|
||||
* course.)
|
||||
*/
|
||||
updateAgeOnGet?: boolean;
|
||||
}
|
||||
|
||||
interface Cache<K, V> {
|
||||
/**
|
||||
* Return total length of objects in cache taking into account `length` options function.
|
||||
*/
|
||||
readonly length: number;
|
||||
|
||||
/**
|
||||
* Return total quantity of objects currently in cache. Note,
|
||||
* that `stale` (see options) items are returned as part of this item count.
|
||||
*/
|
||||
readonly itemCount: number;
|
||||
|
||||
/**
|
||||
* Same as Options.allowStale.
|
||||
*/
|
||||
allowStale: boolean;
|
||||
|
||||
/**
|
||||
* Same as Options.length.
|
||||
*/
|
||||
lengthCalculator(value: V): number;
|
||||
|
||||
/**
|
||||
* Same as Options.max. Resizes the cache when the `max` changes.
|
||||
*/
|
||||
max: number;
|
||||
|
||||
/**
|
||||
* Same as Options.maxAge. Resizes the cache when the `maxAge` changes.
|
||||
*/
|
||||
maxAge: number;
|
||||
|
||||
/**
|
||||
* Will update the "recently used"-ness of the key. They do what you think.
|
||||
* `maxAge` is optional and overrides the cache `maxAge` option if provided.
|
||||
*/
|
||||
set(key: K, value: V, maxAge?: number): boolean;
|
||||
|
||||
/**
|
||||
* Will update the "recently used"-ness of the key. They do what you think.
|
||||
* `maxAge` is optional and overrides the cache `maxAge` option if provided.
|
||||
*
|
||||
* If the key is not found, will return `undefined`.
|
||||
*/
|
||||
get(key: K): V | undefined;
|
||||
|
||||
/**
|
||||
* Returns the key value (or `undefined` if not found) without updating
|
||||
* the "recently used"-ness of the key.
|
||||
*
|
||||
* (If you find yourself using this a lot, you might be using the wrong
|
||||
* sort of data structure, but there are some use cases where it's handy.)
|
||||
*/
|
||||
peek(key: K): V | undefined;
|
||||
|
||||
/**
|
||||
* Check if a key is in the cache, without updating the recent-ness
|
||||
* or deleting it for being stale.
|
||||
*/
|
||||
has(key: K): boolean;
|
||||
|
||||
/**
|
||||
* Deletes a key out of the cache.
|
||||
*/
|
||||
del(key: K): void;
|
||||
|
||||
/**
|
||||
* Clear the cache entirely, throwing away all values.
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
/**
|
||||
* Manually iterates over the entire cache proactively pruning old entries.
|
||||
*/
|
||||
prune(): void;
|
||||
|
||||
/**
|
||||
* Just like `Array.prototype.forEach`. Iterates over all the keys in the cache,
|
||||
* in order of recent-ness. (Ie, more recently used items are iterated over first.)
|
||||
*/
|
||||
forEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
|
||||
|
||||
/**
|
||||
* The same as `cache.forEach(...)` but items are iterated over in reverse order.
|
||||
* (ie, less recently used items are iterated over first.)
|
||||
*/
|
||||
rforEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
|
||||
|
||||
/**
|
||||
* Return an array of the keys in the cache.
|
||||
*/
|
||||
keys(): K[];
|
||||
|
||||
/**
|
||||
* Return an array of the values in the cache.
|
||||
*/
|
||||
values(): V[];
|
||||
|
||||
/**
|
||||
* Return an array of the cache entries ready for serialization and usage with `destinationCache.load(arr)`.
|
||||
*/
|
||||
dump(): Array<LRUEntry<K, V>>;
|
||||
|
||||
/**
|
||||
* Loads another cache entries array, obtained with `sourceCache.dump()`,
|
||||
* into the cache. The destination cache is reset before loading new entries
|
||||
*
|
||||
* @param cacheEntries Obtained from `sourceCache.dump()`
|
||||
*/
|
||||
load(cacheEntries: ReadonlyArray<LRUEntry<K, V>>): void;
|
||||
}
|
||||
|
||||
interface LRUEntry<K, V> {
|
||||
interface Entry<K, V> {
|
||||
k: K;
|
||||
v: V;
|
||||
e: number;
|
||||
}
|
||||
}
|
||||
|
||||
export = LRUCache;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import LRU = require('lru-cache');
|
||||
import LRUCache = require('lru-cache');
|
||||
|
||||
const num = 1;
|
||||
|
||||
@@ -10,9 +10,9 @@ const foo = {
|
||||
foo() {}
|
||||
};
|
||||
|
||||
const cache = LRU<string, Foo>();
|
||||
cache; // $ExpectType Cache<string, Foo>
|
||||
LRU<string, Foo>({ // $ExpectType Cache<string, Foo>
|
||||
const cache = new LRUCache<string, Foo>();
|
||||
cache; // $ExpectType LRUCache<string, Foo>
|
||||
new LRUCache<string, Foo>({ // $ExpectType LRUCache<string, Foo>
|
||||
max: num,
|
||||
maxAge: num,
|
||||
length(value) {
|
||||
@@ -26,9 +26,9 @@ LRU<string, Foo>({ // $ExpectType Cache<string, Foo>
|
||||
stale: false,
|
||||
noDisposeOnSet: false,
|
||||
});
|
||||
LRU<string, Foo>(num); // $ExpectType Cache<string, Foo>
|
||||
new LRU<string, Foo>(); // $ExpectType Cache<string, Foo>
|
||||
new LRU<string, Foo>({ // $ExpectType Cache<string, Foo>
|
||||
new LRUCache<string, Foo>(num); // $ExpectType LRUCache<string, Foo>
|
||||
new LRUCache<string, Foo>(); // $ExpectType LRUCache<string, Foo>
|
||||
new LRUCache<string, Foo>({ // $ExpectType LRUCache<string, Foo>
|
||||
max: num,
|
||||
maxAge: num,
|
||||
length: (value) => {
|
||||
@@ -38,7 +38,7 @@ new LRU<string, Foo>({ // $ExpectType Cache<string, Foo>
|
||||
stale: false,
|
||||
noDisposeOnSet: false,
|
||||
});
|
||||
new LRU<string, Foo>(num); // $ExpectType Cache<string, Foo>
|
||||
new LRUCache<string, Foo>(num); // $ExpectType LRUCache<string, Foo>
|
||||
|
||||
cache.length; // $ExpectType number
|
||||
cache.length = 1; // $ExpectError
|
||||
@@ -80,26 +80,26 @@ cache.prune();
|
||||
cache.forEach(function(value, key, cache) {
|
||||
value; // $ExpectType Foo
|
||||
key; // $ExpectType string
|
||||
cache; // $ExpectType Cache<string, Foo>
|
||||
this; // $ExpectType Cache<string, Foo>
|
||||
cache; // $ExpectType LRUCache<string, Foo>
|
||||
this; // $ExpectType LRUCache<string, Foo>
|
||||
});
|
||||
cache.forEach(function(value, key, cache) {
|
||||
value; // $ExpectType Foo
|
||||
key; // $ExpectType string
|
||||
cache; // $ExpectType Cache<string, Foo>
|
||||
cache; // $ExpectType LRUCache<string, Foo>
|
||||
this; // $ExpectType { foo(): void; }
|
||||
}, foo);
|
||||
|
||||
cache.rforEach(function(value, key, cache) {
|
||||
value; // $ExpectType Foo
|
||||
key; // $ExpectType string
|
||||
cache; // $ExpectType Cache<string, Foo>
|
||||
this; // $ExpectType Cache<string, Foo>
|
||||
cache; // $ExpectType LRUCache<string, Foo>
|
||||
this; // $ExpectType LRUCache<string, Foo>
|
||||
});
|
||||
cache.rforEach(function(value, key, cache) {
|
||||
value; // $ExpectType Foo
|
||||
key; // $ExpectType string
|
||||
cache; // $ExpectType Cache<string, Foo>
|
||||
cache; // $ExpectType LRUCache<string, Foo>
|
||||
this; // $ExpectType { foo(): void; }
|
||||
}, foo);
|
||||
|
||||
@@ -107,5 +107,5 @@ cache.keys(); // $ExpectType string[]
|
||||
cache.values(); // $ExpectType Foo[]
|
||||
|
||||
const dump = cache.dump();
|
||||
dump; // $ExpectType LRUEntry<string, Foo>[]
|
||||
dump; // $ExpectType Entry<string, Foo>[]
|
||||
cache.load(dump);
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"lru-cache-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
|
||||
Vendored
+191
@@ -0,0 +1,191 @@
|
||||
// Type definitions for lru-cache 4.1
|
||||
// Project: https://github.com/isaacs/node-lru-cache
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export = LRU;
|
||||
|
||||
declare const LRU: LRU;
|
||||
|
||||
interface LRU {
|
||||
<K, V>(opts?: LRU.Options<K, V>): LRU.Cache<K, V>;
|
||||
<K, V>(max: number): LRU.Cache<K, V>;
|
||||
new <K, V>(opts?: LRU.Options<K, V>): LRU.Cache<K, V>;
|
||||
new <K, V>(max: number): LRU.Cache<K, V>;
|
||||
}
|
||||
|
||||
declare namespace LRU {
|
||||
interface Options<K = any, V = any> {
|
||||
/**
|
||||
* The maximum size of the cache, checked by applying the length
|
||||
* function to all values in the cache. Not setting this is kind of silly,
|
||||
* since that's the whole purpose of this lib, but it defaults to `Infinity`.
|
||||
*/
|
||||
max?: number;
|
||||
|
||||
/**
|
||||
* Maximum age in ms. Items are not pro-actively pruned out as they age,
|
||||
* but if you try to get an item that is too old, it'll drop it and return
|
||||
* undefined instead of giving it to you.
|
||||
*/
|
||||
maxAge?: number;
|
||||
|
||||
/**
|
||||
* Function that is used to calculate the length of stored items.
|
||||
* If you're storing strings or buffers, then you probably want to do
|
||||
* something like `function(n, key){return n.length}`. The default
|
||||
* is `function(){return 1}`, which is fine if you want to store
|
||||
* `max` like-sized things. The item is passed as the first argument,
|
||||
* and the key is passed as the second argument.
|
||||
*/
|
||||
length?(value: V, key?: K): number;
|
||||
|
||||
/**
|
||||
* Function that is called on items when they are dropped from the cache.
|
||||
* This can be handy if you want to close file descriptors or do other
|
||||
* cleanup tasks when items are no longer accessible. Called with `key, value`.
|
||||
* It's called before actually removing the item from the internal cache,
|
||||
* so if you want to immediately put it back in, you'll have to do that in
|
||||
* a `nextTick` or `setTimeout` callback or it won't do anything.
|
||||
*/
|
||||
dispose?(key: K, value: V): void;
|
||||
|
||||
/**
|
||||
* By default, if you set a `maxAge`, it'll only actually pull stale items
|
||||
* out of the cache when you `get(key)`. (That is, it's not pre-emptively
|
||||
* doing a `setTimeout` or anything.) If you set `stale:true`, it'll return
|
||||
* the stale value before deleting it. If you don't set this, then it'll
|
||||
* return `undefined` when you try to get a stale entry,
|
||||
* as if it had already been deleted.
|
||||
*/
|
||||
stale?: boolean;
|
||||
|
||||
/**
|
||||
* By default, if you set a `dispose()` method, then it'll be called whenever
|
||||
* a `set()` operation overwrites an existing key. If you set this option,
|
||||
* `dispose()` will only be called when a key falls out of the cache,
|
||||
* not when it is overwritten.
|
||||
*/
|
||||
noDisposeOnSet?: boolean;
|
||||
}
|
||||
|
||||
interface Cache<K, V> {
|
||||
/**
|
||||
* Return total length of objects in cache taking into account `length` options function.
|
||||
*/
|
||||
readonly length: number;
|
||||
|
||||
/**
|
||||
* Return total quantity of objects currently in cache. Note,
|
||||
* that `stale` (see options) items are returned as part of this item count.
|
||||
*/
|
||||
readonly itemCount: number;
|
||||
|
||||
/**
|
||||
* Same as Options.allowStale.
|
||||
*/
|
||||
allowStale: boolean;
|
||||
|
||||
/**
|
||||
* Same as Options.length.
|
||||
*/
|
||||
lengthCalculator(value: V): number;
|
||||
|
||||
/**
|
||||
* Same as Options.max. Resizes the cache when the `max` changes.
|
||||
*/
|
||||
max: number;
|
||||
|
||||
/**
|
||||
* Same as Options.maxAge. Resizes the cache when the `maxAge` changes.
|
||||
*/
|
||||
maxAge: number;
|
||||
|
||||
/**
|
||||
* Will update the "recently used"-ness of the key. They do what you think.
|
||||
* `maxAge` is optional and overrides the cache `maxAge` option if provided.
|
||||
*/
|
||||
set(key: K, value: V, maxAge?: number): boolean;
|
||||
|
||||
/**
|
||||
* Will update the "recently used"-ness of the key. They do what you think.
|
||||
* `maxAge` is optional and overrides the cache `maxAge` option if provided.
|
||||
*
|
||||
* If the key is not found, will return `undefined`.
|
||||
*/
|
||||
get(key: K): V | undefined;
|
||||
|
||||
/**
|
||||
* Returns the key value (or `undefined` if not found) without updating
|
||||
* the "recently used"-ness of the key.
|
||||
*
|
||||
* (If you find yourself using this a lot, you might be using the wrong
|
||||
* sort of data structure, but there are some use cases where it's handy.)
|
||||
*/
|
||||
peek(key: K): V | undefined;
|
||||
|
||||
/**
|
||||
* Check if a key is in the cache, without updating the recent-ness
|
||||
* or deleting it for being stale.
|
||||
*/
|
||||
has(key: K): boolean;
|
||||
|
||||
/**
|
||||
* Deletes a key out of the cache.
|
||||
*/
|
||||
del(key: K): void;
|
||||
|
||||
/**
|
||||
* Clear the cache entirely, throwing away all values.
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
/**
|
||||
* Manually iterates over the entire cache proactively pruning old entries.
|
||||
*/
|
||||
prune(): void;
|
||||
|
||||
/**
|
||||
* Just like `Array.prototype.forEach`. Iterates over all the keys in the cache,
|
||||
* in order of recent-ness. (Ie, more recently used items are iterated over first.)
|
||||
*/
|
||||
forEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
|
||||
|
||||
/**
|
||||
* The same as `cache.forEach(...)` but items are iterated over in reverse order.
|
||||
* (ie, less recently used items are iterated over first.)
|
||||
*/
|
||||
rforEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
|
||||
|
||||
/**
|
||||
* Return an array of the keys in the cache.
|
||||
*/
|
||||
keys(): K[];
|
||||
|
||||
/**
|
||||
* Return an array of the values in the cache.
|
||||
*/
|
||||
values(): V[];
|
||||
|
||||
/**
|
||||
* Return an array of the cache entries ready for serialization and usage with `destinationCache.load(arr)`.
|
||||
*/
|
||||
dump(): Array<LRUEntry<K, V>>;
|
||||
|
||||
/**
|
||||
* Loads another cache entries array, obtained with `sourceCache.dump()`,
|
||||
* into the cache. The destination cache is reset before loading new entries
|
||||
*
|
||||
* @param cacheEntries Obtained from `sourceCache.dump()`
|
||||
*/
|
||||
load(cacheEntries: ReadonlyArray<LRUEntry<K, V>>): void;
|
||||
}
|
||||
|
||||
interface LRUEntry<K, V> {
|
||||
k: K;
|
||||
v: V;
|
||||
e: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
import LRU = require('lru-cache');
|
||||
|
||||
const num = 1;
|
||||
|
||||
interface Foo {
|
||||
foo(): void;
|
||||
}
|
||||
|
||||
const foo = {
|
||||
foo() {}
|
||||
};
|
||||
|
||||
const cache = LRU<string, Foo>();
|
||||
cache; // $ExpectType Cache<string, Foo>
|
||||
LRU<string, Foo>({ // $ExpectType Cache<string, Foo>
|
||||
max: num,
|
||||
maxAge: num,
|
||||
length(value) {
|
||||
value; // $ExpectType Foo
|
||||
return num;
|
||||
},
|
||||
dispose(key, value) {
|
||||
key; // $ExpectType string
|
||||
value; // $ExpectType Foo
|
||||
},
|
||||
stale: false,
|
||||
noDisposeOnSet: false,
|
||||
});
|
||||
LRU<string, Foo>(num); // $ExpectType Cache<string, Foo>
|
||||
new LRU<string, Foo>(); // $ExpectType Cache<string, Foo>
|
||||
new LRU<string, Foo>({ // $ExpectType Cache<string, Foo>
|
||||
max: num,
|
||||
maxAge: num,
|
||||
length: (value) => {
|
||||
return num;
|
||||
},
|
||||
dispose: (key, value) => {},
|
||||
stale: false,
|
||||
noDisposeOnSet: false,
|
||||
});
|
||||
new LRU<string, Foo>(num); // $ExpectType Cache<string, Foo>
|
||||
|
||||
cache.length; // $ExpectType number
|
||||
cache.length = 1; // $ExpectError
|
||||
|
||||
cache.itemCount; // $ExpectType number
|
||||
cache.itemCount = 1; // $ExpectError
|
||||
|
||||
cache.allowStale; // $ExpectType boolean
|
||||
cache.allowStale = true;
|
||||
|
||||
cache.lengthCalculator; // $ExpectType (value: Foo) => number
|
||||
cache.lengthCalculator = () => 1;
|
||||
|
||||
cache.max; // $ExpectType number
|
||||
cache.max = 1;
|
||||
|
||||
cache.maxAge; // $ExpectType number
|
||||
cache.maxAge = 1;
|
||||
|
||||
cache.set('foo', foo); // $ExpectType boolean
|
||||
cache.set(1, foo); // $ExpectError
|
||||
cache.set('foo', 1); // $ExpectError
|
||||
|
||||
cache.get('foo'); // $ExpectType Foo | undefined
|
||||
cache.get(1); // $ExpectError
|
||||
|
||||
cache.peek('foo'); // $ExpectType Foo | undefined
|
||||
cache.peek(1); // $ExpectError
|
||||
|
||||
cache.has('foo'); // $ExpectType boolean
|
||||
cache.has(1); // $ExpectError
|
||||
|
||||
cache.del('foo');
|
||||
cache.del(1); // $ExpectError
|
||||
|
||||
cache.reset();
|
||||
cache.prune();
|
||||
|
||||
cache.forEach(function(value, key, cache) {
|
||||
value; // $ExpectType Foo
|
||||
key; // $ExpectType string
|
||||
cache; // $ExpectType Cache<string, Foo>
|
||||
this; // $ExpectType Cache<string, Foo>
|
||||
});
|
||||
cache.forEach(function(value, key, cache) {
|
||||
value; // $ExpectType Foo
|
||||
key; // $ExpectType string
|
||||
cache; // $ExpectType Cache<string, Foo>
|
||||
this; // $ExpectType { foo(): void; }
|
||||
}, foo);
|
||||
|
||||
cache.rforEach(function(value, key, cache) {
|
||||
value; // $ExpectType Foo
|
||||
key; // $ExpectType string
|
||||
cache; // $ExpectType Cache<string, Foo>
|
||||
this; // $ExpectType Cache<string, Foo>
|
||||
});
|
||||
cache.rforEach(function(value, key, cache) {
|
||||
value; // $ExpectType Foo
|
||||
key; // $ExpectType string
|
||||
cache; // $ExpectType Cache<string, Foo>
|
||||
this; // $ExpectType { foo(): void; }
|
||||
}, foo);
|
||||
|
||||
cache.keys(); // $ExpectType string[]
|
||||
cache.values(); // $ExpectType Foo[]
|
||||
|
||||
const dump = cache.dump();
|
||||
dump; // $ExpectType LRUEntry<string, Foo>[]
|
||||
cache.load(dump);
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"lru-cache": ["lru-cache/v4"]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"lru-cache-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-empty-interface": false
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1774,7 +1774,7 @@ declare namespace MangoPay {
|
||||
/**
|
||||
* This is the URL where to redirect users to proceed to 3D secure validation
|
||||
*/
|
||||
SecureModeRedirectUrl: string;
|
||||
SecureModeRedirectURL: string;
|
||||
|
||||
/**
|
||||
* This is the URL where users are automatically redirected after 3D secure validation (if activated)
|
||||
@@ -2596,7 +2596,7 @@ declare namespace MangoPay {
|
||||
/**
|
||||
* This is the URL where to redirect users to proceed to 3D secure validation
|
||||
*/
|
||||
SecureModeRedirectUrl: string;
|
||||
SecureModeRedirectURL: string;
|
||||
}
|
||||
|
||||
interface CreateCardDirectPayIn {
|
||||
|
||||
@@ -4227,7 +4227,7 @@ function wrapState(ComposedComponent: ComponentClass<__MaterialUI.List.Selectabl
|
||||
};
|
||||
}
|
||||
|
||||
const SelectableList = wrapState(makeSelectable(List));
|
||||
const SelectableList = wrapState(makeSelectable<{}>(List));
|
||||
|
||||
const ListExampleSelectable = () => (
|
||||
<Paper>
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"lru-cache": ["lru-cache/v4"]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
+1
@@ -65,6 +65,7 @@ declare module "meteor/universe:i18n" {
|
||||
|
||||
// events
|
||||
function onChangeLocale(callback: (locale: string) => void): void;
|
||||
function offChangeLocale(callback: (locale: string) => void): void;
|
||||
}
|
||||
|
||||
interface ReactComponentProps {
|
||||
|
||||
Vendored
+111
-89
@@ -18,6 +18,7 @@
|
||||
// Emmanuel Gautier <https://github.com/emmanuelgautier>
|
||||
// Frontend Monster <https://github.com/frontendmonster>
|
||||
// Ming Chen <https://github.com/mingchen>
|
||||
// Olga Isakova <https://github.com/penumbra1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -1060,12 +1061,25 @@ declare module "mongoose" {
|
||||
validateBeforeSave?: boolean;
|
||||
/** defaults to "__v" */
|
||||
versionKey?: string | boolean;
|
||||
/**
|
||||
* By default, Mongoose will automatically
|
||||
* select() any populated paths.
|
||||
* To opt out, set selectPopulatedPaths to false.
|
||||
*/
|
||||
selectPopulatedPaths?: boolean;
|
||||
/**
|
||||
* skipVersioning allows excluding paths from
|
||||
* versioning (the internal revision will not be
|
||||
* incremented even if these paths are updated).
|
||||
*/
|
||||
skipVersioning?: any;
|
||||
/**
|
||||
* Validation errors in a single nested schema are reported
|
||||
* both on the child and on the parent schema.
|
||||
* Set storeSubdocValidationError to false on the child schema
|
||||
* to make Mongoose only report the parent error.
|
||||
*/
|
||||
storeSubdocValidationError?: boolean;
|
||||
/**
|
||||
* If set timestamps, mongoose assigns createdAt
|
||||
* and updatedAt fields to your schema, the type
|
||||
@@ -1722,6 +1736,9 @@ declare module "mongoose" {
|
||||
* If later in the query chain a method returns Query<T>, we will need to know type T.
|
||||
* So we save this type as the second type parameter in DocumentQuery. Since people have
|
||||
* been using Query<T>, we set it as an alias of DocumentQuery.
|
||||
*
|
||||
* Furthermore, Query<T> is used for function that has an option { rawResult: true }.
|
||||
* for instance findOneAndUpdate.
|
||||
*/
|
||||
class Query<T> extends DocumentQuery<T, any> { }
|
||||
class DocumentQuery<T, DocType extends Document, QueryHelpers = {}> extends mquery {
|
||||
@@ -1864,7 +1881,7 @@ declare module "mongoose" {
|
||||
equals<T>(val: T): this;
|
||||
|
||||
/** Executes the query */
|
||||
exec(callback?: (err: any, res: T) => void): Promise<T>;
|
||||
exec(callback?: (err: NativeError, res: T) => void): Promise<T>;
|
||||
exec(operation: string | Function, callback?: (err: any, res: T) => void): Promise<T>;
|
||||
|
||||
/** Specifies an $exists condition */
|
||||
@@ -1895,10 +1912,16 @@ declare module "mongoose" {
|
||||
* Issues a mongodb findAndModify remove command.
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the
|
||||
* callback. Executes immediately if callback is passed.
|
||||
*
|
||||
* If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify().
|
||||
* https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*/
|
||||
findOneAndRemove(callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any,
|
||||
callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: { rawResult: true } & QueryFindOneAndRemoveOptions,
|
||||
callback?: (error: any, doc: mongodb.FindAndModifyWriteOpResultObject<DocType | null>, result: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<DocType | null>> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: QueryFindOneAndRemoveOptions,
|
||||
callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
|
||||
@@ -1906,6 +1929,9 @@ declare module "mongoose" {
|
||||
* Issues a mongodb findAndModify update command.
|
||||
* Finds a matching document, updates it according to the update arg, passing any options, and returns
|
||||
* the found document (if any) to the callback. The query executes immediately if callback is passed.
|
||||
*
|
||||
* If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify().
|
||||
* https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*/
|
||||
findOneAndUpdate(callback?: (err: any, doc: DocType | null) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndUpdate(update: any,
|
||||
@@ -1913,8 +1939,15 @@ declare module "mongoose" {
|
||||
findOneAndUpdate(query: any, update: any,
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndUpdate(query: any, update: any,
|
||||
options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType, res: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
options: { rawResult: true } & { upsert: true } & { new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<DocType>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<DocType>> & QueryHelpers;
|
||||
findOneAndUpdate(query: any, update: any,
|
||||
options: { upsert: true } & { new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType, res: any) => void): DocumentQuery<DocType, DocType> & QueryHelpers;
|
||||
findOneAndUpdate(query: any, update: any, options: { rawResult: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<DocType | null>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<DocType | null>> & QueryHelpers;
|
||||
findOneAndUpdate(query: any, update: any, options: QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
|
||||
@@ -2238,12 +2271,21 @@ declare module "mongoose" {
|
||||
class mquery { }
|
||||
|
||||
interface QueryFindOneAndRemoveOptions {
|
||||
/** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */
|
||||
/**
|
||||
* if multiple docs are found by the conditions, sets the sort order to choose
|
||||
* which doc to update
|
||||
*/
|
||||
sort?: any;
|
||||
/** puts a time limit on the query - requires mongodb >= 2.6.0 */
|
||||
maxTimeMS?: number;
|
||||
/** if true, passes the raw result from the MongoDB driver as the third callback parameter */
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
/** like select, it determines which fields to return */
|
||||
projection?: any;
|
||||
/** if true, returns the raw result from the MongoDB driver */
|
||||
rawResult?: boolean;
|
||||
/** overwrites the schema's strict mode option for this update */
|
||||
strict?: boolean|string;
|
||||
}
|
||||
|
||||
interface QueryFindOneAndUpdateOptions extends QueryFindOneAndRemoveOptions {
|
||||
@@ -2251,8 +2293,6 @@ declare module "mongoose" {
|
||||
new?: boolean;
|
||||
/** creates the object if it doesn't exist. defaults to false. */
|
||||
upsert?: boolean;
|
||||
/** Field selection. Equivalent to .select(fields).findOneAndUpdate() */
|
||||
fields?: any | string;
|
||||
/** if true, runs update validators on this command. Update validators validate the update operation against the model's schema. */
|
||||
runValidators?: boolean;
|
||||
/**
|
||||
@@ -2270,6 +2310,8 @@ declare module "mongoose" {
|
||||
* Turn on this option to aggregate all the cast errors.
|
||||
*/
|
||||
multipleCastError?: boolean;
|
||||
/** Field selection. Equivalent to .select(fields).findOneAndUpdate() */
|
||||
fields?: any | string;
|
||||
}
|
||||
|
||||
interface QueryUpdateOptions extends ModelUpdateOptions {
|
||||
@@ -2998,17 +3040,21 @@ declare module "mongoose" {
|
||||
* findByIdAndRemove(id, ...) is equivalent to findOneAndRemove({ _id: id }, ...).
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the callback.
|
||||
* Executes immediately if callback is passed, else a Query object is returned.
|
||||
*
|
||||
* If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify().
|
||||
* https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*
|
||||
* Note: same signatures as findByIdAndDelete
|
||||
*
|
||||
* @param id value of _id to query by
|
||||
*/
|
||||
findByIdAndRemove(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndRemove(id: any | number | string,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndRemove(id: any | number | string, options: {
|
||||
/** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */
|
||||
sort?: any;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndRemove(id: any | number | string, options: QueryFindOneAndRemoveOptions,
|
||||
callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject<T | null>) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findByIdAndRemove(id: any | number | string, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
|
||||
/**
|
||||
@@ -3016,31 +3062,44 @@ declare module "mongoose" {
|
||||
* findByIdAndDelete(id, ...) is equivalent to findByIdAndDelete({ _id: id }, ...).
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the callback.
|
||||
* Executes immediately if callback is passed, else a Query object is returned.
|
||||
*
|
||||
* Note: same signatures as findByIdAndRemove
|
||||
*
|
||||
* @param id value of _id to query by
|
||||
*/
|
||||
findByIdAndDelete(): DocumentQuery<T | null, T>;
|
||||
findByIdAndDelete(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndDelete(id: any | number | string,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndDelete(id: any | number | string, options: {
|
||||
/** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */
|
||||
sort?: any;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndDelete(id: any | number | string, options: QueryFindOneAndRemoveOptions,
|
||||
callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject<T | null>) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findByIdAndDelete(id: any | number | string, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...)
|
||||
* is equivalent to findOneAndUpdate({ _id: id }, ...).
|
||||
*
|
||||
* If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify().
|
||||
* https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*
|
||||
* @param id value of _id to query by
|
||||
*/
|
||||
findByIdAndUpdate(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: { upsert: true, new: true } & ModelFindByIdAndUpdateOptions,
|
||||
options: { rawResult: true } & { upsert: true } & { new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, res: T) => void): DocumentQuery<T, T> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: ModelFindByIdAndUpdateOptions,
|
||||
options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject<T>) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T>> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: { rawResult : true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject<T | null>) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
@@ -3059,62 +3118,62 @@ declare module "mongoose" {
|
||||
* Issue a mongodb findAndModify remove command.
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the callback.
|
||||
* Executes immediately if callback is passed else a Query object is returned.
|
||||
*
|
||||
* If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify().
|
||||
* https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*
|
||||
* Note: same signatures as findOneAndDelete
|
||||
*
|
||||
*/
|
||||
findOneAndRemove(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: {
|
||||
/**
|
||||
* if multiple docs are found by the conditions, sets the sort order to choose
|
||||
* which doc to update
|
||||
*/
|
||||
sort?: any;
|
||||
/** puts a time limit on the query - requires mongodb >= 2.6.0 */
|
||||
maxTimeMS?: number;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: { rawResult: true } & QueryFindOneAndRemoveOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<T | null>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findOneAndDelete command.
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the
|
||||
* callback. Executes immediately if callback is passed.
|
||||
*
|
||||
* Note: same signatures as findOneAndRemove
|
||||
*
|
||||
*/
|
||||
findOneAndDelete(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndDelete(conditions: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndDelete(conditions: any, options: {
|
||||
/**
|
||||
* if multiple docs are found by the conditions, sets the sort order to choose
|
||||
* which doc to update
|
||||
*/
|
||||
sort?: any;
|
||||
/** puts a time limit on the query - requires mongodb >= 2.6.0 */
|
||||
maxTimeMS?: number;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
/** like select, it determines which fields to return */
|
||||
projection?: any;
|
||||
/** if true, returns the raw result from the MongoDB driver */
|
||||
rawResult?: boolean;
|
||||
/** overwrites the schema's strict mode option for this update */
|
||||
strict?: boolean|string;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndDelete(conditions: any, options: { rawResult: true } & QueryFindOneAndRemoveOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<T | null>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findOneAndDelete(conditions: any, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findAndModify update command.
|
||||
* Finds a matching document, updates it according to the update arg, passing any options,
|
||||
* and returns the found document (if any) to the callback. The query executes immediately
|
||||
* if callback is passed else a Query object is returned.
|
||||
*
|
||||
+ * If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than the deprecated findAndModify().
|
||||
+ * https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*/
|
||||
findOneAndUpdate(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: { upsert: true, new: true } & ModelFindOneAndUpdateOptions,
|
||||
options: { rawResult : true } & { upsert: true, new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<T>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T>> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: T, res: any) => void): DocumentQuery<T, T> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: ModelFindOneAndUpdateOptions,
|
||||
options: { rawResult: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<T | null>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
@@ -3308,43 +3367,6 @@ declare module "mongoose" {
|
||||
session?: ClientSession | null;
|
||||
}
|
||||
|
||||
interface ModelFindByIdAndUpdateOptions extends ModelOptions {
|
||||
/** true to return the modified document rather than the original. defaults to false */
|
||||
new?: boolean;
|
||||
/** creates the object if it doesn't exist. defaults to false. */
|
||||
upsert?: boolean;
|
||||
/**
|
||||
* if true, runs update validators on this command. Update validators validate the
|
||||
* update operation against the model's schema.
|
||||
*/
|
||||
runValidators?: boolean;
|
||||
/**
|
||||
* if this and upsert are true, mongoose will apply the defaults specified in the model's
|
||||
* schema if a new document is created. This option only works on MongoDB >= 2.4 because
|
||||
* it relies on MongoDB's $setOnInsert operator.
|
||||
*/
|
||||
setDefaultsOnInsert?: boolean;
|
||||
/** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */
|
||||
sort?: any;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
/** if true, passes the raw result from the MongoDB driver as the third callback parameter */
|
||||
rawResult?: boolean;
|
||||
/** overwrites the schema's strict mode option for this update */
|
||||
strict?: boolean;
|
||||
/** The context option lets you set the value of this in update validators to the underlying query. */
|
||||
context?: string;
|
||||
}
|
||||
|
||||
interface ModelFindOneAndUpdateOptions extends ModelFindByIdAndUpdateOptions {
|
||||
/** Field selection. Equivalent to .select(fields).findOneAndUpdate() */
|
||||
fields?: any | string;
|
||||
/** puts a time limit on the query - requires mongodb >= 2.6.0 */
|
||||
maxTimeMS?: number;
|
||||
/** if true, passes the raw result from the MongoDB driver as the third callback parameter */
|
||||
rawResult?: boolean;
|
||||
}
|
||||
|
||||
interface ModelPopulateOptions {
|
||||
/** space delimited path(s) to populate */
|
||||
path: string;
|
||||
|
||||
@@ -1021,7 +1021,7 @@ query.findOne(function (err, res) {
|
||||
query.findOneAndRemove({name: 'aa'}, {
|
||||
rawResult: true
|
||||
}, function (err, doc) {
|
||||
doc.execPopulate();
|
||||
doc.lastErrorObject
|
||||
}).findOneAndRemove();
|
||||
query.findOneAndUpdate({name: 'aa'}, {name: 'bb'}, {
|
||||
|
||||
@@ -1911,6 +1911,14 @@ LocModel.findOneAndUpdate().exec().then(function (arg) {
|
||||
arg.openingTimes;
|
||||
}
|
||||
});
|
||||
LocModel.findOneAndUpdate(
|
||||
// find a document with that filter
|
||||
{name: "aa"},
|
||||
// document to insert when nothing was found
|
||||
{ $set: {name: "bb"} },
|
||||
// options
|
||||
{upsert: true, new: true, runValidators: true,
|
||||
rawResult: true, multipleCastError: true });
|
||||
LocModel.geoSearch({}, {
|
||||
near: [1, 2],
|
||||
maxDistance: 22
|
||||
|
||||
Vendored
+63
@@ -0,0 +1,63 @@
|
||||
// Type definitions for mumath 3.3
|
||||
// Project: https://github.com/dfcreative/mumath
|
||||
// Definitions by: Adam Zerella <https://github.com/adamzerella>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.3
|
||||
|
||||
/**
|
||||
* Detects proper clamp min/max.
|
||||
*/
|
||||
export function clamp(value: number, left: number, right: number): number;
|
||||
|
||||
/**
|
||||
* Get closest value out of a set.
|
||||
*/
|
||||
export function closest(value: number, list: number[]): number;
|
||||
|
||||
/**
|
||||
* Check if one number is multiple of other
|
||||
* Same as a % b === 0, but with precision check.
|
||||
*/
|
||||
export function isMultiple(a: number, b: number, eps?: number): boolean;
|
||||
|
||||
/**
|
||||
* Return quadratic length of a vector.
|
||||
*/
|
||||
export function len(a: number, b: number): number;
|
||||
|
||||
/**
|
||||
* Return value interpolated between x and y.
|
||||
*/
|
||||
export function lerp(x: number, y: number, ratio: number): number;
|
||||
|
||||
/**
|
||||
* An enhanced mod-loop, like fmod — loops value within a frame.
|
||||
*/
|
||||
export function mod(value: number, max: number, min?: number): number;
|
||||
|
||||
/**
|
||||
* Get order of magnitude for a number.
|
||||
*/
|
||||
export function order(value: number): number;
|
||||
|
||||
/**
|
||||
* Get precision from float:
|
||||
*/
|
||||
export function precision(value: number): number;
|
||||
|
||||
/**
|
||||
* Rounds value to optional step.
|
||||
*/
|
||||
export function round(value: number, step?: number): number;
|
||||
|
||||
/**
|
||||
* Get first scale out of a list of basic scales, aligned to the power. E. g.
|
||||
* step(.37, [1, 2, 5]) → .5 step(456, [1, 2]) → 1000
|
||||
* Similar to closest, but takes all possible powers of scales.
|
||||
*/
|
||||
export function scale(value: number, list: number[]): number;
|
||||
|
||||
/**
|
||||
* Whether element is between left & right, including.
|
||||
*/
|
||||
export function within(value: number, left: number, right: number): number;
|
||||
@@ -0,0 +1,25 @@
|
||||
import * as mumath from "mumath";
|
||||
|
||||
mumath.clamp(1, 2, 3);
|
||||
|
||||
mumath.closest(5, [1, 7, 3, 6, 10]);
|
||||
|
||||
mumath.isMultiple(5, 10, 1.000074);
|
||||
mumath.isMultiple(5, 10);
|
||||
|
||||
mumath.len(15, 1.0);
|
||||
|
||||
mumath.lerp(1, 2, 3);
|
||||
|
||||
mumath.mod(1, 2, 3);
|
||||
mumath.mod(1, 2);
|
||||
|
||||
mumath.order(5);
|
||||
|
||||
mumath.precision(5.0000001);
|
||||
|
||||
mumath.round(0.3, 0.5);
|
||||
|
||||
mumath.scale(5.93, [1.0, 35, 10, 7.135]);
|
||||
|
||||
mumath.within(5, 1, 10);
|
||||
@@ -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",
|
||||
"mumath-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -12,6 +12,9 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"lru-cache": [ "lru-cache/v4" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
@@ -6,6 +6,8 @@ import randomBrowser = require('nanoid/random-browser');
|
||||
import url = require('nanoid/url');
|
||||
import nanoidAsync = require('nanoid/async');
|
||||
import nanoidAsyncBrowser = require('nanoid/async-browser');
|
||||
import nanoidNonSecure = require('nanoid/non-secure');
|
||||
import generateNonSecure = require('nanoid/non-secure/generate');
|
||||
|
||||
const _random = (size: number) => [1, 2, 3, 4];
|
||||
|
||||
@@ -22,5 +24,9 @@ nanoidAsync(null, (error, id) => {
|
||||
});
|
||||
nanoidAsyncBrowser().then((id) => console.log(id));
|
||||
nanoidAsyncBrowser(10).then((id) => console.log(id));
|
||||
nanoidNonSecure();
|
||||
nanoidNonSecure(10);
|
||||
generateNonSecure('0123456789абвгдеё', 5);
|
||||
generateNonSecure('0123456789абвгдеё');
|
||||
|
||||
console.log(url);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user